1PHP_ARG_WITH([apxs2],, 2 [AS_HELP_STRING([[--with-apxs2[=FILE]]], 3 [Build shared Apache 2 handler module. FILE is the optional pathname to 4 the Apache apxs tool [apxs]])], 5 [no], 6 [no]) 7 8AC_MSG_CHECKING([for Apache 2 handler module support via DSO through APXS]) 9 10if test "$PHP_APXS2" != "no"; then 11 if test "$PHP_APXS2" = "yes"; then 12 APXS=apxs 13 $APXS -q CFLAGS >/dev/null 2>&1 14 if test "$?" != "0" && test -x /usr/sbin/apxs; then 15 APXS=/usr/sbin/apxs 16 fi 17 else 18 PHP_EXPAND_PATH($PHP_APXS2, APXS) 19 fi 20 21 $APXS -q CFLAGS >/dev/null 2>&1 22 if test "$?" != "0"; then 23 AC_MSG_RESULT() 24 AC_MSG_RESULT() 25 AC_MSG_RESULT([Sorry, I cannot run apxs. Possible reasons follow:]) 26 AC_MSG_RESULT() 27 AC_MSG_RESULT([1. Perl is not installed]) 28 AC_MSG_RESULT([2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs]) 29 AC_MSG_RESULT([3. Apache was not built using --enable-so (the apxs usage page is displayed)]) 30 AC_MSG_RESULT() 31 AC_MSG_RESULT([The output of $APXS follows:]) 32 $APXS -q CFLAGS 33 AC_MSG_ERROR([Aborting]) 34 fi 35 36 APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR` 37 APXS_BINDIR=`$APXS -q BINDIR` 38 APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET` 39 APXS_CFLAGS=`$APXS -q CFLAGS` 40 APU_BINDIR=`$APXS -q APU_BINDIR` 41 APR_BINDIR=`$APXS -q APR_BINDIR` 42 43 dnl Pick up ap[ru]-N-config if using httpd >=2.1 44 APR_CONFIG=`$APXS -q APR_CONFIG 2>/dev/null || 45 echo $APR_BINDIR/apr-config` 46 APU_CONFIG=`$APXS -q APU_CONFIG 2>/dev/null || 47 echo $APU_BINDIR/apu-config` 48 49 APR_CFLAGS="`$APR_CONFIG --cppflags --includes`" 50 APU_CFLAGS="`$APU_CONFIG --includes`" 51 52 for flag in $APXS_CFLAGS; do 53 case $flag in 54 -D*) APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag";; 55 esac 56 done 57 58 APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" 59 60 dnl Test that we're trying to configure with apache 2.x 61 PHP_AP_EXTRACT_VERSION($APXS_HTTPD) 62 if test "$APACHE_VERSION" -lt 2000044; then 63 AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required]) 64 fi 65 66 APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR` 67 if test -z `$APXS -q SYSCONFDIR`; then 68 INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ 69 $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ 70 -i -n php7" 71 else 72 APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR` 73 INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ 74 \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \ 75 $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ 76 -S SYSCONFDIR='$APXS_SYSCONFDIR' \ 77 -i -a -n php7" 78 fi 79 80 case $host_alias in 81 *aix*) 82 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp" 83 PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) 84 INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" 85 ;; 86 *darwin*) 87 dnl When using bundles on Darwin, we must resolve all symbols. However, the 88 dnl linker does not recursively look at the bundle loader and pull in its 89 dnl dependencies. Therefore, we must pull in the APR and APR-util libraries. 90 if test -x "$APR_CONFIG"; then 91 MH_BUNDLE_FLAGS="`$APR_CONFIG --ldflags --link-ld --libs`" 92 fi 93 if test -x "$APU_CONFIG"; then 94 MH_BUNDLE_FLAGS="`$APU_CONFIG --ldflags --link-ld --libs` $MH_BUNDLE_FLAGS" 95 fi 96 MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS" 97 PHP_SUBST(MH_BUNDLE_FLAGS) 98 PHP_SELECT_SAPI(apache2handler, bundle, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) 99 SAPI_SHARED=libs/libphp7.so 100 INSTALL_IT="$INSTALL_IT $SAPI_SHARED" 101 ;; 102 *) 103 PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) 104 INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" 105 ;; 106 esac 107 108 if test "$APACHE_VERSION" -lt 2004001; then 109 APXS_MPM=`$APXS -q MPM_NAME` 110 if test "$APXS_MPM" != "prefork" && test "$APXS_MPM" != "peruser" && test "$APXS_MPM" != "itk"; then 111 PHP_BUILD_THREAD_SAFE 112 fi 113 else 114 APACHE_THREADED_MPM=`$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes'` 115 if test -n "$APACHE_THREADED_MPM"; then 116 PHP_BUILD_THREAD_SAFE 117 fi 118 fi 119 AC_MSG_RESULT(yes) 120 PHP_SUBST(APXS) 121else 122 AC_MSG_RESULT(no) 123fi 124