dnl Process this file with autoconf to produce a configure script. AC_INIT(mod_auth_mysql.c) AC_CONFIG_HEADER(config.h) dnl We want this one before the checks, so the checks can modify CFLAGS. test -z "$CFLAGS" && auto_cflags=1 dnl Checks for programs. AC_PROG_CC AC_PROG_CC_C_O AC_PROG_RANLIB dnl Ugly hack to get around a problem with gcc on AIX. if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \ "`uname -sv`" = "AIX 4"; then CFLAGS=`echo $CFLAGS | sed -e 's/-g//'` fi dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary dnl and source packages. This should be harmless on other OSs. dnl if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then CFLAGS="$CFLAGS -I/usr/pkg/include" LDFLAGS="$LDFLAGS -L/usr/pkg/lib" fi AC_CHECK_HEADERS(crypt.h) AC_CHECK_FUNCS(crypt) AC_CHECK_LIB(c, crypt, [:], [ AC_CHECK_LIB(crypt, crypt, [ LIBS="-lcrypt $LIBS" AC_DEFINE(HAVE_LIBCRYPT) ], []) ]) AC_CRYPT_CAP AC_MSG_CHECKING(for Apache module support via DSO through APXS) AC_ARG_WITH(apxs, [ --with-apxs[=FILE] Build shared Apache module. FILE is the optional pathname to the Apache apxs tool; defaults to "apxs". (This option needs Perl installed)], [ if test "$withval" = "yes"; then withval=apxs fi APXS_ON=1 APXS="$withval" APXS_LDFLAGS="@MYSQL_LFLAGS@ @MYSQL_LIBS@" APACHE_INCLUDE="-I`$APXS -q INCLUDEDIR`" INSTALL_IT="\$(APXS) -i -a -n auth_mysql libauth_mysql.so" CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2` LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2` LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2` STRONGHOLD= AC_SUBST(APXS) AC_SUBST(APXS_LDFLAGS) AC_SUBST(INSTALL_IT) AC_DEFINE(HAVE_AP_COMPAT_H) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for Apache module support via DSO through APACI) AC_ARG_WITH(shared-apache, [ --with-shared-apache[=DIR] Build shared Apache module. DIR is the top-level Apache build directory, defaults to /usr/local/etc/httpd. (This option needs Perl installed)], [ if test "$withval" = "yes"; then # Apache's default directory withval=/usr/local/etc/httpd fi DSO_APACI_ON=1 if test "$withval" != "no"; then if test -f $withval/src/include/httpd.h; then APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix" APACHE_TARGET=$withval/src/modules/auth_mysql if test ! -d $APACHE_TARGET; then mkdir $APACHE_TARGET fi CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2` LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2` LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2` INSTALL_IT="mkdir -p $APACHE_TARGET; cp mod_auth_mysql.* *.module $APACHE_TARGET; cp config.h $APACHE_TARGET/auth_mysql_config.h; cp apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp apMakefile.libdir $APACHE_TARGET/Makefile.libdir" AC_MSG_RESULT(yes - Shared Apache 1.3.x) STRONGHOLD= if test -f $withval/src/include/ap_compat.h; then AC_DEFINE(HAVE_AP_COMPAT_H) else if test -f $withval/src/include/compat.h; then AC_DEFINE(HAVE_OLD_COMPAT_H) fi fi else AC_MSG_RESULT(no) AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval/src/include) fi fi AC_SUBST(APACHE_INCLUDE) AC_SUBST(APACHE_TARGET) AC_SUBST(INSTALL_IT) ],[ AC_MSG_RESULT(no) ]) if test "$APACI_DSO_ON" != "1"; then if test "$APXS_ON" != "1"; then AC_MSG_CHECKING(for Apache directory) AC_ARG_WITH(apache, [ --with-apache=DIR Specify Apache directory. DIR is the top-level Apache build directory, defaults to /usr/local/etc/httpd.], [ APACHE_BASE_DIR=$withval AC_MSG_RESULT($APACHE_BASE_DIR) ],[ APACHE_BASE_DIR=/usr/local/etc/httpd AC_MSG_RESULT($APACHE_BASE_DIR) ]) # For Apache 1.2.x if test -f $APACHE_BASE_DIR/src/httpd.h; then APACHE_INCLUDE=-I$APACHE_BASE_DIR/src APACHE_TARGET=$APACHE_BASE_DIR/src INSTALL_IT="mkdir -p $APACHE_TARGET; cp mod_auth_mysql.* *.module $APACHE_TARGET; cp config.h $APACHE_TARGET/auth_mysql_config.h" AC_MSG_RESULT(Detected Apache 1.2.x) STRONGHOLD= APACHE_VERSION=1.2 # For Apache 1.3.x elif test -f $APACHE_BASE_DIR/src/main/httpd.h; then APACHE_INCLUDE="-I$APACHE_BASE_DIR/src/main -I$APACHE_BASE_DIR/src/os/unix -I$APACHE_BASE_DIR/src/ap" APACHE_TARGET=$APACHE_BASE_DIR/src/modules/auth_mysql if test ! -d $APACHE_TARGET; then mkdir $APACHE_TARGET fi INSTALL_IT="mkdir -p $APACHE_TARGET; cp mod_auth_mysql.* *.module $APACHE_TARGET; cp config.h $APACHE_TARGET/auth_mysql_config.h; cp apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp apMakefile.libdir $APACHE_TARGET/Makefile.libdir" AC_MSG_RESULT(Detected Apache 1.3.x) APACHE_VERSION=1.3 STRONGHOLD= if test -f $APACHE_BASE_DIR/src/include/ap_compat.h; then AC_DEFINE(HAVE_AP_COMPAT_H) else if test -f $APACHE_BASE_DIR/src/include/compat.h; then AC_DEFINE(HAVE_OLD_COMPAT_H) fi fi # Also for Apache 1.3.x elif test -f $APACHE_BASE_DIR/src/include/httpd.h; then APACHE_INCLUDE="-I$APACHE_BASE_DIR/src/include -I$APACHE_BASE_DIR/src/os/unix" APACHE_TARGET=$APACHE_BASE_DIR/src/modules/auth_mysql if test ! -d $APACHE_TARGET; then mkdir $APACHE_TARGET fi INSTALL_IT="mkdir -p $APACHE_TARGET; cp mod_auth_mysql.* $APACHE_TARGET; cp apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp config.h $APACHE_TARGET/auth_mysql_config.h; cp apMakefile.libdir $APACHE_TARGET/Makefile.libdir; cp *.module $APACHE_TARGET" AC_MSG_RESULT(Detected Apache 1.3.x) APACHE_VERSION=1.3 STRONGHOLD= if test -f $APACHE_BASE_DIR/src/include/ap_compat.h; then AC_DEFINE(HAVE_AP_COMPAT_H) else if test -f $APACHE_BASE_DIR/src/include/compat.h; then AC_DEFINE(HAVE_OLD_COMPAT_H) fi fi # For StrongHold 2.2 elif test -f $APACHE_BASE_DIR/apache/httpd.h; then APACHE_INCLUDE=-"I$APACHE_BASE_DIR/apache -I$APACHE_BASE_DIR/ssl/include" APACHE_TARGET=$APACHE_BASE_DIR/apache INSTALL_IT="mkdir -p $APACHE_TARGET; cp mod_auth_mysql.* *.module $APACHE_TARGET; cp config.h $APACHE_TARGET/auth_mysql_config.h" STRONGHOLD=-DSTRONGHOLD=1 AC_MSG_RESULT(Detected StrongHold) APACHE_VERSION=1.2 if test -f $APACHE_BASE_DIR/src/ap_compat.h; then AC_DEFINE(HAVE_AP_COMPAT_H) APACHE_VERSION=1.3 else if test -f $APACHE_BASE_DIR/src/compat.h; then AC_DEFINE(HAVE_OLD_COMPAT_H) APACHE_VERSION=1.3 fi fi else AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $APACHE_BASE_DIR) fi AC_SUBST(APACHE_INCLUDE) AC_SUBST(APACHE_TARGET) AC_SUBST(INSTALL_IT) AC_SUBST(STRONGHOLD) fi fi AC_MSG_CHECKING(for MySQL directory) AC_ARG_WITH(mysql, [ --with-mysql=DIR Specify the MySQL installation directory. Default: /usr/local], [ MYSQL_BASE_DIR=$withval AC_MSG_RESULT($withval) ],[ MYSQL_BASE_DIR=/usr/local AC_MSG_RESULT(/usr/local) ]) if test -f $MYSQL_BASE_DIR/include/mysql/mysql.h; then MYSQL_INCDIR=$MYSQL_BASE_DIR/include/mysql MYSQL_LIBDIR=$MYSQL_BASE_DIR/lib/mysql elif test -f $MYSQL_BASE_DIR/include/mysql.h; then MYSQL_INCDIR=$MYSQL_BASE_DIR/include MYSQL_LIBDIR=$MYSQL_BASE_DIR/lib else AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $MYSQL_BASE_DIR) fi MYSQL_INCLUDE=-I$MYSQL_INCDIR MYSQL_LFLAGS=-L$MYSQL_LIBDIR MYSQL_LIBS=-lmysqlclient AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_LFLAGS) AC_SUBST(MYSQL_INCLUDE) dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2. test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O2" dnl If we're using cc on HP-UX, add the -Ae to CFLAGS if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then test -n "$GCC" || CFLAGS="-Ae $CFLAGS" fi dnl *** Commented out - generates slow code and consumes a lot of dnl *** resources during compilation - we need to figure out how dnl *** to supply it only when absolutely necessary dnl If we're using gcc add -fpic to make dl() work on some platforms dnl test -n "$GCC" && CFLAGS="$CFLAGS -fpic" AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_SHLIB) AC_SUBST(LDFLAGS_SHLIB) AC_SUBST(LDFLAGS_SHLIB_EXPORT) if test "$APACHE_VERSION" = "1.2"; then cat > .install_notes < .install_notes <> .install_notes <