Annotation of embedaddon/php/sapi/apache_hooks/config.m4, revision 1.1.1.3

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>