>From a936b7d4cf8583ace0be6756b4b066a2c1aebe18 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini 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