+2010-06-01 Joern Rennecke <joern.rennecke@embecosm.com> (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 <stefano.lattarini@gmail.com>
Eric Blake <eblake@redhat.com>
# 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])],
# 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])])])