]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Documentation and tests for the AC_CHECK_DECL change.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 1 Jun 2010 19:54:39 +0000 (21:54 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 1 Jun 2010 20:47:56 +0000 (22:47 +0200)
* lib/autoconf/general.m4 (_AC_CHECK_DECL_BODY): Squash trailing
spaces in as_decl_name.
(_AC_CHECK_DECLS): Likewise for the define.
* tests/semantics.at (AC_CHECK_DECLS): Extend test.
* doc/autoconf.texi (Generic Declarations): Update.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4
tests/semantics.at

index 6718e467eca69f58a6d5f03e263e7340c0f78342..fac7c04247018f5ce73b1f9ff053955b3164a0d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-06-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Documentation and tests for the AC_CHECK_DECL change.
+       * lib/autoconf/general.m4 (_AC_CHECK_DECL_BODY): Squash trailing
+       spaces in as_decl_name.
+       (_AC_CHECK_DECLS): Likewise for the define.
+       * tests/semantics.at (AC_CHECK_DECLS): Extend test.
+       * doc/autoconf.texi (Generic Declarations): Update.
+       * NEWS: Update.
+
 2010-06-01  Joern Rennecke  <joern.rennecke@embecosm.com>  (tiny change)
 
        Generalize AC_CHECK_DECL for C++: allow optional arguments.
diff --git a/NEWS b/NEWS
index afd890795be8e43f67a57185014e8cb2cb0b26c2..04cf8dd9d027c78eec681658f9093fc24cd2bd79 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@ GNU Autoconf NEWS - User visible changes.
 
 ** Autoconf should work on EBCDIC hosts.
 
+** AC_CHECK_DECL and AC_CHECK_DECLS accept optional function argument types
+   for overloaded C++ functions.
+
 * Major changes in Autoconf 2.65 (2009-11-21) [stable]
   Released by Eric Blake, based on git versions 2.64.*.
 
index 3df0d3ffc0c1cb4095c9ce9d0380303641c867c6..eab9ab215253e78a481ff1748e8167de1cbde7f0 100644 (file)
@@ -6275,8 +6275,14 @@ prior to the declaration under test.
 
 This macro actually tests whether @var{symbol} is defined as a macro or
 can be used as an r-value, not whether it is really declared, because it
-is much safer to avoid
-introducing extra declarations when they are not needed.
+is much safer to avoid introducing extra declarations when they are not
+needed.  In order to facilitate use of C++ and overloaded function
+declarations, it is possible to specify function argument types in
+parentheses for types which can be zero-initialized:
+
+@example
+AC_CHECK_DECL([basename(char *)])
+@end example
 
 This macro caches its result in the @code{ac_cv_have_decl_@var{symbol}}
 variable, with characters not suitable for a variable name mapped to
@@ -6289,7 +6295,8 @@ underscores.
 @acindex{CHECK_DECLS}
 @cvindex HAVE_DECL_@var{symbol}
 @caindex have_decl_@var{symbol}
-For each of the @var{symbols} (@emph{comma}-separated list), define
+For each of the @var{symbols} (@emph{comma}-separated list with optional
+function argument types for C++ overloads), define
 @code{HAVE_DECL_@var{symbol}} (in all capitals) to @samp{1} if
 @var{symbol} is declared, otherwise to @samp{0}.  If
 @var{action-if-not-found} is given, it is additional shell code to
@@ -6306,6 +6313,7 @@ AC_CHECK_DECLS([strdup])
 AC_CHECK_DECLS([strlen])
 AC_CHECK_DECLS([malloc, realloc, calloc, free])
 AC_CHECK_DECLS([j0], [], [], [[#include <math.h>]])
+AC_CHECK_DECLS([[basename(char *)], [dirname(char *)]])
 @end example
 
 Unlike the other @samp{AC_CHECK_*S} macros, when a @var{symbol} is not
index fecfb725048bc081ae7b5d7d990206aa115e13f2..762a56cbda395a57c64708c1fe33d63090d47794 100644 (file)
@@ -2792,7 +2792,7 @@ AC_DEFUN([AC_CHECK_FILES],
 # Shell function body for AC_CHECK_DECL.
 m4_define([_AC_CHECK_DECL_BODY],
 [  AS_LINENO_PUSH([$[]1])
-  [as_decl_name=`echo $][2|sed 's/(.*//'`]
+  [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],
@@ -2837,7 +2837,7 @@ 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(m4_bpatsubst(HAVE_DECL_[$1],[(.*])),
+[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
index bb4481b7220871d750fa6d6a929a675b6b811b80..b703fd41d4eaba7c05353d3ab4b6aec64883788c 100644 (file)
@@ -109,9 +109,40 @@ AT_CHECK_MACRO([AC_CHECK_DECLS],
                   struct { int x[20]; } mystruct;
                   extern int myfunc();
                   #define mymacro1(arg) arg
-                  #define mymacro2]])]],
+                  #define mymacro2]])
+  # The difference in space-before-open-paren is intentional.
+  AC_CHECK_DECLS([basenam (char *), dirnam(char *),
+                 [moreargs (char, short, int, long, void *, char [], float, double)]],,,
+                [[#ifdef __cplusplus
+                  extern "C++" char *basenam (char *);
+                  extern "C++" const char *basenam (const char *);
+                  #else
+                  extern char *basenam (const char *);
+                  #endif
+                  #ifdef __cplusplus
+                  extern "C" {
+                  #endif
+                  extern int moreargs (char, short, int, long, void *,
+                                       char [], float, double);
+                  #ifdef __cplusplus
+                  }
+                  #endif
+                  ]])
+  AC_CHECK_DECL([declared (char *)],, [AS_EXIT([1])],
+               [[#ifdef __cplusplus
+                 extern "C++" char *declared (char *);
+                 extern "C++" const char *declared (const char *);
+                 #else
+                 extern char *declared (const char *);
+                 #endif
+               ]])
+  AC_CHECK_DECL([undeclared (char *)], [AS_EXIT([1])],, [[]])
+]],
 [AT_CHECK_DEFINES(
-[#define HAVE_DECL_MYENUM 1
+[#define HAVE_DECL_BASENAM 1
+#define HAVE_DECL_DIRNAM 0
+#define HAVE_DECL_MOREARGS 1
+#define HAVE_DECL_MYENUM 1
 #define HAVE_DECL_MYFUNC 1
 #define HAVE_DECL_MYMACRO1 1
 #define HAVE_DECL_MYMACRO2 1