summaryrefslogtreecommitdiff
path: root/m4/strerror_r.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/strerror_r.m4')
-rw-r--r--m4/strerror_r.m425
1 files changed, 16 insertions, 9 deletions
diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4
index 0689e46..d790ba8 100644
--- a/m4/strerror_r.m4
+++ b/m4/strerror_r.m4
@@ -1,5 +1,5 @@
-# strerror_r.m4 serial 21
-dnl Copyright (C) 2002, 2007-2021 Free Software Foundation, Inc.
+# strerror_r.m4 serial 26
+dnl Copyright (C) 2002, 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -9,9 +9,6 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
AC_REQUIRE([gl_STRING_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
- dnl Persuade Solaris <string.h> to declare strerror_r().
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT
dnl are not defined.
AC_CHECK_DECLS_ONCE([strerror_r])
@@ -20,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
fi
if test $ac_cv_func_strerror_r = yes; then
- if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
+ if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then
if test $gl_cv_func_strerror_r_posix_signature = yes; then
case "$gl_cv_func_strerror_r_works" in
dnl The system's strerror_r has bugs. Replace it.
@@ -40,9 +37,10 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
# Prerequisites of lib/strerror_r.c.
AC_DEFUN([gl_PREREQ_STRERROR_R], [
+ AC_REQUIRE([AC_FUNC_STRERROR_R])
dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r.
AC_CHECK_FUNCS_ONCE([__xpg_strerror_r])
- AC_CHECK_FUNCS_ONCE([catgets])
+ gl_CHECK_FUNCS_ANDROID([catgets], [[#include <nl_types.h>]])
AC_CHECK_FUNCS_ONCE([snprintf])
])
@@ -52,11 +50,16 @@ AC_DEFUN([gl_FUNC_STRERROR_R_WORKS],
[
AC_REQUIRE([gl_HEADER_ERRNO_H])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Persuade Android <string.h> to use the GNU strerror_r API,
+ dnl and Solaris <string.h> to declare strerror_r.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
AC_REQUIRE([gl_FUNC_STRERROR_0])
- AC_CHECK_FUNCS_ONCE([strerror_r])
+ gl_CHECK_FUNCS_ANDROID([strerror_r], [[#include <string.h>]])
if test $ac_cv_func_strerror_r = yes; then
- if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
+ if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then
dnl The POSIX prototype is: int strerror_r (int, char *, size_t);
dnl glibc, Cygwin: char *strerror_r (int, char *, size_t);
dnl AIX 5.1, OSF/1 5.1: int strerror_r (int, char *, int);
@@ -169,5 +172,9 @@ changequote([,])dnl
fi
fi
fi
+ else
+ case "$gl_cv_onwards_func_strerror_r" in
+ future*) REPLACE_STRERROR_R=1 ;;
+ esac
fi
])