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

Last change on this file since 31878 was 31878, checked in by brainslayer, 3 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_CHECK_FUNC(dlopen, dl)
457if test "$ac_cv_func_dlopen" = "yes"; then
458  AC_DEFINE(HAVE_LIBDL, 1, [ ])
459fi
460AC_CHECK_LIB(m, sin)
461
462dnl Check for inet_aton
463dnl in -lc, -lbind and -lresolv
464PHP_CHECK_FUNC(inet_aton, resolv, bind)
465
466dnl Then headers.
467dnl -------------------------------------------------------------------------
468
469dnl Checks for header files.
470AC_HEADER_STDC
471AC_HEADER_DIRENT
472
473dnl QNX requires unix.h to allow functions in libunix to work properly
474AC_CHECK_HEADERS([ \
475inttypes.h \
476stdint.h \
477dirent.h \
478ApplicationServices/ApplicationServices.h \
479sys/param.h \
480sys/types.h \
481sys/time.h \
482netinet/in.h \
483alloca.h \
484arpa/inet.h \
485arpa/nameser.h \
486assert.h \
487crypt.h \
488dns.h \
489fcntl.h \
490grp.h \
491ieeefp.h \
492langinfo.h \
493limits.h \
494locale.h \
495monetary.h \
496netdb.h \
497pwd.h \
498resolv.h \
499signal.h \
500stdarg.h \
501stdlib.h \
502string.h \
503syslog.h \
504sysexits.h \
505sys/ioctl.h \
506sys/file.h \
507sys/mman.h \
508sys/mount.h \
509sys/poll.h \
510sys/resource.h \
511sys/select.h \
512sys/socket.h \
513sys/stat.h \
514sys/statfs.h \
515sys/statvfs.h \
516sys/vfs.h \
517sys/sysexits.h \
518sys/varargs.h \
519sys/wait.h \
520sys/loadavg.h \
521termios.h \
522unistd.h \
523unix.h \
524utime.h \
525sys/utsname.h \
526sys/ipc.h \
527dlfcn.h \
528assert.h
529],[],[],[
530#ifdef HAVE_SYS_PARAM_H
531#include <sys/param.h>
532#endif
533#ifdef HAVE_SYS_TYPES_H
534#include <sys/types.h>
535#endif
536#ifdef HAVE_SYS_TIME_H
537#include <sys/time.h>
538#endif
539#ifdef HAVE_NETINET_IN_H
540#include <netinet/in.h>
541#endif
542#ifdef HAVE_ARPA_NAMESER_H
543#include <arpa/nameser.h>
544#endif
545])
546
547PHP_FOPENCOOKIE
548PHP_BROKEN_GETCWD
549PHP_BROKEN_GLIBC_FOPEN_APPEND
550
551dnl Checks for typedefs, structures, and compiler characteristics.
552dnl -------------------------------------------------------------------------
553
554AC_STRUCT_TM
555AC_STRUCT_TIMEZONE
556
557PHP_MISSING_TIME_R_DECL
558PHP_MISSING_FCLOSE_DECL
559
560PHP_TM_GMTOFF
561PHP_STRUCT_FLOCK
562PHP_SOCKLEN_T
563
564AC_CHECK_SIZEOF(size_t, 8)
565AC_CHECK_SIZEOF(long long, 8)
566AC_CHECK_SIZEOF(long long int, 8)
567AC_CHECK_SIZEOF(long, 8)
568AC_CHECK_SIZEOF(int, 4)
569
570dnl These are defined elsewhere than stdio.h
571PHP_CHECK_SIZEOF(intmax_t, 0)
572PHP_CHECK_SIZEOF(ssize_t, 8)
573PHP_CHECK_SIZEOF(ptrdiff_t, 8)
574
575dnl Check stdint types (must be after header check)
576PHP_CHECK_STDINT_TYPES
577
578dnl Check __builtin_expect
579PHP_CHECK_BUILTIN_EXPECT
580dnl Check __builtin_clz
581PHP_CHECK_BUILTIN_CLZ
582dnl Check __builtin_ctzl
583PHP_CHECK_BUILTIN_CTZL
584dnl Check __builtin_ctzll
585PHP_CHECK_BUILTIN_CTZLL
586
587dnl Check for members of the stat structure
588AC_STRUCT_ST_BLKSIZE
589dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
590dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
591if test "`uname -s 2>/dev/null`" != "QNX"; then
592  AC_STRUCT_ST_BLOCKS
593else
594  AC_MSG_WARN([warnings level for cc set to 0])
595  WARNING_LEVEL=0
596fi
597AC_STRUCT_ST_RDEV
598
599dnl Checks for types
600AC_TYPE_SIZE_T
601AC_TYPE_UID_T
602
603dnl Checks for sockaddr_storage and sockaddr.sa_len
604PHP_SOCKADDR_CHECKS
605
606dnl Check for IPv6 support
607AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
608[AC_TRY_LINK([ #include <sys/types.h>
609#include <sys/socket.h>
610#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
611  [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
612
613dnl Checks for library functions.
614dnl -------------------------------------------------------------------------
615
616AC_FUNC_VPRINTF
617AC_CHECK_FUNCS(
618alphasort \
619asctime_r \
620chroot \
621ctime_r \
622cuserid \
623crypt \
624flock \
625ftok \
626funopen \
627gai_strerror \
628gcvt \
629getloadavg \
630getlogin \
631getprotobyname \
632getprotobynumber \
633getservbyname \
634getservbyport \
635gethostname \
636getrusage \
637gettimeofday \
638gmtime_r \
639getpwnam_r \
640getgrnam_r \
641getpwuid_r \
642grantpt \
643inet_ntoa \
644inet_ntop \
645inet_pton \
646isascii \
647link \
648localtime_r \
649lockf \
650lchown \
651lrand48 \
652memcpy \
653memmove \
654mkstemp \
655mmap \
656nl_langinfo \
657perror \
658poll \
659ptsname \
660putenv \
661realpath \
662random \
663rand_r \
664scandir \
665setitimer \
666setlocale \
667localeconv \
668setenv \
669setpgid \
670setsockopt \
671setvbuf \
672shutdown \
673sin \
674snprintf \
675srand48 \
676srandom \
677statfs \
678statvfs \
679std_syslog \
680strcasecmp \
681strcoll \
682strdup \
683strerror \
684strftime \
685strnlen \
686strptime \
687strstr \
688strtok_r \
689symlink \
690tempnam \
691tzset \
692unlockpt \
693unsetenv \
694usleep \
695utime \
696vsnprintf \
697vasprintf \
698asprintf \
699nanosleep \
700)
701
702dnl Some systems (like OpenSolaris) do not have nanosleep in libc
703PHP_CHECK_FUNC_LIB(nanosleep, rt)
704
705dnl Check for getaddrinfo, should be a better way, but...
706dnl Also check for working getaddrinfo
707AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
708[AC_TRY_LINK([#include <netdb.h>],
709                [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
710  AC_TRY_RUN([
711#include <netdb.h>
712#include <sys/types.h>
713#ifndef AF_INET
714# include <sys/socket.h>
715#endif
716int main(void) {
717  struct addrinfo *ai, *pai, hints;
718
719  memset(&hints, 0, sizeof(hints));
720  hints.ai_flags = AI_NUMERICHOST;
721
722  if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
723    exit(1);
724  }
725
726  if (ai == 0) {
727    exit(1);
728  }
729
730  pai = ai;
731 
732  while (pai) {
733    if (pai->ai_family != AF_INET) {
734      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
735      exit(1);
736    }
737    if (pai->ai_addr->sa_family != AF_INET) {
738      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
739      exit(1);
740    }
741    pai = pai->ai_next;
742  }
743  freeaddrinfo(ai);
744  exit(0);
745}
746  ],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no, ac_cv_func_getaddrinfo=no),
747ac_cv_func_getaddrinfo=no)])
748if test "$ac_cv_func_getaddrinfo" = yes; then
749  AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
750fi
751
752dnl Check for the __sync_fetch_and_add builtin
753AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
754[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)])
755if test "$ac_cv_func_sync_fetch_and_add" = yes; then
756  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
757fi
758
759AC_REPLACE_FUNCS(strlcat strlcpy getopt)
760AC_FUNC_UTIME_NULL
761AC_FUNC_ALLOCA
762dnl PHP_AC_BROKEN_SPRINTF
763dnl PHP_AC_BROKEN_SNPRINTF
764PHP_DECLARED_TIMEZONE
765PHP_TIME_R_TYPE
766PHP_READDIR_R_TYPE
767PHP_CHECK_IN_ADDR_T
768
769AC_CHECK_FUNCS(crypt_r, [ php_crypt_r="1" ], [ php_crypt_r="0" ])
770if test "x$php_crypt_r" = "x1"; then
771  PHP_CRYPT_R_STYLE
772fi
773
774dnl General settings.
775dnl -------------------------------------------------------------------------
776PHP_CONFIGURE_PART(General settings)
777
778PHP_HELP_SEPARATOR([General settings:])
779
780PHP_ARG_ENABLE(gcov,  whether to include gcov symbols,
781[  --enable-gcov           Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!], no, no)
782
783if test "$PHP_GCOV" = "yes"; then
784
785  if test "$GCC" != "yes"; then
786    AC_MSG_ERROR([GCC is required for --enable-gcov])
787  fi
788 
789  dnl Check if ccache is being used
790  case `$php_shtool path $CC` in
791    *ccache*[)] gcc_ccache=yes;;
792    *[)] gcc_ccache=no;;
793  esac
794
795  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
796    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
797  fi
798 
799  dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison)
800  ltp_version_min="105"
801  dnl non-working versions, e.g. "1.8 1.18";
802  dnl remove "none" when introducing the first incompatible LTP version and
803  dnl separate any following additions by spaces
804  ltp_version_exclude="1.8"
805
806  AC_CHECK_PROG(LTP, lcov, lcov)
807  AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
808  PHP_SUBST(LTP)
809  PHP_SUBST(LTP_GENHTML)
810
811  if test "$LTP"; then
812    AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
813      php_cv_ltp_version=invalid
814      ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z`
815      if test -n "$ltp_version_vars"; then
816        set $ltp_version_vars
817        ltp_version="${1}.${2}"
818        ltp_version_num="`expr ${1} \* 100 + ${2}`"
819        if test $ltp_version_num -ge $ltp_version_min; then
820          php_cv_ltp_version="$ltp_version (ok)"
821          for ltp_check_version in $ltp_version_exclude; do
822            if test "$ltp_version" = "$ltp_check_version"; then
823              php_cv_ltp_version=invalid
824              break
825            fi
826          done
827        fi
828      fi
829    ])
830  else
831    ltp_msg="To enable code coverage reporting you must have LTP installed"     
832    AC_MSG_ERROR([$ltp_msg])
833  fi
834
835  case $php_cv_ltp_version in
836    ""|invalid[)]
837      ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)."
838      AC_MSG_ERROR([$ltp_msg])
839      LTP="exit 0;"
840      ;;
841  esac
842
843  if test -z "$LTP_GENHTML"; then
844    AC_MSG_ERROR([Could not find genhtml from the LTP package])
845  fi
846
847  AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
848  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.gcov, $abs_srcdir)
849
850  dnl Remove all optimization flags from CFLAGS
851  changequote({,})
852  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
853  CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
854  changequote([,])
855
856  dnl Add the special gcc flags
857  CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
858  CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
859fi
860
861PHP_ARG_ENABLE(debug, whether to include debugging symbols,
862[  --enable-debug          Compile with debugging symbols], no, no)
863
864if test "$PHP_DEBUG" = "yes"; then
865  PHP_DEBUG=1
866  ZEND_DEBUG=yes
867  changequote({,})
868  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
869  CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
870  changequote([,])
871  dnl add -O0 only if GCC or ICC is used
872  if test "$GCC" = "yes" || test "$ICC" = "yes"; then
873    CFLAGS="$CFLAGS -O0"
874    CXXFLAGS="$CXXFLAGS -g -O0"
875  fi
876  if test "$SUNCC" = "yes"; then
877    if test -n "$auto_cflags"; then
878      CFLAGS="-g"
879      CXXFLAGS="-g"
880    else
881      CFLAGS="$CFLAGS -g"
882      CXXFLAGS="$CFLAGS -g"
883    fi
884  fi
885else
886  PHP_DEBUG=0
887  ZEND_DEBUG=no
888fi
889
890PHP_ARG_WITH(layout, layout of installed files,
891[  --with-layout=TYPE      Set how installed files will be laid out.  Type can
892                          be either PHP or GNU @<:@PHP@:>@], PHP, no)
893
894case $PHP_LAYOUT in
895  GNU)
896    oldstyleextdir=no
897    ;;
898  *)
899    oldstyleextdir=yes
900    ;;
901esac
902
903PHP_ARG_WITH(config-file-path, path to configuration file,
904[  --with-config-file-path=PATH
905                          Set the path in which to look for php.ini @<:@PREFIX/lib@:>@], DEFAULT, no)
906
907if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
908  case $PHP_LAYOUT in
909    GNU)
910      PHP_CONFIG_FILE_PATH=$sysconfdir
911      ;;
912    *)
913      PHP_CONFIG_FILE_PATH=$libdir
914      ;;
915  esac
916fi
917
918AC_MSG_CHECKING([where to scan for configuration files])
919PHP_ARG_WITH(config-file-scan-dir,,
920[  --with-config-file-scan-dir=PATH
921                          Set the path where to scan for configuration files], DEFAULT, no)
922if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
923  PHP_CONFIG_FILE_SCAN_DIR=
924fi
925AC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR])
926
927test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
928
929PHP_ARG_ENABLE(sigchild, whether to enable PHP's own SIGCHLD handler,
930[  --enable-sigchild       Enable PHP's own SIGCHLD handler], no, no)
931
932if test "$PHP_SIGCHILD" = "yes"; then
933  AC_DEFINE(PHP_SIGCHILD, 1, [ ])
934else
935  AC_DEFINE(PHP_SIGCHILD, 0, [ ])
936fi
937
938PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
939[  --enable-libgcc         Enable explicitly linking against libgcc], no, no)
940
941if test "$PHP_LIBGCC" = "yes"; then
942  PHP_LIBGCC_LIBPATH(gcc)
943  if test -z "$libgcc_libpath"; then
944    AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path])
945  fi
946  PHP_ADD_LIBPATH($libgcc_libpath)
947  PHP_ADD_LIBRARY(gcc, yes)
948fi
949
950PHP_ARG_ENABLE(short-tags, whether to enable short tags by default,
951[  --disable-short-tags    Disable the short-form <? start tag by default], yes, no)
952
953if test "$PHP_SHORT_TAGS" = "yes"; then
954  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "1", [ ])
955else
956  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "0", [ ])
957fi
958
959PHP_ARG_ENABLE(dmalloc, whether to enable dmalloc,
960[  --enable-dmalloc        Enable dmalloc], no, no)
961
962if test "$PHP_DMALLOC" = "yes"; then
963  AC_CHECK_LIB(dmalloc, dmalloc_error, [
964    PHP_ADD_LIBRARY(dmalloc)
965    AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
966    CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
967  ], [
968    AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.])
969  ])
970fi
971
972PHP_ARG_ENABLE(ipv6, whether to enable IPv6 support,
973[  --disable-ipv6          Disable IPv6 support], yes, no)
974
975if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
976  AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
977fi
978
979dnl ##
980dnl ## DTRACE CHECKS
981dnl ## Note: this has to be done after SAPI configuration!
982dnl ##
983PHP_ARG_ENABLE(dtrace, whether to enable DTrace support,
984[  --enable-dtrace         Enable DTrace support], no, no)
985
986if test "$PHP_DTRACE" = "yes"; then
987  AC_CHECK_HEADERS([sys/sdt.h], [
988    PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \
989      Zend/zend_execute.c Zend/zend_exceptions.c \
990      Zend/zend_dtrace.c Zend/zend.c])
991    AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
992    PHP_SUBST(PHP_DTRACE_OBJS)
993  ], [
994    AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support])
995  ])
996fi
997
998AC_MSG_CHECKING([how big to make fd sets])
999PHP_ARG_ENABLE(fd-setsize,,
1000[  --enable-fd-setsize     Set size of descriptor sets], no, no)
1001
1002if test "$PHP_FD_SETSIZE" != "no"; then
1003  if test "0$PHP_FD_SETSIZE" -gt 0 2>/dev/null; then
1004    CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$PHP_FD_SETSIZE"
1005    AC_MSG_RESULT([using $PHP_FD_SETSIZE])
1006  else
1007    AC_MSG_ERROR([Invalid value passed to --enable-fd-setsize!])
1008  fi
1009else
1010  AC_MSG_RESULT([using system default])
1011fi
1012
1013dnl Extension configuration.
1014dnl -------------------------------------------------------------------------
1015
1016PHP_HELP_SEPARATOR([Extensions:
1017
1018  --with-EXTENSION=[shared[,PATH]]
1019 
1020    NOTE: Not all extensions can be build as 'shared'.
1021
1022    Example: --with-foobar=shared,/usr/local/foobar/
1023
1024      o Builds the foobar extension as shared extension.
1025      o foobar package install prefix is /usr/local/foobar/
1026])
1027
1028PHP_CONFIGURE_PART(Configuring extensions)
1029
1030dnl
1031dnl Check if all enabled by default extensions should be disabled
1032dnl
1033
1034AC_ARG_ENABLE(all,
1035[  --disable-all           Disable all extensions which are enabled by default
1036], [
1037  PHP_ENABLE_ALL=$enableval
1038])
1039
1040# reading config stubs
1041esyscmd(./build/config-stubs ext)
1042
1043dnl Extensions post-config
1044dnl -------------------------------------------------------------------------
1045
1046enable_shared=yes
1047enable_static=yes
1048
1049case $php_sapi_module in
1050  shared[)]
1051    enable_static=no
1052    case $with_pic in
1053      yes)
1054        standard_libtool_flag='-prefer-pic'
1055        ;;
1056      no)
1057        standard_libtool_flag='-prefer-non-pic'
1058        ;;
1059    esac
1060    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
1061    ;;
1062  *[)]
1063    standard_libtool_flag='-prefer-non-pic -static'
1064    if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then
1065      enable_shared=no
1066    fi
1067    ;;
1068esac
1069
1070EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
1071
1072dnl this has to be here to prevent the openssl crypt() from
1073dnl overriding the system provided crypt().
1074if test "$ac_cv_lib_crypt_crypt" = "yes"; then
1075  EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
1076fi
1077
1078unset LIBS LDFLAGS
1079
1080dnl PEAR
1081dnl -------------------------------------------------------------------------
1082
1083PHP_HELP_SEPARATOR([PEAR:])
1084PHP_CONFIGURE_PART(Configuring PEAR)
1085
1086# compatibility
1087if test -z "$with_pear" && test "$enable_pear" = "no"; then
1088  with_pear=no
1089fi
1090
1091# If CLI is disabled -> disable PEAR
1092if test "$PHP_CLI" = "no"; then
1093  with_pear=no
1094fi
1095
1096PHP_ARG_WITH(pear, [whether to install PEAR],
1097[  --with-pear=DIR         Install PEAR in DIR @<:@PREFIX/lib/php@:>@
1098  --without-pear          Do not install PEAR], DEFAULT, yes)
1099
1100if test "$PHP_PEAR" != "no"; then
1101
1102  dnl
1103  dnl PEAR dependancies
1104  dnl
1105  if test "$PHP_XML" = "no"; then
1106    pear_error_msg="$pear_error_msg
1107                    PEAR requires XML to be enabled.     Add --enable-xml to the configure line. (or --without-pear)"
1108  fi
1109
1110dnl
1111dnl  if test "$PHP_XMLRPC" = "no"; then
1112dnl    pear_error_msg="$pear_error_msg
1113dnl                    PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
1114dnl  fi
1115dnl
1116
1117  if test "$pear_error_msg"; then
1118    AC_MSG_ERROR([$pear_error_msg])
1119  fi
1120
1121  install_pear="install-pear"
1122  PEAR_INSTALLDIR=$PHP_PEAR
1123
1124  if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then
1125    case $PHP_LAYOUT in
1126      GNU) PEAR_INSTALLDIR=$datadir/pear;;
1127      *)   PEAR_INSTALLDIR=$libdir/php;;
1128    esac
1129  fi
1130
1131  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
1132fi
1133
1134
1135dnl Configuring Zend and TSRM.
1136dnl -------------------------------------------------------------------------
1137
1138PHP_HELP_SEPARATOR([Zend:])
1139PHP_CONFIGURE_PART(Configuring Zend)
1140
1141LIBZEND_BASIC_CHECKS
1142LIBZEND_DLSYM_CHECK
1143LIBZEND_OTHER_CHECKS
1144
1145if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
1146  AC_DEFINE(ZTS,1,[ ])
1147  PHP_THREAD_SAFETY=yes
1148else
1149  PHP_THREAD_SAFETY=no
1150fi
1151
1152INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
1153INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
1154
1155if test "$abs_srcdir" != "$abs_builddir"; then
1156  INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
1157  INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
1158fi
1159
1160ZEND_EXTRA_LIBS="$LIBS"
1161unset LIBS LDFLAGS
1162
1163PHP_HELP_SEPARATOR([TSRM:])
1164PHP_CONFIGURE_PART(Configuring TSRM)
1165TSRM_BASIC_CHECKS
1166if test "$PHP_THREAD_SAFETY" = "yes"; then
1167  TSRM_THREADS_CHECKS
1168fi
1169
1170EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
1171EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
1172EXTRA_LIBS="$EXTRA_LIBS $LIBS"
1173unset LIBS LDFLAGS
1174
1175test "$prefix" = "NONE" && prefix=/usr/local
1176test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
1177test "$program_prefix" = "NONE" && program_prefix=
1178test "$program_suffix" = "NONE" && program_suffix=
1179
1180case $libdir in
1181  '${exec_prefix}/lib')
1182    libdir=$libdir/php
1183    ;;
1184esac
1185case `eval echo $datadir` in
1186  '${prefix}/share')
1187    datadir=$datadir/php
1188    ;;
1189esac
1190
1191phplibdir=`pwd`/modules
1192$php_shtool mkdir -p $phplibdir
1193phptempdir=`pwd`/libs
1194
1195old_exec_prefix=$exec_prefix
1196old_libdir=$libdir
1197old_datadir=$datadir
1198exec_prefix=`eval echo $exec_prefix`
1199libdir=`eval echo $libdir`
1200datadir=`eval eval echo $datadir`
1201
1202dnl Build extension directory path
1203
1204ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO //'`
1205
1206if test -z "$EXTENSION_DIR"; then
1207  extbasedir=$ZEND_MODULE_API_NO
1208  if test "$oldstyleextdir" = "yes"; then
1209    if test "$PHP_DEBUG" = "1"; then
1210      part1=debug
1211    else
1212      part1=no-debug
1213    fi
1214    if test "$enable_maintainer_zts" = "yes"; then
1215      part2=zts
1216    else
1217      part2=non-zts
1218    fi
1219    extbasedir=$part1-$part2-$extbasedir
1220    EXTENSION_DIR=$libdir/extensions/$extbasedir
1221  else
1222    if test "$enable_maintainer_zts" = "yes"; then
1223      extbasedir=$extbasedir-zts
1224    fi
1225   
1226    if test "$PHP_DEBUG" = "1"; then
1227      extbasedir=$extbasedir-debug
1228    fi
1229    EXTENSION_DIR=$libdir/$extbasedir
1230  fi
1231fi
1232
1233case $PHP_LAYOUT in
1234  GNU)
1235    datarootdir=$prefix/share
1236    ;;
1237  *)
1238    datarootdir=$prefix/php
1239    ;;
1240esac
1241
1242dnl Expand all directory names for use in macros/constants
1243EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
1244EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
1245EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
1246EXPANDED_BINDIR=`eval echo $bindir`
1247EXPANDED_SBINDIR=`eval echo $sbindir`
1248EXPANDED_MANDIR=`eval echo $mandir`
1249EXPANDED_LIBDIR=$libdir
1250EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
1251EXPANDED_DATADIR=$datadir
1252EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
1253EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
1254INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
1255
1256exec_prefix=$old_exec_prefix
1257libdir=$old_libdir
1258datadir=$old_datadir
1259
1260AC_SUBST(INCLUDE_PATH)
1261AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
1262AC_SUBST(EXPANDED_EXTENSION_DIR)
1263AC_SUBST(EXPANDED_BINDIR)
1264AC_SUBST(EXPANDED_SBINDIR)
1265AC_SUBST(EXPANDED_MANDIR)
1266AC_SUBST(EXPANDED_LIBDIR)
1267AC_SUBST(EXPANDED_DATADIR)
1268AC_SUBST(EXPANDED_SYSCONFDIR)
1269AC_SUBST(EXPANDED_LOCALSTATEDIR)
1270AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
1271AC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR)
1272
1273if test -n "$php_ldflags_add_usr_lib"; then
1274  PHP_RPATHS="$PHP_RPATHS /usr/lib"
1275fi
1276
1277PHP_UTILIZE_RPATHS
1278
1279if test -z "$php_ldflags_add_usr_lib"; then
1280  PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
1281  PHP_REMOVE_USR_LIB(LDFLAGS)
1282fi
1283
1284EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
1285EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
1286
1287PHP_BUILD_DATE=`date '+%Y-%m-%d'`
1288AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
1289
1290case $host_alias in
1291*netware*)
1292  PHP_OS="NetWare"
1293  PHP_UNAME="NetWare"
1294  AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host])
1295  AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host])
1296  ;;
1297*)
1298  PHP_UNAME=`uname -a | xargs`
1299  AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
1300  PHP_OS=`uname | xargs`
1301  AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
1302  ;;
1303esac
1304
1305PHP_SUBST_OLD(PHP_INSTALLED_SAPIS)
1306
1307PHP_SUBST(PHP_EXECUTABLE)
1308
1309PHP_SUBST(PHP_FASTCGI_OBJS)
1310PHP_SUBST(PHP_SAPI_OBJS)
1311PHP_SUBST(PHP_BINARY_OBJS)
1312PHP_SUBST(PHP_GLOBAL_OBJS)
1313
1314PHP_SUBST(PHP_BINARIES)
1315PHP_SUBST(PHP_MODULES)
1316PHP_SUBST(PHP_ZEND_EX)
1317
1318PHP_SUBST(EXT_LIBS)
1319
1320PHP_SUBST_OLD(abs_builddir)
1321PHP_SUBST_OLD(abs_srcdir)
1322PHP_SUBST_OLD(php_abs_top_builddir)
1323PHP_SUBST_OLD(php_abs_top_srcdir)
1324
1325PHP_SUBST(bindir)
1326PHP_SUBST(sbindir)
1327PHP_SUBST(exec_prefix)
1328PHP_SUBST_OLD(program_prefix)
1329PHP_SUBST_OLD(program_suffix)
1330PHP_SUBST(includedir)
1331PHP_SUBST(libdir)
1332PHP_SUBST(mandir)
1333PHP_SUBST(phplibdir)
1334PHP_SUBST(phptempdir)
1335PHP_SUBST(prefix)
1336PHP_SUBST(localstatedir)
1337PHP_SUBST(datadir)
1338PHP_SUBST(datarootdir)
1339PHP_SUBST(sysconfdir)
1340
1341PHP_SUBST(EXEEXT)
1342PHP_SUBST(CC)
1343PHP_SUBST(CFLAGS)
1344PHP_SUBST(CFLAGS_CLEAN)
1345PHP_SUBST(CPP)
1346PHP_SUBST(CPPFLAGS)
1347PHP_SUBST(CXX)
1348PHP_SUBST(CXXFLAGS)
1349PHP_SUBST(CXXFLAGS_CLEAN)
1350PHP_SUBST_OLD(DEBUG_CFLAGS)
1351PHP_SUBST_OLD(EXTENSION_DIR)
1352PHP_SUBST_OLD(EXTRA_LDFLAGS)
1353PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM)
1354PHP_SUBST_OLD(EXTRA_LIBS)
1355PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
1356PHP_SUBST_OLD(INCLUDES)
1357PHP_SUBST_OLD(EXTRA_INCLUDES)
1358PHP_SUBST_OLD(INCLUDE_PATH)
1359PHP_SUBST_OLD(INSTALL_IT)
1360PHP_SUBST(LFLAGS)
1361PHP_SUBST(LIBTOOL)
1362PHP_SUBST(LN_S)
1363PHP_SUBST_OLD(NATIVE_RPATHS)
1364PHP_SUBST_OLD(PEAR_INSTALLDIR)
1365PHP_SUBST(PHP_BUILD_DATE)
1366PHP_SUBST_OLD(PHP_LDFLAGS)
1367PHP_SUBST_OLD(PHP_LIBS)
1368PHP_SUBST(OVERALL_TARGET)
1369PHP_SUBST(PHP_RPATHS)
1370PHP_SUBST(PHP_SAPI)
1371PHP_SUBST_OLD(PHP_VERSION)
1372PHP_SUBST_OLD(PHP_VERSION_ID)
1373PHP_SUBST(SHELL)
1374PHP_SUBST(SHARED_LIBTOOL)
1375PHP_SUBST(WARNING_LEVEL)
1376PHP_SUBST(PHP_FRAMEWORKS)
1377PHP_SUBST(PHP_FRAMEWORKPATH)
1378PHP_SUBST(INSTALL_HEADERS)
1379
1380old_CC=$CC
1381
1382if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
1383  CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
1384  INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
1385  cat >meta_ccld<<EOF
1386#! /bin/sh
1387exec $CC $ac_cv_pthreads_cflags \$@
1388EOF
1389  CC="$abs_builddir/meta_ccld"
1390  chmod +x meta_ccld
1391fi
1392
1393dnl This will go away, if we have a facility to run per-extension code
1394dnl after the thread_safety decision was done
1395if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
1396  CPPFLAGS="$CPPFLAGS -DTHREAD=1"
1397fi
1398
1399ZEND_EXT_TYPE="zend_extension"
1400PHP_SUBST(ZEND_EXT_TYPE)
1401
1402dnl
1403dnl Libtool creation
1404dnl
1405
1406PHP_HELP_SEPARATOR([Libtool:])
1407PHP_CONFIGURE_PART(Configuring libtool)
1408
1409LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS"
1410
1411dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6.
1412dnl This hack works around it. Ugly.
1413case $host_alias in
1414*darwin9*|*darwin10*)
1415  ac_cv_exeext=
1416  ;;
1417esac
1418
1419dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX).
1420dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler.
1421AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
1422  undefine([AC_PROG_CXX])
1423  AC_DEFUN([AC_PROG_CXX], [])
1424  undefine([AC_PROG_CXXCPP])
1425  AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
1426])
1427AC_PROG_LIBTOOL
1428
1429PHP_SET_LIBTOOL_VARIABLE([--silent])
1430
1431dnl libtool 1.4.3 needs this.
1432PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps])
1433
1434test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
1435test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
1436SHARED_LIBTOOL='$(LIBTOOL)'
1437
1438CC=$old_CC
1439
1440PHP_CONFIGURE_PART(Generating files)
1441
1442CXXFLAGS_CLEAN=$CXXFLAGS
1443CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
1444CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
1445INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
1446CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"
1447
1448if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
1449  pharcmd=pharcmd
1450  pharcmd_install=install-pharcmd
1451else
1452  pharcmd=
1453  pharcmd_install=
1454fi;
1455
1456all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd"
1457install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install"
1458
1459PHP_SUBST(all_targets)
1460PHP_SUBST(install_targets)
1461PHP_SUBST(install_binary_targets)
1462
1463PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
1464
1465PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1466
1467PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
1468       fopen_wrappers.c alloca.c  php_scandir.c \
1469       php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
1470       strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
1471       network.c php_open_temporary_file.c \
1472       output.c getopt.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1473
1474PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no)
1475
1476PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
1477       plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c \
1478       glob_wrapper.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1479
1480PHP_ADD_SOURCES(/main, internal_functions.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, sapi)
1481
1482case $host_alias in
1483  *netware*)
1484    PHP_ADD_BUILD_DIR(win32)
1485    PHP_ADD_BUILD_DIR(netware)
1486    ;;
1487  *)
1488    PHP_ADD_SOURCES_X(/main, internal_functions_cli.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_BINARY_OBJS)
1489    ;;
1490esac
1491
1492PHP_ADD_SOURCES(Zend, \
1493    zend_language_parser.c zend_language_scanner.c \
1494    zend_ini_parser.c zend_ini_scanner.c \
1495    zend_alloc.c zend_compile.c zend_constants.c zend_dtrace.c \
1496    zend_execute_API.c zend_highlight.c zend_llist.c \
1497    zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
1498    zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
1499    zend_list.c zend_builtin_functions.c zend_sprintf.c \
1500    zend_ini.c zend_sort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
1501    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
1502    zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
1503    zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
1504    zend_default_classes.c zend_inheritance.c zend_smart_str.c, \
1505        -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1506
1507dnl Selectively disable optimization due to high RAM usage during
1508dnl compiling the executor.
1509if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
1510  flag=-O0
1511else
1512  flag=
1513fi
1514
1515PHP_ADD_SOURCES_X(Zend, zend_execute.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,PHP_GLOBAL_OBJS,,$flag)
1516
1517PHP_ADD_BUILD_DIR(main main/streams)
1518PHP_ADD_BUILD_DIR(TSRM)
1519PHP_ADD_BUILD_DIR(Zend)
1520
1521PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
1522PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend)
1523PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
1524
1525PHP_GEN_BUILD_DIRS
1526PHP_GEN_GLOBAL_MAKEFILE
1527
1528AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
1529
1530$php_shtool mkdir -p pear/scripts
1531$php_shtool mkdir -p scripts
1532$php_shtool mkdir -p scripts/man1
1533
1534ALL_OUTPUT_FILES="php7.spec main/build-defs.h \
1535scripts/phpize scripts/man1/phpize.1 \
1536scripts/php-config scripts/man1/php-config.1 \
1537$PHP_OUTPUT_FILES"
1538
1539dnl
1540dnl Check for unknown configure options
1541dnl
1542PHP_CHECK_CONFIGURE_OPTIONS
1543
1544dnl
1545dnl Generate build files
1546dnl
1547AC_OUTPUT($ALL_OUTPUT_FILES, [], [
1548
1549if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then
1550  REDO_ALL=yes
1551fi
1552
1553################################################################
1554# Create configuration headers
1555#
1556
1557test -d TSRM || $php_shtool mkdir TSRM
1558echo '#include <../main/php_config.h>' > TSRM/tsrm_config.h
1559
1560test -d Zend || $php_shtool mkdir Zend
1561
1562cat >Zend/zend_config.h <<FEO
1563#include <../main/php_config.h>
1564#if defined(APACHE) && defined(PHP_API_VERSION)
1565#undef HAVE_DLFCN_H
1566#endif
1567FEO
1568
1569# run this only when generating all the files?
1570if test -n "\$REDO_ALL"; then
1571  # Hacking while airborne considered harmful.
1572  #
1573  echo "creating main/internal_functions.c"
1574  extensions="$EXT_STATIC"
1575dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
1576  sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
1577
1578  echo "creating main/internal_functions_cli.c"
1579  cli_extensions="$EXT_CLI_STATIC"
1580  sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$cli_extensions > main/internal_functions_cli.c
1581
1582  if test "$UNAME" = "FreeBSD" && test "$PHP_SAPI" = "apache2filter" && test "$TSRM_PTH" != "pth-config" ; then
1583    echo "+--------------------------------------------------------------------+"
1584    echo "|                        *** WARNING ***                             |"
1585    echo "|                                                                    |"
1586    echo "| In order to build PHP as a Apache2 module on FreeBSD, you have to  |"
1587    echo "| add  --with-tsrm-pth to your ./configure line. Therefore you need  |"
1588    echo "| to install gnu-pth from /usr/ports/devel/pth.                      |"
1589  fi
1590
1591  if test -n "$PHP_APXS_BROKEN"; then
1592    echo "+--------------------------------------------------------------------+"
1593    echo "| WARNING: Your $APXS script is most likely broken."
1594    echo "|                                                                    |"
1595    echo "| Please go read http://www.php.net/faq.build#faq.build.apxs         |"
1596    echo "| and make the changes described there and try again.                |"
1597  fi
1598
1599  if test -n "$DEBUG_LOG"; then
1600    rm -f config.cache
1601cat <<X
1602+--------------------------------------------------------------------+
1603|                       *** ATTENTION ***                            |
1604|                                                                    |
1605| Something is likely to be messed up here, because the configure    |
1606| script was not able to detect a simple feature on your platform.   |
1607| This is often caused by incorrect configuration parameters. Please |
1608| see the file debug.log for error messages.                         |
1609|                                                                    |
1610| If you are unable to fix this, send the file debug.log to the      |
1611| php-install@lists.php.net mailing list and include appropriate      |
1612| information about your setup.                                      |
1613X
1614  fi
1615
1616    if test "$PHP_SAPI" = "apache2handler" || test "$PHP_SAPI" = "apache2filter"; then
1617      if test "$APACHE_VERSION" -ge 2004001; then
1618        if test -z "$APACHE_THREADED_MPM"; then
1619cat <<X
1620+--------------------------------------------------------------------+
1621|                        *** WARNING ***                             |
1622|                                                                    |
1623| You have built PHP for Apache's current non-threaded MPM.          |
1624| If you change Apache to use a threaded MPM you must reconfigure    |
1625| PHP with --enable-maintainer-zts                                   |
1626X
1627        fi
1628      fi
1629    fi
1630
1631  # Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
1632  if test "$PHP_OCI8" != "no"; then
1633    if test "$PHP_SAPI" = "apache"; then
1634      if test `uname` = "Linux"; then
1635cat <<X
1636+--------------------------------------------------------------------+
1637|                        *** WARNING ***                             |
1638|                                                                    |
1639| Please check that your Apache (httpd) is linked with libpthread.   |
1640| If not, you have to recompile Apache with pthread. For more        |
1641| details, see this page: http://www.php.net/manual/ref.oci8.php     |
1642X
1643      fi
1644    fi
1645
1646    if test "$PHP_SIGCHILD" != "yes"; then
1647      if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
1648cat <<X
1649+--------------------------------------------------------------------+
1650| Notice:                                                            |
1651| If you encounter <defunc> processes when using a local Oracle      |
1652| database, set the value BEQUEATH_DETACH=YES in Oracle Net's        |
1653| sqlnet.ora file on the PHP host, or set the environment variable   |
1654| BEQUEATH_DETACH to YES before starting Apache.  If the problem     |
1655| still occurs, then recompile PHP and specify --enable-sigchild     |
1656| when configuring.                                                  |
1657X
1658      fi
1659    fi
1660  fi
1661
1662cat <<X
1663+--------------------------------------------------------------------+
1664| License:                                                           |
1665| This software is subject to the PHP License, available in this     |
1666| distribution in the file LICENSE.  By continuing this installation |
1667| process, you are bound by the terms of this license agreement.     |
1668| If you do not agree with the terms of this license, you must abort |
1669| the installation process at this point.                            |
1670+--------------------------------------------------------------------+
1671
1672Thank you for using PHP.
1673
1674X
1675
1676  # Output unknown configure options
1677  if test "$PHP_UNKNOWN_CONFIGURE_OPTIONS"; then
1678    echo "Notice: Following unknown configure options were used:
1679$PHP_UNKNOWN_CONFIGURE_OPTIONS
1680
1681Check '[$]0 --help' for available options
1682"
1683  fi
1684
1685fi
1686])
1687
1688dnl ## Local Variables:
1689dnl ## tab-width: 4
1690dnl ## End:
Note: See TracBrowser for help on using the repository browser.