source: src/router/php7/configure.in @ 31879

Last change on this file since 31879 was 31879, checked in by brainslayer, 4 months ago

update php

File size: 45.7 KB
Line 
1## $Id$ -*- autoconf -*-
2dnl ## Process this file with autoconf to produce a configure script.
3
4dnl include Zend specific macro definitions first
5dnl -------------------------------------------------------------------------
6sinclude(Zend/acinclude.m4)
7
8dnl Basic autoconf + automake initialization, generation of config.nice.
9dnl -------------------------------------------------------------------------
10
11AC_PREREQ(2.59)
12AC_INIT(README.GIT-RULES)
13ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], [])
14
15PHP_CONFIG_NICE(config.nice)
16
17PHP_CANONICAL_HOST_TARGET
18
19AC_CONFIG_HEADER(main/php_config.h)
20AH_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
28
29#define ZEND_DLIMPORT
30
31#undef uint
32#undef ulong
33
34/* Define if you want to enable memory limit support */
35#define MEMORY_LIMIT 0
36])
37AH_BOTTOM([
38#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
39
40#ifdef HAVE_STDLIB_H
41# include <stdlib.h>
42#endif
43
44#ifdef HAVE_SYS_TYPES_H
45# include <sys/types.h>
46#endif
47
48#ifdef HAVE_SYS_SELECT_H
49#include <sys/select.h>
50#endif
51
52#ifdef HAVE_IEEEFP_H
53# include <ieeefp.h>
54#endif
55
56#ifdef HAVE_STRING_H
57# include <string.h>
58#else
59# include <strings.h>
60#endif
61
62#if ZEND_BROKEN_SPRINTF
63int zend_sprintf(char *buffer, const char *format, ...);
64#else
65# define zend_sprintf sprintf
66#endif
67
68#include <math.h>
69
70/* To enable the is_nan, is_infinite and is_finite PHP functions */
71#ifdef NETWARE
72        #define HAVE_DECL_ISNAN 1
73        #define HAVE_DECL_ISINF 1
74        #define HAVE_DECL_ISFINITE 1
75#endif
76
77#ifndef zend_isnan
78#if HAVE_DECL_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) ((a) != (a))
84#endif
85#endif
86
87#if HAVE_DECL_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 || (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
97
98#if HAVE_DECL_ISFINITE
99#define zend_finite(a) isfinite(a)
100#elif defined(HAVE_FINITE)
101#define zend_finite(a) finite(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
107
108#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
109
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
116
117#undef PTHREADS
118])
119
120PHP_MAJOR_VERSION=7
121PHP_MINOR_VERSION=1
122PHP_RELEASE_VERSION=4
123PHP_EXTRA_VERSION=""
124PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
125PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
126
127dnl Allow version values to be used in Makefile
128PHP_SUBST(PHP_MAJOR_VERSION)
129PHP_SUBST(PHP_MINOR_VERSION)
130PHP_SUBST(PHP_RELEASE_VERSION)
131PHP_SUBST(PHP_EXTRA_VERSION)
132
133dnl Define where extension directories are located in the configure context
134AC_DEFUN([PHP_EXT_BUILDDIR],[$config_m4_dir])dnl
135AC_DEFUN([PHP_EXT_DIR],[$config_m4_dir])dnl
136AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir/$config_m4_dir])dnl
137AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl
138
139dnl Setting up the PHP version based on the information above.
140dnl -------------------------------------------------------------------------
141
142echo "/* automatically generated by configure */" > php_version.h.new
143echo "/* edit configure.in to change version number */" >> php_version.h.new
144echo "#define PHP_MAJOR_VERSION $PHP_MAJOR_VERSION" >> php_version.h.new
145echo "#define PHP_MINOR_VERSION $PHP_MINOR_VERSION" >> php_version.h.new
146echo "#define PHP_RELEASE_VERSION $PHP_RELEASE_VERSION" >> php_version.h.new
147echo "#define PHP_EXTRA_VERSION \"$PHP_EXTRA_VERSION\"" >> php_version.h.new
148echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
149echo "#define PHP_VERSION_ID $PHP_VERSION_ID" >> php_version.h.new
150cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
151if 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'
154else
155  rm -f php_version.h.new
156fi
157
158
159dnl Catch common errors here to save a few seconds of our users' time
160dnl -------------------------------------------------------------------------
161
162if 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])
164fi
165
166if test -n "$with_apache" && test -n "$with_apxs"; then
167  AC_MSG_ERROR([--with-apache and --with-apxs cannot be used together])
168fi
169
170if test -n "$with_apxs2filter" && test -n "$with_apxs2"; then
171  AC_MSG_ERROR([--with-apxs2filter and --with-apxs2 cannot be used together])
172fi
173
174 
175dnl Settings we want to make before the checks.
176dnl -------------------------------------------------------------------------
177
178cwd=`pwd`
179
180php_shtool=$srcdir/build/shtool
181T_MD=`$php_shtool echo -n -e %B`
182T_ME=`$php_shtool echo -n -e %b`
183
184PHP_INIT_BUILD_SYSTEM
185
186dnl We want this one before the checks, so the checks can modify CFLAGS.
187test -z "$CFLAGS" && auto_cflags=1
188
189abs_srcdir=`(cd $srcdir; pwd)`
190abs_builddir=`pwd`
191
192php_abs_top_srcdir=$abs_srcdir
193php_abs_top_builddir=$abs_builddir
194
195dnl Because ``make install'' is often performed by the superuser,
196dnl we create the libs subdirectory as the user who configures PHP.
197dnl Otherwise, the current user will not be able to delete libs
198dnl or the contents of libs.
199
200$php_shtool mkdir -p libs
201rm -f libs/*
202
203dnl Checks for programs.
204dnl -------------------------------------------------------------------------
205
206AC_PROG_CC([cc gcc])
207PHP_DETECT_ICC
208PHP_DETECT_SUNCC
209AC_PROG_CC_C_O
210dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
211dnl AC_PROG_CC_STDC
212AC_PROG_CPP
213AC_AIX
214AC_PROG_LN_S
215
216dnl Support systems with system libraries in e.g. /usr/lib64
217PHP_ARG_WITH(libdir, for system library directory,
218[  --with-libdir=NAME      Look for libraries in .../NAME rather than .../lib],lib,no)
219
220PHP_ARG_ENABLE(rpath, whether to enable runpaths,
221[  --disable-rpath         Disable passing additional runtime library
222                          search paths], yes, no)
223
224dnl check for -R, etc. switch
225PHP_RUNPATH_SWITCH
226
227dnl Checks for some support/generator progs
228PHP_PROG_AWK
229PHP_PROG_BISON
230PHP_PROG_RE2C
231
232dnl Check if bison generated files exist when bison does not..
233case $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    ;;
239esac
240
241PHP_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)
243
244if test "$PHP_RE2C_CGOTO" = "no"; then
245  RE2C_FLAGS=""
246else
247  AC_MSG_CHECKING([whether re2c -g works])
248  AC_TRY_COMPILE([],[
249int main(int argc, const char **argv)
250{
251  argc = argc;
252  argv = argv;
253label1:
254label2:
255  static void *adr[] = { &&label1, &&label2};
256  goto *adr[0];
257  return 0;
258}
259  ],[
260    RE2C_FLAGS=""
261    AC_MSG_RESULT([no])
262  ],[
263    RE2C_FLAGS="-g"
264    AC_MSG_RESULT([yes])
265  ])
266fi
267PHP_SUBST(RE2C_FLAGS)
268
269dnl Platform-specific compile settings.
270dnl -------------------------------------------------------------------------
271
272dnl See bug #28605
273case $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    ;;
286esac
287
288dnl activate some gcc specific optimizations for gcc >= 4
289if 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
301fi
302
303case $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, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_GLOBAL_OBJS)
337    PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_GLOBAL_OBJS)
338    PHP7LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
339    EXTENSION_DIR=sys:/php$PHP_MAJOR_VERSION/ext
340    PHP_SUBST(PHP7LIB_SHARED_LIBADD)
341    PHP_SHARED_MODULE(php7lib, PHP_GLOBAL_OBJS, netware)
342    ;;
343esac
344
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
347AC_MSG_CHECKING([whether to force non-PIC code in shared modules])
348case $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    ;;
360esac
361
362
363dnl Include Zend and TSRM configurations.
364dnl -------------------------------------------------------------------------
365
366sinclude(Zend/Zend.m4)
367sinclude(TSRM/threads.m4)
368sinclude(TSRM/tsrm.m4)
369
370dnl .
371dnl -------------------------------------------------------------------------
372
373PTHREADS_CHECK
374PHP_HELP_SEPARATOR([SAPI modules:])
375PHP_SHLIB_SUFFIX_NAMES
376PHP_BUILD_PROGRAM
377PHP_SAPI=none
378
379
380dnl SAPI configuration.
381dnl -------------------------------------------------------------------------
382
383dnl paths to the targets are relative to the build directory
384SAPI_SHARED=libs/libphp[]$PHP_MAJOR_VERSION[.]$SHLIB_DL_SUFFIX_NAME
385SAPI_STATIC=libs/libphp[]$PHP_MAJOR_VERSION[.a]
386SAPI_LIBTOOL=libphp[]$PHP_MAJOR_VERSION[.la]
387
388PHP_CONFIGURE_PART(Configuring SAPI modules)
389
390esyscmd(./build/config-stubs sapi)
391
392dnl Show which main SAPI was selected
393AC_MSG_CHECKING([for chosen SAPI module])
394AC_MSG_RESULT([$PHP_SAPI])
395
396dnl Show which binaries were selected
397AC_MSG_CHECKING([for executable SAPI binaries])
398if test "$PHP_BINARIES"; then
399  AC_MSG_RESULT([$PHP_BINARIES])
400else
401  AC_MSG_RESULT([none])
402fi
403
404dnl Exit early
405if test -z "$PHP_INSTALLED_SAPIS"; then
406  AC_MSG_ERROR([Nothing to build.])
407fi
408
409dnl force ZTS
410if test "$enable_maintainer_zts" = "yes"; then
411  PTHREADS_ASSIGN_VARS
412  PTHREADS_FLAGS
413fi
414
415dnl Starting system checks.
416dnl -------------------------------------------------------------------------
417
418PHP_CONFIGURE_PART(Running system checks)
419
420dnl Find sendmail binary
421PHP_PROG_SENDMAIL
422
423dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset
424PHP_EBCDIC
425
426dnl Check whether the system byte ordering is bigendian
427PHP_C_BIGENDIAN
428
429dnl Check whether writing to stdout works
430PHP_TEST_WRITE_STDOUT
431
432dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
433dnl and source packages.  This should be harmless on other OSs.
434if 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"
437fi
438test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
439
440
441dnl First, library checks.
442dnl -------------------------------------------------------------------------
443
444dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
445dnl to avoid -lnsl checks, if we already have the functions which
446dnl are usually in libnsl
447dnl Also, uClibc will bark at linking with glibc's libnsl.
448
449PHP_CHECK_FUNC(socket, socket)
450PHP_CHECK_FUNC(socketpair, socket)
451PHP_CHECK_FUNC(htonl, socket)
452PHP_CHECK_FUNC(gethostname, nsl)
453PHP_CHECK_FUNC(gethostbyaddr, nsl)
454PHP_CHECK_FUNC(yp_get_default_domain, nsl)
455
456PHP_ADD_LIBRARY(dl)
457PHP_DEF_HAVE(dlopen)
458PHP_DEF_HAVE(libdl)
459ac_cv_func_dlopen=yes
460if test "$ac_cv_func_dlopen" = "yes"; then
461  AC_DEFINE(HAVE_LIBDL, 1, [ ])
462fi
463AC_CHECK_LIB(m, sin)
464
465dnl Check for inet_aton
466dnl in -lc, -lbind and -lresolv
467PHP_CHECK_FUNC(inet_aton, resolv, bind)
468
469dnl Then headers.
470dnl -------------------------------------------------------------------------
471
472dnl Checks for header files.
473AC_HEADER_STDC
474AC_HEADER_DIRENT
475
476dnl QNX requires unix.h to allow functions in libunix to work properly
477AC_CHECK_HEADERS([ \
478inttypes.h \
479stdint.h \
480dirent.h \
481ApplicationServices/ApplicationServices.h \
482sys/param.h \
483sys/types.h \
484sys/time.h \
485netinet/in.h \
486alloca.h \
487arpa/inet.h \
488arpa/nameser.h \
489assert.h \
490crypt.h \
491dns.h \
492fcntl.h \
493grp.h \
494ieeefp.h \
495langinfo.h \
496limits.h \
497locale.h \
498monetary.h \
499netdb.h \
500pwd.h \
501resolv.h \
502signal.h \
503stdarg.h \
504stdlib.h \
505string.h \
506syslog.h \
507sysexits.h \
508sys/ioctl.h \
509sys/file.h \
510sys/mman.h \
511sys/mount.h \
512sys/poll.h \
513sys/resource.h \
514sys/select.h \
515sys/socket.h \
516sys/stat.h \
517sys/statfs.h \
518sys/statvfs.h \
519sys/vfs.h \
520sys/sysexits.h \
521sys/varargs.h \
522sys/wait.h \
523sys/loadavg.h \
524termios.h \
525unistd.h \
526unix.h \
527utime.h \
528sys/utsname.h \
529sys/ipc.h \
530dlfcn.h \
531assert.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
548])
549
550PHP_FOPENCOOKIE
551PHP_BROKEN_GETCWD
552PHP_BROKEN_GLIBC_FOPEN_APPEND
553
554dnl Checks for typedefs, structures, and compiler characteristics.
555dnl -------------------------------------------------------------------------
556
557AC_STRUCT_TM
558AC_STRUCT_TIMEZONE
559
560PHP_MISSING_TIME_R_DECL
561PHP_MISSING_FCLOSE_DECL
562
563PHP_TM_GMTOFF
564PHP_STRUCT_FLOCK
565PHP_SOCKLEN_T
566
567AC_CHECK_SIZEOF(size_t, 8)
568AC_CHECK_SIZEOF(long long, 8)
569AC_CHECK_SIZEOF(long long int, 8)
570AC_CHECK_SIZEOF(long, 8)
571AC_CHECK_SIZEOF(int, 4)
572
573dnl These are defined elsewhere than stdio.h
574PHP_CHECK_SIZEOF(intmax_t, 0)
575PHP_CHECK_SIZEOF(ssize_t, 8)
576PHP_CHECK_SIZEOF(ptrdiff_t, 8)
577
578dnl Check stdint types (must be after header check)
579PHP_CHECK_STDINT_TYPES
580
581dnl Check __builtin_expect
582PHP_CHECK_BUILTIN_EXPECT
583dnl Check __builtin_clz
584PHP_CHECK_BUILTIN_CLZ
585dnl Check __builtin_ctzl
586PHP_CHECK_BUILTIN_CTZL
587dnl Check __builtin_ctzll
588PHP_CHECK_BUILTIN_CTZLL
589
590dnl Check for members of the stat structure
591AC_STRUCT_ST_BLKSIZE
592dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
593dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
594if test "`uname -s 2>/dev/null`" != "QNX"; then
595  AC_STRUCT_ST_BLOCKS
596else
597  AC_MSG_WARN([warnings level for cc set to 0])
598  WARNING_LEVEL=0
599fi
600AC_STRUCT_ST_RDEV
601
602dnl Checks for types
603AC_TYPE_SIZE_T
604AC_TYPE_UID_T
605
606dnl Checks for sockaddr_storage and sockaddr.sa_len
607PHP_SOCKADDR_CHECKS
608
609dnl Check for IPv6 support
610AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
611[AC_TRY_LINK([ #include <sys/types.h>
612#include <sys/socket.h>
613#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
614  [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
615
616dnl Checks for library functions.
617dnl -------------------------------------------------------------------------
618
619AC_FUNC_VPRINTF
620AC_CHECK_FUNCS(
621alphasort \
622asctime_r \
623chroot \
624ctime_r \
625cuserid \
626crypt \
627flock \
628ftok \
629funopen \
630gai_strerror \
631gcvt \
632getloadavg \
633getlogin \
634getprotobyname \
635getprotobynumber \
636getservbyname \
637getservbyport \
638gethostname \
639getrusage \
640gettimeofday \
641gmtime_r \
642getpwnam_r \
643getgrnam_r \
644getpwuid_r \
645grantpt \
646inet_ntoa \
647inet_ntop \
648inet_pton \
649isascii \
650link \
651localtime_r \
652lockf \
653lchown \
654lrand48 \
655memcpy \
656memmove \
657mkstemp \
658mmap \
659nl_langinfo \
660perror \
661poll \
662ptsname \
663putenv \
664realpath \
665random \
666rand_r \
667scandir \
668setitimer \
669setlocale \
670localeconv \
671setenv \
672setpgid \
673setsockopt \
674setvbuf \
675shutdown \
676sin \
677snprintf \
678srand48 \
679srandom \
680statfs \
681statvfs \
682std_syslog \
683strcasecmp \
684strcoll \
685strdup \
686strerror \
687strftime \
688strnlen \
689strptime \
690strstr \
691strtok_r \
692symlink \
693tempnam \
694tzset \
695unlockpt \
696unsetenv \
697usleep \
698utime \
699vsnprintf \
700vasprintf \
701asprintf \
702nanosleep \
703)
704
705dnl Some systems (like OpenSolaris) do not have nanosleep in libc
706PHP_CHECK_FUNC_LIB(nanosleep, rt)
707
708dnl Check for getaddrinfo, should be a better way, but...
709dnl Also check for working getaddrinfo
710AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
711[AC_TRY_LINK([#include <netdb.h>],
712                [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
713  AC_TRY_RUN([
714#include <netdb.h>
715#include <sys/types.h>
716#ifndef AF_INET
717# include <sys/socket.h>
718#endif
719int main(void) {
720  struct addrinfo *ai, *pai, hints;
721
722  memset(&hints, 0, sizeof(hints));
723  hints.ai_flags = AI_NUMERICHOST;
724
725  if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
726    exit(1);
727  }
728
729  if (ai == 0) {
730    exit(1);
731  }
732
733  pai = ai;
734 
735  while (pai) {
736    if (pai->ai_family != AF_INET) {
737      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
738      exit(1);
739    }
740    if (pai->ai_addr->sa_family != AF_INET) {
741      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
742      exit(1);
743    }
744    pai = pai->ai_next;
745  }
746  freeaddrinfo(ai);
747  exit(0);
748}
749  ],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no, ac_cv_func_getaddrinfo=no),
750ac_cv_func_getaddrinfo=no)])
751if test "$ac_cv_func_getaddrinfo" = yes; then
752  AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
753fi
754
755dnl Check for the __sync_fetch_and_add builtin
756AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
757[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)])
758if test "$ac_cv_func_sync_fetch_and_add" = yes; then
759  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
760fi
761
762AC_REPLACE_FUNCS(strlcat strlcpy getopt)
763AC_FUNC_UTIME_NULL
764AC_FUNC_ALLOCA
765dnl PHP_AC_BROKEN_SPRINTF
766dnl PHP_AC_BROKEN_SNPRINTF
767PHP_DECLARED_TIMEZONE
768PHP_TIME_R_TYPE
769PHP_READDIR_R_TYPE
770PHP_CHECK_IN_ADDR_T
771
772AC_CHECK_FUNCS(crypt_r, [ php_crypt_r="1" ], [ php_crypt_r="0" ])
773if test "x$php_crypt_r" = "x1"; then
774  PHP_CRYPT_R_STYLE
775fi
776
777dnl General settings.
778dnl -------------------------------------------------------------------------
779PHP_CONFIGURE_PART(General settings)
780
781PHP_HELP_SEPARATOR([General settings:])
782
783PHP_ARG_ENABLE(gcov,  whether to include gcov symbols,
784[  --enable-gcov           Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!], no, no)
785
786if test "$PHP_GCOV" = "yes"; then
787
788  if test "$GCC" != "yes"; then
789    AC_MSG_ERROR([GCC is required for --enable-gcov])
790  fi
791 
792  dnl Check if ccache is being used
793  case `$php_shtool path $CC` in
794    *ccache*[)] gcc_ccache=yes;;
795    *[)] gcc_ccache=no;;
796  esac
797
798  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
799    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
800  fi
801 
802  dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison)
803  ltp_version_min="105"
804  dnl non-working versions, e.g. "1.8 1.18";
805  dnl remove "none" when introducing the first incompatible LTP version and
806  dnl separate any following additions by spaces
807  ltp_version_exclude="1.8"
808
809  AC_CHECK_PROG(LTP, lcov, lcov)
810  AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
811  PHP_SUBST(LTP)
812  PHP_SUBST(LTP_GENHTML)
813
814  if test "$LTP"; then
815    AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
816      php_cv_ltp_version=invalid
817      ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z`
818      if test -n "$ltp_version_vars"; then
819        set $ltp_version_vars
820        ltp_version="${1}.${2}"
821        ltp_version_num="`expr ${1} \* 100 + ${2}`"
822        if test $ltp_version_num -ge $ltp_version_min; then
823          php_cv_ltp_version="$ltp_version (ok)"
824          for ltp_check_version in $ltp_version_exclude; do
825            if test "$ltp_version" = "$ltp_check_version"; then
826              php_cv_ltp_version=invalid
827              break
828            fi
829          done
830        fi
831      fi
832    ])
833  else
834    ltp_msg="To enable code coverage reporting you must have LTP installed"     
835    AC_MSG_ERROR([$ltp_msg])
836  fi
837
838  case $php_cv_ltp_version in
839    ""|invalid[)]
840      ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)."
841      AC_MSG_ERROR([$ltp_msg])
842      LTP="exit 0;"
843      ;;
844  esac
845
846  if test -z "$LTP_GENHTML"; then
847    AC_MSG_ERROR([Could not find genhtml from the LTP package])
848  fi
849
850  AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
851  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.gcov, $abs_srcdir)
852
853  dnl Remove all optimization flags from CFLAGS
854  changequote({,})
855  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
856  CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
857  changequote([,])
858
859  dnl Add the special gcc flags
860  CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
861  CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
862fi
863
864PHP_ARG_ENABLE(debug, whether to include debugging symbols,
865[  --enable-debug          Compile with debugging symbols], no, no)
866
867if test "$PHP_DEBUG" = "yes"; then
868  PHP_DEBUG=1
869  ZEND_DEBUG=yes
870  changequote({,})
871  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
872  CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
873  changequote([,])
874  dnl add -O0 only if GCC or ICC is used
875  if test "$GCC" = "yes" || test "$ICC" = "yes"; then
876    CFLAGS="$CFLAGS -O0"
877    CXXFLAGS="$CXXFLAGS -g -O0"
878  fi
879  if test "$SUNCC" = "yes"; then
880    if test -n "$auto_cflags"; then
881      CFLAGS="-g"
882      CXXFLAGS="-g"
883    else
884      CFLAGS="$CFLAGS -g"
885      CXXFLAGS="$CFLAGS -g"
886    fi
887  fi
888else
889  PHP_DEBUG=0
890  ZEND_DEBUG=no
891fi
892
893PHP_ARG_WITH(layout, layout of installed files,
894[  --with-layout=TYPE      Set how installed files will be laid out.  Type can
895                          be either PHP or GNU @<:@PHP@:>@], PHP, no)
896
897case $PHP_LAYOUT in
898  GNU)
899    oldstyleextdir=no
900    ;;
901  *)
902    oldstyleextdir=yes
903    ;;
904esac
905
906PHP_ARG_WITH(config-file-path, path to configuration file,
907[  --with-config-file-path=PATH
908                          Set the path in which to look for php.ini @<:@PREFIX/lib@:>@], DEFAULT, no)
909
910if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
911  case $PHP_LAYOUT in
912    GNU)
913      PHP_CONFIG_FILE_PATH=$sysconfdir
914      ;;
915    *)
916      PHP_CONFIG_FILE_PATH=$libdir
917      ;;
918  esac
919fi
920
921AC_MSG_CHECKING([where to scan for configuration files])
922PHP_ARG_WITH(config-file-scan-dir,,
923[  --with-config-file-scan-dir=PATH
924                          Set the path where to scan for configuration files], DEFAULT, no)
925if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
926  PHP_CONFIG_FILE_SCAN_DIR=
927fi
928AC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR])
929
930test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
931
932PHP_ARG_ENABLE(sigchild, whether to enable PHP's own SIGCHLD handler,
933[  --enable-sigchild       Enable PHP's own SIGCHLD handler], no, no)
934
935if test "$PHP_SIGCHILD" = "yes"; then
936  AC_DEFINE(PHP_SIGCHILD, 1, [ ])
937else
938  AC_DEFINE(PHP_SIGCHILD, 0, [ ])
939fi
940
941PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
942[  --enable-libgcc         Enable explicitly linking against libgcc], no, no)
943
944if test "$PHP_LIBGCC" = "yes"; then
945  PHP_LIBGCC_LIBPATH(gcc)
946  if test -z "$libgcc_libpath"; then
947    AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path])
948  fi
949  PHP_ADD_LIBPATH($libgcc_libpath)
950  PHP_ADD_LIBRARY(gcc, yes)
951fi
952
953PHP_ARG_ENABLE(short-tags, whether to enable short tags by default,
954[  --disable-short-tags    Disable the short-form <? start tag by default], yes, no)
955
956if test "$PHP_SHORT_TAGS" = "yes"; then
957  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "1", [ ])
958else
959  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "0", [ ])
960fi
961
962PHP_ARG_ENABLE(dmalloc, whether to enable dmalloc,
963[  --enable-dmalloc        Enable dmalloc], no, no)
964
965if test "$PHP_DMALLOC" = "yes"; then
966  AC_CHECK_LIB(dmalloc, dmalloc_error, [
967    PHP_ADD_LIBRARY(dmalloc)
968    AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
969    CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
970  ], [
971    AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.])
972  ])
973fi
974
975PHP_ARG_ENABLE(ipv6, whether to enable IPv6 support,
976[  --disable-ipv6          Disable IPv6 support], yes, no)
977
978if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
979  AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
980fi
981
982dnl ##
983dnl ## DTRACE CHECKS
984dnl ## Note: this has to be done after SAPI configuration!
985dnl ##
986PHP_ARG_ENABLE(dtrace, whether to enable DTrace support,
987[  --enable-dtrace         Enable DTrace support], no, no)
988
989if test "$PHP_DTRACE" = "yes"; then
990  AC_CHECK_HEADERS([sys/sdt.h], [
991    PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \
992      Zend/zend_execute.c Zend/zend_exceptions.c \
993      Zend/zend_dtrace.c Zend/zend.c])
994    AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
995    PHP_SUBST(PHP_DTRACE_OBJS)
996  ], [
997    AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support])
998  ])
999fi
1000
1001AC_MSG_CHECKING([how big to make fd sets])
1002PHP_ARG_ENABLE(fd-setsize,,
1003[  --enable-fd-setsize     Set size of descriptor sets], no, no)
1004
1005if test "$PHP_FD_SETSIZE" != "no"; then
1006  if test "0$PHP_FD_SETSIZE" -gt 0 2>/dev/null; then
1007    CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$PHP_FD_SETSIZE"
1008    AC_MSG_RESULT([using $PHP_FD_SETSIZE])
1009  else
1010    AC_MSG_ERROR([Invalid value passed to --enable-fd-setsize!])
1011  fi
1012else
1013  AC_MSG_RESULT([using system default])
1014fi
1015
1016dnl Extension configuration.
1017dnl -------------------------------------------------------------------------
1018
1019PHP_HELP_SEPARATOR([Extensions:
1020
1021  --with-EXTENSION=[shared[,PATH]]
1022 
1023    NOTE: Not all extensions can be build as 'shared'.
1024
1025    Example: --with-foobar=shared,/usr/local/foobar/
1026
1027      o Builds the foobar extension as shared extension.
1028      o foobar package install prefix is /usr/local/foobar/
1029])
1030
1031PHP_CONFIGURE_PART(Configuring extensions)
1032
1033dnl
1034dnl Check if all enabled by default extensions should be disabled
1035dnl
1036
1037AC_ARG_ENABLE(all,
1038[  --disable-all           Disable all extensions which are enabled by default
1039], [
1040  PHP_ENABLE_ALL=$enableval
1041])
1042
1043# reading config stubs
1044esyscmd(./build/config-stubs ext)
1045
1046dnl Extensions post-config
1047dnl -------------------------------------------------------------------------
1048
1049enable_shared=yes
1050enable_static=yes
1051
1052case $php_sapi_module in
1053  shared[)]
1054    enable_static=no
1055    case $with_pic in
1056      yes)
1057        standard_libtool_flag='-prefer-pic'
1058        ;;
1059      no)
1060        standard_libtool_flag='-prefer-non-pic'
1061        ;;
1062    esac
1063    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
1064    ;;
1065  *[)]
1066    standard_libtool_flag='-prefer-non-pic -static'
1067    if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then
1068      enable_shared=no
1069    fi
1070    ;;
1071esac
1072
1073EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
1074
1075dnl this has to be here to prevent the openssl crypt() from
1076dnl overriding the system provided crypt().
1077if test "$ac_cv_lib_crypt_crypt" = "yes"; then
1078  EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
1079fi
1080
1081unset LIBS LDFLAGS
1082
1083dnl PEAR
1084dnl -------------------------------------------------------------------------
1085
1086PHP_HELP_SEPARATOR([PEAR:])
1087PHP_CONFIGURE_PART(Configuring PEAR)
1088
1089# compatibility
1090if test -z "$with_pear" && test "$enable_pear" = "no"; then
1091  with_pear=no
1092fi
1093
1094# If CLI is disabled -> disable PEAR
1095if test "$PHP_CLI" = "no"; then
1096  with_pear=no
1097fi
1098
1099PHP_ARG_WITH(pear, [whether to install PEAR],
1100[  --with-pear=DIR         Install PEAR in DIR @<:@PREFIX/lib/php@:>@
1101  --without-pear          Do not install PEAR], DEFAULT, yes)
1102
1103if test "$PHP_PEAR" != "no"; then
1104
1105  dnl
1106  dnl PEAR dependancies
1107  dnl
1108  if test "$PHP_XML" = "no"; then
1109    pear_error_msg="$pear_error_msg
1110                    PEAR requires XML to be enabled.     Add --enable-xml to the configure line. (or --without-pear)"
1111  fi
1112
1113dnl
1114dnl  if test "$PHP_XMLRPC" = "no"; then
1115dnl    pear_error_msg="$pear_error_msg
1116dnl                    PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
1117dnl  fi
1118dnl
1119
1120  if test "$pear_error_msg"; then
1121    AC_MSG_ERROR([$pear_error_msg])
1122  fi
1123
1124  install_pear="install-pear"
1125  PEAR_INSTALLDIR=$PHP_PEAR
1126
1127  if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
1128    case $PHP_LAYOUT in
1129      GNU) PEAR_INSTALLDIR=$datadir/pear;;
1130      *)   PEAR_INSTALLDIR=$libdir/php;;
1131    esac
1132  fi
1133
1134  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
1135fi
1136
1137
1138dnl Configuring Zend and TSRM.
1139dnl -------------------------------------------------------------------------
1140
1141PHP_HELP_SEPARATOR([Zend:])
1142PHP_CONFIGURE_PART(Configuring Zend)
1143
1144LIBZEND_BASIC_CHECKS
1145LIBZEND_DLSYM_CHECK
1146LIBZEND_OTHER_CHECKS
1147
1148if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
1149  AC_DEFINE(ZTS,1,[ ])
1150  PHP_THREAD_SAFETY=yes
1151else
1152  PHP_THREAD_SAFETY=no
1153fi
1154
1155INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
1156INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
1157
1158if test "$abs_srcdir" != "$abs_builddir"; then
1159  INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
1160  INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
1161fi
1162
1163ZEND_EXTRA_LIBS="$LIBS"
1164unset LIBS LDFLAGS
1165
1166PHP_HELP_SEPARATOR([TSRM:])
1167PHP_CONFIGURE_PART(Configuring TSRM)
1168TSRM_BASIC_CHECKS
1169if test "$PHP_THREAD_SAFETY" = "yes"; then
1170  TSRM_THREADS_CHECKS
1171fi
1172
1173EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
1174EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
1175EXTRA_LIBS="$EXTRA_LIBS $LIBS"
1176unset LIBS LDFLAGS
1177
1178test "$prefix" = "NONE" && prefix=/usr/local
1179test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
1180test "$program_prefix" = "NONE" && program_prefix=
1181test "$program_suffix" = "NONE" && program_suffix=
1182
1183case $libdir in
1184  '${exec_prefix}/lib')
1185    libdir=$libdir/php
1186    ;;
1187esac
1188case `eval echo $datadir` in
1189  '${prefix}/share')
1190    datadir=$datadir/php
1191    ;;
1192esac
1193
1194phplibdir=`pwd`/modules
1195$php_shtool mkdir -p $phplibdir
1196phptempdir=`pwd`/libs
1197
1198old_exec_prefix=$exec_prefix
1199old_libdir=$libdir
1200old_datadir=$datadir
1201exec_prefix=`eval echo $exec_prefix`
1202libdir=`eval echo $libdir`
1203datadir=`eval eval echo $datadir`
1204
1205dnl Build extension directory path
1206
1207ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO //'`
1208
1209if test -z "$EXTENSION_DIR"; then
1210  extbasedir=$ZEND_MODULE_API_NO
1211  if test "$oldstyleextdir" = "yes"; then
1212    if test "$PHP_DEBUG" = "1"; then
1213      part1=debug
1214    else
1215      part1=no-debug
1216    fi
1217    if test "$enable_maintainer_zts" = "yes"; then
1218      part2=zts
1219    else
1220      part2=non-zts
1221    fi
1222    extbasedir=$part1-$part2-$extbasedir
1223    EXTENSION_DIR=$libdir/extensions/$extbasedir
1224  else
1225    if test "$enable_maintainer_zts" = "yes"; then
1226      extbasedir=$extbasedir-zts
1227    fi
1228   
1229    if test "$PHP_DEBUG" = "1"; then
1230      extbasedir=$extbasedir-debug
1231    fi
1232    EXTENSION_DIR=$libdir/$extbasedir
1233  fi
1234fi
1235
1236case $PHP_LAYOUT in
1237  GNU)
1238    datarootdir=$prefix/share
1239    ;;
1240  *)
1241    datarootdir=$prefix/php
1242    ;;
1243esac
1244
1245dnl Expand all directory names for use in macros/constants
1246EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
1247EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
1248EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
1249EXPANDED_BINDIR=`eval echo $bindir`
1250EXPANDED_SBINDIR=`eval echo $sbindir`
1251EXPANDED_MANDIR=`eval echo $mandir`
1252EXPANDED_LIBDIR=$libdir
1253EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
1254EXPANDED_DATADIR=$datadir
1255EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
1256EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
1257INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
1258
1259exec_prefix=$old_exec_prefix
1260libdir=$old_libdir
1261datadir=$old_datadir
1262
1263AC_SUBST(INCLUDE_PATH)
1264AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
1265AC_SUBST(EXPANDED_EXTENSION_DIR)
1266AC_SUBST(EXPANDED_BINDIR)
1267AC_SUBST(EXPANDED_SBINDIR)
1268AC_SUBST(EXPANDED_MANDIR)
1269AC_SUBST(EXPANDED_LIBDIR)
1270AC_SUBST(EXPANDED_DATADIR)
1271AC_SUBST(EXPANDED_SYSCONFDIR)
1272AC_SUBST(EXPANDED_LOCALSTATEDIR)
1273AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
1274AC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR)
1275
1276if test -n "$php_ldflags_add_usr_lib"; then
1277  PHP_RPATHS="$PHP_RPATHS /usr/lib"
1278fi
1279
1280PHP_UTILIZE_RPATHS
1281
1282if test -z "$php_ldflags_add_usr_lib"; then
1283  PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
1284  PHP_REMOVE_USR_LIB(LDFLAGS)
1285fi
1286
1287EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
1288EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
1289
1290PHP_BUILD_DATE=`date '+%Y-%m-%d'`
1291AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
1292
1293case $host_alias in
1294*netware*)
1295  PHP_OS="NetWare"
1296  PHP_UNAME="NetWare"
1297  AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host])
1298  AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host])
1299  ;;
1300*)
1301  PHP_UNAME=`uname -a | xargs`
1302  AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
1303  PHP_OS=`uname | xargs`
1304  AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
1305  ;;
1306esac
1307
1308PHP_SUBST_OLD(PHP_INSTALLED_SAPIS)
1309
1310PHP_SUBST(PHP_EXECUTABLE)
1311
1312PHP_SUBST(PHP_FASTCGI_OBJS)
1313PHP_SUBST(PHP_SAPI_OBJS)
1314PHP_SUBST(PHP_BINARY_OBJS)
1315PHP_SUBST(PHP_GLOBAL_OBJS)
1316
1317PHP_SUBST(PHP_BINARIES)
1318PHP_SUBST(PHP_MODULES)
1319PHP_SUBST(PHP_ZEND_EX)
1320
1321PHP_SUBST(EXT_LIBS)
1322
1323PHP_SUBST_OLD(abs_builddir)
1324PHP_SUBST_OLD(abs_srcdir)
1325PHP_SUBST_OLD(php_abs_top_builddir)
1326PHP_SUBST_OLD(php_abs_top_srcdir)
1327
1328PHP_SUBST(bindir)
1329PHP_SUBST(sbindir)
1330PHP_SUBST(exec_prefix)
1331PHP_SUBST_OLD(program_prefix)
1332PHP_SUBST_OLD(program_suffix)
1333PHP_SUBST(includedir)
1334PHP_SUBST(libdir)
1335PHP_SUBST(mandir)
1336PHP_SUBST(phplibdir)
1337PHP_SUBST(phptempdir)
1338PHP_SUBST(prefix)
1339PHP_SUBST(localstatedir)
1340PHP_SUBST(datadir)
1341PHP_SUBST(datarootdir)
1342PHP_SUBST(sysconfdir)
1343
1344PHP_SUBST(EXEEXT)
1345PHP_SUBST(CC)
1346PHP_SUBST(CFLAGS)
1347PHP_SUBST(CFLAGS_CLEAN)
1348PHP_SUBST(CPP)
1349PHP_SUBST(CPPFLAGS)
1350PHP_SUBST(CXX)
1351PHP_SUBST(CXXFLAGS)
1352PHP_SUBST(CXXFLAGS_CLEAN)
1353PHP_SUBST_OLD(DEBUG_CFLAGS)
1354PHP_SUBST_OLD(EXTENSION_DIR)
1355PHP_SUBST_OLD(EXTRA_LDFLAGS)
1356PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM)
1357PHP_SUBST_OLD(EXTRA_LIBS)
1358PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
1359PHP_SUBST_OLD(INCLUDES)
1360PHP_SUBST_OLD(EXTRA_INCLUDES)
1361PHP_SUBST_OLD(INCLUDE_PATH)
1362PHP_SUBST_OLD(INSTALL_IT)
1363PHP_SUBST(LFLAGS)
1364PHP_SUBST(LIBTOOL)
1365PHP_SUBST(LN_S)
1366PHP_SUBST_OLD(NATIVE_RPATHS)
1367PHP_SUBST_OLD(PEAR_INSTALLDIR)
1368PHP_SUBST(PHP_BUILD_DATE)
1369PHP_SUBST_OLD(PHP_LDFLAGS)
1370PHP_SUBST_OLD(PHP_LIBS)
1371PHP_SUBST(OVERALL_TARGET)
1372PHP_SUBST(PHP_RPATHS)
1373PHP_SUBST(PHP_SAPI)
1374PHP_SUBST_OLD(PHP_VERSION)
1375PHP_SUBST_OLD(PHP_VERSION_ID)
1376PHP_SUBST(SHELL)
1377PHP_SUBST(SHARED_LIBTOOL)
1378PHP_SUBST(WARNING_LEVEL)
1379PHP_SUBST(PHP_FRAMEWORKS)
1380PHP_SUBST(PHP_FRAMEWORKPATH)
1381PHP_SUBST(INSTALL_HEADERS)
1382
1383old_CC=$CC
1384
1385if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
1386  CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
1387  INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
1388  cat >meta_ccld<<EOF
1389#! /bin/sh
1390exec $CC $ac_cv_pthreads_cflags \$@
1391EOF
1392  CC="$abs_builddir/meta_ccld"
1393  chmod +x meta_ccld
1394fi
1395
1396dnl This will go away, if we have a facility to run per-extension code
1397dnl after the thread_safety decision was done
1398if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
1399  CPPFLAGS="$CPPFLAGS -DTHREAD=1"
1400fi
1401
1402ZEND_EXT_TYPE="zend_extension"
1403PHP_SUBST(ZEND_EXT_TYPE)
1404
1405dnl
1406dnl Libtool creation
1407dnl
1408
1409PHP_HELP_SEPARATOR([Libtool:])
1410PHP_CONFIGURE_PART(Configuring libtool)
1411
1412LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
1413
1414dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6.
1415dnl This hack works around it. Ugly.
1416case $host_alias in
1417*darwin9*|*darwin10*)
1418  ac_cv_exeext=
1419  ;;
1420esac
1421
1422dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX).
1423dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler.
1424AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
1425  undefine([AC_PROG_CXX])
1426  AC_DEFUN([AC_PROG_CXX], [])
1427  undefine([AC_PROG_CXXCPP])
1428  AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
1429])
1430AC_PROG_LIBTOOL
1431
1432PHP_SET_LIBTOOL_VARIABLE([--silent])
1433
1434dnl libtool 1.4.3 needs this.
1435PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps])
1436
1437test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
1438test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
1439SHARED_LIBTOOL='$(LIBTOOL)'
1440
1441CC=$old_CC
1442
1443PHP_CONFIGURE_PART(Generating files)
1444
1445CXXFLAGS_CLEAN=$CXXFLAGS
1446CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
1447CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
1448INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
1449CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"
1450
1451#if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
1452#  pharcmd=pharcmd
1453#  pharcmd_install=install-pharcmd
1454#else
1455  pharcmd=
1456  pharcmd_install=
1457#fi;
1458
1459all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd"
1460install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install"
1461
1462PHP_SUBST(all_targets)
1463PHP_SUBST(install_targets)
1464PHP_SUBST(install_binary_targets)
1465
1466PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
1467
1468PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1469
1470PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
1471       fopen_wrappers.c alloca.c  php_scandir.c \
1472       php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
1473       strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
1474       network.c php_open_temporary_file.c \
1475       output.c getopt.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1476
1477PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no)
1478
1479PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
1480       plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c \
1481       glob_wrapper.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1482
1483PHP_ADD_SOURCES(/main, internal_functions.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, sapi)
1484
1485case $host_alias in
1486  *netware*)
1487    PHP_ADD_BUILD_DIR(win32)
1488    PHP_ADD_BUILD_DIR(netware)
1489    ;;
1490  *)
1491    PHP_ADD_SOURCES_X(/main, internal_functions_cli.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_BINARY_OBJS)
1492    ;;
1493esac
1494
1495PHP_ADD_SOURCES(Zend, \
1496    zend_language_parser.c zend_language_scanner.c \
1497    zend_ini_parser.c zend_ini_scanner.c \
1498    zend_alloc.c zend_compile.c zend_constants.c zend_dtrace.c \
1499    zend_execute_API.c zend_highlight.c zend_llist.c \
1500    zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
1501    zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
1502    zend_list.c zend_builtin_functions.c zend_sprintf.c \
1503    zend_ini.c zend_sort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
1504    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
1505    zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
1506    zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
1507    zend_default_classes.c zend_inheritance.c zend_smart_str.c, \
1508        -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1509
1510dnl Selectively disable optimization due to high RAM usage during
1511dnl compiling the executor.
1512if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
1513  flag=-O0
1514else
1515  flag=
1516fi
1517
1518PHP_ADD_SOURCES_X(Zend, zend_execute.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,PHP_GLOBAL_OBJS,,$flag)
1519
1520PHP_ADD_BUILD_DIR(main main/streams)
1521PHP_ADD_BUILD_DIR(TSRM)
1522PHP_ADD_BUILD_DIR(Zend)
1523
1524PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
1525PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend)
1526PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
1527
1528PHP_GEN_BUILD_DIRS
1529PHP_GEN_GLOBAL_MAKEFILE
1530
1531AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
1532
1533$php_shtool mkdir -p pear/scripts
1534$php_shtool mkdir -p scripts
1535$php_shtool mkdir -p scripts/man1
1536
1537ALL_OUTPUT_FILES="php7.spec main/build-defs.h \
1538scripts/phpize scripts/man1/phpize.1 \
1539scripts/php-config scripts/man1/php-config.1 \
1540$PHP_OUTPUT_FILES"
1541
1542dnl
1543dnl Check for unknown configure options
1544dnl
1545PHP_CHECK_CONFIGURE_OPTIONS
1546
1547dnl
1548dnl Generate build files
1549dnl
1550AC_OUTPUT($ALL_OUTPUT_FILES, [], [
1551
1552if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then
1553  REDO_ALL=yes
1554fi
1555
1556################################################################
1557# Create configuration headers
1558#
1559
1560test -d TSRM || $php_shtool mkdir TSRM
1561echo '#include <../main/php_config.h>' > TSRM/tsrm_config.h
1562
1563test -d Zend || $php_shtool mkdir Zend
1564
1565cat >Zend/zend_config.h <<FEO
1566#include <../main/php_config.h>
1567#if defined(APACHE) && defined(PHP_API_VERSION)
1568#undef HAVE_DLFCN_H
1569#endif
1570FEO
1571
1572# run this only when generating all the files?
1573if test -n "\$REDO_ALL"; then
1574  # Hacking while airborne considered harmful.
1575  #
1576  echo "creating main/internal_functions.c"
1577  extensions="$EXT_STATIC"
1578dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
1579  sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
1580
1581  echo "creating main/internal_functions_cli.c"
1582  cli_extensions="$EXT_CLI_STATIC"
1583  sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$cli_extensions > main/internal_functions_cli.c
1584
1585  if test "$UNAME" = "FreeBSD" && test "$PHP_SAPI" = "apache2filter" && test "$TSRM_PTH" != "pth-config" ; then
1586    echo "+--------------------------------------------------------------------+"
1587    echo "|                        *** WARNING ***                             |"
1588    echo "|                                                                    |"
1589    echo "| In order to build PHP as a Apache2 module on FreeBSD, you have to  |"
1590    echo "| add  --with-tsrm-pth to your ./configure line. Therefore you need  |"
1591    echo "| to install gnu-pth from /usr/ports/devel/pth.                      |"
1592  fi
1593
1594  if test -n "$PHP_APXS_BROKEN"; then
1595    echo "+--------------------------------------------------------------------+"
1596    echo "| WARNING: Your $APXS script is most likely broken."
1597    echo "|                                                                    |"
1598    echo "| Please go read http://www.php.net/faq.build#faq.build.apxs         |"
1599    echo "| and make the changes described there and try again.                |"
1600  fi
1601
1602  if test -n "$DEBUG_LOG"; then
1603    rm -f config.cache
1604cat <<X
1605+--------------------------------------------------------------------+
1606|                       *** ATTENTION ***                            |
1607|                                                                    |
1608| Something is likely to be messed up here, because the configure    |
1609| script was not able to detect a simple feature on your platform.   |
1610| This is often caused by incorrect configuration parameters. Please |
1611| see the file debug.log for error messages.                         |
1612|                                                                    |
1613| If you are unable to fix this, send the file debug.log to the      |
1614| php-install@lists.php.net mailing list and include appropriate      |
1615| information about your setup.                                      |
1616X
1617  fi
1618
1619    if test "$PHP_SAPI" = "apache2handler" || test "$PHP_SAPI" = "apache2filter"; then
1620      if test "$APACHE_VERSION" -ge 2004001; then
1621        if test -z "$APACHE_THREADED_MPM"; then
1622cat <<X
1623+--------------------------------------------------------------------+
1624|                        *** WARNING ***                             |
1625|                                                                    |
1626| You have built PHP for Apache's current non-threaded MPM.          |
1627| If you change Apache to use a threaded MPM you must reconfigure    |
1628| PHP with --enable-maintainer-zts                                   |
1629X
1630        fi
1631      fi
1632    fi
1633
1634  # Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
1635  if test "$PHP_OCI8" != "no"; then
1636    if test "$PHP_SAPI" = "apache"; then
1637      if test `uname` = "Linux"; then
1638cat <<X
1639+--------------------------------------------------------------------+
1640|                        *** WARNING ***                             |
1641|                                                                    |
1642| Please check that your Apache (httpd) is linked with libpthread.   |
1643| If not, you have to recompile Apache with pthread. For more        |
1644| details, see this page: http://www.php.net/manual/ref.oci8.php     |
1645X
1646      fi
1647    fi
1648
1649    if test "$PHP_SIGCHILD" != "yes"; then
1650      if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
1651cat <<X
1652+--------------------------------------------------------------------+
1653| Notice:                                                            |
1654| If you encounter <defunc> processes when using a local Oracle      |
1655| database, set the value BEQUEATH_DETACH=YES in Oracle Net's        |
1656| sqlnet.ora file on the PHP host, or set the environment variable   |
1657| BEQUEATH_DETACH to YES before starting Apache.  If the problem     |
1658| still occurs, then recompile PHP and specify --enable-sigchild     |
1659| when configuring.                                                  |
1660X
1661      fi
1662    fi
1663  fi
1664
1665cat <<X
1666+--------------------------------------------------------------------+
1667| License:                                                           |
1668| This software is subject to the PHP License, available in this     |
1669| distribution in the file LICENSE.  By continuing this installation |
1670| process, you are bound by the terms of this license agreement.     |
1671| If you do not agree with the terms of this license, you must abort |
1672| the installation process at this point.                            |
1673+--------------------------------------------------------------------+
1674
1675Thank you for using PHP.
1676
1677X
1678
1679  # Output unknown configure options
1680  if test "$PHP_UNKNOWN_CONFIGURE_OPTIONS"; then
1681    echo "Notice: Following unknown configure options were used:
1682$PHP_UNKNOWN_CONFIGURE_OPTIONS
1683
1684Check '[$]0 --help' for available options
1685"
1686  fi
1687
1688fi
1689])
1690
1691dnl ## Local Variables:
1692dnl ## tab-width: 4
1693dnl ## End:
Note: See TracBrowser for help on using the repository browser.