]> Savannah Git Hosting - gnulib.git/commitdiff
uchar: Decide about _GL_LARGE_CHAR32_T at configure time.
authorBruno Haible <bruno@clisp.org>
Sat, 4 Jan 2020 14:53:35 +0000 (15:53 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Jan 2020 14:53:35 +0000 (15:53 +0100)
* m4/uchar.m4 (gl_UCHAR_H): Set SMALL_WCHAR_T.
* modules/uchar (Files): Add stdint.m4.
(Makefile.am): Substitute SMALL_WCHAR_T.
* lib/uchar.in.h (_GL_LARGE_CHAR32_T): Rely on SMALL_WCHAR_T.

ChangeLog
lib/uchar.in.h
m4/uchar.m4
modules/uchar

index 2a1cfa289d9cbb323be5d810a7306582a625b823..f35de0f6a282263fffc2eb9a2ab71350d2725fee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-04  Bruno Haible  <bruno@clisp.org>
+
+       uchar: Decide about _GL_LARGE_CHAR32_T at configure time.
+       * m4/uchar.m4 (gl_UCHAR_H): Set SMALL_WCHAR_T.
+       * modules/uchar (Files): Add stdint.m4.
+       (Makefile.am): Substitute SMALL_WCHAR_T.
+       * lib/uchar.in.h (_GL_LARGE_CHAR32_T): Rely on SMALL_WCHAR_T.
+
 2020-01-04  Bruno Haible  <bruno@clisp.org>
 
        Fix AC_CHECK_DECL so that it deactivates clang's built-in declarations.
index f377cb4876a970e2b0a89c50f8196094d4a4dc61..5241b2e4ff86371c893561bc9144e6f46d4709ed 100644 (file)
@@ -55,7 +55,7 @@ typedef uint_least32_t char32_t;
 #endif
 
 /* Define if a 'char32_t' can hold more characters than a 'wchar_t'.  */
-#if (defined _AIX && !defined __64BIT__) || defined _WIN32 || defined __CYGWIN__
+#if @SMALL_WCHAR_T@                    /* 32-bit AIX, Cygwin, native Windows */
 # define _GL_LARGE_CHAR32_T 1
 #endif
 
index 2fbe45f84b0fc04781bb8d8143937635450ae6be..4aebf5c0769f464e8f77f15b1036fa34471da0eb 100644 (file)
@@ -1,4 +1,4 @@
-# uchar.m4 serial 4
+# uchar.m4 serial 5
 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,16 @@ AC_DEFUN_ONCE([gl_UCHAR_H],
   fi
   AC_SUBST([HAVE_UCHAR_H])
 
+  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
+    SMALL_WCHAR_T=1
+  else
+    SMALL_WCHAR_T=0
+  fi
+  dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows.
+  AC_SUBST([SMALL_WCHAR_T])
+
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use, and which is not
   dnl guaranteed by C11.
index f3f83ae33fa8cee12d648e85186bd52fbca7e954..bd1b4e0473bcfea07a2bb890f45196db8bbf5d0b 100644 (file)
@@ -4,6 +4,7 @@ A GNU-like <uchar.h>.
 Files:
 lib/uchar.in.h
 m4/uchar.m4
+m4/stdint.m4
 
 Depends-on:
 include_next
@@ -26,6 +27,7 @@ uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H)
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_UCHAR_H''@|$(NEXT_UCHAR_H)|g' \
+             -e 's|@''SMALL_WCHAR_T''@|$(SMALL_WCHAR_T)|g' \
              -e 's/@''GNULIB_BTOC32''@/$(GNULIB_BTOC32)/g' \
              -e 's/@''GNULIB_C32TOB''@/$(GNULIB_C32TOB)/g' \
              -e 's/@''GNULIB_MBRTOC32''@/$(GNULIB_MBRTOC32)/g' \