>From 40135ed721447d3fc5c423d42c47f8aaa65bb8c6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Jan 2023 12:19:58 +0100 Subject: [PATCH 20/47] Resolve conflicts for functions introduced in Android API level 21. * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Conditionally set REPLACE_DUPLOCALE. * m4/localename.m4 (gl_LOCALENAME): Conditionally set REPLACE_NEWLOCALE, REPLACE_DUPLOCALE, REPLACE_FREELOCALE. * lib/locale.in.h (newlocale, duplocale, freelocale): Disable _GL_CXXALIASWARN invocation on non-glibc systems. --- ChangeLog | 7 +++++++ lib/locale.in.h | 6 +++--- m4/duplocale.m4 | 5 ++++- m4/localename.m4 | 14 +++++++++++++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22a28b2fd3..a6f1cb08a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ Resolve conflicts for functions introduced in Android API level 21. + * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Conditionally set + REPLACE_DUPLOCALE. + * m4/localename.m4 (gl_LOCALENAME): Conditionally set REPLACE_NEWLOCALE, + REPLACE_DUPLOCALE, REPLACE_FREELOCALE. + * lib/locale.in.h (newlocale, duplocale, freelocale): Disable + _GL_CXXALIASWARN invocation on non-glibc systems. + * lib/unistd.in.h (dup3): Consider REPLACE_DUP3. Disable _GL_CXXALIASWARN invocation on non-glibc systems. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_DUP3. diff --git a/lib/locale.in.h b/lib/locale.in.h index 538b83412b..e9c34182e5 100644 --- a/lib/locale.in.h +++ b/lib/locale.in.h @@ -229,7 +229,7 @@ _GL_CXXALIAS_SYS (newlocale, locale_t, (int category_mask, const char *name, locale_t base)); # endif # endif -# if @HAVE_NEWLOCALE@ +# if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@ _GL_CXXALIASWARN (newlocale); # endif # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ @@ -258,7 +258,7 @@ _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); # endif # endif -# if @HAVE_DUPLOCALE@ +# if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@ _GL_CXXALIASWARN (duplocale); # endif # if @HAVE_DUPLOCALE@ || @REPLACE_DUPLOCALE@ @@ -290,7 +290,7 @@ _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); # endif # endif -# if @HAVE_FREELOCALE@ +# if __GLIBC__ >= 2 && @HAVE_FREELOCALE@ _GL_CXXALIASWARN (freelocale); # endif #elif defined GNULIB_POSIXCHECK diff --git a/m4/duplocale.m4 b/m4/duplocale.m4 index 22b4bf80bd..54349e920a 100644 --- a/m4/duplocale.m4 +++ b/m4/duplocale.m4 @@ -1,4 +1,4 @@ -# duplocale.m4 serial 17 +# duplocale.m4 serial 18 dnl Copyright (C) 2009-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, @@ -110,6 +110,9 @@ int main () fi else HAVE_DUPLOCALE=0 + case "$gl_cv_onwards_func_duplocale" in + future*) REPLACE_DUPLOCALE=1 ;; + esac fi if test $REPLACE_DUPLOCALE = 1; then DUPLOCALE_LIB="$SETLOCALE_NULL_LIB" diff --git a/m4/localename.m4 b/m4/localename.m4 index 43725d8444..8c43a13aa0 100644 --- a/m4/localename.m4 +++ b/m4/localename.m4 @@ -1,4 +1,4 @@ -# localename.m4 serial 9 +# localename.m4 serial 10 dnl Copyright (C) 2007, 2009-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, @@ -22,18 +22,30 @@ AC_DEFUN([gl_LOCALENAME], else dnl In 2019, some versions of z/OS lack the locale_t type and have broken dnl newlocale, duplocale, freelocale functions. + gl_cv_onwards_func_newlocale='future OS version' + gl_cv_onwards_func_duplocale='future OS version' + gl_cv_onwards_func_freelocale='future OS version' gl_func_newlocale=no gl_func_duplocale=no gl_func_freelocale=no fi if test $gl_func_newlocale != yes; then HAVE_NEWLOCALE=0 + case "$gl_cv_onwards_func_newlocale" in + future*) REPLACE_NEWLOCALE=1 ;; + esac fi if test $gl_func_duplocale != yes; then HAVE_DUPLOCALE=0 + case "$gl_cv_onwards_func_duplocale" in + future*) REPLACE_DUPLOCALE=1 ;; + esac fi if test $gl_func_freelocale != yes; then HAVE_FREELOCALE=0 + case "$gl_cv_onwards_func_freelocale" in + future*) REPLACE_FREELOCALE=1 ;; + esac fi if test $gt_localename_enhances_locale_funcs = yes; then REPLACE_NEWLOCALE=1 -- 2.34.1