dnl dnl Copyright (C) 2003 - 2005 Bojan Smojver, Rexursive dnl dnl This program is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public Licence as published by the Free dnl Software Foundation; either version 2 of the Licence, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, but WITHOUT dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licence for dnl more details. dnl dnl You should have received a copy of the GNU General Public Licence along dnl with this program; if not, write to the Free Software Foundation, Inc., 59 dnl Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl Following is the workaround for PACKAGE_* variables from ap_config_auto.h AC_DEFUN([RXV_SPIN_PACKAGE],[ AH_TEMPLATE([RXV_SPIN_PACKAGE_BUGREPORT],[Where to send bug reports]) AH_TEMPLATE([RXV_SPIN_PACKAGE_NAME],[Full name of the package]) AH_TEMPLATE([RXV_SPIN_PACKAGE_STRING],[Full name and version of the package]) AH_TEMPLATE([RXV_SPIN_PACKAGE_TARNAME],[Short name of the package]) AH_TEMPLATE([RXV_SPIN_PACKAGE_VERSION],[Version of the package]) AC_DEFINE_UNQUOTED([RXV_SPIN_PACKAGE_BUGREPORT],["$PACKAGE_BUGREPORT"]) AC_DEFINE_UNQUOTED([RXV_SPIN_PACKAGE_NAME],["$PACKAGE_NAME"]) AC_DEFINE_UNQUOTED([RXV_SPIN_PACKAGE_STRING],["$PACKAGE_STRING"]) AC_DEFINE_UNQUOTED([RXV_SPIN_PACKAGE_TARNAME],["$PACKAGE_TARNAME"]) AC_DEFINE_UNQUOTED([RXV_SPIN_PACKAGE_VERSION],["$PACKAGE_VERSION"]) ]) dnl Signature AC_DEFUN([RXV_SPIN_SIGNATURE],[ AH_TEMPLATE([RXV_SPIN_PACKAGE_SIGNATURE],[Signature of the package]) AC_DEFINE_UNQUOTED([RXV_SPIN_PACKAGE_SIGNATURE],["$PACKAGE/$VERSION"]) ]) dnl Find APXS AC_DEFUN([RXV_SPIN_APXS],[ AC_ARG_WITH([apxs],AC_HELP_STRING([--with-apxs], [location of APache eXtenSion tool (APXS)]), [AC_PATH_PROG([apxs],["`basename $withval`"],, ["`AS_DIRNAME($withval)`"])], [AC_PATH_PROG([apxs],[apxs],, [/usr/sbin:/usr/local/apache2/bin:$PATH])]) if test "x$apxs" = 'x'; then AC_MSG_ERROR([apxs missing]) fi CFLAGS="`$apxs -q CFLAGS` $CFLAGS" CPPFLAGS="$CPPFLAGS -I. -I`$apxs -q INCLUDEDIR`" LDFLAGS="$LDFLAGS -L`$apxs -q LIBDIR`" ]) dnl Static Apache build AC_DEFUN([RXV_SPIN_APACHE],[ AC_ARG_WITH([apache],AC_HELP_STRING([--with-apache], [location of Apache source for static build]), [apache="$withval"],[apache="no"]) AM_CONDITIONAL(STATICBUILD,test "$apache" != 'no') ]) dnl Reentrant Flex AC_DEFUN([RXV_SPIN_FLEXRE],[ AC_ARG_WITH([flex-reentrant],AC_HELP_STRING([--with-flex-reentrant], [location of reentrant flex installation]), [flexre="$withval"],[flexre=""]) ]) dnl Define databases AC_DEFUN([RXV_SPIN_DATABASE],[ AC_ARG_WITH([pgsql],AC_HELP_STRING([--with-pgsql], [build with PostgreSQL support]), [pgsql="$withval"],[pgsql="no"]) AC_ARG_WITH([mysql],AC_HELP_STRING([--with-mysql], [build with MySQL support]), [mysql="$withval"],[mysql="no"]) dnl Add PostgreSQL stuff if configured if test "$pgsql" = 'yes'; then AC_PATH_PROG([pgconfig],[pg_config]) if test "x$pgconfig" = 'x'; then AC_MSG_ERROR([pg_config missing]) fi CPPFLAGS="$CPPFLAGS -I`$pgconfig --includedir`" LDFLAGS="$LDFLAGS -L`$pgconfig --libdir`" fi dnl Add MySQL stuff if configured if test "$mysql" = 'yes'; then AC_PATH_PROG([mysqlconfig],[mysql_config]) if test "x$mysqlconfig" = 'x'; then AC_MSG_ERROR([mysql_config missing]) fi $mysqlconfig --include >/dev/null 2>&1 if test $? -eq 0; then CPPFLAGS="$CPPFLAGS `$mysqlconfig --include`" else CPPFLAGS="$CPPFLAGS `$mysqlconfig --cflags`" fi for opt in `$mysqlconfig --libs`; do if test "x`echo $opt | grep '^-L'`" != 'x'; then LDFLAGS="$LDFLAGS $opt" fi done fi ]) dnl Configuration for mod_spin applications AC_DEFUN([RXV_SPIN_CONFIG],[ AC_PATH_PROG([spinconfig],[rxv_spin-config],,["`$apxs -q BINDIR`:$PATH"]) if test "x$spinconfig" = 'x'; then AC_MSG_ERROR([rxv_spin-config missing]) fi dnl Add rxv_spin stuff CPPFLAGS="$CPPFLAGS -I`$spinconfig --includedir`" LDFLAGS="$LDFLAGS -L`$spinconfig --libdir`" AC_SUBST([rxvspinlibdir],["`$spinconfig --libdir`"]) AC_SUBST([rxvspinacldatadir],["`$spinconfig --acldatadir`"]) ]) dnl Define packager build AC_DEFUN([RXV_SPIN_PACKAGER],[ AC_ARG_ENABLE([packager],AC_HELP_STRING([--enable-packager], [use package tool for installation]), [packager="$enableval"],[packager="no"]) AM_CONDITIONAL(PACKAGERBUILD,test "$packager" = 'yes') ]) dnl APR and APU AC_DEFUN([RXV_SPIN_APRAPU],[ dnl Cater for different APR/APU versions apr_major="`$apxs -q APR_VERSION 2>/dev/null | cut -f 1 -d '.'`" if test "x$apr_major" == 'x'; then apr_major='0' apr_cfmjr='' else apr_cfmjr="${apr_major}-" fi dnl Have to have apr-config and apu-config AC_PATH_PROG([aprconfig],[apr-${apr_cfmjr}config],,["`$apxs -q BINDIR`"]) AC_PATH_PROG([apuconfig],[apu-${apr_cfmjr}config],,["`$apxs -q BINDIR`"]) if test "x$aprconfig" = 'x'; then AC_MSG_ERROR([apr-${apr_cfmjr}config missing]) fi if test "x$apuconfig" = 'x'; then AC_MSG_ERROR([apu-${apr_cfmjr}config missing]) fi dnl Add APR stuff CFLAGS="`$aprconfig --cflags` $CFLAGS" CPPFLAGS="$CPPFLAGS `$aprconfig --cppflags --includes`" for opt in `$aprconfig --ldflags`; do if test "x`echo $opt | grep '^-L'`" != 'x'; then LDFLAGS="$LDFLAGS $opt" fi done dnl Add APR Util stuff CPPFLAGS="$CPPFLAGS `$apuconfig --includes`" for opt in `$apuconfig --ldflags`; do if test "x`echo $opt | grep '^-L'`" != 'x'; then LDFLAGS="$LDFLAGS $opt" fi done APRVMINOR=`$aprconfig --version | cut -f -2 -d '.'` APUVMINOR=`$apuconfig --version | cut -f -2 -d '.'` AC_SUBST([APRVMINOR],[$APRVMINOR]) AC_SUBST([APUVMINOR],[$APUVMINOR]) ]) dnl libapreq2 stuff AC_DEFUN([RXV_SPIN_LIBAPREQ2],[ AC_PATH_PROG([apreq2config],[apreq2-config],,["`$apxs -q BINDIR`:$PATH"]) if test "x$apreq2config" = 'x'; then AC_MSG_ERROR([apreq2-config missing]) fi CPPFLAGS="$CPPFLAGS `$apreq2config --includes` -I`$apxs -q INCLUDEDIR`/apreq2" for opt in `$apreq2config --link-ld`; do if test "x`echo $opt | grep '^-L'`" != 'x'; then LDFLAGS="$LDFLAGS $opt" fi done dnl Where are the Doxygen tag files? if test "$packager" = 'yes'; then AC_SUBST(TAG_FILES_LOCATION, "`$apreq2config --prefix`/share/doc/libapreq2-devel-`$apreq2config --package-version | cut -f 1 -d '-'`") else AC_SUBST(TAG_FILES_LOCATION,"`$apreq2config --prefix`/share/libapreq2/docs") fi ]) dnl libxml2 stuff AC_DEFUN([RXV_SPIN_LIBXML2],[ AC_PATH_PROG([xml2config],[xml2-config]) if test "x$xml2config" = 'x'; then AC_MSG_ERROR([xml2-config missing]) fi CPPFLAGS="$CPPFLAGS `$xml2config --cflags`" for opt in `$xml2config --libs`; do if test "x`echo $opt | grep '^-L'`" != 'x'; then LDFLAGS="$LDFLAGS $opt" fi done ]) AC_DEFUN([RXV_SPIN_KILLQUOTES],[ dnl Kill single quotes, they cause problems CPPFLAGS="`echo $CPPFLAGS | sed -e s,\',,g`" LDFLAGS="`echo $LDFLAGS | sed -e s,\',,g`" ]) dnl We really have to have flex and bison AC_DEFUN([RXV_SPIN_FLEXBISON],[ AC_PROG_YACC if test "$YACC" != 'bison -y'; then AC_MSG_ERROR([bison missing]) fi if test "x${flexre}" != 'x'; then AC_PATH_PROG([LEX],[flex],,["${flexre}/bin:$PATH"]) if test "x$LEX" = 'x'; then AC_MSG_ERROR([flex missing]) fi CPPFLAGS="-I${flexre}/include $CPPFLAGS" LDFLAGS="-L${flexre}/lib $LDFLAGS" AC_CHECK_LIB(fl,main,,[AC_MSG_ERROR([fl library missing])]) else AC_PROG_LEX if test "$LEX" != 'flex'; then AC_MSG_ERROR([flex missing]) fi fi ]) dnl Checks for programs. AC_DEFUN([RXV_SPIN_STDPROGS],[ AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_LN_S AC_PROG_INSTALL AC_PROG_MAKE_SET ]) dnl Checks for libraries. AC_DEFUN([RXV_SPIN_STDLIBS],[ AC_CHECK_LIB(dl,dlopen,,[AC_MSG_ERROR([dl library missing])]) AC_CHECK_LIB(pthread,pthread_create,,[AC_MSG_ERROR([pthread library missing])]) AC_CHECK_LIB(expat,XML_Parse,,[AC_MSG_ERROR([expat library missing])]) AC_CHECK_LIB(gdbm,gdbm_open,,[AC_MSG_ERROR([gdbm library missing])]) AC_CHECK_LIB(db,db_create,,[AC_MSG_ERROR([db library missing])]) AC_CHECK_LIB(crypt,crypt,,[AC_MSG_ERROR([crypt library missing])]) AC_CHECK_LIB(apr-${apr_major},apr_initialize,,[AC_MSG_ERROR([apr-${apr_major} library missing])]) AC_CHECK_LIB(aprutil-${apr_major},apr_brigade_create,,[AC_MSG_ERROR([aprutil-${apr_major} library missing])]) AC_CHECK_LIB(apreq2,apreq_param,,[AC_MSG_ERROR([apreq2 library missing])]) AC_CHECK_LIB(xml2,xmlInitParserCtxt,,[AC_MSG_ERROR([libxml2 library missing])]) if test "$pgsql" = 'yes'; then AC_CHECK_LIB(pq,PQconnectdb,,[AC_MSG_ERROR([pq library missing])]) fi if test "$mysql" = 'yes'; then AC_CHECK_LIB(mysqlclient,mysql_init,,[AC_MSG_ERROR([mysqlclient library missing])]) fi ]) dnl Checks for rxv_spin library AC_DEFUN([RXV_SPIN_SPINLIB],[ AC_CHECK_LIB(rxv_spin,rxv_spin_single,,[AC_MSG_ERROR([rxv_spin library missing])]) ]) dnl Checks for header files. AC_DEFUN([RXV_SPIN_STDHEADERS],[ AC_HEADER_STDC AC_CHECK_HEADERS([apr_general.h],,[AC_MSG_ERROR([apr_general.h header missing])],[[#include ]]) AC_CHECK_HEADERS([apr_strings.h],,[AC_MSG_ERROR([apr_strings.h header missing])]) AC_CHECK_HEADERS([apr.h],,[AC_MSG_ERROR([apr.h header missing])]) AC_CHECK_HEADERS([apr_pools.h],,[AC_MSG_ERROR([apr_pools.h header missing])]) AC_CHECK_HEADERS([apr_buckets.h],,[AC_MSG_ERROR([apr_buckets.h header missing])]) AC_CHECK_HEADERS([apr_file_io.h],,[AC_MSG_ERROR([apr_file_io.h header missing])]) AC_CHECK_HEADERS([apr_hash.h],,[AC_MSG_ERROR([apr_hash.h header missing])]) AC_CHECK_HEADERS([apr_portable.h],,[AC_MSG_ERROR([apr_portable.h header missing])]) AC_CHECK_HEADERS([apr_time.h],,[AC_MSG_ERROR([apr_time.h header missing])]) AC_CHECK_HEADERS([apr_sdbm.h],,[AC_MSG_ERROR([apr_sdbm.h header missing])]) AC_CHECK_HEADERS([apr_md5.h],,[AC_MSG_ERROR([apr_md5.h header missing])]) AC_CHECK_HEADERS([apr_base64.h],,[AC_MSG_ERROR([apr_base64.h header missing])]) AC_CHECK_HEADERS([apreq_param.h],,[AC_MSG_ERROR([apreq_param.h header missing])]) AC_CHECK_HEADERS([apreq_cookie.h],,[AC_MSG_ERROR([apreq_cookie.h header missing])]) AC_CHECK_HEADERS([apreq_module_apache2.h],,[AC_MSG_ERROR([apreq_module_apache2.h header missing])]) AC_CHECK_HEADERS([httpd.h],,[AC_MSG_ERROR([httpd.h header missing])]) AC_CHECK_HEADERS([http_request.h],,[AC_MSG_ERROR([http_request.h header missing])]) AC_CHECK_HEADERS([pcreposix.h]) AC_CHECK_HEADERS([ap_regex.h],,,[[#include ]]) AC_CHECK_HEADERS([libxml/tree.h],,[AC_MSG_ERROR([tree.h header missing])]) AC_CHECK_HEADERS([libxml/parser.h],,[AC_MSG_ERROR([parser.h header missing])]) if test "$pgsql" = 'yes'; then AC_CHECK_HEADERS([libpq-fe.h],,[AC_MSG_ERROR([libpq-fe.h header missing])]) fi if test "$mysql" = 'yes'; then AC_CHECK_HEADERS([mysql.h],,[AC_MSG_ERROR([mysql.h header missing])]) fi dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_TYPE_OFF_T dnl Checks for library functions. AC_CHECK_FUNCS([malloc strchr]) ]) dnl mod_spin private headers AC_DEFUN([RXV_SPIN_PRIVHEADERS],[ AC_CHECK_HEADERS([http_config.h],,[AC_MSG_ERROR([http_config.h header missing])],[[#include ]]) AC_CHECK_HEADERS([http_connection.h],,[AC_MSG_ERROR([http_connection.h header missing])],[[#include ]]) AC_CHECK_HEADERS([http_protocol.h],,[AC_MSG_ERROR([http_core.h header missing])]) AC_CHECK_HEADERS([http_log.h],,[AC_MSG_ERROR([http_log.h header missing])],[[#include ]]) ]) dnl Checks for rxv_spin header AC_DEFUN([RXV_SPIN_SPINHEADER],[ AC_CHECK_HEADERS([rxv_spin.h],,[AC_MSG_ERROR([rxv_spin.h header missing])]) ])