automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: autoheader -vs- AC_CONFIG_HEADERS (Was: Re: Conditionally compi


From: Alexandre Duret-Lutz
Subject: Re: FYI: autoheader -vs- AC_CONFIG_HEADERS (Was: Re: Conditionally compiling Java)
Date: Sat, 06 Jul 2002 14:11:13 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu)

>>> "Tom" == Tom Tromey <address@hidden> writes:

[...]

 Tom> Today I tried the latest automake on GNU fileutils 4.1.9.
 Tom> I get this when I run aclocal; autoconf:

 Tom> configure.ac:7: error: possibly undefined macro: AM_CONFIG_HEADER
 Tom> fleche. grep AM_CONFIG configure
 Tom> AM_CONFIG_HEADER(config.h:config.hin)

 Tom> In configure.ac I see this:

 Tom> AM_CONFIG_HEADER(config.h:config.hin)
 Tom> AC_CANONICAL_HOST
 Tom> AM_INIT_AUTOMAKE([1.6 gnits dist-bzip2])

 Tom> If I move AM_INIT_AUTOMAKE first, then things work as expected.

I'm checking in the appended patch to correct the error message.
I believe there is not reason to allow AM_ macros before
AM_INIT_AUTOMAKE is run.  (Just like AC_ macros should not be
called before AC_INIT.)

It would be possible to allow AM_CONFIG_HEADER to be called
before AM_INIT_AUTOMAKE, for instance using a definition like

AC_DEFUN([AM_CONFIG_HEADER], [
  _AM_CONFIG_HEADER_INSINUATE
  AM_CONFIG_HEADER($@)])

However we couldn't do the same thing for AC_CONFIG_HEADERS,
which is the macro we recommend.

 Tom> However... I expected `autoconf -Wobsolete' to warn about
 Tom> AM_CONFIG_HEADER, but it doesn't.

A while ago a made a patch to use AU_DEFUN in Automake macros
(mail.gnu.org seems dead now; the mail was sent to
address@hidden on April, 21), however I never
committed it because the test case revealed a bug in Autoconf.

Since then I've kept a list of additional functions that should
be AU_DEFUNed the day Autoconf is fixed and I can revise the
patch: AM_CONFIG_HEADER, AM_SYS_POSIX_TERMIOS, and
AM_SYS_POSIX_TERMIOS.


2002-07-06  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: m4/header.m4
===================================================================
RCS file: /cvs/automake/automake/m4/header.m4,v
retrieving revision 1.17
diff -u -r1.17 header.m4
--- m4/header.m4        14 Jun 2002 06:48:30 -0000      1.17
+++ m4/header.m4        6 Jul 2002 11:38:03 -0000
@@ -76,6 +76,11 @@
 [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: tests/confh5.test
===================================================================
RCS file: /cvs/automake/automake/tests/confh5.test,v
retrieving revision 1.1
diff -u -r1.1 confh5.test
--- tests/confh5.test   19 Apr 2002 10:13:34 -0000      1.1
+++ tests/confh5.test   6 Jul 2002 11:38:03 -0000
@@ -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

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]