On Thu, Jul 15, 2004 at 10:38:06AM +0100, Max Bowsher wrote:
> 3) It only implements "accept apr-0 or apr-1", but unless projects do extra
> compatibility work, and make sure to *never* expose the apr ABI in their own
> ABI, they will want "accept apr-0 only" or "accept apr-1 only".
Yes, this is the key problem. Patch below is the logic I like; I
haven't done find_apu.m4.
I don't think it's worth having configure copy ap[ru]-config to
ap[ru]-1-config just to add another failure case here; just assume that
whatever version of APR/util is bundled is a suitable one.
--- build/find_apr.m4 5 Nov 2002 22:09:19 -0000 1.14
+++ build/find_apr.m4 15 Jul 2004 09:54:55 -0000
@@ -6,7 +6,8 @@
dnl embedding APR into the application source, or locating an installed
dnl copy of APR.
dnl
-dnl APR_FIND_APR([srcdir [, builddir, implicit-install-check]])
+dnl APR_FIND_APR([srcdir [, builddir, implicit-install-check]],
+dnl [min-version], [max-version])
dnl
dnl where srcdir is the location of the bundled APR source directory, or
dnl empty if source is not bundled.
@@ -17,6 +18,10 @@
dnl where implicit-install-check set to 1 indicates if there is no
dnl --with-apr option specified, we will look for installed copies.
dnl
+dnl where min-version and max-version specify the mininum and maximum
acceptable
+dnl APR major version numbers which can be used, e.g. "0, 1" allows use of
+dnl either APR 0.9 or APR 1.0; "1, 1" allows use of only APR 1.0.
+dnl
dnl Sets the following variables on exit:
dnl
dnl apr_found : "yes", "no", "reconfig"
@@ -40,6 +45,15 @@
AC_DEFUN(APR_FIND_APR, [
apr_found="no"
+ apr_minver="$4"
+ apr_maxver="$5"
+ if test -z "${apr_minver}"; then
+ apr_minver=0
+ fi
+ if test -z "${apr_maxver}"; then
+ apr_maxver=1
+ fi
+
if test "$ac_cv_emxos2" = "yes"; then
# Scripts don't pass test -x on OS/2
TEST_X="test -f"
@@ -55,14 +69,19 @@
if test "$withval" = "no" || test "$withval" = "yes"; then
AC_MSG_ERROR([--with-apr requires a directory to be provided])
fi
-
- if $TEST_X "$withval/bin/apr-config"; then
+
+ if test "$apr_maxver" = "1" && $TEST_X "$withval/bin/apr-1-config"; then
+ apr_found="yes"
+ apr_config="$withval/bin/apr-1-config"
+ elif test "$apr_minver" = "0" && $TEST_X "$withval/bin/apr-config"; then
apr_found="yes"
apr_config="$withval/bin/apr-config"
elif $TEST_X "$withval/apr-config"; then
+ # Already-configured build directory: presume version is suitable
apr_found="yes"
apr_config="$withval/apr-config"
elif $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
+ # Full path to apr-config script: presume version is suitable
apr_found="yes"
apr_config="$withval"
fi
@@ -84,13 +103,20 @@
fi
fi
if test "$apr_found" = "no" && test -n "$3" && test "$3" = "1"; then
- if apr-config --help > /dev/null 2>&1 ; then
+ if test "$apr_maxver" = "1" && apr-1-config --help > /dev/null 2>&1 ;
then
+ apr_found="yes"
+ apr_config="apr-1-config"
+ elif test "$apr_minver" = "0" && apr-config --help > /dev/null 2>&1 ;
then
apr_found="yes"
apr_config="apr-config"
else
dnl look in some standard places (apparently not in builtin/default)
for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do
- if $TEST_X "$lookdir/bin/apr-config"; then
+ if test "$apr_maxver" = "1" && $TEST_X "$lookdir/bin/apr-1-config";
then
+ apr_found="yes"
+ apr_config="$lookdir/bin/apr-1-config"
+ break
+ elif test "$apr_minver" = "0" && $TEST_X "$lookdir/bin/apr-config";
then
apr_found="yes"
apr_config="$lookdir/bin/apr-config"
break