(_AH_COUNTER): New variable.
* tests/tools.m4 (autoheader): Check their proper functioning.
+2000-05-04 Akim Demaille <akim@epita.fr>
+
+ * acgeneral.m4 (AH_TOP, AH_BOTTOM): New macros.
+ (_AH_COUNTER): New variable.
+ * tests/tools.m4 (autoheader): Check their proper functioning.
+
2000-05-04 Akim Demaille <akim@epita.fr>
* doc/autoconf.texi (Obsolete Macros): Rename as...
## ------------------------- ##
-# AH_OUTPUT(TEXT)
-# ---------------
+# AH_OUTPUT(KEY, TEXT)
+# --------------------
# Pass TEXT to autoheader.
# This macro is `read' only via `autoconf --trace', it outputs nothing.
define([AH_OUTPUT], [])
#undef $1])])
+# AH_TOP(TEXT)
+# ------------
+# Output TEXT at the top of `config.h.in'.
+define([AH_TOP],
+[m4_define([_AH_COUNTER], incr(_AH_COUNTER))dnl
+AH_VERBATIM([0000]_AH_COUNTER, [$1])])
+
+
+# AH_BOTTOM(TEXT)
+# ---------------
+# Output TEXT at the bottom of `config.h.in'.
+define([AH_BOTTOM],
+[m4_define([_AH_COUNTER], incr(_AH_COUNTER))dnl
+AH_VERBATIM([zzzz]_AH_COUNTER, [$1])])
+
+# Initialize.
+define([_AH_COUNTER], [0])
+
## --------------------- ##
## Some /bin/sh idioms. ##
## ------------------------- ##
-# AH_OUTPUT(TEXT)
-# ---------------
+# AH_OUTPUT(KEY, TEXT)
+# --------------------
# Pass TEXT to autoheader.
# This macro is `read' only via `autoconf --trace', it outputs nothing.
define([AH_OUTPUT], [])
#undef $1])])
+# AH_TOP(TEXT)
+# ------------
+# Output TEXT at the top of `config.h.in'.
+define([AH_TOP],
+[m4_define([_AH_COUNTER], incr(_AH_COUNTER))dnl
+AH_VERBATIM([0000]_AH_COUNTER, [$1])])
+
+
+# AH_BOTTOM(TEXT)
+# ---------------
+# Output TEXT at the bottom of `config.h.in'.
+define([AH_BOTTOM],
+[m4_define([_AH_COUNTER], incr(_AH_COUNTER))dnl
+AH_VERBATIM([zzzz]_AH_COUNTER, [$1])])
+
+# Initialize.
+define([_AH_COUNTER], [0])
+
## --------------------- ##
## Some /bin/sh idioms. ##
#undef this
]])
+
# 1. Check that `acconfig.h' is still honored.
AT_DATA(configure.in,
[[AC_INIT
AC_DEFINE(this, "whatever you want.")
]])
-
AT_CHECK([../autoheader -m .. -<configure.in], 0,
[[/* config.h.in. Generated automatically from - by autoheader. */
/* Define this to whatever you want. */
#undef this
]], ignore)
+
# 2. Check that missing templates are a fatal error.
AT_DATA(configure.in,
[[AC_INIT
AT_CHECK([../autoheader -m .. -<configure.in], 1, ignore, ignore)
+
+# 3. Check TOP and BOTTOM.
+AT_DATA(acconfig.h,
+[[/* Top from acconfig.h. */
+@TOP@
+/* Middle from acconfig.h. */
+@BOTTOM@
+/* Bottom from acconfig.h. */
+]])
+
+AT_DATA(configure.in,
+[[AC_INIT
+AC_CONFIG_HEADERS(config.h)
+AH_TOP([Top1 from configure.in.])
+AH_TOP([Top2 from configure.in.])
+AH_VERBATIM([Middle], [Middle from configure.in.])
+AH_BOTTOM([Bottom1 from configure.in.])
+AH_BOTTOM([Bottom2 from configure.in.])
+]])
+
+
+# Yes, that's right: the `middle' part of `acconfig.h' is still before
+# the AH_TOP part. But so what, you're not supposed to use the two
+# together.
+AT_CHECK([../autoheader -m .. -<configure.in], 0,
+[[/* config.h.in. Generated automatically from - by autoheader. */
+/* Top from acconfig.h. */
+
+/* Middle from acconfig.h. */
+
+Top1 from configure.in.
+
+Top2 from configure.in.
+
+Middle from configure.in.
+
+Bottom1 from configure.in.
+
+Bottom2 from configure.in.
+/* Bottom from acconfig.h. */
+]], ignore)
+
+
AT_CLEANUP