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 <ebl...@redhat.com> --- ChangeLog | 6 ++++++ m4/strerror_r.m4 | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4eaad70..93be4e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-11-14 Eric Blake <ebl...@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 diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4 index 7fd08a8..aa0ea44 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.7.4