* m4/header.m4 (AM_CONFIG_HEADER): New macro.
authorAlexandre Duret-Lutz <adl@gnu.org>
Sat, 6 Jul 2002 12:11:12 +0000 (12:11 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sat, 6 Jul 2002 12:11:12 +0000 (12:11 +0000)
* tests/confh5.test: Make sure that Autoconf complains if
AM_CONFIG_HEADER or AC_CONFIG_HEADERS is called before
AM_INIT_AUTOMAKE.

ChangeLog
m4/header.m4
tests/confh5.test

index 0b9a98e..994177a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2002-07-06  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
+       * m4/header.m4 (AM_CONFIG_HEADER): New macro.
+       * tests/confh5.test: Make sure that Autoconf complains if
+       AM_CONFIG_HEADER or AC_CONFIG_HEADERS is called before
+       AM_INIT_AUTOMAKE.
+
+2002-07-06  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
        * lib/Automake/Channels.pm: New file.
        * lib/Automake/Makefile.am (dist_perllib_DATA): Add Channels.pm.
        * automake.in: Use Automake::Channels and register some channels
index 850341b..9f2e234 100644 (file)
@@ -76,6 +76,11 @@ AC_DEFUN([_AM_CONFIG_HEADERS],
 [AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
 ])# _AM_CONFIG_HEADERS
 
+# This is a false definition of AM_CONFIG_HEADER that will be
+# overridden by the real definition when _AM_CONFIG_HEADER_INSINUATE
+# is called (i.e. during AM_INIT_AUTOMAKE).
+AC_DEFUN([AM_CONFIG_HEADER],
+[m4_fatal([AM_CONFIG_HEADER called before AM_INIT_AUTOMAKE])])
 
 # _AM_CONFIG_HEADER_INSINUATE
 # ---------------------------
index a91b0ee..4e460da 100755 (executable)
@@ -1,19 +1,36 @@
 #! /bin/sh
 
-# Make sure Autoconf complains if AC_CONFIG_HEADERS appears
-# before AM_INIT_AUTOMAKE.
+# Make sure that calling AM_CONFIG_HEADER or AC_CONFIG_HEADERS
+# before AM_INIT_AUTOMAKE is not allowed and that the error
+# message says so.
 
 . $srcdir/defs || exit 1
 
 cat > configure.in << 'END'
-AC_INIT
+AC_INIT(nonesuch, nonesuch)
 AC_CONFIG_HEADERS(config.h)
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AM_INIT_AUTOMAKE
 AC_OUTPUT
 END
 
 : > config.h.in
 
 $ACLOCAL || exit 1
-$AUTOCONF 2>&1 | grep AC_CONFIG_HEADERS || exit 1
-:
+# Autoconf (at least up to 2.53) treats this error as a warning.
+# Hence we don't `&& exit 1'.
+$AUTOCONF >output 2>&1
+cat output
+grep 'AC_CONFIG_HEADERS.*before.*AM_INIT_AUTOMAKE' output || exit 1
+
+
+cat > configure.in << 'END'
+AC_INIT(nonesuch, nonesuch)
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE
+AC_OUTPUT
+END
+
+$ACLOCAL || exit 1
+$AUTOCONF >output 2>&1 && exit 1
+cat output
+grep 'AM_CONFIG_HEADER.*before.*AM_INIT_AUTOMAKE' output || exit 1