Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / configure.in
bloba3e46dfb64f8b7cccad6151d3cf526bb4913b09d
1 ## $Id$ -*- autoconf -*-
2 dnl ## Process this file with autoconf to produce a configure script.
4 dnl include Zend specific macro definitions first
5 dnl -------------------------------------------------------------------------
6 sinclude(Zend/acinclude.m4)
8 dnl Basic autoconf + automake initialization, generation of config.nice.
9 dnl -------------------------------------------------------------------------
11 AC_PREREQ(2.59)
12 AC_INIT(README.GIT-RULES)
13 ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], [])
15 PHP_CONFIG_NICE(config.nice)
17 PHP_CANONICAL_HOST_TARGET
19 AC_CONFIG_HEADER(main/php_config.h)
20 AH_TOP([
21 #if defined(__GNUC__) && __GNUC__ >= 4
22 # define ZEND_API __attribute__ ((visibility("default")))
23 # define ZEND_DLEXPORT __attribute__ ((visibility("default")))
24 #else
25 # define ZEND_API
26 # define ZEND_DLEXPORT
27 #endif
29 #define ZEND_DLIMPORT
31 #undef uint
32 #undef ulong
34 /* Define if you want to enable memory limit support */
35 #define MEMORY_LIMIT 0
37 AH_BOTTOM([
38 #ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
40 #ifdef HAVE_STDLIB_H
41 # include <stdlib.h>
42 #endif
44 #ifdef HAVE_SYS_TYPES_H
45 # include <sys/types.h>
46 #endif
48 #ifdef HAVE_SYS_SELECT_H
49 #include <sys/select.h>
50 #endif
52 #ifdef HAVE_IEEEFP_H
53 # include <ieeefp.h>
54 #endif
56 #ifdef HAVE_STRING_H
57 # include <string.h>
58 #else
59 # include <strings.h>
60 #endif
62 #if ZEND_BROKEN_SPRINTF
63 int zend_sprintf(char *buffer, const char *format, ...);
64 #else
65 # define zend_sprintf sprintf
66 #endif
68 #include <math.h>
70 /* To enable the is_nan, is_infinite and is_finite PHP functions */
71 #ifdef NETWARE
72         #define HAVE_ISNAN 1
73         #define HAVE_ISINF 1
74         #define HAVE_ISFINITE 1
75 #endif
77 #ifndef zend_isnan
78 #ifdef HAVE_ISNAN
79 #define zend_isnan(a) isnan(a)
80 #elif defined(HAVE_FPCLASS)
81 #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
82 #else
83 #define zend_isnan(a) 0
84 #endif
85 #endif
87 #ifdef HAVE_ISINF
88 #define zend_isinf(a) isinf(a)
89 #elif defined(INFINITY)
90 /* Might not work, but is required by ISO C99 */
91 #define zend_isinf(a) (((a)==INFINITY)?1:0)
92 #elif defined(HAVE_FPCLASS)
93 #define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
94 #else
95 #define zend_isinf(a) 0
96 #endif
98 #ifdef HAVE_FINITE
99 #define zend_finite(a) finite(a)
100 #elif defined(HAVE_ISFINITE) || defined(isfinite)
101 #define zend_finite(a) isfinite(a)
102 #elif defined(fpclassify)
103 #define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
104 #else
105 #define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
106 #endif
108 #endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
110 #ifdef NETWARE
111 #ifdef USE_WINSOCK
112 #/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T
113 #/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H
114 #endif
115 #endif
117 #undef PTHREADS
120 PHP_MAJOR_VERSION=5
121 PHP_MINOR_VERSION=4
122 PHP_RELEASE_VERSION=14
123 PHP_EXTRA_VERSION=""
124 PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
125 PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
127 dnl Allow version values to be used in Makefile
128 PHP_SUBST(PHP_MAJOR_VERSION)
129 PHP_SUBST(PHP_MINOR_VERSION)
130 PHP_SUBST(PHP_RELEASE_VERSION)
131 PHP_SUBST(PHP_EXTRA_VERSION)
133 dnl Define where extension directories are located in the configure context
134 AC_DEFUN([PHP_EXT_BUILDDIR],[ext/$1])dnl
135 AC_DEFUN([PHP_EXT_DIR],[ext/$1])dnl
136 AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir/ext/$1])dnl
137 AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl
139 dnl Setting up the PHP version based on the information above.
140 dnl -------------------------------------------------------------------------
142 echo "/* automatically generated by configure */" > php_version.h.new
143 echo "/* edit configure.in to change version number */" >> php_version.h.new
144 echo "#define PHP_MAJOR_VERSION $PHP_MAJOR_VERSION" >> php_version.h.new
145 echo "#define PHP_MINOR_VERSION $PHP_MINOR_VERSION" >> php_version.h.new
146 echo "#define PHP_RELEASE_VERSION $PHP_RELEASE_VERSION" >> php_version.h.new
147 echo "#define PHP_EXTRA_VERSION \"$PHP_EXTRA_VERSION\"" >> php_version.h.new
148 echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
149 echo "#define PHP_VERSION_ID $PHP_VERSION_ID" >> php_version.h.new
150 cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
151 if test $? -ne 0 ; then
152   rm -f $srcdir/main/php_version.h && mv php_version.h.new $srcdir/main/php_version.h && \
153   echo 'Updated main/php_version.h'
154 else
155   rm -f php_version.h.new
159 dnl Catch common errors here to save a few seconds of our users' time
160 dnl -------------------------------------------------------------------------
162 if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then
163   AC_MSG_ERROR([--with-shared-apache is not supported. Please refer to the documentation for using APXS])
166 if test -n "$with_apache" && test -n "$with_apxs"; then
167   AC_MSG_ERROR([--with-apache and --with-apxs cannot be used together])
170 if test -n "$with_apxs2filter" && test -n "$with_apxs2"; then
171   AC_MSG_ERROR([--with-apxs2filter and --with-apxs2 cannot be used together])
174   
175 dnl Settings we want to make before the checks.
176 dnl -------------------------------------------------------------------------
178 cwd=`pwd`
180 php_shtool=$srcdir/build/shtool
181 T_MD=`$php_shtool echo -n -e %B`
182 T_ME=`$php_shtool echo -n -e %b`
184 PHP_INIT_BUILD_SYSTEM
186 dnl We want this one before the checks, so the checks can modify CFLAGS.
187 test -z "$CFLAGS" && auto_cflags=1
189 abs_srcdir=`(cd $srcdir; pwd)`
190 abs_builddir=`pwd`
192 php_abs_top_srcdir=$abs_srcdir
193 php_abs_top_builddir=$abs_builddir
195 dnl Because ``make install'' is often performed by the superuser,
196 dnl we create the libs subdirectory as the user who configures PHP.
197 dnl Otherwise, the current user will not be able to delete libs
198 dnl or the contents of libs.
200 $php_shtool mkdir -p libs
201 rm -f libs/*
203 dnl Checks for programs.
204 dnl -------------------------------------------------------------------------
206 AC_PROG_CC([cc gcc])
207 PHP_DETECT_ICC
208 PHP_DETECT_SUNCC
209 AC_PROG_CC_C_O
210 dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
211 dnl AC_PROG_CC_STDC
212 AC_PROG_CPP
213 AC_AIX
214 AC_PROG_LN_S
216 dnl Support systems with system libraries in e.g. /usr/lib64
217 PHP_ARG_WITH(libdir, for system library directory,
218 [  --with-libdir=NAME      Look for libraries in .../NAME rather than .../lib],lib,no)
220 PHP_ARG_ENABLE(rpath, whether to enable runpaths,
221 [  --disable-rpath         Disable passing additional runtime library
222                           search paths], yes, no)
224 dnl check for -R, etc. switch
225 PHP_RUNPATH_SWITCH
227 dnl Checks for some support/generator progs
228 PHP_PROG_AWK
229 PHP_PROG_BISON
230 PHP_PROG_RE2C
232 dnl Check if bison generated files exist when bison does not..
233 case $php_cv_bison_version in
234   ""|invalid[)]
235     if ! test -f "$abs_srcdir/Zend/zend_language_parser.h" || ! test -f "$abs_srcdir/Zend/zend_language_parser.c" ; then
236       AC_MSG_ERROR([bison is required to build PHP/Zend when building a GIT checkout!])
237     fi
238     ;;
239 esac
241 PHP_ARG_ENABLE(re2c-cgoto, whether to enable computed goto gcc extension with re2c,
242 [  --enable-re2c-cgoto     Enable -g flag to re2c to use computed goto gcc extension], no, no)
244 if test "$PHP_RE2C_CGOTO" = "no"; then
245   RE2C_FLAGS=""
246 else
247   AC_MSG_CHECKING([whether re2c -g works])
248   AC_TRY_COMPILE([],[
249 int main(int argc, const char **argv)
251   argc = argc;
252   argv = argv;
253 label1:
254 label2:
255   static void *adr[] = { &&label1, &&label2};
256   goto *adr[0];
257   return 0;
259   ],[
260     RE2C_FLAGS=""
261     AC_MSG_RESULT([no])
262   ],[
263     RE2C_FLAGS="-g"
264     AC_MSG_RESULT([yes])
265   ])
267 PHP_SUBST(RE2C_FLAGS)
269 dnl Platform-specific compile settings.
270 dnl -------------------------------------------------------------------------
272 dnl See bug #28605
273 case $host_cpu in
274   alpha*)
275     if test "$GCC" = "yes"; then
276       CFLAGS="$CFLAGS -mieee"
277     else
278       CFLAGS="$CFLAGS -ieee"
279     fi
280     ;;
281   sparc*)
282     if test "$SUNCC" = "yes"; then
283       CFLAGS="$CFLAGS -xmemalign=8s"
284     fi
285     ;;
286 esac
288 dnl activate some gcc specific optimizations for gcc >= 4
289 if test "$GCC" = "yes"; then
290   case $host_alias in
291   *darwin*)
292     GCC_MAJOR_VERSION=`$CC -dumpversion | /usr/bin/sed -nE '1s/([[0-9]]+)\.[[0-9]]+\..*/\1/;1p'`
293     ;;
294   *)
295     GCC_MAJOR_VERSION=`$CC --version | $SED -n '1s/[[^0-9]]*//;1s/\..*//;1p'`
296     ;;
297   esac
298   if test $GCC_MAJOR_VERSION -ge 4; then
299     CFLAGS="$CFLAGS -fvisibility=hidden"
300   fi
303 case $host_alias in
304   *solaris*)
305     CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
306     if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
307       enable_libgcc=yes
308     fi
309     ;;
310   *dgux*)
311     CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR"
312     ;;
313   *darwin*|*rhapsody*)
314     if test -n "$GCC"; then
315       PHP_CHECK_GCC_ARG(-no-cpp-precomp, gcc_no_cpp_precomp=yes)
316       if test "$gcc_no_cpp_precomp" = "yes"; then
317         CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
318       fi
319     fi
320     php_multiple_shlib_versions_ok=yes
321     ;;
322   *beos*)
323     beos_threads=1
324     LIBS="$LIBS -lbe -lroot"
325     ;;
326   *mips*)
327     CPPFLAGS="$CPPFLAGS -D_XPG_IV"
328     ;;
329   *hpux*)
330     if test "$GCC" = "yes"; then
331       CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
332     fi
333     ;;
334   *netware*)
335     PHP_BUILD_PROGRAM
336     PHP_ADD_SOURCES(/main, internal_functions.c,,PHP_GLOBAL_OBJS)
337     PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS, PHP_GLOBAL_OBJS)
338     PHP5LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
339     EXTENSION_DIR=sys:/php$PHP_MAJOR_VERSION/ext
340     PHP_SUBST(PHP5LIB_SHARED_LIBADD)
341     PHP_SHARED_MODULE(php5lib, PHP_GLOBAL_OBJS, netware)
342     ;;
343 esac
345 # Disable PIC mode by default where it is known to be safe to do so,
346 # to avoid the performance hit from the lost register
347 AC_MSG_CHECKING([whether to force non-PIC code in shared modules])
348 case $host_alias in
349   i?86-*-linux*|i?86-*-freebsd*)
350     if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then
351       with_pic=no
352       AC_MSG_RESULT(yes)
353     else
354       AC_MSG_RESULT(no)
355     fi
356     ;;
357   *)
358     AC_MSG_RESULT(no)
359     ;;
360 esac
363 dnl Include Zend and TSRM configurations.
364 dnl -------------------------------------------------------------------------
366 sinclude(Zend/Zend.m4)
367 sinclude(TSRM/threads.m4)
368 sinclude(TSRM/tsrm.m4)
370 dnl .
371 dnl -------------------------------------------------------------------------
373 PTHREADS_CHECK
374 PHP_HELP_SEPARATOR([SAPI modules:])
375 PHP_SHLIB_SUFFIX_NAMES
376 PHP_BUILD_PROGRAM
377 PHP_SAPI=none
380 dnl SAPI configuration.
381 dnl -------------------------------------------------------------------------
383 dnl paths to the targets are relative to the build directory
384 SAPI_SHARED=libs/libphp[]$PHP_MAJOR_VERSION[.]$SHLIB_DL_SUFFIX_NAME
385 SAPI_STATIC=libs/libphp[]$PHP_MAJOR_VERSION[.a]
386 SAPI_LIBTOOL=libphp[]$PHP_MAJOR_VERSION[.la]
388 PHP_CONFIGURE_PART(Configuring SAPI modules)
390 esyscmd(./build/config-stubs sapi)
392 dnl Show which main SAPI was selected
393 AC_MSG_CHECKING([for chosen SAPI module])
394 AC_MSG_RESULT([$PHP_SAPI])
396 dnl Show which binaries were selected
397 AC_MSG_CHECKING([for executable SAPI binaries])
398 if test "$PHP_BINARIES"; then
399   AC_MSG_RESULT([$PHP_BINARIES])
400 else
401   AC_MSG_RESULT([none])
404 dnl Exit early
405 if test -z "$PHP_INSTALLED_SAPIS"; then
406   AC_MSG_ERROR([Nothing to build.])
409 dnl force ZTS
410 if test "$enable_maintainer_zts" = "yes"; then
411   PTHREADS_ASSIGN_VARS
412   PTHREADS_FLAGS
415 dnl Starting system checks.
416 dnl -------------------------------------------------------------------------
418 PHP_CONFIGURE_PART(Running system checks)
420 dnl Find sendmail binary
421 PHP_PROG_SENDMAIL
423 dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset
424 PHP_EBCDIC
426 dnl Check whether the system byte ordering is bigendian
427 PHP_C_BIGENDIAN
429 dnl Check whether writing to stdout works
430 PHP_TEST_WRITE_STDOUT
432 dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
433 dnl and source packages.  This should be harmless on other OSs.
434 if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
435    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
436    LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
438 test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
441 dnl First, library checks.
442 dnl -------------------------------------------------------------------------
444 dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
445 dnl to avoid -lnsl checks, if we already have the functions which
446 dnl are usually in libnsl
447 dnl Also, uClibc will bark at linking with glibc's libnsl.
449 PHP_CHECK_FUNC(socket, socket)
450 PHP_CHECK_FUNC(socketpair, socket)
451 PHP_CHECK_FUNC(htonl, socket)
452 PHP_CHECK_FUNC(gethostname, nsl)
453 PHP_CHECK_FUNC(gethostbyaddr, nsl)
454 PHP_CHECK_FUNC(yp_get_default_domain, nsl)
456 PHP_ADD_LIBRARY(dl)
457 PHP_DEF_HAVE(dlopen)
458 PHP_DEF_HAVE(libdl)
459 ac_cv_func_dlopen=yes
460 if test "$ac_cv_func_dlopen" = "yes"; then
461   AC_DEFINE(HAVE_LIBDL, 1, [ ])
463 AC_CHECK_LIB(m, sin)
465 dnl Check for inet_aton
466 dnl in -lc, -lbind and -lresolv
467 PHP_CHECK_FUNC(inet_aton, resolv, bind)
469 dnl Then headers.
470 dnl -------------------------------------------------------------------------
472 dnl Checks for header files.
473 AC_HEADER_STDC
474 AC_HEADER_DIRENT
476 dnl QNX requires unix.h to allow functions in libunix to work properly
477 AC_CHECK_HEADERS([ \
478 inttypes.h \
479 stdint.h \
480 dirent.h \
481 ApplicationServices/ApplicationServices.h \
482 sys/param.h \
483 sys/types.h \
484 sys/time.h \
485 netinet/in.h \
486 alloca.h \
487 arpa/inet.h \
488 arpa/nameser.h \
489 assert.h \
490 crypt.h \
491 dns.h \
492 fcntl.h \
493 grp.h \
494 ieeefp.h \
495 langinfo.h \
496 limits.h \
497 locale.h \
498 monetary.h \
499 netdb.h \
500 pwd.h \
501 resolv.h \
502 signal.h \
503 stdarg.h \
504 stdlib.h \
505 string.h \
506 syslog.h \
507 sysexits.h \
508 sys/ioctl.h \
509 sys/file.h \
510 sys/mman.h \
511 sys/mount.h \
512 sys/poll.h \
513 sys/resource.h \
514 sys/select.h \
515 sys/socket.h \
516 sys/stat.h \
517 sys/statfs.h \
518 sys/statvfs.h \
519 sys/vfs.h \
520 sys/sysexits.h \
521 sys/varargs.h \
522 sys/wait.h \
523 sys/loadavg.h \
524 termios.h \
525 unistd.h \
526 unix.h \
527 utime.h \
528 sys/utsname.h \
529 sys/ipc.h \
530 dlfcn.h \
531 assert.h
532 ],[],[],[
533 #ifdef HAVE_SYS_PARAM_H
534 #include <sys/param.h>
535 #endif
536 #ifdef HAVE_SYS_TYPES_H
537 #include <sys/types.h>
538 #endif
539 #ifdef HAVE_SYS_TIME_H
540 #include <sys/time.h>
541 #endif
542 #ifdef HAVE_NETINET_IN_H
543 #include <netinet/in.h>
544 #endif
545 #ifdef HAVE_ARPA_NAMESER_H
546 #include <arpa/nameser.h>
547 #endif
550 PHP_FOPENCOOKIE
551 PHP_BROKEN_GETCWD
552 PHP_BROKEN_GLIBC_FOPEN_APPEND
554 dnl Checks for typedefs, structures, and compiler characteristics.
555 dnl -------------------------------------------------------------------------
557 AC_STRUCT_TM
558 AC_STRUCT_TIMEZONE
560 PHP_MISSING_TIME_R_DECL
561 PHP_MISSING_FCLOSE_DECL
563 PHP_TM_GMTOFF
564 PHP_STRUCT_FLOCK
565 PHP_SOCKLEN_T
567 AC_CHECK_SIZEOF(size_t, 8)
568 AC_CHECK_SIZEOF(long long, 8)
569 AC_CHECK_SIZEOF(long long int, 8)
570 AC_CHECK_SIZEOF(long, 8)
571 AC_CHECK_SIZEOF(int, 4)
573 dnl These are defined elsewhere than stdio.h
574 PHP_CHECK_SIZEOF(intmax_t, 0)
575 PHP_CHECK_SIZEOF(ssize_t, 8)
576 PHP_CHECK_SIZEOF(ptrdiff_t, 8)
578 dnl Check for members of the stat structure
579 AC_STRUCT_ST_BLKSIZE
580 dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
581 dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
582 if test "`uname -s 2>/dev/null`" != "QNX"; then
583   AC_STRUCT_ST_BLOCKS
584 else
585   AC_MSG_WARN([warnings level for cc set to 0])
586   WARNING_LEVEL=0
588 AC_STRUCT_ST_RDEV
590 dnl Checks for types
591 AC_TYPE_SIZE_T
592 AC_TYPE_UID_T
594 dnl Checks for sockaddr_storage and sockaddr.sa_len
595 PHP_SOCKADDR_CHECKS
597 dnl Check for IPv6 support
598 AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
599 [AC_TRY_LINK([ #include <sys/types.h>
600 #include <sys/socket.h>
601 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
602   [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
604 dnl Checks for library functions.
605 dnl -------------------------------------------------------------------------
607 AC_FUNC_VPRINTF
608 AC_CHECK_FUNCS(
609 alphasort \
610 asctime_r \
611 chroot \
612 ctime_r \
613 cuserid \
614 crypt \
615 flock \
616 ftok \
617 funopen \
618 gai_strerror \
619 gcvt \
620 getloadavg \
621 getlogin \
622 getprotobyname \
623 getprotobynumber \
624 getservbyname \
625 getservbyport \
626 gethostname \
627 getrusage \
628 gettimeofday \
629 gmtime_r \
630 getpwnam_r \
631 getgrnam_r \
632 getpwuid_r \
633 grantpt \
634 inet_ntoa \
635 inet_ntop \
636 inet_pton \
637 isascii \
638 link \
639 localtime_r \
640 lockf \
641 lchown \
642 lrand48 \
643 memcpy \
644 memmove \
645 mkstemp \
646 mmap \
647 nl_langinfo \
648 perror \
649 poll \
650 ptsname \
651 putenv \
652 realpath \
653 random \
654 rand_r \
655 scandir \
656 setitimer \
657 setlocale \
658 localeconv \
659 setenv \
660 setpgid \
661 setsockopt \
662 setvbuf \
663 shutdown \
664 sin \
665 snprintf \
666 srand48 \
667 srandom \
668 statfs \
669 statvfs \
670 std_syslog \
671 strcasecmp \
672 strcoll \
673 strdup \
674 strerror \
675 strftime \
676 strnlen \
677 strptime \
678 strstr \
679 strtok_r \
680 symlink \
681 tempnam \
682 tzset \
683 unlockpt \
684 unsetenv \
685 usleep \
686 utime \
687 vsnprintf \
688 vasprintf \
689 asprintf \
690 nanosleep \
693 dnl Some systems (like OpenSolaris) do not have nanosleep in libc
694 PHP_CHECK_FUNC_LIB(nanosleep, rt)
696 dnl Check for getaddrinfo, should be a better way, but...
697 dnl Also check for working getaddrinfo
698 AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
699 [AC_TRY_LINK([#include <netdb.h>],
700                 [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);], 
701   AC_TRY_RUN([
702 #include <netdb.h>
703 #include <sys/types.h>
704 #ifndef AF_INET
705 # include <sys/socket.h>
706 #endif
707 int main(void) {
708   struct addrinfo *ai, *pai, hints;
710   memset(&hints, 0, sizeof(hints));
711   hints.ai_flags = AI_NUMERICHOST;
713   if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
714     exit(1);
715   }
717   if (ai == 0) {
718     exit(1);
719   }
721   pai = ai;
722   
723   while (pai) {
724     if (pai->ai_family != AF_INET) {
725       /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
726       exit(1);
727     }
728     if (pai->ai_addr->sa_family != AF_INET) {
729       /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
730       exit(1);
731     }
732     pai = pai->ai_next;
733   }
734   freeaddrinfo(ai);
735   exit(0);
737   ],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no, ac_cv_func_getaddrinfo=no),
738 ac_cv_func_getaddrinfo=no)])
739 if test "$ac_cv_func_getaddrinfo" = yes; then
740   AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
743 dnl Check for the __sync_fetch_and_add builtin
744 AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
745 [AC_TRY_LINK([],[int x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
746 if test "$ac_cv_func_sync_fetch_and_add" = yes; then
747   AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
750 AC_REPLACE_FUNCS(strlcat strlcpy getopt)
751 AC_FUNC_UTIME_NULL
752 AC_FUNC_ALLOCA
753 dnl PHP_AC_BROKEN_SPRINTF
754 dnl PHP_AC_BROKEN_SNPRINTF
755 PHP_DECLARED_TIMEZONE
756 PHP_TIME_R_TYPE
757 PHP_READDIR_R_TYPE
758 PHP_CHECK_IN_ADDR_T
760 AC_CHECK_FUNCS(crypt_r, [ php_crypt_r="1" ], [ php_crypt_r="0" ])
761 if test "x$php_crypt_r" = "x1"; then
762   PHP_CRYPT_R_STYLE
765 dnl General settings.
766 dnl -------------------------------------------------------------------------
767 PHP_CONFIGURE_PART(General settings)
769 PHP_HELP_SEPARATOR([General settings:])
771 PHP_ARG_ENABLE(gcov,  whether to include gcov symbols,
772 [  --enable-gcov           Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!], no, no)
774 if test "$PHP_GCOV" = "yes"; then
776   if test "$GCC" != "yes"; then
777     AC_MSG_ERROR([GCC is required for --enable-gcov])
778   fi
779   
780   dnl Check if ccache is being used
781   case `$php_shtool path $CC` in
782     *ccache*[)] gcc_ccache=yes;;
783     *[)] gcc_ccache=no;;
784   esac
786   if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
787     AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
788   fi
789   
790   ltp_version_list="1.5 1.6 1.7"
792   AC_CHECK_PROG(LTP, lcov, lcov)
793   AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
794   PHP_SUBST(LTP)
795   PHP_SUBST(LTP_GENHTML)
797   if test "$LTP"; then
798     AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
799       php_cv_ltp_version=invalid
800       ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
801       for ltp_check_version in $ltp_version_list; do
802         if test "$ltp_version" = "$ltp_check_version"; then
803           php_cv_ltp_version="$ltp_check_version (ok)"
804         fi
805       done
806     ])
807   else
808     ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"      
809     AC_MSG_ERROR([$ltp_msg])
810   fi
812   case $php_cv_ltp_version in
813     ""|invalid[)]
814       ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
815       AC_MSG_ERROR([$ltp_msg])
816       LTP="exit 0;"
817       ;;
818   esac
820   if test -z "$LTP_GENHTML"; then
821     AC_MSG_ERROR([Could not find genhtml from the LTP package])
822   fi
824   AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
825   PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.gcov, $abs_srcdir)
827   dnl Remove all optimization flags from CFLAGS
828   changequote({,})
829   CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
830   CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
831   changequote([,])
833   dnl Add the special gcc flags
834   CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
835   CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
838 PHP_ARG_ENABLE(debug, whether to include debugging symbols,
839 [  --enable-debug          Compile with debugging symbols], no, no)
841 if test "$PHP_DEBUG" = "yes"; then
842   PHP_DEBUG=1
843   ZEND_DEBUG=yes
844   changequote({,})
845   CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
846   CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
847   changequote([,])
848   dnl add -O0 only if GCC or ICC is used
849   if test "$GCC" = "yes" || test "$ICC" = "yes"; then
850     CFLAGS="$CFLAGS -O0"
851     CXXFLAGS="$CXXFLAGS -g -O0"
852   fi
853   if test "$SUNCC" = "yes"; then
854     if test -n "$auto_cflags"; then
855       CFLAGS="-g"
856       CXXFLAGS="-g"
857     else
858       CFLAGS="$CFLAGS -g"
859       CXXFLAGS="$CFLAGS -g"
860     fi
861   fi
862 else
863   PHP_DEBUG=0
864   ZEND_DEBUG=no
867 PHP_ARG_WITH(layout, layout of installed files,
868 [  --with-layout=TYPE      Set how installed files will be laid out.  Type can
869                           be either PHP or GNU @<:@PHP@:>@], PHP, no)
871 case $PHP_LAYOUT in
872   GNU)
873     oldstyleextdir=no
874     ;;
875   *)
876     oldstyleextdir=yes
877     ;;
878 esac
880 PHP_ARG_WITH(config-file-path, path to configuration file,
881 [  --with-config-file-path=PATH
882                           Set the path in which to look for php.ini @<:@PREFIX/lib@:>@], DEFAULT, no)
884 if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
885   case $PHP_LAYOUT in
886     GNU)
887       PHP_CONFIG_FILE_PATH=$sysconfdir
888       ;;
889     *)
890       PHP_CONFIG_FILE_PATH=$libdir
891       ;;
892   esac
895 AC_MSG_CHECKING([where to scan for configuration files])
896 PHP_ARG_WITH(config-file-scan-dir,,
897 [  --with-config-file-scan-dir=PATH
898                           Set the path where to scan for configuration files], DEFAULT, no) 
899 if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
900   PHP_CONFIG_FILE_SCAN_DIR=
902 AC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR])
904 test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
906 PHP_ARG_ENABLE(sigchild, whether to enable PHP's own SIGCHLD handler,
907 [  --enable-sigchild       Enable PHP's own SIGCHLD handler], no, no)
909 if test "$PHP_SIGCHILD" = "yes"; then
910   AC_DEFINE(PHP_SIGCHILD, 1, [ ])
911 else
912   AC_DEFINE(PHP_SIGCHILD, 0, [ ])
915 PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
916 [  --enable-libgcc         Enable explicitly linking against libgcc], no, no)
918 if test "$PHP_LIBGCC" = "yes"; then
919   PHP_LIBGCC_LIBPATH(gcc)
920   if test -z "$libgcc_libpath"; then
921     AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path])
922   fi
923   PHP_ADD_LIBPATH($libgcc_libpath)
924   PHP_ADD_LIBRARY(gcc, yes)
927 PHP_ARG_ENABLE(short-tags, whether to enable short tags by default,
928 [  --disable-short-tags    Disable the short-form <? start tag by default], yes, no)
930 if test "$PHP_SHORT_TAGS" = "yes"; then
931   AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "1", [ ])
932 else
933   AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "0", [ ])
936 PHP_ARG_ENABLE(dmalloc, whether to enable dmalloc,
937 [  --enable-dmalloc        Enable dmalloc], no, no)
939 if test "$PHP_DMALLOC" = "yes"; then
940   AC_CHECK_LIB(dmalloc, dmalloc_error, [
941     PHP_ADD_LIBRARY(dmalloc)
942     AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
943     CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
944   ], [
945     AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.])
946   ])
949 PHP_ARG_ENABLE(ipv6, whether to enable IPv6 support,
950 [  --disable-ipv6          Disable IPv6 support], yes, no)
952 if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
953   AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
956 dnl ##
957 dnl ## DTRACE CHECKS
958 dnl ## Note: this has to be done after SAPI configuration!
959 dnl ##
960 PHP_ARG_ENABLE(dtrace, whether to enable DTrace support,
961 [  --enable-dtrace         Enable DTrace support], no, no)
963 if test "$PHP_DTRACE" = "yes"; then
964   AC_CHECK_HEADERS([sys/sdt.h], [
965     PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \
966       Zend/zend_execute.c Zend/zend_exceptions.c \
967       Zend/zend_dtrace.c Zend/zend.c])
968     AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
969     PHP_SUBST(PHP_DTRACE_OBJS)
970   ], [
971     AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support])
972   ])
975 AC_MSG_CHECKING([how big to make fd sets])
976 PHP_ARG_ENABLE(fd-setsize,,
977 [  --enable-fd-setsize     Set size of descriptor sets], no, no)
979 if test "$PHP_FD_SETSIZE" != "no"; then
980   if test "0$PHP_FD_SETSIZE" -gt 0 2>/dev/null; then
981     CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$PHP_FD_SETSIZE"
982     AC_MSG_RESULT([using $PHP_FD_SETSIZE])
983   else
984     AC_MSG_ERROR([Invalid value passed to --enable-fd-setsize!])
985   fi
986 else
987   AC_MSG_RESULT([using system default])
990 dnl Extension configuration.
991 dnl -------------------------------------------------------------------------
993 PHP_HELP_SEPARATOR([Extensions:
995   --with-EXTENSION=[shared[,PATH]]
996   
997     NOTE: Not all extensions can be build as 'shared'.
999     Example: --with-foobar=shared,/usr/local/foobar/
1001       o Builds the foobar extension as shared extension.
1002       o foobar package install prefix is /usr/local/foobar/
1005 PHP_CONFIGURE_PART(Configuring extensions)
1008 dnl Check if all enabled by default extensions should be disabled
1011 AC_ARG_ENABLE(all,
1012 [ --disable-all   Disable all extensions which are enabled by default
1013 ], [
1014   PHP_ENABLE_ALL=$enableval
1017 # reading config stubs
1018 esyscmd(./build/config-stubs ext)
1020 dnl Extensions post-config
1021 dnl -------------------------------------------------------------------------
1023 enable_shared=yes
1024 enable_static=yes
1026 case $php_sapi_module in
1027   shared[)]
1028     enable_static=no
1029     case $with_pic in
1030       yes)
1031         standard_libtool_flag='-prefer-pic'
1032         ;;
1033       no)
1034         standard_libtool_flag='-prefer-non-pic'
1035         ;;
1036     esac
1037     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
1038     ;;
1039   *[)]
1040     standard_libtool_flag='-prefer-non-pic -static'
1041     if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then
1042       enable_shared=no
1043     fi
1044     ;;
1045 esac
1047 EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
1049 dnl this has to be here to prevent the openssl crypt() from
1050 dnl overriding the system provided crypt().
1051 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
1052   EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
1055 unset LIBS LDFLAGS
1057 dnl PEAR
1058 dnl -------------------------------------------------------------------------
1060 PHP_HELP_SEPARATOR([PEAR:])
1061 PHP_CONFIGURE_PART(Configuring PEAR)
1063 # compatibility
1064 if test -z "$with_pear" && test "$enable_pear" = "no"; then
1065   with_pear=no
1068 # If CLI is disabled -> disable PEAR
1069 if test "$PHP_CLI" = "no"; then
1070   with_pear=no
1073 PHP_ARG_WITH(pear, [whether to install PEAR],
1074 [  --with-pear=DIR         Install PEAR in DIR @<:@PREFIX/lib/php@:>@
1075   --without-pear          Do not install PEAR], DEFAULT, yes)
1077 if test "$PHP_PEAR" != "no"; then
1079   dnl
1080   dnl PEAR dependancies
1081   dnl
1082   if test "$PHP_XML" = "no"; then
1083     pear_error_msg="$pear_error_msg 
1084                     PEAR requires XML to be enabled.     Add --enable-xml to the configure line. (or --without-pear)"
1085   fi
1088 dnl  if test "$PHP_XMLRPC" = "no"; then
1089 dnl    pear_error_msg="$pear_error_msg 
1090 dnl                    PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
1091 dnl  fi
1094   if test "$pear_error_msg"; then
1095     AC_MSG_ERROR([$pear_error_msg])
1096   fi
1098   install_pear="install-pear"
1099   PEAR_INSTALLDIR=$PHP_PEAR
1101   if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
1102     case $PHP_LAYOUT in
1103       GNU) PEAR_INSTALLDIR=$datadir/pear;;
1104       *)   PEAR_INSTALLDIR=$libdir/php;;
1105     esac
1106   fi
1108   PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
1112 dnl Configuring Zend and TSRM.
1113 dnl -------------------------------------------------------------------------
1115 PHP_HELP_SEPARATOR([Zend:])
1116 PHP_CONFIGURE_PART(Configuring Zend)
1118 LIBZEND_BASIC_CHECKS
1119 LIBZEND_DLSYM_CHECK
1120 LIBZEND_OTHER_CHECKS
1122 if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
1123   AC_DEFINE(ZTS,1,[ ])
1124   PHP_THREAD_SAFETY=yes
1125 else
1126   PHP_THREAD_SAFETY=no
1129 INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
1130 INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
1132 if test "$abs_srcdir" != "$abs_builddir"; then
1133   INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
1134   INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
1137 ZEND_EXTRA_LIBS="$LIBS"
1138 unset LIBS LDFLAGS
1140 PHP_HELP_SEPARATOR([TSRM:])
1141 PHP_CONFIGURE_PART(Configuring TSRM)
1142 TSRM_BASIC_CHECKS
1143 if test "$PHP_THREAD_SAFETY" = "yes"; then
1144   TSRM_THREADS_CHECKS
1147 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
1148 EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
1149 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
1150 unset LIBS LDFLAGS
1152 test "$prefix" = "NONE" && prefix=/usr/local
1153 test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
1154 test "$program_prefix" = "NONE" && program_prefix=
1155 test "$program_suffix" = "NONE" && program_suffix=
1157 case $libdir in
1158   '${exec_prefix}/lib')
1159     libdir=$libdir/php
1160     ;;
1161 esac
1162 case $datadir in
1163   '${prefix}/share')
1164     datadir=$datadir/php
1165     ;;
1166 esac
1168 phplibdir=`pwd`/modules
1169 $php_shtool mkdir -p $phplibdir
1170 phptempdir=`pwd`/libs
1172 old_exec_prefix=$exec_prefix
1173 old_libdir=$libdir
1174 old_datadir=$datadir
1175 exec_prefix=`eval echo $exec_prefix`
1176 libdir=`eval echo $libdir`
1177 datadir=`eval echo $datadir`
1179 dnl Build extension directory path
1181 ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO //'`
1183 if test -z "$EXTENSION_DIR"; then
1184   extbasedir=$ZEND_MODULE_API_NO
1185   if test "$oldstyleextdir" = "yes"; then
1186     if test "$PHP_DEBUG" = "1"; then
1187       part1=debug
1188     else
1189       part1=no-debug
1190     fi
1191     if test "$enable_maintainer_zts" = "yes"; then
1192       part2=zts
1193     else
1194       part2=non-zts
1195     fi
1196     extbasedir=$part1-$part2-$extbasedir
1197     EXTENSION_DIR=$libdir/extensions/$extbasedir
1198   else
1199     if test "$enable_maintainer_zts" = "yes"; then
1200       extbasedir=$extbasedir-zts
1201     fi
1202     
1203     if test "$PHP_DEBUG" = "1"; then
1204       extbasedir=$extbasedir-debug
1205     fi
1206     EXTENSION_DIR=$libdir/$extbasedir
1207   fi
1210 case $PHP_LAYOUT in
1211   GNU)
1212     datarootdir=$prefix/share
1213     ;;
1214   *)
1215     datarootdir=$prefix/php
1216     ;;
1217 esac
1219 dnl Expand all directory names for use in macros/constants
1220 EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
1221 EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
1222 EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
1223 EXPANDED_BINDIR=`eval echo $bindir`
1224 EXPANDED_SBINDIR=`eval echo $sbindir`
1225 EXPANDED_MANDIR=`eval echo $mandir`
1226 EXPANDED_LIBDIR=$libdir
1227 EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
1228 EXPANDED_DATADIR=$datadir
1229 EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
1230 EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
1231 INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
1233 exec_prefix=$old_exec_prefix
1234 libdir=$old_libdir
1235 datadir=$old_datadir
1237 AC_SUBST(INCLUDE_PATH)
1238 AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
1239 AC_SUBST(EXPANDED_EXTENSION_DIR)
1240 AC_SUBST(EXPANDED_BINDIR)
1241 AC_SUBST(EXPANDED_SBINDIR)
1242 AC_SUBST(EXPANDED_MANDIR)
1243 AC_SUBST(EXPANDED_LIBDIR)
1244 AC_SUBST(EXPANDED_DATADIR)
1245 AC_SUBST(EXPANDED_SYSCONFDIR)
1246 AC_SUBST(EXPANDED_LOCALSTATEDIR)
1247 AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
1248 AC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR)
1250 if test -n "$php_ldflags_add_usr_lib"; then
1251   PHP_RPATHS="$PHP_RPATHS /usr/lib"
1254 PHP_UTILIZE_RPATHS
1256 if test -z "$php_ldflags_add_usr_lib"; then
1257   PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
1258   PHP_REMOVE_USR_LIB(LDFLAGS)
1261 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
1262 EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
1264 PHP_BUILD_DATE=`date '+%Y-%m-%d'`
1265 AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
1267 case $host_alias in
1268 *netware*)
1269   PHP_OS="NetWare"
1270   PHP_UNAME="NetWare"
1271   AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host])
1272   AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host])
1273   ;;
1275   PHP_UNAME=`uname -a | xargs`
1276   AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
1277   PHP_OS=`uname | xargs`
1278   AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
1279   ;;
1280 esac
1282 PHP_SUBST_OLD(PHP_INSTALLED_SAPIS)
1284 PHP_SUBST(PHP_EXECUTABLE)
1286 PHP_SUBST(PHP_SAPI_OBJS)
1287 PHP_SUBST(PHP_BINARY_OBJS)
1288 PHP_SUBST(PHP_GLOBAL_OBJS)
1290 PHP_SUBST(PHP_BINARIES)
1291 PHP_SUBST(PHP_MODULES)
1292 PHP_SUBST(PHP_ZEND_EX)
1294 PHP_SUBST(EXT_LIBS)
1296 PHP_SUBST_OLD(abs_builddir)
1297 PHP_SUBST_OLD(abs_srcdir)
1298 PHP_SUBST_OLD(php_abs_top_builddir)
1299 PHP_SUBST_OLD(php_abs_top_srcdir)
1301 PHP_SUBST(bindir)
1302 PHP_SUBST(sbindir)
1303 PHP_SUBST(exec_prefix)
1304 PHP_SUBST_OLD(program_prefix)
1305 PHP_SUBST_OLD(program_suffix)
1306 PHP_SUBST(includedir)
1307 PHP_SUBST(libdir)
1308 PHP_SUBST(mandir)
1309 PHP_SUBST(phplibdir)
1310 PHP_SUBST(phptempdir)
1311 PHP_SUBST(prefix)
1312 PHP_SUBST(localstatedir)
1313 PHP_SUBST(datadir)
1314 PHP_SUBST(datarootdir)
1315 PHP_SUBST(sysconfdir)
1317 PHP_SUBST(EXEEXT)
1318 PHP_SUBST(CC)
1319 PHP_SUBST(CFLAGS)
1320 PHP_SUBST(CFLAGS_CLEAN)
1321 PHP_SUBST(CPP)
1322 PHP_SUBST(CPPFLAGS)
1323 PHP_SUBST(CXX)
1324 PHP_SUBST(CXXFLAGS)
1325 PHP_SUBST(CXXFLAGS_CLEAN)
1326 PHP_SUBST_OLD(DEBUG_CFLAGS)
1327 PHP_SUBST_OLD(EXTENSION_DIR)
1328 PHP_SUBST_OLD(EXTRA_LDFLAGS)
1329 PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM)
1330 PHP_SUBST_OLD(EXTRA_LIBS)
1331 PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
1332 PHP_SUBST_OLD(INCLUDES)
1333 PHP_SUBST_OLD(EXTRA_INCLUDES)
1334 PHP_SUBST_OLD(INCLUDE_PATH)
1335 PHP_SUBST_OLD(INSTALL_IT)
1336 PHP_SUBST(LFLAGS)
1337 PHP_SUBST(LIBTOOL)
1338 PHP_SUBST(LN_S)
1339 PHP_SUBST_OLD(NATIVE_RPATHS)
1340 PHP_SUBST_OLD(PEAR_INSTALLDIR)
1341 PHP_SUBST(PHP_BUILD_DATE)
1342 PHP_SUBST_OLD(PHP_LDFLAGS)
1343 PHP_SUBST_OLD(PHP_LIBS)
1344 PHP_SUBST(OVERALL_TARGET)
1345 PHP_SUBST(PHP_RPATHS)
1346 PHP_SUBST(PHP_SAPI)
1347 PHP_SUBST_OLD(PHP_VERSION)
1348 PHP_SUBST_OLD(PHP_VERSION_ID)
1349 PHP_SUBST(SHELL)
1350 PHP_SUBST(SHARED_LIBTOOL)
1351 PHP_SUBST(WARNING_LEVEL)
1352 PHP_SUBST(PHP_FRAMEWORKS)
1353 PHP_SUBST(PHP_FRAMEWORKPATH)
1354 PHP_SUBST(INSTALL_HEADERS)
1356 old_CC=$CC
1358 if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
1359   CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
1360   INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
1361   cat >meta_ccld<<EOF
1362 #! /bin/sh
1363 exec $CC $ac_cv_pthreads_cflags \$@
1365   CC="$abs_builddir/meta_ccld"
1366   chmod +x meta_ccld
1369 dnl This will go away, if we have a facility to run per-extension code
1370 dnl after the thread_safety decision was done
1371 if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
1372   CPPFLAGS="$CPPFLAGS -DTHREAD=1"
1375 ZEND_EXT_TYPE="zend_extension"
1376 PHP_SUBST(ZEND_EXT_TYPE)
1379 dnl Libtool creation
1382 PHP_HELP_SEPARATOR([Libtool:])
1383 PHP_CONFIGURE_PART(Configuring libtool)
1385 LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
1387 dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6.
1388 dnl This hack works around it. Ugly.
1389 case $host_alias in
1390 *darwin9*|*darwin10*)
1391   ac_cv_exeext=
1392   ;;
1393 esac
1395 dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX).
1396 dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler.
1397 AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
1398   undefine([AC_PROG_CXX])
1399   AC_DEFUN([AC_PROG_CXX], [])
1400   undefine([AC_PROG_CXXCPP])
1401   AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
1403 AC_PROG_LIBTOOL
1405 if test "$enable_debug" != "yes"; then
1406   PHP_SET_LIBTOOL_VARIABLE([--silent])
1409 dnl libtool 1.4.3 needs this.
1410 PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps])
1412 test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
1413 test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
1414 SHARED_LIBTOOL='$(LIBTOOL)'
1416 CC=$old_CC
1418 PHP_CONFIGURE_PART(Generating files)
1420 CXXFLAGS_CLEAN=$CXXFLAGS
1421 CFLAGS_CLEAN=$CFLAGS
1422 CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
1423 INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
1424 CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
1426 if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
1427   pharcmd=pharcmd
1428   pharcmd_install=install-pharcmd
1429 else
1430   pharcmd=
1431   pharcmd_install=
1434 all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd"
1435 install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install"
1437 PHP_SUBST(all_targets)
1438 PHP_SUBST(install_targets)
1439 PHP_SUBST(install_binary_targets)
1441 PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
1443 PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c)
1445 PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
1446        fopen_wrappers.c alloca.c  php_scandir.c \
1447        php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
1448        strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
1449        network.c php_open_temporary_file.c php_logos.c \
1450        output.c getopt.c)
1452 PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
1453        plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c \
1454        glob_wrapper.c)
1456 PHP_ADD_SOURCES(/main, internal_functions.c,, sapi)
1458 case $host_alias in
1459   *netware*)
1460     PHP_ADD_BUILD_DIR(win32)
1461     PHP_ADD_BUILD_DIR(netware)
1462     ;;
1463   *)
1464     PHP_ADD_SOURCES_X(/main, internal_functions_cli.c,, PHP_BINARY_OBJS)
1465     ;;
1466 esac
1468 PHP_ADD_SOURCES(Zend, \
1469     zend_language_parser.c zend_language_scanner.c \
1470     zend_ini_parser.c zend_ini_scanner.c \
1471     zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c zend_dtrace.c \
1472     zend_execute_API.c zend_highlight.c zend_llist.c \
1473     zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
1474     zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
1475     zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
1476     zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
1477     zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
1478     zend_closures.c zend_float.c zend_string.c zend_signal.c)
1480 if test -r "$abs_srcdir/Zend/zend_objects.c"; then
1481   PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c)
1484 dnl Selectively disable optimization due to high RAM usage during
1485 dnl compiling the executor.
1486 if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
1487   flag=-O0
1488 else
1489   flag=
1492 PHP_ADD_SOURCES_X(Zend, zend_execute.c,,PHP_GLOBAL_OBJS,,$flag)
1494 PHP_ADD_BUILD_DIR(main main/streams)
1495 PHP_ADD_BUILD_DIR(TSRM)
1496 PHP_ADD_BUILD_DIR(Zend)
1498 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
1499 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend)
1500 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
1502 PHP_GEN_BUILD_DIRS
1503 PHP_GEN_GLOBAL_MAKEFILE
1505 AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
1507 $php_shtool mkdir -p pear/scripts
1508 $php_shtool mkdir -p scripts
1509 $php_shtool mkdir -p scripts/man1
1511 ALL_OUTPUT_FILES="php5.spec main/build-defs.h \
1512 scripts/phpize scripts/man1/phpize.1 \
1513 scripts/php-config scripts/man1/php-config.1 \
1514 $PHP_OUTPUT_FILES"
1517 dnl Check for unknown configure options
1519 PHP_CHECK_CONFIGURE_OPTIONS
1522 dnl Generate build files
1524 AC_OUTPUT($ALL_OUTPUT_FILES, [], [
1526 if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then
1527   REDO_ALL=yes
1530 ################################################################
1531 # Create configuration headers
1534 test -d TSRM || $php_shtool mkdir TSRM
1535 echo '#include <../main/php_config.h>' > TSRM/tsrm_config.h
1537 test -d Zend || $php_shtool mkdir Zend
1539 cat >Zend/zend_config.h <<FEO
1540 #include <../main/php_config.h>
1541 #if defined(APACHE) && defined(PHP_API_VERSION)
1542 #undef HAVE_DLFCN_H
1543 #endif
1546 # run this only when generating all the files?
1547 if test -n "\$REDO_ALL"; then
1548   # Hacking while airborne considered harmful.
1549   #
1550   echo "creating main/internal_functions.c"
1551   extensions="$EXT_STATIC"
1552 dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
1553   sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
1555   echo "creating main/internal_functions_cli.c"
1556   cli_extensions="$EXT_CLI_STATIC"
1557   sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$cli_extensions > main/internal_functions_cli.c
1559   if test "$UNAME" = "FreeBSD" && test "$PHP_SAPI" = "apache2filter" && test "$TSRM_PTH" != "pth-config" ; then
1560     echo "+--------------------------------------------------------------------+"
1561     echo "|                        *** WARNING ***                             |"
1562     echo "|                                                                    |"
1563     echo "| In order to build PHP as a Apache2 module on FreeBSD, you have to  |"
1564     echo "| add  --with-tsrm-pth to your ./configure line. Therefore you need  |"
1565     echo "| to install gnu-pth from /usr/ports/devel/pth.                      |"
1566   fi
1568   if test -n "$PHP_APXS_BROKEN"; then
1569     echo "+--------------------------------------------------------------------+"
1570     echo "| WARNING: Your $APXS script is most likely broken."
1571     echo "|                                                                    |"
1572     echo "| Please go read http://www.php.net/faq.build#faq.build.apxs         |"
1573     echo "| and make the changes described there and try again.                |"
1574   fi
1576   if test -n "$DEBUG_LOG"; then
1577     rm -f config.cache
1578 cat <<X
1579 +--------------------------------------------------------------------+
1580 |                       *** ATTENTION ***                            |
1581 |                                                                    |
1582 | Something is likely to be messed up here, because the configure    |
1583 | script was not able to detect a simple feature on your platform.   |
1584 | This is often caused by incorrect configuration parameters. Please |
1585 | see the file debug.log for error messages.                         |
1586 |                                                                    |
1587 | If you are unable to fix this, send the file debug.log to the      |
1588 | php-install@lists.php.net mailing list and include appropiate      |
1589 | information about your setup.                                      |
1591   fi
1593   if test "$PHP_SAPI" = "apache2handler" || test "$PHP_SAPI" = "apache2filter"; then
1594     if test "$APACHE_VERSION" -ge 2004001; then
1595       if test -z "$APACHE_THREADED_MPM"; then
1596 cat <<X
1597 +--------------------------------------------------------------------+
1598 |                        *** WARNING ***                             |
1599 |                                                                    |
1600 | You have built PHP for Apache's current non-threaded MPM.          |
1601 | If you change Apache to use a threaded MPM you must reconfigure    |
1602 | PHP with --enable-maintainer-zts                                   |
1604       fi
1605     fi
1606   fi
1608   # Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
1609   if test "$PHP_OCI8" != "no"; then
1610     if test "$PHP_SAPI" = "apache"; then
1611       if test `uname` = "Linux"; then
1612 cat <<X
1613 +--------------------------------------------------------------------+
1614 |                        *** WARNING ***                             |
1615 |                                                                    |
1616 | Please check that your Apache (httpd) is linked with libpthread.   |
1617 | If not, you have to recompile Apache with pthread. For more        |
1618 | details, see this page: http://www.php.net/manual/ref.oci8.php     |
1620       fi
1621     fi
1623     if test "$PHP_SIGCHILD" != "yes"; then
1624       if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
1625 cat <<X
1626 +--------------------------------------------------------------------+
1627 | Notice:                                                            |
1628 | If you encounter <defunc> processes when using a local Oracle      |
1629 | database, set the value BEQUEATH_DETACH=YES in Oracle Net's        |
1630 | sqlnet.ora file on the PHP host, or set the environment variable   |
1631 | BEQUEATH_DETACH to YES before starting Apache.  If the problem     |
1632 | still occurs, then recompile PHP and specify --enable-sigchild     |
1633 | when configuring.                                                  |
1635       fi
1636     fi
1637   fi
1639 cat <<X
1640 +--------------------------------------------------------------------+
1641 | License:                                                           |
1642 | This software is subject to the PHP License, available in this     |
1643 | distribution in the file LICENSE.  By continuing this installation |
1644 | process, you are bound by the terms of this license agreement.     |
1645 | If you do not agree with the terms of this license, you must abort |
1646 | the installation process at this point.                            |
1647 +--------------------------------------------------------------------+
1649 Thank you for using PHP.
1653   # Output unknown configure options
1654   if test "$PHP_UNKNOWN_CONFIGURE_OPTIONS"; then
1655     echo "Notice: Following unknown configure options were used:
1656 $PHP_UNKNOWN_CONFIGURE_OPTIONS
1658 Check '[$]0 --help' for available options
1660   fi
1665 dnl ## Local Variables:
1666 dnl ## tab-width: 4
1667 dnl ## End: