* automake.in (%silent_variable_override): New variable.
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 14 Apr 2003 19:13:15 +0000 (19:13 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 14 Apr 2003 19:13:15 +0000 (19:13 +0000)
(macro_define): Warn about variable definitions overriding
Automake variables.
(rule_define): Warn about target definitions overriding
Automake variables.  Fix $condmsg definition.
* automake.texi (Invoking Automake): Document the `override'
category.
* lib/Automake/ChannelDefs.pm (usage): Likewise.
* lib/am/texinfos.am [!%?CYGNUS] (MAKEINFO): Do not define,
this is already done in m4/init.m4.
* tests/dejagnu2.test: Run $MAKE, don't only grep.  Use
-Wno-override, and make sure we get a warning without.
* tests/exeext2.test, tests/substtarg.test: Use -Wno-override,
and make sure we get a warning without.
* tests/exeext3.test, tests/java2.test, tests/nolink.test,
tests/subpkg.test, tests/vartest.test: Use -Wno-override.
* tests/txinfo13.test: Use installcheck-local instead of overriding
installcheck.
* tests/txinfo2.test: Run $MAKE on the real Makefile (this test
used to succeed thanks to a failure...)
* tests/location.test: Adjust expected messages.
* tests/Makefile.am (XFAIL_TESTS): Add txinfo5.test.

22 files changed:
ChangeLog
Makefile.in
NEWS
automake.in
automake.texi
lib/Automake/ChannelDefs.pm
lib/am/texinfos.am
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/dejagnu2.test
tests/exeext2.test
tests/exeext3.test
tests/java2.test
tests/location.test
tests/nolink.test
tests/subpkg.test
tests/substtarg.test
tests/txinfo13.test
tests/txinfo2.test
tests/vartar.test
version.texi

index cae171a..0ed1cec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2003-04-14  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * automake.in (%silent_variable_override): New variable.
+       (macro_define): Warn about variable definitions overriding
+       Automake variables.
+       (rule_define): Warn about target definitions overriding
+       Automake variables.  Fix $condmsg definition.
+       * automake.texi (Invoking Automake): Document the `override'
+       category.
+       * lib/Automake/ChannelDefs.pm (usage): Likewise.
+       * lib/am/texinfos.am [!%?CYGNUS] (MAKEINFO): Do not define,
+       this is already done in m4/init.m4.
+       * tests/dejagnu2.test: Run $MAKE, don't only grep.  Use
+       -Wno-override, and make sure we get a warning without.
+       * tests/exeext2.test, tests/substtarg.test: Use -Wno-override,
+       and make sure we get a warning without.
+       * tests/exeext3.test, tests/java2.test, tests/nolink.test,
+       tests/subpkg.test, tests/vartest.test: Use -Wno-override.
+       * tests/txinfo13.test: Use installcheck-local instead of overriding
+       installcheck.
+       * tests/txinfo2.test: Run $MAKE on the real Makefile (this test
+       used to succeed thanks to a failure...)
+       * tests/location.test: Adjust expected messages.
+       * tests/Makefile.am (XFAIL_TESTS): Add txinfo5.test.
+
 2003-04-12  Raja R Harinath  <harinath@acm.org>
 
        * lib/Automake/DisjConditions.pm (true): Don't cache answer.
index 216541b..588a5c9 100644 (file)
@@ -264,6 +264,7 @@ mostlyclean-vti:
 
 maintainer-clean-vti:
        -rm -f stamp-vti version.texi
+
 TEXI2DVI = texi2dvi
 
 TEXI2PDF = $(TEXI2DVI) --pdf --batch
diff --git a/NEWS b/NEWS
index 1b422a5..044a36e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,8 @@ New in 1.7a:
   substituted from configure.ac.  This has been requested by people
   dealing with non-POSIX ar implementations.
 
+* New warning option: -Woverride.  This will warn about any user
+  target or variable definitions which override Automake definitions.
 \f
 New in 1.7:
 * Autoconf 2.54 is required.
index db375fc..c8fe09f 100755 (executable)
@@ -276,6 +276,13 @@ my %ac_macro_for_var =
    YACC => 'AC_PROG_YACC',
    );
 
+# Variables that can be overriden without complaint from -Woverride
+my %silent_variable_override =
+  (AR => 1,
+   ARFLAGS => 1,
+   DEJATOOL => 1,
+   JAVAC => 1);
+
 # Copyright on generated Makefile.ins.
 my $gen_copyright = "\
 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
