bug#30126: Do not require “ltmain.sh” for out-of-tree libtool

Mathieu Lirzin <[email protected]>
Newsgroups gmane.comp.sysutils.automake.bugs,gmane.comp.sysutils.automake.patches
Message-ID <[email protected]>
I am opening a bug to keep track of this.

Mathieu Lirzin <[email protected]> writes:

> Paolo Bonzini <[email protected]> writes:
>
>> On 31/10/2016 13:30, Paolo Bonzini wrote:
>>> If Automake does not see LT_SUPPORTED_TAG, it assumes an old libtool
>>> that does not know about AC_REQUIRE_AUX_FILE.  However, if the program
>>> does not use Libtool's configure.ac macros this check gets a
>>> false positive.  Do not require ltmain.sh if no Libtool macro is
>>> found in configure.ac.
>>> 
>>> Libtools that are not stone-age are already covered by LT_SUPPORTED_TAG
>>> and _LT_AC_TAGCONFIG, but add AC_PROG_LIBTOOL just in case for Libtool
>>> up to 1.4.
>>
>> This patch was never applied.
>>
>> Paolo
>>
>>> 2016-10-31  Paolo Bonzini  <[email protected]>
>>> 
>>> 	* bin/automake.in ($libtool_bundled): New.
>>> 	(handle_libtool): Do not require libtool files if libtool is
>>> 	not being bundled.
>>> 	(scan_autoconf_traces): Set $libtool_bundled.  Trace
>>> 	AC_PROG_LIBTOOL too.
>>> 
>>> Signed-off-by: Paolo Bonzini <[email protected]>
>>> ---
>>> 	If the patch is accepted I will send an Autoconf patch to
>>> 	preselect AC_PROG_LIBTOOL.
>>> 
>>> 	Since this is a bug, it would be nice to add it at least to
>>> 	the 1.16 branch.
>>> 
>>>  bin/automake.in | 12 +++++++++++-
>>>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> I haven't tested this, and I am not a Libtool expert so I trust your
> analysis.
>
> What do you think of adding a test ensuring that ltmain.sh is not
> required when no Libtool macro is found?
>
> I have attached a updated patch with trivial formatting and comment
> changes.

Here is the current version of the patch which needs a test to be
merged.


-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37
0001-automake-Do-not-require-ltmain.sh-for-out-of-tree-li.patch (text/x-patch, 2.5 KB)
From a936b7d4cf8583ace0be6756b4b066a2c1aebe18 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <[email protected]>
Date: Mon, 31 Oct 2016 13:30:50 +0100
Subject: [PATCH] automake: Do not require ltmain.sh for out-of-tree libtool

If Automake does not see LT_SUPPORTED_TAG, it assumes an old libtool
that does not know about AC_REQUIRE_AUX_FILE.  However, if the program
does not use Libtool's configure.ac macros this check gets a
false positive.  Do not require ltmain.sh if no Libtool macro is
found in configure.ac.

* bin/automake.in ($libtool_bundled): New variable.
(handle_libtool): Do not require libtool files if libtool is not being
bundled.
(scan_autoconf_traces): Set $libtool_bundled.  Trace AC_PROG_LIBTOOL.
---
 bin/automake.in | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/automake.in b/bin/automake.in
index 5e36c0f..b7fbe96 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -344,6 +344,8 @@ my @extra_recursive_targets = ();
 
 # Lists of tags supported by Libtool.
 my %libtool_tags = ();
+# 1 if Libtool is being bundled, so ltmain.sh is required.
+my $libtool_bundled = 0;
 # 1 if Libtool uses LT_SUPPORTED_TAG.  If it does, then it also
 # uses AC_REQUIRE_AUX_FILE.
 my $libtool_new_api = 0;
@@ -2524,7 +2526,7 @@ sub handle_libtool ()
   # (Starting with Libtool 2.0 we do not have to bother.  These
   # requirements are done with AC_REQUIRE_AUX_FILE.)
   require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files)
-    if $relative_dir eq '.' && ! $libtool_new_api;
+    if $relative_dir eq '.' && $libtool_bundled && ! $libtool_new_api;
 
   my @libtool_rms;
   foreach my $item (sort keys %libtool_clean_directories)
@@ -5239,6 +5241,7 @@ sub scan_autoconf_traces
 		_AM_COND_IF => 1,
 		_AM_COND_ELSE => 1,
 		_AM_COND_ENDIF => 1,
+		AC_PROG_LIBTOOL => 0,
 		LT_SUPPORTED_TAG => 1,
 		_LT_AC_TAGCONFIG => 0,
 		m4_include => 1,
@@ -5482,10 +5485,17 @@ EOF
 		if $mtime > $configure_deps_greatest_timestamp;
 	    }
 	}
+      elsif ($macro eq 'AC_PROG_LIBTOOL')
+	{
+	  # Detect bundling of really old Libtool up to 1.4 that does not
+	  # support tags.
+	  $libtool_bundled = 1;
+	}
       elsif ($macro eq 'LT_SUPPORTED_TAG')
 	{
 	  $libtool_tags{$args[1]} = 1;
 	  $libtool_new_api = 1;
+	  $libtool_bundled = 1;
 	}
       elsif ($macro eq '_LT_AC_TAGCONFIG')
 	{
@@ -5498,6 +5508,7 @@ EOF
 	      # Hardcode the tags supported by Libtool 1.5.
 	      %libtool_tags = (CC => 1, CXX => 1, GCJ => 1, F77 => 1);
 	    }
+	  $libtool_bundled = 1;
 	}
     }
 
-- 
2.9.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.