[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: AC_CONFIG_HEADERS vs AM_CONFIG_HEADER
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: AC_CONFIG_HEADERS vs AM_CONFIG_HEADER |
Date: |
Thu, 18 Jul 2002 13:18:02 +0200 |
User-agent: |
Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu) |
We've applied the first patch on Autoconf and the second on
Automake (HEAD).
They solve the AC_CONFIG_HEADERS vs AM_CONFIG_HEADER debacle in
Automake.
_AC_AM_CONFIG_HEADER_HOOK allows Automake to add some extra code
in the header loop of config.status. This simplify things a
lot.
Akim & Alexandre
2002-07-18 Akim Demaille <address@hidden>,
Alexandre Duret-Lutz <address@hidden>
* lib/autoconf/status.m4 (_AC_OUTPUT_HEADERS): Install
_AC_AM_CONFIG_HEADER_HOOK for Automake 1.7.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.27
diff -u -u -r1.27 status.m4
--- lib/autoconf/status.m4 6 Jun 2002 17:55:47 -0000 1.27
+++ lib/autoconf/status.m4 18 Jul 2002 10:27:43 -0000
@@ -654,6 +654,11 @@
cat $tmp/config.h
rm -f $tmp/config.h
fi
+dnl If running for Automake, be ready to perform additional
+dnl commands to set up the timestamp files.
+m4_ifdef([_AC_AM_CONFIG_HEADER_HOOK],
+ [_AC_AM_CONFIG_HEADER_HOOK([$ac_file])
+])dnl
m4_ifset([AC_LIST_HEADERS_COMMANDS],
[ # Run the commands associated with the file.
case $ac_file in
2002-07-18 Alexandre Duret-Lutz <address@hidden>
Akim Demaille <address@hidden>
* m4/header.m4 (_AM_DIRNAME, _AM_STAMP, _AM_CONFIG_HEADER,
_AM_CONFIG_HEADER_INSINUATE): Remove them all. Leave just ...
(AM_CONFIG_HEADER): ... this new definition for compatibility.
* m4/init.m4: Don't call _AM_CONFIG_HEADER_INSINUATE.
(_AC_AM_CONFIG_HEADER_HOOK): New macro.
* tests/confh5.tests: Delete.
* tests/Makefile.am (TESTS): Remove confh5.tests.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.185
diff -u -r1.185 NEWS
--- NEWS 11 Jul 2002 20:10:38 -0000 1.185
+++ NEWS 18 Jul 2002 11:02:43 -0000
@@ -14,8 +14,7 @@
was defined for another condition.
* It is no longer a requirement to use AM_CONFIG_HEADER instead of
AC_CONFIG_HEADERS. Although still supported, AM_CONFIG_HEADER is
- obsolete. It is now an error to call any of these macro before
- AM_INIT_AUTOMAKE.
+ obsolete.
* Use Autoconf's --trace interface to inspect configure.ac and get
a more accurate view of it.
* automake --output-dir is deprecated.
Index: m4/header.m4
===================================================================
RCS file: /cvs/automake/automake/m4/header.m4,v
retrieving revision 1.18
diff -u -r1.18 header.m4
--- m4/header.m4 6 Jul 2002 12:11:11 -0000 1.18
+++ m4/header.m4 18 Jul 2002 11:02:43 -0000
@@ -21,83 +21,5 @@
# serial 6
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated. We must strip everything past the first ":",
-# and everything past the last "/".
-
-# _AM_DIRNAME(PATH)
-# -----------------
-# Like AS_DIRNAME, only do it during macro expansion
-AC_DEFUN([_AM_DIRNAME],
- [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
- m4_if(regexp([$1], [^//\([^/]\|$\)]), -1,
- m4_if(regexp([$1], [^/.*]), -1,
- [.],
- patsubst([$1], [^\(/\).*], [\1])),
- patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
- patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
-])# _AM_DIRNAME
-
-
-# The stamp files are numbered to have different names.
-# We could number them on a directory basis, but that's additional
-# complications, let's have a unique counter.
-m4_define([_AM_STAMP_Count], [0])
-
-
-# _AM_STAMP(HEADER)
-# -----------------
-# The name of the stamp file for HEADER.
-AC_DEFUN([_AM_STAMP],
-[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl
-AS_ESCAPE(_AM_DIRNAME(patsubst([$1],
- [:.*])))/stamp-h[]_AM_STAMP_Count])
-
-
-# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS)
-# ------------------------------------------------------------
-# We used to try to get a real timestamp in stamp-h. But the fear is that
-# that will cause unnecessary cvs conflicts.
-AC_DEFUN([_AM_CONFIG_HEADER],
-[# Add the stamp file to the list of files AC keeps track of,
-# along with our hook.
-_AM_AC_CONFIG_HEADERS([$1],
- [# update the timestamp
-echo 'timestamp for $1' >"_AM_STAMP([$1])"
-$2],
- [$3])
-])# _AM_CONFIG_HEADER
-
-
-# _AM_CONFIG_HEADERS(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS)
-# ----------------------------------------------------------------
-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
-# ---------------------------
-# Replace AC_CONFIG_HEADERS with our AM_CONFIG_HEADER.
-# We don't care about AC_CONFIG_HEADER (without S): it's an obsolete
-# Autoconf macro which will simply call AC_CONFIG_HEADERS (with S).
-AC_DEFUN([_AM_CONFIG_HEADER_INSINUATE], [
-dnl Since the substitution is only effective after AM_INIT_AUTOMAKE,
-dnl make sure AC_CONFIG_HEADERS is not called before.
-AC_BEFORE([AM_INIT_AUTOMAKE], [AC_CONFIG_HEADERS])dnl
-dnl Save the previous AC_CONFIG_HEADERS definition
-dnl (Beware: this must be m4_copy, not m4_rename, because we will
-dnl lose the --trace bit of AC_CONFIG_HEADERS if we undefine it.)
-m4_copy([AC_CONFIG_HEADERS], [_AM_AC_CONFIG_HEADERS])dnl
-dnl Override AC_CONFIG_HEADERS with ours.
-AC_DEFUN([AC_CONFIG_HEADERS], [_AM_CONFIG_HEADERS($][@)])dnl
-dnl Define AM_CONFIG_HEADERS (obsolete) in terms of AC_CONFIG_HEADERS.
-dnl This way autoheader will `see' the calls to AM_CONFIG_HEADER.
-AC_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($][@)])dnl
-])
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AC_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.45
diff -u -r1.45 init.m4
--- m4/init.m4 19 Apr 2002 10:13:30 -0000 1.45
+++ m4/init.m4 18 Jul 2002 11:02:43 -0000
@@ -96,5 +96,16 @@
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
-_AM_CONFIG_HEADER_INSINUATE
])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[_am_stamp_count=`expr ${_am_stamp_count-0} + 1`
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.418
diff -u -r1.418 Makefile.am
--- tests/Makefile.am 16 Jul 2002 21:46:59 -0000 1.418
+++ tests/Makefile.am 18 Jul 2002 11:02:43 -0000
@@ -100,7 +100,6 @@
confdist.test \
confh.test \
confh4.test \
-confh5.test \
config.test \
confincl.test \
confsub.test \
Index: tests/confh5.test
===================================================================
RCS file: tests/confh5.test
diff -N tests/confh5.test
--- tests/confh5.test 6 Jul 2002 12:11:12 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-#! /bin/sh
-
-# 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(nonesuch, nonesuch)
-AC_CONFIG_HEADERS(config.h)
-AM_INIT_AUTOMAKE
-AC_OUTPUT
-END
-
-: > config.h.in
-
-$ACLOCAL || 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: AC_CONFIG_HEADERS vs AM_CONFIG_HEADER,
Alexandre Duret-Lutz <=