bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] Make AC_CHECK_FUNC compatible with gcc -Werror


From: Dmitry V. Levin
Subject: [PATCH 2/2] Make AC_CHECK_FUNC compatible with gcc -Werror
Date: Fri, 26 Feb 2010 04:52:55 +0300

* lib/autoconf/functions.m4 (_AC_CHECK_FUNC_BODY): Use
AC_LANG_FUNC_LINK_TRY_GCC_BUILTIN also in case when AC_LANG_WERROR
is not in effect.
* tests/semantics.at (AC_CHECK_FUNCS with gcc -Werror): New test.
---
 lib/autoconf/functions.m4 |    2 +-
 tests/semantics.at        |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 33e624e..8f7bb28 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -47,7 +47,7 @@ m4_define([_AC_CHECK_FUNC_BODY],
   AC_CACHE_CHECK([for $[]2], [$[]3],
   [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY($[]2)],
                  [AS_VAR_SET([$[]3], [yes])],
-                 [if test "$GCC:$ac_[]_AC_LANG_ABBREV[]_werror_flag" = 
yes:yes; then
+                 [if test "$GCC" = yes; then
                     AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY_GCC_BUILTIN($[]2)],
                                    [AS_VAR_SET([$[]3], [yes])],
                                    [AS_VAR_SET([$[]3], [no])])
diff --git a/tests/semantics.at b/tests/semantics.at
index 213f067..c06d0a3 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -146,6 +146,21 @@ AC_CHECK_FUNCS(printf autoconf_ftnirp)],
 ])])
 
 
+# AC_CHECK_FUNCS with gcc -Werror
+# -------------------------------
+# Check that it performs the correct actions:
+# Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
+AT_CHECK_MACRO([AC_CHECK_FUNCS with gcc -Werror],
+[AC_PROG_CC
+test "$GCC" = yes || exit 77
+CFLAGS="${CFLAGS-} -Werror"; export CFLAGS
+AC_CHECK_FUNCS(printf autoconf_ftnirp)],
+[AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_FTNIRP */
+#define HAVE_PRINTF 1
+])])
+
+
 # AC_REPLACE_FUNCS
 # ----------------
 # Check that it performs the correct actions: autoconf_ftnirp.c must


-- 
ldv

Attachment: pgpuSMVhXgmyU.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]