[PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Justin Erenkrantz
--On Wednesday, July 14, 2004 10:24 PM +0100 Max Bowsher [EMAIL PROTECTED] 
wrote:
Joe Orton wrote:
On Wed, Jul 14, 2004 at 04:12:29PM +0100, Max Bowsher wrote:
David Reid wrote:
Tarballs available at http://www.apache.org/~dreid/
Test  report!
RC4 is still installing prefix/bin/apr-config , so making it impossible
to
install apr 0 and apr 1 side-by-side.
Known issue, will get fixed sometime after 1.0.0 once everything else
has been hooked up to use apr-1-config.
I'm unsure whether my m4 skills are sufficient, but since this is of
interest to me as I package apr for cygwin, I'm going to work on this, to
ideally get it done for apr 1.0.0, if I can, if not, helping to get it done
in 1.0.1 at the latest.
Tweak find_apr.m4 to look for apr-1-config then look for apr-config.  None 
of
these projects you mention need any changes other than a new find_ap{ru}.m4.
They all use $apr_config *after* find_ap{ru}.m4 runs.  That's why we designed
find_ap{ru}.m4 in the way we did - so that changes like this are extremely
non-intrusive.
Update those find_ap{ru}.m4 in projects that have it, then you're done.
Completely untested patch attached.  I hope my mailer doesn't do anything
stupid with it, but you should get the gist of it.  -- justin
Index: apr/build/find_apr.m4
===
RCS file: /home/cvs/apr/build/find_apr.m4,v
retrieving revision 1.14
diff -u -r1.14 find_apr.m4
--- apr/build/find_apr.m4   5 Nov 2002 22:09:19 -   1.14
+++ apr/build/find_apr.m4   15 Jul 2004 03:38:35 -
@@ -56,9 +56,15 @@
  AC_MSG_ERROR([--with-apr requires a directory to be provided])
fi
-if $TEST_X $withval/bin/apr-config; then
+if $TEST_X $withval/bin/apr-1-config; then
+  apr_found=yes
+  apr_config=$withval/bin/apr-1-config
+elif $TEST_X $withval/bin/apr-config; then
  apr_found=yes
  apr_config=$withval/bin/apr-config
+elif $TEST_X $withval/apr-1-config; then
+  apr_found=yes
+  apr_config=$withval/apr-1-config
elif $TEST_X $withval/apr-config; then
  apr_found=yes
  apr_config=$withval/apr-config
@@ -78,19 +84,26 @@
  apr_temp_abs_srcdir=`cd $1  pwd`
  apr_found=reconfig
  if test -n $2; then
-apr_config=$2/apr-config
+apr_config=$2/apr-1-config
  else
-apr_config=$1/apr-config
+apr_config=$1/apr-1-config
  fi
fi
if test $apr_found = no  test -n $3  test $3 = 1; then
-  if apr-config --help  /dev/null 21 ; then
+  if apr-1-config --help  /dev/null 21 ; then
+apr_found=yes
+apr_config=apr-1-config
+  elif apr-config --help  /dev/null 21 ; 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_X $lookdir/bin/apr-1-config; then
+apr_found=yes
+apr_config=$lookdir/bin/apr-1-config
+break
+  elif $TEST_X $lookdir/bin/apr-config; then
apr_found=yes
apr_config=$lookdir/bin/apr-config
break
Index: apr-util/build/find_apu.m4
===
RCS file: /home/cvs/apr-util/build/find_apu.m4,v
retrieving revision 1.7
diff -u -r1.7 find_apu.m4
--- apr-util/build/find_apu.m4  5 Nov 2002 22:13:42 -   1.7
+++ apr-util/build/find_apu.m4  15 Jul 2004 03:38:09 -
@@ -52,9 +52,16 @@
  AC_MSG_ERROR([--with-apr-util requires a directory to be provided])
fi
-if test -x $withval/bin/apu-config; then
+if test -x $withval/bin/apu-1-config; then
+   apu_found=yes
+   apu_config=$withval/bin/apu-1-config
+elif test -x $withval/bin/apu-config; then
   apu_found=yes
   apu_config=$withval/bin/apu-config
+elif test -x $withval/apu-1-config; then
+   dnl Already configured build dir
+   apu_found=yes
+   apu_config=$withval/apu-1-config
elif test -x $withval/apu-config; then
   dnl Already configured build dir
   apu_found=yes
@@ -76,19 +83,26 @@
if test -d $1; then
  apu_found=reconfig
  if test -n $2; then
-apu_config=$2/apu-config
+apu_config=$2/apu-1-config
  else
-apu_config=$1/apu-config
+apu_config=$1/apu-1-config
  fi
fi
if test $apu_found = no  test -n $3  test $3 = 1; then
-  if apu-config --help  /dev/null 21 ; then
+  if apu-1-config --help  /dev/null 21 ; then
+apu_found=yes
+apu_config=apu-1-config
+  elif apu-config --help  /dev/null 21 ; then
apu_found=yes
apu_config=apu-config
  else
dnl look in the 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/apu-config; then
+  

Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Joe Orton
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 - 1.14 
+++ build/find_apr.m4 15 Jul 2004 09:54:55 -
@@ -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 21 ; 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 21 ; then
+  if test $apr_maxver = 1  apr-1-config --help  /dev/null 21 ; 
then
+apr_found=yes
+apr_config=apr-1-config
+  elif test $apr_minver = 0  apr-config --help  /dev/null 21 ; 
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


Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Noah Misch
On Thu, Jul 15, 2004 at 11:02:13AM +0100, Joe Orton wrote:

 -dnl APR_FIND_APR([srcdir [, builddir, implicit-install-check]])
 +dnl APR_FIND_APR([srcdir [, builddir, implicit-install-check]], 
 +dnl  [min-version], [max-version])

 +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.

The minimum version field does need to accept two digits.  A project could use
an API added in APR 1.X, in which case e.g. APR_FIND_APR(,,, 1.4, 3) would be
appropriate and necessary.  No?


Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Joe Orton
On Thu, Jul 15, 2004 at 05:34:33AM -0700, Noah Misch wrote:
 On Thu, Jul 15, 2004 at 11:02:13AM +0100, Joe Orton wrote:
 
  -dnl APR_FIND_APR([srcdir [, builddir, implicit-install-check]])
  +dnl APR_FIND_APR([srcdir [, builddir, implicit-install-check]], 
  +dnl  [min-version], [max-version])
 
  +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.
 
 The minimum version field does need to accept two digits.  A project could use
 an API added in APR 1.X, in which case e.g. APR_FIND_APR(,,, 1.4, 3) would be
 appropriate and necessary.  No?

Sure, that would be useful, much more complicated to implement though
since you have to start parsing the arguments and --version output etc.
Handling just the major version is sufficient for the moment I think... 

joe


Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Justin Erenkrantz
--On Thursday, July 15, 2004 10:38 AM +0100 Max Bowsher [EMAIL PROTECTED] wrote:
1) It doesn't update configure.in / Makefile.in to name apr-config
apr-MAJOR-config in the build directory.
Well, that doesn't matter to our external projects.  (And, huh, it's already 
named like that for me when it's installed.)

