From 03ea6c07ce04f0ba815243191688de4ba370e95a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 29 Apr 2026 16:31:30 +0200 Subject: [PATCH] mbrtoc32-regular: Strengthen the configure test. * m4/mbrtoc32-regular.m4: New file. * modules/mbrtoc32-regular (Files): Add it. (configure.ac): Invoke gl_FUNC_MBRTOC32_REGULAR. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Set gl_cv_func_mbrtoc32_regular. If it's "no" or "guessing no", set REPLACE_MBRTOC32=1. --- ChangeLog | 9 +++++++++ m4/mbrtoc32-regular.m4 | 9 +++++++++ m4/mbrtoc32.m4 | 32 +++++++++++++++++++++++++++++++- modules/mbrtoc32-regular | 2 ++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 m4/mbrtoc32-regular.m4 diff --git a/ChangeLog b/ChangeLog index c38bc06df4..824928bc39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2026-04-29 Bruno Haible + + mbrtoc32-regular: Strengthen the configure test. + * m4/mbrtoc32-regular.m4: New file. + * modules/mbrtoc32-regular (Files): Add it. + (configure.ac): Invoke gl_FUNC_MBRTOC32_REGULAR. + * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Set gl_cv_func_mbrtoc32_regular. + If it's "no" or "guessing no", set REPLACE_MBRTOC32=1. + 2026-04-28 Bruno Haible error-h: Support multiple gnulib-tool invocations in the same package. diff --git a/m4/mbrtoc32-regular.m4 b/m4/mbrtoc32-regular.m4 new file mode 100644 index 0000000000..d14db66fab --- /dev/null +++ b/m4/mbrtoc32-regular.m4 @@ -0,0 +1,9 @@ +# mbrtoc32-regular.m4 +# serial 1 +dnl Copyright (C) 2026 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. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_MBRTOC32_REGULAR], [:]) diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4 index d1690fb4c9..926da0e6c9 100644 --- a/m4/mbrtoc32.m4 +++ b/m4/mbrtoc32.m4 @@ -1,5 +1,5 @@ # mbrtoc32.m4 -# serial 21 +# serial 22 dnl Copyright (C) 2014-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -52,6 +52,36 @@ AC_DEFUN([gl_FUNC_MBRTOC32], LOCALE_ZH_CN=none ;; esac + m4_ifdef([gl_FUNC_MBRTOC32_REGULAR], [ + dnl The package requests a regular mbrtoc32 function. + dnl glibc's mbrtoc32 function is not regular, + dnl due to the zh_HK.BIG5-HKSCS locale, see + dnl https://sourceware.org/bugzilla/show_bug.cgi?id=25734 + dnl https://sourceware.org/bugzilla/show_bug.cgi?id=30611 + AC_CACHE_CHECK([whether mbrtoc32 is regular], + [gl_cv_func_mbrtoc32_regular], + [AC_REQUIRE([AC_CANONICAL_HOST]) + gl_cv_func_mbrtoc32_regular="guessing yes" + case "$host_os" in + *-gnu* | gnu*) + AC_EGREP_CPP([Unlucky], [ + #include + #if defined __GNU_LIBRARY__ && __GLIBC__ >= 2 + Unlucky GNU user + #endif + ], + [gl_cv_func_mbrtoc32_regular="guessing no"], + []) + ;; + esac + ]) + ], [ + dnl The package does not request a regular mbrtoc32 function. + gl_cv_func_mbrtoc32_regular=irrelevant + ]) + case "$gl_cv_func_mbrtoc32_regular" in + *no) REPLACE_MBRTOC32=1 ;; + esac fi if test $HAVE_WORKING_MBRTOC32 = 0; then REPLACE_MBRTOC32=1 diff --git a/modules/mbrtoc32-regular b/modules/mbrtoc32-regular index e8ae236fc5..4e8af3d4e5 100644 --- a/modules/mbrtoc32-regular +++ b/modules/mbrtoc32-regular @@ -3,11 +3,13 @@ mbrtoc32() function that maps each multibyte character to exactly one Unicode character and thus never returns (size_t)(-3). Files: +m4/mbrtoc32-regular.m4 Depends-on: mbrtoc32 configure.ac: +gl_FUNC_MBRTOC32_REGULAR gl_MODULE_INDICATOR([mbrtoc32-regular]) Makefile.am: -- 2.47.3