Index: configure.ac
===================================================================
--- configure.ac	(revision 31624)
+++ configure.ac	(working copy)
@@ -49,10 +49,6 @@
 
 AC_SUBST([MKDIR], ["$INSTALL -d"])
 
-
-dnl find Apache with a recent-enough magic module number.
-SVN_FIND_APACHE(20020903)
-
 # ==== Libraries, for which we may have source to build ======================
 
 dnl verify apr version and set apr flags
@@ -107,6 +103,10 @@
             [Defined if apr_memcache (standalone or in apr-util) is present])
 fi
 
+
+dnl Find Apache with a recent-enough magic module number
+SVN_FIND_APACHE(20020903)
+
 dnl Set up a number of directories ---------------------
 
 dnl Create SVN_BINDIR for proper substitution
Index: build/ac-macros/apr.m4
===================================================================
--- build/ac-macros/apr.m4	(revision 31624)
+++ build/ac-macros/apr.m4	(working copy)
@@ -14,7 +14,7 @@
 
   AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
 
-  APR_FIND_APR("$abs_srcdir/apr", "$abs_builddir/apr", 1, [0 1])
+  APR_FIND_APR("$abs_srcdir/apr", "$abs_builddir/apr", 1, [1 0])
 
   if test $apr_found = "no"; then
     AC_MSG_WARN([APR not found])
Index: build/ac-macros/aprutil.m4
===================================================================
--- build/ac-macros/aprutil.m4	(revision 31624)
+++ build/ac-macros/aprutil.m4	(working copy)
@@ -19,7 +19,7 @@
 
   AC_MSG_NOTICE([Apache Portable Runtime Utility (APRUTIL) library configuration])
 
-  APR_FIND_APU("$abs_srcdir/apr-util", "$abs_builddir/apr-util", 1, [0 1])
+  APR_FIND_APU("$abs_srcdir/apr-util", "$abs_builddir/apr-util", 1, [1 0])
 
   if test $apu_found = "no"; then
     AC_MSG_WARN([APRUTIL not found])
Index: build/ac-macros/apache.m4
===================================================================
--- build/ac-macros/apache.m4	(revision 31624)
+++ build/ac-macros/apache.m4	(working copy)
@@ -71,6 +71,27 @@
     AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING([if Apache version is compatible with APR version])
+apr_major_version="${apr_version%%.*}"
+case "$apr_major_version" in
+  0)
+    apache_minor_version_wanted_regex="0"
+    ;;
+  1)
+    apache_minor_version_wanted_regex=["[1-4]"]
+    ;;
+  *)
+    AC_MSG_ERROR([unknown APR version])
+    ;;
+esac
+AC_EGREP_CPP([apache_minor_version="$apache_minor_version_wanted_regex"],
+             [
+#include "$APXS_INCLUDE/ap_release.h"
+apache_minor_version=AP_SERVER_MINORVERSION_NUMBER],
+             [AC_MSG_RESULT([yes])],
+             [AC_MSG_RESULT([no])
+              AC_MSG_ERROR([Apache version incompatible with APR version])])
+
 AC_ARG_WITH(apache-libexecdir,
             [AS_HELP_STRING([[--with-apache-libexecdir[=PATH]]],
                             [Install Apache modules to PATH instead of Apache's

