dnl dnl Copyright (C) 2003 - 2007 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 Lesser General Public License as published by dnl the Free Software Foundation, either version 2.1 of the License, or (at dnl your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public dnl License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public License dnl along with this program. If not, see . dnl 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="-L`$apxs -q LIBDIR` $LDFLAGS" AC_SUBST([apxs]) ]) 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 Try built in APXS support first aprconfig="`$apxs -q APR_CONFIG 2>/dev/null`" apuconfig="`$apxs -q APU_CONFIG 2>/dev/null`" dnl Have to have apr-config and apu-config if test "x$aprconfig" = 'x'; then AC_PATH_PROG([aprconfig],[apr-${apr_cfmjr}config],,["`$apxs -q BINDIR`:$PATH"]) fi if test "x$apuconfig" = 'x'; then AC_PATH_PROG([apuconfig],[apu-${apr_cfmjr}config],,["`$apxs -q BINDIR`:$PATH"]) fi 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`" SPINLIBS="`$aprconfig --link-libtool` $SPINLIBS" APRVMINOR=`$aprconfig --version | cut -f -2 -d '.'` dnl Add APR Util stuff CPPFLAGS="$CPPFLAGS `$apuconfig --includes`" SPINLIBS="`$apuconfig --link-libtool` $SPINLIBS" APUVMINOR=`$apuconfig --version | cut -f -2 -d '.'` AC_SUBST([SPINLIBS]) AC_SUBST([APRVMINOR]) AC_SUBST([APUVMINOR]) AC_SUBST([aprconfig]) AC_SUBST([apuconfig]) ]) 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" SPINLIBS="`$apreq2config --link-libtool` $SPINLIBS" AC_SUBST([SPINLIBS]) dnl Where are the Doxygen tag files? if test "$packager" = 'yes'; then AC_SUBST(APREQ_TAG_FILES_LOCATION, "`$apreq2config --prefix`/share/doc/libapreq2-devel-`$apreq2config --package-version | cut -f 1 -d '-'`") AC_SUBST(APR_TAG_FILES_LOCATION, "`$aprconfig --prefix`/share/doc/apr-`$aprconfig --version`/api-docs") else AC_SUBST(APREQ_TAG_FILES_LOCATION,"`$apreq2config --prefix`/share/libapreq2/docs") AC_SUBST(APR_TAG_FILES_LOCATION,"$APREQ_TAG_FILES_LOCATION") fi AC_SUBST([apreq2config]) ]) 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="$opt $LDFLAGS" fi done AC_SUBST([xml2config],[$xml2config]) ]) 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 We really have to have bison AC_DEFUN([RXV_SPIN_FLEXBISON],[ AC_PROG_YACC if test "$YACC" != 'bison -y'; then AC_MSG_NOTICE([bison missing: existing parser will be used]) AM_CONDITIONAL(NOBISON,true) else AM_CONDITIONAL(NOBISON,false) fi dnl Verify that we have reentrant flex scanner if test "x${flexre}" != 'x'; then AC_PATH_PROG([LEX],[flex],,["${flexre}/bin:$PATH"]) else AC_PATH_PROG([LEX],[flex]) fi if test "x$LEX" = 'x'; then AC_MSG_NOTICE([flex missing: existing scanner will be used]) AM_CONDITIONAL(NOFLEX,true) AM_CONDITIONAL(NORLEX,true) else AM_CONDITIONAL(NOFLEX,false) $LEX -t -R >/dev/null 2>&1 < #include ]]) AC_CHECK_HEADERS([apr_md5.h],,[AC_MSG_ERROR([apr_md5.h header missing])]) AC_CHECK_HEADERS([apr_reslist.h],,[AC_MSG_ERROR([apr_reslist.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.h],,[AC_MSG_ERROR([apreq_module.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([ap_regex.h],,[AC_MSG_ERROR([ap_regex.h header missing])],[[#include ]]) AC_CHECK_HEADERS([ap_mpm.h],,[AC_MSG_ERROR([ap_mpm.h header missing])],[[#include ]]) AC_CHECK_HEADERS([libxml/xmlreader.h],,[AC_MSG_ERROR([xmlreader.h header missing])]) AC_CHECK_HEADERS([libxml/xmlwriter.h],,[AC_MSG_ERROR([xmlwriter.h header missing])]) dnl Checks for library functions. AC_CHECK_FUNCS([malloc strchr]) AC_SUBST([RXV_SPIN_STDC_HEADERS], [`test "$ac_cv_header_stdc" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_UNISTD_H], [`test "$ac_cv_header_unistd_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_SYS_TYPES_H], [`test "$ac_cv_header_sys_types_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_STRINGS_H], [`test "$ac_cv_header_apr_strings_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_POOLS_H], [`test "$ac_cv_header_apr_pools_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_HASH_H], [`test "$ac_cv_header_apr_hash_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_TIME_H], [`test "$ac_cv_header_apr_time_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_DSO_H], [`test "$ac_cv_header_apr_dso_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_BUCKETS_H], [`test "$ac_cv_header_apr_buckets_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APR_DBD_H], [`test "$ac_cv_header_apr_dbd_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APREQ_PARAM_H], [`test "$ac_cv_header_apreq_param_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APREQ_COOKIE_H], [`test "$ac_cv_header_apreq_cookie_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_APREQ_MODULE_H], [`test "$ac_cv_header_apreq_module_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_HTTPD_H], [`test "$ac_cv_header_httpd_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_HTTP_REQUEST_H], [`test "$ac_cv_header_http_request_h" = 'yes' && echo 1 || echo 0`]) AC_SUBST([RXV_SPIN_HAVE_AP_REGEX_H], [`test "$ac_cv_header_ap_regex_h" = 'yes' && echo 1 || echo 0`]) ]) dnl Check APU features AC_DEFUN([RXV_SPIN_APUFEATURES],[ dnl Do we have to fake apr_dbd_get_name function? AC_CHECK_FUNCS(apr_dbd_get_name,,[ dnl Add PostgreSQL configuration AC_PATH_PROG([pgconfig],[pg_config]) if test "x$pgconfig" != 'x'; then CPPFLAGS="$CPPFLAGS -I`$pgconfig --includedir`" LDFLAGS="-L`$pgconfig --libdir` $LDFLAGS" fi dnl Add MySQL configuration AC_PATH_PROG([mysqlconfig],[mysql_config]) if test "x$mysqlconfig" != 'x'; then $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_r`; do if test "x`echo $opt | grep '^-L'`" != 'x'; then LDFLAGS="$opt $LDFLAGS" fi done fi dnl Check for database libraries AC_CHECK_LIB(pq,PQconnectdb) AC_CHECK_LIB(mysqlclient_r,mysql_init) AC_CHECK_LIB(sqlite,sqlite_open) AC_CHECK_LIB(sqlite3,sqlite3_open) dnl Check for database headers AC_CHECK_HEADERS([libpq-fe.h]) AC_CHECK_HEADERS([mysql.h]) AC_CHECK_HEADERS([sqlite.h]) AC_CHECK_HEADERS([sqlite3.h]) ]) AC_CHECK_FUNCS(apr_reslist_acquired_count) ]) 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 ]]) AC_CHECK_HEADERS([util_filter.h],,[AC_MSG_ERROR([util_filter.h header missing])],[[#include ]]) ])