]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
mbrtoc32-regular: Strengthen the configure test. master
authorBruno Haible <bruno@clisp.org>
Wed, 29 Apr 2026 14:31:30 +0000 (16:31 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 29 Apr 2026 14:31:30 +0000 (16:31 +0200)
* 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
m4/mbrtoc32-regular.m4 [new file with mode: 0644]
m4/mbrtoc32.m4
modules/mbrtoc32-regular

index c38bc06df4fc8763ece74f1b023ecdcaab81a89f..824928bc396f744b15406962a0a38a9911d33c40 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-04-29  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        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 (file)
index 0000000..d14db66
--- /dev/null
@@ -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], [:])
index d1690fb4c998821fd54cd7326f6ce8cbd040d94e..926da0e6c9b8c3f7500ec770fb1fd9205e19e55b 100644 (file)
@@ -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 <features.h>
+                 #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
index e8ae236fc570a9d30bfde8c6e3dcb1fdf259c6cb..4e8af3d4e580ffdd6538ee53d9b7fcb71c778f31 100644 (file)
@@ -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: