automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-640-


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-640-gf4f5bbe
Date: Sat, 15 Jan 2011 20:27:19 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=f4f5bbe6f3094c3817efa63695844a5b1dca2ceb

The branch, master has been updated
       via  f4f5bbe6f3094c3817efa63695844a5b1dca2ceb (commit)
       via  19a272ee9a1c7a1f2a4de9bac8e56f83dcbde06e (commit)
       via  228b82698e108071a053581a17e6b89c58fbf9be (commit)
       via  1c760b1c009b1f474b64bacc2b5e705e237ea198 (commit)
       via  1609491e95df66d8119ada02eeeb4070ca3a9a28 (commit)
       via  f90a06c1eb001d03366b3bd50699d0672ca2cbdb (commit)
       via  2bc047b1d6ba46439219979634a999c3e3be41ce (commit)
       via  9a88bf663b640f2960111b387ad572ee1aa3a7b7 (commit)
       via  b67240eb097e5b1ef2b76492e07dc706ee5103bd (commit)
       via  b638d1355fa5e685e0011196247b81a875dbe523 (commit)
       via  0bdcb49a98a4d57a2daac9945d1623e39c3c8a91 (commit)
       via  b9ddbaa09383161fbf1a35de650abfc19f94f001 (commit)
      from  9217054b5bd016069548688ebce64aa4989a127d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f4f5bbe6f3094c3817efa63695844a5b1dca2ceb
Merge: 9217054 19a272e
Author: Stefano Lattarini <address@hidden>
Date:   Sat Jan 15 15:49:52 2011 +0100

    Merge branch 'warns-win-over-strictness'
    
    * warns-win-over-strictness:
      Update docs w.r.t. warning and strictness options.
      More tests on warnings/strictness precedence.
      Update NEWS about the warnings-over-strictness precedence.
      Warnings win over strictness in AUTOMAKE_OPTIONS.
      Change signature of 'Automake::Options::_process_option_list()'.
      Add more tests about AUTOMAKE_OPTIONS.
      Warnings win over strictness in AM_INIT_AUTOMAKE.
      Warnings win over strictness on command line.
      More tests on warnings and strictness.
      New test on silent-rules mode and portability warnings.
      Add new tests on strictness and warnings precedence and overriding.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   94 +++++++++++++++
 NEWS                                               |    9 ++
 automake.in                                        |   47 +++++---
 doc/automake.texi                                  |   57 +++++++++-
 lib/Automake/Options.pm                            |   73 ++++++++----
 tests/Makefile.am                                  |   13 ++-
 tests/Makefile.in                                  |   13 ++-
 tests/amopts-location.test                         |   83 +++++++++++++
 ...-subdir.test => amopts-variable-expansion.test} |   54 ++++-----
 tests/gnuwarn.test                                 |   15 ++-
 tests/silent-nowarn.test                           |   44 +++++++
 tests/strictness-override.test                     |  123 ++++++++++++++++++++
 tests/strictness-precedence.test                   |   77 ++++++++++++
 tests/warning-groups-win-over-strictness.test      |   64 ++++++++++
 tests/warnings-override.test                       |  111 ++++++++++++++++++
 tests/warnings-precedence.test                     |   77 ++++++++++++
 tests/warnings-strictness-interactions.test        |   59 ++++++++++
 tests/{auxdir.test => warnings-unknown.test}       |   29 +++---
 tests/warnings-win-over-strictness.test            |   90 ++++++++++++++
 19 files changed, 1035 insertions(+), 97 deletions(-)
 create mode 100755 tests/amopts-location.test
 copy tests/{autodist-acconfig-no-subdir.test => 
amopts-variable-expansion.test} (50%)
 create mode 100755 tests/silent-nowarn.test
 create mode 100755 tests/strictness-override.test
 create mode 100755 tests/strictness-precedence.test
 create mode 100755 tests/warning-groups-win-over-strictness.test
 create mode 100755 tests/warnings-override.test
 create mode 100755 tests/warnings-precedence.test
 create mode 100755 tests/warnings-strictness-interactions.test
 copy tests/{auxdir.test => warnings-unknown.test} (54%)
 create mode 100755 tests/warnings-win-over-strictness.test

