configure.ac 48 KB

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