+2019-11-24 Bruno Haible <bruno@clisp.org>
+
+ mbrtowc: Modernize autoconf test.
+ * m4/mbrtowc.m4 (gl_MBRTOWC_INCOMPLETE_STATE): Require
+ gt_LOCALE_FR_UTF8. If a traditional Japanese locale is not available,
+ try a UTF-8 locale.
+ * doc/posix-functions/mbrtowc.texi: Update info about AIX.
+
2019-11-24 Bruno Haible <bruno@clisp.org>
Fix errors in C++ mode on mingw.
@item
This function returns @code{(size_t) -1} instead of @code{(size_t) -2}
when the input is empty:
-AIX 5.1.
+AIX 7.2.
@item
This function does not put the state into non-initial state when parsing an
incomplete multibyte character on some platforms:
-AIX 5.1.
+AIX 7.2.
@item
This function returns the total number of bytes that make up the multibyte
character, not the number of bytes that were needed to complete the multibyte
-# mbrtowc.m4 serial 32 -*- coding: utf-8 -*-
+# mbrtowc.m4 serial 33 -*- coding: utf-8 -*-
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2019 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([gt_LOCALE_JA])
+ AC_REQUIRE([gt_LOCALE_FR_UTF8])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
[gl_cv_func_mbrtowc_incomplete_state],
[gl_cv_func_mbrtowc_incomplete_state=yes],
[gl_cv_func_mbrtowc_incomplete_state=no],
[:])
+ else
+ if test $LOCALE_FR_UTF8 != none; then
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+ included before <wchar.h>. */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+int main ()
+{
+ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+ {
+ const char input[] = "B\303\274\303\237er"; /* "Büßer" */
+ mbstate_t state;
+ wchar_t wc;
+
+ memset (&state, '\0', sizeof (mbstate_t));
+ if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+ if (mbsinit (&state))
+ return 2;
+ }
+ return 0;
+}]])],
+ [gl_cv_func_mbrtowc_incomplete_state=yes],
+ [gl_cv_func_mbrtowc_incomplete_state=no],
+ [:])
+ fi
fi
])
])