>From dbfbf0d2e550d7d304f5fb8edfa5a340aebc4d21 Mon Sep 17 00:00:00 2001 From: Joern Rennecke Date: Tue, 1 Jun 2010 20:06:54 +0200 Subject: [PATCH 1/2] Generalize AC_CHECK_DECL for C++: allow optional arguments. * general.m4 (_AC_CHECK_DECL_BODY): Process trailing function argument types as arguments to use for C++. (_AC_CHECK_DECLS): Filter out trailing function argument types when henerating the HAVE_DECL_* macro. Signed-off-by: Ralf Wildenhues --- ChangeLog | 8 ++++++++ lib/autoconf/general.m4 | 15 +++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1452eb3..8041556 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-01 Joern Rennecke (tiny change) + + Generalize AC_CHECK_DECL for C++: allow optional arguments. + * general.m4 (_AC_CHECK_DECL_BODY): Process trailing function + argument types as arguments to use for C++. + (_AC_CHECK_DECLS): Filter out trailing function argument types + when henerating the HAVE_DECL_* macro. + 2010-05-25 Stefano Lattarini Eric Blake diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index b7ac62f..fecfb72 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2792,10 +2792,16 @@ AC_DEFUN([AC_CHECK_FILES], # Shell function body for AC_CHECK_DECL. m4_define([_AC_CHECK_DECL_BODY], [ AS_LINENO_PUSH([$[]1]) - AC_CACHE_CHECK([whether $[]2 is declared], [$[]3], + [as_decl_name=`echo $][2|sed 's/(.*//'`] + [as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`] + AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4], address@hidden:@ifndef $[]2 - (void) $[]2; address@hidden:@ifndef $[]as_decl_name address@hidden:@ifdef __cplusplus + (void) $[]as_decl_use; address@hidden:@else + (void) $[]as_decl_name; address@hidden:@endif @%:@endif ])], [AS_VAR_SET([$[]3], [yes])], @@ -2831,7 +2837,8 @@ AS_VAR_POPDEF([ac_Symbol])dnl # ACTION-IF-FOUND or ACTION-IF-NOT-FOUND. m4_define([_AC_CHECK_DECLS], [AC_CHECK_DECL([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl -[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_$1]), [$ac_have_decl], +[AC_DEFINE_UNQUOTED(AS_TR_CPP(m4_bpatsubst(HAVE_DECL_[$1],[(.*])), + [$ac_have_decl], [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])]dnl [m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])]) -- 1.7.0.rc1.161.g90487