You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jani Averbach <ja...@cc.jyu.fi> on 2002/10/23 02:06:57 UTC

[PATCH]: #911 ac-helper/svn-apache.m4 detect version of Apache

Hi!

Here is a small patch that complements my previous ac-helper/apr.m4 patch.
With these two I suppose that it is possible to detect version of Apache
and apr (and apr-util after there is --version for it).
Therefore both part of bug #911 are handled.

I have tested this against --with-apxs and --with-apache, and it seems
to work.

Log:

* ac-helper/svn-apache.m4: Check version of Apache by inspecting
  ap_release.h file. It is found by apxs or --with-apache.
  Accepted version is controlled by ap_<min|max>_patch_level which define
  lower and upper bound for the Apache's version.


Index: ac-helpers/svn-apache.m4
===================================================================
--- ac-helpers/svn-apache.m4	(revision 3445)
+++ ac-helpers/svn-apache.m4	(working copy)
@@ -8,6 +8,55 @@
 dnl       source dir, we cannot create static builds of the system.
 dnl

+dnl
+dnl Check Apache's version by inspecting ap_release.h file
+dnl
+AC_DEFUN(SVN_CHECK_APACHE_VERSION,[
+
+   ap_min_patch_level=41
+   ap_max_patch_level=45
+
+   ap_release_h="$1"
+   if test ! -r "$ap_release_h"; then
+      	dnl Same logic here than SVN_FIND_APACHE - wrong place, then just bail
+      	AC_MSG_ERROR([no - Unable to locate $ap_release_h])
+   else
+	ap_major_version=`grep '#define AP_SERVER_MAJORVERSION ' $ap_release_h | sed --silent 's/#define  *AP_SERVER_MAJORVERSION  *"\([0-9][0-9]*\)"/\1/p'`
+	ap_minor_version=`grep '#define AP_SERVER_MINORVERSION ' $ap_release_h | sed --silent 's/#define  *AP_SERVER_MINORVERSION  *"\([0-9][0-9]*\)"/\1/p'`
+	ap_patch_level_all=`grep '#define AP_SERVER_PATCHLEVEL ' $ap_release_h | sed --silent 's/#define  *AP_SERVER_PATCHLEVEL  *"\([0-9][0-9]*.*\)"/\1/p'`
+        ap_patch_level=`echo $ap_patch_level_all | sed --silent 's/\([[0-9]][[0-9]]*\).*/\1/p'`
+
+        ap_version="$ap_major_version.$ap_minor_version.$ap_patch_level_all"
+        ap_version_status="bad"
+
+        if test -z "$ap_major_version"; then
+            :
+        elif test "$ap_major_version" -eq 2; then
+            if test -z "$ap_minor_version"; then
+                :
+            elif test "$ap_minor_version" -eq 0; then
+                if test -z "$ap_patch_level"; then
+                    :
+                elif test "$ap_patch_level" -ge $ap_min_patch_level -a "$ap_patch_level" -le $ap_max_patch_level; then
+                    dnl We won't accept 2.0.44-dev if we want at least 2.0.44
+                    if test "$ap_patch_level" -eq "$ap_min_patch_level"; then
+                        if test "$ap_patch_level" = "$ap_patch_level_all"; then
+                            ap_version_status="good"
+                        fi
+                    else
+                        ap_version_status="good"
+                    fi
+                fi
+            fi
+        fi
+        if test $ap_version_status != "good"; then
+                AC_MSG_ERROR([Need apache version between 2.0.$ap_min_patch_level and 2.0.$ap_max_patch_level, you have $ap_version])
+        else
+            AC_MSG_RESULT(yes - Apache $ap_version)
+        fi
+   fi
+])
+
 AC_DEFUN(SVN_FIND_APACHE,[

 AC_MSG_CHECKING(for static Apache module support)
@@ -27,10 +76,11 @@
 		INSTALL_APACHE_RULE=install-mods-static
 		BINNAME=mod_dav_svn.a

-  		AC_MSG_RESULT(yes - Apache 2.0.x)
+                dnl this will print result for ac_msg_checking
+                SVN_CHECK_APACHE_VERSION($withval/include/ap_release.h)

                 if test ! -r $withval/srclib/apr/include/apr.h; then
-                        AC_MSG_WARN(Apache 2.0.x is not configured)
+                        AC_MSG_WARN(Apache is not configured)
                 fi
 	else
 		dnl if they pointed us at the wrong place, then just bail
@@ -69,7 +119,9 @@
 if test -n "$APXS" -a "$APXS" != "no"; then
     APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
     if test -r $APXS_INCLUDE/mod_dav.h; then
-        AC_MSG_RESULT(found at $APXS)
+        dnl this will print result for ac_msg_checking
+        SVN_CHECK_APACHE_VERSION($APXS_INCLUDE/ap_release.h)
+
     elif test "$APXS_EXPLICIT" != ""; then
 	AC_MSG_ERROR(no - APXS refers to an old version of Apache
                      Unable to locate $APXS_INCLUDE/mod_dav.h)

--
Jani Averbach


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org