apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noah Misch <n...@cs.caltech.edu>
Subject [PATCH] Make buildconf's libtool.m4 detection more robust
Date Mon, 05 Jan 2004 10:54:34 GMT
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


Mime
View raw message