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