]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
1999-10-31 Akim Demaille <akim@epita.fr>
authorAkim Demaille <akim@epita.fr>
Mon, 20 Dec 1999 12:08:01 +0000 (12:08 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 20 Dec 1999 12:08:01 +0000 (12:08 +0000)
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.

ChangeLog
acgeneral.m4
autoheader.m4
lib/autoconf/general.m4

index 85a81c53111cb89984877ae0684e9de90f325121..70186975967c8d66a88c394e8b2b2abb1649e769 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
index a6235de4353b85accc410c3239580c67f1e288cb..d5cea62c93a82e4d75cb1f86b7b97f11edc30571 100644 (file)
@@ -167,6 +167,43 @@ define([m4_strip],
           [ \(.\)$], [\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 ------------------------------------------------------------
@@ -259,41 +296,6 @@ define(_m4_foreach,
                                                  [$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
index 9db225282b240d00d906d17a2410918c2642848d..31aed6ea32343bc2466248f1ce91d91173986adc 100644 (file)
@@ -192,23 +192,31 @@ define([AC_CONFIG_H], patsubst($1, [ .*$], []))dnl
 @@@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
index a6235de4353b85accc410c3239580c67f1e288cb..d5cea62c93a82e4d75cb1f86b7b97f11edc30571 100644 (file)
@@ -167,6 +167,43 @@ define([m4_strip],
           [ \(.\)$], [\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 ------------------------------------------------------------
@@ -259,41 +296,6 @@ define(_m4_foreach,
                                                  [$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