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

From: Mathieu Lirzin <[email-masked]>
Date: Tue, 20 Feb 2018 20:55:33 +0100

Hello,

Mathieu Lirzin <[email-masked]> writes:

> Mathieu Lirzin <[email-masked]> writes:
>
>>>>>From a936b7d4cf8583ace0be6756b4b066a2c1aebe18 Mon Sep 17 00:00:00 2001
>> From: Paolo Bonzini <[email-masked]>
>> 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.

>From 196fc03864028e022b7a590b50c5711c6754e42b Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <[email-masked]>
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

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