From 0716d22ed34add08b2f8b7c5a532ad01d0dfc9c8 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 20 Dec 1999 12:08:01 +0000 Subject: [PATCH] 1999-10-31 Akim Demaille 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 | 11 +++++++ acgeneral.m4 | 72 +++++++++++++++++++++-------------------- autoheader.m4 | 36 +++++++++++++-------- lib/autoconf/general.m4 | 72 +++++++++++++++++++++-------------------- 4 files changed, 107 insertions(+), 84 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85a81c53..70186975 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +1999-10-31 Akim Demaille + + 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 * acspecific.m4: Formating changes. diff --git a/acgeneral.m4 b/acgeneral.m4 index a6235de4..d5cea62c 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -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 diff --git a/autoheader.m4 b/autoheader.m4 index 9db22528..31aed6ea 100644 --- a/autoheader.m4 +++ b/autoheader.m4 @@ -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 diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index a6235de4..d5cea62c 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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