You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Justin Erenkrantz <ju...@erenkrantz.com> on 2004/07/15 05:41:51 UTC

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

--On Wednesday, July 14, 2004 10:24 PM +0100 Max Bowsher <ma...@ukf.net> 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 -0000	1.14
+++ apr/build/find_apr.m4	15 Jul 2004 03:38:35 -0000
@@ -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 2>&1 ; then
+      if apr-1-config --help > /dev/null 2>&1 ; then
+        apr_found="yes"
+        apr_config="apr-1-config"
+      elif 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_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 -0000	1.7
+++ apr-util/build/find_apu.m4	15 Jul 2004 03:38:09 -0000
@@ -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 2>&1 ; then
+      if apu-1-config --help > /dev/null 2>&1 ; then
+        apu_found="yes"
+        apu_config="apu-1-config"
+      elif apu-config --help > /dev/null 2>&1 ; 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
+          if test -x "$lookdir/bin/apu-1-config"; then
+            apu_found="yes"
+            apu_config="$lookdir/bin/apu-1-config"
+            break
+          elif test -x "$lookdir/bin/apu-config"; then
             apu_found="yes"
             apu_config="$lookdir/bin/apu-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)

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, July 15, 2004 12:01 PM -0500 "William A. Rowe, Jr." 
<wr...@rowe-clan.net> 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)

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 10:09 AM 7/15/2004, Justin Erenkrantz wrote:
>--On Thursday, July 15, 2004 5:34 AM -0700 Noah Misch <no...@cs.caltech.edu> 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)

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, July 15, 2004 9:07 AM -0700 Noah Misch <no...@cs.caltech.edu> 
wrote:

> If APR_FIND_APR accepts version constraints, should it not interpret them
> to at least the maximum granularity at which APR allows API changes?  I
> think this is not difficult:

I disagree.  When you have multiple parallel installs of the same major 
version all sorts of things can go wonky.

In your scenario, imagine: /usr having apr-1.1.5 installed and then 
/opt/apache having apr-1.2.5 installed.  That's going to be a nasty 
conflict when the user tries to run it depending upon the characteristics 
of the run-time linker (not to mention compiler search order).  You might 
override the one in /usr/lib with the one in /opt/apache or you might not.. 


I'd strongly prefer we not open the door to a slew of errors.  The 
granularity should be at the major version and no finer.  -- justin

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

Posted by Noah Misch <no...@cs.caltech.edu>.
On Thu, Jul 15, 2004 at 08:09:37AM -0700, Justin Erenkrantz wrote:
> --On Thursday, July 15, 2004 5:34 AM -0700 Noah Misch 
> <no...@cs.caltech.edu> 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

If APR_FIND_APR accepts version constraints, should it not interpret them to at
least the maximum granularity at which APR allows API changes?  I think this is
not difficult:

candidates=
for dir in /usr/local /usr /opt/apache ; do
    for c in $dir/bin/apr-config $dir/bin/apr-[[:digit:]]-config ; do
        if test -x $c; then candidates="$candidates $c"; fi
    done
done

best=
best_ver=-1
for apr_config in $candidates; do
    ver=`apr-config --version`
    if expr $ver \< $max \& $ver \> $min \& $ver \> $best_ver
       best=$apr_config
       best_ver=$ver
    fi
done
apr_config=$best
...

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

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, July 15, 2004 5:34 AM -0700 Noah Misch <no...@cs.caltech.edu> 
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)

Posted by Joe Orton <jo...@redhat.com>.
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)

Posted by Noah Misch <no...@cs.caltech.edu>.
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)

Posted by Joe Orton <jo...@redhat.com>.
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

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

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, July 15, 2004 6:15 PM +0100 Max Bowsher <ma...@ukf.net> 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

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

Posted by Max Bowsher <ma...@ukf.net>.
Justin Erenkrantz wrote:
> --On Thursday, July 15, 2004 10:38 AM +0100 Max Bowsher <ma...@ukf.net>
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.)

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.

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

Not necessarily. It was suggested on IRC (by noahmcit) that we may want to
consider installing find_apr.m4 to the system aclocal directory, from where
it can transparently fetched into client projects by standard autotools
methods.

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

Projects wishing to accept apr-0 only can remain with the old m4. However,
some projects (httpd-HEAD!) will want to accept apr-1 only.


I'm currently testing and writing a changelog for a patch that supports all
the above.

Max.


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

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, July 15, 2004 10:38 AM +0100 Max Bowsher <ma...@ukf.net> 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)

Posted by Max Bowsher <ma...@ukf.net>.
Justin Erenkrantz wrote:
> 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

Thanks for the patch, but unfortunately, it has some flaws:

1) It doesn't update configure.in / Makefile.in to name apr-config
apr-MAJOR-config in the build directory.

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

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


I'll be writing up an implementation proposal for a set of changes
addressing this, and posting it to this list shortly.

Max.