2) It assumes bundled apr will be apr-1. We want to make find_apr.m4
independent of apr version, so that in the future, it could be installed
into a system aclocal directory (thanks to noahmcit on #apr for pointing
this out).
No, that doesn't matter: if you want to assume bundled APR is less than 1.0, 
use the same find_ap{ru}.m4 you are right now.

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.
Again, not a concern at all.  If you want to accept apr-0 *only*, then don't 
upgrade to this find_ap{ru}.m4.

It's not like all of the projects would magically upgrade to this: they have 
to choose to upgrade to this m4 version.  -- justin


Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Justin Erenkrantz
--On Thursday, July 15, 2004 5:34 AM -0700 Noah Misch [EMAIL PROTECTED] 
wrote:

The minimum version field does need to accept two digits.  A project could
use an API added in APR 1.X, in which case e.g. APR_FIND_APR(,,, 1.4, 3)
would be appropriate and necessary.  No?
If a project wants that level of specificity, they can call $apr_config after 
calling APR_FIND_APR to reject versions they find unsuitable.  But, you can't 
have parallel installs of APR with the same major version number.  -- justin


Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread William A. Rowe, Jr.
At 10:09 AM 7/15/2004, Justin Erenkrantz wrote:
--On Thursday, July 15, 2004 5:34 AM -0700 Noah Misch [EMAIL PROTECTED] 
wrote:

The minimum version field does need to accept two digits.  A project could
use an API added in APR 1.X, in which case e.g. APR_FIND_APR(,,, 1.4, 3)
would be appropriate and necessary.  No?

If a project wants that level of specificity, they can call $apr_config after 
calling APR_FIND_APR to reject versions they find unsuitable.  But, you can't 
have parallel installs of APR with the same major version number.  -- justin

APR_FIND_APR returns only the first apr found - what 'list of found apr's' 
do you suggest the author validate against to determine where apr-1(.1)
lives?

Bill





Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Justin Erenkrantz
--On Thursday, July 15, 2004 12:01 PM -0500 William A. Rowe, Jr. 
[EMAIL PROTECTED] wrote:

APR_FIND_APR returns only the first apr found - what 'list of found
apr's'  do you suggest the author validate against to determine where
apr-1(.1) lives?
They shouldn't.  The granularity is at the major level not at the minor or 
patch level.  If the user wants to override detection, they can shoot 
themselves in the foot by passing the path explicitly.  -- justin


Re: [PATCH] update find_ap{ru}.m4 for ap{ru}-1-config was Re: 1.0.0 RC4 (apr-config - apr-1-config)

2004-07-15 Thread Justin Erenkrantz
--On Thursday, July 15, 2004 6:15 PM +0100 Max Bowsher [EMAIL PROTECTED] 
wrote:
Well, actually, it does. It allows you to build a project against an
external, built, but uninstalled apr.
William Rowe indicated in IRC that he finds the feature very useful, so
I'm not going to scrap it when I've already written the code to make it
continue to work.
No, what you are talking about is what is installed in the builddir.  It 
doesn't matter.  We're going to use it regardless of what major version it 
is because the packager decided it was the 'right' version to use.  Hence, 
adding the -major- detection for the bundled copy is rather pointless and 
something Joe caught on in my patch.  -- justin