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