xref: /PHP-8.1/configure.ac (revision fcbcf2f2)
1dnl Process this file with autoconf to produce a configure script.
2
3dnl Include external macro definitions before the AC_INIT to also remove
4dnl comments starting with # and empty newlines from the included files.
5dnl ----------------------------------------------------------------------------
6m4_include([build/ax_check_compile_flag.m4])
7m4_include([build/ax_func_which_gethostbyname_r.m4])
8m4_include([build/ax_gcc_func_attribute.m4])
9m4_include([build/libtool.m4])
10m4_include([build/php_cxx_compile_stdcxx.m4])
11m4_include([build/php.m4])
12m4_include([build/pkg.m4])
13m4_include([TSRM/threads.m4])
14m4_include([TSRM/tsrm.m4])
15
16dnl Basic autoconf initialization, generation of config.nice.
17dnl ----------------------------------------------------------------------------
18
19AC_PREREQ([2.68])
20AC_INIT([PHP],[8.1.31-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net])
21AC_CONFIG_SRCDIR([main/php_version.h])
22AC_CONFIG_AUX_DIR([build])
23AC_PRESERVE_HELP_ORDER
24
25PHP_CONFIG_NICE(config.nice)
26
27PHP_CANONICAL_HOST_TARGET
28
29AC_CONFIG_HEADERS([main/php_config.h])
30
31AH_TOP([
32#ifndef PHP_CONFIG_H
33#define PHP_CONFIG_H
34
35#if defined(__GNUC__) && __GNUC__ >= 4
36# define ZEND_API __attribute__ ((visibility("default")))
37# define ZEND_DLEXPORT __attribute__ ((visibility("default")))
38#else
39# define ZEND_API
40# define ZEND_DLEXPORT
41#endif
42
43#define ZEND_DLIMPORT
44])
45AH_BOTTOM([
46#include <stdlib.h>
47
48#ifdef HAVE_SYS_TYPES_H
49# include <sys/types.h>
50#endif
51
52#ifdef HAVE_SYS_SELECT_H
53#include <sys/select.h>
54#endif
55
56#include <string.h>
57
58#endif /* PHP_CONFIG_H */
59])
60
61ac_IFS=$IFS; IFS="."
62set $(echo AC_PACKAGE_VERSION | "${SED}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/')
63IFS=$ac_IFS
64PHP_MAJOR_VERSION=[$]1
65PHP_MINOR_VERSION=[$]2
66PHP_RELEASE_VERSION=[$]3
67PHP_EXTRA_VERSION=[$]4
68PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
69PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
70
71dnl Allow version values to be used in Makefile.
72PHP_SUBST(PHP_MAJOR_VERSION)
73PHP_SUBST(PHP_MINOR_VERSION)
74PHP_SUBST(PHP_RELEASE_VERSION)
75PHP_SUBST(PHP_EXTRA_VERSION)
76
77dnl Define where extension directories are located in the configure context.
78AC_DEFUN([PHP_EXT_BUILDDIR],[$config_m4_dir])dnl
79AC_DEFUN([PHP_EXT_DIR],[$config_m4_dir])dnl
80AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir/$config_m4_dir])dnl
81AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl
82
83dnl Setting up the PHP version based on the information above.
84dnl ----------------------------------------------------------------------------
85
86echo "/* automatically generated by configure */" > php_version.h.new
87echo "/* edit configure.ac to change version number */" >> php_version.h.new
88echo "#define PHP_MAJOR_VERSION $PHP_MAJOR_VERSION" >> php_version.h.new
89echo "#define PHP_MINOR_VERSION $PHP_MINOR_VERSION" >> php_version.h.new
90echo "#define PHP_RELEASE_VERSION $PHP_RELEASE_VERSION" >> php_version.h.new
91echo "#define PHP_EXTRA_VERSION \"$PHP_EXTRA_VERSION\"" >> php_version.h.new
92echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
93echo "#define PHP_VERSION_ID $PHP_VERSION_ID" >> php_version.h.new
94cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
95if test $? -ne 0 ; then
96  rm -f $srcdir/main/php_version.h && mv php_version.h.new $srcdir/main/php_version.h && \
97  echo 'Updated main/php_version.h'
98else
99  rm -f php_version.h.new
100fi
101
102dnl Settings we want to make before the checks.
103dnl ----------------------------------------------------------------------------
104
105php_shtool=$srcdir/build/shtool
106T_MD=`$php_shtool echo -n -e %B`
107T_ME=`$php_shtool echo -n -e %b`
108
109PHP_INIT_BUILD_SYSTEM
110
111dnl We want this one before the checks, so the checks can modify CFLAGS.
112test -z "$CFLAGS" && auto_cflags=1
113
114abs_srcdir=`(cd $srcdir; pwd)`
115abs_builddir=`pwd`
116
117dnl Because `make install` is often performed by the superuser, we create the
118dnl libs subdirectory as the user who configures PHP. Otherwise, the current
119dnl user will not be able to delete libs or the contents of libs.
120
121$php_shtool mkdir -p libs
122rm -f libs/*
123
124dnl Checks for programs.
125dnl ----------------------------------------------------------------------------
126
127PKG_PROG_PKG_CONFIG
128AC_PROG_CC([cc gcc])
129PHP_DETECT_ICC
130PHP_DETECT_SUNCC
131
132dnl AC_PROG_CC_C99 is obsolete with autoconf >= 2.70 yet necessary for <= 2.69.
133m4_version_prereq([2.70],,[AC_PROG_CC_C99])
134AC_PROG_CPP
135AC_USE_SYSTEM_EXTENSIONS
136AC_PROG_LN_S
137
138if test "$cross_compiling" = yes ; then
139  AC_MSG_CHECKING(for native build C compiler)
140  AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)
141  AC_MSG_RESULT($BUILD_CC)
142else
143  BUILD_CC=$CC
144fi
145
146dnl Support systems with system libraries in e.g. /usr/lib64.
147PHP_ARG_WITH([libdir],
148  [for system library directory],
149  [AS_HELP_STRING([--with-libdir=NAME],
150    [Look for libraries in .../NAME rather than .../lib])],
151  [lib],
152  [no])
153
154PHP_ARG_ENABLE([rpath],
155  [whether to enable runpaths],
156  [AS_HELP_STRING([--disable-rpath],
157    [Disable passing additional runtime library search paths])],
158  [yes],
159  [no])
160
161dnl Check for -R, etc. switch.
162PHP_RUNPATH_SWITCH
163
164dnl Checks for some support/generator progs.
165PHP_PROG_AWK
166PHP_PROG_BISON([3.0.0])
167PHP_PROG_RE2C([0.13.4])
168PHP_PROG_PHP()
169
170PHP_ARG_ENABLE([re2c-cgoto],
171  [whether to enable computed goto gcc extension with re2c],
172  [AS_HELP_STRING([--enable-re2c-cgoto],
173    [Enable -g flag to re2c to use computed goto gcc extension])],
174  [no],
175  [no])
176
177if test "$PHP_RE2C_CGOTO" = "no"; then
178  RE2C_FLAGS=""
179else
180  AC_MSG_CHECKING([whether re2c -g works])
181  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
182int main(int argc, const char **argv)
183{
184  argc = argc;
185  argv = argv;
186label1:
187label2:
188  static void *adr[] = { &&label1, &&label2};
189  goto *adr[0];
190  return 0;
191}
192  ]])],[
193    RE2C_FLAGS=""
194    AC_MSG_RESULT([no])
195  ],[
196    RE2C_FLAGS="-g"
197    AC_MSG_RESULT([yes])
198  ])
199fi
200PHP_SUBST(RE2C_FLAGS)
201
202dnl Platform-specific compile settings.
203dnl ----------------------------------------------------------------------------
204
205dnl See bug #28605
206case $host_cpu in
207  alpha*)
208    if test "$GCC" = "yes"; then
209      CFLAGS="$CFLAGS -mieee"
210    else
211      CFLAGS="$CFLAGS -ieee"
212    fi
213    ;;
214  sparc*)
215    if test "$SUNCC" = "yes"; then
216      CFLAGS="$CFLAGS -xmemalign=8s"
217    fi
218    ;;
219esac
220
221dnl Mark symbols hidden by default if the compiler (for example, gcc >= 4)
222dnl supports it. This can help reduce the binary size and startup time.
223AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
224                       [CFLAGS="$CFLAGS -fvisibility=hidden"])
225
226case $host_alias in
227  *solaris*)
228    CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
229    ;;
230  *dgux*)
231    CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR"
232    ;;
233  *mips*)
234    CPPFLAGS="$CPPFLAGS -D_XPG_IV"
235    ;;
236  *hpux*)
237    if test "$GCC" = "yes"; then
238      CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
239    fi
240    ;;
241esac
242
243dnl Disable PIC mode by default where it is known to be safe to do so, to avoid
244dnl the performance hit from the lost register.
245AC_MSG_CHECKING([whether to force non-PIC code in shared modules])
246case $host_alias in
247  i?86-*-linux*|i?86-*-freebsd*)
248    if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then
249      with_pic=no
250      AC_MSG_RESULT(yes)
251    else
252      AC_MSG_RESULT(no)
253    fi
254    ;;
255  *)
256    AC_MSG_RESULT(no)
257    ;;
258esac
259
260dnl Detect musl libc
261AC_MSG_CHECKING([whether we are using musl libc])
262if command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl
263then
264  AC_MSG_RESULT(yes)
265  AC_DEFINE([__MUSL__], [1], [Define when using musl libc])
266else
267  AC_MSG_RESULT(no)
268fi
269
270
271dnl Include Zend configurations.
272dnl ----------------------------------------------------------------------------
273
274sinclude(Zend/Zend.m4)
275
276dnl ----------------------------------------------------------------------------
277
278PTHREADS_CHECK
279PHP_HELP_SEPARATOR([SAPI modules:])
280PHP_SHLIB_SUFFIX_NAMES
281PHP_BUILD_PROGRAM
282PHP_SAPI=none
283
284dnl SAPI configuration.
285dnl ----------------------------------------------------------------------------
286
287dnl Paths to the targets are relative to the build directory.
288SAPI_SHARED=libs/libphp.[]$SHLIB_DL_SUFFIX_NAME
289SAPI_STATIC=libs/libphp.a
290SAPI_LIBTOOL=libphp.la
291
292PHP_CONFIGURE_PART(Configuring SAPI modules)
293
294esyscmd(./build/config-stubs sapi)
295
296dnl Show which main SAPI was selected.
297AC_MSG_CHECKING([for chosen SAPI module])
298AC_MSG_RESULT([$PHP_SAPI])
299
300dnl Show which binaries were selected.
301AC_MSG_CHECKING([for executable SAPI binaries])
302if test "$PHP_BINARIES"; then
303  AC_MSG_RESULT([$PHP_BINARIES])
304else
305  AC_MSG_RESULT([none])
306fi
307
308dnl Exit early.
309if test -z "$PHP_INSTALLED_SAPIS"; then
310  AC_MSG_ERROR([Nothing to build.])
311fi
312
313dnl Force ZTS.
314if test "$enable_zts" = "yes"; then
315  dnl Add pthreads linker and compiler flags.
316  if test -n "$ac_cv_pthreads_lib"; then
317    LIBS="$LIBS -l$ac_cv_pthreads_lib"
318  fi
319  if test -n "$ac_cv_pthreads_cflags"; then
320    CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
321  fi
322
323  PTHREADS_FLAGS
324fi
325
326dnl Starting system checks.
327dnl ----------------------------------------------------------------------------
328
329PHP_CONFIGURE_PART(Running system checks)
330
331dnl Find sendmail binary.
332PHP_PROG_SENDMAIL
333
334dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset.
335PHP_EBCDIC
336
337dnl Check whether the system byte ordering is bigendian.
338PHP_C_BIGENDIAN
339
340dnl Check whether writing to stdout works.
341PHP_TEST_WRITE_STDOUT
342
343dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary and
344dnl source packages. This should be harmless on other OSs.
345if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
346   CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
347   LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
348fi
349test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
350
351dnl First, library checks.
352dnl ----------------------------------------------------------------------------
353
354dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try to avoid -lnsl
355dnl checks, if we already have the functions which are usually in libnsl. Also,
356dnl uClibc will bark at linking with glibc's libnsl.
357
358PHP_CHECK_FUNC(socket, socket, network)
359PHP_CHECK_FUNC(socketpair, socket, network)
360PHP_CHECK_FUNC(htonl, socket, network)
361PHP_CHECK_FUNC(gethostname, nsl, network)
362PHP_CHECK_FUNC(gethostbyaddr, nsl, network)
363PHP_CHECK_FUNC(dlopen, dl, root)
364PHP_CHECK_FUNC(dlsym, dl, root)
365if test "$ac_cv_func_dlopen" = "yes"; then
366  AC_DEFINE(HAVE_LIBDL, 1, [ ])
367fi
368AC_CHECK_LIB(m, sin)
369
370case $host_alias in
371  riscv64*)
372    PHP_CHECK_FUNC(__atomic_exchange_1, atomic)
373    ;;
374esac
375
376dnl Check for inet_aton in -lc, -lbind and -lresolv.
377PHP_CHECK_FUNC(inet_aton, resolv, bind)
378
379dnl Then headers.
380dnl ----------------------------------------------------------------------------
381
382dnl QNX requires unix.h to allow functions in libunix to work properly.
383AC_CHECK_HEADERS([ \
384stdint.h \
385dirent.h \
386sys/param.h \
387sys/types.h \
388sys/time.h \
389netinet/in.h \
390alloca.h \
391arpa/inet.h \
392arpa/nameser.h \
393crypt.h \
394dns.h \
395fcntl.h \
396grp.h \
397ieeefp.h \
398langinfo.h \
399malloc.h \
400poll.h \
401pty.h \
402pwd.h \
403resolv.h \
404strings.h \
405syslog.h \
406sysexits.h \
407sys/ioctl.h \
408sys/file.h \
409sys/mman.h \
410sys/mount.h \
411sys/poll.h \
412sys/resource.h \
413sys/select.h \
414sys/socket.h \
415sys/stat.h \
416sys/statfs.h \
417sys/statvfs.h \
418sys/vfs.h \
419sys/sysexits.h \
420sys/uio.h \
421sys/wait.h \
422sys/loadavg.h \
423unistd.h \
424unix.h \
425utime.h \
426sys/utsname.h \
427sys/ipc.h \
428dlfcn.h \
429tmmintrin.h \
430nmmintrin.h \
431wmmintrin.h \
432immintrin.h
433],[],[],[
434#ifdef HAVE_SYS_PARAM_H
435#include <sys/param.h>
436#endif
437#ifdef HAVE_SYS_TYPES_H
438#include <sys/types.h>
439#endif
440#ifdef HAVE_SYS_TIME_H
441#include <sys/time.h>
442#endif
443#ifdef HAVE_NETINET_IN_H
444#include <netinet/in.h>
445#endif
446#ifdef HAVE_ARPA_NAMESER_H
447#include <arpa/nameser.h>
448#endif
449])
450
451PHP_FOPENCOOKIE
452PHP_BROKEN_GETCWD
453if test "$GCC" = "yes"; then
454  PHP_BROKEN_GCC_STRLEN_OPT
455fi
456
457dnl Checks for typedefs, structures, and compiler characteristics.
458dnl ----------------------------------------------------------------------------
459
460AC_STRUCT_TIMEZONE
461
462PHP_MISSING_TIME_R_DECL
463PHP_MISSING_FCLOSE_DECL
464PHP_STRUCT_FLOCK
465
466AC_CHECK_TYPES(socklen_t, [], [], [
467  #ifdef HAVE_SYS_TYPES_H
468  # include <sys/types.h>
469  #endif
470  #ifdef HAVE_SYS_SOCKET_H
471  # include <sys/socket.h>
472  #endif
473])
474
475dnl These are defined elsewhere than stdio.h.
476PHP_CHECK_SIZEOF(intmax_t, 0)
477PHP_CHECK_SIZEOF(ssize_t, 8)
478PHP_CHECK_SIZEOF(ptrdiff_t, 8)
479
480dnl Check stdint types (must be after header check).
481PHP_CHECK_STDINT_TYPES
482
483dnl Check __builtin_expect
484PHP_CHECK_BUILTIN_EXPECT
485dnl Check __builtin_clz
486PHP_CHECK_BUILTIN_CLZ
487dnl Check __builtin_clzl
488PHP_CHECK_BUILTIN_CLZL
489dnl Check __builtin_clzll
490PHP_CHECK_BUILTIN_CLZLL
491dnl Check __builtin_ctzl
492PHP_CHECK_BUILTIN_CTZL
493dnl Check __builtin_ctzll
494PHP_CHECK_BUILTIN_CTZLL
495dnl Check __builtin_smull_overflow
496PHP_CHECK_BUILTIN_SMULL_OVERFLOW
497dnl Check __builtin_smulll_overflow
498PHP_CHECK_BUILTIN_SMULLL_OVERFLOW
499dnl Check __builtin_saddl_overflow
500PHP_CHECK_BUILTIN_SADDL_OVERFLOW
501dnl Check __builtin_saddll_overflow
502PHP_CHECK_BUILTIN_SADDLL_OVERFLOW
503dnl Check __builtin_ssubl_overflow
504PHP_CHECK_BUILTIN_SSUBL_OVERFLOW
505dnl Check __builtin_ssubll_overflow
506PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW
507dnl Check __builtin_cpu_init
508PHP_CHECK_BUILTIN_CPU_INIT
509dnl Check __builtin_cpu_supports
510PHP_CHECK_BUILTIN_CPU_SUPPORTS
511
512dnl Check for __alignof__ support in the compiler
513AC_CACHE_CHECK(whether the compiler supports __alignof__, ac_cv_alignof_exists,[
514AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
515]],[[
516  int align = __alignof__(int);
517]])],[
518  ac_cv_alignof_exists=yes
519],[
520  ac_cv_alignof_exists=no
521])])
522if test "$ac_cv_alignof_exists" = "yes"; then
523  AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__])
524fi
525
526dnl Check for structure members.
527AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
528AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
529dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
530if test "`uname -s 2>/dev/null`" != "QNX"; then
531  AC_STRUCT_ST_BLOCKS
532fi
533
534dnl Checks for types.
535AC_TYPE_SIZE_T
536AC_TYPE_UID_T
537
538dnl Checks for sockaddr_storage and sockaddr.sa_len.
539PHP_SOCKADDR_CHECKS
540
541dnl Checks for GCC function attributes on all systems except ones without glibc
542dnl Fix for these systems is already included in GCC 7, but not on GCC 6.
543dnl
544dnl At least some versions of FreeBSD seem to have buggy ifunc support, see
545dnl bug #77284. Conservatively don't use ifuncs on FreeBSD.
546AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*|*openbsd*], [true], [
547  AX_GCC_FUNC_ATTRIBUTE([ifunc])
548  AX_GCC_FUNC_ATTRIBUTE([target])
549])
550
551dnl Check for IPv6 support.
552AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
553[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
554#include <sys/socket.h>
555#include <netinet/in.h>]], [[struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;]])],
556  [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
557
558dnl Checks for library functions.
559dnl ----------------------------------------------------------------------------
560
561AC_CHECK_FUNCS(
562alphasort \
563asctime_r \
564chroot \
565ctime_r \
566explicit_memset \
567fdatasync \
568flock \
569ftok \
570funopen \
571gai_strerror \
572getcwd \
573getloadavg \
574getlogin \
575getprotobyname \
576getprotobynumber \
577getservbyname \
578getservbyport \
579getrusage \
580gettimeofday \
581gmtime_r \
582getpwnam_r \
583getgrnam_r \
584getpwuid_r \
585getwd \
586glob \
587inet_ntoa \
588inet_ntop \
589inet_pton \
590localtime_r \
591lchown \
592memmove \
593mkstemp \
594mmap \
595nice \
596nl_langinfo \
597poll \
598putenv \
599scandir \
600setitimer \
601setenv \
602shutdown \
603sigprocmask \
604statfs \
605statvfs \
606std_syslog \
607strcasecmp \
608strnlen \
609strptime \
610strtok_r \
611symlink \
612tzset \
613unsetenv \
614usleep \
615utime \
616vasprintf \
617asprintf \
618nanosleep \
619memmem \
620)
621
622dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version.
623AC_FUNC_STRERROR_R
624
625AX_FUNC_WHICH_GETHOSTBYNAME_R
626
627dnl Some systems (like OpenSolaris) do not have nanosleep in libc.
628PHP_CHECK_FUNC_LIB(nanosleep, rt)
629
630dnl Haiku does not have network api in libc.
631PHP_CHECK_FUNC_LIB(setsockopt, network)
632
633dnl Check for getaddrinfo, should be a better way, but... Also check for working
634dnl getaddrinfo.
635AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
636[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
637  [[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
638#include <string.h>
639#include <netdb.h>
640#include <sys/types.h>
641#include <string.h>
642#include <stdlib.h>
643#ifndef AF_INET
644# include <sys/socket.h>
645#endif
646int main(void) {
647  struct addrinfo *ai, *pai, hints;
648
649  memset(&hints, 0, sizeof(hints));
650  hints.ai_flags = AI_NUMERICHOST;
651
652  if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
653    return 1;
654  }
655
656  if (ai == 0) {
657    return 1;
658  }
659
660  pai = ai;
661
662  while (pai) {
663    if (pai->ai_family != AF_INET) {
664      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
665      return 1;
666    }
667    if (pai->ai_addr->sa_family != AF_INET) {
668      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
669      return 1;
670    }
671    pai = pai->ai_next;
672  }
673  freeaddrinfo(ai);
674  return 0;
675}
676  ]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [
677    dnl Cross compilation.
678    case $host_alias in
679      *linux*)
680        ac_cv_func_getaddrinfo=yes
681        ;;
682      *)
683        ac_cv_func_getaddrinfo=no
684        ;;
685    esac
686  ])],
687[ac_cv_func_getaddrinfo=no])])
688if test "$ac_cv_func_getaddrinfo" = yes; then
689  AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
690fi
691
692AC_REPLACE_FUNCS(strlcat strlcpy explicit_bzero getopt)
693AC_FUNC_ALLOCA
694PHP_TIME_R_TYPE
695PHP_CHECK_IN_ADDR_T
696
697AC_CACHE_CHECK([for aarch64 CRC32 API], ac_cv_func___crc32d,
698[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arm_acle.h>]],[[__crc32d(0, 0);]])],[ac_cv_func___crc32d=yes],[ac_cv_func___crc32d="no"])])
699if test "$ac_cv_func___crc32d" = "yes"; then
700  AC_DEFINE([HAVE_AARCH64_CRC32], [1], [Define when aarch64 CRC32 API is available.])
701fi
702
703dnl Check for asm goto support.
704AC_CACHE_CHECK([for asm goto], ac_cv__asm_goto,
705[AC_RUN_IFELSE([AC_LANG_SOURCE([[
706int main(void) {
707#if defined(__x86_64__) || defined(__i386__)
708    __asm__ goto("jmp %l0\n" :::: end);
709#elif defined(__aarch64__)
710    __asm__ goto("b %l0\n" :::: end);
711#endif
712end:
713    return 0;
714}
715  ]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no], [
716    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
717int main(void) {
718#if defined(__x86_64__) || defined(__i386__)
719    __asm__ goto("jmp %l0\n" :::: end);
720#elif defined(__aarch64__)
721    __asm__ goto("b %l0\n" :::: end);
722#endif
723end:
724    return 0;
725}
726  ]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no])
727])])
728
729if test "$ac_cv__asm_goto" = yes; then
730  AC_DEFINE(HAVE_ASM_GOTO,1,[Define if asm goto support])
731fi
732
733dnl Check valgrind support.
734PHP_ARG_WITH([valgrind],
735  [whether to enable valgrind support],
736  [AS_HELP_STRING([--with-valgrind],
737    [Enable valgrind support])],
738  [yes],
739  [no])
740
741if test "$PHP_VALGRIND" != "no"; then
742  PKG_CHECK_MODULES([VALGRIND], [valgrind], [have_valgrind="yes"], [have_valgrind="no"])
743
744  if test "$have_valgrind" = "yes"; then
745    PHP_EVAL_INCLINE($VALGRIND_CFLAGS)
746    AC_DEFINE(HAVE_VALGRIND, 1, [ ])
747  else
748    if test "$with_valgrind" = "yes"; then
749      AC_MSG_ERROR([Valgrind not found. Please install Valgrind.])
750    fi
751  fi
752fi
753
754dnl Check for openpty. It may require linking against libutil or libbsd.
755PHP_CHECK_FUNC(openpty, util, bsd)
756
757dnl General settings.
758dnl ----------------------------------------------------------------------------
759PHP_CONFIGURE_PART(General settings)
760
761PHP_HELP_SEPARATOR([General settings:])
762
763PHP_ARG_ENABLE([gcov],
764  [whether to include gcov symbols],
765  [AS_HELP_STRING([--enable-gcov],
766    [Enable GCOV code coverage - FOR DEVELOPERS ONLY!!])],
767  [no],
768  [no])
769
770if test "$PHP_GCOV" = "yes"; then
771
772  if test "$GCC" != "yes"; then
773    AC_MSG_ERROR([GCC is required for --enable-gcov])
774  fi
775
776  dnl Check if ccache is being used.
777  case `$php_shtool path $CC` in
778    *ccache*[)] gcc_ccache=yes;;
779    *[)] gcc_ccache=no;;
780  esac
781
782  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
783    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
784  fi
785
786  AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
787  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/build/Makefile.gcov, $abs_srcdir)
788
789  dnl Remove all optimization flags from CFLAGS.
790  changequote({,})
791  CFLAGS=`echo "$CFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
792  CXXFLAGS=`echo "$CXXFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
793  changequote([,])
794
795  dnl Add the special gcc flags.
796  CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
797  CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
798fi
799
800PHP_ARG_ENABLE([debug],
801  [whether to include debugging symbols],
802  [AS_HELP_STRING([--enable-debug],
803    [Compile with debugging symbols])],
804  [no],
805  [no])
806
807if test "$PHP_DEBUG" = "yes"; then
808  PHP_DEBUG=1
809  ZEND_DEBUG=yes
810  changequote({,})
811  CFLAGS=`echo "$CFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
812  CXXFLAGS=`echo "$CXXFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
813  changequote([,])
814  dnl Add -O0 only if GCC or ICC is used.
815  if test "$GCC" = "yes" || test "$ICC" = "yes"; then
816    CFLAGS="$CFLAGS -O0"
817    CXXFLAGS="$CXXFLAGS -g -O0"
818  fi
819  if test "$SUNCC" = "yes"; then
820    if test -n "$auto_cflags"; then
821      CFLAGS="-g"
822      CXXFLAGS="-g"
823    else
824      CFLAGS="$CFLAGS -g"
825      CXXFLAGS="$CFLAGS -g"
826    fi
827  fi
828else
829  PHP_DEBUG=0
830  ZEND_DEBUG=no
831fi
832
833PHP_ARG_ENABLE([debug-assertions],
834  [whether to enable debug assertions in release mode],
835  [AS_HELP_STRING([--enable-debug-assertions],
836    [Compile with debug assertions even in release mode])],
837  [no],
838  [no])
839
840if test "$PHP_DEBUG_ASSERTIONS" = "yes"; then
841  PHP_DEBUG=1
842  ZEND_DEBUG=yes
843fi
844
845AC_ARG_ENABLE([zts],
846  [AS_HELP_STRING([--enable-zts],
847    [Enable thread safety])],
848  [ZEND_ZTS=$enableval],
849  [ZEND_ZTS=no])
850
851if test "$ZEND_ZTS" = "yes"; then
852  AC_DEFINE(ZTS, 1,[ ])
853  PHP_THREAD_SAFETY=yes
854else
855  PHP_THREAD_SAFETY=no
856fi
857
858PHP_ARG_ENABLE([rtld-now],
859  [whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
860  [AS_HELP_STRING([--enable-rtld-now],
861    [Use dlopen with RTLD_NOW instead of RTLD_LAZY])],
862  [no],
863  [no])
864
865if test "$PHP_RTLD_NOW" = "yes"; then
866  AC_DEFINE(PHP_USE_RTLD_NOW, 1, [ Use dlopen with RTLD_NOW instead of RTLD_LAZY ])
867fi
868
869PHP_ARG_WITH([layout],
870  [layout of installed files],
871  [AS_HELP_STRING([--with-layout=TYPE],
872    [Set how installed files will be laid out. Type can be either PHP or GNU [PHP]])],
873  [PHP],
874  [no])
875
876case $PHP_LAYOUT in
877  GNU)
878    oldstyleextdir=no
879    ;;
880  *)
881    oldstyleextdir=yes
882    ;;
883esac
884
885PHP_ARG_WITH([config-file-path],
886  [path to configuration file],
887  [AS_HELP_STRING([--with-config-file-path=PATH],
888    [Set the path in which to look for php.ini [PREFIX/lib]])],
889  [DEFAULT],
890  [no])
891
892if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
893  case $PHP_LAYOUT in
894    GNU)
895      PHP_CONFIG_FILE_PATH=$sysconfdir
896      ;;
897    *)
898      PHP_CONFIG_FILE_PATH=$libdir
899      ;;
900  esac
901fi
902
903AC_MSG_CHECKING([where to scan for configuration files])
904PHP_ARG_WITH([config-file-scan-dir],,
905  [AS_HELP_STRING([--with-config-file-scan-dir=PATH],
906    [Set the path where to scan for configuration files])],
907  [DEFAULT],
908  [no])
909
910if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
911  PHP_CONFIG_FILE_SCAN_DIR=
912fi
913AC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR])
914
915test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
916
917PHP_ARG_ENABLE([sigchild],
918  [whether to enable PHP's own SIGCHLD handler],
919  [AS_HELP_STRING([--enable-sigchild],
920    [Enable PHP's own SIGCHLD handler])],
921  [no],
922  [no])
923
924if test "$PHP_SIGCHILD" = "yes"; then
925  AC_DEFINE(PHP_SIGCHILD, 1, [ ])
926else
927  AC_DEFINE(PHP_SIGCHILD, 0, [ ])
928fi
929
930PHP_ARG_ENABLE([libgcc],
931  [whether to explicitly link against libgcc],
932  [AS_HELP_STRING([--enable-libgcc],
933    [Enable explicitly linking against libgcc])],
934  [no],
935  [no])
936
937if test "$PHP_LIBGCC" = "yes"; then
938  PHP_LIBGCC_LIBPATH(gcc)
939  if test -z "$libgcc_libpath"; then
940    AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path])
941  fi
942  PHP_ADD_LIBPATH($libgcc_libpath)
943  PHP_ADD_LIBRARY(gcc, yes)
944fi
945
946PHP_ARG_ENABLE([short-tags],
947  [whether to enable short tags by default],
948  [AS_HELP_STRING([--disable-short-tags],
949    [Disable the short-form <? start tag by default])],
950  [yes],
951  [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],
960  [whether to enable dmalloc],
961  [AS_HELP_STRING([--enable-dmalloc],
962    [Enable dmalloc])],
963  [no],
964  [no])
965
966if test "$PHP_DMALLOC" = "yes"; then
967  AC_CHECK_LIB(dmalloc, dmalloc_error, [
968    PHP_ADD_LIBRARY(dmalloc)
969    AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
970    CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
971  ], [
972    AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.])
973  ])
974fi
975
976PHP_ARG_ENABLE([ipv6],
977  [whether to enable IPv6 support],
978  [AS_HELP_STRING([--disable-ipv6],
979    [Disable IPv6 support])],
980  [yes],
981  [no])
982
983if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
984  AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
985fi
986
987dnl DTRACE checks. Note: this has to be done after SAPI configuration.
988PHP_ARG_ENABLE([dtrace],
989  [whether to enable DTrace support],
990  [AS_HELP_STRING([--enable-dtrace],
991    [Enable DTrace support])],
992  [no],
993  [no])
994
995if test "$PHP_DTRACE" = "yes"; then
996  AC_CHECK_HEADERS([sys/sdt.h], [
997    PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \
998      Zend/zend_execute.c Zend/zend_exceptions.c \
999      Zend/zend_dtrace.c Zend/zend.c])
1000    AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
1001    PHP_SUBST(PHP_DTRACE_OBJS)
1002  ], [
1003    AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support])
1004  ])
1005fi
1006
1007AC_MSG_CHECKING([how big to make fd sets])
1008PHP_ARG_ENABLE([fd-setsize],,
1009  [AS_HELP_STRING([--enable-fd-setsize],
1010    [Set size of descriptor sets])],
1011  [no],
1012  [no])
1013
1014if test "$PHP_FD_SETSIZE" != "no"; then
1015  if test "0$PHP_FD_SETSIZE" -gt 0 2>/dev/null; then
1016    CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$PHP_FD_SETSIZE"
1017    AC_MSG_RESULT([using $PHP_FD_SETSIZE])
1018  else
1019    AC_MSG_ERROR([Invalid value passed to --enable-fd-setsize!])
1020  fi
1021else
1022  AC_MSG_RESULT([using system default])
1023fi
1024
1025PHP_ARG_ENABLE([werror],,
1026  [AS_HELP_STRING([--enable-werror],
1027    [Enable -Werror])],
1028  [no],
1029  [no])
1030PHP_ARG_ENABLE([memory-sanitizer],,
1031  [AS_HELP_STRING([--enable-memory-sanitizer],
1032    [Enable memory sanitizer (clang only)])],
1033  [no],
1034  [no])
1035PHP_ARG_ENABLE([address-sanitizer],,
1036  [AS_HELP_STRING([--enable-address-sanitizer],
1037    [Enable address sanitizer])],
1038  [no],
1039  [no])
1040PHP_ARG_ENABLE([undefined-sanitizer],,
1041  [AS_HELP_STRING([--enable-undefined-sanitizer],
1042    [Enable undefined sanitizer])],
1043  [no],
1044  [no])
1045
1046dnl Extension configuration.
1047dnl ----------------------------------------------------------------------------
1048
1049PHP_HELP_SEPARATOR([Extensions:
1050
1051  --with-EXTENSION=[shared[,PATH]]
1052
1053    NOTE: Not all extensions can be build as 'shared'.
1054
1055    Example: --with-foobar=shared,/usr/local/foobar/
1056
1057      o Builds the foobar extension as shared extension.
1058      o foobar package install prefix is /usr/local/foobar/
1059])
1060
1061PHP_CONFIGURE_PART(Configuring extensions)
1062
1063dnl Check if all enabled by default extensions should be disabled.
1064AC_ARG_ENABLE([all],
1065  [AS_HELP_STRING([--disable-all],
1066    [Disable all extensions which are enabled by default])],
1067  [PHP_ENABLE_ALL=$enableval])
1068
1069dnl Reading config stubs.
1070esyscmd(./build/config-stubs ext)
1071
1072dnl Extensions post-config.
1073dnl ----------------------------------------------------------------------------
1074
1075dnl Align segments on huge page boundary
1076case $host_alias in
1077  i[[3456]]86-*-linux-* | x86_64-*-linux-*)
1078	AC_MSG_CHECKING(linker support for -zcommon-page-size=2097152)
1079    save_LDFLAGS=$LDFLAGS
1080    LDFLAGS="$LDFLAGS -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
1081    AC_RUN_IFELSE(
1082        [AC_LANG_SOURCE([[int main() {return 0;}]])],
1083        [ac_cv_common_page_size=yes],
1084        [ac_cv_common_page_size=no],
1085        [ac_cv_common_page_size=no])
1086    LDFLAGS=$save_LDFLAGS
1087    if test "$ac_cv_common_page_size" = "yes"; then
1088        AC_MSG_RESULT([yes])
1089        EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
1090    else
1091        AC_MSG_RESULT([no])
1092        AC_MSG_CHECKING(linker support for -zmax-page-size=2097152)
1093        save_LDFLAGS=$LDFLAGS
1094        LDFLAGS="$LDFLAGS -Wl,-zmax-page-size=2097152"
1095        AC_RUN_IFELSE(
1096            [AC_LANG_SOURCE([[int main() {return 0;}]])],
1097            [ac_cv_max_page_size=yes],
1098            [ac_cv_max_page_size=no],
1099            [ac_cv_max_page_size=no])
1100        LDFLAGS=$save_LDFLAGS
1101        if test "$ac_cv_max_page_size" = "yes"; then
1102            AC_MSG_RESULT([yes])
1103            EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM -Wl,-zmax-page-size=2097152"
1104        else
1105            AC_MSG_RESULT([no])
1106        fi
1107    fi
1108    ;;
1109esac
1110
1111enable_shared=yes
1112enable_static=yes
1113
1114case $php_sapi_module in
1115  shared[)]
1116    if test "$PHP_CGI" = "no" && test "$PHP_CLI" = "no" && test "$PHP_FPM" = "no" && test "$PHP_LITESPEED" = "no" && test "$PHP_PHPDBG" = "no"; then
1117      enable_static=no
1118    fi
1119    case $with_pic in
1120      yes)
1121        standard_libtool_flag='-prefer-pic'
1122        ;;
1123      no)
1124        standard_libtool_flag='-prefer-non-pic'
1125        ;;
1126    esac
1127    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
1128    ;;
1129  *[)]
1130    standard_libtool_flag='-prefer-non-pic -static'
1131    if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then
1132      enable_shared=no
1133    fi
1134    ;;
1135esac
1136
1137EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
1138
1139dnl This has to be here to prevent the openssl crypt() from overriding the
1140dnl system provided crypt().
1141if test "$ac_cv_lib_crypt_crypt" = "yes"; then
1142  EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
1143fi
1144
1145unset LIBS LDFLAGS
1146
1147dnl PEAR
1148dnl ----------------------------------------------------------------------------
1149
1150PHP_HELP_SEPARATOR([PEAR:])
1151PHP_CONFIGURE_PART(Configuring PEAR)
1152
1153dnl Compatibility
1154if test -z "$with_pear" && test "$enable_pear" = "no"; then
1155  with_pear=no
1156fi
1157
1158dnl If CLI is disabled disable PEAR.
1159if test "$PHP_CLI" = "no"; then
1160  with_pear=no
1161fi
1162
1163PHP_ARG_WITH([pear],
1164  [whether to install PEAR],
1165  [AS_HELP_STRING([[--with-pear[=DIR]]],
1166    [Install PEAR in DIR [PREFIX/lib/php]])],
1167  [no],
1168  [yes])
1169
1170if test "$PHP_PEAR" != "no"; then
1171
1172  dnl PEAR dependencies.
1173  if test "$PHP_XML" = "no"; then
1174    pear_error_msg="$pear_error_msg
1175                    PEAR requires XML to be enabled.     Add --enable-xml to the configure line. (or --without-pear)"
1176  fi
1177
1178  if test "$pear_error_msg"; then
1179    AC_MSG_ERROR([$pear_error_msg])
1180  fi
1181
1182  AC_MSG_WARN([The --with-pear option is deprecated])
1183
1184  install_pear="install-pear"
1185  PEAR_INSTALLDIR=$PHP_PEAR
1186
1187  if test "$PHP_PEAR" = "yes"; then
1188    case $PHP_LAYOUT in
1189      GNU) PEAR_INSTALLDIR=$datadir/pear;;
1190      *)   PEAR_INSTALLDIR=$libdir/php;;
1191    esac
1192  fi
1193
1194  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
1195fi
1196
1197dnl Configuring Zend and TSRM.
1198dnl ----------------------------------------------------------------------------
1199
1200AC_ARG_ENABLE([fiber-asm],
1201  [AS_HELP_STRING([--disable-fiber-asm],
1202    [Disable the use of boost fiber assembly files])],
1203  [fiber_asm=$enableval], [fiber_asm='yes'])
1204
1205PHP_HELP_SEPARATOR([Zend:])
1206PHP_CONFIGURE_PART(Configuring Zend)
1207
1208AS_CASE([$host_cpu],
1209  [x86_64*|amd64*], [fiber_cpu="x86_64"],
1210  [x86*|amd*|i?86*|pentium], [fiber_cpu="i386"],
1211  [aarch64*|arm64*], [fiber_cpu="arm64"],
1212  [arm*], [fiber_cpu="arm32"],
1213  [ppc64*|powerpc64*], [fiber_cpu="ppc64"],
1214  [ppc*|powerpc*], [fiber_cpu="ppc32"],
1215  [riscv64*], [fiber_cpu="riscv64"],
1216  [s390x*], [fiber_cpu="s390x"],
1217  [mips64*], [fiber_cpu="mips64"],
1218  [mips*], [fiber_cpu="mips32"],
1219  [fiber_cpu="unknown"]
1220)
1221
1222AS_CASE([$host_os],
1223  [darwin*], [fiber_os="mac"],
1224  [aix*|os400*], [fiber_os="aix"],
1225  [freebsd*], [fiber_os="freebsd"],
1226  [fiber_os="other"]
1227)
1228
1229AS_CASE([$fiber_cpu],
1230  [x86_64], [fiber_asm_file_prefix="x86_64_sysv"],
1231  [i386], [fiber_asm_file_prefix="i386_sysv"],
1232  [arm64], [fiber_asm_file_prefix="arm64_aapcs"],
1233  [arm32], [fiber_asm_file_prefix="arm_aapcs"],
1234  [ppc64], [fiber_asm_file_prefix="ppc64_sysv"],
1235  [ppc32], [fiber_asm_file_prefix="ppc32_sysv"],
1236  [riscv64], [fiber_asm_file_prefix="riscv64_sysv"],
1237  [s390x], [fiber_asm_file_prefix="s390x_sysv"],
1238  [mips64], [fiber_asm_file_prefix="mips64_n64"],
1239  [mips32], [fiber_asm_file_prefix="mips32_o32"],
1240  [fiber_asm_file_prefix="unknown"]
1241)
1242
1243if test "$fiber_os" = 'mac'; then
1244  fiber_asm_file="combined_sysv_macho_gas"
1245elif test "$fiber_os" = 'aix'; then
1246  # AIX uses a different calling convention (shared with non-_CALL_ELF Linux).
1247  # The AIX assembler isn't GNU, but the file is compatible.
1248  fiber_asm_file="${fiber_asm_file_prefix}_xcoff_gas"
1249elif test "$fiber_os" = 'freebsd'; then
1250  case $fiber_cpu in
1251    i386*)
1252      fiber_asm="no"
1253      ;;
1254    *)
1255      fiber_asm_file="${fiber_asm_file_prefix}_elf_gas"
1256      ;;
1257  esac
1258elif test "$fiber_asm_file_prefix" != 'unknown'; then
1259  fiber_asm_file="${fiber_asm_file_prefix}_elf_gas"
1260else
1261  fiber_asm="no"
1262fi
1263
1264if test "$fiber_asm" = 'yes'; then
1265  AC_MSG_CHECKING([for fiber switching context])
1266  AC_DEFINE([ZEND_FIBER_ASM], 1, [ ])
1267  PHP_ADD_SOURCES(Zend/asm, make_${fiber_asm_file}.S jump_${fiber_asm_file}.S)
1268  AC_MSG_RESULT([$fiber_asm_file])
1269else
1270  if test "$fiber_os" = 'mac'; then
1271    AC_DEFINE([_XOPEN_SOURCE], 1, [ ])
1272  fi
1273  AC_CHECK_HEADER(ucontext.h, [
1274    AC_DEFINE([ZEND_FIBER_UCONTEXT], 1, [ ])
1275  ], [
1276       AC_MSG_ERROR([fibers not available on this platform])
1277  ])
1278fi
1279
1280LIBZEND_BASIC_CHECKS
1281LIBZEND_DLSYM_CHECK
1282LIBZEND_OTHER_CHECKS
1283
1284INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
1285INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
1286
1287if test "$abs_srcdir" != "$abs_builddir"; then
1288  INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
1289  INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
1290fi
1291
1292ZEND_EXTRA_LIBS="$LIBS"
1293unset LIBS LDFLAGS
1294
1295PHP_HELP_SEPARATOR([TSRM:])
1296PHP_CONFIGURE_PART(Configuring TSRM)
1297if test "$PHP_THREAD_SAFETY" = "yes"; then
1298  TSRM_CHECK_PTHREADS
1299fi
1300
1301EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
1302EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
1303EXTRA_LIBS="$EXTRA_LIBS $LIBS"
1304unset LIBS LDFLAGS
1305
1306AC_ARG_PROGRAM
1307
1308test "$prefix" = "NONE" && prefix=/usr/local
1309test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
1310test "$program_prefix" = "NONE" && program_prefix=
1311test "$program_suffix" = "NONE" && program_suffix=
1312
1313case $libdir in
1314  '${exec_prefix}/lib')
1315    libdir=$libdir/php
1316    ;;
1317esac
1318case `eval echo $datadir` in
1319  '${prefix}/share')
1320    datadir=$datadir/php
1321    ;;
1322esac
1323
1324phplibdir=`pwd`/modules
1325$php_shtool mkdir -p $phplibdir
1326phptempdir=`pwd`/libs
1327
1328old_exec_prefix=$exec_prefix
1329old_libdir=$libdir
1330old_datadir=$datadir
1331exec_prefix=`eval echo $exec_prefix`
1332libdir=`eval echo $libdir`
1333datadir=`eval eval echo $datadir`
1334
1335dnl Build extension directory path.
1336ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|"${SED}" 's/#define ZEND_MODULE_API_NO //'`
1337
1338if test -z "$EXTENSION_DIR"; then
1339  extbasedir=$ZEND_MODULE_API_NO
1340  if test "$oldstyleextdir" = "yes"; then
1341    if test "$PHP_DEBUG" = "1"; then
1342      part1=debug
1343    else
1344      part1=no-debug
1345    fi
1346    if test "$enable_zts" = "yes"; then
1347      part2=zts
1348    else
1349      part2=non-zts
1350    fi
1351    extbasedir=$part1-$part2-$extbasedir
1352    EXTENSION_DIR=$libdir/extensions/$extbasedir
1353  else
1354    if test "$enable_zts" = "yes"; then
1355      extbasedir=$extbasedir-zts
1356    fi
1357
1358    if test "$PHP_DEBUG" = "1"; then
1359      extbasedir=$extbasedir-debug
1360    fi
1361    EXTENSION_DIR=$libdir/$extbasedir
1362  fi
1363fi
1364
1365case $PHP_LAYOUT in
1366  GNU)
1367    datarootdir=$prefix/share
1368    ;;
1369  *)
1370    datarootdir=$prefix/php
1371    ;;
1372esac
1373
1374dnl Expand all directory names for use in macros/constants.
1375EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
1376EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
1377EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
1378EXPANDED_BINDIR=`eval echo $bindir`
1379EXPANDED_SBINDIR=`eval echo $sbindir`
1380EXPANDED_MANDIR=`eval echo $mandir`
1381EXPANDED_LIBDIR=$libdir
1382EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
1383EXPANDED_DATADIR=$datadir
1384EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
1385EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
1386INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
1387
1388exec_prefix=$old_exec_prefix
1389libdir=$old_libdir
1390datadir=$old_datadir
1391
1392AC_SUBST(INCLUDE_PATH)
1393AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
1394AC_SUBST(EXPANDED_EXTENSION_DIR)
1395AC_SUBST(EXPANDED_BINDIR)
1396AC_SUBST(EXPANDED_SBINDIR)
1397AC_SUBST(EXPANDED_MANDIR)
1398AC_SUBST(EXPANDED_LIBDIR)
1399AC_SUBST(EXPANDED_DATADIR)
1400AC_SUBST(EXPANDED_SYSCONFDIR)
1401AC_SUBST(EXPANDED_LOCALSTATEDIR)
1402AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
1403AC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR)
1404
1405PHP_UTILIZE_RPATHS
1406
1407PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
1408PHP_REMOVE_USR_LIB(LDFLAGS)
1409
1410EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
1411EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
1412
1413UNAME=`uname -a | xargs`
1414PHP_UNAME=${PHP_UNAME:-$UNAME}
1415AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
1416PHP_OS=`uname | xargs`
1417AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
1418PHP_BUILD_SYSTEM=${PHP_BUILD_SYSTEM:-$PHP_UNAME}
1419AC_DEFINE_UNQUOTED(PHP_BUILD_SYSTEM,"$PHP_BUILD_SYSTEM",[builder uname output])
1420if test -n "${PHP_BUILD_PROVIDER}"; then
1421  AC_DEFINE_UNQUOTED(PHP_BUILD_PROVIDER,"$PHP_BUILD_PROVIDER",[build provider])
1422fi
1423if test -n "${PHP_BUILD_COMPILER}"; then
1424  AC_DEFINE_UNQUOTED(PHP_BUILD_COMPILER,"$PHP_BUILD_COMPILER",[used compiler for build])
1425fi
1426if test -n "${PHP_BUILD_ARCH}"; then
1427  AC_DEFINE_UNQUOTED(PHP_BUILD_ARCH,"$PHP_BUILD_ARCH",[build architecture])
1428fi
1429
1430PHP_SUBST_OLD(PHP_INSTALLED_SAPIS)
1431
1432PHP_SUBST(PHP_FASTCGI_OBJS)
1433PHP_SUBST(PHP_SAPI_OBJS)
1434PHP_SUBST(PHP_BINARY_OBJS)
1435PHP_SUBST(PHP_GLOBAL_OBJS)
1436
1437PHP_SUBST(PHP_BINARIES)
1438PHP_SUBST(PHP_MODULES)
1439PHP_SUBST(PHP_ZEND_EX)
1440
1441PHP_SUBST(EXT_LIBS)
1442
1443PHP_SUBST_OLD(abs_builddir)
1444PHP_SUBST_OLD(abs_srcdir)
1445
1446PHP_SUBST(bindir)
1447PHP_SUBST(sbindir)
1448PHP_SUBST(exec_prefix)
1449PHP_SUBST_OLD(program_prefix)
1450PHP_SUBST_OLD(program_suffix)
1451PHP_SUBST(includedir)
1452PHP_SUBST(libdir)
1453PHP_SUBST(mandir)
1454PHP_SUBST(phplibdir)
1455PHP_SUBST(phptempdir)
1456PHP_SUBST(prefix)
1457PHP_SUBST(localstatedir)
1458PHP_SUBST(datadir)
1459PHP_SUBST(datarootdir)
1460PHP_SUBST(sysconfdir)
1461
1462PHP_SUBST(EXEEXT)
1463PHP_SUBST(CC)
1464PHP_SUBST(BUILD_CC)
1465PHP_SUBST(CFLAGS)
1466PHP_SUBST(CFLAGS_CLEAN)
1467PHP_SUBST(CPP)
1468PHP_SUBST(CPPFLAGS)
1469PHP_SUBST(CXX)
1470PHP_SUBST(CXXFLAGS)
1471PHP_SUBST(CXXFLAGS_CLEAN)
1472PHP_SUBST_OLD(DEBUG_CFLAGS)
1473PHP_SUBST_OLD(EXTENSION_DIR)
1474PHP_SUBST_OLD(EXTRA_LDFLAGS)
1475PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM)
1476PHP_SUBST_OLD(EXTRA_LIBS)
1477PHP_SUBST_OLD(ZEND_EXTRA_LIBS)
1478PHP_SUBST_OLD(INCLUDES)
1479PHP_SUBST_OLD(EXTRA_INCLUDES)
1480PHP_SUBST_OLD(INCLUDE_PATH)
1481PHP_SUBST_OLD(INSTALL_IT)
1482PHP_SUBST(LFLAGS)
1483PHP_SUBST(LIBTOOL)
1484PHP_SUBST(LN_S)
1485PHP_SUBST_OLD(NATIVE_RPATHS)
1486PHP_SUBST_OLD(PEAR_INSTALLDIR)
1487PHP_SUBST_OLD(PHP_LDFLAGS)
1488PHP_SUBST_OLD(PHP_LIBS)
1489PHP_SUBST(OVERALL_TARGET)
1490PHP_SUBST(PHP_RPATHS)
1491PHP_SUBST(PHP_SAPI)
1492PHP_SUBST_OLD(PHP_VERSION)
1493PHP_SUBST_OLD(PHP_VERSION_ID)
1494PHP_SUBST(SHELL)
1495PHP_SUBST(SHARED_LIBTOOL)
1496PHP_SUBST(PHP_FRAMEWORKS)
1497PHP_SUBST(PHP_FRAMEWORKPATH)
1498PHP_SUBST(INSTALL_HEADERS)
1499
1500old_CC=$CC
1501
1502if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
1503  CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
1504  CPPFLAGS="$CPPFLAGS $ac_cv_pthreads_cflags"
1505fi
1506
1507dnl Enable -Werror late, because it may break configure checks throwing warnings.
1508if test "$PHP_WERROR" = "yes"; then
1509  CFLAGS="$CFLAGS -Werror"
1510  CXXFLAGS="$CXXFLAGS -Werror"
1511fi
1512
1513if test "$PHP_MEMORY_SANITIZER" = "yes" &&
1514   test "$PHP_ADDRESS_SANITIZER" = "yes"; then
1515   AC_MSG_ERROR([MemorySanitizer and AddressSanitizer are mutually exclusive])
1516fi
1517
1518dnl Enable -fsanitize=memory late, because interceptors may break linking detection.
1519if test "$PHP_MEMORY_SANITIZER" = "yes"; then
1520  AX_CHECK_COMPILE_FLAG([-fsanitize=memory -fsanitize-memory-track-origins], [
1521    CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
1522    CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
1523  ], [AC_MSG_ERROR([MemorySanitizer is not available])])
1524fi
1525
1526if test "$PHP_ADDRESS_SANITIZER" = "yes"; then
1527  AX_CHECK_COMPILE_FLAG([-fsanitize=address], [
1528    CFLAGS="$CFLAGS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC"
1529    CXXFLAGS="$CXXFLAGS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC"
1530  ], [AC_MSG_ERROR([AddressSanitizer is not available])])
1531fi
1532
1533if test "$PHP_UNDEFINED_SANITIZER" = "yes"; then
1534  AX_CHECK_COMPILE_FLAG([-fsanitize=undefined], [
1535    CFLAGS="$CFLAGS -fsanitize=undefined"
1536    CXXFLAGS="$CXXFLAGS -fsanitize=undefined"
1537
1538    dnl Clang 17 adds stricter function pointer compatibility checks where pointer args cannot be
1539    dnl cast to void*. In that case, set -fno-sanitize=function.
1540    OLD_CFLAGS="$CFLAGS"
1541    CFLAGS="$CFLAGS -fno-sanitize-recover=undefined"
1542    AC_RUN_IFELSE([AC_LANG_SOURCE([[
1543void foo(char *string) {}
1544int main(void) {
1545  void (*f)(void *) = (void (*)(void *))foo;
1546  f("foo");
1547}
1548    ]])],,[ubsan_needs_no_function=yes],)
1549    CFLAGS="$OLD_CFLAGS"
1550    if test "$ubsan_needs_no_function" = yes; then
1551      CFLAGS="$CFLAGS -fno-sanitize=function"
1552      CXXFLAGS="$CFLAGS -fno-sanitize=function"
1553    fi
1554  ], [AC_MSG_ERROR([UndefinedBehaviorSanitizer is not available])])
1555fi
1556
1557if test "$PHP_MEMORY_SANITIZER" = "yes" ||
1558   test "$PHP_ADDRESS_SANITIZER" = "yes" ||
1559   test "$PHP_UNDEFINED_SANITIZER" = "yes"; then
1560    CFLAGS="$CFLAGS -fno-omit-frame-pointer"
1561    CXXFLAGS="$CXXFLAGS -fno-omit-frame-pointer"
1562fi
1563
1564dnl
1565dnl Libtool creation.
1566dnl
1567
1568PHP_HELP_SEPARATOR([Libtool:])
1569PHP_CONFIGURE_PART(Configuring libtool)
1570
1571dnl Silence warning: `ar: 'u' modifier ignored since 'D' is the default`
1572dnl See https://github.com/php/php-src/pull/3017
1573AC_SUBST(AR_FLAGS, [cr])
1574
1575dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by
1576dnl PHP_REQUIRE_CXX). Otherwise AC_PROG_LIBTOOL fails if there is no working C++
1577dnl compiler.
1578AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
1579  undefine([AC_PROG_CXX])
1580  AC_DEFUN([AC_PROG_CXX], [])
1581  undefine([AC_PROG_CXXCPP])
1582  AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
1583])
1584AC_PROG_LIBTOOL
1585
1586PHP_SET_LIBTOOL_VARIABLE([--silent])
1587
1588dnl libtool 1.4.3 needs this.
1589PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps])
1590
1591dnl This needs to be passed explicitly to allow scan-build compiler overrides.
1592PHP_SET_LIBTOOL_VARIABLE([--tag CC])
1593
1594test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
1595test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
1596SHARED_LIBTOOL='$(LIBTOOL)'
1597
1598CC=$old_CC
1599
1600PHP_CONFIGURE_PART(Generating files)
1601
1602CXXFLAGS_CLEAN=$CXXFLAGS
1603CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
1604CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
1605CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"
1606
1607if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
1608  pharcmd=pharcmd
1609  pharcmd_install=install-pharcmd
1610else
1611  pharcmd=
1612  pharcmd_install=
1613fi;
1614
1615all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd"
1616install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install"
1617
1618PHP_SUBST(all_targets)
1619PHP_SUBST(install_targets)
1620PHP_SUBST(install_binary_targets)
1621
1622PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
1623PHP_INSTALL_HEADERS([Zend/Optimizer], [ \
1624    zend_call_graph.h \
1625    zend_cfg.h \
1626    zend_dfg.h \
1627    zend_dump.h \
1628    zend_func_info.h \
1629    zend_inference.h \
1630    zend_optimizer.h \
1631    zend_ssa.h])
1632
1633PHP_ADD_SOURCES(TSRM, TSRM.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1634
1635PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c \
1636       fopen_wrappers.c alloca.c  php_scandir.c \
1637       php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
1638       strlcat.c explicit_bzero.c reentrancy.c php_variables.c php_ticks.c \
1639       network.c php_open_temporary_file.c \
1640       output.c getopt.c php_syslog.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1641
1642PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no)
1643
1644PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
1645       plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c \
1646       glob_wrapper.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1647
1648PHP_ADD_SOURCES(/main, internal_functions.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, sapi)
1649PHP_ADD_SOURCES_X(/main, internal_functions_cli.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_BINARY_OBJS)
1650
1651PHP_ADD_SOURCES(Zend, \
1652    zend_language_parser.c zend_language_scanner.c \
1653    zend_ini_parser.c zend_ini_scanner.c \
1654    zend_alloc.c zend_compile.c zend_constants.c zend_dtrace.c \
1655    zend_execute_API.c zend_highlight.c zend_llist.c \
1656    zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
1657    zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
1658    zend_list.c zend_builtin_functions.c zend_attributes.c zend_execute.c \
1659    zend_ini.c zend_sort.c zend_multibyte.c zend_stream.c \
1660    zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
1661    zend_closures.c zend_weakrefs.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
1662    zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
1663    zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c \
1664    zend_observer.c zend_system_id.c zend_enum.c zend_fibers.c zend_max_execution_timer.c \
1665	Optimizer/zend_optimizer.c \
1666	Optimizer/pass1.c \
1667	Optimizer/pass3.c \
1668	Optimizer/optimize_func_calls.c \
1669	Optimizer/block_pass.c \
1670	Optimizer/optimize_temp_vars_5.c \
1671	Optimizer/nop_removal.c \
1672	Optimizer/compact_literals.c \
1673	Optimizer/zend_cfg.c \
1674	Optimizer/zend_dfg.c \
1675	Optimizer/dfa_pass.c \
1676	Optimizer/zend_ssa.c \
1677	Optimizer/zend_inference.c \
1678	Optimizer/zend_func_info.c \
1679	Optimizer/zend_call_graph.c \
1680	Optimizer/sccp.c \
1681	Optimizer/scdf.c \
1682	Optimizer/dce.c \
1683	Optimizer/escape_analysis.c \
1684	Optimizer/compact_vars.c \
1685	Optimizer/zend_dump.c \
1686    , -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1687
1688PHP_ADD_BUILD_DIR(main main/streams)
1689PHP_ADD_BUILD_DIR(TSRM)
1690PHP_ADD_BUILD_DIR(Zend Zend/asm Zend/Optimizer)
1691
1692PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
1693PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
1694
1695PHP_GEN_BUILD_DIRS
1696PHP_GEN_GLOBAL_MAKEFILE
1697
1698AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
1699
1700dnl Make directories when building in a separate build directory.
1701$php_shtool mkdir -p pear
1702$php_shtool mkdir -p scripts
1703$php_shtool mkdir -p scripts/man1
1704
1705ALL_OUTPUT_FILES="main/build-defs.h \
1706scripts/phpize scripts/man1/phpize.1 \
1707scripts/php-config scripts/man1/php-config.1 \
1708$PHP_OUTPUT_FILES"
1709
1710dnl Generate build files.
1711AC_CONFIG_FILES([$ALL_OUTPUT_FILES])
1712
1713AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([main/php_config.h.in])])
1714
1715AC_CONFIG_COMMANDS([default],[
1716cat <<X
1717
1718+--------------------------------------------------------------------+
1719| License:                                                           |
1720| This software is subject to the PHP License, available in this     |
1721| distribution in the file LICENSE. By continuing this installation  |
1722| process, you are bound by the terms of this license agreement.     |
1723| If you do not agree with the terms of this license, you must abort |
1724| the installation process at this point.                            |
1725+--------------------------------------------------------------------+
1726
1727Thank you for using PHP.
1728
1729X
1730],[
1731
1732if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then
1733  REDO_ALL=yes
1734fi
1735
1736dnl Create configuration headers.
1737dnl ----------------------------------------------------------------------------
1738test -d Zend || $php_shtool mkdir Zend
1739
1740cat >Zend/zend_config.h <<FEO
1741#include <../main/php_config.h>
1742FEO
1743
1744dnl Run this only when generating all the files.
1745if test -n "\$REDO_ALL"; then
1746  echo "creating main/internal_functions.c"
1747  AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_STATIC" > main/internal_functions.c
1748
1749  echo "creating main/internal_functions_cli.c"
1750  AWK="$AWK" sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in "$EXT_CLI_STATIC" > main/internal_functions_cli.c
1751
1752    if test "$PHP_SAPI" = "apache2handler"; then
1753      if test "$APACHE_VERSION" -ge 2004001; then
1754        if test -z "$APACHE_THREADED_MPM"; then
1755cat <<X
1756+--------------------------------------------------------------------+
1757|                        *** WARNING ***                             |
1758|                                                                    |
1759| You have built PHP for Apache's current non-threaded MPM.          |
1760| If you change Apache to use a threaded MPM you must reconfigure    |
1761| PHP with --enable-zts                                              |
1762X
1763        fi
1764      fi
1765    fi
1766
1767  dnl Warn about Apache if oci8 extension is enabled on Linux.
1768  if test "$PHP_OCI8" != "no"; then
1769    if test "$PHP_SIGCHILD" != "yes"; then
1770      if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
1771cat <<X
1772+--------------------------------------------------------------------+
1773| Notice:                                                            |
1774| If you encounter <defunc> processes when using a local Oracle      |
1775| database, set the value BEQUEATH_DETACH=YES in Oracle Net's        |
1776| sqlnet.ora file on the PHP host, or set the environment variable   |
1777| BEQUEATH_DETACH to YES before starting Apache.  If the problem     |
1778| still occurs, then recompile PHP and specify --enable-sigchild     |
1779| when configuring.                                                  |
1780X
1781      fi
1782    fi
1783  fi
1784
1785fi
1786])
1787AC_OUTPUT
1788