xref: /PHP-7.4/configure.ac (revision 0328ff49)
175fb7486SPeter Kokotdnl Process this file with autoconf to produce a configure script.
2257de2baSStig Bakken
34e7064d1SPeter Kokotdnl Include external macro definitions before the AC_INIT to also remove
44e7064d1SPeter Kokotdnl comments starting with # and empty newlines from the included files.
575fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
64e7064d1SPeter Kokotm4_include([build/ax_check_compile_flag.m4])
7beb58ca1SPeter Kokotm4_include([build/ax_func_which_gethostbyname_r.m4])
84e7064d1SPeter Kokotm4_include([build/ax_gcc_func_attribute.m4])
94e7064d1SPeter Kokotm4_include([build/libtool.m4])
104e7064d1SPeter Kokotm4_include([build/php_cxx_compile_stdcxx.m4])
114e7064d1SPeter Kokotm4_include([build/php.m4])
124e7064d1SPeter Kokotm4_include([build/pkg.m4])
131c9e8e8fSPeter Kokotm4_include([TSRM/threads.m4])
141c9e8e8fSPeter Kokotm4_include([TSRM/tsrm.m4])
154e7064d1SPeter Kokot
16f8fb45faSPeter Kokotdnl Basic autoconf initialization, generation of config.nice.
1775fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
18e9111e53SMarko Karppinen
190b0d4b5fSPeter KokotAC_PREREQ([2.68])
20*0328ff49SDerick RethansAC_INIT([PHP],[7.4.20-dev],[https://bugs.php.net],[php],[https://www.php.net])
21afd52f9dSPeter KokotAC_CONFIG_SRCDIR([main/php_version.h])
227e445ef3SPeter KokotAC_CONFIG_AUX_DIR([build])
239bbf9967SPeter KokotAC_PRESERVE_HELP_ORDER
24e9111e53SMarko Karppinen
25e9111e53SMarko KarppinenPHP_CONFIG_NICE(config.nice)
26e9111e53SMarko Karppinen
277a3d9addSfoobarPHP_CANONICAL_HOST_TARGET
28ae78d7d4SMoriyoshi Koizumi
29491f1477SPeter KokotAC_CONFIG_HEADERS([main/php_config.h])
30a6daded1SPeter Kokot
31cc8ecca0SRasmus LerdorfAH_TOP([
328d8d7ed8SRemi Collet#ifndef PHP_CONFIG_H
338d8d7ed8SRemi Collet#define PHP_CONFIG_H
348d8d7ed8SRemi Collet
35cc8ecca0SRasmus Lerdorf#if defined(__GNUC__) && __GNUC__ >= 4
36cc8ecca0SRasmus Lerdorf# define ZEND_API __attribute__ ((visibility("default")))
37cc8ecca0SRasmus Lerdorf# define ZEND_DLEXPORT __attribute__ ((visibility("default")))
38cc8ecca0SRasmus Lerdorf#else
39cc8ecca0SRasmus Lerdorf# define ZEND_API
40cc8ecca0SRasmus Lerdorf# define ZEND_DLEXPORT
41cc8ecca0SRasmus Lerdorf#endif
42cc8ecca0SRasmus Lerdorf
43cc8ecca0SRasmus Lerdorf#define ZEND_DLIMPORT
44cc8ecca0SRasmus Lerdorf])
45cc8ecca0SRasmus LerdorfAH_BOTTOM([
46cc8ecca0SRasmus Lerdorf#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS
47cc8ecca0SRasmus Lerdorf
487dd62811SPeter Kokot#include <stdlib.h>
49cc8ecca0SRasmus Lerdorf
50cc8ecca0SRasmus Lerdorf#ifdef HAVE_SYS_TYPES_H
51cc8ecca0SRasmus Lerdorf# include <sys/types.h>
52cc8ecca0SRasmus Lerdorf#endif
53cc8ecca0SRasmus Lerdorf
54cc8ecca0SRasmus Lerdorf#ifdef HAVE_SYS_SELECT_H
55cc8ecca0SRasmus Lerdorf#include <sys/select.h>
56cc8ecca0SRasmus Lerdorf#endif
57cc8ecca0SRasmus Lerdorf
58cc8ecca0SRasmus Lerdorf#ifdef HAVE_IEEEFP_H
59cc8ecca0SRasmus Lerdorf# include <ieeefp.h>
60cc8ecca0SRasmus Lerdorf#endif
61cc8ecca0SRasmus Lerdorf
62d3ca28f5SPeter Kokot#include <string.h>
63cc8ecca0SRasmus Lerdorf
64251bd9c2SAnatol Belski#if defined(__cplusplus) && __cplusplus >= 201103L
65251bd9c2SAnatol Belskiextern "C++" {
66251bd9c2SAnatol Belski#include <cmath>
67251bd9c2SAnatol Belski#define zend_isnan std::isnan
68251bd9c2SAnatol Belski#define zend_isinf std::isinf
69251bd9c2SAnatol Belski#define zend_finite std::isfinite
70251bd9c2SAnatol Belski}
71251bd9c2SAnatol Belski#else
72cc8ecca0SRasmus Lerdorf#include <math.h>
73cc8ecca0SRasmus Lerdorf
74cc8ecca0SRasmus Lerdorf#ifndef zend_isnan
75251bd9c2SAnatol Belski#if HAVE_DECL_ISNAN
76cc8ecca0SRasmus Lerdorf#define zend_isnan(a) isnan(a)
77cc8ecca0SRasmus Lerdorf#elif defined(HAVE_FPCLASS)
78cc8ecca0SRasmus Lerdorf#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
79cc8ecca0SRasmus Lerdorf#else
8021d78786SAndrea Faulds#define zend_isnan(a) ((a) != (a))
81cc8ecca0SRasmus Lerdorf#endif
82cc8ecca0SRasmus Lerdorf#endif
83cc8ecca0SRasmus Lerdorf
84251bd9c2SAnatol Belski#if HAVE_DECL_ISINF
85cc8ecca0SRasmus Lerdorf#define zend_isinf(a) isinf(a)
86cc8ecca0SRasmus Lerdorf#elif defined(INFINITY)
87cc8ecca0SRasmus Lerdorf/* Might not work, but is required by ISO C99 */
88714d825bSChristian Schmidt#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
89cc8ecca0SRasmus Lerdorf#elif defined(HAVE_FPCLASS)
90cc8ecca0SRasmus Lerdorf#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
91cc8ecca0SRasmus Lerdorf#else
92cc8ecca0SRasmus Lerdorf#define zend_isinf(a) 0
93cc8ecca0SRasmus Lerdorf#endif
94cc8ecca0SRasmus Lerdorf
95251bd9c2SAnatol Belski#if HAVE_DECL_ISFINITE
96cc8ecca0SRasmus Lerdorf#define zend_finite(a) isfinite(a)
9720816401STjerk Meesters#elif defined(HAVE_FINITE)
9820816401STjerk Meesters#define zend_finite(a) finite(a)
99cc8ecca0SRasmus Lerdorf#elif defined(fpclassify)
100cc8ecca0SRasmus Lerdorf#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
101cc8ecca0SRasmus Lerdorf#else
102cc8ecca0SRasmus Lerdorf#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
103cc8ecca0SRasmus Lerdorf#endif
104cc8ecca0SRasmus Lerdorf
105251bd9c2SAnatol Belski#endif
106cc8ecca0SRasmus Lerdorf#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
107cc8ecca0SRasmus Lerdorf
1088d8d7ed8SRemi Collet#endif /* PHP_CONFIG_H */
109cc8ecca0SRasmus Lerdorf])
110e9111e53SMarko Karppinen
111afd52f9dSPeter Kokotac_IFS=$IFS; IFS="."
1120988f696Smaxset $(echo AC_PACKAGE_VERSION | "${SED}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/')
113afd52f9dSPeter KokotIFS=$ac_IFS
114afd52f9dSPeter KokotPHP_MAJOR_VERSION=[$]1
115afd52f9dSPeter KokotPHP_MINOR_VERSION=[$]2
116afd52f9dSPeter KokotPHP_RELEASE_VERSION=[$]3
117afd52f9dSPeter KokotPHP_EXTRA_VERSION=[$]4
1188684e749SJani TaskinenPHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
1198684e749SJani TaskinenPHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
1208684e749SJani Taskinen
12175fb7486SPeter Kokotdnl Allow version values to be used in Makefile.
1228684e749SJani TaskinenPHP_SUBST(PHP_MAJOR_VERSION)
1238684e749SJani TaskinenPHP_SUBST(PHP_MINOR_VERSION)
1248684e749SJani TaskinenPHP_SUBST(PHP_RELEASE_VERSION)
1258684e749SJani TaskinenPHP_SUBST(PHP_EXTRA_VERSION)
126e9111e53SMarko Karppinen
12775fb7486SPeter Kokotdnl Define where extension directories are located in the configure context.
128ae196280SXinchen HuiAC_DEFUN([PHP_EXT_BUILDDIR],[$config_m4_dir])dnl
129ae196280SXinchen HuiAC_DEFUN([PHP_EXT_DIR],[$config_m4_dir])dnl
130ae196280SXinchen HuiAC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir/$config_m4_dir])dnl
13169eec3f3SfoobarAC_DEFUN([PHP_ALWAYS_SHARED],[])dnl
132e9111e53SMarko Karppinen
133e9111e53SMarko Karppinendnl Setting up the PHP version based on the information above.
13475fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
135257de2baSStig Bakken
136d9f52fe0SStig Bakkenecho "/* automatically generated by configure */" > php_version.h.new
1372fe9208eSBrian Evansecho "/* edit configure.ac to change version number */" >> php_version.h.new
1388684e749SJani Taskinenecho "#define PHP_MAJOR_VERSION $PHP_MAJOR_VERSION" >> php_version.h.new
1398684e749SJani Taskinenecho "#define PHP_MINOR_VERSION $PHP_MINOR_VERSION" >> php_version.h.new
1408684e749SJani Taskinenecho "#define PHP_RELEASE_VERSION $PHP_RELEASE_VERSION" >> php_version.h.new
1418684e749SJani Taskinenecho "#define PHP_EXTRA_VERSION \"$PHP_EXTRA_VERSION\"" >> php_version.h.new
142d9f52fe0SStig Bakkenecho "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
1437625313fSfoobarecho "#define PHP_VERSION_ID $PHP_VERSION_ID" >> php_version.h.new
1443cfc8a1eSfoobarcmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1
1454aeb6305SAndrey Hristovif test $? -ne 0 ; then
1467efc1a2eSJani Taskinen  rm -f $srcdir/main/php_version.h && mv php_version.h.new $srcdir/main/php_version.h && \
1477efc1a2eSJani Taskinen  echo 'Updated main/php_version.h'
148257de2baSStig Bakkenelse
1497efc1a2eSJani Taskinen  rm -f php_version.h.new
150257de2baSStig Bakkenfi
151257de2baSStig Bakken
152e9111e53SMarko Karppinendnl Settings we want to make before the checks.
15375fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
154e9111e53SMarko Karppinen
155e9111e53SMarko Karppinenphp_shtool=$srcdir/build/shtool
156e9111e53SMarko KarppinenT_MD=`$php_shtool echo -n -e %B`
157e9111e53SMarko KarppinenT_ME=`$php_shtool echo -n -e %b`
158e9111e53SMarko Karppinen
15970f97c17SfoobarPHP_INIT_BUILD_SYSTEM
16070f97c17Sfoobar
161e9111e53SMarko Karppinendnl We want this one before the checks, so the checks can modify CFLAGS.
162e9111e53SMarko Karppinentest -z "$CFLAGS" && auto_cflags=1
163e9111e53SMarko Karppinen
164e9111e53SMarko Karppinenabs_srcdir=`(cd $srcdir; pwd)`
165e9111e53SMarko Karppinenabs_builddir=`pwd`
166e9111e53SMarko Karppinen
16775fb7486SPeter Kokotdnl Because `make install` is often performed by the superuser, we create the
16875fb7486SPeter Kokotdnl libs subdirectory as the user who configures PHP. Otherwise, the current
16975fb7486SPeter Kokotdnl user will not be able to delete libs or the contents of libs.
170e9111e53SMarko Karppinen
171e9111e53SMarko Karppinen$php_shtool mkdir -p libs
172e9111e53SMarko Karppinenrm -f libs/*
173e9111e53SMarko Karppinen
174e9111e53SMarko Karppinendnl Checks for programs.
17575fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
176e9111e53SMarko Karppinen
1772d031977SEli SchwartzPKG_PROG_PKG_CONFIG
178978129fdSDavid Soria ParraAC_PROG_CC([cc gcc])
179ebef6661SAntony DovgalPHP_DETECT_ICC
18047e909faSDavid Soria ParraPHP_DETECT_SUNCC
181e9111e53SMarko KarppinenAC_PROG_CPP
182b12cece8SPeter KokotAC_USE_SYSTEM_EXTENSIONS
1832a6da0f2SfoobarAC_PROG_LN_S
18460ad61deSfoobar
18575fb7486SPeter Kokotdnl Support systems with system libraries in e.g. /usr/lib64.
1869df6a1e4SPeter KokotPHP_ARG_WITH([libdir],
1879df6a1e4SPeter Kokot  [for system library directory],
1889df6a1e4SPeter Kokot  [AS_HELP_STRING([--with-libdir=NAME],
1899df6a1e4SPeter Kokot    [Look for libraries in .../NAME rather than .../lib])],
1909df6a1e4SPeter Kokot  [lib],
1919df6a1e4SPeter Kokot  [no])
1929df6a1e4SPeter Kokot
1939df6a1e4SPeter KokotPHP_ARG_ENABLE([rpath],
1949df6a1e4SPeter Kokot  [whether to enable runpaths],
1959df6a1e4SPeter Kokot  [AS_HELP_STRING([--disable-rpath],
1969df6a1e4SPeter Kokot    [Disable passing additional runtime library search paths])],
1979df6a1e4SPeter Kokot  [yes],
1989df6a1e4SPeter Kokot  [no])
199c6a7e4caSJani Taskinen
20075fb7486SPeter Kokotdnl Check for -R, etc. switch.
20160ad61deSfoobarPHP_RUNPATH_SWITCH
20260ad61deSfoobar
20375fb7486SPeter Kokotdnl Checks for some support/generator progs.
2042a6da0f2SfoobarPHP_PROG_AWK
2053207741dSPeter KokotPHP_PROG_BISON([3.0.0])
2063207741dSPeter KokotPHP_PROG_RE2C([0.13.4])
2078558c090SJani Taskinen
2089df6a1e4SPeter KokotPHP_ARG_ENABLE([re2c-cgoto],
2099df6a1e4SPeter Kokot  [whether to enable computed goto gcc extension with re2c],
2109df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-re2c-cgoto],
2119df6a1e4SPeter Kokot    [Enable -g flag to re2c to use computed goto gcc extension])],
2129df6a1e4SPeter Kokot  [no],
2139df6a1e4SPeter Kokot  [no])
214af316021SMarcus Boerger
215af316021SMarcus Boergerif test "$PHP_RE2C_CGOTO" = "no"; then
216af316021SMarcus Boerger  RE2C_FLAGS=""
217af316021SMarcus Boergerelse
218af316021SMarcus Boerger  AC_MSG_CHECKING([whether re2c -g works])
2194371945bSPeter Kokot  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
2207efc1a2eSJani Taskinenint main(int argc, const char **argv)
2217efc1a2eSJani Taskinen{
2227efc1a2eSJani Taskinen  argc = argc;
2237efc1a2eSJani Taskinen  argv = argv;
224af316021SMarcus Boergerlabel1:
225af316021SMarcus Boergerlabel2:
2267efc1a2eSJani Taskinen  static void *adr[] = { &&label1, &&label2};
2277efc1a2eSJani Taskinen  goto *adr[0];
2287efc1a2eSJani Taskinen  return 0;
2297efc1a2eSJani Taskinen}
2304371945bSPeter Kokot  ]])],[
231af316021SMarcus Boerger    RE2C_FLAGS=""
232af316021SMarcus Boerger    AC_MSG_RESULT([no])
233af316021SMarcus Boerger  ],[
234af316021SMarcus Boerger    RE2C_FLAGS="-g"
235af316021SMarcus Boerger    AC_MSG_RESULT([yes])
236af316021SMarcus Boerger  ])
237af316021SMarcus Boergerfi
238af316021SMarcus BoergerPHP_SUBST(RE2C_FLAGS)
2394157e50cSfoobar
2402fcd5025Sfoobardnl Platform-specific compile settings.
24175fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
2422fcd5025Sfoobar
243cb5a9f53Sfoobardnl See bug #28605
244cb5a9f53Sfoobarcase $host_cpu in
2457efc1a2eSJani Taskinen  alpha*)
246cb5a9f53Sfoobar    if test "$GCC" = "yes"; then
247cb5a9f53Sfoobar      CFLAGS="$CFLAGS -mieee"
248cb5a9f53Sfoobar    else
249cb5a9f53Sfoobar      CFLAGS="$CFLAGS -ieee"
250cb5a9f53Sfoobar    fi
251cb5a9f53Sfoobar    ;;
25247e909faSDavid Soria Parra  sparc*)
25347e909faSDavid Soria Parra    if test "$SUNCC" = "yes"; then
254e3f76cc8SDavid Soria Parra      CFLAGS="$CFLAGS -xmemalign=8s"
25547e909faSDavid Soria Parra    fi
256e1ae9330SJohannes Schlüter    ;;
257cb5a9f53Sfoobaresac
258cb5a9f53Sfoobar
259086f9adcSMichael Orlitzkydnl Mark symbols hidden by default if the compiler (for example, gcc >= 4)
260086f9adcSMichael Orlitzkydnl supports it. This can help reduce the binary size and startup time.
26156d2147cSXinchen HuiAX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
26256d2147cSXinchen Hui                       [CFLAGS="$CFLAGS -fvisibility=hidden"])
263240fa244SDmitry Stogov
2642fcd5025Sfoobarcase $host_alias in
2657efc1a2eSJani Taskinen  *solaris*)
2662fcd5025Sfoobar    CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
2672fcd5025Sfoobar    if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
2682fcd5025Sfoobar      enable_libgcc=yes
2692fcd5025Sfoobar    fi
2702fcd5025Sfoobar    ;;
2717efc1a2eSJani Taskinen  *dgux*)
2727efc1a2eSJani Taskinen    CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR"
2737efc1a2eSJani Taskinen    ;;
274bde96f29SPeter Kokot  *darwin*)
275ed7c89ccSAntony Dovgal    if test -n "$GCC"; then
276ed7c89ccSAntony Dovgal      PHP_CHECK_GCC_ARG(-no-cpp-precomp, gcc_no_cpp_precomp=yes)
277ed7c89ccSAntony Dovgal      if test "$gcc_no_cpp_precomp" = "yes"; then
278ed7c89ccSAntony Dovgal        CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
279ed7c89ccSAntony Dovgal      fi
280ed7c89ccSAntony Dovgal    fi
2817efc1a2eSJani Taskinen    ;;
2827efc1a2eSJani Taskinen  *mips*)
2837efc1a2eSJani Taskinen    CPPFLAGS="$CPPFLAGS -D_XPG_IV"
2847efc1a2eSJani Taskinen    ;;
2857efc1a2eSJani Taskinen  *hpux*)
286eb0c45d5Sfoobar    if test "$GCC" = "yes"; then
28734805e8dSfoobar      CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
28834805e8dSfoobar    fi
28934805e8dSfoobar    ;;
2902fcd5025Sfoobaresac
2912fcd5025Sfoobar
29275fb7486SPeter Kokotdnl Disable PIC mode by default where it is known to be safe to do so, to avoid
29375fb7486SPeter Kokotdnl the performance hit from the lost register.
29493181062SfoobarAC_MSG_CHECKING([whether to force non-PIC code in shared modules])
29593181062Sfoobarcase $host_alias in
2967efc1a2eSJani Taskinen  i?86-*-linux*|i?86-*-freebsd*)
2976faa433dSfoobar    if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then
29893181062Sfoobar      with_pic=no
29993181062Sfoobar      AC_MSG_RESULT(yes)
30093181062Sfoobar    else
30193181062Sfoobar      AC_MSG_RESULT(no)
30293181062Sfoobar    fi
30393181062Sfoobar    ;;
3047efc1a2eSJani Taskinen  *)
3057efc1a2eSJani Taskinen    AC_MSG_RESULT(no)
3067efc1a2eSJani Taskinen    ;;
30793181062Sfoobaresac
30893181062Sfoobar
3091c9e8e8fSPeter Kokotdnl Include Zend configurations.
31075fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
31155801d53SSascha Schumann
3124d2b0715SZeev Suraskisinclude(Zend/Zend.m4)
313257de2baSStig Bakken
31475fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
315f04936f8SSascha Schumann
316e9111e53SMarko KarppinenPTHREADS_CHECK
317e9111e53SMarko KarppinenPHP_HELP_SEPARATOR([SAPI modules:])
318276171f8SfoobarPHP_SHLIB_SUFFIX_NAMES
319b6e4841eSSascha SchumannPHP_BUILD_PROGRAM
32025aee9caSJani TaskinenPHP_SAPI=none
321e9111e53SMarko Karppinen
322e9111e53SMarko Karppinendnl SAPI configuration.
32375fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
324e9111e53SMarko Karppinen
32575fb7486SPeter Kokotdnl Paths to the targets are relative to the build directory.
3268684e749SJani TaskinenSAPI_SHARED=libs/libphp[]$PHP_MAJOR_VERSION[.]$SHLIB_DL_SUFFIX_NAME
3278684e749SJani TaskinenSAPI_STATIC=libs/libphp[]$PHP_MAJOR_VERSION[.a]
3288684e749SJani TaskinenSAPI_LIBTOOL=libphp[]$PHP_MAJOR_VERSION[.la]
329b6e4841eSSascha Schumann
330b6e4841eSSascha SchumannPHP_CONFIGURE_PART(Configuring SAPI modules)
331b6e4841eSSascha Schumann
33220c43285Sfoobaresyscmd(./build/config-stubs sapi)
333b6e4841eSSascha Schumann
33475fb7486SPeter Kokotdnl Show which main SAPI was selected.
335acb7d69fSfoobarAC_MSG_CHECKING([for chosen SAPI module])
336acb7d69fSfoobarAC_MSG_RESULT([$PHP_SAPI])
337b6e4841eSSascha Schumann
33875fb7486SPeter Kokotdnl Show which binaries were selected.
33925aee9caSJani TaskinenAC_MSG_CHECKING([for executable SAPI binaries])
34025aee9caSJani Taskinenif test "$PHP_BINARIES"; then
34125aee9caSJani Taskinen  AC_MSG_RESULT([$PHP_BINARIES])
34225aee9caSJani Taskinenelse
34325aee9caSJani Taskinen  AC_MSG_RESULT([none])
34425aee9caSJani Taskinenfi
34525aee9caSJani Taskinen
34675fb7486SPeter Kokotdnl Exit early.
34725aee9caSJani Taskinenif test -z "$PHP_INSTALLED_SAPIS"; then
34825aee9caSJani Taskinen  AC_MSG_ERROR([Nothing to build.])
34925aee9caSJani Taskinenfi
35025aee9caSJani Taskinen
35175fb7486SPeter Kokotdnl Force ZTS.
3524c8473d6SZeev Suraskiif test "$enable_maintainer_zts" = "yes"; then
3531c9e8e8fSPeter Kokot  dnl Add pthreads linker and compiler flags.
3541c9e8e8fSPeter Kokot  if test -n "$ac_cv_pthreads_lib"; then
3551c9e8e8fSPeter Kokot    LIBS="$LIBS -l$ac_cv_pthreads_lib"
3561c9e8e8fSPeter Kokot  fi
3571c9e8e8fSPeter Kokot  if test -n "$ac_cv_pthreads_cflags"; then
3581c9e8e8fSPeter Kokot    CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
3591c9e8e8fSPeter Kokot  fi
3601c9e8e8fSPeter Kokot
361b6e4841eSSascha Schumann  PTHREADS_FLAGS
362b6e4841eSSascha Schumannfi
363b6e4841eSSascha Schumann
364e9111e53SMarko Karppinendnl Starting system checks.
36575fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
366257de2baSStig Bakken
367e9111e53SMarko KarppinenPHP_CONFIGURE_PART(Running system checks)
368e9111e53SMarko Karppinen
36975fb7486SPeter Kokotdnl Find sendmail binary.
370e9111e53SMarko KarppinenPHP_PROG_SENDMAIL
3712a6da0f2Sfoobar
37275fb7486SPeter Kokotdnl Check whether the system uses EBCDIC (not ASCII) as its native codeset.
37306e504d3SMartin KraemerPHP_EBCDIC
3742a6da0f2Sfoobar
37575fb7486SPeter Kokotdnl Check whether the system byte ordering is bigendian.
3762a6da0f2SfoobarPHP_C_BIGENDIAN
3772a6da0f2Sfoobar
37875fb7486SPeter Kokotdnl Check whether writing to stdout works.
37943d788ecSAntony DovgalPHP_TEST_WRITE_STDOUT
38043d788ecSAntony Dovgal
38175fb7486SPeter Kokotdnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary and
38275fb7486SPeter Kokotdnl source packages. This should be harmless on other OSs.
383257de2baSStig Bakkenif test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
3847efc1a2eSJani Taskinen   CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
3857efc1a2eSJani Taskinen   LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
386257de2baSStig Bakkenfi
387e9111e53SMarko Karppinentest -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
388257de2baSStig Bakken
389e9111e53SMarko Karppinendnl First, library checks.
39075fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
391e9111e53SMarko Karppinen
39275fb7486SPeter Kokotdnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try to avoid -lnsl
39375fb7486SPeter Kokotdnl checks, if we already have the functions which are usually in libnsl. Also,
39475fb7486SPeter Kokotdnl uClibc will bark at linking with glibc's libnsl.
395ec9612aaSSascha Schumann
396ad198758SSascha SchumannPHP_CHECK_FUNC(socket, socket)
397d10b86f8SWez FurlongPHP_CHECK_FUNC(socketpair, socket)
398ad198758SSascha SchumannPHP_CHECK_FUNC(htonl, socket)
399ad198758SSascha SchumannPHP_CHECK_FUNC(gethostname, nsl)
400ad198758SSascha SchumannPHP_CHECK_FUNC(gethostbyaddr, nsl)
4016bf422d6SSascha SchumannPHP_CHECK_FUNC(dlopen, dl)
4026165c234SNikita PopovPHP_CHECK_FUNC(dlsym, dl)
40365b79b35SSascha Schumannif test "$ac_cv_func_dlopen" = "yes"; then
40465b79b35SSascha Schumann  AC_DEFINE(HAVE_LIBDL, 1, [ ])
40565b79b35SSascha Schumannfi
4065d70fbf6SSascha SchumannAC_CHECK_LIB(m, sin)
407257de2baSStig Bakken
40875fb7486SPeter Kokotdnl Check for inet_aton in -lc, -lbind and -lresolv.
409ad198758SSascha SchumannPHP_CHECK_FUNC(inet_aton, resolv, bind)
4100887298bSDerick Rethans
411e9111e53SMarko Karppinendnl Then headers.
41275fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
413e9111e53SMarko Karppinen
41475fb7486SPeter Kokotdnl QNX requires unix.h to allow functions in libunix to work properly.
415550c2aa8SPeter Kokotdnl locale.h is checked for supporting old code in extensions such as imagick.
416ad198758SSascha SchumannAC_CHECK_HEADERS([ \
41720fce0baSfoobarinttypes.h \
41820fce0baSfoobarstdint.h \
4197429aadfSfoobardirent.h \
42034821ed4SJon Parisesys/param.h \
421ad198758SSascha Schumannsys/types.h \
422ad198758SSascha Schumannsys/time.h \
423ad198758SSascha Schumannnetinet/in.h \
424de5e2a58SSascha Schumannalloca.h \
425a4838358SSascha Schumannarpa/inet.h \
426af5df4c8SScott MacVicararpa/nameser.h \
427a4838358SSascha Schumanncrypt.h \
428af5df4c8SScott MacVicardns.h \
429a4838358SSascha Schumannfcntl.h \
430a4838358SSascha Schumanngrp.h \
4313cb57374Sfoobarieeefp.h \
432f1364ebfSWez Furlonglanginfo.h \
433a4838358SSascha Schumannlocale.h \
4342079b098SPeter Kokotmalloc.h \
435116b06d6SIlia Alshanetskymonetary.h \
4362909e5c9SSascha Schumannnetdb.h \
437d9dfac90SMichael Heimpoldpoll.h \
438a4838358SSascha Schumannpwd.h \
439b2067a18SStephen van Egmondresolv.h \
4402079b098SPeter Kokotstrings.h \
441de5e2a58SSascha Schumannsyslog.h \
44283cf6629SRasmus Lerdorfsysexits.h \
443f73528f0SPeter Seiderersys/auxv.h \
444398b4a2fSWez Furlongsys/ioctl.h \
445a4838358SSascha Schumannsys/file.h \
446a4838358SSascha Schumannsys/mman.h \
447311278f2SJon Parisesys/mount.h \
4489e14ed02SWez Furlongsys/poll.h \
449de5e2a58SSascha Schumannsys/resource.h \
450a4838358SSascha Schumannsys/select.h \
451a4838358SSascha Schumannsys/socket.h \
452305ae11aSDmitry Stogovsys/stat.h \
453a4838358SSascha Schumannsys/statfs.h \
454a4838358SSascha Schumannsys/statvfs.h \
45535de326bSZeev Suraskisys/vfs.h \
45683cf6629SRasmus Lerdorfsys/sysexits.h \
4572079b098SPeter Kokotsys/uio.h \
458a4838358SSascha Schumannsys/wait.h \
459a0371df3SAntony Dovgalsys/loadavg.h \
460398b4a2fSWez Furlongtermios.h \
461a4838358SSascha Schumannunistd.h \
462a4838358SSascha Schumannunix.h \
46323ebf6e9SSascha Schumannutime.h \
46403c82d38SStig Bakkensys/utsname.h \
465e66a760fSDavid Reidsys/ipc.h \
46630dc899cSfoobardlfcn.h \
467cf0fae5eSXinchen Huitmmintrin.h \
468cf0fae5eSXinchen Huinmmintrin.h \
469cf0fae5eSXinchen Huiimmintrin.h
470ad198758SSascha Schumann],[],[],[
47134821ed4SJon Parise#ifdef HAVE_SYS_PARAM_H
47234821ed4SJon Parise#include <sys/param.h>
47334821ed4SJon Parise#endif
474ad198758SSascha Schumann#ifdef HAVE_SYS_TYPES_H
475ad198758SSascha Schumann#include <sys/types.h>
476ad198758SSascha Schumann#endif
477ad198758SSascha Schumann#ifdef HAVE_SYS_TIME_H
478ad198758SSascha Schumann#include <sys/time.h>
479ad198758SSascha Schumann#endif
480ad198758SSascha Schumann#ifdef HAVE_NETINET_IN_H
481ad198758SSascha Schumann#include <netinet/in.h>
482ad198758SSascha Schumann#endif
483ad198758SSascha Schumann#ifdef HAVE_ARPA_NAMESER_H
484ad198758SSascha Schumann#include <arpa/nameser.h>
485ad198758SSascha Schumann#endif
486ad198758SSascha Schumann])
487257de2baSStig Bakken
48858210f92SWez FurlongPHP_FOPENCOOKIE
489cfd04663SWez FurlongPHP_BROKEN_GETCWD
490b117feebSChristoph M. Beckerif test "$GCC" = "yes"; then
491b117feebSChristoph M. Becker  PHP_BROKEN_GCC_STRLEN_OPT
492b117feebSChristoph M. Beckerfi
493e9111e53SMarko Karppinen
494257de2baSStig Bakkendnl Checks for typedefs, structures, and compiler characteristics.
49575fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
496e9111e53SMarko Karppinen
497257de2baSStig BakkenAC_STRUCT_TIMEZONE
498257de2baSStig Bakken
4992a6da0f2SfoobarPHP_MISSING_TIME_R_DECL
5002a6da0f2SfoobarPHP_MISSING_FCLOSE_DECL
501f2f8d38eSSascha SchumannPHP_STRUCT_FLOCK
502bbdbc265SPeter Kokot
503bbdbc265SPeter KokotAC_CHECK_TYPES(socklen_t, [], [], [
504bbdbc265SPeter Kokot  #ifdef HAVE_SYS_TYPES_H
505bbdbc265SPeter Kokot  # include <sys/types.h>
506bbdbc265SPeter Kokot  #endif
507bbdbc265SPeter Kokot  #ifdef HAVE_SYS_SOCKET_H
508bbdbc265SPeter Kokot  # include <sys/socket.h>
509bbdbc265SPeter Kokot  #endif
510bbdbc265SPeter Kokot])
511bec518a6SSascha Schumann
51275fb7486SPeter Kokotdnl These are defined elsewhere than stdio.h.
5133d88f40dSfoobarPHP_CHECK_SIZEOF(intmax_t, 0)
5143d88f40dSfoobarPHP_CHECK_SIZEOF(ssize_t, 8)
5153d88f40dSfoobarPHP_CHECK_SIZEOF(ptrdiff_t, 8)
5163d88f40dSfoobar
51775fb7486SPeter Kokotdnl Check stdint types (must be after header check).
51814caf174SMichael WallnerPHP_CHECK_STDINT_TYPES
51914caf174SMichael Wallner
520017f89e8SLevi Morrisondnl Check __builtin_expect
521017f89e8SLevi MorrisonPHP_CHECK_BUILTIN_EXPECT
52259424bb7SDmitry Stogovdnl Check __builtin_clz
52359424bb7SDmitry StogovPHP_CHECK_BUILTIN_CLZ
52459424bb7SDmitry Stogovdnl Check __builtin_ctzl
52559424bb7SDmitry StogovPHP_CHECK_BUILTIN_CTZL
52659424bb7SDmitry Stogovdnl Check __builtin_ctzll
52759424bb7SDmitry StogovPHP_CHECK_BUILTIN_CTZLL
52875017520SXinchen Huidnl Check __builtin_smull_overflow
52975017520SXinchen HuiPHP_CHECK_BUILTIN_SMULL_OVERFLOW
53075017520SXinchen Huidnl Check __builtin_smulll_overflow
53175017520SXinchen HuiPHP_CHECK_BUILTIN_SMULLL_OVERFLOW
53275017520SXinchen Huidnl Check __builtin_saddl_overflow
53375017520SXinchen HuiPHP_CHECK_BUILTIN_SADDL_OVERFLOW
53475017520SXinchen Huidnl Check __builtin_saddll_overflow
53575017520SXinchen HuiPHP_CHECK_BUILTIN_SADDLL_OVERFLOW
53675017520SXinchen Huidnl Check __builtin_ssubl_overflow
53775017520SXinchen HuiPHP_CHECK_BUILTIN_SSUBL_OVERFLOW
53875017520SXinchen Huidnl Check __builtin_ssubll_overflow
53975017520SXinchen HuiPHP_CHECK_BUILTIN_SSUBLL_OVERFLOW
54008428cf6SXinchen Huidnl Check __builtin_cpu_init
54108428cf6SXinchen HuiPHP_CHECK_BUILTIN_CPU_INIT
54287b71804SXinchen Huidnl Check __builtin_cpu_supports
54387b71804SXinchen HuiPHP_CHECK_BUILTIN_CPU_SUPPORTS
544017f89e8SLevi Morrison
54545131411SNikita Popovdnl Check instructions.
54645131411SNikita PopovPHP_CHECK_CPU_SUPPORTS([ssse3])
54745131411SNikita PopovPHP_CHECK_CPU_SUPPORTS([sse4.2])
54845131411SNikita PopovPHP_CHECK_CPU_SUPPORTS([avx])
54945131411SNikita PopovPHP_CHECK_CPU_SUPPORTS([avx2])
55045131411SNikita Popov
55175fb7486SPeter Kokotdnl Check for structure members.
552a8c3e22dSPeter KokotAC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
553d2184efbSPeter KokotAC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
554499f2ac1SPeter Kokotdnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist.
555257de2baSStig Bakkenif test "`uname -s 2>/dev/null`" != "QNX"; then
5565aed99b4Sfoobar  AC_STRUCT_ST_BLOCKS
557257de2baSStig Bakkenfi
558257de2baSStig Bakken
55975fb7486SPeter Kokotdnl Checks for types.
560257de2baSStig BakkenAC_TYPE_SIZE_T
561257de2baSStig BakkenAC_TYPE_UID_T
562257de2baSStig Bakken
56375fb7486SPeter Kokotdnl Checks for sockaddr_storage and sockaddr.sa_len.
564ec940d4dSfoobarPHP_SOCKADDR_CHECKS
565f8486bc3SWez Furlong
56667352cb2SPeter Kokotdnl Checks for GCC function attributes on all systems except ones without glibc
56775fb7486SPeter Kokotdnl Fix for these systems is already included in GCC 7, but not on GCC 6.
56829158911SNikita Popovdnl
56929158911SNikita Popovdnl At least some versions of FreeBSD seem to have buggy ifunc support, see
57029158911SNikita Popovdnl bug #77284. Conservatively don't use ifuncs on FreeBSD.
571a04fac84SDavid CarlierAS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*|*openbsd*], [true], [
57267352cb2SPeter Kokot  AX_GCC_FUNC_ATTRIBUTE([ifunc])
57367352cb2SPeter Kokot  AX_GCC_FUNC_ATTRIBUTE([target])
57467352cb2SPeter Kokot])
57598aa3a65SXinchen Hui
57675fb7486SPeter Kokotdnl Check for IPv6 support.
5775fc85205SStig VenaasAC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
5784371945bSPeter Kokot[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
5794d17d05dSfoobar#include <sys/socket.h>
5804371945bSPeter Kokot#include <netinet/in.h>]], [[struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;]])],
581a79e2de3SSascha Schumann  [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
582f68fb8faSStig Venaas
583257de2baSStig Bakkendnl Checks for library functions.
58475fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
585e9111e53SMarko Karppinen
5865d70fbf6SSascha SchumannAC_CHECK_FUNCS(
587d59d500aSIlia Alshanetskyalphasort \
58835b30a8dSSascha Schumannasctime_r \
589637e8e14SSascha Schumannchroot \
59035b30a8dSSascha Schumannctime_r \
591d3eff417Sfoobarcrypt \
5927f51257cSDavid Carlierexplicit_memset \
5935d70fbf6SSascha Schumannflock \
5949a3c8e51SPeter Kokotfpclass \
5958d9963b0SWez Furlongftok \
5965029c730SWez Furlongfunopen \
59730441cdaSStig Venaasgai_strerror \
5989a3c8e51SPeter Kokotgetcwd \
599a8be85ceSWez Furlonggetloadavg \
6005d70fbf6SSascha Schumanngetlogin \
60183cf6629SRasmus Lerdorfgetprotobyname \
60283cf6629SRasmus Lerdorfgetprotobynumber \
60316b94858Sfoobargetservbyname \
60416b94858Sfoobargetservbyport \
605da8c6beaSSascha Schumanngetrusage \
6065d70fbf6SSascha Schumanngettimeofday \
60735b30a8dSSascha Schumanngmtime_r \
608466d9ba0SIlia Alshanetskygetpwnam_r \
609466d9ba0SIlia Alshanetskygetgrnam_r \
61078ca1de7SIlia Alshanetskygetpwuid_r \
6119a3c8e51SPeter Kokotgetwd \
6129a3c8e51SPeter Kokotglob \
613398b4a2fSWez Furlonggrantpt \
6141b53a2d1SWez Furlonginet_ntoa \
6151b53a2d1SWez Furlonginet_ntop \
616074ca453SMarko Karppineninet_pton \
61735b30a8dSSascha Schumannlocaltime_r \
618f87e7b8bSDerick Rethanslchown \
6199a3c8e51SPeter Kokotmbrlen \
6205d70fbf6SSascha Schumannmemmove \
62167f59f7bSZeev Suraskimkstemp \
6225d70fbf6SSascha Schumannmmap \
6239a3c8e51SPeter Kokotnice \
624f1364ebfSWez Furlongnl_langinfo \
625ccb5c84bSWez Furlongpoll \
626398b4a2fSWez Furlongptsname \
6275d70fbf6SSascha Schumannputenv \
628f73ee14bSfoobarrealpath \
629524f0b1bSSascha Schumannrand_r \
630d59d500aSIlia Alshanetskyscandir \
6315d70fbf6SSascha Schumannsetitimer \
6326509311eSNuno Lopessetenv \
6335d70fbf6SSascha Schumannshutdown \
6349a3c8e51SPeter Kokotsigprocmask \
6355d70fbf6SSascha Schumannstatfs \
6365d70fbf6SSascha Schumannstatvfs \
6378f58728eSSascha Schumannstd_syslog \
6385d70fbf6SSascha Schumannstrcasecmp \
6399a3c8e51SPeter Kokotstrfmon \
6407c910b94SNuno Lopesstrnlen \
6418f1a327eSSterling Hughesstrptime \
642524f0b1bSSascha Schumannstrtok_r \
6435d70fbf6SSascha Schumannsymlink \
6445d70fbf6SSascha Schumanntzset \
645398b4a2fSWez Furlongunlockpt \
6465d70fbf6SSascha Schumannunsetenv \
6475d70fbf6SSascha Schumannusleep \
6485d70fbf6SSascha Schumannutime \
649ceabdbb4SScott MacVicarvasprintf \
650ceabdbb4SScott MacVicarasprintf \
6514ee578f8SIlia Alshanetskynanosleep \
652622b10f0SAnatol Belskimemmem \
6535d70fbf6SSascha Schumann)
6545d70fbf6SSascha Schumann
655beb58ca1SPeter KokotAX_FUNC_WHICH_GETHOSTBYNAME_R
656beb58ca1SPeter Kokot
65775fb7486SPeter Kokotdnl Some systems (like OpenSolaris) do not have nanosleep in libc.
658444ea3c9SAntony DovgalPHP_CHECK_FUNC_LIB(nanosleep, rt)
65914c70e09SJani Taskinen
66075fb7486SPeter Kokotdnl Check for getaddrinfo, should be a better way, but... Also check for working
66175fb7486SPeter Kokotdnl getaddrinfo.
662f802468cSStig VenaasAC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
6634371945bSPeter Kokot[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
6644371945bSPeter Kokot  [[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
665aa405b7dSNikita Popov#include <string.h>
6661c7d6b22SSara Golemon#include <netdb.h>
6671c7d6b22SSara Golemon#include <sys/types.h>
66899e290f8SWez Furlong#ifndef AF_INET
66999e290f8SWez Furlong# include <sys/socket.h>
67099e290f8SWez Furlong#endif
6711c7d6b22SSara Golemonint main(void) {
6721c7d6b22SSara Golemon  struct addrinfo *ai, *pai, hints;
6731c7d6b22SSara Golemon
6741c7d6b22SSara Golemon  memset(&hints, 0, sizeof(hints));
6751c7d6b22SSara Golemon  hints.ai_flags = AI_NUMERICHOST;
6761c7d6b22SSara Golemon
67764f31205SWez Furlong  if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
678aa405b7dSNikita Popov    return 1;
6791c7d6b22SSara Golemon  }
6801c7d6b22SSara Golemon
68164f31205SWez Furlong  if (ai == 0) {
682aa405b7dSNikita Popov    return 1;
6831c7d6b22SSara Golemon  }
6841c7d6b22SSara Golemon
6851c7d6b22SSara Golemon  pai = ai;
686cf3b8521SPeter Kokot
6871c7d6b22SSara Golemon  while (pai) {
6881c7d6b22SSara Golemon    if (pai->ai_family != AF_INET) {
6891c7d6b22SSara Golemon      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
690aa405b7dSNikita Popov      return 1;
6911c7d6b22SSara Golemon    }
6921c7d6b22SSara Golemon    if (pai->ai_addr->sa_family != AF_INET) {
6931c7d6b22SSara Golemon      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
694aa405b7dSNikita Popov      return 1;
6951c7d6b22SSara Golemon    }
6961c7d6b22SSara Golemon    pai = pai->ai_next;
6971c7d6b22SSara Golemon  }
6981c7d6b22SSara Golemon  freeaddrinfo(ai);
699aa405b7dSNikita Popov  return 0;
7001c7d6b22SSara Golemon}
7014371945bSPeter Kokot  ]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [ac_cv_func_getaddrinfo=no])],
7024371945bSPeter Kokot[ac_cv_func_getaddrinfo=no])])
703f802468cSStig Venaasif test "$ac_cv_func_getaddrinfo" = yes; then
704f802468cSStig Venaas  AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
705f802468cSStig Venaasfi
706f802468cSStig Venaas
70775fb7486SPeter Kokotdnl Check for the __sync_fetch_and_add builtin.
7083d190388SFelipe PenaAC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
7094371945bSPeter Kokot[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[int x;__sync_fetch_and_add(&x,1);]])],[ac_cv_func_sync_fetch_and_add=yes],[ac_cv_func_sync_fetch_and_add=no])])
7103d190388SFelipe Penaif test "$ac_cv_func_sync_fetch_and_add" = yes; then
7113d190388SFelipe Pena  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
7123d190388SFelipe Penafi
7133d190388SFelipe Pena
7142464dbd5SDavid CarlierAC_REPLACE_FUNCS(strlcat strlcpy explicit_bzero getopt)
715257de2baSStig BakkenAC_FUNC_ALLOCA
7163bfe29fdSSascha SchumannPHP_TIME_R_TYPE
7172a6da0f2SfoobarPHP_CHECK_IN_ADDR_T
718e9111e53SMarko Karppinen
719a74c36a3SAntony DovgalAC_CHECK_FUNCS(crypt_r, [ php_crypt_r="1" ], [ php_crypt_r="0" ])
720a74c36a3SAntony Dovgalif test "x$php_crypt_r" = "x1"; then
721a74c36a3SAntony Dovgal  PHP_CRYPT_R_STYLE
722a74c36a3SAntony Dovgalfi
723a74c36a3SAntony Dovgal
724d4bebc87SOndřej SurýAC_CACHE_CHECK([for aarch64 CRC32 API], ac_cv_func___crc32d,
725d4bebc87SOndřej Surý[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arm_acle.h>]],[[__crc32d(0, 0);]])],[ac_cv_func___crc32d=yes],[ac_cv_func___crc32d="no"])])
726d4bebc87SOndřej Surýif test "$ac_cv_func___crc32d" = "yes"; then
727d4bebc87SOndřej Surý  AC_DEFINE([HAVE_AARCH64_CRC32], [1], [Define when aarch64 CRC32 API is available.])
728d4bebc87SOndřej Surýfi
729d4bebc87SOndřej Surý
73075fb7486SPeter Kokotdnl Check for asm goto support.
7314e0b3c0cSDavid CarlierAC_CACHE_CHECK([for asm goto], ac_cv__asm_goto,
7324371945bSPeter Kokot[AC_RUN_IFELSE([AC_LANG_SOURCE([[
7334e0b3c0cSDavid Carlierint main(void) {
734adc3b720SSebastian Pop#if defined(__x86_64__) || defined(__i386__)
7354e0b3c0cSDavid Carlier    __asm__ goto("jmp %l0\n" :::: end);
736adc3b720SSebastian Pop#elif defined(__aarch64__)
737adc3b720SSebastian Pop    __asm__ goto("b %l0\n" :::: end);
738adc3b720SSebastian Pop#endif
7394e0b3c0cSDavid Carlierend:
7404e0b3c0cSDavid Carlier    return 0;
7414e0b3c0cSDavid Carlier}
7424371945bSPeter Kokot  ]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no], [ac_cv__asm_goto=no])])
7434e0b3c0cSDavid Carlier
7444e0b3c0cSDavid Carlierif test "$ac_cv__asm_goto" = yes; then
7454e0b3c0cSDavid Carlier  AC_DEFINE(HAVE_ASM_GOTO,1,[Define if asm goto support])
7464e0b3c0cSDavid Carlierfi
7474e0b3c0cSDavid Carlier
74875fb7486SPeter Kokotdnl Check valgrind support.
7499df6a1e4SPeter KokotPHP_ARG_WITH([valgrind],
7509df6a1e4SPeter Kokot  [whether to enable valgrind support],
751ef34e00dSHugh McMaster  [AS_HELP_STRING([--with-valgrind],
7529df6a1e4SPeter Kokot    [Enable valgrind support])],
7539df6a1e4SPeter Kokot  [yes],
7549df6a1e4SPeter Kokot  [no])
75525ba60b1SMichael Heimpold
75625ba60b1SMichael Heimpoldif test "$PHP_VALGRIND" != "no"; then
757ef34e00dSHugh McMaster  PKG_CHECK_MODULES([VALGRIND], [valgrind], [have_valgrind="yes"], [have_valgrind="no"])
75825ba60b1SMichael Heimpold
759ef34e00dSHugh McMaster  if test "$have_valgrind" = "yes"; then
760ef34e00dSHugh McMaster    PHP_EVAL_INCLINE($VALGRIND_CFLAGS)
761ef34e00dSHugh McMaster    AC_DEFINE(HAVE_VALGRIND, 1, [ ])
76225ba60b1SMichael Heimpold  else
763ef34e00dSHugh McMaster    if test "$with_valgrind" = "yes"; then
764ef34e00dSHugh McMaster      AC_MSG_ERROR([Valgrind not found. Please install Valgrind.])
76525ba60b1SMichael Heimpold    fi
76625ba60b1SMichael Heimpold  fi
76725ba60b1SMichael Heimpoldfi
768fc1ae1d1SDmitry Stogov
769e9111e53SMarko Karppinendnl General settings.
77075fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
7712f676485SfoobarPHP_CONFIGURE_PART(General settings)
772e9111e53SMarko Karppinen
7738a8741a1SfoobarPHP_HELP_SEPARATOR([General settings:])
774f2f8d38eSSascha Schumann
7759df6a1e4SPeter KokotPHP_ARG_ENABLE([gcov],
7769df6a1e4SPeter Kokot  [whether to include gcov symbols],
7779df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-gcov],
7783718a955SNikita Popov    [Enable GCOV code coverage - FOR DEVELOPERS ONLY!!])],
7799df6a1e4SPeter Kokot  [no],
7809df6a1e4SPeter Kokot  [no])
78130dc899cSfoobar
78230dc899cSfoobarif test "$PHP_GCOV" = "yes"; then
78330dc899cSfoobar
78430dc899cSfoobar  if test "$GCC" != "yes"; then
78530dc899cSfoobar    AC_MSG_ERROR([GCC is required for --enable-gcov])
78630dc899cSfoobar  fi
787cf3b8521SPeter Kokot
78875fb7486SPeter Kokot  dnl Check if ccache is being used.
7895b6cc7d9Sfoobar  case `$php_shtool path $CC` in
7905b6cc7d9Sfoobar    *ccache*[)] gcc_ccache=yes;;
7915b6cc7d9Sfoobar    *[)] gcc_ccache=no;;
7925b6cc7d9Sfoobar  esac
7935b6cc7d9Sfoobar
7945b6cc7d9Sfoobar  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
7955b6cc7d9Sfoobar    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
79630dc899cSfoobar  fi
797cf3b8521SPeter Kokot
79830dc899cSfoobar  AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
7992957651cSPeter Kokot  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/build/Makefile.gcov, $abs_srcdir)
80030dc899cSfoobar
80175fb7486SPeter Kokot  dnl Remove all optimization flags from CFLAGS.
80230dc899cSfoobar  changequote({,})
8030988f696Smax  CFLAGS=`echo "$CFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
8040988f696Smax  CXXFLAGS=`echo "$CXXFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
80530dc899cSfoobar  changequote([,])
80630dc899cSfoobar
80775fb7486SPeter Kokot  dnl Add the special gcc flags.
80830dc899cSfoobar  CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
809f36b3ca9SAntony Dovgal  CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
81030dc899cSfoobarfi
81130dc899cSfoobar
8129df6a1e4SPeter KokotPHP_ARG_ENABLE([debug],
8139df6a1e4SPeter Kokot  [whether to include debugging symbols],
8149df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-debug],
8159df6a1e4SPeter Kokot    [Compile with debugging symbols])],
8169df6a1e4SPeter Kokot  [no],
8179df6a1e4SPeter Kokot  [no])
818a4c484a4SSascha Schumann
819724e4e22SSascha Schumannif test "$PHP_DEBUG" = "yes"; then
820bc29ceefSZeev Suraski  PHP_DEBUG=1
821a4c484a4SSascha Schumann  ZEND_DEBUG=yes
8226c75d829SAntony Dovgal  changequote({,})
8230988f696Smax  CFLAGS=`echo "$CFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
8240988f696Smax  CXXFLAGS=`echo "$CXXFLAGS" | "${SED}" -e 's/-O[0-9s]*//g'`
8256c75d829SAntony Dovgal  changequote([,])
82675fb7486SPeter Kokot  dnl Add -O0 only if GCC or ICC is used.
827ebef6661SAntony Dovgal  if test "$GCC" = "yes" || test "$ICC" = "yes"; then
828309a56f3SJani Taskinen    CFLAGS="$CFLAGS -O0"
829580c5121SAntony Dovgal    CXXFLAGS="$CXXFLAGS -g -O0"
830ebef6661SAntony Dovgal  fi
83147e909faSDavid Soria Parra  if test "$SUNCC" = "yes"; then
832fe8d326dSDavid Soria Parra    if test -n "$auto_cflags"; then
83347e909faSDavid Soria Parra      CFLAGS="-g"
83447e909faSDavid Soria Parra      CXXFLAGS="-g"
83547e909faSDavid Soria Parra    else
83647e909faSDavid Soria Parra      CFLAGS="$CFLAGS -g"
83747e909faSDavid Soria Parra      CXXFLAGS="$CFLAGS -g"
83847e909faSDavid Soria Parra    fi
83947e909faSDavid Soria Parra  fi
840a4c484a4SSascha Schumannelse
841a4c484a4SSascha Schumann  PHP_DEBUG=0
842a4c484a4SSascha Schumann  ZEND_DEBUG=no
843a4c484a4SSascha Schumannfi
844a4c484a4SSascha Schumann
845d633cbacSRemi ColletPHP_ARG_ENABLE([rtld-now],
846d633cbacSRemi Collet  [whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
847d633cbacSRemi Collet  [AS_HELP_STRING([--enable-rtld-now],
848d633cbacSRemi Collet    [Use dlopen with RTLD_NOW instead of RTLD_LAZY])],
849d633cbacSRemi Collet  [no],
850d633cbacSRemi Collet  [no])
851d633cbacSRemi Collet
852d633cbacSRemi Colletif test "$PHP_RTLD_NOW" = "yes"; then
853d633cbacSRemi Collet  AC_DEFINE(PHP_USE_RTLD_NOW, 1, [ Use dlopen with RTLD_NOW instead of RTLD_LAZY ])
854d633cbacSRemi Colletfi
855d633cbacSRemi Collet
8569df6a1e4SPeter KokotPHP_ARG_WITH([layout],
8579df6a1e4SPeter Kokot  [layout of installed files],
8589df6a1e4SPeter Kokot  [AS_HELP_STRING([--with-layout=TYPE],
8599df6a1e4SPeter Kokot    [Set how installed files will be laid out. Type can be either PHP or GNU [PHP]])],
8609df6a1e4SPeter Kokot  [PHP],
8619df6a1e4SPeter Kokot  [no])
862553df412SStig Bakken
86353cfce6bSfoobarcase $PHP_LAYOUT in
86453cfce6bSfoobar  GNU)
86553cfce6bSfoobar    oldstyleextdir=no
86653cfce6bSfoobar    ;;
86753cfce6bSfoobar  *)
86853cfce6bSfoobar    oldstyleextdir=yes
86953cfce6bSfoobar    ;;
87053cfce6bSfoobaresac
87153cfce6bSfoobar
8729df6a1e4SPeter KokotPHP_ARG_WITH([config-file-path],
8739df6a1e4SPeter Kokot  [path to configuration file],
8749df6a1e4SPeter Kokot  [AS_HELP_STRING([--with-config-file-path=PATH],
8759df6a1e4SPeter Kokot    [Set the path in which to look for php.ini [PREFIX/lib]])],
8769df6a1e4SPeter Kokot  [DEFAULT],
8779df6a1e4SPeter Kokot  [no])
878553df412SStig Bakken
8799982ff56SSascha Schumannif test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
880553df412SStig Bakken  case $PHP_LAYOUT in
881dd9792bfSStig Bakken    GNU)
8829982ff56SSascha Schumann      PHP_CONFIG_FILE_PATH=$sysconfdir
88353cfce6bSfoobar      ;;
884dd9792bfSStig Bakken    *)
8859982ff56SSascha Schumann      PHP_CONFIG_FILE_PATH=$libdir
88653cfce6bSfoobar      ;;
887553df412SStig Bakken  esac
888553df412SStig Bakkenfi
889553df412SStig Bakken
890eb923bf6SJani TaskinenAC_MSG_CHECKING([where to scan for configuration files])
8919df6a1e4SPeter KokotPHP_ARG_WITH([config-file-scan-dir],,
8929df6a1e4SPeter Kokot  [AS_HELP_STRING([--with-config-file-scan-dir=PATH],
8939df6a1e4SPeter Kokot    [Set the path where to scan for configuration files])],
8949df6a1e4SPeter Kokot  [DEFAULT],
8959df6a1e4SPeter Kokot  [no])
8969df6a1e4SPeter Kokot
897989a61edSRasmus Lerdorfif test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then
8987f1e8292Sfoobar  PHP_CONFIG_FILE_SCAN_DIR=
899989a61edSRasmus Lerdorffi
900eb923bf6SJani TaskinenAC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR])
901989a61edSRasmus Lerdorf
902a4c484a4SSascha Schumanntest -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
903257de2baSStig Bakken
9049df6a1e4SPeter KokotPHP_ARG_ENABLE([sigchild],
9059df6a1e4SPeter Kokot  [whether to enable PHP's own SIGCHLD handler],
9069df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-sigchild],
9079df6a1e4SPeter Kokot    [Enable PHP's own SIGCHLD handler])],
9089df6a1e4SPeter Kokot  [no],
9099df6a1e4SPeter Kokot  [no])
910674f4bacSThies C. Arntzen
911674f4bacSThies C. Arntzenif test "$PHP_SIGCHILD" = "yes"; then
912e49ad341SSascha Schumann  AC_DEFINE(PHP_SIGCHILD, 1, [ ])
913674f4bacSThies C. Arntzenelse
914e49ad341SSascha Schumann  AC_DEFINE(PHP_SIGCHILD, 0, [ ])
915674f4bacSThies C. Arntzenfi
916674f4bacSThies C. Arntzen
9179df6a1e4SPeter KokotPHP_ARG_ENABLE([libgcc],
9189df6a1e4SPeter Kokot  [whether to explicitly link against libgcc],
9199df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-libgcc],
9209df6a1e4SPeter Kokot    [Enable explicitly linking against libgcc])],
9219df6a1e4SPeter Kokot  [no],
9229df6a1e4SPeter Kokot  [no])
9231e31b775SSascha Schumann
9241e31b775SSascha Schumannif test "$PHP_LIBGCC" = "yes"; then
9251e31b775SSascha Schumann  PHP_LIBGCC_LIBPATH(gcc)
9261e31b775SSascha Schumann  if test -z "$libgcc_libpath"; then
927acb7d69fSfoobar    AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path])
928df42e494SSascha Schumann  fi
9298a26918eSfoobar  PHP_ADD_LIBPATH($libgcc_libpath)
9308a26918eSfoobar  PHP_ADD_LIBRARY(gcc, yes)
9311e31b775SSascha Schumannfi
932df42e494SSascha Schumann
9339df6a1e4SPeter KokotPHP_ARG_ENABLE([short-tags],
9349df6a1e4SPeter Kokot  [whether to enable short tags by default],
9359df6a1e4SPeter Kokot  [AS_HELP_STRING([--disable-short-tags],
9369df6a1e4SPeter Kokot    [Disable the short-form <? start tag by default])],
9379df6a1e4SPeter Kokot  [yes],
9389df6a1e4SPeter Kokot  [no])
939257de2baSStig Bakken
940e49ad341SSascha Schumannif test "$PHP_SHORT_TAGS" = "yes"; then
941eb923bf6SJani Taskinen  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "1", [ ])
942e49ad341SSascha Schumannelse
943eb923bf6SJani Taskinen  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "0", [ ])
944e49ad341SSascha Schumannfi
945e49ad341SSascha Schumann
9469df6a1e4SPeter KokotPHP_ARG_ENABLE([dmalloc],
9479df6a1e4SPeter Kokot  [whether to enable dmalloc],
9489df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-dmalloc],
9499df6a1e4SPeter Kokot    [Enable dmalloc])],
9509df6a1e4SPeter Kokot  [no],
9519df6a1e4SPeter Kokot  [no])
952e49ad341SSascha Schumann
953e49ad341SSascha Schumannif test "$PHP_DMALLOC" = "yes"; then
954e74c4e0aSfoobar  AC_CHECK_LIB(dmalloc, dmalloc_error, [
955e74c4e0aSfoobar    PHP_ADD_LIBRARY(dmalloc)
956e74c4e0aSfoobar    AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
957e74c4e0aSfoobar    CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
958e74c4e0aSfoobar  ], [
959acb7d69fSfoobar    AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.])
960e74c4e0aSfoobar  ])
961e49ad341SSascha Schumannfi
962e49ad341SSascha Schumann
9639df6a1e4SPeter KokotPHP_ARG_ENABLE([ipv6],
9649df6a1e4SPeter Kokot  [whether to enable IPv6 support],
9659df6a1e4SPeter Kokot  [AS_HELP_STRING([--disable-ipv6],
9669df6a1e4SPeter Kokot    [Disable IPv6 support])],
9679df6a1e4SPeter Kokot  [yes],
9689df6a1e4SPeter Kokot  [no])
969fcc03805SStig Venaas
970fcc03805SStig Venaasif test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
971eb923bf6SJani Taskinen  AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
972fcc03805SStig Venaasfi
973fcc03805SStig Venaas
97475fb7486SPeter Kokotdnl DTRACE checks. Note: this has to be done after SAPI configuration.
9759df6a1e4SPeter KokotPHP_ARG_ENABLE([dtrace],
9769df6a1e4SPeter Kokot  [whether to enable DTrace support],
9779df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-dtrace],
9789df6a1e4SPeter Kokot    [Enable DTrace support])],
9799df6a1e4SPeter Kokot  [no],
9809df6a1e4SPeter Kokot  [no])
98108b9fdc8SDavid Soria Parra
98208b9fdc8SDavid Soria Parraif test "$PHP_DTRACE" = "yes"; then
983e68ffa09SAntony Dovgal  AC_CHECK_HEADERS([sys/sdt.h], [
984200dcee2SJani Taskinen    PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \
985e68ffa09SAntony Dovgal      Zend/zend_execute.c Zend/zend_exceptions.c \
986e68ffa09SAntony Dovgal      Zend/zend_dtrace.c Zend/zend.c])
987e68ffa09SAntony Dovgal    AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
988200dcee2SJani Taskinen    PHP_SUBST(PHP_DTRACE_OBJS)
989e68ffa09SAntony Dovgal  ], [
990e68ffa09SAntony Dovgal    AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support])
991e68ffa09SAntony Dovgal  ])
99208b9fdc8SDavid Soria Parrafi
99308b9fdc8SDavid Soria Parra
99499e290f8SWez FurlongAC_MSG_CHECKING([how big to make fd sets])
9959df6a1e4SPeter KokotPHP_ARG_ENABLE([fd-setsize],,
9969df6a1e4SPeter Kokot  [AS_HELP_STRING([--enable-fd-setsize],
9979df6a1e4SPeter Kokot    [Set size of descriptor sets])],
9989df6a1e4SPeter Kokot  [no],
9999df6a1e4SPeter Kokot  [no])
1000eb923bf6SJani Taskinen
1001921eb893SJani Taskinenif test "$PHP_FD_SETSIZE" != "no"; then
1002921eb893SJani Taskinen  if test "0$PHP_FD_SETSIZE" -gt 0 2>/dev/null; then
1003921eb893SJani Taskinen    CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$PHP_FD_SETSIZE"
1004921eb893SJani Taskinen    AC_MSG_RESULT([using $PHP_FD_SETSIZE])
1005921eb893SJani Taskinen  else
1006921eb893SJani Taskinen    AC_MSG_ERROR([Invalid value passed to --enable-fd-setsize!])
1007921eb893SJani Taskinen  fi
1008eb923bf6SJani Taskinenelse
1009eb923bf6SJani Taskinen  AC_MSG_RESULT([using system default])
1010eb923bf6SJani Taskinenfi
101199e290f8SWez Furlong
101233e8a7b3SNikita PopovPHP_ARG_ENABLE([werror],,
101333e8a7b3SNikita Popov  [AS_HELP_STRING([--enable-werror],
101433e8a7b3SNikita Popov    [Enable -Werror])],
101533e8a7b3SNikita Popov  [no],
101633e8a7b3SNikita Popov  [no])
101733e8a7b3SNikita Popov
1018e9111e53SMarko Karppinendnl Extension configuration.
101975fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
1020e9111e53SMarko Karppinen
10218a8741a1SfoobarPHP_HELP_SEPARATOR([Extensions:
10228a8741a1Sfoobar
10238a8741a1Sfoobar  --with-EXTENSION=[shared[,PATH]]
1024cf3b8521SPeter Kokot
10258a8741a1Sfoobar    NOTE: Not all extensions can be build as 'shared'.
10268a8741a1Sfoobar
10278a8741a1Sfoobar    Example: --with-foobar=shared,/usr/local/foobar/
10288a8741a1Sfoobar
10298a8741a1Sfoobar      o Builds the foobar extension as shared extension.
10308a8741a1Sfoobar      o foobar package install prefix is /usr/local/foobar/
10318a8741a1Sfoobar])
10321e2474b1SStig Bakken
1033f2f8d38eSSascha SchumannPHP_CONFIGURE_PART(Configuring extensions)
10345f20be73Sfoobar
103575fb7486SPeter Kokotdnl Check if all enabled by default extensions should be disabled.
10369df6a1e4SPeter KokotAC_ARG_ENABLE([all],
10379df6a1e4SPeter Kokot  [AS_HELP_STRING([--disable-all],
10389df6a1e4SPeter Kokot    [Disable all extensions which are enabled by default])],
10399df6a1e4SPeter Kokot  [PHP_ENABLE_ALL=$enableval])
10403bf75192Sfoobar
104175fb7486SPeter Kokotdnl Reading config stubs.
104220c43285Sfoobaresyscmd(./build/config-stubs ext)
1043e9111e53SMarko Karppinen
104475fb7486SPeter Kokotdnl Extensions post-config.
104575fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
1046e9111e53SMarko Karppinen
1047ce44cd3bSDmitry Stogovdnl Align segments on huge page boundary
1048ce44cd3bSDmitry Stogovcase $host_alias in
1049ce44cd3bSDmitry Stogov  i[[3456]]86-*-linux-* | x86_64-*-linux-*)
1050ce44cd3bSDmitry Stogov	AC_MSG_CHECKING(linker support for -zcommon-page-size=2097152)
1051ce44cd3bSDmitry Stogov    save_LDFLAGS=$LDFLAGS
1052ce44cd3bSDmitry Stogov    LDFLAGS="$LDFLAGS -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
1053ce44cd3bSDmitry Stogov    AC_RUN_IFELSE(
1054ce44cd3bSDmitry Stogov        [AC_LANG_SOURCE([[int main() {return 0;}]])],
1055ce44cd3bSDmitry Stogov        [ac_cv_common_page_size=yes],
1056ce44cd3bSDmitry Stogov        [ac_cv_common_page_size=no],
1057ce44cd3bSDmitry Stogov        [ac_cv_common_page_size=no])
1058ce44cd3bSDmitry Stogov    LDFLAGS=$save_LDFLAGS
1059ce44cd3bSDmitry Stogov    if test "$ac_cv_common_page_size" = "yes"; then
1060ce44cd3bSDmitry Stogov        AC_MSG_RESULT([yes])
1061ce44cd3bSDmitry Stogov        EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
1062ce44cd3bSDmitry Stogov    else
1063ce44cd3bSDmitry Stogov        AC_MSG_RESULT([no])
1064ce44cd3bSDmitry Stogov        AC_MSG_CHECKING(linker support for -zmax-page-size=2097152)
1065ce44cd3bSDmitry Stogov        save_LDFLAGS=$LDFLAGS
1066ce44cd3bSDmitry Stogov        LDFLAGS="$LDFLAGS -Wl,-zmax-page-size=2097152"
1067ce44cd3bSDmitry Stogov        AC_RUN_IFELSE(
1068ce44cd3bSDmitry Stogov            [AC_LANG_SOURCE([[int main() {return 0;}]])],
1069ce44cd3bSDmitry Stogov            [ac_cv_max_page_size=yes],
1070ce44cd3bSDmitry Stogov            [ac_cv_max_page_size=no],
1071ce44cd3bSDmitry Stogov            [ac_cv_max_page_size=no])
1072ce44cd3bSDmitry Stogov        LDFLAGS=$save_LDFLAGS
1073ce44cd3bSDmitry Stogov        if test "$ac_cv_max_page_size" = "yes"; then
1074ce44cd3bSDmitry Stogov            AC_MSG_RESULT([yes])
1075ce44cd3bSDmitry Stogov            EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM -Wl,-zmax-page-size=2097152"
1076ce44cd3bSDmitry Stogov        else
1077ce44cd3bSDmitry Stogov            AC_MSG_RESULT([no])
1078ce44cd3bSDmitry Stogov        fi
1079ce44cd3bSDmitry Stogov    fi
1080ce44cd3bSDmitry Stogov    ;;
1081ce44cd3bSDmitry Stogovesac
1082ce44cd3bSDmitry Stogov
1083232afa48SSascha Schumannenable_shared=yes
1084232afa48SSascha Schumannenable_static=yes
1085232afa48SSascha Schumann
108625aee9caSJani Taskinencase $php_sapi_module in
108725aee9caSJani Taskinen  shared[)]
108833958ccbSDmitry Stogov    enable_static=no
10896faa433dSfoobar    case $with_pic in
10907efc1a2eSJani Taskinen      yes)
10917efc1a2eSJani Taskinen        standard_libtool_flag='-prefer-pic'
10927efc1a2eSJani Taskinen        ;;
10937efc1a2eSJani Taskinen      no)
10947efc1a2eSJani Taskinen        standard_libtool_flag='-prefer-non-pic'
10957efc1a2eSJani Taskinen        ;;
10966faa433dSfoobar    esac
10975745f861SSascha Schumann    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
10987efc1a2eSJani Taskinen    ;;
109925aee9caSJani Taskinen  *[)]
110025aee9caSJani Taskinen    standard_libtool_flag='-prefer-non-pic -static'
110125aee9caSJani Taskinen    if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then
110225aee9caSJani Taskinen      enable_shared=no
110325aee9caSJani Taskinen    fi
110425aee9caSJani Taskinen    ;;
1105232afa48SSascha Schumannesac
1106232afa48SSascha Schumann
1107c4d84aa3SAdam DickmeissEXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
1108f9f4644aSfoobar
110975fb7486SPeter Kokotdnl This has to be here to prevent the openssl crypt() from overriding the
111075fb7486SPeter Kokotdnl system provided crypt().
1111f9f4644aSfoobarif test "$ac_cv_lib_crypt_crypt" = "yes"; then
1112f9f4644aSfoobar  EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt"
1113f9f4644aSfoobarfi
1114f9f4644aSfoobar
111516450418SJani Taskinenunset LIBS LDFLAGS
1116e9111e53SMarko Karppinen
11178dca948cSfoobardnl PEAR
111875fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
11198dca948cSfoobar
11208dca948cSfoobarPHP_HELP_SEPARATOR([PEAR:])
11218dca948cSfoobarPHP_CONFIGURE_PART(Configuring PEAR)
11228dca948cSfoobar
112375fb7486SPeter Kokotdnl Compatibility
11248dca948cSfoobarif test -z "$with_pear" && test "$enable_pear" = "no"; then
11258dca948cSfoobar  with_pear=no
11268dca948cSfoobarfi
11278dca948cSfoobar
112875fb7486SPeter Kokotdnl If CLI is disabled disable PEAR.
1129eb923bf6SJani Taskinenif test "$PHP_CLI" = "no"; then
1130066d1b4dSfoobar  with_pear=no
1131066d1b4dSfoobarfi
1132066d1b4dSfoobar
11339df6a1e4SPeter KokotPHP_ARG_WITH([pear],
11349df6a1e4SPeter Kokot  [whether to install PEAR],
11359df6a1e4SPeter Kokot  [AS_HELP_STRING([[--with-pear[=DIR]]],
11369df6a1e4SPeter Kokot    [Install PEAR in DIR [PREFIX/lib/php]])],
11379df6a1e4SPeter Kokot  [no],
11389df6a1e4SPeter Kokot  [yes])
11398dca948cSfoobar
11408dca948cSfoobarif test "$PHP_PEAR" != "no"; then
11418dca948cSfoobar
114275fb7486SPeter Kokot  dnl PEAR dependencies.
11438dca948cSfoobar  if test "$PHP_XML" = "no"; then
1144cf3b8521SPeter Kokot    pear_error_msg="$pear_error_msg
1145066d1b4dSfoobar                    PEAR requires XML to be enabled.     Add --enable-xml to the configure line. (or --without-pear)"
11468dca948cSfoobar  fi
114711eeb0c3Sfoobar
11488dca948cSfoobar  if test "$pear_error_msg"; then
11498dca948cSfoobar    AC_MSG_ERROR([$pear_error_msg])
11508dca948cSfoobar  fi
11518dca948cSfoobar
1152e93d6d97SNikita Popov  AC_MSG_WARN([The --with-pear option is deprecated])
1153e93d6d97SNikita Popov
11548dca948cSfoobar  install_pear="install-pear"
11558dca948cSfoobar  PEAR_INSTALLDIR=$PHP_PEAR
11568dca948cSfoobar
1157e93d6d97SNikita Popov  if test "$PHP_PEAR" = "yes"; then
11588dca948cSfoobar    case $PHP_LAYOUT in
11598dca948cSfoobar      GNU) PEAR_INSTALLDIR=$datadir/pear;;
11608dca948cSfoobar      *)   PEAR_INSTALLDIR=$libdir/php;;
11618dca948cSfoobar    esac
11628dca948cSfoobar  fi
1163066d1b4dSfoobar
1164066d1b4dSfoobar  PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear)
11658dca948cSfoobarfi
11668dca948cSfoobar
1167e9111e53SMarko Karppinendnl Configuring Zend and TSRM.
116875fb7486SPeter Kokotdnl ----------------------------------------------------------------------------
1169e9111e53SMarko Karppinen
1170db50cd25SfoobarPHP_HELP_SEPARATOR([Zend:])
1171f2f8d38eSSascha SchumannPHP_CONFIGURE_PART(Configuring Zend)
1172db50cd25Sfoobar
1173a4c484a4SSascha SchumannLIBZEND_BASIC_CHECKS
11746bf422d6SSascha SchumannLIBZEND_DLSYM_CHECK
1175a4c484a4SSascha SchumannLIBZEND_OTHER_CHECKS
1176a4c484a4SSascha Schumann
11774c8473d6SZeev Suraskiif test "$ZEND_MAINTAINER_ZTS" = "yes"; then
1178e49ad341SSascha Schumann  AC_DEFINE(ZTS,1,[ ])
1179e4812c0fSSascha Schumann  PHP_THREAD_SAFETY=yes
1180e4812c0fSSascha Schumannelse
1181e4812c0fSSascha Schumann  PHP_THREAD_SAFETY=no
1182b416e577SSascha Schumannfi
1183b416e577SSascha Schumann
118437d1a4f9SfoobarINCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
118537d1a4f9SfoobarINCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
118637d1a4f9Sfoobar
1187a31237a2SSascha Schumannif test "$abs_srcdir" != "$abs_builddir"; then
118884f8310eSSascha Schumann  INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
118948b11896SDerick Rethans  INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
1190a31237a2SSascha Schumannfi
1191a31237a2SSascha Schumann
1192c4d84aa3SAdam DickmeissZEND_EXTRA_LIBS="$LIBS"
119316450418SJani Taskinenunset LIBS LDFLAGS
11947ee05bc6SAndi Gutmans
1195db50cd25SfoobarPHP_HELP_SEPARATOR([TSRM:])
11967ee05bc6SAndi GutmansPHP_CONFIGURE_PART(Configuring TSRM)
11975f3d9359SAndi Gutmansif test "$PHP_THREAD_SAFETY" = "yes"; then
1198622b7208SAndi Gutmans  TSRM_THREADS_CHECKS
11995f3d9359SAndi Gutmansfi
12002a6da0f2Sfoobar
12017ee05bc6SAndi GutmansEXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
1202ca18b631SfoobarEXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS"
12037ee05bc6SAndi GutmansEXTRA_LIBS="$EXTRA_LIBS $LIBS"
120416450418SJani Taskinenunset LIBS LDFLAGS
120523e5aeddSSascha Schumann
12063748d807SPeter KokotAC_ARG_PROGRAM
12073748d807SPeter Kokot
12089982ff56SSascha Schumanntest "$prefix" = "NONE" && prefix=/usr/local
12092cf1b8d3SStig Bakkentest "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
1210e01ab8c9Sfoobartest "$program_prefix" = "NONE" && program_prefix=
1211e01ab8c9Sfoobartest "$program_suffix" = "NONE" && program_suffix=
1212dd9792bfSStig Bakken
12132cf1b8d3SStig Bakkencase $libdir in
1214553df412SStig Bakken  '${exec_prefix}/lib')
12159982ff56SSascha Schumann    libdir=$libdir/php
1216553df412SStig Bakken    ;;
12172cf1b8d3SStig Bakkenesac
121883db7753SFerenc Kovacscase `eval echo $datadir` in
1219553df412SStig Bakken  '${prefix}/share')
12209982ff56SSascha Schumann    datadir=$datadir/php
1221553df412SStig Bakken    ;;
12222cf1b8d3SStig Bakkenesac
1223a88946c7SSascha Schumann
12249982ff56SSascha Schumannphplibdir=`pwd`/modules
1225553df412SStig Bakken$php_shtool mkdir -p $phplibdir
12269982ff56SSascha Schumannphptempdir=`pwd`/libs
12272cf1b8d3SStig Bakken
12289982ff56SSascha Schumannold_exec_prefix=$exec_prefix
12299982ff56SSascha Schumannold_libdir=$libdir
12309982ff56SSascha Schumannold_datadir=$datadir
12312cf1b8d3SStig Bakkenexec_prefix=`eval echo $exec_prefix`
12322cf1b8d3SStig Bakkenlibdir=`eval echo $libdir`
123383db7753SFerenc Kovacsdatadir=`eval eval echo $datadir`
1234553df412SStig Bakken
123575fb7486SPeter Kokotdnl Build extension directory path.
12360988f696SmaxZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|"${SED}" 's/#define ZEND_MODULE_API_NO //'`
1237553df412SStig Bakken
12389982ff56SSascha Schumannif test -z "$EXTENSION_DIR"; then
12399982ff56SSascha Schumann  extbasedir=$ZEND_MODULE_API_NO
1240553df412SStig Bakken  if test "$oldstyleextdir" = "yes"; then
1241553df412SStig Bakken    if test "$PHP_DEBUG" = "1"; then
12429982ff56SSascha Schumann      part1=debug
1243553df412SStig Bakken    else
12449982ff56SSascha Schumann      part1=no-debug
1245553df412SStig Bakken    fi
12464c8473d6SZeev Suraski    if test "$enable_maintainer_zts" = "yes"; then
12479982ff56SSascha Schumann      part2=zts
1248553df412SStig Bakken    else
12499982ff56SSascha Schumann      part2=non-zts
1250553df412SStig Bakken    fi
12519982ff56SSascha Schumann    extbasedir=$part1-$part2-$extbasedir
12525aed99b4Sfoobar    EXTENSION_DIR=$libdir/extensions/$extbasedir
1253553df412SStig Bakken  else
12544c8473d6SZeev Suraski    if test "$enable_maintainer_zts" = "yes"; then
12555aed99b4Sfoobar      extbasedir=$extbasedir-zts
12565aed99b4Sfoobar    fi
1257cf3b8521SPeter Kokot
12585aed99b4Sfoobar    if test "$PHP_DEBUG" = "1"; then
12595aed99b4Sfoobar      extbasedir=$extbasedir-debug
12605aed99b4Sfoobar    fi
12615aed99b4Sfoobar    EXTENSION_DIR=$libdir/$extbasedir
1262553df412SStig Bakken  fi
1263553df412SStig Bakkenfi
1264553df412SStig Bakken
12659f761958SAntony Dovgalcase $PHP_LAYOUT in
12669f761958SAntony Dovgal  GNU)
12679f761958SAntony Dovgal    datarootdir=$prefix/share
12689f761958SAntony Dovgal    ;;
12699f761958SAntony Dovgal  *)
12709f761958SAntony Dovgal    datarootdir=$prefix/php
12719f761958SAntony Dovgal    ;;
12729f761958SAntony Dovgalesac
12739f761958SAntony Dovgal
127475fb7486SPeter Kokotdnl Expand all directory names for use in macros/constants.
12752cf1b8d3SStig BakkenEXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
12762cf1b8d3SStig BakkenEXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
12772cf1b8d3SStig BakkenEXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
12782cf1b8d3SStig BakkenEXPANDED_BINDIR=`eval echo $bindir`
12794e10081fSJani TaskinenEXPANDED_SBINDIR=`eval echo $sbindir`
1280e9bc3652SHannes MagnussonEXPANDED_MANDIR=`eval echo $mandir`
12819982ff56SSascha SchumannEXPANDED_LIBDIR=$libdir
12822cf1b8d3SStig BakkenEXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
12839982ff56SSascha SchumannEXPANDED_DATADIR=$datadir
12842cf1b8d3SStig BakkenEXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
1285989a61edSRasmus LerdorfEXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
12869982ff56SSascha SchumannINCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
12872cf1b8d3SStig Bakken
12889982ff56SSascha Schumannexec_prefix=$old_exec_prefix
12899982ff56SSascha Schumannlibdir=$old_libdir
12909982ff56SSascha Schumanndatadir=$old_datadir
12912cf1b8d3SStig Bakken
12922cf1b8d3SStig BakkenAC_SUBST(INCLUDE_PATH)
12932cf1b8d3SStig BakkenAC_SUBST(EXPANDED_PEAR_INSTALLDIR)
12942cf1b8d3SStig BakkenAC_SUBST(EXPANDED_EXTENSION_DIR)
12952cf1b8d3SStig BakkenAC_SUBST(EXPANDED_BINDIR)
12964e10081fSJani TaskinenAC_SUBST(EXPANDED_SBINDIR)
1297e9bc3652SHannes MagnussonAC_SUBST(EXPANDED_MANDIR)
12982cf1b8d3SStig BakkenAC_SUBST(EXPANDED_LIBDIR)
12992cf1b8d3SStig BakkenAC_SUBST(EXPANDED_DATADIR)
13002cf1b8d3SStig BakkenAC_SUBST(EXPANDED_SYSCONFDIR)
13012cf1b8d3SStig BakkenAC_SUBST(EXPANDED_LOCALSTATEDIR)
13022cf1b8d3SStig BakkenAC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
1303989a61edSRasmus LerdorfAC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR)
13047bb67a62SStig Bakken
13052ad1a1e7SSascha Schumannif test -n "$php_ldflags_add_usr_lib"; then
13062ad1a1e7SSascha Schumann  PHP_RPATHS="$PHP_RPATHS /usr/lib"
13072ad1a1e7SSascha Schumannfi
13082ad1a1e7SSascha Schumann
1309aef27e37SSascha SchumannPHP_UTILIZE_RPATHS
1310f2a090c6SSascha Schumann
13112ad1a1e7SSascha Schumannif test -z "$php_ldflags_add_usr_lib"; then
13122ad1a1e7SSascha Schumann  PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
13132ad1a1e7SSascha Schumann  PHP_REMOVE_USR_LIB(LDFLAGS)
13142ad1a1e7SSascha Schumannfi
13158f3ebfe4SSascha Schumann
13167ac99e5aSSascha SchumannEXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
1317ca18b631SfoobarEXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
1318fca9539dSSascha Schumann
131975fb7486SPeter Kokotdnl SOURCE_DATE_EPOCH for reproducible builds
132075fb7486SPeter Kokotdnl https://reproducible-builds.org/specs/source-date-epoch/
132160ac2558SAnatol BelskiPHP_BUILD_DATE=`date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d 2>/dev/null`
132260ac2558