1 | dnl |
---|
2 | dnl $Id: acinclude.m4,v 1.332.2.14.2.28 2008/09/08 10:24:38 tony2001 Exp $ |
---|
3 | dnl |
---|
4 | dnl This file contains local autoconf functions. |
---|
5 | dnl |
---|
6 | |
---|
7 | dnl ------------------------------------------------------------------------- |
---|
8 | dnl Output stylize macros for configure (help/runtime) |
---|
9 | dnl ------------------------------------------------------------------------- |
---|
10 | |
---|
11 | dnl |
---|
12 | dnl PHP_HELP_SEPARATOR(title) |
---|
13 | dnl |
---|
14 | dnl Adds separator title into the configure --help display. |
---|
15 | dnl |
---|
16 | AC_DEFUN([PHP_HELP_SEPARATOR],[ |
---|
17 | AC_ARG_ENABLE([],[ |
---|
18 | $1 |
---|
19 | ],[]) |
---|
20 | ]) |
---|
21 | |
---|
22 | dnl |
---|
23 | dnl PHP_CONFIGURE_PART(title) |
---|
24 | dnl |
---|
25 | dnl Adds separator title configure output (idea borrowed from mm) |
---|
26 | dnl |
---|
27 | AC_DEFUN([PHP_CONFIGURE_PART],[ |
---|
28 | AC_MSG_RESULT() |
---|
29 | AC_MSG_RESULT([${T_MD}$1${T_ME}]) |
---|
30 | ]) |
---|
31 | |
---|
32 | dnl ------------------------------------------------------------------------- |
---|
33 | dnl Build system helper macros |
---|
34 | dnl ------------------------------------------------------------------------- |
---|
35 | |
---|
36 | dnl |
---|
37 | dnl PHP_DEF_HAVE(what) |
---|
38 | dnl |
---|
39 | dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [ ])' |
---|
40 | dnl |
---|
41 | AC_DEFUN([PHP_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___), 1, [ ])]) |
---|
42 | |
---|
43 | dnl |
---|
44 | dnl PHP_RUN_ONCE(namespace, variable, code) |
---|
45 | dnl |
---|
46 | dnl execute code, if variable is not set in namespace |
---|
47 | dnl |
---|
48 | AC_DEFUN([PHP_RUN_ONCE],[ |
---|
49 | changequote({,}) |
---|
50 | unique=`echo $2|$SED 's/[^a-zA-Z0-9]/_/g'` |
---|
51 | changequote([,]) |
---|
52 | cmd="echo $ac_n \"\$$1$unique$ac_c\"" |
---|
53 | if test -n "$unique" && test "`eval $cmd`" = "" ; then |
---|
54 | eval "$1$unique=set" |
---|
55 | $3 |
---|
56 | fi |
---|
57 | ]) |
---|
58 | |
---|
59 | dnl |
---|
60 | dnl PHP_EXPAND_PATH(path, variable) |
---|
61 | dnl |
---|
62 | dnl expands path to an absolute path and assigns it to variable |
---|
63 | dnl |
---|
64 | AC_DEFUN([PHP_EXPAND_PATH],[ |
---|
65 | if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then |
---|
66 | $2=$1 |
---|
67 | else |
---|
68 | changequote({,}) |
---|
69 | ep_dir="`echo $1|$SED 's%/*[^/][^/]*/*$%%'`" |
---|
70 | changequote([,]) |
---|
71 | ep_realdir="`(cd \"$ep_dir\" && pwd)`" |
---|
72 | $2="$ep_realdir/`basename \"$1\"`" |
---|
73 | fi |
---|
74 | ]) |
---|
75 | |
---|
76 | dnl |
---|
77 | dnl PHP_DEFINE(WHAT [, value[, directory]]) |
---|
78 | dnl |
---|
79 | dnl Creates builddir/include/what.h and in there #define WHAT value |
---|
80 | dnl |
---|
81 | AC_DEFUN([PHP_DEFINE],[ |
---|
82 | [echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > ]ifelse([$3],,[include],[$3])[/php_]translit($1,A-Z,a-z)[.h] |
---|
83 | ]) |
---|
84 | |
---|
85 | dnl |
---|
86 | dnl PHP_SUBST(varname) |
---|
87 | dnl |
---|
88 | dnl Adds variable with it's value into Makefile, e.g.: |
---|
89 | dnl CC = gcc |
---|
90 | dnl |
---|
91 | AC_DEFUN([PHP_SUBST],[ |
---|
92 | PHP_VAR_SUBST="$PHP_VAR_SUBST $1" |
---|
93 | ]) |
---|
94 | |
---|
95 | dnl |
---|
96 | dnl PHP_SUBST_OLD(varname) |
---|
97 | dnl |
---|
98 | dnl Same as PHP_SUBST() but also substitutes all @VARNAME@ |
---|
99 | dnl instances in every file passed to AC_OUTPUT() |
---|
100 | dnl |
---|
101 | AC_DEFUN([PHP_SUBST_OLD],[ |
---|
102 | PHP_SUBST($1) |
---|
103 | AC_SUBST($1) |
---|
104 | ]) |
---|
105 | |
---|
106 | dnl |
---|
107 | dnl PHP_OUTPUT(file) |
---|
108 | dnl |
---|
109 | dnl Adds "file" to the list of files generated by AC_OUTPUT |
---|
110 | dnl This macro can be used several times. |
---|
111 | dnl |
---|
112 | AC_DEFUN([PHP_OUTPUT],[ |
---|
113 | PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1" |
---|
114 | ]) |
---|
115 | |
---|
116 | |
---|
117 | dnl ------------------------------------------------------------------------- |
---|
118 | dnl Build system base macros |
---|
119 | dnl ------------------------------------------------------------------------- |
---|
120 | |
---|
121 | dnl |
---|
122 | dnl PHP_CANONICAL_HOST_TARGET |
---|
123 | dnl |
---|
124 | AC_DEFUN([PHP_CANONICAL_HOST_TARGET],[ |
---|
125 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
---|
126 | AC_REQUIRE([AC_CANONICAL_TARGET])dnl |
---|
127 | dnl Make sure we do not continue if host_alias is empty. |
---|
128 | if test -z "$host_alias" && test -n "$host"; then |
---|
129 | host_alias=$host |
---|
130 | fi |
---|
131 | if test -z "$host_alias"; then |
---|
132 | AC_MSG_ERROR([host_alias is not set!]) |
---|
133 | fi |
---|
134 | ]) |
---|
135 | |
---|
136 | dnl |
---|
137 | dnl PHP_INIT_BUILD_SYSTEM |
---|
138 | dnl |
---|
139 | AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[ |
---|
140 | AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl |
---|
141 | test -d include || $php_shtool mkdir include |
---|
142 | > Makefile.objects |
---|
143 | > Makefile.fragments |
---|
144 | dnl We need to play tricks here to avoid matching the grep line itself |
---|
145 | pattern=define |
---|
146 | $EGREP $pattern'.*include/php' $srcdir/configure|$SED 's/.*>//'|xargs touch 2>/dev/null |
---|
147 | ]) |
---|
148 | |
---|
149 | dnl |
---|
150 | dnl PHP_GEN_GLOBAL_MAKEFILE |
---|
151 | dnl |
---|
152 | dnl Generates the global makefile. |
---|
153 | dnl |
---|
154 | AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[ |
---|
155 | cat >Makefile <<EOF |
---|
156 | srcdir = $abs_srcdir |
---|
157 | builddir = $abs_builddir |
---|
158 | top_srcdir = $abs_srcdir |
---|
159 | top_builddir = $abs_builddir |
---|
160 | EOF |
---|
161 | for i in $PHP_VAR_SUBST; do |
---|
162 | eval echo "$i = \$$i" >> Makefile |
---|
163 | done |
---|
164 | |
---|
165 | cat $abs_srcdir/Makefile.global Makefile.fragments Makefile.objects >> Makefile |
---|
166 | ]) |
---|
167 | |
---|
168 | dnl |
---|
169 | dnl PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]]) |
---|
170 | dnl |
---|
171 | dnl Processes a file called Makefile.frag in the source directory |
---|
172 | dnl of the most recently added extension. $(srcdir) and $(builddir) |
---|
173 | dnl are substituted with the proper paths. Can be used to supply |
---|
174 | dnl custom rules and/or additional targets. |
---|
175 | dnl |
---|
176 | AC_DEFUN([PHP_ADD_MAKEFILE_FRAGMENT],[ |
---|
177 | ifelse($1,,src=$ext_srcdir/Makefile.frag,src=$1) |
---|
178 | ifelse($2,,ac_srcdir=$ext_srcdir,ac_srcdir=$2) |
---|
179 | ifelse($3,,ac_builddir=$ext_builddir,ac_builddir=$3) |
---|
180 | test -f "$src" && $SED -e "s#\$(srcdir)#$ac_srcdir#g" -e "s#\$(builddir)#$ac_builddir#g" $src >> Makefile.fragments |
---|
181 | ]) |
---|
182 | |
---|
183 | dnl |
---|
184 | dnl PHP_ADD_SOURCES(source-path, sources [, special-flags [, type]]) |
---|
185 | dnl |
---|
186 | dnl Adds sources which are located relative to source-path to the |
---|
187 | dnl array of type type. Sources are processed with optional |
---|
188 | dnl special-flags which are passed to the compiler. Sources |
---|
189 | dnl can be either written in C or C++ (filenames shall end in .c |
---|
190 | dnl or .cpp, respectively). |
---|
191 | dnl |
---|
192 | dnl Note: If source-path begins with a "/", the "/" is removed and |
---|
193 | dnl the path is interpreted relative to the top build-directory. |
---|
194 | dnl |
---|
195 | dnl which array to append to? |
---|
196 | AC_DEFUN([PHP_ADD_SOURCES],[ |
---|
197 | PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS))) |
---|
198 | ]) |
---|
199 | |
---|
200 | dnl |
---|
201 | dnl _PHP_ASSIGN_BUILD_VARS(type) |
---|
202 | dnl internal, don't use |
---|
203 | AC_DEFUN([_PHP_ASSIGN_BUILD_VARS],[ |
---|
204 | ifelse($1,shared,[ |
---|
205 | b_c_pre=$shared_c_pre |
---|
206 | b_cxx_pre=$shared_cxx_pre |
---|
207 | b_c_meta=$shared_c_meta |
---|
208 | b_cxx_meta=$shared_cxx_meta |
---|
209 | b_c_post=$shared_c_post |
---|
210 | b_cxx_post=$shared_cxx_post |
---|
211 | ],[ |
---|
212 | b_c_pre=$php_c_pre |
---|
213 | b_cxx_pre=$php_cxx_pre |
---|
214 | b_c_meta=$php_c_meta |
---|
215 | b_cxx_meta=$php_cxx_meta |
---|
216 | b_c_post=$php_c_post |
---|
217 | b_cxx_post=$php_cxx_post |
---|
218 | ])dnl |
---|
219 | b_lo=[$]$1_lo |
---|
220 | ]) |
---|
221 | |
---|
222 | dnl |
---|
223 | dnl PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]]) |
---|
224 | dnl |
---|
225 | dnl Additional to PHP_ADD_SOURCES (see above), this lets you set the |
---|
226 | dnl name of the array target-var directly, as well as whether |
---|
227 | dnl shared objects will be built from the sources. |
---|
228 | dnl |
---|
229 | dnl Should not be used directly. |
---|
230 | dnl |
---|
231 | AC_DEFUN([PHP_ADD_SOURCES_X],[ |
---|
232 | dnl relative to source- or build-directory? |
---|
233 | dnl ac_srcdir/ac_bdir include trailing slash |
---|
234 | case $1 in |
---|
235 | ""[)] ac_srcdir="$abs_srcdir/"; unset ac_bdir; ac_inc="-I. -I$abs_srcdir" ;; |
---|
236 | /*[)] ac_srcdir=`echo "$1"|cut -c 2-`"/"; ac_bdir=$ac_srcdir; ac_inc="-I$ac_bdir -I$abs_srcdir/$ac_bdir" ;; |
---|
237 | *[)] ac_srcdir="$abs_srcdir/$1/"; ac_bdir="$1/"; ac_inc="-I$ac_bdir -I$ac_srcdir" ;; |
---|
238 | esac |
---|
239 | |
---|
240 | dnl how to build .. shared or static? |
---|
241 | ifelse($5,yes,_PHP_ASSIGN_BUILD_VARS(shared),_PHP_ASSIGN_BUILD_VARS(php)) |
---|
242 | |
---|
243 | dnl iterate over the sources |
---|
244 | old_IFS=[$]IFS |
---|
245 | for ac_src in $2; do |
---|
246 | |
---|
247 | dnl remove the suffix |
---|
248 | IFS=. |
---|
249 | set $ac_src |
---|
250 | ac_obj=[$]1 |
---|
251 | IFS=$old_IFS |
---|
252 | |
---|
253 | dnl append to the array which has been dynamically chosen at m4 time |
---|
254 | $4="[$]$4 [$]ac_bdir[$]ac_obj.lo" |
---|
255 | |
---|
256 | dnl choose the right compiler/flags/etc. for the source-file |
---|
257 | case $ac_src in |
---|
258 | *.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; |
---|
259 | *.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; |
---|
260 | *.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;; |
---|
261 | *.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;; |
---|
262 | esac |
---|
263 | |
---|
264 | dnl create a rule for the object/source combo |
---|
265 | cat >>Makefile.objects<<EOF |
---|
266 | $ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src |
---|
267 | $ac_comp |
---|
268 | EOF |
---|
269 | done |
---|
270 | ]) |
---|
271 | |
---|
272 | dnl ------------------------------------------------------------------------- |
---|
273 | dnl Compiler characteristics checks |
---|
274 | dnl ------------------------------------------------------------------------- |
---|
275 | |
---|
276 | dnl |
---|
277 | dnl PHP_TARGET_RDYNAMIC |
---|
278 | dnl |
---|
279 | dnl Checks whether -rdynamic is supported by the compiler. This |
---|
280 | dnl is necessary for some targets to populate the global symbol |
---|
281 | dnl table. Otherwise, dynamic modules would not be able to resolve |
---|
282 | dnl PHP-related symbols. |
---|
283 | dnl |
---|
284 | dnl If successful, adds -rdynamic to PHP_LDFLAGS. |
---|
285 | dnl |
---|
286 | AC_DEFUN([PHP_TARGET_RDYNAMIC],[ |
---|
287 | if test -n "$GCC"; then |
---|
288 | dnl we should use a PHP-specific macro here |
---|
289 | PHP_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes) |
---|
290 | if test "$gcc_rdynamic" = "yes"; then |
---|
291 | PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic" |
---|
292 | fi |
---|
293 | fi |
---|
294 | ]) |
---|
295 | |
---|
296 | dnl |
---|
297 | dnl PHP_RUNPATH_SWITCH |
---|
298 | dnl |
---|
299 | dnl Checks for -R, etc. switch |
---|
300 | dnl |
---|
301 | AC_DEFUN([PHP_RUNPATH_SWITCH],[ |
---|
302 | AC_MSG_CHECKING([if compiler supports -R]) |
---|
303 | AC_CACHE_VAL(php_cv_cc_dashr,[ |
---|
304 | SAVE_LIBS=$LIBS |
---|
305 | LIBS="-R /usr/$PHP_LIBDIR $LIBS" |
---|
306 | AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no) |
---|
307 | LIBS=$SAVE_LIBS]) |
---|
308 | AC_MSG_RESULT([$php_cv_cc_dashr]) |
---|
309 | if test $php_cv_cc_dashr = "yes"; then |
---|
310 | ld_runpath_switch=-R |
---|
311 | else |
---|
312 | AC_MSG_CHECKING([if compiler supports -Wl,-rpath,]) |
---|
313 | AC_CACHE_VAL(php_cv_cc_rpath,[ |
---|
314 | SAVE_LIBS=$LIBS |
---|
315 | LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS" |
---|
316 | AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no) |
---|
317 | LIBS=$SAVE_LIBS]) |
---|
318 | AC_MSG_RESULT([$php_cv_cc_rpath]) |
---|
319 | if test $php_cv_cc_rpath = "yes"; then |
---|
320 | ld_runpath_switch=-Wl,-rpath, |
---|
321 | else |
---|
322 | dnl something innocuous |
---|
323 | ld_runpath_switch=-L |
---|
324 | fi |
---|
325 | fi |
---|
326 | if test "$PHP_RPATH" = "no"; then |
---|
327 | ld_runpath_switch= |
---|
328 | fi |
---|
329 | ]) |
---|
330 | |
---|
331 | dnl |
---|
332 | dnl PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found) |
---|
333 | dnl |
---|
334 | AC_DEFUN([PHP_CHECK_GCC_ARG],[ |
---|
335 | gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_) |
---|
336 | AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [ |
---|
337 | echo 'void somefunc() { };' > conftest.c |
---|
338 | cmd='$CC $1 -c conftest.c' |
---|
339 | if eval $cmd 2>&1 | $EGREP -e $1 >/dev/null ; then |
---|
340 | ac_result=no |
---|
341 | else |
---|
342 | ac_result=yes |
---|
343 | fi |
---|
344 | eval $gcc_arg_name=$ac_result |
---|
345 | rm -f conftest.* |
---|
346 | ]) |
---|
347 | if eval test "\$$gcc_arg_name" = "yes"; then |
---|
348 | $2 |
---|
349 | else |
---|
350 | : |
---|
351 | $3 |
---|
352 | fi |
---|
353 | ]) |
---|
354 | |
---|
355 | dnl |
---|
356 | dnl PHP_LIBGCC_LIBPATH(gcc) |
---|
357 | dnl |
---|
358 | dnl Stores the location of libgcc in libgcc_libpath |
---|
359 | dnl |
---|
360 | AC_DEFUN([PHP_LIBGCC_LIBPATH],[ |
---|
361 | changequote({,}) |
---|
362 | libgcc_libpath=`$1 --print-libgcc-file-name|$SED 's%/*[^/][^/]*$%%'` |
---|
363 | changequote([,]) |
---|
364 | ]) |
---|
365 | |
---|
366 | dnl ------------------------------------------------------------------------- |
---|
367 | dnl Macros to modify LIBS, INCLUDES, etc. variables |
---|
368 | dnl ------------------------------------------------------------------------- |
---|
369 | |
---|
370 | dnl |
---|
371 | dnl PHP_REMOVE_USR_LIB(NAME) |
---|
372 | dnl |
---|
373 | dnl Removes all -L/usr/$PHP_LIBDIR entries from variable NAME |
---|
374 | dnl |
---|
375 | AC_DEFUN([PHP_REMOVE_USR_LIB],[ |
---|
376 | unset ac_new_flags |
---|
377 | for i in [$]$1; do |
---|
378 | case [$]i in |
---|
379 | -L/usr/$PHP_LIBDIR|-L/usr/$PHP_LIBDIR/[)] ;; |
---|
380 | *[)] ac_new_flags="[$]ac_new_flags [$]i" ;; |
---|
381 | esac |
---|
382 | done |
---|
383 | $1=[$]ac_new_flags |
---|
384 | ]) |
---|
385 | |
---|
386 | dnl |
---|
387 | dnl PHP_EVAL_LIBLINE(libline, SHARED-LIBADD) |
---|
388 | dnl |
---|
389 | dnl Use this macro, if you need to add libraries and or library search |
---|
390 | dnl paths to the PHP build system which are only given in compiler |
---|
391 | dnl notation. |
---|
392 | dnl |
---|
393 | AC_DEFUN([PHP_EVAL_LIBLINE],[ |
---|
394 | for ac_i in $1; do |
---|
395 | case $ac_i in |
---|
396 | -pthread[)] |
---|
397 | if test "$ext_shared" = "yes"; then |
---|
398 | $2="[$]$2 -pthread" |
---|
399 | else |
---|
400 | PHP_RUN_ONCE(EXTRA_LDFLAGS, [$ac_i], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i"]) |
---|
401 | fi |
---|
402 | ;; |
---|
403 | -l*[)] |
---|
404 | ac_ii=`echo $ac_i|cut -c 3-` |
---|
405 | PHP_ADD_LIBRARY($ac_ii,1,$2) |
---|
406 | ;; |
---|
407 | -L*[)] |
---|
408 | ac_ii=`echo $ac_i|cut -c 3-` |
---|
409 | PHP_ADD_LIBPATH($ac_ii,$2) |
---|
410 | ;; |
---|
411 | esac |
---|
412 | done |
---|
413 | ]) |
---|
414 | |
---|
415 | dnl |
---|
416 | dnl PHP_EVAL_INCLINE(headerline) |
---|
417 | dnl |
---|
418 | dnl Use this macro, if you need to add header search paths to the PHP |
---|
419 | dnl build system which are only given in compiler notation. |
---|
420 | dnl |
---|
421 | AC_DEFUN([PHP_EVAL_INCLINE],[ |
---|
422 | for ac_i in $1; do |
---|
423 | case $ac_i in |
---|
424 | -I*[)] |
---|
425 | ac_ii=`echo $ac_i|cut -c 3-` |
---|
426 | PHP_ADD_INCLUDE($ac_ii) |
---|
427 | ;; |
---|
428 | esac |
---|
429 | done |
---|
430 | ]) |
---|
431 | |
---|
432 | dnl internal, don't use |
---|
433 | AC_DEFUN([_PHP_ADD_LIBPATH_GLOBAL],[ |
---|
434 | PHP_RUN_ONCE(LIBPATH, $1, [ |
---|
435 | test "x$PHP_RPATH" != "xno" && |
---|
436 | test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$1" |
---|
437 | LDFLAGS="$LDFLAGS -L$1" |
---|
438 | PHP_RPATHS="$PHP_RPATHS $1" |
---|
439 | ]) |
---|
440 | ])dnl |
---|
441 | dnl |
---|
442 | dnl |
---|
443 | dnl PHP_ADD_LIBPATH(path [, SHARED-LIBADD]) |
---|
444 | dnl |
---|
445 | dnl Adds a path to linkpath/runpath (LDFLAGS) |
---|
446 | dnl |
---|
447 | AC_DEFUN([PHP_ADD_LIBPATH],[ |
---|
448 | if test "$1" != "/usr/$PHP_LIBDIR" && test "$1" != "/usr/lib"; then |
---|
449 | PHP_EXPAND_PATH($1, ai_p) |
---|
450 | ifelse([$2],,[ |
---|
451 | _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) |
---|
452 | ],[ |
---|
453 | if test "$ext_shared" = "yes"; then |
---|
454 | $2="-L$ai_p [$]$2" |
---|
455 | test "x$PHP_RPATH" != "xno" && \ |
---|
456 | test -n "$ld_runpath_switch" && $2="$ld_runpath_switch$ai_p [$]$2" |
---|
457 | else |
---|
458 | _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) |
---|
459 | fi |
---|
460 | ]) |
---|
461 | fi |
---|
462 | ]) |
---|
463 | |
---|
464 | dnl |
---|
465 | dnl PHP_UTILIZE_RPATHS() |
---|
466 | dnl |
---|
467 | dnl builds RPATHS/LDFLAGS from PHP_RPATHS |
---|
468 | dnl |
---|
469 | AC_DEFUN([PHP_UTILIZE_RPATHS],[ |
---|
470 | OLD_RPATHS=$PHP_RPATHS |
---|
471 | unset PHP_RPATHS |
---|
472 | |
---|
473 | for i in $OLD_RPATHS; do |
---|
474 | dnl Can be passed to native cc/libtool |
---|
475 | PHP_LDFLAGS="$PHP_LDFLAGS -L$i" |
---|
476 | dnl Libtool-specific |
---|
477 | PHP_RPATHS="$PHP_RPATHS -R $i" |
---|
478 | dnl cc-specific |
---|
479 | NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i" |
---|
480 | done |
---|
481 | |
---|
482 | if test "$PHP_RPATH" = "no"; then |
---|
483 | unset PHP_RPATHS |
---|
484 | unset NATIVE_RPATHS |
---|
485 | fi |
---|
486 | ]) |
---|
487 | |
---|
488 | dnl |
---|
489 | dnl PHP_ADD_INCLUDE(path [,before]) |
---|
490 | dnl |
---|
491 | dnl add an include path. |
---|
492 | dnl if before is 1, add in the beginning of INCLUDES. |
---|
493 | dnl |
---|
494 | AC_DEFUN([PHP_ADD_INCLUDE],[ |
---|
495 | if test "$1" != "/usr/include"; then |
---|
496 | PHP_EXPAND_PATH($1, ai_p) |
---|
497 | PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [ |
---|
498 | if test "$2"; then |
---|
499 | INCLUDES="-I$ai_p $INCLUDES" |
---|
500 | else |
---|
501 | INCLUDES="$INCLUDES -I$ai_p" |
---|
502 | fi |
---|
503 | ]) |
---|
504 | fi |
---|
505 | ]) |
---|
506 | |
---|
507 | dnl internal, don't use |
---|
508 | AC_DEFUN([_PHP_X_ADD_LIBRARY],[dnl |
---|
509 | ifelse([$2],,$3="-l$1 [$]$3", $3="[$]$3 -l$1") dnl |
---|
510 | ])dnl |
---|
511 | dnl |
---|
512 | dnl internal, don't use |
---|
513 | AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[ |
---|
514 | case $1 in |
---|
515 | c|c_r|pthread*[)] ;; |
---|
516 | *[)] ifelse($3,,[ |
---|
517 | _PHP_X_ADD_LIBRARY($1,$2,$5) |
---|
518 | ],[ |
---|
519 | if test "$ext_shared" = "yes"; then |
---|
520 | _PHP_X_ADD_LIBRARY($1,$2,$3) |
---|
521 | else |
---|
522 | $4($1,$2) |
---|
523 | fi |
---|
524 | ]) ;; |
---|
525 | esac |
---|
526 | ])dnl |
---|
527 | dnl |
---|
528 | dnl |
---|
529 | dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]]) |
---|
530 | dnl |
---|
531 | dnl add a library to the link line |
---|
532 | dnl |
---|
533 | AC_DEFUN([PHP_ADD_LIBRARY],[ |
---|
534 | _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY],[LIBS]) |
---|
535 | ]) |
---|
536 | |
---|
537 | dnl |
---|
538 | dnl PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]]) |
---|
539 | dnl |
---|
540 | dnl add a library to the link line (deferred, not used during configure) |
---|
541 | dnl |
---|
542 | AC_DEFUN([PHP_ADD_LIBRARY_DEFER],[ |
---|
543 | _PHP_ADD_LIBRARY_SKELETON([$1],[$2],[$3],[PHP_ADD_LIBRARY_DEFER],[DLIBS]) |
---|
544 | ]) |
---|
545 | |
---|
546 | dnl |
---|
547 | dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd]) |
---|
548 | dnl |
---|
549 | dnl add a library to the link line and path to linkpath/runpath. |
---|
550 | dnl if shared-libadd is not empty and $ext_shared is yes, |
---|
551 | dnl shared-libadd will be assigned the library information |
---|
552 | dnl |
---|
553 | AC_DEFUN([PHP_ADD_LIBRARY_WITH_PATH],[ |
---|
554 | ifelse($3,,[ |
---|
555 | if test -n "$2"; then |
---|
556 | PHP_ADD_LIBPATH($2) |
---|
557 | fi |
---|
558 | PHP_ADD_LIBRARY($1) |
---|
559 | ],[ |
---|
560 | if test "$ext_shared" = "yes"; then |
---|
561 | $3="-l$1 [$]$3" |
---|
562 | if test -n "$2"; then |
---|
563 | PHP_ADD_LIBPATH($2,$3) |
---|
564 | fi |
---|
565 | else |
---|
566 | PHP_ADD_LIBRARY_WITH_PATH($1,$2) |
---|
567 | fi |
---|
568 | ]) |
---|
569 | ]) |
---|
570 | |
---|
571 | dnl |
---|
572 | dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd]) |
---|
573 | dnl |
---|
574 | dnl add a library to the link line (deferred) |
---|
575 | dnl and path to linkpath/runpath (not deferred) |
---|
576 | dnl if shared-libadd is not empty and $ext_shared is yes, |
---|
577 | dnl shared-libadd will be assigned the library information |
---|
578 | dnl |
---|
579 | AC_DEFUN([PHP_ADD_LIBRARY_DEFER_WITH_PATH],[ |
---|
580 | ifelse($3,,[ |
---|
581 | if test -n "$2"; then |
---|
582 | PHP_ADD_LIBPATH($2) |
---|
583 | fi |
---|
584 | PHP_ADD_LIBRARY_DEFER($1) |
---|
585 | ],[ |
---|
586 | if test "$ext_shared" = "yes"; then |
---|
587 | $3="-l$1 [$]$3" |
---|
588 | if test -n "$2"; then |
---|
589 | PHP_ADD_LIBPATH($2,$3) |
---|
590 | fi |
---|
591 | else |
---|
592 | PHP_ADD_LIBRARY_DEFER_WITH_PATH($1,$2) |
---|
593 | fi |
---|
594 | ]) |
---|
595 | ]) |
---|
596 | |
---|
597 | dnl |
---|
598 | dnl PHP_ADD_FRAMEWORK(framework [,before]) |
---|
599 | dnl |
---|
600 | dnl add a (Darwin / Mac OS X) framework to the link |
---|
601 | dnl line. if before is 1, the framework is added |
---|
602 | dnl to the beginning of the line. |
---|
603 | dnl |
---|
604 | AC_DEFUN([PHP_ADD_FRAMEWORK], [ |
---|
605 | PHP_RUN_ONCE(FRAMEWORKS, $1, [ |
---|
606 | if test "$2"; then |
---|
607 | PHP_FRAMEWORKS="-framework $1 $PHP_FRAMEWORKS" |
---|
608 | else |
---|
609 | PHP_FRAMEWORKS="$PHP_FRAMEWORKS -framework $1" |
---|
610 | fi |
---|
611 | ]) |
---|
612 | ]) |
---|
613 | |
---|
614 | dnl |
---|
615 | dnl PHP_ADD_FRAMEWORKPATH(path [,before]) |
---|
616 | dnl |
---|
617 | dnl add a (Darwin / Mac OS X) framework path to the link |
---|
618 | dnl and include lines. default paths include (but are |
---|
619 | dnl not limited to) /Local/Library/Frameworks and |
---|
620 | dnl /System/Library/Frameworks, so these don't need |
---|
621 | dnl to be specifically added. if before is 1, the |
---|
622 | dnl framework path is added to the beginning of the |
---|
623 | dnl relevant lines. |
---|
624 | dnl |
---|
625 | AC_DEFUN([PHP_ADD_FRAMEWORKPATH], [ |
---|
626 | PHP_EXPAND_PATH($1, ai_p) |
---|
627 | PHP_RUN_ONCE(FRAMEWORKPATH, $ai_p, [ |
---|
628 | if test "$2"; then |
---|
629 | PHP_FRAMEWORKPATH="-F$ai_p $PHP_FRAMEWORKPATH" |
---|
630 | else |
---|
631 | PHP_FRAMEWORKPATH="$PHP_FRAMEWORKPATH -F$ai_p" |
---|
632 | fi |
---|
633 | ]) |
---|
634 | ]) |
---|
635 | |
---|
636 | dnl |
---|
637 | dnl PHP_ADD_FRAMEWORK_WITH_PATH(framework, path) |
---|
638 | dnl |
---|
639 | dnl Adds a (Darwin / Mac OS X) framework path and the |
---|
640 | dnl framework itself to the link and include lines. |
---|
641 | dnl |
---|
642 | AC_DEFUN([PHP_ADD_FRAMEWORK_WITH_PATH], [ |
---|
643 | PHP_ADD_FRAMEWORKPATH($2) |
---|
644 | PHP_ADD_FRAMEWORK($1) |
---|
645 | ]) |
---|
646 | |
---|
647 | dnl |
---|
648 | dnl PHP_SET_LIBTOOL_VARIABLE(var) |
---|
649 | dnl |
---|
650 | dnl Set libtool variable |
---|
651 | dnl |
---|
652 | AC_DEFUN([PHP_SET_LIBTOOL_VARIABLE],[ |
---|
653 | if test -z "$LIBTOOL"; then |
---|
654 | LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' |
---|
655 | else |
---|
656 | LIBTOOL="$LIBTOOL $1" |
---|
657 | fi |
---|
658 | ]) |
---|
659 | |
---|
660 | dnl ------------------------------------------------------------------------- |
---|
661 | dnl Wrapper macros for AC_ARG_WITH / AC_ARG_ENABLE |
---|
662 | dnl ------------------------------------------------------------------------- |
---|
663 | |
---|
664 | dnl PHP_ARG_ANALYZE_EX |
---|
665 | dnl internal |
---|
666 | AC_DEFUN([PHP_ARG_ANALYZE_EX],[ |
---|
667 | ext_output="yes, shared" |
---|
668 | ext_shared=yes |
---|
669 | case [$]$1 in |
---|
670 | shared,*[)] |
---|
671 | $1=`echo "[$]$1"|$SED 's/^shared,//'` |
---|
672 | ;; |
---|
673 | shared[)] |
---|
674 | $1=yes |
---|
675 | ;; |
---|
676 | no[)] |
---|
677 | ext_output=no |
---|
678 | ext_shared=no |
---|
679 | ;; |
---|
680 | *[)] |
---|
681 | ext_output=yes |
---|
682 | ext_shared=no |
---|
683 | ;; |
---|
684 | esac |
---|
685 | |
---|
686 | PHP_ALWAYS_SHARED([$1]) |
---|
687 | ]) |
---|
688 | |
---|
689 | dnl PHP_ARG_ANALYZE |
---|
690 | dnl internal |
---|
691 | AC_DEFUN([PHP_ARG_ANALYZE],[ |
---|
692 | ifelse([$3],yes,[PHP_ARG_ANALYZE_EX([$1])],[ext_output=ifelse([$]$1,,no,[$]$1)]) |
---|
693 | ifelse([$2],,,[AC_MSG_RESULT([$ext_output])]) |
---|
694 | ]) |
---|
695 | |
---|
696 | dnl |
---|
697 | dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val[, extension-or-not]]) |
---|
698 | dnl Sets PHP_ARG_NAME either to the user value or to the default value. |
---|
699 | dnl default-val defaults to no. This will also set the variable ext_shared, |
---|
700 | dnl and will overwrite any previous variable of that name. |
---|
701 | dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run |
---|
702 | dnl the PHP_ARG_ANALYZE_EX. |
---|
703 | dnl |
---|
704 | AC_DEFUN([PHP_ARG_WITH],[ |
---|
705 | php_with_[]translit($1,A-Z0-9-,a-z0-9_)=ifelse($4,,no,$4) |
---|
706 | PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)]) |
---|
707 | ]) |
---|
708 | |
---|
709 | dnl PHP_REAL_ARG_WITH |
---|
710 | dnl internal |
---|
711 | AC_DEFUN([PHP_REAL_ARG_WITH],[ |
---|
712 | ifelse([$2],,,[AC_MSG_CHECKING([$2])]) |
---|
713 | AC_ARG_WITH($1,[$3],$5=[$]withval, |
---|
714 | [ |
---|
715 | $5=ifelse($4,,no,$4) |
---|
716 | |
---|
717 | if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then |
---|
718 | $5=$PHP_ENABLE_ALL |
---|
719 | fi |
---|
720 | ]) |
---|
721 | PHP_ARG_ANALYZE($5,[$2],$6) |
---|
722 | ]) |
---|
723 | |
---|
724 | dnl |
---|
725 | dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val[, extension-or-not]]) |
---|
726 | dnl Sets PHP_ARG_NAME either to the user value or to the default value. |
---|
727 | dnl default-val defaults to no. This will also set the variable ext_shared, |
---|
728 | dnl and will overwrite any previous variable of that name. |
---|
729 | dnl If extension-or-not is yes (default), then do the ENABLE_ALL check and run |
---|
730 | dnl the PHP_ARG_ANALYZE_EX. |
---|
731 | dnl |
---|
732 | AC_DEFUN([PHP_ARG_ENABLE],[ |
---|
733 | php_enable_[]translit($1,A-Z0-9-,a-z0-9_)=ifelse($4,,no,$4) |
---|
734 | PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_),[ifelse($5,,yes,$5)]) |
---|
735 | ]) |
---|
736 | |
---|
737 | dnl PHP_REAL_ARG_ENABLE |
---|
738 | dnl internal |
---|
739 | AC_DEFUN([PHP_REAL_ARG_ENABLE],[ |
---|
740 | ifelse([$2],,,[AC_MSG_CHECKING([$2])]) |
---|
741 | AC_ARG_ENABLE($1,[$3],$5=[$]enableval, |
---|
742 | [ |
---|
743 | $5=ifelse($4,,no,$4) |
---|
744 | |
---|
745 | if test "$PHP_ENABLE_ALL" && test "$6" = "yes"; then |
---|
746 | $5=$PHP_ENABLE_ALL |
---|
747 | fi |
---|
748 | ]) |
---|
749 | PHP_ARG_ANALYZE($5,[$2],$6) |
---|
750 | ]) |
---|
751 | |
---|
752 | dnl ------------------------------------------------------------------------- |
---|
753 | dnl Build macros |
---|
754 | dnl ------------------------------------------------------------------------- |
---|
755 | |
---|
756 | dnl |
---|
757 | dnl PHP_BUILD_THREAD_SAFE |
---|
758 | dnl |
---|
759 | AC_DEFUN([PHP_BUILD_THREAD_SAFE],[ |
---|
760 | enable_maintainer_zts=yes |
---|
761 | if test "$pthreads_working" != "yes"; then |
---|
762 | AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.]) |
---|
763 | fi |
---|
764 | ]) |
---|
765 | |
---|
766 | dnl |
---|
767 | dnl PHP_REQUIRE_CXX |
---|
768 | dnl |
---|
769 | AC_DEFUN([PHP_REQUIRE_CXX],[ |
---|
770 | if test -z "$php_cxx_done"; then |
---|
771 | AC_PROG_CXX |
---|
772 | AC_PROG_CXXCPP |
---|
773 | php_cxx_done=yes |
---|
774 | fi |
---|
775 | ]) |
---|
776 | |
---|
777 | dnl |
---|
778 | dnl PHP_BUILD_SHARED |
---|
779 | dnl |
---|
780 | AC_DEFUN([PHP_BUILD_SHARED],[ |
---|
781 | PHP_BUILD_PROGRAM |
---|
782 | OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la] |
---|
783 | php_build_target=shared |
---|
784 | |
---|
785 | php_c_pre=$shared_c_pre |
---|
786 | php_c_meta=$shared_c_meta |
---|
787 | php_c_post=$shared_c_post |
---|
788 | php_cxx_pre=$shared_cxx_pre |
---|
789 | php_cxx_meta=$shared_cxx_meta |
---|
790 | php_cxx_post=$shared_cxx_post |
---|
791 | php_lo=$shared_lo |
---|
792 | ]) |
---|
793 | |
---|
794 | dnl |
---|
795 | dnl PHP_BUILD_STATIC |
---|
796 | dnl |
---|
797 | AC_DEFUN([PHP_BUILD_STATIC],[ |
---|
798 | PHP_BUILD_PROGRAM |
---|
799 | OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la] |
---|
800 | php_build_target=static |
---|
801 | ]) |
---|
802 | |
---|
803 | dnl |
---|
804 | dnl PHP_BUILD_BUNDLE |
---|
805 | dnl |
---|
806 | AC_DEFUN([PHP_BUILD_BUNDLE],[ |
---|
807 | PHP_BUILD_PROGRAM |
---|
808 | OVERALL_TARGET=libs/libphp[]$PHP_MAJOR_VERSION[.bundle] |
---|
809 | php_build_target=static |
---|
810 | ]) |
---|
811 | |
---|
812 | dnl |
---|
813 | dnl PHP_BUILD_PROGRAM |
---|
814 | dnl |
---|
815 | AC_DEFUN([PHP_BUILD_PROGRAM],[ |
---|
816 | OVERALL_TARGET=[]ifelse($1,,php,$1) |
---|
817 | php_c_pre='$(LIBTOOL) --mode=compile $(CC)' |
---|
818 | php_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)' |
---|
819 | php_c_post= |
---|
820 | php_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)' |
---|
821 | php_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)' |
---|
822 | php_cxx_post= |
---|
823 | php_lo=lo |
---|
824 | |
---|
825 | case $with_pic in |
---|
826 | yes) pic_setting='-prefer-pic';; |
---|
827 | no) pic_setting='-prefer-non-pic';; |
---|
828 | esac |
---|
829 | |
---|
830 | shared_c_pre='$(LIBTOOL) --mode=compile $(CC)' |
---|
831 | shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) '$pic_setting |
---|
832 | shared_c_post= |
---|
833 | shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)' |
---|
834 | shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) '$pic_setting |
---|
835 | shared_cxx_post= |
---|
836 | shared_lo=lo |
---|
837 | |
---|
838 | php_build_target=program |
---|
839 | ]) |
---|
840 | |
---|
841 | dnl |
---|
842 | dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx, zend_ext) |
---|
843 | dnl |
---|
844 | dnl Basically sets up the link-stage for building module-name |
---|
845 | dnl from object_var in build-dir. |
---|
846 | dnl |
---|
847 | AC_DEFUN([PHP_SHARED_MODULE],[ |
---|
848 | install_modules="install-modules" |
---|
849 | |
---|
850 | case $host_alias in |
---|
851 | *aix*[)] |
---|
852 | suffix=so |
---|
853 | link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -Wl,-G -o '$3'/$1.la -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) && mv -f '$3'/.libs/$1.so '$3'/$1.so' |
---|
854 | ;; |
---|
855 | *netware*[)] |
---|
856 | suffix=nlm |
---|
857 | link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php5lib, , -L$(top_builddir)/netware -lphp5lib) $(translit(ifelse($1, php5lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)' |
---|
858 | ;; |
---|
859 | *[)] |
---|
860 | suffix=la |
---|
861 | link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)' |
---|
862 | ;; |
---|
863 | esac |
---|
864 | |
---|
865 | if test "x$5" = "xyes"; then |
---|
866 | PHP_ZEND_EX="$PHP_ZEND_EX \$(phplibdir)/$1.$suffix" |
---|
867 | else |
---|
868 | PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.$suffix" |
---|
869 | fi |
---|
870 | PHP_SUBST($2) |
---|
871 | cat >>Makefile.objects<<EOF |
---|
872 | \$(phplibdir)/$1.$suffix: $3/$1.$suffix |
---|
873 | \$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir) |
---|
874 | |
---|
875 | $3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES) |
---|
876 | $link_cmd |
---|
877 | |
---|
878 | EOF |
---|
879 | ]) |
---|
880 | |
---|
881 | dnl |
---|
882 | dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]]) |
---|
883 | dnl |
---|
884 | dnl Selects the SAPI name and type (static, shared, programm) |
---|
885 | dnl and optionally also the source-files for the SAPI-specific |
---|
886 | dnl objects. |
---|
887 | dnl |
---|
888 | AC_DEFUN([PHP_SELECT_SAPI],[ |
---|
889 | PHP_SAPI=$1 |
---|
890 | |
---|
891 | case "$2" in |
---|
892 | static[)] PHP_BUILD_STATIC;; |
---|
893 | shared[)] PHP_BUILD_SHARED;; |
---|
894 | bundle[)] PHP_BUILD_BUNDLE;; |
---|
895 | program[)] PHP_BUILD_PROGRAM($5);; |
---|
896 | esac |
---|
897 | |
---|
898 | ifelse($3,,,[PHP_ADD_SOURCES([sapi/$1],[$3],[$4],[sapi])]) |
---|
899 | ]) |
---|
900 | |
---|
901 | dnl deprecated |
---|
902 | AC_DEFUN([PHP_EXTENSION],[ |
---|
903 | sources=`$AWK -f $abs_srcdir/build/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in` |
---|
904 | |
---|
905 | PHP_NEW_EXTENSION($1, $sources, $2, $3) |
---|
906 | |
---|
907 | if test -r "$ext_srcdir/Makefile.frag"; then |
---|
908 | PHP_ADD_MAKEFILE_FRAGMENT |
---|
909 | fi |
---|
910 | ]) |
---|
911 | |
---|
912 | AC_DEFUN([PHP_ADD_BUILD_DIR],[ |
---|
913 | ifelse($2,,[ |
---|
914 | BUILD_DIR="$BUILD_DIR $1" |
---|
915 | ], [ |
---|
916 | $php_shtool mkdir -p $1 |
---|
917 | ]) |
---|
918 | ]) |
---|
919 | |
---|
920 | AC_DEFUN([PHP_GEN_BUILD_DIRS],[ |
---|
921 | $php_shtool mkdir -p $BUILD_DIR |
---|
922 | ]) |
---|
923 | |
---|
924 | dnl |
---|
925 | dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx[, zend_ext]]]]]) |
---|
926 | dnl |
---|
927 | dnl Includes an extension in the build. |
---|
928 | dnl |
---|
929 | dnl "extname" is the name of the ext/ subdir where the extension resides. |
---|
930 | dnl "sources" is a list of files relative to the subdir which are used |
---|
931 | dnl to build the extension. |
---|
932 | dnl "shared" can be set to "shared" or "yes" to build the extension as |
---|
933 | dnl a dynamically loadable library. Optional parameter "sapi_class" can |
---|
934 | dnl be set to "cli" to mark extension build only with CLI or CGI sapi's. |
---|
935 | dnl "extra-cflags" are passed to the compiler, with |
---|
936 | dnl @ext_srcdir@ and @ext_builddir@ being substituted. |
---|
937 | dnl "cxx" can be used to indicate that a C++ shared module is desired. |
---|
938 | dnl "zend_ext" indicates a zend extension. |
---|
939 | AC_DEFUN([PHP_NEW_EXTENSION],[ |
---|
940 | ext_builddir=[]PHP_EXT_BUILDDIR($1) |
---|
941 | ext_srcdir=[]PHP_EXT_SRCDIR($1) |
---|
942 | |
---|
943 | ifelse($5,,ac_extra=,[ac_extra=`echo "$5"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g`]) |
---|
944 | |
---|
945 | if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then |
---|
946 | dnl ---------------------------------------------- Static module |
---|
947 | [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no |
---|
948 | PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,) |
---|
949 | EXT_STATIC="$EXT_STATIC $1" |
---|
950 | if test "$3" != "nocli"; then |
---|
951 | EXT_CLI_STATIC="$EXT_CLI_STATIC $1" |
---|
952 | fi |
---|
953 | else |
---|
954 | if test "$3" = "shared" || test "$3" = "yes"; then |
---|
955 | dnl ---------------------------------------------- Shared module |
---|
956 | [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=yes |
---|
957 | PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes) |
---|
958 | case $host_alias in |
---|
959 | *netware*[)] |
---|
960 | PHP_SHARED_MODULE(php$1,shared_objects_$1, $ext_builddir, $6, $7) |
---|
961 | ;; |
---|
962 | *[)] |
---|
963 | PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6, $7) |
---|
964 | ;; |
---|
965 | esac |
---|
966 | AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module) |
---|
967 | fi |
---|
968 | fi |
---|
969 | |
---|
970 | if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then |
---|
971 | dnl ---------------------------------------------- CLI static module |
---|
972 | [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no |
---|
973 | if test "$PHP_SAPI" = "cgi"; then |
---|
974 | PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,) |
---|
975 | EXT_STATIC="$EXT_STATIC $1" |
---|
976 | else |
---|
977 | PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli) |
---|
978 | fi |
---|
979 | EXT_CLI_STATIC="$EXT_CLI_STATIC $1" |
---|
980 | fi |
---|
981 | PHP_ADD_BUILD_DIR($ext_builddir) |
---|
982 | |
---|
983 | dnl Set for phpize builds only |
---|
984 | dnl --------------------------- |
---|
985 | if test "$ext_builddir" = "."; then |
---|
986 | PHP_PECL_EXTENSION=$1 |
---|
987 | PHP_SUBST(PHP_PECL_EXTENSION) |
---|
988 | fi |
---|
989 | ]) |
---|
990 | |
---|
991 | dnl |
---|
992 | dnl PHP_WITH_SHARED |
---|
993 | dnl |
---|
994 | dnl Checks whether $withval is "shared" or starts with "shared,XXX" |
---|
995 | dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff |
---|
996 | dnl from $withval. |
---|
997 | dnl |
---|
998 | AC_DEFUN([PHP_WITH_SHARED],[ |
---|
999 | PHP_ARG_ANALYZE_EX(withval) |
---|
1000 | shared=$ext_shared |
---|
1001 | unset ext_shared ext_output |
---|
1002 | ]) |
---|
1003 | |
---|
1004 | dnl |
---|
1005 | dnl PHP_ADD_EXTENSION_DEP(extname, depends [, depconf]) |
---|
1006 | dnl |
---|
1007 | dnl This macro is scanned by genif.sh when it builds the internal functions |
---|
1008 | dnl list, so that modules can be init'd in the correct order |
---|
1009 | dnl $1 = name of extension, $2 = extension upon which it depends |
---|
1010 | dnl $3 = optional: if true, it's ok for $2 to have not been configured |
---|
1011 | dnl default is false and should halt the build. |
---|
1012 | dnl To be effective, this macro must be invoked *after* PHP_NEW_EXTENSION. |
---|
1013 | dnl The extension on which it depends must also have been configured. |
---|
1014 | dnl See ADD_EXTENSION_DEP in win32 build |
---|
1015 | dnl |
---|
1016 | AC_DEFUN([PHP_ADD_EXTENSION_DEP], [ |
---|
1017 | am_i_shared=$[PHP_]translit($1,a-z_-,A-Z__)[_SHARED] |
---|
1018 | is_it_shared=$[PHP_]translit($2,a-z_-,A-Z__)[_SHARED] |
---|
1019 | is_it_enabled=$[PHP_]translit($2,a-z_-,A-Z__) |
---|
1020 | if test "$am_i_shared" = "no" && test "$is_it_shared" = "yes" ; then |
---|
1021 | AC_MSG_ERROR([ |
---|
1022 | You've configured extension $1 to build statically, but it |
---|
1023 | depends on extension $2, which you've configured to build shared. |
---|
1024 | You either need to build $1 shared or build $2 statically for the |
---|
1025 | build to be successful. |
---|
1026 | ]) |
---|
1027 | fi |
---|
1028 | if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then |
---|
1029 | AC_MSG_ERROR([ |
---|
1030 | You've configured extension $1, which depends on extension $2, |
---|
1031 | but you've either not enabled $2, or have disabled it. |
---|
1032 | ]) |
---|
1033 | fi |
---|
1034 | dnl Some systems require that we link $2 to $1 when building |
---|
1035 | ]) |
---|
1036 | |
---|
1037 | dnl ------------------------------------------------------------------------- |
---|
1038 | dnl Checks for structures, typedefs, broken functions, etc. |
---|
1039 | dnl ------------------------------------------------------------------------- |
---|
1040 | |
---|
1041 | dnl Internal helper macros |
---|
1042 | dnl |
---|
1043 | dnl _PHP_DEF_HAVE_FILE(what, filename) |
---|
1044 | AC_DEFUN([_PHP_DEF_HAVE_FILE], [ |
---|
1045 | php_def_have_what=HAVE_[]`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_' ` |
---|
1046 | echo "#define $php_def_have_what 1" >> $2 |
---|
1047 | ]) |
---|
1048 | dnl |
---|
1049 | dnl _PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-found-action]]) |
---|
1050 | dnl |
---|
1051 | AC_DEFUN([_PHP_CHECK_SIZEOF], [ |
---|
1052 | php_cache_value=php_cv_sizeof_[]$1 |
---|
1053 | AC_CACHE_VAL(php_cv_sizeof_[]$1, [ |
---|
1054 | old_LIBS=$LIBS |
---|
1055 | LIBS= |
---|
1056 | old_LDFLAGS=$LDFLAGS |
---|
1057 | LDFLAGS= |
---|
1058 | AC_TRY_RUN([#include <stdio.h> |
---|
1059 | #if STDC_HEADERS |
---|
1060 | #include <stdlib.h> |
---|
1061 | #include <stddef.h> |
---|
1062 | #endif |
---|
1063 | #ifdef HAVE_INTTYPES_H |
---|
1064 | #include <inttypes.h> |
---|
1065 | #endif |
---|
1066 | #ifdef HAVE_UNISTD_H |
---|
1067 | #include <unistd.h> |
---|
1068 | #endif |
---|
1069 | $3 |
---|
1070 | |
---|
1071 | int main() |
---|
1072 | { |
---|
1073 | FILE *fp = fopen("conftestval", "w"); |
---|
1074 | if (!fp) return(1); |
---|
1075 | fprintf(fp, "%d\n", sizeof($1)); |
---|
1076 | return(0); |
---|
1077 | } |
---|
1078 | ], [ |
---|
1079 | eval $php_cache_value=`cat conftestval` |
---|
1080 | ], [ |
---|
1081 | eval $php_cache_value=0 |
---|
1082 | ], [ |
---|
1083 | ifelse([$2],,[eval $php_cache_value=0], [eval $php_cache_value=$2]) |
---|
1084 | ]) |
---|
1085 | LDFLAGS=$old_LDFLAGS |
---|
1086 | LIBS=$old_LIBS |
---|
1087 | ]) |
---|
1088 | if eval test "\$$php_cache_value" != "0"; then |
---|
1089 | ifelse([$4],[],:,[$4]) |
---|
1090 | ifelse([$5],[],,[else $5]) |
---|
1091 | fi |
---|
1092 | ]) |
---|
1093 | |
---|
1094 | dnl |
---|
1095 | dnl PHP_CHECK_SIZEOF(type, cross-value, extra-headers) |
---|
1096 | dnl |
---|
1097 | AC_DEFUN(PHP_CHECK_SIZEOF, [ |
---|
1098 | AC_MSG_CHECKING([size of $1]) |
---|
1099 | _PHP_CHECK_SIZEOF($1, $2, $3, [ |
---|
1100 | AC_DEFINE_UNQUOTED([SIZEOF_]translit($1,a-z,A-Z_), [$]php_cv_sizeof_[]$1, [Size of $1]) |
---|
1101 | AC_DEFINE_UNQUOTED([HAVE_]translit($1,a-z,A-Z_), 1, [Whether $1 is available]) |
---|
1102 | ]) |
---|
1103 | AC_MSG_RESULT([[$][php_cv_sizeof_]translit($1, ,_)]) |
---|
1104 | ]) |
---|
1105 | |
---|
1106 | dnl |
---|
1107 | dnl PHP_CHECK_TYPES(type-list, include-file [, extra-headers]) |
---|
1108 | dnl |
---|
1109 | AC_DEFUN([PHP_CHECK_TYPES], [ |
---|
1110 | for php_typename in $1; do |
---|
1111 | AC_MSG_CHECKING([whether $php_typename exists]) |
---|
1112 | _PHP_CHECK_SIZEOF($php_typename, 0, $3, [ |
---|
1113 | _PHP_DEF_HAVE_FILE($php_typename, $2) |
---|
1114 | AC_MSG_RESULT([yes]) |
---|
1115 | ], [ |
---|
1116 | AC_MSG_RESULT([no]) |
---|
1117 | ]) |
---|
1118 | done |
---|
1119 | ]) |
---|
1120 | |
---|
1121 | dnl |
---|
1122 | dnl PHP_CHECK_IN_ADDR_T |
---|
1123 | dnl |
---|
1124 | AC_DEFUN([PHP_CHECK_IN_ADDR_T], [ |
---|
1125 | dnl AIX keeps in_addr_t in /usr/include/netinet/in.h |
---|
1126 | AC_MSG_CHECKING([for in_addr_t]) |
---|
1127 | AC_CACHE_VAL(ac_cv_type_in_addr_t, |
---|
1128 | [AC_EGREP_CPP(dnl |
---|
1129 | changequote(<<,>>)dnl |
---|
1130 | <<in_addr_t[^a-zA-Z_0-9]>>dnl |
---|
1131 | changequote([,]), [#include <sys/types.h> |
---|
1132 | #if STDC_HEADERS |
---|
1133 | #include <stdlib.h> |
---|
1134 | #include <stddef.h> |
---|
1135 | #endif |
---|
1136 | #ifdef HAVE_NETINET_IN_H |
---|
1137 | #include <netinet/in.h> |
---|
1138 | #endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl |
---|
1139 | AC_MSG_RESULT([$ac_cv_type_in_addr_t]) |
---|
1140 | if test $ac_cv_type_in_addr_t = no; then |
---|
1141 | AC_DEFINE(in_addr_t, u_int, [ ]) |
---|
1142 | fi |
---|
1143 | ]) |
---|
1144 | |
---|
1145 | dnl |
---|
1146 | dnl PHP_TIME_R_TYPE |
---|
1147 | dnl |
---|
1148 | dnl Check type of reentrant time-related functions |
---|
1149 | dnl Type can be: irix, hpux or POSIX |
---|
1150 | dnl |
---|
1151 | AC_DEFUN([PHP_TIME_R_TYPE],[ |
---|
1152 | AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[ |
---|
1153 | AC_TRY_RUN([ |
---|
1154 | #include <time.h> |
---|
1155 | |
---|
1156 | main() { |
---|
1157 | char buf[27]; |
---|
1158 | struct tm t; |
---|
1159 | time_t old = 0; |
---|
1160 | int r, s; |
---|
1161 | |
---|
1162 | s = gmtime_r(&old, &t); |
---|
1163 | r = (int) asctime_r(&t, buf, 26); |
---|
1164 | if (r == s && s == 0) return (0); |
---|
1165 | return (1); |
---|
1166 | } |
---|
1167 | ],[ |
---|
1168 | ac_cv_time_r_type=hpux |
---|
1169 | ],[ |
---|
1170 | AC_TRY_RUN([ |
---|
1171 | #include <time.h> |
---|
1172 | main() { |
---|
1173 | struct tm t, *s; |
---|
1174 | time_t old = 0; |
---|
1175 | char buf[27], *p; |
---|
1176 | |
---|
1177 | s = gmtime_r(&old, &t); |
---|
1178 | p = asctime_r(&t, buf, 26); |
---|
1179 | if (p == buf && s == &t) return (0); |
---|
1180 | return (1); |
---|
1181 | } |
---|
1182 | ],[ |
---|
1183 | ac_cv_time_r_type=irix |
---|
1184 | ],[ |
---|
1185 | ac_cv_time_r_type=POSIX |
---|
1186 | ],[ |
---|
1187 | ac_cv_time_r_type=POSIX |
---|
1188 | ]) |
---|
1189 | ],[ |
---|
1190 | ac_cv_time_r_type=POSIX |
---|
1191 | ]) |
---|
1192 | ]) |
---|
1193 | case $ac_cv_time_r_type in |
---|
1194 | hpux[)] AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;; |
---|
1195 | irix[)] AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;; |
---|
1196 | esac |
---|
1197 | ]) |
---|
1198 | |
---|
1199 | dnl |
---|
1200 | dnl PHP_DOES_PWRITE_WORK |
---|
1201 | dnl internal |
---|
1202 | AC_DEFUN([PHP_DOES_PWRITE_WORK],[ |
---|
1203 | AC_TRY_RUN([ |
---|
1204 | #include <sys/types.h> |
---|
1205 | #include <sys/stat.h> |
---|
1206 | #include <fcntl.h> |
---|
1207 | #include <unistd.h> |
---|
1208 | #include <errno.h> |
---|
1209 | $1 |
---|
1210 | main() { |
---|
1211 | int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); |
---|
1212 | |
---|
1213 | if (fd < 0) exit(1); |
---|
1214 | if (pwrite(fd, "text", 4, 0) != 4) exit(1); |
---|
1215 | /* Linux glibc breakage until 2.2.5 */ |
---|
1216 | if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); |
---|
1217 | exit(0); |
---|
1218 | } |
---|
1219 | |
---|
1220 | ],[ |
---|
1221 | ac_cv_pwrite=yes |
---|
1222 | ],[ |
---|
1223 | ac_cv_pwrite=no |
---|
1224 | ],[ |
---|
1225 | ac_cv_pwrite=no |
---|
1226 | ]) |
---|
1227 | ]) |
---|
1228 | |
---|
1229 | dnl PHP_DOES_PREAD_WORK |
---|
1230 | dnl internal |
---|
1231 | AC_DEFUN([PHP_DOES_PREAD_WORK],[ |
---|
1232 | echo test > conftest_in |
---|
1233 | AC_TRY_RUN([ |
---|
1234 | #include <sys/types.h> |
---|
1235 | #include <sys/stat.h> |
---|
1236 | #include <fcntl.h> |
---|
1237 | #include <unistd.h> |
---|
1238 | #include <errno.h> |
---|
1239 | $1 |
---|
1240 | main() { |
---|
1241 | char buf[3]; |
---|
1242 | int fd = open("conftest_in", O_RDONLY); |
---|
1243 | if (fd < 0) exit(1); |
---|
1244 | if (pread(fd, buf, 2, 0) != 2) exit(1); |
---|
1245 | /* Linux glibc breakage until 2.2.5 */ |
---|
1246 | if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); |
---|
1247 | exit(0); |
---|
1248 | } |
---|
1249 | ],[ |
---|
1250 | ac_cv_pread=yes |
---|
1251 | ],[ |
---|
1252 | ac_cv_pread=no |
---|
1253 | ],[ |
---|
1254 | ac_cv_pread=no |
---|
1255 | ]) |
---|
1256 | rm -f conftest_in |
---|
1257 | ]) |
---|
1258 | |
---|
1259 | dnl |
---|
1260 | dnl PHP_PWRITE_TEST |
---|
1261 | dnl |
---|
1262 | AC_DEFUN([PHP_PWRITE_TEST],[ |
---|
1263 | AC_CACHE_CHECK(whether pwrite works,ac_cv_pwrite,[ |
---|
1264 | PHP_DOES_PWRITE_WORK |
---|
1265 | if test "$ac_cv_pwrite" = "no"; then |
---|
1266 | PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);]) |
---|
1267 | if test "$ac_cv_pwrite" = "yes"; then |
---|
1268 | ac_cv_pwrite=64 |
---|
1269 | fi |
---|
1270 | fi |
---|
1271 | ]) |
---|
1272 | |
---|
1273 | if test "$ac_cv_pwrite" != "no"; then |
---|
1274 | AC_DEFINE(HAVE_PWRITE, 1, [ ]) |
---|
1275 | if test "$ac_cv_pwrite" = "64"; then |
---|
1276 | AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default]) |
---|
1277 | fi |
---|
1278 | fi |
---|
1279 | ]) |
---|
1280 | |
---|
1281 | dnl |
---|
1282 | dnl PHP_PREAD_TEST |
---|
1283 | dnl |
---|
1284 | AC_DEFUN([PHP_PREAD_TEST],[ |
---|
1285 | AC_CACHE_CHECK(whether pread works,ac_cv_pread,[ |
---|
1286 | PHP_DOES_PREAD_WORK |
---|
1287 | if test "$ac_cv_pread" = "no"; then |
---|
1288 | PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);]) |
---|
1289 | if test "$ac_cv_pread" = "yes"; then |
---|
1290 | ac_cv_pread=64 |
---|
1291 | fi |
---|
1292 | fi |
---|
1293 | ]) |
---|
1294 | |
---|
1295 | if test "$ac_cv_pread" != "no"; then |
---|
1296 | AC_DEFINE(HAVE_PREAD, 1, [ ]) |
---|
1297 | if test "$ac_cv_pread" = "64"; then |
---|
1298 | AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default]) |
---|
1299 | fi |
---|
1300 | fi |
---|
1301 | ]) |
---|
1302 | |
---|
1303 | dnl |
---|
1304 | dnl PHP_MISSING_TIME_R_DECL |
---|
1305 | dnl |
---|
1306 | AC_DEFUN([PHP_MISSING_TIME_R_DECL],[ |
---|
1307 | AC_MSG_CHECKING([for missing declarations of reentrant functions]) |
---|
1308 | AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[ |
---|
1309 | : |
---|
1310 | ],[ |
---|
1311 | AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared]) |
---|
1312 | ]) |
---|
1313 | AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[ |
---|
1314 | : |
---|
1315 | ],[ |
---|
1316 | AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared]) |
---|
1317 | ]) |
---|
1318 | AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[ |
---|
1319 | : |
---|
1320 | ],[ |
---|
1321 | AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared]) |
---|
1322 | ]) |
---|
1323 | AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[ |
---|
1324 | : |
---|
1325 | ],[ |
---|
1326 | AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared]) |
---|
1327 | ]) |
---|
1328 | AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[ |
---|
1329 | : |
---|
1330 | ],[ |
---|
1331 | AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared]) |
---|
1332 | ]) |
---|
1333 | AC_MSG_RESULT([done]) |
---|
1334 | ]) |
---|
1335 | |
---|
1336 | dnl |
---|
1337 | dnl PHP_READDIR_R_TYPE |
---|
1338 | dnl |
---|
1339 | AC_DEFUN([PHP_READDIR_R_TYPE],[ |
---|
1340 | dnl HAVE_READDIR_R is also defined by libmysql |
---|
1341 | AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no) |
---|
1342 | if test "$ac_cv_func_readdir_r" = "yes"; then |
---|
1343 | AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[ |
---|
1344 | AC_TRY_RUN([ |
---|
1345 | #define _REENTRANT |
---|
1346 | #include <sys/types.h> |
---|
1347 | #include <dirent.h> |
---|
1348 | |
---|
1349 | #ifndef PATH_MAX |
---|
1350 | #define PATH_MAX 1024 |
---|
1351 | #endif |
---|
1352 | |
---|
1353 | main() { |
---|
1354 | DIR *dir; |
---|
1355 | char entry[sizeof(struct dirent)+PATH_MAX]; |
---|
1356 | struct dirent *pentry = (struct dirent *) &entry; |
---|
1357 | |
---|
1358 | dir = opendir("/"); |
---|
1359 | if (!dir) |
---|
1360 | exit(1); |
---|
1361 | if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) |
---|
1362 | exit(0); |
---|
1363 | exit(1); |
---|
1364 | } |
---|
1365 | ],[ |
---|
1366 | ac_cv_what_readdir_r=POSIX |
---|
1367 | ],[ |
---|
1368 | AC_TRY_CPP([ |
---|
1369 | #define _REENTRANT |
---|
1370 | #include <sys/types.h> |
---|
1371 | #include <dirent.h> |
---|
1372 | int readdir_r(DIR *, struct dirent *); |
---|
1373 | ],[ |
---|
1374 | ac_cv_what_readdir_r=old-style |
---|
1375 | ],[ |
---|
1376 | ac_cv_what_readdir_r=none |
---|
1377 | ]) |
---|
1378 | ],[ |
---|
1379 | ac_cv_what_readdir_r=none |
---|
1380 | ]) |
---|
1381 | ]) |
---|
1382 | case $ac_cv_what_readdir_r in |
---|
1383 | POSIX) |
---|
1384 | AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);; |
---|
1385 | old-style) |
---|
1386 | AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);; |
---|
1387 | esac |
---|
1388 | fi |
---|
1389 | ]) |
---|
1390 | |
---|
1391 | dnl |
---|
1392 | dnl PHP_TM_GMTOFF |
---|
1393 | dnl |
---|
1394 | AC_DEFUN([PHP_TM_GMTOFF],[ |
---|
1395 | AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, |
---|
1396 | [AC_TRY_COMPILE([#include <sys/types.h> |
---|
1397 | #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;], |
---|
1398 | ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) |
---|
1399 | |
---|
1400 | if test "$ac_cv_struct_tm_gmtoff" = yes; then |
---|
1401 | AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm]) |
---|
1402 | fi |
---|
1403 | ]) |
---|
1404 | |
---|
1405 | dnl |
---|
1406 | dnl PHP_STRUCT_FLOCK |
---|
1407 | dnl |
---|
1408 | AC_DEFUN([PHP_STRUCT_FLOCK],[ |
---|
1409 | AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock, |
---|
1410 | AC_TRY_COMPILE([ |
---|
1411 | #include <unistd.h> |
---|
1412 | #include <fcntl.h> |
---|
1413 | ], |
---|
1414 | [struct flock x;], |
---|
1415 | [ |
---|
1416 | ac_cv_struct_flock=yes |
---|
1417 | ],[ |
---|
1418 | ac_cv_struct_flock=no |
---|
1419 | ]) |
---|
1420 | ) |
---|
1421 | if test "$ac_cv_struct_flock" = "yes" ; then |
---|
1422 | AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock]) |
---|
1423 | fi |
---|
1424 | ]) |
---|
1425 | |
---|
1426 | dnl |
---|
1427 | dnl PHP_SOCKLEN_T |
---|
1428 | dnl |
---|
1429 | AC_DEFUN([PHP_SOCKLEN_T],[ |
---|
1430 | AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t, |
---|
1431 | AC_TRY_COMPILE([ |
---|
1432 | #include <sys/types.h> |
---|
1433 | #include <sys/socket.h> |
---|
1434 | ],[ |
---|
1435 | socklen_t x; |
---|
1436 | ],[ |
---|
1437 | ac_cv_socklen_t=yes |
---|
1438 | ],[ |
---|
1439 | ac_cv_socklen_t=no |
---|
1440 | ])) |
---|
1441 | if test "$ac_cv_socklen_t" = "yes"; then |
---|
1442 | AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t]) |
---|
1443 | fi |
---|
1444 | ]) |
---|
1445 | |
---|
1446 | dnl |
---|
1447 | dnl PHP_MISSING_FCLOSE_DECL |
---|
1448 | dnl |
---|
1449 | dnl See if we have broken header files like SunOS has. |
---|
1450 | dnl |
---|
1451 | AC_DEFUN([PHP_MISSING_FCLOSE_DECL],[ |
---|
1452 | AC_MSG_CHECKING([for fclose declaration]) |
---|
1453 | AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[ |
---|
1454 | AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ]) |
---|
1455 | AC_MSG_RESULT([ok]) |
---|
1456 | ],[ |
---|
1457 | AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ]) |
---|
1458 | AC_MSG_RESULT([missing]) |
---|
1459 | ]) |
---|
1460 | ]) |
---|
1461 | |
---|
1462 | dnl |
---|
1463 | dnl PHP_AC_BROKEN_SPRINTF |
---|
1464 | dnl |
---|
1465 | dnl Check for broken sprintf(), C99 conformance |
---|
1466 | dnl |
---|
1467 | AC_DEFUN([PHP_AC_BROKEN_SPRINTF],[ |
---|
1468 | AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[ |
---|
1469 | AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[ |
---|
1470 | ac_cv_broken_sprintf=no |
---|
1471 | ],[ |
---|
1472 | ac_cv_broken_sprintf=yes |
---|
1473 | ],[ |
---|
1474 | ac_cv_broken_sprintf=no |
---|
1475 | ]) |
---|
1476 | ]) |
---|
1477 | if test "$ac_cv_broken_sprintf" = "yes"; then |
---|
1478 | AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [Whether sprintf is C99 conform]) |
---|
1479 | else |
---|
1480 | AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [Whether sprintf is C99 conform]) |
---|
1481 | fi |
---|
1482 | ]) |
---|
1483 | |
---|
1484 | dnl |
---|
1485 | dnl PHP_AC_BROKEN_SNPRINTF |
---|
1486 | dnl |
---|
1487 | dnl Check for broken snprintf(), C99 conformance |
---|
1488 | dnl |
---|
1489 | AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[ |
---|
1490 | AC_CACHE_CHECK(whether snprintf is broken, ac_cv_broken_snprintf,[ |
---|
1491 | AC_TRY_RUN([ |
---|
1492 | #define NULL (0L) |
---|
1493 | main() { |
---|
1494 | char buf[20]; |
---|
1495 | int res = 0; |
---|
1496 | res = res || (snprintf(buf, 2, "marcus") != 6); |
---|
1497 | res = res || (buf[1] != '\0'); |
---|
1498 | /* Implementations may consider this as an encoding error */ |
---|
1499 | snprintf(buf, 0, "boerger"); |
---|
1500 | /* However, they MUST ignore the pointer */ |
---|
1501 | res = res || (buf[0] != 'm'); |
---|
1502 | res = res || (snprintf(NULL, 0, "boerger") != 7); |
---|
1503 | res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8); |
---|
1504 | exit(res); |
---|
1505 | } |
---|
1506 | ],[ |
---|
1507 | ac_cv_broken_snprintf=no |
---|
1508 | ],[ |
---|
1509 | ac_cv_broken_snprintf=yes |
---|
1510 | ],[ |
---|
1511 | ac_cv_broken_snprintf=no |
---|
1512 | ]) |
---|
1513 | ]) |
---|
1514 | if test "$ac_cv_broken_snprintf" = "yes"; then |
---|
1515 | AC_DEFINE(PHP_BROKEN_SNPRINTF, 1, [Whether snprintf is C99 conform]) |
---|
1516 | else |
---|
1517 | AC_DEFINE(PHP_BROKEN_SNPRINTF, 0, [Whether snprintf is C99 conform]) |
---|
1518 | fi |
---|
1519 | ]) |
---|
1520 | |
---|
1521 | dnl |
---|
1522 | dnl PHP_SOLARIS_PIC_WEIRDNESS |
---|
1523 | dnl |
---|
1524 | dnl Solaris requires main code to be position independent in order |
---|
1525 | dnl to let shared objects find symbols. Weird. Ugly. |
---|
1526 | dnl |
---|
1527 | dnl Must be run after all --with-NN options that let the user |
---|
1528 | dnl choose dynamic extensions, and after the gcc test. |
---|
1529 | dnl |
---|
1530 | AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[ |
---|
1531 | AC_MSG_CHECKING([whether -fPIC is required]) |
---|
1532 | if test -n "$EXT_SHARED"; then |
---|
1533 | os=`uname -sr 2>/dev/null` |
---|
1534 | case $os in |
---|
1535 | "SunOS 5.6"|"SunOS 5.7"[)] |
---|
1536 | case $CC in |
---|
1537 | gcc*|egcs*) |
---|
1538 | CFLAGS="$CFLAGS -fPIC";; |
---|
1539 | *[)] |
---|
1540 | CFLAGS="$CFLAGS -fpic";; |
---|
1541 | esac |
---|
1542 | AC_MSG_RESULT([yes]);; |
---|
1543 | *[)] |
---|
1544 | AC_MSG_RESULT([no]);; |
---|
1545 | esac |
---|
1546 | else |
---|
1547 | AC_MSG_RESULT([no]) |
---|
1548 | fi |
---|
1549 | ]) |
---|
1550 | |
---|
1551 | dnl |
---|
1552 | dnl PHP_SYS_LFS |
---|
1553 | dnl |
---|
1554 | dnl The problem is that the default compilation flags in Solaris 2.6 won't |
---|
1555 | dnl let programs access large files; you need to tell the compiler that |
---|
1556 | dnl you actually want your programs to work on large files. For more |
---|
1557 | dnl details about this brain damage please see: |
---|
1558 | dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html |
---|
1559 | dnl |
---|
1560 | dnl Written by Paul Eggert <eggert@twinsun.com>. |
---|
1561 | dnl |
---|
1562 | AC_DEFUN([PHP_SYS_LFS], |
---|
1563 | [dnl |
---|
1564 | # If available, prefer support for large files unless the user specified |
---|
1565 | # one of the CPPFLAGS, LDFLAGS, or LIBS variables. |
---|
1566 | AC_MSG_CHECKING([whether large file support needs explicit enabling]) |
---|
1567 | ac_getconfs='' |
---|
1568 | ac_result=yes |
---|
1569 | ac_set='' |
---|
1570 | ac_shellvars='CPPFLAGS LDFLAGS LIBS' |
---|
1571 | for ac_shellvar in $ac_shellvars; do |
---|
1572 | case $ac_shellvar in |
---|
1573 | CPPFLAGS[)] ac_lfsvar=LFS_CFLAGS ;; |
---|
1574 | *[)] ac_lfsvar=LFS_$ac_shellvar ;; |
---|
1575 | esac |
---|
1576 | eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar |
---|
1577 | (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } |
---|
1578 | ac_getconf=`getconf $ac_lfsvar` |
---|
1579 | ac_getconfs=$ac_getconfs$ac_getconf |
---|
1580 | eval ac_test_$ac_shellvar=\$ac_getconf |
---|
1581 | done |
---|
1582 | case "$ac_result$ac_getconfs" in |
---|
1583 | yes[)] ac_result=no ;; |
---|
1584 | esac |
---|
1585 | case "$ac_result$ac_set" in |
---|
1586 | yes?*[)] ac_result="yes, but $ac_set is already set, so use its settings" |
---|
1587 | esac |
---|
1588 | AC_MSG_RESULT([$ac_result]) |
---|
1589 | case $ac_result in |
---|
1590 | yes[)] |
---|
1591 | for ac_shellvar in $ac_shellvars; do |
---|
1592 | eval $ac_shellvar=\$ac_test_$ac_shellvar |
---|
1593 | done ;; |
---|
1594 | esac |
---|
1595 | ]) |
---|
1596 | |
---|
1597 | dnl |
---|
1598 | dnl PHP_SOCKADDR_CHECKS |
---|
1599 | dnl |
---|
1600 | AC_DEFUN([PHP_SOCKADDR_CHECKS], [ |
---|
1601 | dnl Check for struct sockaddr_storage exists |
---|
1602 | AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_sockaddr_storage, |
---|
1603 | [AC_TRY_COMPILE([#include <sys/types.h> |
---|
1604 | #include <sys/socket.h>], |
---|
1605 | [struct sockaddr_storage s; s], |
---|
1606 | [ac_cv_sockaddr_storage=yes], [ac_cv_sockaddr_storage=no]) |
---|
1607 | ]) |
---|
1608 | if test "$ac_cv_sockaddr_storage" = "yes"; then |
---|
1609 | AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [Whether you have struct sockaddr_storage]) |
---|
1610 | fi |
---|
1611 | dnl Check if field sa_len exists in struct sockaddr |
---|
1612 | AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[ |
---|
1613 | AC_TRY_COMPILE([#include <sys/types.h> |
---|
1614 | #include <sys/socket.h>], |
---|
1615 | [static struct sockaddr sa; int n = (int) sa.sa_len; return n;], |
---|
1616 | [ac_cv_sockaddr_sa_len=yes], [ac_cv_sockaddr_sa_len=no]) |
---|
1617 | ]) |
---|
1618 | if test "$ac_cv_sockaddr_sa_len" = "yes"; then |
---|
1619 | AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has field sa_len]) |
---|
1620 | fi |
---|
1621 | ]) |
---|
1622 | |
---|
1623 | dnl |
---|
1624 | dnl PHP_DECLARED_TIMEZONE |
---|
1625 | dnl |
---|
1626 | AC_DEFUN([PHP_DECLARED_TIMEZONE],[ |
---|
1627 | AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[ |
---|
1628 | AC_TRY_COMPILE([ |
---|
1629 | #include <sys/types.h> |
---|
1630 | #include <time.h> |
---|
1631 | #ifdef HAVE_SYS_TIME_H |
---|
1632 | #include <sys/time.h> |
---|
1633 | #endif |
---|
1634 | ],[ |
---|
1635 | time_t foo = (time_t) timezone; |
---|
1636 | ],[ |
---|
1637 | ac_cv_declared_timezone=yes |
---|
1638 | ],[ |
---|
1639 | ac_cv_declared_timezone=no |
---|
1640 | ])]) |
---|
1641 | if test "$ac_cv_declared_timezone" = "yes"; then |
---|
1642 | AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone]) |
---|
1643 | fi |
---|
1644 | ]) |
---|
1645 | |
---|
1646 | dnl |
---|
1647 | dnl PHP_EBCDIC |
---|
1648 | dnl |
---|
1649 | AC_DEFUN([PHP_EBCDIC], [ |
---|
1650 | AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[ |
---|
1651 | AC_TRY_RUN( [ |
---|
1652 | int main(void) { |
---|
1653 | return (unsigned char)'A' != (unsigned char)0xC1; |
---|
1654 | } |
---|
1655 | ],[ |
---|
1656 | ac_cv_ebcdic=yes |
---|
1657 | ],[ |
---|
1658 | ac_cv_ebcdic=no |
---|
1659 | ],[ |
---|
1660 | ac_cv_ebcdic=no |
---|
1661 | ])]) |
---|
1662 | if test "$ac_cv_ebcdic" = "yes"; then |
---|
1663 | AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC]) |
---|
1664 | fi |
---|
1665 | ]) |
---|
1666 | |
---|
1667 | dnl |
---|
1668 | dnl PHP_BROKEN_GETCWD |
---|
1669 | dnl |
---|
1670 | dnl Some systems, notably Solaris, cause getcwd() or realpath to fail if a |
---|
1671 | dnl component of the path has execute but not read permissions |
---|
1672 | dnl |
---|
1673 | AC_DEFUN([PHP_BROKEN_GETCWD],[ |
---|
1674 | AC_MSG_CHECKING([for broken getcwd]) |
---|
1675 | os=`uname -sr 2>/dev/null` |
---|
1676 | case $os in |
---|
1677 | SunOS*[)] |
---|
1678 | AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd]) |
---|
1679 | AC_MSG_RESULT([yes]);; |
---|
1680 | *[)] |
---|
1681 | AC_MSG_RESULT([no]);; |
---|
1682 | esac |
---|
1683 | ]) |
---|
1684 | |
---|
1685 | dnl |
---|
1686 | dnl PHP_BROKEN_GLIBC_FOPEN_APPEND |
---|
1687 | dnl |
---|
1688 | AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [ |
---|
1689 | AC_MSG_CHECKING([for broken libc stdio]) |
---|
1690 | AC_CACHE_VAL(have_broken_glibc_fopen_append,[ |
---|
1691 | AC_TRY_RUN([ |
---|
1692 | #include <stdio.h> |
---|
1693 | int main(int argc, char *argv[]) |
---|
1694 | { |
---|
1695 | FILE *fp; |
---|
1696 | long position; |
---|
1697 | char *filename = "/tmp/phpglibccheck"; |
---|
1698 | |
---|
1699 | fp = fopen(filename, "w"); |
---|
1700 | if (fp == NULL) { |
---|
1701 | perror("fopen"); |
---|
1702 | exit(2); |
---|
1703 | } |
---|
1704 | fputs("foobar", fp); |
---|
1705 | fclose(fp); |
---|
1706 | |
---|
1707 | fp = fopen(filename, "a+"); |
---|
1708 | position = ftell(fp); |
---|
1709 | fclose(fp); |
---|
1710 | unlink(filename); |
---|
1711 | if (position == 0) |
---|
1712 | return 1; |
---|
1713 | return 0; |
---|
1714 | } |
---|
1715 | ], |
---|
1716 | [have_broken_glibc_fopen_append=no], |
---|
1717 | [have_broken_glibc_fopen_append=yes ], |
---|
1718 | AC_TRY_COMPILE([ |
---|
1719 | #include <features.h> |
---|
1720 | ],[ |
---|
1721 | #if !__GLIBC_PREREQ(2,2) |
---|
1722 | choke me |
---|
1723 | #endif |
---|
1724 | ], |
---|
1725 | [have_broken_glibc_fopen_append=yes], |
---|
1726 | [have_broken_glibc_fopen_append=no ]) |
---|
1727 | )]) |
---|
1728 | |
---|
1729 | if test "$have_broken_glibc_fopen_append" = "yes"; then |
---|
1730 | AC_MSG_RESULT(yes) |
---|
1731 | AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+]) |
---|
1732 | else |
---|
1733 | AC_MSG_RESULT(no) |
---|
1734 | fi |
---|
1735 | ]) |
---|
1736 | |
---|
1737 | dnl |
---|
1738 | dnl PHP_FOPENCOOKIE |
---|
1739 | dnl |
---|
1740 | AC_DEFUN([PHP_FOPENCOOKIE], [ |
---|
1741 | AC_CHECK_FUNC(fopencookie, [have_glibc_fopencookie=yes]) |
---|
1742 | |
---|
1743 | if test "$have_glibc_fopencookie" = "yes"; then |
---|
1744 | dnl this comes in two flavors: |
---|
1745 | dnl newer glibcs (since 2.1.2 ? ) |
---|
1746 | dnl have a type called cookie_io_functions_t |
---|
1747 | AC_TRY_COMPILE([ |
---|
1748 | #define _GNU_SOURCE |
---|
1749 | #include <stdio.h> |
---|
1750 | ], [cookie_io_functions_t cookie;], [have_cookie_io_functions_t=yes], []) |
---|
1751 | |
---|
1752 | if test "$have_cookie_io_functions_t" = "yes"; then |
---|
1753 | cookie_io_functions_t=cookie_io_functions_t |
---|
1754 | have_fopen_cookie=yes |
---|
1755 | |
---|
1756 | dnl even newer glibcs have a different seeker definition... |
---|
1757 | AC_TRY_RUN([ |
---|
1758 | #define _GNU_SOURCE |
---|
1759 | #include <stdio.h> |
---|
1760 | |
---|
1761 | struct cookiedata { |
---|
1762 | __off64_t pos; |
---|
1763 | }; |
---|
1764 | |
---|
1765 | __ssize_t reader(void *cookie, char *buffer, size_t size) |
---|
1766 | { return size; } |
---|
1767 | __ssize_t writer(void *cookie, const char *buffer, size_t size) |
---|
1768 | { return size; } |
---|
1769 | int closer(void *cookie) |
---|
1770 | { return 0; } |
---|
1771 | int seeker(void *cookie, __off64_t *position, int whence) |
---|
1772 | { ((struct cookiedata*)cookie)->pos = *position; return 0; } |
---|
1773 | |
---|
1774 | cookie_io_functions_t funcs = {reader, writer, seeker, closer}; |
---|
1775 | |
---|
1776 | main() { |
---|
1777 | struct cookiedata g = { 0 }; |
---|
1778 | FILE *fp = fopencookie(&g, "r", funcs); |
---|
1779 | |
---|
1780 | if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) |
---|
1781 | exit(0); |
---|
1782 | exit(1); |
---|
1783 | } |
---|
1784 | |
---|
1785 | ], [ |
---|
1786 | cookie_io_functions_use_off64_t=yes |
---|
1787 | ], [ |
---|
1788 | cookie_io_functions_use_off64_t=no |
---|
1789 | ], [ |
---|
1790 | cookie_io_functions_use_off64_t=no |
---|
1791 | ]) |
---|
1792 | |
---|
1793 | else |
---|
1794 | |
---|
1795 | dnl older glibc versions (up to 2.1.2 ?) |
---|
1796 | dnl call it _IO_cookie_io_functions_t |
---|
1797 | AC_TRY_COMPILE([ |
---|
1798 | #define _GNU_SOURCE |
---|
1799 | #include <stdio.h> |
---|
1800 | ], [ _IO_cookie_io_functions_t cookie; ], [have_IO_cookie_io_functions_t=yes], []) |
---|
1801 | if test "$have_cookie_io_functions_t" = "yes" ; then |
---|
1802 | cookie_io_functions_t=_IO_cookie_io_functions_t |
---|
1803 | have_fopen_cookie=yes |
---|
1804 | fi |
---|
1805 | fi |
---|
1806 | |
---|
1807 | if test "$have_fopen_cookie" = "yes" ; then |
---|
1808 | AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ]) |
---|
1809 | AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ]) |
---|
1810 | if test "$cookie_io_functions_use_off64_t" = "yes" ; then |
---|
1811 | AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ]) |
---|
1812 | fi |
---|
1813 | fi |
---|
1814 | fi |
---|
1815 | ]) |
---|
1816 | |
---|
1817 | dnl ------------------------------------------------------------------------- |
---|
1818 | dnl Library/function existance and build sanity checks |
---|
1819 | dnl ------------------------------------------------------------------------- |
---|
1820 | |
---|
1821 | dnl |
---|
1822 | dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]]) |
---|
1823 | dnl |
---|
1824 | dnl Wrapper for AC_CHECK_LIB |
---|
1825 | dnl |
---|
1826 | AC_DEFUN([PHP_CHECK_LIBRARY], [ |
---|
1827 | save_old_LDFLAGS=$LDFLAGS |
---|
1828 | ac_stuff="$5" |
---|
1829 | |
---|
1830 | save_ext_shared=$ext_shared |
---|
1831 | ext_shared=yes |
---|
1832 | PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS) |
---|
1833 | AC_CHECK_LIB([$1],[$2],[ |
---|
1834 | LDFLAGS=$save_old_LDFLAGS |
---|
1835 | ext_shared=$save_ext_shared |
---|
1836 | $3 |
---|
1837 | ],[ |
---|
1838 | LDFLAGS=$save_old_LDFLAGS |
---|
1839 | ext_shared=$save_ext_shared |
---|
1840 | unset ac_cv_lib_$1[]_$2 |
---|
1841 | $4 |
---|
1842 | ])dnl |
---|
1843 | ]) |
---|
1844 | |
---|
1845 | dnl |
---|
1846 | dnl PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]]) |
---|
1847 | dnl |
---|
1848 | dnl El cheapo wrapper for AC_CHECK_LIB |
---|
1849 | dnl |
---|
1850 | AC_DEFUN([PHP_CHECK_FRAMEWORK], [ |
---|
1851 | save_old_LDFLAGS=$LDFLAGS |
---|
1852 | LDFLAGS="-framework $1 $LDFLAGS" |
---|
1853 | dnl supplying "c" to AC_CHECK_LIB is technically cheating, but |
---|
1854 | dnl rewriting AC_CHECK_LIB is overkill and this only affects |
---|
1855 | dnl the "checking.." output anyway. |
---|
1856 | AC_CHECK_LIB(c,[$2],[ |
---|
1857 | LDFLAGS=$save_old_LDFLAGS |
---|
1858 | $3 |
---|
1859 | ],[ |
---|
1860 | LDFLAGS=$save_old_LDFLAGS |
---|
1861 | $4 |
---|
1862 | ]) |
---|
1863 | ]) |
---|
1864 | |
---|
1865 | dnl |
---|
1866 | dnl PHP_CHECK_FUNC_LIB(func, libs) |
---|
1867 | dnl |
---|
1868 | dnl This macro checks whether 'func' or '__func' exists |
---|
1869 | dnl in the specified library. |
---|
1870 | dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS. |
---|
1871 | dnl This should be called in the ACTION-IF-NOT-FOUND part of PHP_CHECK_FUNC |
---|
1872 | dnl |
---|
1873 | dnl |
---|
1874 | dnl autoconf undefines the builtin "shift" :-( |
---|
1875 | dnl If possible, we use the builtin shift anyway, otherwise we use |
---|
1876 | dnl the ubercool definition I have tested so far with FreeBSD/GNU m4 |
---|
1877 | ifdef([builtin],[builtin(define, phpshift, [builtin(shift, $@)])],[ |
---|
1878 | define([phpshift],[ifelse(index([$@],[,]),-1,,[substr([$@],incr(index([$@],[,])))])]) |
---|
1879 | ]) |
---|
1880 | dnl |
---|
1881 | AC_DEFUN([PHP_CHECK_FUNC_LIB],[ |
---|
1882 | ifelse($2,,:,[ |
---|
1883 | unset ac_cv_lib_$2[]_$1 |
---|
1884 | unset ac_cv_lib_$2[]___$1 |
---|
1885 | unset found |
---|
1886 | AC_CHECK_LIB($2, $1, [found=yes], [ |
---|
1887 | AC_CHECK_LIB($2, __$1, [found=yes], [found=no]) |
---|
1888 | ]) |
---|
1889 | |
---|
1890 | if test "$found" = "yes"; then |
---|
1891 | ac_libs=$LIBS |
---|
1892 | LIBS="$LIBS -l$2" |
---|
1893 | AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no]) |
---|
1894 | LIBS=$ac_libs |
---|
1895 | fi |
---|
1896 | |
---|
1897 | if test "$found" = "yes"; then |
---|
1898 | PHP_ADD_LIBRARY($2) |
---|
1899 | PHP_DEF_HAVE($1) |
---|
1900 | PHP_DEF_HAVE(lib$2) |
---|
1901 | ac_cv_func_$1=yes |
---|
1902 | else |
---|
1903 | PHP_CHECK_FUNC_LIB($1,phpshift(phpshift($@))) |
---|
1904 | fi |
---|
1905 | ]) |
---|
1906 | ]) |
---|
1907 | |
---|
1908 | dnl |
---|
1909 | dnl PHP_CHECK_FUNC(func, ...) |
---|
1910 | dnl |
---|
1911 | dnl This macro checks whether 'func' or '__func' exists |
---|
1912 | dnl in the default libraries and as a fall back in the specified library. |
---|
1913 | dnl Defines HAVE_func and HAVE_library if found and adds the library to LIBS. |
---|
1914 | dnl |
---|
1915 | AC_DEFUN([PHP_CHECK_FUNC],[ |
---|
1916 | unset ac_cv_func_$1 |
---|
1917 | unset ac_cv_func___$1 |
---|
1918 | unset found |
---|
1919 | |
---|
1920 | AC_CHECK_FUNC($1, [found=yes],[ AC_CHECK_FUNC(__$1,[found=yes],[found=no]) ]) |
---|
1921 | |
---|
1922 | case $found in |
---|
1923 | yes[)] |
---|
1924 | PHP_DEF_HAVE($1) |
---|
1925 | ac_cv_func_$1=yes |
---|
1926 | ;; |
---|
1927 | ifelse($#,1,,[ |
---|
1928 | *[)] PHP_CHECK_FUNC_LIB($@) ;; |
---|
1929 | ]) |
---|
1930 | esac |
---|
1931 | ]) |
---|
1932 | |
---|
1933 | dnl |
---|
1934 | dnl PHP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs [, extra-source]]) |
---|
1935 | dnl |
---|
1936 | dnl This macro checks whether build works and given function exists. |
---|
1937 | dnl |
---|
1938 | AC_DEFUN([PHP_TEST_BUILD], [ |
---|
1939 | old_LIBS=$LIBS |
---|
1940 | LIBS="$4 $LIBS" |
---|
1941 | AC_TRY_RUN([ |
---|
1942 | $5 |
---|
1943 | char $1(); |
---|
1944 | int main() { |
---|
1945 | $1(); |
---|
1946 | return 0; |
---|
1947 | } |
---|
1948 | ], [ |
---|
1949 | LIBS=$old_LIBS |
---|
1950 | $2 |
---|
1951 | ],[ |
---|
1952 | LIBS=$old_LIBS |
---|
1953 | $3 |
---|
1954 | ],[ |
---|
1955 | LIBS=$old_LIBS |
---|
1956 | ]) |
---|
1957 | ]) |
---|
1958 | |
---|
1959 | dnl ------------------------------------------------------------------------- |
---|
1960 | dnl Platform characteristics checks |
---|
1961 | dnl ------------------------------------------------------------------------- |
---|
1962 | |
---|
1963 | dnl |
---|
1964 | dnl PHP_SHLIB_SUFFIX_NAMES |
---|
1965 | dnl |
---|
1966 | dnl Determines link library suffix SHLIB_SUFFIX_NAME |
---|
1967 | dnl which can be: .so, .sl or .dylib |
---|
1968 | dnl |
---|
1969 | dnl Determines shared library suffix SHLIB_DL_SUFFIX_NAME |
---|
1970 | dnl suffix can be: .so or .sl |
---|
1971 | dnl |
---|
1972 | AC_DEFUN([PHP_SHLIB_SUFFIX_NAMES],[ |
---|
1973 | AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl |
---|
1974 | PHP_SUBST_OLD(SHLIB_SUFFIX_NAME) |
---|
1975 | PHP_SUBST_OLD(SHLIB_DL_SUFFIX_NAME) |
---|
1976 | SHLIB_SUFFIX_NAME=so |
---|
1977 | SHLIB_DL_SUFFIX_NAME=$SHLIB_SUFFIX_NAME |
---|
1978 | case $host_alias in |
---|
1979 | *hpux*[)] |
---|
1980 | SHLIB_SUFFIX_NAME=sl |
---|
1981 | SHLIB_DL_SUFFIX_NAME=sl |
---|
1982 | ;; |
---|
1983 | *darwin*[)] |
---|
1984 | SHLIB_SUFFIX_NAME=dylib |
---|
1985 | SHLIB_DL_SUFFIX_NAME=so |
---|
1986 | ;; |
---|
1987 | esac |
---|
1988 | ]) |
---|
1989 | |
---|
1990 | dnl |
---|
1991 | dnl PHP_CHECK_64BIT([do if 32], [do if 64]) |
---|
1992 | dnl |
---|
1993 | dnl This macro is used to detect if we're at 64-bit platform or not. |
---|
1994 | dnl It could be useful for those external libs, that have different precompiled |
---|
1995 | dnl versions in different directories. |
---|
1996 | dnl |
---|
1997 | AC_DEFUN([PHP_CHECK_64BIT],[ |
---|
1998 | AC_CHECK_SIZEOF(long int, 4) |
---|
1999 | AC_MSG_CHECKING([checking if we're at 64-bit platform]) |
---|
2000 | if test "$ac_cv_sizeof_long_int" = "4" ; then |
---|
2001 | AC_MSG_RESULT([no]) |
---|
2002 | $1 |
---|
2003 | else |
---|
2004 | AC_MSG_RESULT([yes]) |
---|
2005 | $2 |
---|
2006 | fi |
---|
2007 | ]) |
---|
2008 | |
---|
2009 | dnl |
---|
2010 | dnl PHP_C_BIGENDIAN |
---|
2011 | dnl |
---|
2012 | dnl Replacement macro for AC_C_BIGENDIAN |
---|
2013 | dnl |
---|
2014 | AC_DEFUN([PHP_C_BIGENDIAN], |
---|
2015 | [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php, |
---|
2016 | [ |
---|
2017 | ac_cv_c_bigendian_php=unknown |
---|
2018 | AC_TRY_RUN( |
---|
2019 | [ |
---|
2020 | int main(void) |
---|
2021 | { |
---|
2022 | short one = 1; |
---|
2023 | char *cp = (char *)&one; |
---|
2024 | |
---|
2025 | if (*cp == 0) { |
---|
2026 | return(0); |
---|
2027 | } else { |
---|
2028 | return(1); |
---|
2029 | } |
---|
2030 | } |
---|
2031 | ], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown]) |
---|
2032 | ]) |
---|
2033 | if test $ac_cv_c_bigendian_php = yes; then |
---|
2034 | AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word]) |
---|
2035 | fi |
---|
2036 | ]) |
---|
2037 | |
---|
2038 | dnl ------------------------------------------------------------------------- |
---|
2039 | dnl Checks for programs: PHP_PROG_<program> |
---|
2040 | dnl ------------------------------------------------------------------------- |
---|
2041 | |
---|
2042 | dnl |
---|
2043 | dnl PHP_PROG_SENDMAIL |
---|
2044 | dnl |
---|
2045 | dnl Search for the sendmail binary |
---|
2046 | dnl |
---|
2047 | AC_DEFUN([PHP_PROG_SENDMAIL], [ |
---|
2048 | PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib |
---|
2049 | AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH) |
---|
2050 | PHP_SUBST(PROG_SENDMAIL) |
---|
2051 | ]) |
---|
2052 | |
---|
2053 | dnl |
---|
2054 | dnl PHP_PROG_AWK |
---|
2055 | dnl |
---|
2056 | dnl Some vendors force mawk before gawk; mawk is broken so we don't like that |
---|
2057 | dnl |
---|
2058 | AC_DEFUN([PHP_PROG_AWK], [ |
---|
2059 | AC_CHECK_PROGS(AWK, gawk nawk awk mawk, bork, /usr/xpg4/bin/:$PATH) |
---|
2060 | case "$AWK" in |
---|
2061 | *mawk) |
---|
2062 | AC_MSG_WARN([mawk is known to have problems on some systems. You should install GNU awk]) |
---|
2063 | ;; |
---|
2064 | *gawk) |
---|
2065 | ;; |
---|
2066 | bork) |
---|
2067 | AC_MSG_ERROR([Could not find awk; Install GNU awk]) |
---|
2068 | ;; |
---|
2069 | *) |
---|
2070 | AC_MSG_CHECKING([if $AWK is broken]) |
---|
2071 | if ! $AWK 'function foo() {}' >/dev/null 2>&1 ; then |
---|
2072 | AC_MSG_RESULT([yes]) |
---|
2073 | AC_MSG_ERROR([You should install GNU awk]) |
---|
2074 | else |
---|
2075 | AC_MSG_RESULT([no]) |
---|
2076 | fi |
---|
2077 | ;; |
---|
2078 | esac |
---|
2079 | PHP_SUBST(AWK) |
---|
2080 | ]) |
---|
2081 | |
---|
2082 | dnl |
---|
2083 | dnl PHP_PROG_BISON |
---|
2084 | dnl |
---|
2085 | dnl Search for bison and check it's version |
---|
2086 | dnl |
---|
2087 | AC_DEFUN([PHP_PROG_BISON], [ |
---|
2088 | AC_PROG_YACC |
---|
2089 | LIBZEND_BISON_CHECK |
---|
2090 | PHP_SUBST(YACC) |
---|
2091 | ]) |
---|
2092 | |
---|
2093 | dnl |
---|
2094 | dnl PHP_PROG_LEX |
---|
2095 | dnl |
---|
2096 | dnl Search for (f)lex and check it's version |
---|
2097 | dnl |
---|
2098 | AC_DEFUN([PHP_PROG_LEX], [ |
---|
2099 | dnl we only support certain flex versions |
---|
2100 | flex_version_list="2.5.4" |
---|
2101 | |
---|
2102 | AC_PROG_LEX |
---|
2103 | if test "$LEX" = "flex"; then |
---|
2104 | dnl AC_DECL_YYTEXT is obsolete since autoconf 2.50 and merged into AC_PROG_LEX |
---|
2105 | dnl this is what causes that annoying "PHP_PROG_LEX is expanded from" warning with autoconf 2.50+ |
---|
2106 | dnl it should be removed once we drop support of autoconf 2.13 (if ever) |
---|
2107 | AC_DECL_YYTEXT |
---|
2108 | : |
---|
2109 | fi |
---|
2110 | dnl ## Make flex scanners use const if they can, even if __STDC__ is not |
---|
2111 | dnl ## true, for compilers like Sun's that only set __STDC__ true in |
---|
2112 | dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode |
---|
2113 | AC_C_CONST |
---|
2114 | if test "$ac_cv_c_const" = "yes" ; then |
---|
2115 | LEX_CFLAGS="-DYY_USE_CONST" |
---|
2116 | fi |
---|
2117 | |
---|
2118 | if test "$LEX" = "flex"; then |
---|
2119 | AC_CACHE_CHECK([for flex version], php_cv_flex_version, [ |
---|
2120 | flex_version=`$LEX -V -v --version 2>/dev/null | $SED -e 's/^.* //'` |
---|
2121 | php_cv_flex_version=invalid |
---|
2122 | for flex_check_version in $flex_version_list; do |
---|
2123 | if test "$flex_version" = "$flex_check_version"; then |
---|
2124 | php_cv_flex_version="$flex_check_version (ok)" |
---|
2125 | fi |
---|
2126 | done |
---|
2127 | ]) |
---|
2128 | else |
---|
2129 | flex_version=none |
---|
2130 | fi |
---|
2131 | |
---|
2132 | case $php_cv_flex_version in |
---|
2133 | ""|invalid[)] |
---|
2134 | if test -f "$abs_srcdir/Zend/zend_language_scanner.c" && test -f "$abs_srcdir/Zend/zend_ini_scanner.c"; then |
---|
2135 | AC_MSG_WARN([flex versions supported for regeneration of the Zend/PHP parsers: $flex_version_list (found: $flex_version)]) |
---|
2136 | else |
---|
2137 | flex_msg="Supported flex versions are: $flex_version_list" |
---|
2138 | if test "$flex_version" = "none"; then |
---|
2139 | flex_msg="flex not found. flex is required to generate the Zend/PHP parsers! $flex_msg" |
---|
2140 | else |
---|
2141 | flex_msg="Found invalid flex version: $flex_version. $flex_msg" |
---|
2142 | fi |
---|
2143 | AC_MSG_ERROR([$flex_msg]) |
---|
2144 | fi |
---|
2145 | LEX="exit 0;" |
---|
2146 | ;; |
---|
2147 | esac |
---|
2148 | PHP_SUBST(LEX) |
---|
2149 | ]) |
---|
2150 | |
---|
2151 | dnl |
---|
2152 | dnl PHP_PROG_RE2C |
---|
2153 | dnl |
---|
2154 | dnl Search for the re2c binary and check the version |
---|
2155 | dnl |
---|
2156 | AC_DEFUN([PHP_PROG_RE2C],[ |
---|
2157 | AC_CHECK_PROG(RE2C, re2c, re2c) |
---|
2158 | if test -n "$RE2C"; then |
---|
2159 | AC_CACHE_CHECK([for re2c version], php_cv_re2c_version, [ |
---|
2160 | re2c_vernum=`$RE2C --vernum 2>/dev/null` |
---|
2161 | if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1304"; then |
---|
2162 | php_cv_re2c_version=invalid |
---|
2163 | else |
---|
2164 | php_cv_re2c_version="`$RE2C --version | cut -d ' ' -f 2 2>/dev/null` (ok)" |
---|
2165 | fi |
---|
2166 | ]) |
---|
2167 | fi |
---|
2168 | case $php_cv_re2c_version in |
---|
2169 | ""|invalid[)] |
---|
2170 | AC_MSG_WARN([You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.]) |
---|
2171 | RE2C="exit 0;" |
---|
2172 | ;; |
---|
2173 | esac |
---|
2174 | PHP_SUBST(RE2C) |
---|
2175 | ]) |
---|
2176 | |
---|
2177 | dnl ------------------------------------------------------------------------- |
---|
2178 | dnl Common setup macros: PHP_SETUP_<what> |
---|
2179 | dnl ------------------------------------------------------------------------- |
---|
2180 | |
---|
2181 | dnl |
---|
2182 | dnl PHP_SETUP_ICU([shared-add]) |
---|
2183 | dnl |
---|
2184 | dnl Common setup macro for ICU |
---|
2185 | dnl |
---|
2186 | AC_DEFUN([PHP_SETUP_ICU],[ |
---|
2187 | PHP_ARG_WITH(icu-dir,, |
---|
2188 | [ --with-icu-dir=DIR Specify where ICU libraries and headers can be found], DEFAULT, no) |
---|
2189 | |
---|
2190 | if test "$PHP_ICU_DIR" = "no"; then |
---|
2191 | PHP_ICU_DIR=DEFAULT |
---|
2192 | fi |
---|
2193 | |
---|
2194 | if test "$PHP_ICU_DIR" = "DEFAULT"; then |
---|
2195 | dnl Try to find icu-config |
---|
2196 | AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin]) |
---|
2197 | else |
---|
2198 | ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config" |
---|
2199 | fi |
---|
2200 | |
---|
2201 | AC_MSG_CHECKING([for location of ICU headers and libraries]) |
---|
2202 | |
---|
2203 | dnl Trust icu-config to know better what the install prefix is.. |
---|
2204 | icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null` |
---|
2205 | if test "$?" != "0" || test -z "$icu_install_prefix"; then |
---|
2206 | AC_MSG_RESULT([not found]) |
---|
2207 | AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.]) |
---|
2208 | else |
---|
2209 | AC_MSG_RESULT([$icu_install_prefix]) |
---|
2210 | |
---|
2211 | dnl Check ICU version |
---|
2212 | AC_MSG_CHECKING([for ICU 3.4 or greater]) |
---|
2213 | icu_version_full=`$ICU_CONFIG --version` |
---|
2214 | ac_IFS=$IFS |
---|
2215 | IFS="." |
---|
2216 | set $icu_version_full |
---|
2217 | IFS=$ac_IFS |
---|
2218 | icu_version=`expr [$]1 \* 1000 + [$]2` |
---|
2219 | AC_MSG_RESULT([found $icu_version_full]) |
---|
2220 | |
---|
2221 | if test "$icu_version" -lt "3004"; then |
---|
2222 | AC_MSG_ERROR([ICU version 3.4 or later is required]) |
---|
2223 | fi |
---|
2224 | |
---|
2225 | ICU_INCS=`$ICU_CONFIG --cppflags-searchpath` |
---|
2226 | ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio` |
---|
2227 | PHP_EVAL_INCLINE($ICU_INCS) |
---|
2228 | PHP_EVAL_LIBLINE($ICU_LIBS, $1) |
---|
2229 | fi |
---|
2230 | ]) |
---|
2231 | |
---|
2232 | dnl |
---|
2233 | dnl PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]]) |
---|
2234 | dnl |
---|
2235 | dnl Common setup macro for kerberos |
---|
2236 | dnl |
---|
2237 | AC_DEFUN([PHP_SETUP_KERBEROS],[ |
---|
2238 | found_kerberos=no |
---|
2239 | unset KERBEROS_CFLAGS |
---|
2240 | unset KERBEROS_LIBS |
---|
2241 | |
---|
2242 | dnl First try to find krb5-config |
---|
2243 | if test -z "$KRB5_CONFIG"; then |
---|
2244 | AC_PATH_PROG(KRB5_CONFIG, krb5-config, no, [$PATH:/usr/kerberos/bin:/usr/local/bin]) |
---|
2245 | fi |
---|
2246 | |
---|
2247 | dnl If krb5-config is found try using it |
---|
2248 | if test "$PHP_KERBEROS" = "yes" && test -x "$KRB5_CONFIG"; then |
---|
2249 | KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi` |
---|
2250 | KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi` |
---|
2251 | |
---|
2252 | if test -n "$KERBEROS_LIBS" && test -n "$KERBEROS_CFLAGS"; then |
---|
2253 | found_kerberos=yes |
---|
2254 | PHP_EVAL_LIBLINE($KERBEROS_LIBS, $1) |
---|
2255 | PHP_EVAL_INCLINE($KERBEROS_CFLAGS) |
---|
2256 | fi |
---|
2257 | fi |
---|
2258 | |
---|
2259 | dnl If still not found use old skool method |
---|
2260 | if test "$found_kerberos" = "no"; then |
---|
2261 | |
---|
2262 | if test "$PHP_KERBEROS" = "yes"; then |
---|
2263 | PHP_KERBEROS="/usr/kerberos /usr/local /usr" |
---|
2264 | fi |
---|
2265 | |
---|
2266 | for i in $PHP_KERBEROS; do |
---|
2267 | if test -f $i/$PHP_LIBDIR/libkrb5.a || test -f $i/$PHP_LIBDIR/libkrb5.$SHLIB_SUFFIX_NAME; then |
---|
2268 | PHP_KERBEROS_DIR=$i |
---|
2269 | break |
---|
2270 | fi |
---|
2271 | done |
---|
2272 | |
---|
2273 | if test "$PHP_KERBEROS_DIR"; then |
---|
2274 | found_kerberos=yes |
---|
2275 | PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/$PHP_LIBDIR, $1) |
---|
2276 | PHP_ADD_LIBRARY(gssapi_krb5, 1, $1) |
---|
2277 | PHP_ADD_LIBRARY(krb5, 1, $1) |
---|
2278 | PHP_ADD_LIBRARY(k5crypto, 1, $1) |
---|
2279 | PHP_ADD_LIBRARY(com_err, 1, $1) |
---|
2280 | PHP_ADD_INCLUDE($PHP_KERBEROS_DIR/include) |
---|
2281 | fi |
---|
2282 | fi |
---|
2283 | |
---|
2284 | if test "$found_kerberos" = "yes"; then |
---|
2285 | ifelse([$2],[],:,[$2]) |
---|
2286 | ifelse([$3],[],,[else $3]) |
---|
2287 | fi |
---|
2288 | ]) |
---|
2289 | |
---|
2290 | dnl |
---|
2291 | dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]]) |
---|
2292 | dnl |
---|
2293 | dnl Common setup macro for openssl |
---|
2294 | dnl |
---|
2295 | AC_DEFUN([PHP_SETUP_OPENSSL],[ |
---|
2296 | found_openssl=no |
---|
2297 | unset OPENSSL_INCDIR |
---|
2298 | unset OPENSSL_LIBDIR |
---|
2299 | |
---|
2300 | dnl Empty variable means 'no' |
---|
2301 | test -z "$PHP_OPENSSL" && PHP_OPENSSL=no |
---|
2302 | test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no |
---|
2303 | |
---|
2304 | dnl Fallbacks for different configure options |
---|
2305 | if test "$PHP_OPENSSL" != "no"; then |
---|
2306 | PHP_OPENSSL_DIR=$PHP_OPENSSL |
---|
2307 | elif test "$PHP_IMAP_SSL" != "no"; then |
---|
2308 | PHP_OPENSSL_DIR=$PHP_IMAP_SSL |
---|
2309 | fi |
---|
2310 | |
---|
2311 | dnl First try to find pkg-config |
---|
2312 | if test -z "$PKG_CONFIG"; then |
---|
2313 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
---|
2314 | fi |
---|
2315 | |
---|
2316 | dnl If pkg-config is found try using it |
---|
2317 | if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then |
---|
2318 | if $PKG_CONFIG --atleast-version=0.9.6 openssl; then |
---|
2319 | found_openssl=yes |
---|
2320 | OPENSSL_LIBS=`$PKG_CONFIG --libs openssl` |
---|
2321 | OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl` |
---|
2322 | OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl` |
---|
2323 | else |
---|
2324 | AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.]) |
---|
2325 | fi |
---|
2326 | |
---|
2327 | if test -n "$OPENSSL_LIBS" && test -n "$OPENSSL_INCS"; then |
---|
2328 | PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1) |
---|
2329 | PHP_EVAL_INCLINE($OPENSSL_INCS) |
---|
2330 | fi |
---|
2331 | fi |
---|
2332 | |
---|
2333 | dnl If pkg-config fails for some reason, revert to the old method |
---|
2334 | if test "$found_openssl" = "no"; then |
---|
2335 | |
---|
2336 | if test "$PHP_OPENSSL_DIR" = "yes"; then |
---|
2337 | PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl" |
---|
2338 | fi |
---|
2339 | |
---|
2340 | for i in $PHP_OPENSSL_DIR; do |
---|
2341 | if test -r $i/include/openssl/evp.h; then |
---|
2342 | OPENSSL_INCDIR=$i/include |
---|
2343 | fi |
---|
2344 | if test -r $i/$PHP_LIBDIR/libssl.a -o -r $i/$PHP_LIBDIR/libssl.$SHLIB_SUFFIX_NAME; then |
---|
2345 | OPENSSL_LIBDIR=$i/$PHP_LIBDIR |
---|
2346 | fi |
---|
2347 | test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break |
---|
2348 | done |
---|
2349 | |
---|
2350 | if test -z "$OPENSSL_INCDIR"; then |
---|
2351 | AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>]) |
---|
2352 | fi |
---|
2353 | |
---|
2354 | if test -z "$OPENSSL_LIBDIR"; then |
---|
2355 | AC_MSG_ERROR([Cannot find OpenSSL's libraries]) |
---|
2356 | fi |
---|
2357 | |
---|
2358 | old_CPPFLAGS=$CPPFLAGS |
---|
2359 | CPPFLAGS=-I$OPENSSL_INCDIR |
---|
2360 | AC_MSG_CHECKING([for OpenSSL version]) |
---|
2361 | AC_EGREP_CPP(yes,[ |
---|
2362 | #include <openssl/opensslv.h> |
---|
2363 | #if OPENSSL_VERSION_NUMBER >= 0x0090600fL |
---|
2364 | yes |
---|
2365 | #endif |
---|
2366 | ],[ |
---|
2367 | AC_MSG_RESULT([>= 0.9.6]) |
---|
2368 | ],[ |
---|
2369 | AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.]) |
---|
2370 | ]) |
---|
2371 | CPPFLAGS=$old_CPPFLAGS |
---|
2372 | |
---|
2373 | PHP_ADD_INCLUDE($OPENSSL_INCDIR) |
---|
2374 | |
---|
2375 | PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [ |
---|
2376 | PHP_ADD_LIBRARY(crypto,,$1) |
---|
2377 | ],[ |
---|
2378 | AC_MSG_ERROR([libcrypto not found!]) |
---|
2379 | ],[ |
---|
2380 | -L$OPENSSL_LIBDIR |
---|
2381 | ]) |
---|
2382 | |
---|
2383 | old_LIBS=$LIBS |
---|
2384 | LIBS="$LIBS -lcrypto" |
---|
2385 | PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [ |
---|
2386 | found_openssl=yes |
---|
2387 | ],[ |
---|
2388 | AC_MSG_ERROR([libssl not found!]) |
---|
2389 | ],[ |
---|
2390 | -L$OPENSSL_LIBDIR |
---|
2391 | ]) |
---|
2392 | LIBS=$old_LIBS |
---|
2393 | PHP_ADD_LIBRARY(ssl,,$1) |
---|
2394 | |
---|
2395 | PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1) |
---|
2396 | fi |
---|
2397 | |
---|
2398 | if test "$found_openssl" = "yes"; then |
---|
2399 | dnl For apache 1.3.x static build |
---|
2400 | OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR |
---|
2401 | AC_SUBST(OPENSSL_INCDIR_OPT) |
---|
2402 | |
---|
2403 | ifelse([$2],[],:,[$2]) |
---|
2404 | ifelse([$3],[],,[else $3]) |
---|
2405 | fi |
---|
2406 | ]) |
---|
2407 | |
---|
2408 | dnl |
---|
2409 | dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]]) |
---|
2410 | dnl |
---|
2411 | dnl Common setup macro for iconv |
---|
2412 | dnl |
---|
2413 | AC_DEFUN([PHP_SETUP_ICONV], [ |
---|
2414 | found_iconv=no |
---|
2415 | unset ICONV_DIR |
---|
2416 | |
---|
2417 | # Create the directories for a VPATH build: |
---|
2418 | $php_shtool mkdir -p ext/iconv |
---|
2419 | |
---|
2420 | echo > ext/iconv/php_have_bsd_iconv.h |
---|
2421 | echo > ext/iconv/php_have_ibm_iconv.h |
---|
2422 | echo > ext/iconv/php_have_glibc_iconv.h |
---|
2423 | echo > ext/iconv/php_have_libiconv.h |
---|
2424 | echo > ext/iconv/php_have_iconv.h |
---|
2425 | echo > ext/iconv/php_php_iconv_impl.h |
---|
2426 | echo > ext/iconv/php_php_iconv_h_path.h |
---|
2427 | echo > ext/iconv/php_iconv_supports_errno.h |
---|
2428 | |
---|
2429 | dnl |
---|
2430 | dnl Check libc first if no path is provided in --with-iconv |
---|
2431 | dnl |
---|
2432 | if test "$PHP_ICONV" = "yes"; then |
---|
2433 | AC_CHECK_FUNC(iconv, [ |
---|
2434 | found_iconv=yes |
---|
2435 | ],[ |
---|
2436 | AC_CHECK_FUNC(libiconv,[ |
---|
2437 | PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv]) |
---|
2438 | AC_DEFINE(HAVE_LIBICONV, 1, [ ]) |
---|
2439 | found_iconv=yes |
---|
2440 | ]) |
---|
2441 | ]) |
---|
2442 | fi |
---|
2443 | |
---|
2444 | dnl |
---|
2445 | dnl Check external libs for iconv funcs |
---|
2446 | dnl |
---|
2447 | if test "$found_iconv" = "no"; then |
---|
2448 | |
---|
2449 | for i in $PHP_ICONV /usr/local /usr; do |
---|
2450 | if test -r $i/include/giconv.h; then |
---|
2451 | AC_DEFINE(HAVE_GICONV_H, 1, [ ]) |
---|
2452 | ICONV_DIR=$i |
---|
2453 | iconv_lib_name=giconv |
---|
2454 | break |
---|
2455 | elif test -r $i/include/iconv.h; then |
---|
2456 | ICONV_DIR=$i |
---|
2457 | iconv_lib_name=iconv |
---|
2458 | break |
---|
2459 | fi |
---|
2460 | done |
---|
2461 | |
---|
2462 | if test -z "$ICONV_DIR"; then |
---|
2463 | AC_MSG_ERROR([Please specify the install prefix of iconv with --with-iconv=<DIR>]) |
---|
2464 | fi |
---|
2465 | |
---|
2466 | if test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.a || |
---|
2467 | test -f $ICONV_DIR/$PHP_LIBDIR/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME |
---|
2468 | then |
---|
2469 | PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [ |
---|
2470 | found_iconv=yes |
---|
2471 | PHP_DEFINE(HAVE_LIBICONV,1,[ext/iconv]) |
---|
2472 | AC_DEFINE(HAVE_LIBICONV,1,[ ]) |
---|
2473 | ], [ |
---|
2474 | PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [ |
---|
2475 | found_iconv=yes |
---|
2476 | ], [], [ |
---|
2477 | -L$ICONV_DIR/$PHP_LIBDIR |
---|
2478 | ]) |
---|
2479 | ], [ |
---|
2480 | -L$ICONV_DIR/$PHP_LIBDIR |
---|
2481 | ]) |
---|
2482 | fi |
---|
2483 | fi |
---|
2484 | |
---|
2485 | if test "$found_iconv" = "yes"; then |
---|
2486 | PHP_DEFINE(HAVE_ICONV,1,[ext/iconv]) |
---|
2487 | AC_DEFINE(HAVE_ICONV,1,[ ]) |
---|
2488 | if test -n "$ICONV_DIR"; then |
---|
2489 | PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/$PHP_LIBDIR, $1) |
---|
2490 | PHP_ADD_INCLUDE($ICONV_DIR/include) |
---|
2491 | fi |
---|
2492 | $2 |
---|
2493 | ifelse([$3],[],,[else $3]) |
---|
2494 | fi |
---|
2495 | ]) |
---|
2496 | |
---|
2497 | dnl |
---|
2498 | dnl PHP_SETUP_LIBXML(shared-add [, action-found [, action-not-found]]) |
---|
2499 | dnl |
---|
2500 | dnl Common setup macro for libxml |
---|
2501 | dnl |
---|
2502 | AC_DEFUN([PHP_SETUP_LIBXML], [ |
---|
2503 | AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path, |
---|
2504 | [ |
---|
2505 | for i in $PHP_LIBXML_DIR /usr/local /usr; do |
---|
2506 | if test -x "$i/bin/xml2-config"; then |
---|
2507 | ac_cv_php_xml2_config_path="$i/bin/xml2-config" |
---|
2508 | break |
---|
2509 | fi |
---|
2510 | done |
---|
2511 | ]) |
---|
2512 | |
---|
2513 | if test -x "$ac_cv_php_xml2_config_path"; then |
---|
2514 | XML2_CONFIG="$ac_cv_php_xml2_config_path" |
---|
2515 | libxml_full_version=`$XML2_CONFIG --version` |
---|
2516 | ac_IFS=$IFS |
---|
2517 | IFS="." |
---|
2518 | set $libxml_full_version |
---|
2519 | IFS=$ac_IFS |
---|
2520 | LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3` |
---|
2521 | if test "$LIBXML_VERSION" -ge "2006011"; then |
---|
2522 | LIBXML_LIBS=`$XML2_CONFIG --libs` |
---|
2523 | LIBXML_INCS=`$XML2_CONFIG --cflags` |
---|
2524 | PHP_EVAL_LIBLINE($LIBXML_LIBS, $1) |
---|
2525 | PHP_EVAL_INCLINE($LIBXML_INCS) |
---|
2526 | |
---|
2527 | dnl Check that build works with given libs |
---|
2528 | AC_CACHE_CHECK(whether libxml build works, php_cv_libxml_build_works, [ |
---|
2529 | PHP_TEST_BUILD(xmlInitParser, |
---|
2530 | [ |
---|
2531 | php_cv_libxml_build_works=yes |
---|
2532 | ], [ |
---|
2533 | AC_MSG_RESULT(no) |
---|
2534 | AC_MSG_ERROR([build test failed. Please check the config.log for details.]) |
---|
2535 | ], [ |
---|
2536 | [$]$1 |
---|
2537 | ]) |
---|
2538 | ]) |
---|
2539 | if test "$php_cv_libxml_build_works" = "yes"; then |
---|
2540 | AC_DEFINE(HAVE_LIBXML, 1, [ ]) |
---|
2541 | fi |
---|
2542 | $2 |
---|
2543 | else |
---|
2544 | AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.]) |
---|
2545 | fi |
---|
2546 | ifelse([$3],[],,[else $3]) |
---|
2547 | fi |
---|
2548 | ]) |
---|
2549 | |
---|
2550 | dnl ------------------------------------------------------------------------- |
---|
2551 | dnl Misc. macros |
---|
2552 | dnl ------------------------------------------------------------------------- |
---|
2553 | |
---|
2554 | dnl |
---|
2555 | dnl PHP_INSTALL_HEADERS(path [, file ...]) |
---|
2556 | dnl |
---|
2557 | dnl PHP header files to be installed |
---|
2558 | dnl |
---|
2559 | AC_DEFUN([PHP_INSTALL_HEADERS],[ |
---|
2560 | ifelse([$2],[],[ |
---|
2561 | for header_file in $1; do |
---|
2562 | PHP_RUN_ONCE(INSTALLHEADERS, $header_file, [ |
---|
2563 | INSTALL_HEADERS="$INSTALL_HEADERS $header_file" |
---|
2564 | ]) |
---|
2565 | done |
---|
2566 | ], [ |
---|
2567 | header_path=$1 |
---|
2568 | for header_file in $2; do |
---|
2569 | hp_hf="$header_path/$header_file" |
---|
2570 | PHP_RUN_ONCE(INSTALLHEADERS, $hp_hf, [ |
---|
2571 | INSTALL_HEADERS="$INSTALL_HEADERS $hp_hf" |
---|
2572 | ]) |
---|
2573 | done |
---|
2574 | ]) |
---|
2575 | ]) |
---|
2576 | |
---|
2577 | dnl |
---|
2578 | dnl PHP_AP_EXTRACT_VERSION(/path/httpd) |
---|
2579 | dnl |
---|
2580 | dnl This macro is used to get a comparable |
---|
2581 | dnl version for apache1/2. |
---|
2582 | dnl |
---|
2583 | AC_DEFUN([PHP_AP_EXTRACT_VERSION],[ |
---|
2584 | ac_output=`$1 -v 2>&1 | grep version` |
---|
2585 | ac_IFS=$IFS |
---|
2586 | IFS="- /. |
---|
2587 | " |
---|
2588 | set $ac_output |
---|
2589 | IFS=$ac_IFS |
---|
2590 | |
---|
2591 | APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6` |
---|
2592 | ]) |
---|
2593 | |
---|
2594 | dnl |
---|
2595 | dnl PHP_DEBUG_MACRO(filename) |
---|
2596 | dnl |
---|
2597 | AC_DEFUN([PHP_DEBUG_MACRO],[ |
---|
2598 | DEBUG_LOG=$1 |
---|
2599 | cat >$1 <<X |
---|
2600 | CONFIGURE: $CONFIGURE_COMMAND |
---|
2601 | CC: $CC |
---|
2602 | CFLAGS: $CFLAGS |
---|
2603 | CPPFLAGS: $CPPFLAGS |
---|
2604 | CXX: $CXX |
---|
2605 | CXXFLAGS: $CXXFLAGS |
---|
2606 | INCLUDES: $INCLUDES |
---|
2607 | LDFLAGS: $LDFLAGS |
---|
2608 | LIBS: $LIBS |
---|
2609 | DLIBS: $DLIBS |
---|
2610 | SAPI: $PHP_SAPI |
---|
2611 | PHP_RPATHS: $PHP_RPATHS |
---|
2612 | uname -a: `uname -a` |
---|
2613 | |
---|
2614 | X |
---|
2615 | cat >conftest.$ac_ext <<X |
---|
2616 | main() |
---|
2617 | { |
---|
2618 | exit(0); |
---|
2619 | } |
---|
2620 | X |
---|
2621 | (eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1 |
---|
2622 | rm -fr conftest* |
---|
2623 | ]) |
---|
2624 | |
---|
2625 | dnl |
---|
2626 | dnl PHP_CONFIG_NICE(filename) |
---|
2627 | dnl |
---|
2628 | dnl Generates the config.nice file |
---|
2629 | dnl |
---|
2630 | AC_DEFUN([PHP_CONFIG_NICE],[ |
---|
2631 | AC_REQUIRE([AC_PROG_EGREP]) |
---|
2632 | AC_REQUIRE([LT_AC_PROG_SED]) |
---|
2633 | PHP_SUBST_OLD(EGREP) |
---|
2634 | PHP_SUBST_OLD(SED) |
---|
2635 | test -f $1 && mv $1 $1.old |
---|
2636 | rm -f $1.old |
---|
2637 | cat >$1<<EOF |
---|
2638 | #! /bin/sh |
---|
2639 | # |
---|
2640 | # Created by configure |
---|
2641 | |
---|
2642 | EOF |
---|
2643 | |
---|
2644 | for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS EXTRA_LDFLAGS_PROGRAM LIBS CC CXX; do |
---|
2645 | eval val=\$$var |
---|
2646 | if test -n "$val"; then |
---|
2647 | echo "$var='$val' \\" >> $1 |
---|
2648 | fi |
---|
2649 | done |
---|
2650 | |
---|
2651 | echo "'[$]0' \\" >> $1 |
---|
2652 | if test `expr -- [$]0 : "'.*"` = 0; then |
---|
2653 | CONFIGURE_COMMAND="$CONFIGURE_COMMAND '[$]0'" |
---|
2654 | else |
---|
2655 | CONFIGURE_COMMAND="$CONFIGURE_COMMAND [$]0" |
---|
2656 | fi |
---|
2657 | for arg in $ac_configure_args; do |
---|
2658 | if test `expr -- $arg : "'.*"` = 0; then |
---|
2659 | if test `expr -- $arg : "--.*"` = 0; then |
---|
2660 | break; |
---|
2661 | fi |
---|
2662 | echo "'[$]arg' \\" >> $1 |
---|
2663 | CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS '[$]arg'" |
---|
2664 | else |
---|
2665 | if test `expr -- $arg : "'--.*"` = 0; then |
---|
2666 | break; |
---|
2667 | fi |
---|
2668 | echo "[$]arg \\" >> $1 |
---|
2669 | CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS [$]arg" |
---|
2670 | fi |
---|
2671 | done |
---|
2672 | echo '"[$]@"' >> $1 |
---|
2673 | chmod +x $1 |
---|
2674 | CONFIGURE_COMMAND="$CONFIGURE_COMMAND $CONFIGURE_OPTIONS" |
---|
2675 | PHP_SUBST_OLD(CONFIGURE_COMMAND) |
---|
2676 | PHP_SUBST_OLD(CONFIGURE_OPTIONS) |
---|
2677 | ]) |
---|
2678 | |
---|
2679 | dnl |
---|
2680 | dnl PHP_CHECK_CONFIGURE_OPTIONS |
---|
2681 | dnl |
---|
2682 | AC_DEFUN([PHP_CHECK_CONFIGURE_OPTIONS],[ |
---|
2683 | for arg in $ac_configure_args; do |
---|
2684 | case $arg in |
---|
2685 | --with-*[)] |
---|
2686 | arg_name="`echo [$]arg | $SED -e 's/--with-/with-/g' -e 's/=.*//g'`" |
---|
2687 | ;; |
---|
2688 | --without-*[)] |
---|
2689 | arg_name="`echo [$]arg | $SED -e 's/--without-/with-/g' -e 's/=.*//g'`" |
---|
2690 | ;; |
---|
2691 | --enable-*[)] |
---|
2692 | arg_name="`echo [$]arg | $SED -e 's/--enable-/enable-/g' -e 's/=.*//g'`" |
---|
2693 | ;; |
---|
2694 | --disable-*[)] |
---|
2695 | arg_name="`echo [$]arg | $SED -e 's/--disable-/enable-/g' -e 's/=.*//g'`" |
---|
2696 | ;; |
---|
2697 | *[)] |
---|
2698 | continue |
---|
2699 | ;; |
---|
2700 | esac |
---|
2701 | case $arg_name in |
---|
2702 | # Allow --disable-all / --enable-all |
---|
2703 | enable-all[)];; |
---|
2704 | |
---|
2705 | # Allow certain libtool options |
---|
2706 | enable-libtool-lock | with-pic | with-tags | enable-shared | enable-static | enable-fast-install | with-gnu-ld[)];; |
---|
2707 | |
---|
2708 | # Allow certain TSRM options |
---|
2709 | with-tsrm-pth | with-tsrm-st | with-tsrm-pthreads[)];; |
---|
2710 | |
---|
2711 | # Allow certain Zend options |
---|
2712 | with-zend-vm | enable-maintainer-zts | enable-inline-optimization[)];; |
---|
2713 | |
---|
2714 | # All the rest must be set using the PHP_ARG_* macros |
---|
2715 | # PHP_ARG_* macros set php_enable_<arg_name> or php_with_<arg_name> |
---|
2716 | *[)] |
---|
2717 | # Options that exist before PHP 6 |
---|
2718 | if test "$PHP_MAJOR_VERSION" -lt "6"; then |
---|
2719 | case $arg_name in |
---|
2720 | enable-zend-multibyte[)] continue;; |
---|
2721 | esac |
---|
2722 | fi |
---|
2723 | |
---|
2724 | is_arg_set=php_[]`echo [$]arg_name | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-' 'abcdefghijklmnopqrstuvwxyz_'` |
---|
2725 | if eval test "x\$$is_arg_set" = "x"; then |
---|
2726 | PHP_UNKNOWN_CONFIGURE_OPTIONS="$PHP_UNKNOWN_CONFIGURE_OPTIONS |
---|
2727 | [$]arg" |
---|
2728 | fi |
---|
2729 | ;; |
---|
2730 | esac |
---|
2731 | done |
---|
2732 | ]) |
---|
2733 | |
---|
2734 | dnl |
---|
2735 | dnl PHP_CHECK_PDO_INCLUDES([found [, not-found]]) |
---|
2736 | dnl |
---|
2737 | AC_DEFUN([PHP_CHECK_PDO_INCLUDES],[ |
---|
2738 | AC_CACHE_CHECK([for PDO includes], pdo_inc_path, [ |
---|
2739 | AC_MSG_CHECKING([for PDO includes]) |
---|
2740 | if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then |
---|
2741 | pdo_inc_path=$abs_srcdir/ext |
---|
2742 | elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then |
---|
2743 | pdo_inc_path=$abs_srcdir/ext |
---|
2744 | elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then |
---|
2745 | pdo_inc_path=$prefix/include/php/ext |
---|
2746 | fi |
---|
2747 | ]) |
---|
2748 | if test -n "$pdo_inc_path"; then |
---|
2749 | ifelse([$1],[],:,[$1]) |
---|
2750 | else |
---|
2751 | ifelse([$2],[],[AC_MSG_ERROR([Cannot find php_pdo_driver.h.])],[$2]) |
---|
2752 | fi |
---|
2753 | ]) |
---|
2754 | |
---|
2755 | dnl |
---|
2756 | dnl PHP_DETECT_ICC |
---|
2757 | dnl Detect Intel C++ Compiler and unset $GCC if ICC found |
---|
2758 | AC_DEFUN([PHP_DETECT_ICC], |
---|
2759 | [ |
---|
2760 | ICC="no" |
---|
2761 | AC_MSG_CHECKING([for icc]) |
---|
2762 | AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER], |
---|
2763 | ICC="no" |
---|
2764 | AC_MSG_RESULT([no]), |
---|
2765 | ICC="yes" |
---|
2766 | GCC="no" |
---|
2767 | AC_MSG_RESULT([yes]) |
---|
2768 | ) |
---|
2769 | ]) |
---|
2770 | |
---|
2771 | dnl |
---|
2772 | dnl PHP_CRYPT_R_STYLE |
---|
2773 | dnl detect the style of crypt_r() is any is available |
---|
2774 | dnl see APR_CHECK_CRYPT_R_STYLE() for original version |
---|
2775 | dnl |
---|
2776 | AC_DEFUN([PHP_CRYPT_R_STYLE], |
---|
2777 | [ |
---|
2778 | AC_CACHE_CHECK([which data struct is used by crypt_r], php_cv_crypt_r_style,[ |
---|
2779 | php_cv_crypt_r_style=none |
---|
2780 | AC_TRY_COMPILE([ |
---|
2781 | #define _REENTRANT 1 |
---|
2782 | #include <crypt.h> |
---|
2783 | ],[ |
---|
2784 | CRYPTD buffer; |
---|
2785 | crypt_r("passwd", "hash", &buffer); |
---|
2786 | ], |
---|
2787 | php_cv_crypt_r_style=cryptd) |
---|
2788 | |
---|
2789 | if test "$php_cv_crypt_r_style" = "none"; then |
---|
2790 | AC_TRY_COMPILE([ |
---|
2791 | #define _REENTRANT 1 |
---|
2792 | #include <crypt.h> |
---|
2793 | ],[ |
---|
2794 | struct crypt_data buffer; |
---|
2795 | crypt_r("passwd", "hash", &buffer); |
---|
2796 | ], |
---|
2797 | php_cv_crypt_r_style=struct_crypt_data) |
---|
2798 | fi |
---|
2799 | |
---|
2800 | if test "$php_cv_crypt_r_style" = "none"; then |
---|
2801 | AC_TRY_COMPILE([ |
---|
2802 | #define _REENTRANT 1 |
---|
2803 | #define _GNU_SOURCE |
---|
2804 | #include <crypt.h> |
---|
2805 | ],[ |
---|
2806 | struct crypt_data buffer; |
---|
2807 | crypt_r("passwd", "hash", &buffer); |
---|
2808 | ], |
---|
2809 | php_cv_crypt_r_style=struct_crypt_data_gnu_source) |
---|
2810 | fi |
---|
2811 | ]) |
---|
2812 | |
---|
2813 | if test "$php_cv_crypt_r_style" = "cryptd"; then |
---|
2814 | AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD]) |
---|
2815 | fi |
---|
2816 | if test "$php_cv_crypt_r_style" = "struct_crypt_data" -o "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then |
---|
2817 | AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data]) |
---|
2818 | fi |
---|
2819 | if test "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then |
---|
2820 | AC_DEFINE(CRYPT_R_GNU_SOURCE, 1, [Define if struct crypt_data requires _GNU_SOURCE]) |
---|
2821 | fi |
---|
2822 | if test "$php_cv_crypt_r_style" = "none"; then |
---|
2823 | AC_MSG_ERROR([Unable to detect data struct used by crypt_r]) |
---|
2824 | fi |
---|
2825 | ]) |
---|
2826 | |
---|
2827 | dnl |
---|
2828 | dnl PHP_TEST_WRITE_STDOUT |
---|
2829 | dnl |
---|
2830 | AC_DEFUN([PHP_TEST_WRITE_STDOUT],[ |
---|
2831 | AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[ |
---|
2832 | AC_TRY_RUN([ |
---|
2833 | #ifdef HAVE_UNISTD_H |
---|
2834 | #include <unistd.h> |
---|
2835 | #endif |
---|
2836 | |
---|
2837 | #define TEXT "This is the test message -- " |
---|
2838 | |
---|
2839 | main() |
---|
2840 | { |
---|
2841 | int n; |
---|
2842 | |
---|
2843 | n = write(1, TEXT, sizeof(TEXT)-1); |
---|
2844 | return (!(n == sizeof(TEXT)-1)); |
---|
2845 | } |
---|
2846 | ],[ |
---|
2847 | ac_cv_write_stdout=yes |
---|
2848 | ],[ |
---|
2849 | ac_cv_write_stdout=no |
---|
2850 | ],[ |
---|
2851 | ac_cv_write_stdout=no |
---|
2852 | ]) |
---|
2853 | ]) |
---|
2854 | if test "$ac_cv_write_stdout" = "yes"; then |
---|
2855 | AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works]) |
---|
2856 | fi |
---|
2857 | ]) |
---|
2858 | |
---|