From 0602cfd486655d5b5f0ebdf92f19280f6b6e984c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 14 Nov 2016 15:36:51 -0600 Subject: [PATCH] strerror_r-posix: Another fix, for HAVE_DECL_STRERROR_R on mingw 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 --- ChangeLog | 6 ++++++ m4/strerror_r.m4 | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4eaad708b7..93be4e91c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-11-14 Eric Blake + + 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 strptime: fix compile error in recent change diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4 index 7fd08a867b..aa0ea44bd6 100644 --- a/m4/strerror_r.m4 +++ b/m4/strerror_r.m4 @@ -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); -- 2.39.5