]> Savannah Git Hosting - gnulib.git/commitdiff
strerror_r-posix: Another fix, for HAVE_DECL_STRERROR_R on mingw
authorEric Blake <eblake@redhat.com>
Mon, 14 Nov 2016 21:36:51 +0000 (15:36 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 14 Nov 2016 23:15:39 +0000 (17:15 -0600)
Commit 5ddd9d7 improved strerror_r on glibc systems (where
STRERROR_R_CHAR_P was defined twice with different values), but
missed mingw systems (where HAVE_DECL_STRERROR_R is now defined
twice with different values).  Avoid the AC_CHECK_DECLS[_ONCE]
and AC_CHECK_FUNCS[_ONCE] m4 macros that call AC_DEFINE under the
hood, and instead limit our checks to just setting shell witnesses,
so that compilation on mingw doesn't trigger warnings (and mess up
subsequent tests that use -Werror) about a redefined C preprocessor
macro.

* m4/strerror_r.m4 (gl_FUNC_STRERROR_R, gl_FUNC_STRERROR_R_WORKS):
Avoid calling macros that may supply a conflicting AC_DEFINE().

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
m4/strerror_r.m4

index 4eaad708b771e6ad3c6f6fb2ea464400ae63feb1..93be4e91c243f22fd6772cce550310f2fa90d2be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-11-14  Eric Blake  <eblake@redhat.com>
+
+       strerror_r-posix: Another fix, for HAVE_DECL_STRERROR_R on mingw.
+       * m4/strerror_r.m4 (gl_FUNC_STRERROR_R, gl_FUNC_STRERROR_R_WORKS):
+       Avoid _ONCE variants, which may supply a conflicting AC_DEFINE().
+
 2016-11-14  Pádraig Brady  <P@draigBrady.com>
 
        strptime: fix compile error in recent change
index 7fd08a867bf3a2863782b3b96eb05000cebbdb31..aa0ea44bd6ff42e30d119b403852c5ba640be432 100644 (file)
@@ -1,4 +1,4 @@
-# strerror_r.m4 serial 17
+# strerror_r.m4 serial 18
 dnl Copyright (C) 2002, 2007-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,10 +14,8 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
 
   dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT
   dnl are not defined.
-  AC_CHECK_DECLS_ONCE([strerror_r])
-  if test $ac_cv_have_decl_strerror_r = no; then
-    HAVE_DECL_STRERROR_R=0
-  fi
+  AC_CHECK_DECL([strerror_r],
+    [HAVE_DECL_STRERROR_R=1], [HAVE_DECL_STRERROR_R=0])
   AC_DEFINE_UNQUOTED([HAVE_DECL_STRERROR_R_ORIG], [$HAVE_DECL_STRERROR_R],
     [Define to 1 if you have the declaration of 'strerror_r' in the system include files, or to 0 otherwise.])
 
@@ -70,7 +68,7 @@ AC_DEFUN([gl_FUNC_STRERROR_R_WORKS],
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_REQUIRE([gl_FUNC_STRERROR_0])
 
-  AC_CHECK_FUNCS_ONCE([strerror_r])
+  AC_CHECK_FUNC([strerror_r])
   if test $ac_cv_func_strerror_r = yes; then
     if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
       dnl The POSIX prototype is:  int strerror_r (int, char *, size_t);