From cf77b61525686330fbc90ac0188597c4ec98e5c3 Mon Sep 17 00:00:00 2001 From: cantor Date: Mon, 2 Apr 2007 19:39:16 +0000 Subject: [PATCH] Upport Apache auto-detect code. git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2212 cb58f699-b61c-0410-a6fe-9272a202ed29 --- configure.ac | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/configure.ac b/configure.ac index d872ba7..94a006c 100644 --- a/configure.ac +++ b/configure.ac @@ -209,6 +209,61 @@ if test ! "$WANT_NSAPI" = "no" ; then WANT_SUBDIRS="$WANT_SUBDIRS nsapi_shib" fi +# +# If no --enable-apache-xx specified +# find a default and fake the specific parameters +# + +# simple macro to peek at an enable or a with +AC_DEFUN([Peek], +if test "[${[$1]_][$2]+set}" = set; then + peekval="${[$1]_[$2]}" + $3 +fi; dnl +) + +AC_MSG_CHECKING(if default apache needed) +need_default=yes +Peek(enable,apache_13,need_default=no) +Peek(enable,apache_20,need_default=no) +Peek(enable,apache_22,need_default=no) +AC_MSG_RESULT($need_default) + +if test "$need_default" = "yes"; then + # find an apxs, then the httpd + xs= + Peek(with,apxs,xs="$peekval") + Peek(with,apxs2,xs="$peekval") + Peek(with,apxs22,xs="$peekval") + if test "x$xs" = "x"; then + AC_PATH_PROGS(xs, apxs2 apxs, + AC_MSG_ERROR(No apxs, no apache found. Try --with-apxs), + [/usr/local/apache2/bin:/usr/local/apache/bin:/usr/sbin:$PATH]) + fi + # ask the daemon for the version and set parameters + AC_MSG_CHECKING(default apache version) + httpd="`$xs -q SBINDIR`/`$xs -q TARGET`" + if test "x$httpd" != "x"; then + v=`$httpd -v|$SED -n -e 's/.*Apache\/\.*//p'` + case $v in + 1.3*) [enable_apache_13]=yes + [with_apxs]=$xs + AC_MSG_RESULT(1.3) + ;; + 2.0*) [enable_apache_20]=yes + [with_apxs2]=$xs + AC_MSG_RESULT(2.0) + ;; + 2.2*) [enable_apache_22]=yes + [with_apxs22]=$xs + AC_MSG_RESULT(2.2) + ;; + *) AC_MSG_ERROR(unusable apache versions: $v. Try setting --with-apxs) + esac + else + AC_MSG_RESULT(cannot determine version. Try setting --with-apxs) + fi +fi # Apache 1.3 (mod_shib_13) # --enable-apache-13 -- 2.1.4