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