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