config.m4 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. dnl
  2. dnl $Id$
  3. dnl
  4. PHP_ARG_WITH(apxs2,,
  5. [ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional
  6. pathname to the Apache apxs tool [apxs]], no, no)
  7. AC_MSG_CHECKING([for Apache 2.0 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. # 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"
  51. # Test that we're trying to configure with apache 2.x
  52. PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
  53. if test "$APACHE_VERSION" -le 2000000; then
  54. 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)])
  55. elif test "$APACHE_VERSION" -lt 2000044; then
  56. AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required])
  57. fi
  58. APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
  59. if test -z `$APXS -q SYSCONFDIR`; then
  60. INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
  61. $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
  62. -i -n php5"
  63. else
  64. APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
  65. INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
  66. \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
  67. $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
  68. -S SYSCONFDIR='$APXS_SYSCONFDIR' \
  69. -i -a -n php5"
  70. fi
  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_php5.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,
  79. dnl the linker does not recursively look at the bundle loader and
  80. dnl pull in its dependencies. Therefore, we must pull in the APR
  81. dnl and APR-util libraries.
  82. if test -x "$APR_CONFIG"; then
  83. MH_BUNDLE_FLAGS="`$APR_CONFIG --ldflags --link-ld --libs`"
  84. fi
  85. if test -x "$APU_CONFIG"; then
  86. MH_BUNDLE_FLAGS="`$APU_CONFIG --ldflags --link-ld --libs` $MH_BUNDLE_FLAGS"
  87. fi
  88. MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
  89. PHP_SUBST(MH_BUNDLE_FLAGS)
  90. PHP_SELECT_SAPI(apache2handler, bundle, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
  91. SAPI_SHARED=libs/libphp5.so
  92. INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
  93. ;;
  94. *beos*)
  95. if test -f _APP_; then `rm _APP_`; fi
  96. `ln -s $APXS_BINDIR/httpd _APP_`
  97. EXTRA_LIBS="$EXTRA_LIBS _APP_"
  98. PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
  99. INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
  100. ;;
  101. *)
  102. PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
  103. INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
  104. ;;
  105. esac
  106. if test "$APACHE_VERSION" -lt 2004001; then
  107. APXS_MPM=`$APXS -q MPM_NAME`
  108. if test "$APXS_MPM" != "prefork" && test "$APXS_MPM" != "peruser" && test "$APXS_MPM" != "itk"; then
  109. PHP_BUILD_THREAD_SAFE
  110. fi
  111. else
  112. APACHE_THREADED_MPM=`$APXS_HTTPD -V | grep 'threaded:.*yes'`
  113. if test -n "$APACHE_THREADED_MPM"; then
  114. PHP_BUILD_THREAD_SAFE
  115. fi
  116. fi
  117. AC_MSG_RESULT(yes)
  118. PHP_SUBST(APXS)
  119. else
  120. AC_MSG_RESULT(no)
  121. fi
  122. dnl ## Local Variables:
  123. dnl ## tab-width: 4
  124. dnl ## End: