[PATCH] automake: do not require ltmain.sh for out-of-tree libtool

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] automake: do not require ltmain.sh for out-of-tree libtool

Paolo Bonzini-2
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.

2016-10-31  Paolo Bonzini  <[hidden email]>

        * 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 <[hidden email]>
---
        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(-)

diff --git a/bin/automake.in b/bin/automake.in
index 3abee49..cb2a480 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -274,6 +274,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;
@@ -2304,7 +2306,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)
@@ -4952,6 +4954,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,
@@ -5185,10 +5188,16 @@ sub scan_autoconf_traces
  if $mtime > $configure_deps_greatest_timestamp;
     }
  }
+      elsif ($macro eq 'AC_PROG_LIBTOOL')
+ {
+  # Detect bundling of really old Libtool 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')
  {
@@ -5201,6 +5210,7 @@ sub scan_autoconf_traces
       # Hardcode the tags supported by Libtool 1.5.
       %libtool_tags = (CC => 1, CXX => 1, GCJ => 1, F77 => 1);
     }
+  $libtool_bundled = 1;
  }
     }
 
--
2.7.4


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] automake: do not require ltmain.sh for out-of-tree libtool

Paolo Bonzini-2
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  <[hidden email]>
>
> * 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 <[hidden email]>
> ---
> 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(-)
>
> diff --git a/bin/automake.in b/bin/automake.in
> index 3abee49..cb2a480 100644
> --- a/bin/automake.in
> +++ b/bin/automake.in
> @@ -274,6 +274,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;
> @@ -2304,7 +2306,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)
> @@ -4952,6 +4954,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,
> @@ -5185,10 +5188,16 @@ sub scan_autoconf_traces
>   if $mtime > $configure_deps_greatest_timestamp;
>      }
>   }
> +      elsif ($macro eq 'AC_PROG_LIBTOOL')
> + {
> +  # Detect bundling of really old Libtool 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')
>   {
> @@ -5201,6 +5210,7 @@ sub scan_autoconf_traces
>        # Hardcode the tags supported by Libtool 1.5.
>        %libtool_tags = (CC => 1, CXX => 1, GCJ => 1, F77 => 1);
>      }
> +  $libtool_bundled = 1;
>   }
>      }
>  
>


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] automake: do not require ltmain.sh for out-of-tree libtool

Mathieu Lirzin
Hello,

Paolo Bonzini <[hidden email]> 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.

I will take a look at this in the weekend.

Thanks for reminding us.

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

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] automake: do not require ltmain.sh for out-of-tree libtool

Mathieu Lirzin
In reply to this post by Paolo Bonzini-2
Hello,

Paolo Bonzini <[hidden email]> 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  <[hidden email]>
>>
>> * 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 <[hidden email]>
>> ---
>> 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.



Thanks.

--
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 (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] automake: do not require ltmain.sh for out-of-tree libtool

Paolo Bonzini-2
On 17/10/2017 13:45, Mathieu Lirzin wrote:

>>>  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.
>


I am not sure when I will have time (it's been a year ;)) but yes,
that's a good idea.

Paolo