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_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 dnl 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 dnl Test that we're trying to configure with apache 2.x 60 PHP_AP_EXTRACT_VERSION($APXS_HTTPD) 61 if test "$APACHE_VERSION" -lt 2000044; then 62 AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required]) 63 fi 64 65 APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR` 66 if test -z `$APXS -q SYSCONFDIR`; then 67 INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ 68 $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ 69 -i -n php" 70 else 71 APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR` 72 INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ 73 \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \ 74 $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ 75 -S SYSCONFDIR='$APXS_SYSCONFDIR' \ 76 -i -a -n php" 77 fi 78 79 LIBPHP_CFLAGS="-shared" 80 PHP_SUBST(LIBPHP_CFLAGS) 81 82 case $host_alias in 83 *aix*) 84 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp" 85 PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) 86 INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL" 87 ;; 88 *darwin*) 89 dnl When using bundles on Darwin, we must resolve all symbols. However, the 90 dnl linker does not recursively look at the bundle loader and pull in its 91 dnl dependencies. Therefore, we must pull in the APR 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_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS) 101 SAPI_SHARED=libs/libphp.so 102 INSTALL_IT="$INSTALL_IT $SAPI_SHARED" 103 ;; 104 *) 105 PHP_SELECT_SAPI(apache2handler, shared, mod_php.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 2>/dev/null | 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