diff --git a/ChangeLog b/ChangeLog
index 651ba48..cb7cf2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,97 @@
+2011-01-15  Stefano Lattarini  <address@hidden>
+
+       Update docs w.r.t. warning and strictness options.
+       * doc/automake.texi (Strictness): Document that some warnings are
+       turned off by default in `foreign' strictness.
+       (Options): Divide into new sections "Options generalities" and
+       "List of Automake options".  Fix typo (colon instead of full
+       stop).  Document option precedence (AUTOMAKE_OPTIONS wins over
+       AM_INIT_AUTOMAKE which wins over command line).  Also document
+       interactions between options specifying strictness and those
+       specifying warnings.
+
+       More tests on warnings/strictness precedence.
+       * tests/warning-groups-win-over-strictness.test: New test, similar
+       to `warnings-win-over-strictness.test', but checking the explicit
+       catch-all warning flags (like `-Wall' and `-Wnone').
+       * tests/Makefile.am (TESTS): Update.
+
+       Update NEWS about the warnings-over-strictness precedence.
+       * NEWS: Automake explicit warning levels always take precedence
+       over the implicit warning levels implied by Automake strictness.
+
+       For PR automake/547:
+       Warnings win over strictness in AUTOMAKE_OPTIONS.
+       Ensure that, for what concerns the options specified in
+       AUTOMAKE_OPTIONS, explicitly-defined warnings always take
+       precedence over implicit strictness-implied warnings.
+       This finally fixes Automake bug#7669 a.k.a. PR/547.
+       * automake.in (handle_options): Call 'process_option_list'
+       only once per set of options.
+       * lib/Automake/Options.pm (process_global_option_list,
+       process_option_list): Add sanity checks.
+       ($_options_processed, $_global_options_processed): New
+       internal variables, used by the sanity checks above.
+       * tests/warnings-win-over-strictness.test: Extend.
+
+       For PR automake/547:
+       Change signature of 'Automake::Options::_process_option_list()'.
+       This only modifies internal details in the automake implementation,
+       bearing no externally visible effect, but preparing the way for the
+       final fix of Automake bug#7669 a.k.a. PR/547.
+       * lib/Automake/Options.pm (_process_option_list): Accept as
+       arguments a list of hash references with keys 'option' and 'where',
+       where 'option' is an option as might occur in AUTOMAKE_OPTIONS or
+       AM_INIT_AUTOMAKE, and 'where' is the location where it occurred.
+       (process_option_list, process_global_option_list): Updated.
+       * automake.in (handle_options, scan_autoconf_traces): Update.
+
+       Add more tests about AUTOMAKE_OPTIONS.
+       In view of soon-to-follow refactorings (still in the pursuit of a
+       fix for Automake bug#7669 a.k.a. PR/547), add some more tests on
+       AUTOMAKE_OPTIONS support, to prevent obvious regressions.
+       * tests/amopts-variable-expansion.test: New test.
+       * tests/amopts-location.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+       For PR automake/547:
+       Warnings win over strictness in AM_INIT_AUTOMAKE.
+       This change ensures that, for what concerns the options specified
+       in AM_INIT_AUTOMAKE,  explicitly-defined warnings always take
+       precedence over implicit strictness-implied warnings.  Related to
+       Automake bug#7669 a.k.a. PR/547.
+       * lib/Automake/Options.pm (_process_option_list): Parse explicit
+       warnings only after the strictness level has been set.  Fix POD
+       documentation.
+       * tests/warnings-win-over-strictness.test: Extend.
+
+       For PR automake/547:
+       Warnings win over strictness on command line.
+       Ensure that, on the command line at least, explicitly defined
+       warnings always take precedence over implicit strictness-implied
+       warnings.  Related to Automake bug#7669 a.k.a. PR/547.
+       * automake.in (parse_arguments): Parse warnings only after the
+       strictness level has been processed.
+       * tests/gnuwarn.test: Update, plus miscellaneous improvements.
+       * tests/warnings-win-over-strictness.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+       More tests on warnings and strictness.
+       * tests/warnings-strictness-interactions.test: New test.
+       * tests/warnings-unknown.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+       New test on silent-rules mode and portability warnings.
+       * tests/silent-nowarn.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+       Add new tests on strictness and warnings precedence and overriding.
+       * tests/strictness-override.test: New test.
+       * tests/strictness-precedence.test: New test.
+       * tests/warnings-override.test: New test.
+       * tests/warnings-precedence.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-01-15  Ralf Wildenhues  <address@hidden>
 
        Fix remake rule-induced test failures with HP-UX make.
diff --git a/NEWS b/NEWS
index 417cc5c..bbc177d 100644
--- a/NEWS
+++ b/NEWS
@@ -108,6 +108,15 @@ Bugs fixed in 1.11a:
 
   - Automake now complains if a `*YFLAGS' variable has any conditional
     content, not only a conditional definition.
+
+  - Explicit enabling and/or disabling of Automake warning categories
+    through the `-W...' options now always takes precedence over the
+    implicit warning level implied by Automake strictness (foreign, gnu
+    or gnits),  regardless of the order in which such strictness and
+    warning flags appear.  For example, a setting like:
+      AUTOMAKE_OPTIONS = -Wall --foreign
+    will cause the warnings in category `portability' to be enabled, even
+    if those warnings are by default disabled in `foreign' strictness.
 
 New in 1.11:
 
diff --git a/automake.in b/automake.in
index 1d4601b..ef3b8a6 100644
--- a/automake.in
+++ b/automake.in
@@ -1244,12 +1244,10 @@ sub handle_options
          msg_var ('unsupported', $var,
                   "`AUTOMAKE_OPTIONS' cannot have conditional contents");
        }
-      foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE,
-                                                         location => 1))
-       {
-         my ($loc, $value) = @$locvals;
-         return 1 if (process_option_list ($loc, $value))
-       }
+      my @options = map { { option => $_->[1], where => $_->[0] } }
+                       $var->value_as_list_recursive (cond_filter => TRUE,
+                                                      location => 1);
+      return 1 if process_option_list (@options);
     }
 
   # Override portability-recursive warning.
