* automake.in (scan_autoconf_traces): Check the expected
authorAlexandre Duret-Lutz <adl@gnu.org>
Tue, 1 Jul 2003 21:25:39 +0000 (21:25 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Tue, 1 Jul 2003 21:25:39 +0000 (21:25 +0000)
number of arguments of each traced macro.
* tests/overrid.test: Fix call to AM_CONDITIONAL.
* tests/conff2.test: New files.
* tests/Makefile.am (TESTS): Add conff2.test.
Report from Paolo Bonzini.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/conff2.test [new file with mode: 0755]
tests/overrid.test

index 9500fb7..1249104 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-07-01  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * automake.in (scan_autoconf_traces): Check the expected
+       number of arguments of each traced macro.
+       * tests/overrid.test: Fix call to AM_CONDITIONAL.
+       * tests/conff2.test: New files.
+       * tests/Makefile.am (TESTS): Add conff2.test.
+       Report from Paolo Bonzini.
+
 2003-06-30  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * automake.in ($SUBST_REF_PATTERN): Do not define.
@@ -23,6 +32,8 @@
        _value_as_list_recursive_worker,
        value_as_list_recursive, loc_and_value_as_list_recursive): ... here.
        (reset): Reset %_gen_varname.
+       (require_variables_for_variable): Accept an Automake::Variable
+       as argument.
 
 2003-06-27  Alexandre Duret-Lutz  <adl@gnu.org>
 
index 4a6d271..c9e25da 100755 (executable)
@@ -4660,29 +4660,33 @@ sub scan_autoconf_traces ($)
 {
   my ($filename) = @_;
 
-  my @traced = qw(AC_CANONICAL_HOST
-                 AC_CANONICAL_SYSTEM
-                 AC_CONFIG_AUX_DIR
-                 AC_CONFIG_FILES
-                 AC_CONFIG_HEADERS
-                 AC_INIT
-                 AC_LIBSOURCE
-                 AC_SUBST
-                 AM_AUTOMAKE_VERSION
-                 AM_CONDITIONAL
-                 AM_GNU_GETTEXT
-                 AM_INIT_AUTOMAKE
-                 AM_MAINTAINER_MODE
-                 AM_PROG_CC_C_O
-                 m4_include
-                 m4_sinclude);
+  # Macros to trace, with their minimal number of arguments.
+  my %traced = (
+               AC_CANONICAL_HOST => 0,
+               AC_CANONICAL_SYSTEM => 0,
+               AC_CONFIG_AUX_DIR => 1,
+               AC_CONFIG_FILES => 1,
+               AC_CONFIG_HEADERS => 1,
+               AC_INIT => 0,
+               AC_LIBSOURCE => 1,
+               AC_SUBST => 1,
+               AM_AUTOMAKE_VERSION => 1,
+               AM_CONDITIONAL => 2,
+               AM_GNU_GETTEXT => 0,
+               AM_INIT_AUTOMAKE => 0,
+               AM_MAINTAINER_MODE => 0,
+               AM_PROG_CC_C_O => 0,
+               m4_include => 1,
+               m4_sinclude => 1,
+             );
 
   my $traces = ($ENV{AUTOCONF} || 'autoconf') . " ";
 
   # Use a separator unlikely to be used, not `:', the default, which
   # has a precise meaning for AC_CONFIG_FILES and so on.
   $traces .= join (' ',
-                  map { "--trace=$_" . ':\$f:\$l::\$n::\${::}%' } @traced);
+                  map { "--trace=$_" . ':\$f:\$l::\$n::\${::}%' }
+                  (keys %traced));
 
   my $tracefh = new Automake::XFile ("$traces $filename |");
   verb "reading $traces";
@@ -4694,6 +4698,16 @@ sub scan_autoconf_traces ($)
       my $where = new Automake::Location $here;
       my $macro = $args[0];
 
+      prog_error ("unrequested trace `$macro'")
+       unless exists $traced{$macro};
+
+      # Skip and diagnose malformed calls.
+      if ($#args < $traced{$macro})
+       {
+         msg ('syntax', $where, "not enough arguments for $macro");
+         next;
+       }
+
       # Alphabetical ordering please.
       if ($macro eq 'AC_CANONICAL_HOST')
        {
index e8db714..67c71dc 100644 (file)
@@ -118,6 +118,7 @@ condman2.test \
 conf2.test \
 confdeps.test \
 conff.test \
+conff2.test \
 confh.test \
 confh4.test \
 config.test \
index e26da4e..00a8530 100644 (file)
@@ -229,6 +229,7 @@ condman2.test \
 conf2.test \
 confdeps.test \
 conff.test \
+conff2.test \
 confh.test \
 confh4.test \
 config.test \
diff --git a/tests/conff2.test b/tests/conff2.test
new file mode 100755 (executable)
index 0000000..3808da7
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure empty calls to AC_CONFIG_FILES or AC_CONFIG_HEADERS are diagnosed.
+
+. ./defs || exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES ([oops])
+AC_CONFIG_HEADERS
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'configure.in:3:.*AC_CONFIG_FILES' stderr
+grep 'configure.in:4:.*AC_CONFIG_HEADERS' stderr
index 5679c2d..c8398e1 100755 (executable)
@@ -26,7 +26,7 @@
 set -e
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL([COND])
+AM_CONDITIONAL([COND], [:])
 END
 
 cat > Makefile.am << 'END'