config.m4 4.3 KB

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