From: Joern Rennecke Date: Tue, 1 Jun 2010 18:06:54 +0000 (+0200) Subject: Generalize AC_CHECK_DECL for C++: allow optional arguments. X-Git-Tag: v2.66~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03bf155e9babf32e7d96c2179836637a38d59d21;p=thirdparty%2Fautoconf.git 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 generating the HAVE_DECL_* macro. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 1452eb32..6718e467 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 generating the HAVE_DECL_* macro. + 2010-05-25 Stefano Lattarini Eric Blake diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index b7ac62f2..fecfb725 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], -[@%:@ifndef $[]2 - (void) $[]2; +[@%:@ifndef $[]as_decl_name +@%:@ifdef __cplusplus + (void) $[]as_decl_use; +@%:@else + (void) $[]as_decl_name; +@%:@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])])])