You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Noah Misch <no...@cs.caltech.edu> on 2004/01/05 11:54:34 UTC

[PATCH] Make buildconf's libtool.m4 detection more robust

Hi,

I'm building APR CVS HEAD on a recent (no more than three months old) Cygwin
binary installation.  buildconf fails to find libtool.m4 because
/usr/bin/libtoolize is actually a shell script that applies some heuristics to
choose between /usr/autotool/{devel,stable}/bin/libtoolize.

One can get around this by setting LIBTOOL_M4, of course, but I think this patch
obviates that need and introduces a better general solution besides.  It parses
the output from libtoolize, which includes the directory of libtool.m4, and uses
that.  If this fails (such as if, for example, the output format of libtool
varies too much), buildconf will fall back on its previous mechanism.

Long-term, maybe I'll ask the libtool people to add a --m4 option that prints
that directory so scripts like this one can find libtool.m4 without relying on
fragile transformations like this one.

I would appreciate any feedback and results of testing with your own versions of
libtool (try sh -x buildconf and see if it falls back on the old mechanism).

Thanks,
Noah

diff -u -r1.26 buildconf
--- buildconf	17 Jun 2003 20:44:25 -0000	1.26
+++ buildconf	5 Jan 2004 09:18:53 -0000
@@ -78,11 +78,18 @@
 # and libtool 1.4 by simply rerunning the buildconf script.
 (cd build ; rm -f ltconfig ltmain.sh libtool.m4)

-$libtoolize --copy --automake
+# Run libtoolize and grab the location of libtool.m4 from its output
+ltfile=`$libtoolize --copy 2>&1 | grep 'You should' | cut -d\\\` -f2 | cut -d\' -f1`

-ltpath=`dirname $libtoolize`
-ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
+# If parsing libtoolize output failed; guess the location
+if [ ! -f "$ltfile" ]; then
+    ltpath=`dirname $libtoolize`
+    ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
+fi

+if [ ! -z "$LIBTOOL_M4" ]; then
+    ltfile=$LIBTOOL_M4
+fi
 if [ ! -f $ltfile ]; then
     echo "$ltfile not found"
     exit 1


Re: [PATCH] Make buildconf's libtool.m4 detection more robust

Posted by Joe Orton <jo...@manyfish.co.uk>.
Hi,

On Mon, Jan 05, 2004 at 02:54:34AM -0800, Noah Misch wrote:
> I'm building APR CVS HEAD on a recent (no more than three months old) Cygwin
> binary installation.  buildconf fails to find libtool.m4 because
> /usr/bin/libtoolize is actually a shell script that applies some heuristics to
> choose between /usr/autotool/{devel,stable}/bin/libtoolize.
> 
> One can get around this by setting LIBTOOL_M4, of course, but I think this patch
> obviates that need and introduces a better general solution besides.  It parses
> the output from libtoolize, which includes the directory of libtool.m4, and uses
> that.  If this fails (such as if, for example, the output format of libtool
> varies too much), buildconf will fall back on its previous mechanism.

That's pretty ugly... I'm more inclined to say: if you have a really
weird libtool installation, set LIBTOOL_M4.  libtoolize
--where-is-libtool-m4 sounds good :)

> Long-term, maybe I'll ask the libtool people to add a --m4 option that prints
> that directory so scripts like this one can find libtool.m4 without relying on
> fragile transformations like this one.

Regards,

joe