Fix PR automake/49:
authorAlexandre Duret-Lutz <adl@gnu.org>
Sat, 17 Apr 2004 18:46:06 +0000 (18:46 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sat, 17 Apr 2004 18:46:06 +0000 (18:46 +0000)
* automake.in (scan_autoconf_traces) <AC_CONFIG_AUX_DIR>: Diagnose
calls to AC_CONFIG_AUX_DIR followings calls to AM_INIT_AUTOMAKE.
* tests/auxdir.test, tests/auxdir2.test, tests/lex5.test,
tests/mdate3.test, tests/multlib.test, tests/reqd2.test,
tests/symlink.test, tests/txinfo8.test, tests/txinfo22.test,
tests/yacc6.test, tests/yacc8.test: Fix to call AC_CONFIG_AUX_DIR
before AM_INIT_AUTOMAKE.
* tests/auxdir3.test: New file (exercise this diagnostic).
* tests/Makefile.am (TESTS): Add auxdir3.test.

18 files changed:
ChangeLog
NEWS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/auxdir.test
tests/auxdir2.test
tests/auxdir3.test [new file with mode: 0755]
tests/lex5.test
tests/mdate3.test
tests/multlib.test
tests/reqd2.test
tests/subobj3.test
tests/symlink.test
tests/txinfo22.test
tests/txinfo8.test
tests/yacc6.test
tests/yacc8.test

index 9122883..bb1e15b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-04-17  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       Fix PR automake/49:
+       * automake.in (scan_autoconf_traces) <AC_CONFIG_AUX_DIR>: Diagnose
+       calls to AC_CONFIG_AUX_DIR followings calls to AM_INIT_AUTOMAKE.
+       * tests/auxdir.test, tests/auxdir2.test, tests/lex5.test,
+       tests/mdate3.test, tests/multlib.test, tests/reqd2.test,
+       tests/symlink.test, tests/txinfo8.test, tests/txinfo22.test,
+       tests/yacc6.test, tests/yacc8.test: Fix to call AC_CONFIG_AUX_DIR
+       before AM_INIT_AUTOMAKE.
+       * tests/auxdir3.test: New file (exercise this diagnostic).
+       * tests/Makefile.am (TESTS): Add auxdir3.test.
+
 2004-04-15  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * aclocal.in (%map_traced_defs): New variable.
diff --git a/NEWS b/NEWS
index 4422197..58da992 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,8 @@ New in 1.8a:
   (Calls to AC_PROG_EGREP causing libtool.m4 to be included is the
   most famous instance of this bug.)
 
+* Diagnose AC_CONFIG_AUX_DIR calls following AM_INIT_AUTOMAKE. (PR/49)
+
 \f
 New in 1.8:
 
index 00be104..afdb051 100755 (executable)
@@ -4596,7 +4596,7 @@ sub scan_autoconf_traces ($)
   while ($_ = $tracefh->getline)
     {
       chomp;
-      my ($here, @args) = split /::/;
+      my ($here, @args) = split (/::/);
       my $where = new Automake::Location $here;
       my $macro = $args[0];
 
@@ -4626,6 +4626,12 @@ sub scan_autoconf_traces ($)
        }
       elsif ($macro eq 'AC_CONFIG_AUX_DIR')
        {
+         if ($seen_init_automake)
+           {
+             error ($where, "AC_CONFIG_AUX_DIR must be called before "
+                    . "AM_INIT_AUTOMAKE...", partial => 1);
+             error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here");
+           }
          $config_aux_dir = $args[1];
          $config_aux_dir_set_in_configure_ac = 1;
        }
index cebf448..817dff1 100644 (file)
@@ -53,6 +53,7 @@ autohdr3.test \
 autohdr4.test \
 auxdir.test \
 auxdir2.test \
+auxdir3.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
index f457c2b..8583b24 100644 (file)
@@ -168,6 +168,7 @@ autohdr3.test \
 autohdr4.test \
 auxdir.test \
 auxdir2.test \
+auxdir3.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
index 2046d03..8feaea8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 . ./defs || exit 1
 
 # The "./." is here so we don't have to mess with subdirs.
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT([auxdir], [1.0])
 AC_CONFIG_AUX_DIR(./.)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 END
 
 cat > Makefile.am << 'END'
index 4313825..5e1d766 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 . ./defs || exit 1
 
 # The "./." is here so we don't have to mess with subdirs.
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT([auxdir2], [1.0])
 AC_CONFIG_AUX_DIR($foo)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 END
 
 : > Makefile.am
diff --git a/tests/auxdir3.test b/tests/auxdir3.test
new file mode 100755 (executable)
index 0000000..f04ec36
--- /dev/null
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 2004  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.
+
+# Test to make sure we diagnose misplaced AC_CONFIG_AUX_DIR.
+
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_AUX_DIR(.)
+END
+
+: > Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'AC_CONFIG_AUX_DIR.*AM_INIT_AUTOMAKE' stderr
index 60e36a2..71554cd 100755 (executable)
@@ -25,8 +25,11 @@ required='gcc GNUmake gzip flex'
 
 set -e
 
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT([lex5], [1.0])
 AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AM_PROG_LEX
index 177519f..900ef5f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 
 . ./defs || exit 1
 
-cat >> configure.in << 'END'
-AC_CONFIG_AUX_DIR(foo)
+cat > configure.in << 'END'
+AC_INIT([mdate3], [1.0])
+AC_CONFIG_AUX_DIR([foo])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 END
 
 cat > Makefile.am << 'END'
index 61c4f0a..c64bce0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -26,9 +26,12 @@ required='gcc GNUmake'
 
 set -e
 
-cat >>configure.in <<'END'
+cat >configure.in <<'END'
+AC_INIT([multlib], [1.0])
 AC_CONFIG_SRCDIR(libfoo/foo.c)
 AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 AC_CONFIG_SUBDIRS(libfoo)
 AC_CONFIG_SUBDIRS(libbar)
 AC_OUTPUT
index 12cf1f4..cce8023 100755 (executable)
@@ -27,8 +27,11 @@ required='libtoolize'
 
 set -e
 
-cat >>configure.in <<'END'
+cat > configure.in << 'END'
+AC_INIT([req2], [1.0])
 AC_CONFIG_AUX_DIR([autoconf])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
 AM_PROG_LIBTOOL
 AC_CONFIG_FILES([autoconf/Makefile main/Makefile])
index 9257695..7255392 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004  Free Software
+# Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -25,9 +26,9 @@ required=gcc
 
 cat > configure.in << 'END'
 AC_INIT(sub/hello.c)
-AM_INIT_AUTOMAKE(hello,0.23)
 dnl Prevent automake from looking in .. and ../..
 AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE(hello,0.23)
 AC_PROG_CC
 AM_PROG_CC_C_O
 AM_C_PROTOTYPES
index 597336d..974edb6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1999, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -30,8 +30,11 @@ rm -f mkinstalldirs
 
 : > Makefile.am
 
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT([symlink], [1.0])
 AC_CONFIG_AUX_DIR(sub)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 END
 
 $ACLOCAL
index a2cf051..8607431 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -28,8 +28,11 @@ required='makeinfo tex'
 
 set -e
 
-cat >>configure.in <<END
+cat > configure.in << 'END'
+AC_INIT([txinfo22], [1.0])
 AC_CONFIG_AUX_DIR(aux)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
 
index edc9b11..a429985 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004  Free Software
+# Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -26,9 +27,9 @@
 
 cat > configure.in << 'END'
 AC_INIT
+AC_CONFIG_AUX_DIR(sub)
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_OUTPUT(Makefile sub/Makefile)
-AC_CONFIG_AUX_DIR(sub)
 END
 
 cat > Makefile.am << 'END'
index 108bc20..c25a2e5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -28,8 +28,11 @@ required='gcc bison'
 
 set -e
 
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT([yacc6], [1.0])
 AC_CONFIG_AUX_DIR([aux])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
 AC_PROG_YACC
 AC_CONFIG_FILES([sub/Makefile])
index 40009b8..5f1eaea 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -26,8 +26,11 @@ required="gcc bison"
 
 set -e
 
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT([yacc8], [1.0])
 AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_YACC