@@ -5469,9 +5467,9 @@ sub scan_autoconf_traces ($)
            }
          elsif (defined $args[1])
            {
-             exit $exit_code
-               if (process_global_option_list ($where,
-                                               split (' ', $args[1])));
+             my @opts = split (' ', $args[1]);
+             @opts = map { { option => $_, where => $where } } @opts;
+             exit $exit_code if process_global_option_list (@opts);
            }
        }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
@@ -8467,26 +8465,26 @@ EOF
 # Parse command line.
 sub parse_arguments ()
 {
-  # Start off as gnu.
-  set_strictness ('gnu');
+  my $strict = 'gnu';
+  my $cygnus = 0;
+  my $ignore_deps = 0;
+  my @warnings = ();
 
-  my $cli_where = new Automake::Location;
   my %cli_options =
     (
      'libdir=s'        => \$libdir,
-     'gnu'             => sub { set_strictness ('gnu'); },
-     'gnits'           => sub { set_strictness ('gnits'); },
-     'cygnus'          => sub { set_global_option ('cygnus', $cli_where); },
-     'foreign'          => sub { set_strictness ('foreign'); },
-     'include-deps'    => sub { unset_global_option ('no-dependencies'); },
-     'i|ignore-deps'   => sub { set_global_option ('no-dependencies',
-                                                   $cli_where); },
+     'gnu'             => sub { $strict = 'gnu'; },
+     'gnits'           => sub { $strict = 'gnits'; },
+     'foreign'         => sub { $strict = 'foreign'; },
+     'cygnus'          => \$cygnus,
+     'include-deps'    => sub { $ignore_deps = 0; },
+     'i|ignore-deps'   => sub { $ignore_deps = 1; },
      'no-force'        => sub { $force_generation = 0; },
      'f|force-missing'  => \$force_missing,
      'a|add-missing'   => \$add_missing,
      'c|copy'          => \$copy_missing,
      'v|verbose'       => sub { setup_channel 'verb', silent => 0; },
-     'W|warnings=s'     => \&parse_warnings,
+     'W|warnings=s'     => address@hidden,
      );
   use Getopt::Long;
   Getopt::Long::config ("bundling", "pass_through");
@@ -8515,6 +8513,15 @@ sub parse_arguments ()
   Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {}
     or exit 1;
 
+  set_strictness ($strict);
+  my $cli_where = new Automake::Location;
+  set_global_option ('cygnus', $cli_where) if $cygnus;
+  set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
+  for my $warning (@warnings)
+    {
+      &parse_warnings ('-W', $warning);
+    }
+
   return unless @ARGV;
 
   if ($ARGV[0] =~ /^-./)
diff --git a/doc/automake.texi b/doc/automake.texi
index 8c98ce8..51d7304 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -320,6 +320,11 @@ Support for test suites
 * DejaGnu Tests::               Interfacing with the external testing framework
 * Install Tests::               Running tests on installed packages
 
+Changing Automake's Behavior
+
+* Options generalities::        Semantics of Automake option
+* List of Automake options::    A comprehensive list of Automake options
+
 Miscellaneous Rules
 
 * Tags::                        Interfacing to cscope, etags and mkid
@@ -1899,7 +1904,9 @@ The valid strictness levels are:
 Automake will check for only those things that are absolutely
 required for proper operations.  For instance, whereas GNU standards
 dictate the existence of a @file{NEWS} file, it will not be required in
-this mode.  The name comes from the fact that Automake is intended to be
+this mode.  This strictness will also turn off some warnings by default
+(among them, portability warnings).
+The name comes from the fact that Automake is intended to be
 used for GNU programs; these relaxed rules are not the standard mode of
 operation.
 
@@ -9023,8 +9030,16 @@ will now be rerun each time the version number is 
bumped, when only
 @node Options
 @chapter Changing Automake's Behavior
 
address@hidden
+* Options generalities::        Semantics of Automake option
+* List of Automake options::    A comprehensive list of Automake options
address@hidden menu
+
address@hidden Options generalities
address@hidden Options generalities
+
 Various features of Automake can be controlled by options.  Except where
-noted otherwise, options can be specified in one of several ways: Most
+noted otherwise, options can be specified in one of several ways.  Most
 options can be applied on a address@hidden basis when listed in a
 special @file{Makefile} variable named @code{AUTOMAKE_OPTIONS}.  Some
 of these options only make sense when specified in the toplevel
@@ -9034,7 +9049,43 @@ of these options only make sense when specified in the 
toplevel
 require changes to the @command{configure} script can only be specified
 there.  These are annotated below.
 
-Currently understood options are:
+As a general rule, options specified in @code{AUTOMAKE_OPTIONS} take
+precedence over those specified in @code{AM_INIT_AUTOMAKE}, which in
+turn take precedence over those specified on the command line.
+
+Also, some care must be taken about the interactions among strictness
+level and warning categories.  As a general rule, strictness-implied
+warnings are overridden by those specified by explicit options.  For
+example, even if @samp{portability} warnings are disabled by default
+in @option{foreign} strictness, an usage like this will end up enabling
+them:
+
address@hidden
+AUTOMAKE_OPTIONS = -Wportability foreign
address@hidden example
+
+However, a strictness level specified in a higher-priority context
+will override all the explicit warnings specified in a lower-priority
+context.  For example, if @file{configure.ac} contains:
+
address@hidden
+AM_INIT_AUTOMAKE([-Wportability])
address@hidden example
+
address@hidden
+and @file{Makefile.am} contains:
+
address@hidden
+AUTOMAKE_OPTIONS = foreign
address@hidden example
+
address@hidden
+then @samp{portability} warnings will be @emph{disabled} in
address@hidden
+
address@hidden List of Automake options
address@hidden List of Automake options
+
 @vindex AUTOMAKE_OPTIONS
 
 @table @asis
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index a6d65a8..31052c0 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -76,6 +76,12 @@ F<Makefile.am>s.
 use vars '%_options';          # From AUTOMAKE_OPTIONS
 use vars '%_global_options';   # from AM_INIT_AUTOMAKE or the command line.
 
+# Whether process_option_list has already been called for the current
+# Makefile.am.
+use vars '$_options_processed';
+# Whether process_global_option_list has already been called.
+use vars '$_global_options_processed';
+
 =head2 Constants
 
 =over 4
@@ -135,6 +141,7 @@ previous F<Makefile.am>.
 
 sub reset ()
 {
+  $_options_processed = 0;
   %_options = %_global_options;
   # The first time we are run,
   # remember the current setting as the default.
@@ -222,29 +229,39 @@ sub unset_global_option ($)
 }
 
 
-=item C<process_option_list ($where, @options)>
+=item C<process_option_list (@list)>
+
+=item C<process_global_option_list (@list)>
 
-=item C<process_global_option_list ($where, @options)>
+Process Automake's option lists.  C<@list> should be a list of hash
+references with keys C<option> and C<where>, where C<option> is an
+option as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>,
+and C<where> is the location where that option occurred.
 
-Process Automake's option lists.  C<@options> should be a list of
-words, as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>.
+These functions should be called at most once for each set of options
+having the same precedence; i.e., do not call it twice for two options
+from C<AM_INIT_AUTOMAKE>.
 
 Return 1 on error, 0 otherwise.
 
 =cut
 
 # $BOOL
-# _process_option_list (\%OPTIONS, $WHERE, @OPTIONS)
-# --------------------------------------------------
-# Process a list of options.  Return 1 on error, 0 otherwise.
-# \%OPTIONS is the hash to fill with options data, $WHERE is
-# the location where @OPTIONS occurred.
-sub _process_option_list (\%$@)
+# _process_option_list (\%OPTIONS, @LIST)
+# ------------------------------------------
+# Process a list of options.  \%OPTIONS is the hash to fill with options
+# data.  @LIST is a list of options as get passed to public subroutines
+# process_option_list() and process_global_option_list() (see POD
+# documentation above).
+sub _process_option_list (\%@)
 {
-  my ($options, $where, @list) = @_;
+  my ($options, @list) = @_;
+  my @warnings = ();
 
-  foreach (@list)
+  foreach my $h (@list)
     {
+      my $_ = $h->{'option'};
+      my $where = $h->{'where'};
       $options->{$_} = $where;
       if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
        {
@@ -313,11 +330,8 @@ sub _process_option_list (\%$@)
        }
       elsif (/^(?:--warnings=|-W)(.*)$/)
        {
-         foreach my $cat (split (',', $1))
-           {
-             msg 'unsupported', $where, "unknown warning category `$cat'"
-               if switch_warning $cat;
-           }
+         my @w = map { { cat => $_, loc => $where} } split (',', $1);
+         push @warnings, @w;
        }
       else
        {
@@ -326,19 +340,32 @@ sub _process_option_list (\%$@)
          return 1;
        }
     }
+  # We process warnings here, so that any explicitly-given warning setting
+  # will take precedence over warning settings defined implicitly by the
+  # strictness.
+  foreach my $w (@warnings)
+    {
+      msg 'unsupported', $w->{'loc'},
+          "unknown warning category `$w->{'cat'}'"
+       if switch_warning $w->{cat};
+    }
   return 0;
 }
 
-sub process_option_list ($@)
+sub process_option_list (@)
 {
-  my ($where, @list) = @_;
-  return _process_option_list (%_options, $where, @list);
+  prog_error "local options already processed"
+    if $_options_processed;
+  return _process_option_list (%_options, @_);
+  $_options_processed = 1;
 }
 
-sub process_global_option_list ($@)
+sub process_global_option_list (@)
 {
-  my ($where, @list) = @_;
-  return _process_option_list (%_global_options, $where, @list);
+  prog_error "global options already processed"
+    if $_global_options_processed;
+  return _process_option_list (%_global_options, @_);
+  $_global_options_processed = 1;
 }
 
 =item C<set_strictness ($name)>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f231938..eb7f712 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to create Makefile.in
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+# 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -134,6 +134,8 @@ alpha2.test \
 amassign.test \
 ammissing.test \
 amopt.test \
+amopts-location.test \
+amopts-variable-expansion.test \
 amsubst.test \
 ansi.test \
 ansi2.test \
@@ -792,6 +794,7 @@ silent-lex-gcc.test \
 silent-lex-generic.test \
 silent-yacc-gcc.test \
 silent-yacc-generic.test \
+silent-nowarn.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
@@ -813,6 +816,8 @@ stdinc.test \
 stamph2.test \
 stdlib.test \
 stdlib2.test \
+strictness-override.test \
+strictness-precedence.test \
 strip.test \
 strip2.test \
 strip3.test \
@@ -942,7 +947,13 @@ vtexi.test \
 vtexi2.test \
 vtexi3.test \
 vtexi4.test \
+warnings-override.test \
+warnings-precedence.test \
+warnings-strictness-interactions.test \
+warnings-unknown.test \
 warnopts.test \
+warnings-win-over-strictness.test \
+warning-groups-win-over-strictness.test \
 werror.test \
 werror2.test \
 werror3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index c2d2b8f..ac88261 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -16,7 +16,7 @@
 @SET_MAKE@
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+# 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -397,6 +397,8 @@ alpha2.test \
 amassign.test \
 ammissing.test \
 amopt.test \
+amopts-location.test \
+amopts-variable-expansion.test \
 amsubst.test \
 ansi.test \
 ansi2.test \
@@ -1055,6 +1057,7 @@ silent-lex-gcc.test \
 silent-lex-generic.test \
 silent-yacc-gcc.test \
 silent-yacc-generic.test \
+silent-nowarn.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
@@ -1076,6 +1079,8 @@ stdinc.test \
 stamph2.test \
 stdlib.test \
 stdlib2.test \
+strictness-override.test \
+strictness-precedence.test \
 strip.test \
 strip2.test \
 strip3.test \
@@ -1205,7 +1210,13 @@ vtexi.test \
 vtexi2.test \
 vtexi3.test \
 vtexi4.test \
+warnings-override.test \
+warnings-precedence.test \
+warnings-strictness-interactions.test \
+warnings-unknown.test \
 warnopts.test \
+warnings-win-over-strictness.test \
+warning-groups-win-over-strictness.test \
 werror.test \
 werror2.test \
 werror3.test \
diff --git a/tests/amopts-location.test b/tests/amopts-location.test
new file mode 100755
index 0000000..23b75c0
--- /dev/null
+++ b/tests/amopts-location.test
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Check that errors about AUTOMAKE_OPTIONS refers to correct
+# locations.
+
+. ./defs || Exit 1
+
+cat > Makefile.am <<'END'
+# comment \
+# continued
+include Makefile0.am
+END
+
+cat > Makefile0.am <<'END'
+#1
+#2
+#3
+include Makefile1.am
+END
+
+cat > Makefile1.am <<'END'
+AUTOMAKE_OPTIONS = tar-pax
+# comment
+END
+
+cat > Makefile2.am <<'END'
+## automake comment
+bar:
+       :
+line = \
+continued
+AUTOMAKE_OPTIONS = tar-ustar
+END
+
+cat > Makefile3.am <<'END'
+quux = a
+AUTOMAKE_OPTIONS =
+quux += b
+AUTOMAKE_OPTIONS += tar-v7
+zardoz = 1
+END
+
+cat >>configure.in <<'END'
+AC_CONFIG_FILES([Makefile2 Makefile3])
+END
+
+$ACLOCAL
+# Automake options 'tar-v7', 'tar-ustar' and 'tar-pax' can only be used
+# as argument to AM_INIT_AUTOMAKE, and not in AUTOMAKE_OPTIONS.
+AUTOMAKE_fails
+
+# Check that all the expected line numbers are correctly reported
+# in automake warning/error messages.
+grep '^Makefile1\.am:1:.*tar-pax' stderr
+grep '^Makefile2\.am:6:.*tar-ustar' stderr
+grep '^Makefile3\.am:2:.*tar-v7' stderr
+grep '^Makefile\.am:3:.*Makefile0\.am.*included from here' stderr
+grep '^Makefile0\.am:4:.*Makefile1\.am.*included from here' stderr
+
+# And also check that no botched line number is reported.
+cat stderr \
+  | grep -v '^Makefile\.am:3:'  \
+  | grep -v '^Makefile0\.am:4:' \
+  | grep -v '^Makefile1\.am:1:' \
+  | grep -v '^Makefile2\.am:6:' \
+  | grep -v '^Makefile3\.am:2:' \
+  | grep . && Exit 1
+
+:
diff --git a/tests/autodist-acconfig-no-subdir.test 
b/tests/amopts-variable-expansion.test
similarity index 50%
copy from tests/autodist-acconfig-no-subdir.test
copy to tests/amopts-variable-expansion.test
index e6bd5a9..7a746ea 100755
--- a/tests/autodist-acconfig-no-subdir.test
+++ b/tests/amopts-variable-expansion.test
@@ -14,45 +14,39 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that `acconfig.h' is *not* automatically distributed when
-# placed in a subdirectory.
-# Related to automake bug#7819.
+# Check that AUTOMAKE_OPTIONS support variable expansion.
 
 . ./defs || Exit 1
 
-set -e
+# We want complete control over automake options.
+AUTOMAKE=$original_AUTOMAKE
 
-cat >> configure.in <<END
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([-Wall -Werror gnu])
+AC_CONFIG_FILES([Makefile])
 END
 
 cat > Makefile.am <<'END'
-SUBDIRS = sub
-sub/acconfig.h:
-       echo target $@ should not be built >&2; exit 1
-check-local: distdir
-       ls -l $(distdir)/sub
-       test ! -f $(distdir)/sub/acconfig.h
+# The following should expand to `-Wnone -Wno-error foreign -Wportability'.
+AUTOMAKE_OPTIONS = $(foo) foreign
+AUTOMAKE_OPTIONS += ${bar}
+foo = $(foo1)
+foo1 = ${foo2}
+foo2 = -Wnone
+foo2 += $(foo3)
+foo3 = -Wno-error
+bar = -Wportability
+## This will give a warning with `-Wportability'
+zardoz :=
+## This would give a warning with `-Woverride'.
+install:
 END
 
-mkdir sub
-
-cat > sub/Makefile.am <<'END'
-acconfig.h:
-       echo target $@ should not be built >&2; exit 1
-check-local:
-       echo $(DISTFILES) | grep 'acconfig\.h' && exit 1; :
-       echo $(DIST_COMMON) | grep 'acconfig\.h' && exit 1; :
-END
-
-: > sub/acconfig.h
-
 $ACLOCAL
-$AUTOMAKE
-$AUTOCONF
-
-./configure
-$MAKE check
+AUTOMAKE_run 0
+grep '^Makefile\.am:.*:=.*not portable' stderr
+grep README stderr && Exit 1
+$EGREP '(install|override)' stderr && Exit 1
 
 :
diff --git a/tests/gnuwarn.test b/tests/gnuwarn.test
index 43987b9..3db7e85 100755
--- a/tests/gnuwarn.test
+++ b/tests/gnuwarn.test
@@ -18,6 +18,9 @@
 
 . ./defs || Exit 1
 
+# We need (almost) complete control over automake options.
+AUTOMAKE="$original_AUTOMAKE -Werror"
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
@@ -38,12 +41,14 @@ END
 
 $ACLOCAL
 # Don't warn in foreign mode
-$AUTOMAKE -Wnone --add-missing --foreign
+$AUTOMAKE --add-missing --foreign
 # Warn in gnu mode
-AUTOMAKE_fails -Wnone --add-missing --gnu
-grep 'Makefile.am:1:.*CFLAGS' stderr
-grep 'Makefile.am:2:.*LDFLAGS' stderr
+AUTOMAKE_fails --add-missing --gnu
+grep '^Makefile\.am:1:.*CFLAGS' stderr
+grep '^Makefile\.am:2:.*LDFLAGS' stderr
 # No reason to warn about CXXFLAGS since it's not used.
 grep CXXFLAGS stderr && Exit 1
 # Don't warn if -Wno-gnu.
-$AUTOMAKE -Wnone --gnu -Wno-gnu
+$AUTOMAKE --gnu -Wno-gnu
+
+:
diff --git a/tests/silent-nowarn.test b/tests/silent-nowarn.test
new file mode 100755
index 0000000..f0f5e70
--- /dev/null
+++ b/tests/silent-nowarn.test
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Check that the 'silent-rules' mode suppresses the warnings for recursive
+# make variable expansions.  This should happen regardless of whether and
+# where these warnings are requested.
+
+. ./defs || Exit 1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+# Yes, we repeat the warnings two times, both before and after
+# 'silent-rules'.  This is deliberate.
+AM_INIT_AUTOMAKE([gnu -Wall -Wportability-recursive
+                      silent-rules
+                      -Wall -Wportability-recursive])
+AC_CONFIG_FILES([Makefile])
+END
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = gnu -Wall -Wportability-recursive
+foo = $($(v)) $(x$(v)) $($(v)x) $(y$(v)z)
+END
+
+# Files required bu gnu strictness.
+touch AUTHORS ChangeLog COPYING INSTALL NEWS README THANKS
+
+$ACLOCAL
+$AUTOMAKE --gnu -Wall -Wportability-recursive
+
+:
diff --git a/tests/strictness-override.test b/tests/strictness-override.test
new file mode 100755
index 0000000..aacb561
--- /dev/null
+++ b/tests/strictness-override.test
@@ -0,0 +1,123 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# The strictness specified in Makefile.am:AUTOMAKE_OPTIONS should
+# override that specified in configure.in:AM_INIT_AUTOMAKE, and both
+# should override the strictness specified on the command line.
+# NOTE: the current semantics might not be the best one (even if it has
+# been in place for quite a long time); see also Automake bug #7673.
+# Update this test if the semantics are changed.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$original_AUTOMAKE
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS =
+END
+
+set_strictness ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE -Werror $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep 'required file.*README' stderr
+}
+
+$ACLOCAL
+
+# Leave out only one of the required files, to avoid too much
+# repetition in the error messages.
+touch INSTALL NEWS AUTHORS ChangeLog COPYING
+
+rm -rf autom4te*.cache
+set_strictness '' Makefile.am
+set_strictness '' configure.in
+ko --gnu
+ko
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'gnu' Makefile.am
+set_strictness '' configure.in
+ko --gnu
+ko
+ko --foreign
+
+rm -rf autom4te*.cache
+set_strictness '' Makefile.am
+set_strictness 'gnu' configure.in
+ko --gnu
+ko
+ko --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'foreign' Makefile.am
+set_strictness '' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness '' Makefile.am
+set_strictness 'foreign' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'gnu' Makefile.am
+set_strictness 'gnu' configure.in
+ko --gnu
+ko
+ko --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'foreign' Makefile.am
+set_strictness 'foreign' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'foreign' Makefile.am
+set_strictness 'gnu' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'gnu' Makefile.am
+set_strictness 'foreign' configure.in
+ko --gnu
+ko
+ko --foreign
+
+:
diff --git a/tests/strictness-precedence.test b/tests/strictness-precedence.test
new file mode 100755
index 0000000..a949215
--- /dev/null
+++ b/tests/strictness-precedence.test
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS,
+# strictness specified later should take precedence over strictness
+# specified earlier.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$original_AUTOMAKE
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS =
+END
+
+set_strictness ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE -Werror $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep 'required file.*README' stderr
+}
+
+# Leave out only one of the required files, to avoid too much
+# repetition in the error messages.
+touch INSTALL NEWS AUTHORS ChangeLog COPYING
+
+$ACLOCAL
+ko --foreign --gnu
+ok --gnu --foreign
+
+set_strictness '' Makefile.am
+set_strictness 'gnu foreign' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ok
+set_strictness 'foreign gnu' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ko
+
+set_strictness '' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+set_strictness 'gnu foreign' Makefile.am
+ok
+set_strictness 'foreign gnu' Makefile.am
+ko
+
+:
diff --git a/tests/warning-groups-win-over-strictness.test 
b/tests/warning-groups-win-over-strictness.test
new file mode 100755
index 0000000..a291442
--- /dev/null
+++ b/tests/warning-groups-win-over-strictness.test
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Check that explicitly-defined warning levels take precedence over
+# implicit strictness-implied warnings, even when these explicit warning
+# levels are "catch-all warnings" (such as `-Wall' and `-Wnone').
+# Since we are at it, also throw in *.am and *.m4 file inclusions.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$original_AUTOMAKE
+
+# Files required in gnu and/or gnits strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING THANKS
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+m4_include([am-init-automake.m4])
+AC_PROG_CC
+AC_CONFIG_FILES([Makefile])
+# Other similar tests do not use AC_OUTPUT, so we use it here,
+# for completeness and for better coverage.
+AC_OUTPUT
+END
+
+cat > Makefile.am <<END
+include automake-options.am
+FOO := bar
+END
+
+rm -rf autom4te*.cache
+: > automake-options.am
+echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
+$ACLOCAL
+AUTOMAKE_fails -Werror -Wall --foreign
+grep '^Makefile\.am:.*:=.*not portable' stderr
+
+rm -rf autom4te*.cache
+: > automake-options.am
+echo 'AM_INIT_AUTOMAKE([-Werror -Wnone gnu])' > am-init-automake.m4
+$ACLOCAL
+$AUTOMAKE
+
+rm -rf autom4te*.cache
+echo 'AUTOMAKE_OPTIONS = -Werror -Wnone gnits' > automake-options.am
+echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
+$ACLOCAL
+$AUTOMAKE
+
+:
diff --git a/tests/warnings-override.test b/tests/warnings-override.test
new file mode 100755
index 0000000..728a7c0
--- /dev/null
+++ b/tests/warnings-override.test
@@ -0,0 +1,111 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# The warnings specified in Makefile.am:AUTOMAKE_OPTIONS should override
+# those specified in configure.in:AM_INIT_AUTOMAKE, and both should
+# override the warnings specified on the command line.
+# NOTE: the current semantics might not be the best one (even if it has
+# been in place for quite a long time); see also Automake bug #7673.
+# Update this test if the semantics are changed.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$original_AUTOMAKE -Werror"
+
+cat > Makefile.am <<'END'
+FOO := bar
+AUTOMAKE_OPTIONS =
+END
+
+set_warnings ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep '^Makefile\.am:1:.*:=.*not portable' stderr
+}
+
+$ACLOCAL
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+rm -rf autom4te*.cache
+set_warnings '-Wno-portability' Makefile.am
+set_warnings '' configure.in
+
+ok -Wportability
+ok
+
+rm -rf autom4te*.cache
+set_warnings '' Makefile.am
+set_warnings '-Wno-portability' configure.in
+
+ok -Wportability
+ok
+
+rm -rf autom4te*.cache
+set_warnings '-Wno-portability' Makefile.am
+set_warnings '-Wno-portability' configure.in
+
+ok -Wportability
+
+rm -rf autom4te*.cache
+set_warnings '-Wportability' Makefile.am
+set_warnings '' configure.in
+
+ko
+ko -Wno-portability
+
+rm -rf autom4te*.cache
+set_warnings '' Makefile.am
+set_warnings '-Wportability' configure.in
+
+ko
+ko -Wno-portability
+
+rm -rf autom4te*.cache
+set_warnings '-Wportability' Makefile.am
+set_warnings '-Wportability' configure.in
+ko -Wno-portability
+
+rm -rf autom4te*.cache
+set_warnings '-Wno-portability' Makefile.am
+set_warnings '-Wportability' configure.in
+ok
+ok -Wportability
+
+rm -rf autom4te*.cache
+set_warnings '-Wportability' Makefile.am
+set_warnings '-Wno-portability' configure.in
+ko
+ko -Wno-portability
+
+:
diff --git a/tests/warnings-precedence.test b/tests/warnings-precedence.test
new file mode 100755
index 0000000..0f11669
--- /dev/null
+++ b/tests/warnings-precedence.test
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS,
+# warnings specified later should take precedence over those specified
+# earlier.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$original_AUTOMAKE -Werror"
+
+cat > Makefile.am <<'END'
+FOO := bar
+AUTOMAKE_OPTIONS =
+END
+
+set_warnings ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep '^Makefile\.am:1:.*:=.*not portable' stderr
+}
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+$ACLOCAL
+ok -Wportability -Wno-portability
+ko -Wno-portability -Wportability
+
+set_warnings '' Makefile.am
+set_warnings '-Wportability -Wno-portability' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ok
+set_warnings '-Wno-portability -Wportability' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ko
+
+set_warnings '' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+set_warnings '-Wportability -Wno-portability' Makefile.am
+ok
+set_warnings '-Wno-portability -Wportability' Makefile.am
+ko
+
+:
diff --git a/tests/warnings-strictness-interactions.test 
b/tests/warnings-strictness-interactions.test
new file mode 100755
index 0000000..e2c7675
--- /dev/null
+++ b/tests/warnings-strictness-interactions.test
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Check that the default warnings triggered by a strictness specified
+# in AUTOMAKE_OPTIONS take precedence over explicit warnings given in
+# AM_INIT_AUTOMAKE.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$original_AUTOMAKE -Werror"
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
+FOO := bar
+END
+
+set_am_opts ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+set_am_opts '-Wportability' configure.in
+set_am_opts 'foreign' Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+
+rm -rf autom4te*.cache
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+set_am_opts '-Wno-portability' configure.in
+set_am_opts 'gnu' Makefile.am
+
+AUTOMAKE_fails
+$ACLOCAL
+grep '^Makefile\.am:2:.*:=.*not portable' stderr
+
+:
diff --git a/tests/auxdir.test b/tests/warnings-unknown.test
similarity index 54%
copy from tests/auxdir.test
copy to tests/warnings-unknown.test
index 04e69f8..77ed589 100755
--- a/tests/auxdir.test
+++ b/tests/warnings-unknown.test
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007, 2010, 2011 Free
-# Software Foundation, Inc.
+# Copyright (C) 2011 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
@@ -15,29 +14,31 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# Check that automake complains about unknown warnings.
 
 . ./defs || Exit 1
 
