From: Bruno Haible Date: Sun, 16 Oct 2016 15:45:52 +0000 (+0200) Subject: Fix conflict between strerror_r-posix module and AC_FUNC_STRERROR_R. X-Git-Tag: v1.0~6579 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=888834f40d1bff6a4409aed98bba125348667f84;p=gnulib.git Fix conflict between strerror_r-posix module and AC_FUNC_STRERROR_R. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Override the values set by the AC_FUNC_STRERROR_R macro. Define HAVE_DECL_STRERROR_R_ORIG. * lib/strerror_r.c: Use HAVE_DECL_STRERROR_R_ORIG instead of HAVE_DECL_STRERROR_R. --- diff --git a/ChangeLog b/ChangeLog index 4faf8ba17d..f01affc2de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-10-16 Bruno Haible + + Fix conflict between strerror_r-posix module and AC_FUNC_STRERROR_R. + * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Override the values set by the + AC_FUNC_STRERROR_R macro. Define HAVE_DECL_STRERROR_R_ORIG. + * lib/strerror_r.c: Use HAVE_DECL_STRERROR_R_ORIG instead of + HAVE_DECL_STRERROR_R. + 2016-10-16 Bruno Haible Make the 'argp' module work without the 'error' module. diff --git a/lib/strerror_r.c b/lib/strerror_r.c index 07a00cf663..b1d4cf5909 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -40,7 +40,7 @@ extern #endif int __xpg_strerror_r (int errnum, char *buf, size_t buflen); -#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) +#elif HAVE_DECL_STRERROR_R_ORIG && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) /* The system's strerror_r function is OK, except that its third argument is 'int', not 'size_t', or its return type is wrong. */ diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4 index 2318927961..06c51e156f 100644 --- a/m4/strerror_r.m4 +++ b/m4/strerror_r.m4 @@ -1,4 +1,4 @@ -# strerror_r.m4 serial 15 +# strerror_r.m4 serial 16 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, @@ -18,6 +18,8 @@ AC_DEFUN([gl_FUNC_STRERROR_R], if test $ac_cv_have_decl_strerror_r = no; then HAVE_DECL_STRERROR_R=0 fi + 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.]) if test $ac_cv_func_strerror_r = yes; then if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then @@ -36,6 +38,11 @@ AC_DEFUN([gl_FUNC_STRERROR_R], REPLACE_STRERROR_R=1 fi fi + + # Overwrite the findings of AC_FUNC_STRERROR_R (for code that uses that). + AC_REQUIRE([AC_FUNC_STRERROR_R]) + AC_DEFINE([HAVE_DECL_STRERROR_R], [1]) + AC_DEFINE([STRERROR_R_CHAR_P], [0]) ]) # Prerequisites of lib/strerror_r.c.