@@ -6376,9 +6383,19 @@ sub macro_define ($$$$$$$$)
          && $var_owner{$var}{$cond} != VAR_AUTOMAKE
          && $owner == VAR_AUTOMAKE)
        {
+         if (! exists $silent_variable_override{$var})
+           {
+             my $condmsg = ($cond == TRUE
+                            ? '' : (" in condition `" . $cond->human . "'"));
+             msg_cond_var ('override', $cond, $var,
+                           "user variable `$var' defined here$condmsg...",
+                           partial => 1);
+             msg ('override', $where,
+                  "... overrides Automake variable `$var' defined here");
+           }
          verb ("refusing to override the user definition of:\n"
                . macro_dump ($var)
-               ."with `$cond->human' => `$value'");
+               ."with `" . $cond->human . "' => `$value'");
        }
       else
        {
@@ -7133,11 +7150,11 @@ sub rule_define ($$$$$)
 
       # Don't mention true conditions in diagnostics.
       my $condmsg =
-       $cond == TRUE ? " in condition `" . $cond->human . "'" : '';
+       $cond == TRUE ? '' : " in condition `" . $cond->human . "'";
 
       if ($owner == TARGET_USER)
        {
-         if ($oldowner eq TARGET_USER)
+         if ($oldowner == TARGET_USER)
            {
              # Ignore `%'-style pattern rules.  We'd need the
              # dependencies to detect duplicates, and they are
@@ -7174,6 +7191,11 @@ sub rule_define ($$$$$)
        {
          if ($oldowner == TARGET_USER)
            {
+             msg_cond_target ('override', $cond, $target,
+                              "user target `$target' defined here"
+                              . "$condmsg...", partial => 1);
+             msg ('override', $where,
+                  "... overrides Automake target `$target' defined here");
              # Don't overwrite the user definition of TARGET.
              return ();
            }
index f33e8a2..afc24e4 100644 (file)
@@ -1051,6 +1051,8 @@ warnings related to the GNU Coding Standards
 (@pxref{Top, , , standards, The GNU Coding Standards}).
 @item obsolete
 obsolete features or constructions
+@item override
+user redefinitions of Automake rules or variables
 @item portability
 portability issues (e.g., use of Make features which are known not portable)
 @item syntax
index 7fb18a2..61bc1d5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 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
@@ -98,13 +98,18 @@ Warnings related to GNU Coding Standards.
 
 Warnings about obsolete features (silent by default).
 
+=item C<override>
+
+Warnings about user redefinitions of Automake rules or
+variables (silent by default).
+
 =item C<portability>
 
 Warnings about non-portable constructs.
 
 =item C<syntax>
 
-Weird syntax, unused variables, typos...
+Warnings about weird syntax, unused variables, typos...
 
 =item C<unsupported>
 
@@ -139,6 +144,7 @@ register_channel 'automake', type => 'fatal', backtrace => 1,
 
 register_channel 'gnu', type => 'warning';
 register_channel 'obsolete', type => 'warning', silent => 1;
+register_channel 'override', type => 'warning', silent => 1;
 register_channel 'portability', type => 'warning', silent => 1;
 register_channel 'syntax', type => 'warning';
 register_channel 'unsupported', type => 'warning';
@@ -161,6 +167,7 @@ sub usage ()
   print "Warning categories include:
   `gnu'           GNU coding standards (default in gnu and gnits modes)
   `obsolete'      obsolete features or constructions
+  `override'      user redefinitions of Automake rules or variables
   `portability'   portability issues
   `syntax'        dubious syntactic constructs (default)
   `unsupported'   unsupported or incomplete features (default)
index b3c5972..de1e9fc 100644 (file)
@@ -24,7 +24,6 @@
 
 if %?LOCAL-TEXIS%
 if ! %?CYGNUS%
-MAKEINFO = @MAKEINFO@
 TEXI2DVI = texi2dvi
 
 else %?CYGNUS%
index 18895fa..d4a9843 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 10 April 2003
+@set UPDATED 14 April 2003
 @set UPDATED-MONTH April 2003
 @set EDITION 1.7a
 @set VERSION 1.7a
index e0c9ae6..26865e0 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-XFAIL_TESTS = subdir5.test auxdir2.test cond17.test
+XFAIL_TESTS = subdir5.test auxdir2.test cond17.test txinfo5.test
 
 TESTS =        \
 acinclude.test \
index 9a19ca9..ef296f6 100644 (file)
@@ -104,7 +104,7 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-XFAIL_TESTS = subdir5.test auxdir2.test cond17.test
+XFAIL_TESTS = subdir5.test auxdir2.test cond17.test txinfo5.test
 TESTS = \
 acinclude.test \
 aclibobj.test \
index 388fe3e..c6142b6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 
 . ./defs || exit 1
 
+set -e
+
+echo 'AC_OUTPUT' >> configure.in
+
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
 
 site.exp:
-    echo foo
+       @echo foo
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -Wno-override
 
 grep site.exp Makefile.in
 test `grep '^site\.exp:' Makefile.in | wc -l` -eq 1
+
+./configure
+$MAKE site.exp >stdout
+cat stdout
+grep foo stdout
+
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'Makefile.am:3:.*site.exp' stderr
index c7bd71c..6402a57 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -41,11 +41,12 @@ $ACLOCAL
 $AUTOMAKE -Wnone
 $AUTOMAKE -Wnone -Wobsolete 2>stderr && exit 1
 cat stderr
-grep maude stderr
+grep 'deprecated.*maude' stderr
 $AUTOMAKE -Wall 2>stderr && exit 1
 cat stderr
-grep maude stderr
+grep 'deprecated.*maude' stderr
+grep 'overrid.*maude' stderr
 
 echo 'AUTOMAKE_OPTIONS = no-exeext' >> Makefile.am
 
-$AUTOMAKE -Wall
+$AUTOMAKE -Wall -Wno-override
index a867f00..f16a69d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -36,7 +36,7 @@ maude$(EXEEXT):
 END
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 
 $FGREP 'maude$(EXEEXT):' Makefile.in
 test 1 = `grep 'maude.*:' Makefile.in | wc -l`
index 5ccf31b..f89bdf6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -48,6 +48,6 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 ./configure
 $MAKE
index 7cb5052..8ee95c9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -66,11 +66,11 @@ library.am: change your target to read `libfoo.a$(EXEEXT)'
 Makefile.am:3:   while processing library `libfoo.a'
 program.am: target `libfoo.a$(EXEEXT)' was defined here
 Makefile.am:1:   while processing program `libfoo.a'
-program.am: redefinition of `libfoo.a' in condition `TRUE'...
+program.am: redefinition of `libfoo.a'...
 Makefile.am:1:   while processing program `libfoo.a'
 library.am: ... `libfoo.a' previously defined here
 Makefile.am:3:   while processing library `libfoo.a'
-tags.am: redefinition of `ctags' in condition `TRUE'...
+tags.am: redefinition of `ctags'...
 program.am: ... `ctags' previously defined here
 Makefile.am:6:   while processing program `ctags'
 EOF
index e23f831..1c22b53 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -22,6 +22,8 @@
 
 . ./defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = no-exeext
 
@@ -32,8 +34,8 @@ meal: beans.veg beef.meat
        cat beans.veg beef.meat > meal
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -Wno-override
 
 grep '^meal.*:' Makefile.in | grep -v beef.meat && exit 1
 
index 84b2306..6b67124 100755 (executable)
@@ -88,12 +88,12 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 
 cd lib
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-override
 cd ..
 
 ./configure
index 591e774..9bc7214 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -47,6 +47,9 @@ END
 set -e
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'overrid.*libfake@SUBST@.a' stderr
 num=`grep '^libfake@SUBST@.a:' Makefile.in | wc -l`
 test $num -eq 1
+$AUTOMAKE -Wno-override
index 077f635..b32e98d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -32,7 +32,7 @@ cat > Makefile.am << 'END'
 info_TEXINFOS = subdir/main.texi
 subdir_main_TEXINFOS = subdir/inc.texi
 
-installcheck:
+installcheck-local:
        test -f $(infodir)/main.info
 END
 
index e1e1b46..900a2c3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 
 . ./defs || exit 1
 
+set -e
+
+echo AC_OUTPUT >> configure.in
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 magic:
@@ -33,7 +37,12 @@ END
 echo '@setfilename textutils.info' > textutils.texi
 : > textutils.info~
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
 
-test -z "`$MAKE -s -f Makefile.in magic | grep '~'`"
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE magic >stdout
+cat stdout
+grep '~' stdout && exit 1
+exit 0
index e6b7a3a..237bd27 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 
 . ./defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 install = install
 install:
        $(install) install
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE -Wno-override
 
-grep '^install = install$' Makefile.in || exit 1
+grep '^install = install$' Makefile.in
 
 cat > target.expected <<'EOF'
 install:
        $(install) install
 EOF
 sed -n '/^install:/,/^ /p' Makefile.in > target.value
-diff target.expected target.value || exit 1
-
-exit 0
+diff target.expected target.value
index 18895fa..d4a9843 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 10 April 2003
+@set UPDATED 14 April 2003
 @set UPDATED-MONTH April 2003
 @set EDITION 1.7a
 @set VERSION 1.7a