You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Max Bowsher <ma...@ukf.net> on 2003/05/29 13:02:00 UTC

[Patch] Add fallback method to libtool.m4 location algorithm

Below are 2 patches, one for apr, one for the embedded expat in apr-util.

They add a fallback method to locating libtool.m4.

This is important for systems which use auto-version selecting redirector
scripts for the autotools.

The fallback method uses aclocal --print-ac-dir to locate libtool.m4, since
on such systems, aclocal will most likely be a wrapper script which will
invoke the correct real aclocal, which will be able to provide the correct
path.

Max.


Index: buildconf
===================================================================
RCS file: /home/max/cvsmirror/misc-cvs/apr/buildconf,v
retrieving revision 1.25
diff -u -p -r1.25 buildconf
--- buildconf 1 Jan 2003 00:01:41 -0000 1.25
+++ buildconf 29 May 2003 10:46:20 -0000
@@ -83,9 +83,21 @@ $libtoolize --copy --automake
 ltpath=`dirname $libtoolize`
 ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4

-if [ ! -f $ltfile ]; then
-    echo "$ltfile not found"
-    exit 1
+if [ ! -f "$ltfile" ]; then
+    ltfile2="$ltfile"
+    ltfile="`aclocal --print-ac-dir`"/libtool.m4
+    if [ $? -ne 0 ]; then
+        ltfile="aclocal not available"
+        ltnotfound=yes
+    elif [ ! -f "$ltfile" ]; then
+        ltnotfound=yes
+    fi
+    if [ -n "$ltnotfound" ]; then
+        echo "Unable to find libtool.m4 - tried these locations:"
+        echo "  Based on path of libtoolize: $ltfile2"
+        echo "  Via aclocal --print-ac-dir:  $ltfile"
+        exit 1
+    fi
 fi

 cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' >
build/libtool.m4




Index: xml/expat/buildconf.sh
===================================================================
RCS file: /home/max/cvsmirror/misc-cvs/apr-util/xml/expat/buildconf.sh,v
retrieving revision 1.10
diff -u -p -r1.10 buildconf.sh
--- xml/expat/buildconf.sh 15 May 2002 16:51:52 -0000 1.10
+++ xml/expat/buildconf.sh 29 May 2003 10:47:16 -0000
@@ -8,8 +8,27 @@ if [ "x$libtoolize" = "x" ]; then
     echo "libtoolize not found in path"
     exit 1
 fi
+
 ltpath=`dirname $libtoolize`
 ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
+
+if [ ! -f "$ltfile" ]; then
+    ltfile2="$ltfile"
+    ltfile="`aclocal --print-ac-dir`"/libtool.m4
+    if [ $? -ne 0 ]; then
+        ltfile="aclocal not available"
+        ltnotfound=yes
+    elif [ ! -f "$ltfile" ]; then
+        ltnotfound=yes
+    fi
+    if [ -n "$ltnotfound" ]; then
+        echo "Unable to find libtool.m4 - tried these locations:"
+        echo "  Based on path of libtoolize: $ltfile2"
+        echo "  Via aclocal --print-ac-dir:  $ltfile"
+        exit 1
+    fi
+fi
+
 echo "Incorporating $ltfile into aclocal.m4 ..."
 echo "dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf.sh" >
aclocal.m4
 echo "dnl edits here will be lost" >> aclocal.m4


Re: [Patch] Add fallback method to libtool.m4 location algorithm

Posted by Max Bowsher <ma...@ukf.net>.
Joe Orton wrote:
> On Thu, May 29, 2003 at 12:02:00PM +0100, Max Bowsher wrote:
>> Below are 2 patches, one for apr, one for the embedded expat in apr-util.
>>
>> They add a fallback method to locating libtool.m4.
>>
>> This is important for systems which use auto-version selecting redirector
>> scripts for the autotools.
>
> It might be better to stop guessing and just allow $LIBTOOL_M4 to
> specify the libtool.m4 location.  Would that work for you?

Well, it seems rather non-ideal, when there is a good fully-automated
alternative.

>> The fallback method uses aclocal --print-ac-dir to locate libtool.m4,
since
>> on such systems, aclocal will most likely be a wrapper script which will
>> invoke the correct real aclocal, which will be able to provide the
correct
>> path.
>
> (wait for the "oh no! automake" shrieks from the galleries)

Why? This isn't a dependency - it merely takes advantage of aclocal if and
only if the primary search for libtool.m4 fails, and aclocal is installed.


Max.

