Provide the m4 infrastructure for defining AH_ hooks.
* autoheader.m4 (AH_HOOK): New macro.
Hook all the AC_ macros to their AH_siblings in AH_HOOKS.
Run AH_HOOKS.
* acgeneral.m4 (m4_append): New macro.
(m4_list_append, m4_list_add): Removed.
+1999-10-31 Akim Demaille <akim@epita.fr>
+
+ Provide the m4 infrastructure for defining AH_ hooks.
+
+ * autoheader.m4 (AH_HOOK): New macro.
+ Hook all the AC_ macros to their AH_siblings in AH_HOOKS.
+ Run AH_HOOKS.
+
+ * acgeneral.m4 (m4_append): New macro.
+ (m4_list_append, m4_list_add): Removed.
+
1999-10-31 Akim Demaille <akim@epita.fr>
* acspecific.m4: Formating changes.
[ \(.\)$], [\1])])
+
+dnl m4_append(MACRO-NAME, STRING)
+dnl -----------------------------
+dnl Redefine MACRO-NAME to hold its former content plus STRING at the
+dnl end. It is valid to use this macro with MACRO-NAME undefined.
+dnl
+dnl This macro is robust to active symbols. It can be used to grow
+dnl strings or lists.
+dnl
+dnl | define(active, ACTIVE)
+dnl | m4_append([sentence], [This is an])
+dnl | m4_append([sentence], [ active ])
+dnl | m4_append([sentence], [symbol.])
+dnl | sentence
+dnl | undefine([active])dnl
+dnl | sentence
+dnl => This is an ACTIVE symbol.
+dnl => This is an active symbol.
+dnl
+dnl It can be used to define hooks.
+dnl
+dnl | define(active, ACTIVE)
+dnl | m4_append([hooks], [define([act1], [act2])])
+dnl | m4_append([hooks], [define([act2], [active])])
+dnl | undefine([active])
+dnl | act1
+dnl | hooks
+dnl | act1
+dnl => act1
+dnl =>
+dnl => active
+define(m4_append,
+[define([$1],
+ifdef([$1], [defn([$1])])
+[$2])])
+
+
dnl ------------------------------------------------------------
dnl Some additional m4 structural control.
dnl ------------------------------------------------------------
[$3])])])
-dnl m4_list_append(LIST, ELEMENT)
-dnl -----------------------------
-dnl Insert ELEMENT at the end of LIST.
-dnl
-dnl This macro is picky on its input, especially for the empty list: it
-dnl must be either the empty string, or exactly `()' (no spaces allowed).
-dnl This macro is actually purely textual: it basically replaces the
-dnl closing paren of LIST with `, ELEMENT)'. The hair is to preserve
-dnl quotation: this macro is robust to active symbols.
-dnl
-dnl | define(active, ACTIVE)
-dnl | m4_list_append(m4_list_append(m4_list_append((), [1 active]),
-dnl | [2 active]),
-dnl | [3 active])end
-dnl =>(1 active, 2 active, 3 active)end
-dnl
-dnl The combination of this macro and m4_quote is extremely useful to
-dnl build and store lists:
-dnl
-dnl | define(active, ACTIVE)
-dnl | define(list, ())
-dnl | define([list], m4_quote(m4_list_append(list, [1 active])))
-dnl | define([list], m4_quote(m4_list_append(list, [2 active])))
-dnl | define([list], m4_quote(m4_list_append(list, [3 active])))
-dnl | list
-dnl =>(1 active, 2 active, 3 active)
-dnl
-define([m4_list_append],
-[ifelse([$1], [], [([$2])],
- [$1], [()], [([$2])],
- [patsubst([[$1]], [^..\(.*\)..$], [[(\1, $2)]])])])
-
-
-define([m4_list_add],
-[define([$1], m4_quote(m4_list_append($1, [$2])))])
dnl ### Defining macros
@@@config_h=AC_CONFIG_H@@@
])
+dnl Install a new hook for AH_ macros.
+define(AH_HOOK,
+[m4_append([AH_HOOKS], [define([$1], defn([$2]))])])
+
+
dnl Autoheader is not the right program to complain about cross-compiling.
define([AC_TRY_RUN], [
$2
$3
$4])
-define([AC_DEFINE], [AH_DEFINE($@)])
-define([AC_DEFINE_UNQUOTED], [AH_DEFINE($@)])
-define([AC_NEED_DECLS], [AH_NEED_DECLS($@)])
-define([AC_CHECK_SIZEOF], [AH_CHECK_SIZEOF($@)])
-define([AC_CHECK_FUNCS], [AH_CHECK_FUNCS($@)])
-define([AC_CHECK_HEADERS], [AH_CHECK_HEADERS($@)])
-define([AC_CHECK_HEADERS_DIRENT], [AH_CHECK_HEADERS($@)])
-define([AC_CHECK_MEMBERS], [AH_CHECK_MEMBERS($@)])
-define([AC_CHECK_LIB], [AH_CHECK_LIB($@)])
-define([AC_PROG_LEX], [AH_PROG_LEX($@)])
-define([AC_FUNC_ALLOCA], [AH_FUNC_ALLOCA($@)])
-define([AC_C_CHAR_UNSIGNED], [AH_C_CHAR_UNSIGNED($@)])
-define([AC_AIX], [AH_AIX($@)])
-define([AC_F77_WRAPPERS], [AH_F77_WRAPPERS($@)])
+AH_HOOK([AC_DEFINE], [AH_DEFINE])
+AH_HOOK([AC_DEFINE_UNQUOTED], [AH_DEFINE])
+AH_HOOK([AC_NEED_DECLS], [AH_NEED_DECLS])
+AH_HOOK([AC_CHECK_SIZEOF], [AH_CHECK_SIZEOF])
+AH_HOOK([AC_CHECK_FUNCS], [AH_CHECK_FUNCS])
+AH_HOOK([AC_CHECK_HEADERS], [AH_CHECK_HEADERS])
+AH_HOOK([AC_CHECK_HEADERS_DIRENT], [AH_CHECK_HEADERS])
+AH_HOOK([AC_CHECK_MEMBERS], [AH_CHECK_MEMBERS])
+AH_HOOK([AC_CHECK_LIB], [AH_CHECK_LIB])
+AH_HOOK([AC_PROG_LEX], [AH_PROG_LEX])
+AH_HOOK([AC_FUNC_ALLOCA], [AH_FUNC_ALLOCA])
+AH_HOOK([AC_C_CHAR_UNSIGNED], [AH_C_CHAR_UNSIGNED])
+AH_HOOK([AC_AIX], [AH_AIX])
+AH_HOOK([AC_F77_WRAPPERS], [AH_F77_WRAPPERS])
+
+dnl Install the AH_HOOKS
+AH_HOOKS
[ \(.\)$], [\1])])
+
+dnl m4_append(MACRO-NAME, STRING)
+dnl -----------------------------
+dnl Redefine MACRO-NAME to hold its former content plus STRING at the
+dnl end. It is valid to use this macro with MACRO-NAME undefined.
+dnl
+dnl This macro is robust to active symbols. It can be used to grow
+dnl strings or lists.
+dnl
+dnl | define(active, ACTIVE)
+dnl | m4_append([sentence], [This is an])
+dnl | m4_append([sentence], [ active ])
+dnl | m4_append([sentence], [symbol.])
+dnl | sentence
+dnl | undefine([active])dnl
+dnl | sentence
+dnl => This is an ACTIVE symbol.
+dnl => This is an active symbol.
+dnl
+dnl It can be used to define hooks.
+dnl
+dnl | define(active, ACTIVE)
+dnl | m4_append([hooks], [define([act1], [act2])])
+dnl | m4_append([hooks], [define([act2], [active])])
+dnl | undefine([active])
+dnl | act1
+dnl | hooks
+dnl | act1
+dnl => act1
+dnl =>
+dnl => active
+define(m4_append,
+[define([$1],
+ifdef([$1], [defn([$1])])
+[$2])])
+
+
dnl ------------------------------------------------------------
dnl Some additional m4 structural control.
dnl ------------------------------------------------------------
[$3])])])
-dnl m4_list_append(LIST, ELEMENT)
-dnl -----------------------------
-dnl Insert ELEMENT at the end of LIST.
-dnl
-dnl This macro is picky on its input, especially for the empty list: it
-dnl must be either the empty string, or exactly `()' (no spaces allowed).
-dnl This macro is actually purely textual: it basically replaces the
-dnl closing paren of LIST with `, ELEMENT)'. The hair is to preserve
-dnl quotation: this macro is robust to active symbols.
-dnl
-dnl | define(active, ACTIVE)
-dnl | m4_list_append(m4_list_append(m4_list_append((), [1 active]),
-dnl | [2 active]),
-dnl | [3 active])end
-dnl =>(1 active, 2 active, 3 active)end
-dnl
-dnl The combination of this macro and m4_quote is extremely useful to
-dnl build and store lists:
-dnl
-dnl | define(active, ACTIVE)
-dnl | define(list, ())
-dnl | define([list], m4_quote(m4_list_append(list, [1 active])))
-dnl | define([list], m4_quote(m4_list_append(list, [2 active])))
-dnl | define([list], m4_quote(m4_list_append(list, [3 active])))
-dnl | list
-dnl =>(1 active, 2 active, 3 active)
-dnl
-define([m4_list_append],
-[ifelse([$1], [], [([$2])],
- [$1], [()], [([$2])],
- [patsubst([[$1]], [^..\(.*\)..$], [[(\1, $2)]])])])
-
-
-define([m4_list_add],
-[define([$1], m4_quote(m4_list_append($1, [$2])))])
dnl ### Defining macros