Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 176 lines (140 sloc) 3.748 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
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
83 else
84 php_shtool=$builddir/build/shtool
1e1e343 - restructured phpize
Jan Lehnardt authored
85 fi
86 }
87
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
88 phpize_check_autotools()
89 {
90 test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
91 test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
92
93 if ! test -x "$php_shtool path $PHP_AUTOCONF"; then
94 echo <<EOF
95 Cannot find autoconf. Please check your autoconf installation and the \$PHP_AUTOCONF
96 environment variable is set correctly and then rerun this script.
97
98 EOF
99 exit 1
100 fi
101 if ! test -x "$php_shtool path $PHP_AUTOHEADER"; then
102 echo <<EOF
103 Cannot find autoheader. Please check your autoconf installation and the \$PHP_AUTOHEADER
104 environment variable is set correctly and then rerun this script.
105
106 EOF
107 exit 1
108 fi
109 }
1e1e343 - restructured phpize
Jan Lehnardt authored
110
111 phpize_copy_files()
112 {
113 test -d build || mkdir build
114
536e744 - do it right (phpize path issue)
Jan Lehnardt authored
115 (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
116 (cd "$phpdir" && cp $FILES "$builddir")
0576cdc - Return of the automake requirement.
foobar authored
117 (cd "$builddir" && cat ./build/libtool.m4 >> acinclude.m4)
1e1e343 - restructured phpize
Jan Lehnardt authored
118 }
119
120 phpize_replace_prefix()
121 {
122 sed \
123 -e "s#@prefix@#$prefix#" \
f4f844a - phpize now can handle directories with spaces in their name (#28847)
Jan Lehnardt authored
124 < "$phpdir/phpize.m4" > configure.in
1e1e343 - restructured phpize
Jan Lehnardt authored
125 }
126
127 phpize_autotools()
128 {
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
129 $PHP_AUTOCONF || exit 1
130 $PHP_AUTOHEADER || exit 1
1e1e343 - restructured phpize
Jan Lehnardt authored
131 }
132
133 # Main script
134
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
135 case "$1" in
136 # Cleanup
063e4e2 Added --help to phpize
foobar authored
137 --clean)
1e1e343 - restructured phpize
Jan Lehnardt authored
138 phpize_check_configm4 1
139 phpize_clean
140 exit 0
063e4e2 Added --help to phpize
foobar authored
141 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
142
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
143 # Usage
063e4e2 Added --help to phpize
foobar authored
144 --help)
1e1e343 - restructured phpize
Jan Lehnardt authored
145 phpize_usage
146 exit 0
063e4e2 Added --help to phpize
foobar authored
147 ;;
1e1e343 - restructured phpize
Jan Lehnardt authored
148
149 # Version
150 --version|-v)
151 phpize_print_api_numbers
152 exit 0
153 ;;
154
155 # Default
f6cafd6 Fix previous commit. (never do 2 things same time :)
foobar authored
156 *)
1e1e343 - restructured phpize
Jan Lehnardt authored
157 phpize_check_configm4 0
20c4328 - Fixed bug: #13561 (--without-pear prevents install of phpize, php-c…
foobar authored
158
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
159 phpize_print_api_numbers
160
1e1e343 - restructured phpize
Jan Lehnardt authored
161 phpize_copy_files
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
162
1e1e343 - restructured phpize
Jan Lehnardt authored
163 phpize_replace_prefix
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
164
1e1e343 - restructured phpize
Jan Lehnardt authored
165 touch install-sh mkinstalldirs missing
f2f8d38 Integration of -ng changes. Changes:
Sascha Schumann authored
166
1e1e343 - restructured phpize
Jan Lehnardt authored
167 phpize_check_shtool
168
e2e53b6 - Added the $PHP_AUTOCONF/$PHP_AUTOHEADER usage to phpize
foobar authored
169 phpize_check_autotools
170
171 phpize_autotools
1e1e343 - restructured phpize
Jan Lehnardt authored
172 ;;
173 esac
174
2284335 - Show the API numbers again while phpizing.
Derick Rethans authored
175 exit 0
Something went wrong with that request. Please try again.