Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 186 lines (148 sloc) 4.013 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
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
4 EGREP='@EGREP@'
fbc947f * generate pear scripts properly with configure
Stig Bakken authored
5 prefix='@prefix@'
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
6 exec_prefix="`eval echo @exec_prefix@`"
7 phpdir="`eval echo @libdir@`/build"
8 includedir="`eval echo @includedir@`/php"
5989ae5 Fix building external extensions.
Sascha Schumann authored
9 builddir="`pwd`"
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"
12 FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh"
13 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
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/ \
8fec4cc Missing "confdefs.h" in the cleanup-files-list
foobar authored
16 config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h"
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
39 test -e $i && rm -rf $i
40 done
41 }
42
43 phpize_check_configm4()
44 {
45 if test ! -r config.m4; then
46 phpize_no_configm4 $@
47 exit 1
48 fi
49
50 }
51
52 phpize_get_api_numbers()
53 {
54 # extracting API NOs:
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
55 PHP_API_VERSION=`$EGREP '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
56 ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
57 ZEND_EXTENSION_API_NO=`$EGREP '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
1e1e343 - restructured phpize
Jan Lehnardt authored
58 }
59
60 phpize_print_api_numbers()
61 {
62 phpize_get_api_numbers
63 echo "Configuring for:"
64 echo "PHP Api Version: "$PHP_API_VERSION
65 echo "Zend Module Api No: "$ZEND_MODULE_API_NO
66 echo "Zend Extension Api No: "$ZEND_EXTENSION_API_NO
67 }
68
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
69 phpize_check_build_files()
1e1e343 - restructured phpize
Jan Lehnardt authored
70 {
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
71 if test ! -d "$phpdir"; then
72 cat <<EOF
73 Cannot find build files at '$phpdir'. Please check your PHP installation.
1e1e343 - restructured phpize
Jan Lehnardt authored
74
75 EOF
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
76 exit 1
77 fi
1e1e343 - restructured phpize
Jan Lehnardt authored
78 }
79
80 phpize_check_shtool()
81 {
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
82 test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
1e1e343 - restructured phpize
Jan Lehnardt authored
83
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
84 if test ! -x "$builddir/build/shtool"; then
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
85 cat <<EOF
86 shtool at '$builddir/build/shtool' does not exist or is not executable.
87 Make sure that the file exists and is executable and then rerun this script.
88
89 EOF
1e1e343 - restructured phpize
Jan Lehnardt authored
90 exit 1
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
91 else
92 php_shtool=$builddir/build/shtool
1e1e343 - restructured phpize
Jan Lehnardt authored
93 fi
94 }
95
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
96 phpize_check_autotools()
97 {
98 test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
99 test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
100
f3ee713 Fix the echo/backquote issues + aclocal
foobar authored
101 if ! test -x "`$php_shtool path $PHP_AUTOCONF`"; then
102 cat <<EOF
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
103 Cannot find autoconf. Please check your autoconf installation and the \$PHP_AUTOCONF
104 environment variable is set correctly and then rerun this script.
105
106 EOF
107 exit 1
108 fi
f3ee713 Fix the echo/backquote issues + aclocal
foobar authored
109 if ! test -x "`$php_shtool path $PHP_AUTOHEADER`"; then
110 cat <<EOF
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
111 Cannot find autoheader. Please check your autoconf installation and the \$PHP_AUTOHEADER
112 environment variable is set correctly and then rerun this script.
113
114 EOF
115 exit 1
116 fi
117 }
1e1e343 - restructured phpize
Jan Lehnardt authored
118
119 phpize_copy_files()
120 {
121 test -d build || mkdir build
122
536e744 - do it right (phpize path issue)
Jan Lehnardt authored
123 (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
124 (cd "$phpdir" && cp $FILES "$builddir")
c28f59a - Proper fix for phpize when dealing with PECL
foobar authored
125 (cd "$builddir" && cat acinclude.m4 ./build/libtool.m4 > aclocal.m4)
1e1e343 - restructured phpize
Jan Lehnardt authored
126 }
127
128 phpize_replace_prefix()
129 {
130 sed \
131 -e "s#@prefix@#$prefix#" \
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
132 < "$phpdir/phpize.m4" > configure.in
1e1e343 - restructured phpize
Jan Lehnardt authored
133 }
134
135 phpize_autotools()
136 {
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
137 $PHP_AUTOCONF || exit 1
138 $PHP_AUTOHEADER || exit 1
1e1e343 - restructured phpize
Jan Lehnardt authored
139 }
140
141 # Main script
142
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
143 case "$1" in
144 # Cleanup
063e4e2 Added --help to phpize
foobar authored
145 --clean)
1e1e343 - restructured phpize
Jan Lehnardt authored
146 phpize_check_configm4 1
147 phpize_clean
148 exit 0
063e4e2 Added --help to phpize
foobar authored
149 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
150
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
151 # Usage
063e4e2 Added --help to phpize
foobar authored
152 --help)
1e1e343 - restructured phpize
Jan Lehnardt authored
153 phpize_usage
154 exit 0
063e4e2 Added --help to phpize
foobar authored
155 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
156
157 # Version
158 --version|-v)
159 phpize_print_api_numbers
160 exit 0
161 ;;
162
163 # Default
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
164 *)
1e1e343 - restructured phpize
Jan Lehnardt authored
165 phpize_check_configm4 0
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-c…
foobar authored
166
058205b - Fix phpize: need to eval path variables for them to be usable
foobar authored
167 phpize_check_build_files
168
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
169 phpize_print_api_numbers
170
1e1e343 - restructured phpize
Jan Lehnardt authored
171 phpize_copy_files
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
172
1e1e343 - restructured phpize
Jan Lehnardt authored
173 phpize_replace_prefix
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
174
1e1e343 - restructured phpize
Jan Lehnardt authored
175 touch install-sh mkinstalldirs missing
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
176
1e1e343 - restructured phpize
Jan Lehnardt authored
177 phpize_check_shtool
178
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
179 phpize_check_autotools
180
181 phpize_autotools
1e1e343 - restructured phpize
Jan Lehnardt authored
182 ;;
183 esac
184
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
185 exit 0
Something went wrong with that request. Please try again.