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
[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
# ---------------------------
#! /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