config.m4 4.6 KB

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