Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 68947 invoked from network); 5 Jan 2004 10:54:49 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Jan 2004 10:54:49 -0000 Received: (qmail 5612 invoked by uid 500); 5 Jan 2004 10:54:23 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 5581 invoked by uid 500); 5 Jan 2004 10:54:21 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 5568 invoked from network); 5 Jan 2004 10:54:21 -0000 X-Authentication-Warning: flywheel.cs.caltech.edu: noah owned process doing -bs Date: Mon, 5 Jan 2004 02:54:34 -0800 (PST) From: Noah Misch To: Subject: [PATCH] Make buildconf's libtool.m4 detection more robust Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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