From 71c0040e3b27f2a2e1ad567b13893854738c12ad Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 20 Dec 1999 12:01:55 +0000 Subject: [PATCH] 1999-10-31 Akim Demaille * acspecific.m4 (AC_CHECK_MEMBER, AC_CHECK_MEMBERS): New macros. * autoheader.m4 (AH_CHECK_MEMBERS): New macro. (epilogue): Hook AH_CHECK_MEMBERS on AC_CHECK_MEMBERS. --- ChangeLog | 10 +++++++-- acgeneral.m4 | 46 +++++++++++++++++++++++++++++++++++++++++ autoheader.m4 | 26 +++++++++++++++++++---- lib/autoconf/general.m4 | 46 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3246773..8af8fd0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,16 @@ +1999-10-31 Akim Demaille + + * acspecific.m4 (AC_CHECK_MEMBER, AC_CHECK_MEMBERS): New macros. + * autoheader.m4 (AH_CHECK_MEMBERS): New macro. + (epilogue): Hook AH_CHECK_MEMBERS on AC_CHECK_MEMBERS. + 1999-10-31 Akim Demaille * autoheader.m4 (AC_FUNC_ALLOCA): Rename from this ... (AH_FUNC_ALLOCA): ... to this. Includes all the needed templates. (AC_C_CHAR_UNSIGNED): Rename from this ... (AH_C_CHAR_UNSIGNED): ... to this. - + 1999-10-31 Ben Elliston * Makefile.am (CLEANFILES): New explicit variable. @@ -630,7 +636,7 @@ * config.guess: Eliminate the trailing dot if ${UNAME_RELEASE} is 1.4-. Fix for PR autoconf/22. -1999-09-17 Akim Demaille +1999-09-17 Akim Demaille * acgeneral.m4 (AC_INIT_PARSE_ARGS): Improve configure's --help. diff --git a/acgeneral.m4 b/acgeneral.m4 index 2bd60eda..d21bc86e 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2034,6 +2034,52 @@ define(AC_HASBEEN, dnl ### Generic structure checks +dnl AC_CHECK_MEMBER(AGGREGATE.MEMBER +dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, INCLUDES ]]]) +dnl --------------------------------------------------------- +dnl AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell +dnl variables are not a valid argument. +AC_DEFUN(AC_CHECK_MEMBER, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl +dnl Extract the aggregate name, and the member name +AC_VAR_IF_INDIR([$1], +[AC_FATAL([$0: requires manifest arguments])], +[pushdef(AC_Member_Aggregate, [patsubst([$1], [\.[^.]*])])dnl +pushdef(AC_Member_Member, [patsubst([$1], [.*\.])])])dnl +AC_CACHE_CHECK([for $1], ac_Member, +[AC_TRY_COMPILE(m4_default([$4 +], [#include +#include +#if STDC_HEADERS +# include +# include +#endif +]), +ac_Member_Aggregate foo; +foo.ac_Member_Member;, +AC_VAR_SET(ac_Member, yes), AC_VAR_SET(ac_Member, no))]) +AC_SHELL_IFELSE(test AC_VAR_GET(ac_Member) = yes, + [$2], [$3])dnl +popdef([AC_Member_Member])dnl +popdef([AC_Member_Aggregate])dnl +AC_VAR_POPDEF([ac_Member])dnl +])dnl AC_CHECK_MEMBER + +dnl AC_CHECK_MEMBER(AGGREGATE.MEMBER... +dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, INCLUDES ]]]) +dnl --------------------------------------------------------- +AC_DEFUN(AC_CHECK_MEMBERS, +[m4_foreach([AC_Member], [$1], + [AC_SPECIALIZE([AC_CHECK_MEMBER], AC_Member, + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member)) +$2], + [$3], + [$4])])]) + + dnl Check if a particular structure member exists. dnl AC_C_STRUCT_MEMBER(VARIABLE, INCLUDES, TYPE, MEMBER) AC_DEFUN(AC_C_STRUCT_MEMBER, diff --git a/autoheader.m4 b/autoheader.m4 index dd0ca300..9db22528 100644 --- a/autoheader.m4 +++ b/autoheader.m4 @@ -103,10 +103,11 @@ define([AH_CHECK_FUNCS], [AC_FOREACH([AC_Func], [$1], [AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Func), [Define if you have the `]AC_Func[' function.]) -# Success -$2 -# Failure -$3])]) + # Success + $2 + # Failure + $3]) +]) define([AH_CHECK_SIZEOF], [AH_TEMPLATE(AC_TR_CPP(SIZEOF_$1), @@ -116,6 +117,22 @@ define([AH_PROG_LEX], [AH_CHECK_LIB(fl) AH_CHECK_LIB(l)]) +define([AH_CHECK_MEMBERS], +[m4_foreach([AC_Member], [$1], + [pushdef(AC_Member_Aggregate, [patsubst(AC_Member, [\.[^.]*])]) + pushdef(AC_Member_Member, [patsubst(AC_Member, [.*\.])]) + AH_TEMPLATE(AC_TR_CPP(HAVE_[]AC_Member), + [Define if `]AC_Member_Member[' is member of] + [`]AC_Member_Aggregate['.]) + popdef([AC_Member_Member]) + popdef([AC_Member_Aggregate]) + # Success + $2 + # Failure + $3]) +]) + + define([AH_FUNC_ALLOCA], [AH_TEMPLATE(HAVE_ALLOCA_H, [Define if you have and it should be used @@ -188,6 +205,7 @@ 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($@)]) diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 2bd60eda..d21bc86e 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2034,6 +2034,52 @@ define(AC_HASBEEN, dnl ### Generic structure checks +dnl AC_CHECK_MEMBER(AGGREGATE.MEMBER +dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, INCLUDES ]]]) +dnl --------------------------------------------------------- +dnl AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell +dnl variables are not a valid argument. +AC_DEFUN(AC_CHECK_MEMBER, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl +dnl Extract the aggregate name, and the member name +AC_VAR_IF_INDIR([$1], +[AC_FATAL([$0: requires manifest arguments])], +[pushdef(AC_Member_Aggregate, [patsubst([$1], [\.[^.]*])])dnl +pushdef(AC_Member_Member, [patsubst([$1], [.*\.])])])dnl +AC_CACHE_CHECK([for $1], ac_Member, +[AC_TRY_COMPILE(m4_default([$4 +], [#include +#include +#if STDC_HEADERS +# include +# include +#endif +]), +ac_Member_Aggregate foo; +foo.ac_Member_Member;, +AC_VAR_SET(ac_Member, yes), AC_VAR_SET(ac_Member, no))]) +AC_SHELL_IFELSE(test AC_VAR_GET(ac_Member) = yes, + [$2], [$3])dnl +popdef([AC_Member_Member])dnl +popdef([AC_Member_Aggregate])dnl +AC_VAR_POPDEF([ac_Member])dnl +])dnl AC_CHECK_MEMBER + +dnl AC_CHECK_MEMBER(AGGREGATE.MEMBER... +dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, INCLUDES ]]]) +dnl --------------------------------------------------------- +AC_DEFUN(AC_CHECK_MEMBERS, +[m4_foreach([AC_Member], [$1], + [AC_SPECIALIZE([AC_CHECK_MEMBER], AC_Member, + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member)) +$2], + [$3], + [$4])])]) + + dnl Check if a particular structure member exists. dnl AC_C_STRUCT_MEMBER(VARIABLE, INCLUDES, TYPE, MEMBER) AC_DEFUN(AC_C_STRUCT_MEMBER,