automake-patches
[Top][All Lists]
Advanced

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

from AM_CONFIG_HEADER to AC_CONFIG_HEADERS


From: Alexandre Duret-Lutz
Subject: from AM_CONFIG_HEADER to AC_CONFIG_HEADERS
Date: 14 Apr 2002 17:06:26 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Here is something that seems to work.  (I hope Akim will not
have an heart attack we he come back from holiday and see this.)

What should happen to AM_CONFIG_HEADER now that
AC_CONFIG_HEADERS can be used?  This patch documents it as
obsolete, that's what I think makes more sense.

Another approach would be to still recommend AM_CONFIG_HEADER
over AC_CONFIG_HEADERS, even if both work identically (I fear
this would be confusing).

2002-04-14  Alexandre Duret-Lutz  <address@hidden>

        * m4/header.m4 (_AM_CONFIG_HEADER_INSINUATE): New function,
        override AC_CONFIG_HEADERS with AM_CONFIG_HEADER.
        (_AM_CONFIG_HEADER): Use _AM_AC_CONFIG_HEADERS.
        * m4/init.m4: Call _AM_CONFIG_HEADER_INSINUATE.
        * tests/stamph2.test: Use AC_CONFIG_HEADERS for some of the config
        files.
        * tests/confh5.test: New file.
        * tests/Makefile.am (TESTS): Add confh5.test.
        * automake.texi (Optional, Public macros): Update descriptions
        of AC_CONFIG_HEADERS and AM_CONFIG_HEADER.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.176
diff -u -r1.176 NEWS
--- NEWS        13 Apr 2002 21:26:34 -0000      1.176
+++ NEWS        14 Apr 2002 15:04:34 -0000
@@ -1,4 +1,6 @@
 New in 1.6a:
+* It is no longuer a requirement to use AM_CONFIG_HEADER instead of
+  AC_CONFIG_HEADERS.  AM_CONFIG_HEADER is obsolete.
 * Use Autoconf's --trace interface to inspect configure.ac and get
   a more accurate view of it.
 * automake --output-dir is deprecated
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.272
diff -u -r1.272 automake.texi
--- automake.texi       13 Apr 2002 21:26:34 -0000      1.272
+++ automake.texi       14 Apr 2002 15:04:56 -0000
@@ -1115,12 +1115,11 @@
 and their effects are:
 
 @table @code
address@hidden AC_CONFIG_HEADER
-Automake requires the use of @code{AM_CONFIG_HEADER} (@pxref{Macros}),
-which is similar to @code{AC_CONFIG_HEADER} (@pxref{Configuration
-Headers, , Configuration Header Files, autoconf, The Autoconf Manual}),
-but does some useful Automake-specific work.
address@hidden AC_CONFIG_HEADER
address@hidden AC_CONFIG_HEADERS
+Automake will generate rules to rebuild these headers.  Older versions
+of Automake required the use of @code{AM_CONFIG_HEADER}
+(@pxref{Macros}); this no longuer the case today.
address@hidden AC_CONFIG_HEADERS
 
 @item AC_CONFIG_AUX_DIR
 Automake will look for various helper scripts, such as
@@ -1385,7 +1384,8 @@
 @table @code
 @item AM_CONFIG_HEADER
 Automake will generate rules to automatically regenerate the config
-header.
+header.  This obsolete macro is a synonym of @code{AC_CONFIG_HEADERS}
+today (@pxref{Optional}).
 @cvindex AM_CONFIG_HEADER
 
 @item AM_ENABLE_MULTILIB
@@ -2326,7 +2326,7 @@
 Automake already provides some @samp{-I} options automatically.  In
 particular it generates @samp{-I$(srcdir)}, @samp{-I.}, and a @samp{-I}
 pointing to the directory holding @file{config.h} (if you've used
address@hidden or @code{AM_CONFIG_HEADER}).  You can disable
address@hidden or @code{AM_CONFIG_HEADER}).  You can disable
 the default @samp{-I} options using the @samp{nostdinc} option.
 
 @item INCLUDES
