summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-09 10:51:57 +0200
committerBruno Haible <bruno@clisp.org>2020-05-09 10:51:57 +0200
commit0026bb83b67abedfcaf765f3a62bd583611c6b56 (patch)
tree4b9a8b8df22d282f66678cb2ce3965177645d828 /m4
parent2bbe201944c2e65a49e71c6d3d3bfefb0049e899 (diff)
downloadgnulib-0026bb83b67abedfcaf765f3a62bd583611c6b56.tar.gz
uchar: Work around incorrect char16_t, char32_t types on Haiku 2020.
* lib/uchar.in.h (char16_t): Define as macro if GNULIB_OVERRIDES_CHAR16_T. (char32_t): Define as macro if GNULIB_OVERRIDES_CHAR32_T. * m4/uchar.m4 (gl_TYPE_CHAR16_T, gl_TYPE_CHAR32_T): New macros. (gl_UCHAR_H): Invoke them. (gl_UCHAR_H_DEFAULTS): Initialize GNULIB_OVERRIDES_CHAR16_T, GNULIB_OVERRIDES_CHAR32_T. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32, gl_MBRTOC32_SANITYCHECK): Require gl_TYPE_CHAR32_T and test GNULIB_OVERRIDES_CHAR32_T. * modules/uchar (Makefile.am): Substitute GNULIB_OVERRIDES_CHAR16_T, GNULIB_OVERRIDES_CHAR32_T.
Diffstat (limited to 'm4')
-rw-r--r--m4/mbrtoc32.m48
-rw-r--r--m4/uchar.m4104
2 files changed, 82 insertions, 30 deletions
diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4
index 991bbc87cb..5b5e9380e5 100644
--- a/m4/mbrtoc32.m4
+++ b/m4/mbrtoc32.m4
@@ -1,4 +1,4 @@
-# mbrtoc32.m4 serial 4
+# mbrtoc32.m4 serial 5
dnl Copyright (C) 2014-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,13 +11,14 @@ AC_DEFUN([gl_FUNC_MBRTOC32],
AC_REQUIRE([AC_TYPE_MBSTATE_T])
gl_MBSTATE_T_BROKEN
+ AC_REQUIRE([gl_TYPE_CHAR32_T])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
if test $gl_cv_func_mbrtoc32 = no; then
HAVE_MBRTOC32=0
else
- if test $REPLACE_MBSTATE_T = 1; then
+ if test $GNULIB_OVERRIDES_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then
REPLACE_MBRTOC32=1
else
gl_MBRTOC32_EMPTY_INPUT
@@ -141,11 +142,12 @@ dnl Result is HAVE_WORKING_MBRTOC32.
AC_DEFUN([gl_MBRTOC32_SANITYCHECK],
[
AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_TYPE_CHAR32_T])
AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
AC_REQUIRE([gt_LOCALE_FR])
AC_REQUIRE([gt_LOCALE_ZH_CN])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- if test $gl_cv_func_mbrtoc32 = no; then
+ if test $GNULIB_OVERRIDES_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then
HAVE_WORKING_MBRTOC32=0
else
AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc],
diff --git a/m4/uchar.m4 b/m4/uchar.m4
index 63d8b13408..0875caa36d 100644
--- a/m4/uchar.m4
+++ b/m4/uchar.m4
@@ -1,4 +1,4 @@
-# uchar.m4 serial 13
+# uchar.m4 serial 14
dnl Copyright (C) 2019-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,6 +19,9 @@ AC_DEFUN_ONCE([gl_UCHAR_H],
fi
AC_SUBST([HAVE_UCHAR_H])
+ gl_TYPE_CHAR16_T
+ gl_TYPE_CHAR32_T
+
dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'.
gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES])
if test $BITSIZEOF_WCHAR_T -lt 32; then
@@ -36,6 +39,51 @@ AC_DEFUN_ONCE([gl_UCHAR_H],
]], [c32rtomb mbrtoc32])
])
+dnl On Haiku 2020, char16_t and char32_t are incorrectly defined.
+dnl See <https://dev.haiku-os.org/ticket/15990>.
+AC_DEFUN_ONCE([gl_TYPE_CHAR16_T],
+[
+ AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+ dnl Determine whether gnulib's <uchar.h> would, if present, override char16_t.
+ AC_CACHE_CHECK([whether char16_t is correctly defined],
+ [gl_cv_type_char16_t_works],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #include <uchar.h>
+ /* For simplicity, assume that uint16_least_t is equivalent to
+ 'unsigned short'. */
+ int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1];
+ ]])
+ ],
+ [gl_cv_type_char16_t_works=yes],
+ [gl_cv_type_char16_t_works=no])
+ ])
+ if test $gl_cv_type_char16_t_works = no; then
+ GNULIB_OVERRIDES_CHAR16_T=1
+ fi
+])
+AC_DEFUN_ONCE([gl_TYPE_CHAR32_T],
+[
+ AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+ dnl Determine whether gnulib's <uchar.h> would, if present, override char32_t.
+ AC_CACHE_CHECK([whether char32_t is correctly defined],
+ [gl_cv_type_char32_t_works],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #include <uchar.h>
+ /* For simplicity, assume that uint32_least_t is equivalent to
+ 'unsigned int'. */
+ int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1];
+ ]])
+ ],
+ [gl_cv_type_char32_t_works=yes],
+ [gl_cv_type_char32_t_works=no])
+ ])
+ if test $gl_cv_type_char32_t_works = no; then
+ GNULIB_OVERRIDES_CHAR32_T=1
+ fi
+])
+
AC_DEFUN([gl_UCHAR_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -47,31 +95,33 @@ AC_DEFUN([gl_UCHAR_MODULE_INDICATOR],
AC_DEFUN([gl_UCHAR_H_DEFAULTS],
[
- GNULIB_BTOC32=0; AC_SUBST([GNULIB_BTOC32])
- GNULIB_C32ISALNUM=0; AC_SUBST([GNULIB_C32ISALNUM])
- GNULIB_C32ISALPHA=0; AC_SUBST([GNULIB_C32ISALPHA])
- GNULIB_C32ISBLANK=0; AC_SUBST([GNULIB_C32ISBLANK])
- GNULIB_C32ISCNTRL=0; AC_SUBST([GNULIB_C32ISCNTRL])
- GNULIB_C32ISDIGIT=0; AC_SUBST([GNULIB_C32ISDIGIT])
- GNULIB_C32ISGRAPH=0; AC_SUBST([GNULIB_C32ISGRAPH])
- GNULIB_C32ISLOWER=0; AC_SUBST([GNULIB_C32ISLOWER])
- GNULIB_C32ISPRINT=0; AC_SUBST([GNULIB_C32ISPRINT])
- GNULIB_C32ISPUNCT=0; AC_SUBST([GNULIB_C32ISPUNCT])
- GNULIB_C32ISSPACE=0; AC_SUBST([GNULIB_C32ISSPACE])
- GNULIB_C32ISUPPER=0; AC_SUBST([GNULIB_C32ISUPPER])
- GNULIB_C32ISXDIGIT=0; AC_SUBST([GNULIB_C32ISXDIGIT])
- GNULIB_C32RTOMB=0; AC_SUBST([GNULIB_C32RTOMB])
- GNULIB_C32SNRTOMBS=0; AC_SUBST([GNULIB_C32SNRTOMBS])
- GNULIB_C32SRTOMBS=0; AC_SUBST([GNULIB_C32SRTOMBS])
- GNULIB_C32STOMBS=0; AC_SUBST([GNULIB_C32STOMBS])
- GNULIB_C32TOB=0; AC_SUBST([GNULIB_C32TOB])
- GNULIB_MBRTOC32=0; AC_SUBST([GNULIB_MBRTOC32])
- GNULIB_MBSNRTOC32S=0; AC_SUBST([GNULIB_MBSNRTOC32S])
- GNULIB_MBSRTOC32S=0; AC_SUBST([GNULIB_MBSRTOC32S])
- GNULIB_MBSTOC32S=0; AC_SUBST([GNULIB_MBSTOC32S])
+ GNULIB_OVERRIDES_CHAR16_T=0; AC_SUBST([GNULIB_OVERRIDES_CHAR16_T])
+ GNULIB_OVERRIDES_CHAR32_T=0; AC_SUBST([GNULIB_OVERRIDES_CHAR32_T])
+ GNULIB_BTOC32=0; AC_SUBST([GNULIB_BTOC32])
+ GNULIB_C32ISALNUM=0; AC_SUBST([GNULIB_C32ISALNUM])
+ GNULIB_C32ISALPHA=0; AC_SUBST([GNULIB_C32ISALPHA])
+ GNULIB_C32ISBLANK=0; AC_SUBST([GNULIB_C32ISBLANK])
+ GNULIB_C32ISCNTRL=0; AC_SUBST([GNULIB_C32ISCNTRL])
+ GNULIB_C32ISDIGIT=0; AC_SUBST([GNULIB_C32ISDIGIT])
+ GNULIB_C32ISGRAPH=0; AC_SUBST([GNULIB_C32ISGRAPH])
+ GNULIB_C32ISLOWER=0; AC_SUBST([GNULIB_C32ISLOWER])
+ GNULIB_C32ISPRINT=0; AC_SUBST([GNULIB_C32ISPRINT])
+ GNULIB_C32ISPUNCT=0; AC_SUBST([GNULIB_C32ISPUNCT])
+ GNULIB_C32ISSPACE=0; AC_SUBST([GNULIB_C32ISSPACE])
+ GNULIB_C32ISUPPER=0; AC_SUBST([GNULIB_C32ISUPPER])
+ GNULIB_C32ISXDIGIT=0; AC_SUBST([GNULIB_C32ISXDIGIT])
+ GNULIB_C32RTOMB=0; AC_SUBST([GNULIB_C32RTOMB])
+ GNULIB_C32SNRTOMBS=0; AC_SUBST([GNULIB_C32SNRTOMBS])
+ GNULIB_C32SRTOMBS=0; AC_SUBST([GNULIB_C32SRTOMBS])
+ GNULIB_C32STOMBS=0; AC_SUBST([GNULIB_C32STOMBS])
+ GNULIB_C32TOB=0; AC_SUBST([GNULIB_C32TOB])
+ GNULIB_MBRTOC32=0; AC_SUBST([GNULIB_MBRTOC32])
+ GNULIB_MBSNRTOC32S=0; AC_SUBST([GNULIB_MBSNRTOC32S])
+ GNULIB_MBSRTOC32S=0; AC_SUBST([GNULIB_MBSRTOC32S])
+ GNULIB_MBSTOC32S=0; AC_SUBST([GNULIB_MBSTOC32S])
dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB])
- HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32])
- REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB])
- REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32])
+ HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB])
+ HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32])
+ REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB])
+ REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32])
])