Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 151 lines (118 sloc) 3.033 kB
1e1e343 - restructured phpize
Jan Lehnardt authored
1 #!/bin/sh
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
2
1e1e343 - restructured phpize
Jan Lehnardt authored
3 # Variable declaration
fbc947f * generate pear scripts properly with configure
Stig Bakken authored
4 prefix='@prefix@'
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
5 phpdir="$prefix/lib/php/build"
24e9621 - Fix phpize
Derick Rethans authored
6 includedir="$prefix/include/php"
5989ae5 Fix building external extensions.
Sascha Schumann authored
7 builddir="`pwd`"
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-c…
foobar authored
8
480a3b0 - Changed phpize not to require automake and libtool.
foobar authored
9 FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
10 FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh"
11 CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-c…
foobar authored
12 mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
5264cfb - Remove also autom4te.cache dir with phpize --clean
foobar authored
13 aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
8fec4cc Missing "confdefs.h" in the cleanup-files-list
foobar authored
14 config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h"
5989ae5 Fix building external extensions.
Sascha Schumann authored
15
1e1e343 - restructured phpize
Jan Lehnardt authored
16 # function declaration
17 phpize_usage()
18 {
19 echo "Usage: $0 [--clean|--help|--version|-v]"
20 }
21
22 phpize_no_configm4()
23 {
24 if test $@ -eq 1; then
25 clean=" --clean"
26 fi
27
28 echo "Cannot find config.m4. "
29 echo "Make sure that you run '$0$clean' in the top level source directory of the module"
30 echo
31 }
32
33 phpize_clean()
34 {
35 echo "Cleaning.."
36 for i in $CLEAN_FILES; do
37 test -e $i && rm -rf $i
38 done
39 }
40
41 phpize_check_configm4()
42 {
43 if test ! -r config.m4; then
44 phpize_no_configm4 $@
45 exit 1
46 fi
47
48 }
49
50 phpize_get_api_numbers()
51 {
52 # extracting API NOs:
53 PHP_API_VERSION=`egrep '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
54 ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
55 ZEND_EXTENSION_API_NO=`egrep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
56 }
57
58 phpize_print_api_numbers()
59 {
60 phpize_get_api_numbers
61 echo "Configuring for:"
62 echo "PHP Api Version: "$PHP_API_VERSION
63 echo "Zend Module Api No: "$ZEND_MODULE_API_NO
64 echo "Zend Extension Api No: "$ZEND_EXTENSION_API_NO
65 }
66
67 phpize_no_shtool()
68 {
69 echo <<EOF
70 shtool at '$builddir/build/shtool' not executable.
71 Make sure that the file exists and is executable and then rerun this script.
72
73 EOF
74 }
75
76 phpize_check_shtool()
77 {
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
78 test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
1e1e343 - restructured phpize
Jan Lehnardt authored
79
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
80 if test ! -x "$builddir/build/shtool"; then
1e1e343 - restructured phpize
Jan Lehnardt authored
81 phpize_no_shtool
82 exit 1
83 fi
84 }
85
86
87 phpize_copy_files()
88 {
89 test -d build || mkdir build
90
536e744 - do it right (phpize path issue)
Jan Lehnardt authored
91 (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
92 (cd "$phpdir" && cp $FILES "$builddir")
1e1e343 - restructured phpize
Jan Lehnardt authored
93 }
94
95 phpize_replace_prefix()
96 {
97 sed \
98 -e "s#@prefix@#$prefix#" \
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
99 < "$phpdir/phpize.m4" > configure.in
1e1e343 - restructured phpize
Jan Lehnardt authored
100 }
101
102 phpize_autotools()
103 {
480a3b0 - Changed phpize not to require automake and libtool.
foobar authored
104 cat acinclude.m4 ./build/libtool.m4 > aclocal.m4 || exit 1
1e1e343 - restructured phpize
Jan Lehnardt authored
105 autoconf || exit 1
106 autoheader || exit 1
107 }
108
109 # Main script
110
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
111 case "$1" in
112 # Cleanup
063e4e2 Added --help to phpize
foobar authored
113 --clean)
1e1e343 - restructured phpize
Jan Lehnardt authored
114 phpize_check_configm4 1
115 phpize_clean
116 exit 0
063e4e2 Added --help to phpize
foobar authored
117 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
118
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
119 # Usage
063e4e2 Added --help to phpize
foobar authored
120 --help)
1e1e343 - restructured phpize
Jan Lehnardt authored
121 phpize_usage
122 exit 0
063e4e2 Added --help to phpize
foobar authored
123 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
124
125 # Version
126 --version|-v)
127 phpize_print_api_numbers
128 exit 0
129 ;;
130
131 # Default
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
132 *)
1e1e343 - restructured phpize
Jan Lehnardt authored
133 phpize_check_configm4 0
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-c…
foobar authored
134
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
135 phpize_print_api_numbers
136
1e1e343 - restructured phpize
Jan Lehnardt authored
137 phpize_copy_files
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
138
1e1e343 - restructured phpize
Jan Lehnardt authored
139 phpize_replace_prefix
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
140
1e1e343 - restructured phpize
Jan Lehnardt authored
141 touch install-sh mkinstalldirs missing
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
142
1e1e343 - restructured phpize
Jan Lehnardt authored
143 phpize_autotools
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
144
1e1e343 - restructured phpize
Jan Lehnardt authored
145 phpize_check_shtool
146
147 ;;
148 esac
149
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
150 exit 0
Something went wrong with that request. Please try again.