Index: m4/header.m4
===================================================================
RCS file: /cvs/automake/automake/m4/header.m4,v
retrieving revision 1.14
diff -u -r1.14 header.m4
--- m4/header.m4        26 Oct 2001 09:59:59 -0000      1.14
+++ m4/header.m4        14 Apr 2002 15:05:04 -0000
@@ -62,7 +62,7 @@
 AC_DEFUN([_AM_CONFIG_HEADER],
 [# Add the stamp file to the list of files AC keeps track of,
 # along with our hook.
-AC_CONFIG_HEADERS([$1],
+_AM_AC_CONFIG_HEADERS([$1],
                   [# update the timestamp
 echo 'timestamp for $1' >"_AM_STAMP([$1])"
 $2],
@@ -75,3 +75,20 @@
 AC_DEFUN([AM_CONFIG_HEADER],
 [AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
 ])# AM_CONFIG_HEADER
+
+
+# _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
+m4_rename([AC_CONFIG_HEADERS], [_AM_AC_CONFIG_HEADERS])dnl
+dnl Setup ours.
+dnl (Don't use m4_copy because we are tracing AM_CONFIG_HEADER.)
+AC_DEFUN([AC_CONFIG_HEADERS], [AM_CONFIG_HEADER($][@)])dnl
+])
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.44
diff -u -r1.44 init.m4
--- m4/init.m4  17 Mar 2002 23:18:00 -0000      1.44
+++ m4/init.m4  14 Apr 2002 15:05:04 -0000
@@ -87,13 +87,14 @@
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 
 _AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_][CC],
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
                   [_AM_DEPENDENCIES(CC)],
-                  [define([AC_PROG_][CC],
-                          defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_][CXX],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
                   [_AM_DEPENDENCIES(CXX)],
-                  [define([AC_PROG_][CXX],
-                          defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
 ])
+_AM_CONFIG_HEADER_INSINUATE
 ])
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.388
diff -u -r1.388 Makefile.am
--- tests/Makefile.am   13 Apr 2002 21:48:35 -0000      1.388
+++ tests/Makefile.am   14 Apr 2002 15:05:04 -0000
@@ -92,6 +92,7 @@
 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
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/confh5.test   14 Apr 2002 15:05:11 -0000
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+# Make sure Autoconf complains if AC_CONFIG_HEADERS appears
+# before AM_INIT_AUTOMAKE.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT
+AC_CONFIG_HEADERS(config.h)
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT
+END
+
+: > config.h.in
+
+$ACLOCAL || exit 1
+$AUTOCONF 2>&1 | grep AC_CONFIG_HEADERS || exit 1
+:
Index: tests/stamph2.test
===================================================================
RCS file: /cvs/automake/automake/tests/stamph2.test,v
retrieving revision 1.5
diff -u -r1.5 stamph2.test
--- tests/stamph2.test  26 Dec 2001 08:22:06 -0000      1.5
+++ tests/stamph2.test  14 Apr 2002 15:05:11 -0000
@@ -3,18 +3,16 @@
 # Make sure stamp-h* files are created where we expect
 . $srcdir/defs || exit 1
 
-cat > configure.in << END
-AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE($me, 1.0)
+cat >> configure.in << END
 AM_CONFIG_HEADER(1.h
                  2.h:config.hin
-                 3.h:sdir1/config1.hin
-
-                 sdir1/4.h
-                 sdir1/5.h:config.hin
-                 sdir1/6.h:sdir1/config1.hin
-                 sdir1/7.h:sdir2/config2.hin)
-AC_OUTPUT(Makefile)
+                 3.h:sdir1/config1.hin)
+# AM_CONFIG_HEADER and AC_CONFIG_HEADERS should be synonyms.
+AC_CONFIG_HEADERS(sdir1/4.h
+                  sdir1/5.h:config.hin
+                  sdir1/6.h:sdir1/config1.hin
+                  sdir1/7.h:sdir2/config2.hin)
+AC_OUTPUT
 END
 
 : > Makefile.am
-- 
Alexandre Duret-Lutz




reply via email to

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