-# The "./." is here so we don't have to mess with subdirs.
+# We want (almost) complete control over automake options.
+AUTOMAKE="$original_AUTOMAKE --foreign -Werror"
+
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
-AC_CONFIG_AUX_DIR([./.])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([-Wno-zardoz])
 AC_CONFIG_FILES([Makefile])
 END
 
-cat > Makefile.am << 'END'
-pkgdata_DATA =
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS = -Wfoobar
 END
 
-cp "$top_testsrcdir/lib/mkinstalldirs" .
-
-# The "././" prefix confuses Automake into thinking it is doing a
-# subdir build.  Yes, this is hacky.
 $ACLOCAL
-$AUTOMAKE ././Makefile
 
-grep '/\./\./mkinstalldirs' Makefile.in
+AUTOMAKE_fails -Wbazquux
+grep '^configure\.in:2:.* unknown warning category.*zardoz' stderr
+grep '^Makefile\.am:1:.* unknown warning category.*foobar' stderr
+grep '^automake:.* unknown warning category.*bazquux' stderr
+
+# Check that we can override warnings about unknown warning categories.
+$AUTOMAKE -Wno-unsupported -Wbazquux
 
 :
diff --git a/tests/warnings-win-over-strictness.test 
b/tests/warnings-win-over-strictness.test
new file mode 100755
index 0000000..0db3176
--- /dev/null
+++ b/tests/warnings-win-over-strictness.test
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Check that, on the command line, explicitly-defined warnings take
+# precedence over implicit strictness-implied warnings.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$original_AUTOMAKE
+
+ok ()
+{
+  AUTOMAKE_run 0 $*
+  test ! -s stderr
+}
+
+ko ()
+{
+  AUTOMAKE_run 0 $*
+  grep '^Makefile\.am:.*:=.*not portable' stderr
+  test `wc -l <stderr` -eq 1
+}
+
+set_am_opts()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
+FOO := bar
+END
+
+$ACLOCAL
+
+ko --foreign -Wportability
+ko -Wportability --foreign
+ok --gnu -Wno-portability
+ok -Wno-portability --gnu
+
+set_am_opts '' Makefile.am
+
+rm -rf autom4te*.cache
+set_am_opts 'foreign -Wportability' configure.in
+ko
+rm -rf autom4te*.cache
+set_am_opts '-Wportability foreign' configure.in
+ko
+rm -rf autom4te*.cache
+set_am_opts 'gnu -Wno-portability' configure.in
+ok
+rm -rf autom4te*.cache
+set_am_opts '-Wno-portability gnu' configure.in
+ok
+
+rm -rf autom4te*.cache
+set_am_opts '' configure.in
+
+set_am_opts 'foreign -Wportability' Makefile.am
+ko
+set_am_opts '-Wportability foreign' Makefile.am
+ko
+set_am_opts 'gnu -Wno-portability' Makefile.am
+ok
+set_am_opts '-Wno-portability gnu' Makefile.am
+ok
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]