config.m4 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. dnl
  2. dnl $Id$
  3. dnl
  4. AC_DEFUN([PHP_APACHE_FD_CHECK], [
  5. AC_CACHE_CHECK([for member fd in BUFF *],ac_cv_php_fd_in_buff,[
  6. save=$CPPFLAGS
  7. if test -n "$APXS_INCLUDEDIR"; then
  8. CPPFLAGS="$CPPFLAGS -I$APXS_INCLUDEDIR"
  9. else
  10. CPPFLAGS="$CPPFLAGS $APACHE_INCLUDE"
  11. fi
  12. AC_TRY_COMPILE([#include <httpd.h>],[conn_rec *c; int fd = c->client->fd;],[
  13. ac_cv_php_fd_in_buff=yes],[ac_cv_php_fd_in_buff=no],[ac_cv_php_fd_in_buff=no])
  14. CPPFLAGS=$save
  15. ])
  16. if test "$ac_cv_php_fd_in_buff" = "yes"; then
  17. AC_DEFINE(PHP_APACHE_HAVE_CLIENT_FD,1,[ ])
  18. fi
  19. ])
  20. dnl Apache 1.x shared module
  21. PHP_ARG_WITH(apache-hooks,,
  22. [ --with-apache-hooks[=FILE]
  23. EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional
  24. pathname to the Apache apxs tool [apxs]], no, no)
  25. AC_MSG_CHECKING([for Apache 1.x (hooks) module support via DSO through APXS])
  26. if test "$PHP_APACHE_HOOKS" != "no"; then
  27. if test "$PHP_APACHE_HOOKS" = "yes"; then
  28. APXS=apxs
  29. $APXS -q CFLAGS >/dev/null 2>&1
  30. if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
  31. APXS=/usr/sbin/apxs
  32. fi
  33. else
  34. PHP_EXPAND_PATH($PHP_APACHE_HOOKS, APXS)
  35. fi
  36. $APXS -q CFLAGS >/dev/null 2>&1
  37. if test "$?" != "0"; then
  38. AC_MSG_RESULT()
  39. AC_MSG_RESULT()
  40. AC_MSG_RESULT([Sorry, I was not able to successfully run APXS. Possible reasons:])
  41. AC_MSG_RESULT()
  42. AC_MSG_RESULT([1. Perl is not installed;])
  43. AC_MSG_RESULT([2. Apache was not compiled with DSO support (--enable-module=so);])
  44. AC_MSG_RESULT([3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs])
  45. AC_MSG_RESULT([The output of $APXS follows])
  46. $APXS -q CFLAGS
  47. AC_MSG_ERROR([Aborting])
  48. fi
  49. APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
  50. APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
  51. APXS_CFLAGS=`$APXS -q CFLAGS`
  52. APXS_HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
  53. APACHE_INCLUDE=-I$APXS_INCLUDEDIR
  54. # Test that we're trying to configure with apache 1.x
  55. PHP_AP_EXTRACT_VERSION($APXS_HTTPD)
  56. if test "$APACHE_VERSION" -ge 2000000; then
  57. AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2])
  58. fi
  59. for flag in $APXS_CFLAGS; do
  60. case $flag in
  61. -D*) APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag";;
  62. esac
  63. done
  64. case $host_alias in
  65. *aix*)
  66. APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
  67. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
  68. PHP_AIX_LDFLAGS="-Wl,-brtl"
  69. build_type=shared
  70. ;;
  71. *darwin*)
  72. MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD"
  73. PHP_SUBST(MH_BUNDLE_FLAGS)
  74. SAPI_SHARED=libs/libphp5.so
  75. build_type=bundle
  76. ;;
  77. *)
  78. build_type=shared
  79. ;;
  80. esac
  81. PHP_SELECT_SAPI(apache_hooks, $build_type, sapi_apache.c mod_php5.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
  82. # Test whether apxs support -S option
  83. $APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1
  84. if test "$?" != "0"; then
  85. APACHE_HOOKS_INSTALL="$APXS -i -a -n php5 $SAPI_SHARED" # Old apxs does not have -S option
  86. else
  87. APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
  88. if test -z `$APXS -q SYSCONFDIR`; then
  89. APACHE_HOOKS_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
  90. $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
  91. -i -n php5 $SAPI_SHARED"
  92. else
  93. APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
  94. APACHE_HOOKS_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
  95. \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
  96. $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
  97. -S SYSCONFDIR='$APXS_SYSCONFDIR' \
  98. -i -a -n php5 $SAPI_SHARED"
  99. fi
  100. fi
  101. if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then
  102. PHP_APXS_BROKEN=yes
  103. fi
  104. STRONGHOLD=
  105. AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
  106. AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
  107. AC_DEFINE(HAVE_APACHE_HOOKS,1,[ ])
  108. AC_MSG_RESULT(yes)
  109. else
  110. AC_MSG_RESULT(no)
  111. fi
  112. dnl Apache 1.x static module
  113. PHP_ARG_WITH(apache-hooks-static,,
  114. [ --with-apache-hooks-static[=DIR]
  115. EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache
  116. build directory [/usr/local/apache]], no, no)
  117. AC_MSG_CHECKING(for Apache 1.x (hooks) module support)
  118. if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$PHP_APACHE_HOOKS_STATIC" != "no"; then
  119. if test "$PHP_APACHE_HOOKS_STATIC" = "yes"; then
  120. # Apache's default directory
  121. PHP_APACHE_HOOKS_STATIC=/usr/local/apache
  122. fi
  123. APACHE_HOOKS_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php5.* sapi/apache_hooks/libphp5.module"
  124. AC_DEFINE(HAVE_APACHE,1,[ ])
  125. APACHE_HOOKS_MODULE=yes
  126. PHP_EXPAND_PATH($PHP_APACHE_HOOKS_STATIC, PHP_APACHE_HOOKS_STATIC)
  127. # For Apache 1.2.x
  128. if test -f $PHP_APACHE_HOOKS_STATIC/src/httpd.h; then
  129. APACHE_INCLUDE=-I$PHP_APACHE_HOOKS_STATIC/src
  130. APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src
  131. PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
  132. APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
  133. PHP_LIBS="-L. -lphp3"
  134. AC_MSG_RESULT([yes - Apache 1.2.x])
  135. STRONGHOLD=
  136. if test -f $PHP_APACHE_HOOKS_STATIC/src/ap_config.h; then
  137. AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
  138. fi
  139. # For Apache 2.0.x
  140. elif test -f $PHP_APACHE_HOOKS_STATIC/include/httpd.h && test -f $PHP_APACHE_HOOKS_STATIC/srclib/apr/include/apr_general.h ; then
  141. AC_MSG_ERROR([Use --with-apxs2 with Apache 2.x!])
  142. # For Apache 1.3.x
  143. elif test -f $PHP_APACHE_HOOKS_STATIC/src/main/httpd.h; then
  144. APACHE_HAS_REGEX=1
  145. APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/main -I$PHP_APACHE_HOOKS_STATIC/src/os/unix -I$PHP_APACHE_HOOKS_STATIC/src/ap"
  146. APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php5
  147. if test ! -d $APACHE_TARGET; then
  148. mkdir $APACHE_TARGET
  149. fi
  150. PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
  151. APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
  152. PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
  153. AC_MSG_RESULT([yes - Apache 1.3.x])
  154. STRONGHOLD=
  155. if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
  156. AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
  157. fi
  158. if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_compat.h; then
  159. AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
  160. if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
  161. AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
  162. fi
  163. elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/compat.h; then
  164. AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
  165. fi
  166. # Also for Apache 1.3.x
  167. elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/httpd.h; then
  168. APACHE_HAS_REGEX=1
  169. APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/include -I$PHP_APACHE_HOOKS_STATIC/src/os/unix"
  170. APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php5
  171. if test ! -d $APACHE_TARGET; then
  172. mkdir $APACHE_TARGET
  173. fi
  174. PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
  175. PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
  176. APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
  177. AC_MSG_RESULT([yes - Apache 1.3.x])
  178. STRONGHOLD=
  179. if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
  180. AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
  181. fi
  182. if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_compat.h; then
  183. AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
  184. if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
  185. AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
  186. fi
  187. elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/compat.h; then
  188. AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
  189. fi
  190. # For StrongHold 2.2
  191. elif test -f $PHP_APACHE_HOOKS_STATIC/apache/httpd.h; then
  192. APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/apache -I$PHP_APACHE_HOOKS_STATIC/ssl/include"
  193. APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/apache
  194. PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
  195. PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
  196. APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
  197. STRONGHOLD=-DSTRONGHOLD=1
  198. AC_MSG_RESULT([yes - StrongHold])
  199. if test -f $PHP_APACHE_HOOKS_STATIC/apache/ap_config.h; then
  200. AC_DEFINE(HAVE_AP_CONFIG_H, 1, [ ])
  201. fi
  202. if test -f $PHP_APACHE_HOOKS_STATIC/src/ap_compat.h; then
  203. AC_DEFINE(HAVE_AP_COMPAT_H, 1, [ ])
  204. if test ! -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config_auto.h; then
  205. AC_MSG_ERROR([Please run Apache\'s configure or src/Configure program once and try again])
  206. fi
  207. elif test -f $PHP_APACHE_HOOKS_STATIC/src/compat.h; then
  208. AC_DEFINE(HAVE_OLD_COMPAT_H, 1, [ ])
  209. fi
  210. else
  211. AC_MSG_RESULT(no)
  212. AC_MSG_ERROR([Invalid Apache directory - unable to find httpd.h under $PHP_APACHE_HOOKS_STATIC])
  213. fi
  214. else
  215. AC_MSG_RESULT(no)
  216. fi
  217. # compatibility
  218. if test -z "$enable_mod_charset" && test "$with_mod_charset"; then
  219. enable_mod_charset=$with_mod_charset
  220. fi
  221. PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option,
  222. [ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no)
  223. if test "$PHP_MOD_CHARSET" = "yes"; then
  224. AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ])
  225. fi
  226. dnl Build as static module
  227. if test "$APACHE_HOOKS_MODULE" = "yes"; then
  228. PHP_TARGET_RDYNAMIC
  229. $php_shtool mkdir -p sapi/apache_hooks
  230. PHP_OUTPUT(sapi/apache_hooks/libphp5.module)
  231. fi
  232. dnl General
  233. if test -n "$APACHE_HOOKS_INSTALL"; then
  234. if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
  235. APXS_EXP=-bE:sapi/apache_hooks/mod_php5.exp
  236. fi
  237. PHP_APACHE_FD_CHECK
  238. INSTALL_IT=$APACHE_HOOKS_INSTALL
  239. PHP_SUBST(APXS_EXP)
  240. PHP_SUBST(APACHE_INCLUDE)
  241. PHP_SUBST(APACHE_TARGET)
  242. PHP_SUBST(APXS)
  243. PHP_SUBST(APXS_LDFLAGS)
  244. PHP_SUBST(APACHE_HOOKS_INSTALL)
  245. PHP_SUBST(STRONGHOLD)
  246. fi
  247. dnl ## Local Variables:
  248. dnl ## tab-width: 4
  249. dnl ## End: