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