diff --git a/ChangeLog b/ChangeLog index d8b7ff6559..6145b67156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2026-09-20 Bruno Haible + wctob: Make consistent with wcrtomb. + * m4/wctob.m4 (gl_FUNC_WCTOB): Require gl_MBRTOWC_C_LOCALE and, if + needed, set REPLACE_WCTOB. + * modules/wctob (Files): Add mbrtowc.m4. + wctob: Make thread-safe if possible. * m4/wctob.m4 (gl_PREREQ_WCTOB): Test for wcrtomb. * lib/wctob.c (wctob): Use wcrtomb instead of wctomb if possible. diff --git a/m4/wctob.m4 b/m4/wctob.m4 index 0fcb560aaf..127fd18dc5 100644 --- a/m4/wctob.m4 +++ b/m4/wctob.m4 @@ -1,5 +1,5 @@ # wctob.m4 -# serial 16 +# serial 17 dnl Copyright (C) 2008-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, @@ -91,6 +91,14 @@ int main () *yes) ;; *) REPLACE_WCTOB=1 ;; esac + dnl When we adjust mbrtowc in the C locale, we need to adjust wctob as well, + dnl for consistency. + AC_REQUIRE([gl_MBRTOWC_C_LOCALE]) + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in + *yes) ;; + *) REPLACE_WCTOB=1 + ;; + esac fi ]) diff --git a/modules/wctob b/modules/wctob index 35e6e8be0d..cfd3b898d1 100644 --- a/modules/wctob +++ b/modules/wctob @@ -4,6 +4,7 @@ wctob() function: convert wide character to unibyte character. Files: lib/wctob.c m4/wctob.m4 +m4/mbrtowc.m4 m4/locale-en.m4 m4/locale-fr.m4 m4/codeset.m4