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

Previous Next

Package: automake;

Reported by: Mathieu Lirzin <mthl <at> gnu.org>

Date: Mon, 15 Jan 2018 14:54:02 UTC

Severity: normal

Tags: moreinfo, patch

To reply to this bug, email your comments to 30126 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#30126; Package automake. (Mon, 15 Jan 2018 14:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Lirzin <mthl <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Mon, 15 Jan 2018 14:54:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Lirzin <mthl <at> gnu.org>
To: bug-automake <at> gnu.org
Cc: Paolo Bonzini <bonzini <at> gnu.org>, eggert <at> cs.ucla.edu,
 automake-patches <at> gnu.org
Subject: Do not require “ltmain.sh” for out-of-tree
 libtool
Date: Mon, 15 Jan 2018 15:53:24 +0100
[Message part 1 (text/plain, inline)]
I am opening a bug to keep track of this.

Mathieu Lirzin <mthl <at> gnu.org> writes:

> Paolo Bonzini <bonzini <at> gnu.org> 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  <bonzini <at> gnu.org>
>>> 
>>> 	* 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 <bonzini <at> gnu.org>
>>> ---
>>> 	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.

[0001-automake-Do-not-require-ltmain.sh-for-out-of-tree-li.patch (text/x-patch, inline)]
From a936b7d4cf8583ace0be6756b4b066a2c1aebe18 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <bonzini <at> gnu.org>
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

[Message part 3 (text/plain, inline)]
-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

Added tag(s) patch. Request was from Mathieu Lirzin <mthl <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 15 Jan 2018 14:56:02 GMT) Full text and rfc822 format available.

Severity set to 'important' from 'normal' Request was from Mathieu Lirzin <mthl <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 15 Jan 2018 14:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#30126; Package automake. (Mon, 15 Jan 2018 22:33:02 GMT) Full text and rfc822 format available.

Message #12 received at 30126 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Lirzin <mthl <at> gnu.org>
To: Paolo Bonzini <bonzini <at> gnu.org>
Cc: eggert <at> cs.ucla.edu, 30126 <at> debbugs.gnu.org, automake-patches <at> gnu.org
Subject: Re: bug#30126: Do not require “ltmain.sh” for
 out-of-tree libtool
Date: Mon, 15 Jan 2018 23:31:52 +0100
Hello Paolo,

Mathieu Lirzin <mthl <at> gnu.org> writes:

>>From a936b7d4cf8583ace0be6756b4b066a2c1aebe18 Mon Sep 17 00:00:00 2001
> From: Paolo Bonzini <bonzini <at> gnu.org>
> 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.
> ---

Would you have some time to allocate on a test for this patch in the
following days/weeks?  I would like to be able to merge it before
releasing Automake 1.16?

Thanks.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37




Information forwarded to bug-automake <at> gnu.org:
bug#30126; Package automake. (Tue, 20 Feb 2018 19:57:01 GMT) Full text and rfc822 format available.

Message #15 received at 30126 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Lirzin <mthl <at> gnu.org>
To: Paolo Bonzini <bonzini <at> gnu.org>
Cc: eggert <at> cs.ucla.edu, 30126 <at> debbugs.gnu.org, automake-patches <at> gnu.org
Subject: Re: bug#30126: Do not require “ltmain.sh” for
 out-of-tree libtool
Date: Tue, 20 Feb 2018 20:55:33 +0100
[Message part 1 (text/plain, inline)]
Hello,

Mathieu Lirzin <mthl <at> gnu.org> writes:

> Mathieu Lirzin <mthl <at> gnu.org> writes:
>
>>>>From a936b7d4cf8583ace0be6756b4b066a2c1aebe18 Mon Sep 17 00:00:00 2001
>> From: Paolo Bonzini <bonzini <at> gnu.org>
>> 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.
>> ---
>
> Would you have some time to allocate on a test for this patch in the
> following days/weeks?  I would like to be able to merge it before
> releasing Automake 1.16?

I have implemented the test myself, however I still don't understand how
the following scenario could reasonably happen.  So could you explain me
how such configuration could happen so that I can include it as a
rationale describing the test?

Thanks.

[0001-tests-Add-t-libtool-when-required.sh.patch (text/x-patch, inline)]
From 196fc03864028e022b7a590b50c5711c6754e42b Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <mthl <at> gnu.org>
Date: Tue, 20 Feb 2018 11:14:54 +0100
Subject: [PATCH] =?UTF-8?q?tests:=20Add=20=E2=80=9Ct/libtool-when-required?=
 =?UTF-8?q?.sh=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* t/libtool-when-required.sh: New failing test for bug#30126.
* t/list-of-tests.mk (handwritten_TESTS, XFAIL_TESTS): Add it.
---
 t/libtool-when-required.sh | 36 ++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk         |  2 ++
 2 files changed, 38 insertions(+)
 create mode 100644 t/libtool-when-required.sh

diff --git a/t/libtool-when-required.sh b/t/libtool-when-required.sh
new file mode 100644
index 000000000..d5f93814f
--- /dev/null
+++ b/t/libtool-when-required.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright (C) 2018 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Make sure Automake does not require libtool files when no libtool macros are
+# used.
+
+. test-init.sh
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AC_SUBST([LIBTOOL], [libtool])
+AM_PROG_AR
+AC_OUTPUT
+END
+
+cat >> Makefile.am <<'END'
+lib_LTLIBRARIES = libfoo.la
+END
+
+$ACLOCAL
+AUTOMAKE_run -d 'should not complain about missing ltmain.sh' -- --add-missing
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 271bfb573..8fdd076aa 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -38,6 +38,7 @@ t/override-conditional-pr13940.sh \
 t/dist-pr109765.sh \
 t/instdir-cond2.sh \
 t/java-nobase.sh \
+t/libtool-when-required.sh \
 t/objext-pr10128.sh \
 t/remake-timing-bug-pr8365.sh \
 t/lex-subobj-nodep.sh \
@@ -638,6 +639,7 @@ t/libtool8.sh \
 t/libtool9.sh \
 t/libtoo10.sh \
 t/libtoo11.sh \
+t/libtool-when-required.sh \
 t/license.sh \
 t/license2.sh \
 t/link_c_cxx.sh \
-- 
2.16.1

[Message part 3 (text/plain, inline)]
-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

Severity set to 'normal' from 'important' Request was from Mathieu Lirzin <mthl <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 25 Feb 2018 22:19:02 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Mathieu Lirzin <mthl <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 25 Feb 2018 22:19:02 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.