lang, suffix rules: don't require C stuff needlessly
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 11 Jun 2013 19:20:18 +0000 (21:20 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 12 Jun 2013 08:33:51 +0000 (10:33 +0200)
This change fixes automake bug#14560: when two or more user-defined suffix
rules were present in a single Makefile.am, automake would needlessly
include definition of some make variables related to C compilation in the
generated Makefile.in.

* automake.in (handle_languages): Fix logic to decide whether or not to
include definitions of C compilation related variables in the generated
Makefile.in: instead of doing so when two or more user-defined suffix
rules are seen (which is a completely bogus criterion), do so when two
or more compiled languages are used.
* lib/Automake/Rule.pm (suffix_rules_count): Remove as no longer used.
(@EXPORT): Adjust.
* t/list-of-tests.mk (XFAIL_TESTS): No longer list the test script
'suffix-extra-c-stuff-pr14560.sh', which now passes.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
automake.in
lib/Automake/Rule.pm
t/list-of-tests.mk

diff --git a/NEWS b/NEWS
index d540aab..a6f0953 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+New in 1.13.4:
+
+* Bugs fixed:
+
+  - Fix a minor regression introduced in Automake 1.13.3: when two or more
+    user-defined suffix rules were present in a single Makefile.am,
+    automake would needlessly include definition of some make variables
+    related to C compilation in the generated Makefile.in (bug#14560).
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 New in 1.13.3:
 
 * Documentation fixes:
index 63d5bdf..835d3bd 100644 (file)
@@ -1572,10 +1572,11 @@ sub handle_languages
     # If the project is entirely C++ or entirely Fortran 77 (i.e., 1
     # suffix rule was learned), don't bother with the C stuff.  But if
     # anything else creeps in, then use it.
-    $needs_c = 1
-      if $need_link || suffix_rules_count > 1;
-
-    if ($needs_c)
+    my @languages_seen = map { $languages{$extension_map{$_}}->name }
+                             (keys %extension_seen);
+    @languages_seen = uniq (@languages_seen);
+    $needs_c = 1 if @languages_seen > 1;
+    if ($need_link || $needs_c)
       {
        &define_compiler_variable ($languages{'c'})
          unless defined $done{$languages{'c'}};
index 7fe6474..a28a78d 100644 (file)
@@ -29,8 +29,7 @@ use Automake::DisjConditions;
 require Exporter;
 use vars '@ISA', '@EXPORT', '@EXPORT_OK';
 @ISA = qw/Automake::Item Exporter/;
-@EXPORT = qw (reset register_suffix_rule suffix_rules_count
-              next_in_suffix_chain
+@EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
              suffixes rules $KNOWN_EXTENSIONS_PATTERN
              depend %dependencies %actions register_action
              accept_extensions
@@ -465,18 +464,6 @@ sub register_suffix_rule ($$$)
     }
 }
 
-=item C<$count = suffix_rules_count>
-
-Return the number of suffix rules added while processing the current
-F<Makefile> (excluding predefined suffix rules).
-
-=cut
-
-sub suffix_rules_count ()
-{
-  return (scalar keys %_suffix_rules) - (scalar keys %_suffix_rules_builtin);
-}
-
 =item C<@list = suffixes>
 
 Return the list of known suffixes.
index f2eb648..007094f 100644 (file)
@@ -42,7 +42,6 @@ t/remake-timing-bug-pr8365.sh \
 t/lex-subobj-nodep.sh \
 t/subobj-indir-pr13928.sh \
 t/subobj-vpath-pr13928.sh \
-t/suffix-extra-c-stuff-pr14560.sh \
 t/remake-am-pr10111.sh \
 t/remake-m4-pr10111.sh \
 $(perl_fake_XFAIL_TESTS)