]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Generalize AC_CHECK_DECL for C++: allow optional arguments.
authorJoern Rennecke <joern.rennecke@embecosm.com>
Tue, 1 Jun 2010 18:06:54 +0000 (20:06 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 1 Jun 2010 20:47:47 +0000 (22:47 +0200)
* 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>
ChangeLog
lib/autoconf/general.m4

index 1452eb32f738001dd5ca69b30d5de7732902fb9d..6718e467eca69f58a6d5f03e263e7340c0f78342 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
index b7ac62f29ccc1e1f53f455301fe566203cce72b2..fecfb725048bc081ae7b5d7d990206aa115e13f2 100644 (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])])])