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.176 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`"
68724e2 - Improved php-config:
foobar authored
9 SED="@SED@"
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-c…
foobar authored
10
480a3b0 - Changed phpize not to require automake and libtool.
foobar authored
11 FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
ee5fd96 - Made it possible to do "make test" for phpized extensions
foobar authored
12 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
13 CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
f6c1212 - Cleanup test output files too
foobar authored
14 mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
5264cfb - Remove also autom4te.cache dir with phpize --clean
foobar authored
15 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
16 config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
da629d8 more test output files
foobar authored
17 run-tests*.php tests/*.diff tests/*.exp tests/*.log tests/*.out tests/*.php"
5989ae5 Fix building external extensions.
Sascha Schumann authored
18
1e1e343 - restructured phpize
Jan Lehnardt authored
19 # function declaration
20 phpize_usage()
21 {
22 echo "Usage: $0 [--clean|--help|--version|-v]"
23 }
24
25 phpize_no_configm4()
26 {
27 if test $@ -eq 1; then
28 clean=" --clean"
29 fi
30
31 echo "Cannot find config.m4. "
32 echo "Make sure that you run '$0$clean' in the top level source directory of the module"
33 echo
34 }
35
36 phpize_clean()
37 {
38 echo "Cleaning.."
39 for i in $CLEAN_FILES; do
98f245e Fix cleanup
foobar authored
40 if test -f "$i"; then
41 rm -f $i
42 elif test -d "$i"; then
43 rm -rf $i
44 fi
1e1e343 - restructured phpize
Jan Lehnardt authored
45 done
46 }
47
48 phpize_check_configm4()
49 {
50 if test ! -r config.m4; then
51 phpize_no_configm4 $@
52 exit 1
53 fi
54
55 }
56
57 phpize_get_api_numbers()
58 {
59 # extracting API NOs:
68724e2 - Improved php-config:
foobar authored
60 PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
61 ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
62 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
63 }
64
65 phpize_print_api_numbers()
66 {
67 phpize_get_api_numbers
68 echo "Configuring for:"
69 echo "PHP Api Version: "$PHP_API_VERSION
70 echo "Zend Module Api No: "$ZEND_MODULE_API_NO
71 echo "Zend Extension Api No: "$ZEND_EXTENSION_API_NO
72 }
73
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
74 phpize_check_build_files()
1e1e343 - restructured phpize
Jan Lehnardt authored
75 {
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
76 if test ! -d "$phpdir"; then
77 cat <<EOF
78 Cannot find build files at '$phpdir'. Please check your PHP installation.
1e1e343 - restructured phpize
Jan Lehnardt authored
79
80 EOF
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
81 exit 1
82 fi
1e1e343 - restructured phpize
Jan Lehnardt authored
83 }
84
85 phpize_check_shtool()
86 {
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
87 test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
1e1e343 - restructured phpize
Jan Lehnardt authored
88
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
89 if test ! -x "$builddir/build/shtool"; then
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
90 cat <<EOF
91 shtool at '$builddir/build/shtool' does not exist or is not executable.
92 Make sure that the file exists and is executable and then rerun this script.
93
94 EOF
1e1e343 - restructured phpize
Jan Lehnardt authored
95 exit 1
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
96 else
97 php_shtool=$builddir/build/shtool
1e1e343 - restructured phpize
Jan Lehnardt authored
98 fi
99 }
100
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
101 phpize_check_autotools()
102 {
103 test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
104 test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
105
5b77718 typofix
foobar authored
106 if ! test -x $PHP_AUTOCONF && ! test -x "`$php_shtool path $PHP_AUTOCONF`"; then
f3ee713 Fix the echo/backquote issues + aclocal
foobar authored
107 cat <<EOF
758ff2f @jparise Wrapping the $PHP_AUTOCONF and $PHP_AUTOHEADER error messages to fit
jparise authored
108 Cannot find autoconf. Please check your autoconf installation and the
3078bba @jparise If the $PHP_AUTOCONF and $PHP_AUTOHEADER environmental variables are set
jparise authored
109 \$PHP_AUTOCONF environment variable. Then, rerun this script.
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
110
111 EOF
112 exit 1
113 fi
3078bba @jparise If the $PHP_AUTOCONF and $PHP_AUTOHEADER environmental variables are set
jparise authored
114 if ! test -x $PHP_AUTOHEADER && ! test -x "`$php_shtool path $PHP_AUTOHEADER`"; then
f3ee713 Fix the echo/backquote issues + aclocal
foobar authored
115 cat <<EOF
758ff2f @jparise Wrapping the $PHP_AUTOCONF and $PHP_AUTOHEADER error messages to fit
jparise authored
116 Cannot find autoheader. Please check your autoconf installation and the
3078bba @jparise If the $PHP_AUTOCONF and $PHP_AUTOHEADER environmental variables are set
jparise authored
117 \$PHP_AUTOHEADER environment variable. Then, rerun this 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 {
68724e2 - Improved php-config:
foobar authored
135 $SED \
1e1e343 - restructured phpize
Jan Lehnardt authored
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-c…
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.