>> Index: buildconf
>> ===================================================================
>> RCS file: /home/max/cvsmirror/misc-cvs/apr/buildconf,v
>> retrieving revision 1.25
>> diff -u -p -r1.25 buildconf
>> --- buildconf 1 Jan 2003 00:01:41 -0000 1.25
>> +++ buildconf 29 May 2003 10:46:20 -0000
>> @@ -83,9 +83,21 @@ $libtoolize --copy --automake
>>  ltpath=`dirname $libtoolize`
>>  ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
>>
>> -if [ ! -f $ltfile ]; then
>> -    echo "$ltfile not found"
>> -    exit 1
>> +if [ ! -f "$ltfile" ]; then
>> +    ltfile2="$ltfile"
>> +    ltfile="`aclocal --print-ac-dir`"/libtool.m4
>> +    if [ $? -ne 0 ]; then
>> +        ltfile="aclocal not available"
>> +        ltnotfound=yes
>> +    elif [ ! -f "$ltfile" ]; then
>> +        ltnotfound=yes
>> +    fi
>> +    if [ -n "$ltnotfound" ]; then
>> +        echo "Unable to find libtool.m4 - tried these locations:"
>> +        echo "  Based on path of libtoolize: $ltfile2"
>> +        echo "  Via aclocal --print-ac-dir:  $ltfile"
>> +        exit 1
>> +    fi
>>  fi
>>
>>  cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' >
>> build/libtool.m4
>>
>>
>>
>>
>> Index: xml/expat/buildconf.sh
>> ===================================================================
>> RCS file: /home/max/cvsmirror/misc-cvs/apr-util/xml/expat/buildconf.sh,v
>> retrieving revision 1.10
>> diff -u -p -r1.10 buildconf.sh
>> --- xml/expat/buildconf.sh 15 May 2002 16:51:52 -0000 1.10
>> +++ xml/expat/buildconf.sh 29 May 2003 10:47:16 -0000
>> @@ -8,8 +8,27 @@ if [ "x$libtoolize" = "x" ]; then
>>      echo "libtoolize not found in path"
>>      exit 1
>>  fi
>> +
>>  ltpath=`dirname $libtoolize`
>>  ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
>> +
>> +if [ ! -f "$ltfile" ]; then
>> +    ltfile2="$ltfile"
>> +    ltfile="`aclocal --print-ac-dir`"/libtool.m4
>> +    if [ $? -ne 0 ]; then
>> +        ltfile="aclocal not available"
>> +        ltnotfound=yes
>> +    elif [ ! -f "$ltfile" ]; then
>> +        ltnotfound=yes
>> +    fi
>> +    if [ -n "$ltnotfound" ]; then
>> +        echo "Unable to find libtool.m4 - tried these locations:"
>> +        echo "  Based on path of libtoolize: $ltfile2"
>> +        echo "  Via aclocal --print-ac-dir:  $ltfile"
>> +        exit 1
>> +    fi
>> +fi
>> +
>>  echo "Incorporating $ltfile into aclocal.m4 ..."
>>  echo "dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf.sh" >
>> aclocal.m4
>>  echo "dnl edits here will be lost" >> aclocal.m4


Re: [Patch] Add fallback method to libtool.m4 location algorithm

Posted by Joe Orton <jo...@manyfish.co.uk>.
On Thu, May 29, 2003 at 12:02:00PM +0100, Max Bowsher wrote:
> Below are 2 patches, one for apr, one for the embedded expat in apr-util.
> 
> They add a fallback method to locating libtool.m4.
> 
> This is important for systems which use auto-version selecting redirector
> scripts for the autotools.

It might be better to stop guessing and just allow $LIBTOOL_M4 to
specify the libtool.m4 location.  Would that work for you?

> The fallback method uses aclocal --print-ac-dir to locate libtool.m4, since
> on such systems, aclocal will most likely be a wrapper script which will
> invoke the correct real aclocal, which will be able to provide the correct
> path.

(wait for the "oh no! automake" shrieks from the galleries)

> Max.
> 
> 
> Index: buildconf
> ===================================================================
> RCS file: /home/max/cvsmirror/misc-cvs/apr/buildconf,v
> retrieving revision 1.25
> diff -u -p -r1.25 buildconf
> --- buildconf 1 Jan 2003 00:01:41 -0000 1.25
> +++ buildconf 29 May 2003 10:46:20 -0000
> @@ -83,9 +83,21 @@ $libtoolize --copy --automake
>  ltpath=`dirname $libtoolize`
>  ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
> 
> -if [ ! -f $ltfile ]; then
> -    echo "$ltfile not found"
> -    exit 1
> +if [ ! -f "$ltfile" ]; then
> +    ltfile2="$ltfile"
> +    ltfile="`aclocal --print-ac-dir`"/libtool.m4
> +    if [ $? -ne 0 ]; then
> +        ltfile="aclocal not available"
> +        ltnotfound=yes
> +    elif [ ! -f "$ltfile" ]; then
> +        ltnotfound=yes
> +    fi
> +    if [ -n "$ltnotfound" ]; then
> +        echo "Unable to find libtool.m4 - tried these locations:"
> +        echo "  Based on path of libtoolize: $ltfile2"
> +        echo "  Via aclocal --print-ac-dir:  $ltfile"
> +        exit 1
> +    fi
>  fi
> 
>  cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' >
> build/libtool.m4
> 
> 
> 
> 
> Index: xml/expat/buildconf.sh
> ===================================================================
> RCS file: /home/max/cvsmirror/misc-cvs/apr-util/xml/expat/buildconf.sh,v
> retrieving revision 1.10
> diff -u -p -r1.10 buildconf.sh
> --- xml/expat/buildconf.sh 15 May 2002 16:51:52 -0000 1.10
> +++ xml/expat/buildconf.sh 29 May 2003 10:47:16 -0000
> @@ -8,8 +8,27 @@ if [ "x$libtoolize" = "x" ]; then
>      echo "libtoolize not found in path"
>      exit 1
>  fi
> +
>  ltpath=`dirname $libtoolize`
>  ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
> +
> +if [ ! -f "$ltfile" ]; then
> +    ltfile2="$ltfile"
> +    ltfile="`aclocal --print-ac-dir`"/libtool.m4
> +    if [ $? -ne 0 ]; then
> +        ltfile="aclocal not available"
> +        ltnotfound=yes
> +    elif [ ! -f "$ltfile" ]; then
> +        ltnotfound=yes
> +    fi
> +    if [ -n "$ltnotfound" ]; then
> +        echo "Unable to find libtool.m4 - tried these locations:"
> +        echo "  Based on path of libtoolize: $ltfile2"
> +        echo "  Via aclocal --print-ac-dir:  $ltfile"
> +        exit 1
> +    fi
> +fi
> +
>  echo "Incorporating $ltfile into aclocal.m4 ..."
>  echo "dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf.sh" >
> aclocal.m4
>  echo "dnl edits here will be lost" >> aclocal.m4
>