From: Akim Demaille Date: Fri, 4 Feb 2000 13:37:47 +0000 (+0000) Subject: Hide AH_HOOK behind AH_DEFUN. X-Git-Tag: autoconf-2.50~1248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea044949a526636d3718f41d26bee71f2b545d94;p=thirdparty%2Fautoconf.git Hide AH_HOOK behind AH_DEFUN. * autoheader.m4 (AH_DEFUN): New macro. Combination of define and AH_HOOK. (AC_TRY_RUN, AC_DEFINE, AC_DEFINE_UNQUOTED, AC_CHECK_LIB, AC_CHECK_HEADERS, AC_CHECK_HEADERS_DIRENT, AC_CHECK_DECLS, AC_CHECK_FUNCS, AC_CHECK_SIZEOF, AC_PROG_LEX, AC_CHECK_MEMBERS, AC_CHECK_TYPE, AC_FUNC_ALLOCA, AC_CHECK_TYPES, AC_C_CHAR_UNSIGNED, AC_AIX, AC_F77_WRAPPERS, AC_CONFIG_HEADER): All the former calls to define and AH_HOOK in autoheader.m4 are replaced by AH_DEFUN. --- diff --git a/ChangeLog b/ChangeLog index 96b2e73ef..df99f7a05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2000-02-04 Akim Demaille + + Hide AH_HOOK behind AH_DEFUN. + + * autoheader.m4 (AH_DEFUN): New macro. Combination of define and + AH_HOOK. + (AC_TRY_RUN, AC_DEFINE, AC_DEFINE_UNQUOTED, AC_CHECK_LIB, + AC_CHECK_HEADERS, AC_CHECK_HEADERS_DIRENT, AC_CHECK_DECLS, + AC_CHECK_FUNCS, AC_CHECK_SIZEOF, AC_PROG_LEX, AC_CHECK_MEMBERS, + AC_CHECK_TYPE, AC_FUNC_ALLOCA, AC_CHECK_TYPES, AC_C_CHAR_UNSIGNED, + AC_AIX, AC_F77_WRAPPERS, AC_CONFIG_HEADER): All the former calls + to define and AH_HOOK in autoheader.m4 are replaced by AH_DEFUN. + 2000-02-04 Akim Demaille * acspecific.m4 (AC_RSH, AC_ARG_ARRAY, AC_HAVE_POUNDBANG): No use diff --git a/acgeneral.m4 b/acgeneral.m4 index 797129946..1e5abcd3c 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -3189,7 +3189,7 @@ dnl esac AC_DEFUN(AC_CONFIG_LINKS, [AC_CONFIG_UNIQUE([$1])dnl ifelse(regexp([$1], [^\.:\| \.:]), -1,, - [AC_FATAL([$0: invalid destination: `.'])])dnl + [AC_FATAL([$0: invalid destination: `.'])])dnl m4_append([AC_LIST_LINKS], [$1])dnl dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1], diff --git a/autoheader.m4 b/autoheader.m4 index b607ec5b3..95df481b2 100644 --- a/autoheader.m4 +++ b/autoheader.m4 @@ -24,6 +24,54 @@ m4_include(acspecific.m4)dnl m4_include(acoldnames.m4)dnl +dnl AH_HOOK(AUTOCONF-NAME, AUTOHEADER-NAME) +dnl --------------------------------------- +dnl Install a new hook for AH_ macros. Specify that the macro +dnl AUTOCONF-NAME will later be defined as the concatenation of +dnl both its former definition, and that of AUTOHEADER-NAME. +dnl +dnl There are several motivations for not just defining to be equivalent to +dnl AUTOHEADER-NAME. +dnl +dnl Let AC_FOO be +dnl | AC_DEFINE(FOO, 1) +dnl | AC_DEFINE(BAR, 1) +dnl | AC_DEFINE(BAZ, 1, The value of BAZ.) +dnl Let AH_FOO be +dnl | AH_TEMPLATE(FOO, The value of FOO.) +dnl +dnl If we hook AC_FOO to be AH_FOO only, then only FOO will be templated. +dnl If we hook AC_FOO to expand in both the former AC_FOO and AH_FOO, then +dnl both FOO and BAZ are templated. +dnl +dnl Additionaly, if AC_FOO is hooked to AH_FOO only, then we loose track +dnl of the other AC_DEFINE, and the autoheader machinery (see the use of +dnl the shell variable SYMS in AC_TEMPLATE) won't be able to see that BAR +dnl is not templated at all. Hooking AC_FOO on both its AC_ and AH_ faces +dnl makes sure we keep track of non templated DEFINEs. +dnl +dnl The two last end of lines make AH_HOOKS more readable. +define(AH_HOOK, +[m4_append([AH_HOOKS], +[define([$1], +defn([$1]) +defn([$2]) +) +])]) + + + +dnl AH_DEFUN(MACRO, CONTENT) +dnl ------------------------ +dnl Define the macro AH_MACRO (i.e., with AH_ prepended) as CONTENT. Also +dnl install an AH_HOOK from MACRO to AH_MACRO. This hook is run by +dnl autoheader to substitutes the selected AC_FOO macros by AH_AC_FOO. +define(AH_DEFUN, +[define([AH_$1], [$2]) +AH_HOOK([$1], [AH_$1])]) + + + dnl These are alternate definitions of some macros, which produce dnl strings in the output marked with "@@@" so we can easily extract dnl the information we want. The `#' at the end of the first line of @@ -31,6 +79,12 @@ dnl each definition seems to be necessary to prevent m4 from eating dnl the newline, which makes the @@@ not always be at the beginning of dnl a line. +dnl Autoheader is not the right program to complain about cross-compiling. +AH_DEFUN([AC_TRY_RUN], +[$2 +$3 +$4]) + dnl AH_DEFINE(VARIABLE, [VALUE], [DESCRIPTION]) dnl ------------------------------------------- dnl When running autoheader, this macro replaces AC_DEFINE and @@ -47,6 +101,10 @@ dnl Ignore CPP macro arguments. @@@syms="$syms patsubst($1, [(.*$])"@@@ ])]) +AH_DEFUN([AC_DEFINE], [AH_DEFINE($@)]) +AH_DEFUN([AC_DEFINE_UNQUOTED], [AH_DEFINE($@)]) + + dnl AH_TEMPLATE(KEY, DESCRIPTION) dnl ----------------------------- dnl Issue an autoheader template for KEY, i.e., a comment composed @@ -56,6 +114,7 @@ define([AH_TEMPLATE], AC_WRAP([$2 */], [ ], [/* ])[ #undef $1])]) + dnl AH_VERBATIM(KEY, TEMPLATE) dnl -------------------------- dnl If KEY is direct (i.e., no indirection such as in KEY=$my_func which may @@ -73,7 +132,7 @@ _AC_SH_QUOTE([$2])" dnl FIXME: To be rigorous, this should not be systematic: depending dnl upon the arguments of AC_CHECK_LIB, we might not AC_DEFINE. -define([AH_CHECK_LIB], +AH_DEFUN([AC_CHECK_LIB], [AH_TEMPLATE(AC_TR_CPP(HAVE_LIB$1), [Define if you have the `]$1[' library (-l]$1[).]) # Success @@ -90,7 +149,10 @@ define([AH_CHECK_HEADERS], # Failure $3])]) -define([AH_CHECK_DECLS], +AH_DEFUN([AC_CHECK_HEADERS], [AH_CHECK_HEADERS($@)]) +AH_DEFUN([AC_CHECK_HEADERS_DIRENT], [AH_CHECK_HEADERS($@)]) + +AH_DEFUN([AC_CHECK_DECLS], [AC_FOREACH([AC_Symbol], [$1], [AH_TEMPLATE(AC_TR_CPP([NEED_]AC_Symbol[_DECL]), [Define if you need the declaration of `]AC_Symbol['.]) @@ -99,7 +161,8 @@ define([AH_CHECK_DECLS], # Failure $3])]) -define([AH_CHECK_FUNCS], + +AH_DEFUN([AC_CHECK_FUNCS], [AC_FOREACH([AC_Func], [$1], [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Func), [Define if you have the `]AC_Func[' function.]) @@ -109,17 +172,17 @@ define([AH_CHECK_FUNCS], $3]) ]) -define([AH_CHECK_SIZEOF], +AH_DEFUN([AC_CHECK_SIZEOF], [AH_TEMPLATE(AC_TR_CPP(SIZEOF_$1), [The number of bytes in a `]$1['.])]) -define([AH_PROG_LEX], -[AH_CHECK_LIB(fl) -AH_CHECK_LIB(l)]) +AH_DEFUN([AC_PROG_LEX], +[AC_CHECK_LIB(fl) +AC_CHECK_LIB(l)]) -define([AH_CHECK_MEMBERS], +AH_DEFUN([AC_CHECK_MEMBERS], [m4_foreach([AC_Member], [$1], [pushdef(AC_Member_Aggregate, [patsubst(AC_Member, [\.[^.]*])]) pushdef(AC_Member_Member, [patsubst(AC_Member, [.*\.])]) @@ -134,25 +197,13 @@ define([AH_CHECK_MEMBERS], $3]) ]) -dnl AH_CHECK_TYPES((TYPES, ...)) -dnl ---------------------------- -define([AH_CHECK_TYPES], -[m4_foreach([AC_Type], [$1], - [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Type), - [Define if the system has the type `]AC_Type['.]) - # Success - $2 - # Failure - $3]) -]) - dnl AC_CHECK_TYPE(TYPE, SUBTITUTE) dnl ------------------------------ -define([AH_CHECK_TYPE], +AH_DEFUN([AC_CHECK_TYPE], [AH_TEMPLATE([$1], [Define to `$2' if does not define.])]) -define([AH_FUNC_ALLOCA], +AH_DEFUN([AC_FUNC_ALLOCA], [AH_VERBATIM([STACK_DIRECTION], [/* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be @@ -164,7 +215,20 @@ define([AH_FUNC_ALLOCA], ])])dnl AH_FUNC_ALLOCA -define([AH_C_CHAR_UNSIGNED], +dnl AH_CHECK_TYPES((TYPES, ...)) +dnl ---------------------------- +AH_DEFUN([AC_CHECK_TYPES], +[m4_foreach([AC_Type], [$1], + [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Type), + [Define if the system has the type `]AC_Type['.]) + # Success + $2 + # Failure + $3]) +]) + + +AH_DEFUN([AC_C_CHAR_UNSIGNED], [AH_VERBATIM([__CHAR_UNSIGNED__], [/* Define if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ @@ -173,7 +237,7 @@ define([AH_C_CHAR_UNSIGNED], ])]) -define([AH_AIX], +AH_DEFUN([AC_AIX], [AH_VERBATIM([_ALL_SOURCE], [/* Define if on AIX 3. System headers sometimes define this. @@ -184,7 +248,7 @@ define([AH_AIX], ])]) -define([AH_F77_WRAPPERS], +AH_DEFUN([AC_F77_WRAPPERS], [AH_TEMPLATE([F77_FUNC], [Define to a macro that performs the appropriate name mangling on its argument to make the C identifier, which @@ -197,76 +261,9 @@ AH_TEMPLATE([F77_FUNC_], scheme of the Fortran 77 compiler.])]) -define([AC_CONFIG_HEADER], [# -define([AC_CONFIG_H], patsubst($1, [ .*$], []))dnl -@@@config_h=AC_CONFIG_H@@@ +AH_DEFUN([AC_CONFIG_HEADER], +[@@@config_h=patsubst($1, [ .*$], [])@@@ ]) -dnl AH_HOOK(AUTOCONF-NAME, AUTOHEADER-NAME) -dnl --------------------------------------- -dnl Install a new hook for AH_ macros. Specify that the macro -dnl AUTOCONF-NAME will later be defined as the concatenation of -dnl both its former definition, and that of AUTOHEADER-NAME. -dnl -dnl There are motivations for not just defining to AUTOHEADER-NAME. For -dnl instance, if there is an AC macro which requires a special template -dnl but also has traditional AC_DEFINEs which are documented, then it is -dnl logical that these templates are preserved. AC_FUNC_ALLOCA is such an -dnl example. -dnl Another reason is that this way -dnl -dnl There are several for not just defining to be equivalent to -dnl AUTOHEADER-NAME. -dnl -dnl Let AC_FOO be -dnl | AC_DEFINE(FOO, 1) -dnl | AC_DEFINE(BAR, 1) -dnl | AC_DEFINE(BAZ, 1, The value of BAZ.) -dnl Let AH_FOO be -dnl | AH_TEMPLATE(FOO, The value of FOO.) -dnl -dnl If we hook AC_FOO to be AH_FOO only, then only FOO will be templated. -dnl If we hook AC_FOO to expand in both the former AC_FOO and AH_FOO, then -dnl both FOO and BAZ are templated. -dnl -dnl Additionaly, if AC_FOO is hooked to AH_FOO only, then we loose track -dnl of the other AC_DEFINE, and the autoheader machinery (see the use of -dnl the shell variable SYMS in AC_TEMPLATE) won't be able to see that BAR -dnl is not templated at all. Hooking AC_FOO on both its AC_ and AH_ faces -dnl makes sure we keep track of non templated DEFINEs. -dnl -dnl The two last end of lines make AH_HOOKS more readable. -define(AH_HOOK, -[m4_append([AH_HOOKS], -[define([$1], -defn([$1]) -defn([$2]) -) -])]) - - -dnl Autoheader is not the right program to complain about cross-compiling. -define([AC_TRY_RUN], [ -$2 -$3 -$4]) - -AH_HOOK([AC_DEFINE], [AH_DEFINE]) -AH_HOOK([AC_DEFINE_UNQUOTED], [AH_DEFINE]) -AH_HOOK([AC_CHECK_DECLS], [AH_CHECK_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_TYPE], [AH_CHECK_TYPE]) -AH_HOOK([AC_CHECK_TYPES], [AH_CHECK_TYPES]) -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 797129946..1e5abcd3c 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -3189,7 +3189,7 @@ dnl esac AC_DEFUN(AC_CONFIG_LINKS, [AC_CONFIG_UNIQUE([$1])dnl ifelse(regexp([$1], [^\.:\| \.:]), -1,, - [AC_FATAL([$0: invalid destination: `.'])])dnl + [AC_FATAL([$0: invalid destination: `.'])])dnl m4_append([AC_LIST_LINKS], [$1])dnl dnl Register the commands ifelse([$2],,, [AC_FOREACH([AC_File], [$1],