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