Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 191 lines (153 sloc) 4.142 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@'
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
5 exec_prefix="`eval echo @exec_prefix@`"
6 phpdir="`eval echo @libdir@`/build"
7 includedir="`eval echo @includedir@`/php"
5989ae5 Fix building external extensions.
Sascha Schumann authored
8 builddir="`pwd`"
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-conf...
foobar authored
9
480a3b0 - Changed phpize not to require automake and libtool.
foobar authored
10 FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
ee5fd96 - Made it possible to do "make test" for phpized extensions
foobar authored
11 FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh run-tests*.php"
480a3b0 - Changed phpize not to require automake and libtool.
foobar authored
12 CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
f6c1212 - Cleanup test output files too
foobar authored
13 mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
5264cfb - Remove also autom4te.cache dir with phpize --clean
foobar authored
14 aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
ee5fd96 - Made it possible to do "make test" for phpized extensions
foobar authored
15 config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
da629d8 more test output files
foobar authored
16 run-tests*.php tests/*.diff tests/*.exp tests/*.log tests/*.out tests/*.php"
5989ae5 Fix building external extensions.
Sascha Schumann authored
17
1e1e343 - restructured phpize
Jan Lehnardt authored
18 # function declaration
19 phpize_usage()
20 {
21 echo "Usage: $0 [--clean|--help|--version|-v]"
22 }
23
24 phpize_no_configm4()
25 {
26 if test $@ -eq 1; then
27 clean=" --clean"
28 fi
29
30 echo "Cannot find config.m4. "
31 echo "Make sure that you run '$0$clean' in the top level source directory of the module"
32 echo
33 }
34
35 phpize_clean()
36 {
37 echo "Cleaning.."
38 for i in $CLEAN_FILES; do
98f245e Fix cleanup
foobar authored
39 if test -f "$i"; then
40 rm -f $i
41 elif test -d "$i"; then
42 rm -rf $i
43 fi
1e1e343 - restructured phpize
Jan Lehnardt authored
44 done
45 }
46
47 phpize_check_configm4()
48 {
49 if test ! -r config.m4; then
50 phpize_no_configm4 $@
51 exit 1
52 fi
53
54 }
55
56 phpize_get_api_numbers()
57 {
58 # extracting API NOs:
8d2afe0 - This does not have to be egrep here
foobar authored
59 PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
60 ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
61 ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
1e1e343 - restructured phpize
Jan Lehnardt authored
62 }
63
64 phpize_print_api_numbers()
65 {
66 phpize_get_api_numbers
67 echo "Configuring for:"
68 echo "PHP Api Version: "$PHP_API_VERSION
69 echo "Zend Module Api No: "$ZEND_MODULE_API_NO
70 echo "Zend Extension Api No: "$ZEND_EXTENSION_API_NO
71 }
72
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
73 phpize_check_build_files()
1e1e343 - restructured phpize
Jan Lehnardt authored
74 {
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
75 if test ! -d "$phpdir"; then
76 cat <<EOF
77 Cannot find build files at '$phpdir'. Please check your PHP installation.
1e1e343 - restructured phpize
Jan Lehnardt authored
78
79 EOF
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
80 exit 1
81 fi
1e1e343 - restructured phpize
Jan Lehnardt authored
82 }
83
84 phpize_check_shtool()
85 {
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
86 test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
1e1e343 - restructured phpize
Jan Lehnardt authored
87
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
88 if test ! -x "$builddir/build/shtool"; then
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
89 cat <<EOF
90 shtool at '$builddir/build/shtool' does not exist or is not executable.
91 Make sure that the file exists and is executable and then rerun this script.
92
93 EOF
1e1e343 - restructured phpize
Jan Lehnardt authored
94 exit 1
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
95 else
96 php_shtool=$builddir/build/shtool
1e1e343 - restructured phpize
Jan Lehnardt authored
97 fi
98 }
99
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
100 phpize_check_autotools()
101 {
102 test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
103 test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
104
f3ee713 Fix the echo/backquote issues + aclocal
foobar authored
105 if ! test -x "`$php_shtool path $PHP_AUTOCONF`"; then
106 cat <<EOF
758ff2f @jparise Wrapping the $PHP_AUTOCONF and $PHP_AUTOHEADER error messages to fit
jparise authored
107 Cannot find autoconf. Please check your autoconf installation and the
108 \$PHP_AUTOCONF environment variable is set correctly and then rerun this script.
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
109
110 EOF
111 exit 1
112 fi
f3ee713 Fix the echo/backquote issues + aclocal
foobar authored
113 if ! test -x "`$php_shtool path $PHP_AUTOHEADER`"; then
114 cat <<EOF
758ff2f @jparise Wrapping the $PHP_AUTOCONF and $PHP_AUTOHEADER error messages to fit
jparise authored
115 Cannot find autoheader. Please check your autoconf installation and the
116 \$PHP_AUTOHEADER environment variable is set correctly and then rerun this
117 script.
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
118
119 EOF
120 exit 1
121 fi
122 }
1e1e343 - restructured phpize
Jan Lehnardt authored
123
124 phpize_copy_files()
125 {
126 test -d build || mkdir build
127
536e744 - do it right (phpize path issue)
Jan Lehnardt authored
128 (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
129 (cd "$phpdir" && cp $FILES "$builddir")
c28f59a - Proper fix for phpize when dealing with PECL
foobar authored
130 (cd "$builddir" && cat acinclude.m4 ./build/libtool.m4 > aclocal.m4)
1e1e343 - restructured phpize
Jan Lehnardt authored
131 }
132
133 phpize_replace_prefix()
134 {
135 sed \
136 -e "s#@prefix@#$prefix#" \
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
137 < "$phpdir/phpize.m4" > configure.in
1e1e343 - restructured phpize
Jan Lehnardt authored
138 }
139
140 phpize_autotools()
141 {
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
142 $PHP_AUTOCONF || exit 1
143 $PHP_AUTOHEADER || exit 1
1e1e343 - restructured phpize
Jan Lehnardt authored
144 }
145
146 # Main script
147
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
148 case "$1" in
149 # Cleanup
063e4e2 Added --help to phpize
foobar authored
150 --clean)
1e1e343 - restructured phpize
Jan Lehnardt authored
151 phpize_check_configm4 1
152 phpize_clean
153 exit 0
063e4e2 Added --help to phpize
foobar authored
154 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
155
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
156 # Usage
063e4e2 Added --help to phpize
foobar authored
157 --help)
1e1e343 - restructured phpize
Jan Lehnardt authored
158 phpize_usage
159 exit 0
063e4e2 Added --help to phpize
foobar authored
160 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
161
162 # Version
163 --version|-v)
164 phpize_print_api_numbers
165 exit 0
166 ;;
167
168 # Default
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
169 *)
1e1e343 - restructured phpize
Jan Lehnardt authored
170 phpize_check_configm4 0
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-conf...
foobar authored
171
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
172 phpize_check_build_files
173
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
174 phpize_print_api_numbers
175
1e1e343 - restructured phpize
Jan Lehnardt authored
176 phpize_copy_files
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
177
1e1e343 - restructured phpize
Jan Lehnardt authored
178 phpize_replace_prefix
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
179
1e1e343 - restructured phpize
Jan Lehnardt authored
180 touch install-sh mkinstalldirs missing
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
181
1e1e343 - restructured phpize
Jan Lehnardt authored
182 phpize_check_shtool
183
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
184 phpize_check_autotools
185
186 phpize_autotools
1e1e343 - restructured phpize
Jan Lehnardt authored
187 ;;
188 esac
189
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
190 exit 0
Something went wrong with that request. Please try again.