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 <Ralf.Wildenhues@gmx.de>
This commit is contained in:
Joern Rennecke 2010-06-01 20:06:54 +02:00 committed by Ralf Wildenhues
parent f44e1243ec
commit 03bf155e9b
2 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,11 @@
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>

View File

@ -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])])])