Try harder to get WCHAR_MIN and WCHAR_MAX.
authorBruno Haible <bruno@clisp.org>
Mon, 26 Jun 2006 17:27:53 +0000 (17:27 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 26 Jun 2006 17:27:53 +0000 (17:27 +0000)
ChangeLog
lib/ChangeLog
lib/stdint_.h
m4/ChangeLog
m4/stdint.m4
modules/stdint

index e58645ef6687f5e6222565fbc6701146541c41b6..dccbc8733b7afd125102b94a2d45e5ef64c72d2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-06-26  Bruno Haible  <bruno@clisp.org>
+
+       * modules/stdint (Makefile.am): Also substitute HAVE_WCHAR_H.
+
 2006-06-23  Simon Josefsson  <jas@extundo.com>
             Bruno Haible  <bruno@clisp.org>
 
index 0602728ec4014feeff339dd7d769b1e42fa74992..809b26e1e5d8673982ab46e17cac940d235fffe7 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-26  Bruno Haible  <bruno@clisp.org>
+
+       * stdlib_.h: Include <wchar.h> if necessary for WCHAR_MIN or
+       WCHAR_MAX.
+       Reported by Mark D. Baushke and Larry Jones.
+
 2006-06-26  Bruno Haible  <bruno@clisp.org>
 
        * stdlib_.h: Don't include <stdint.h> when using the SGI C compiler
index 73d4f7df53c9544d66072ed8701425549beb8e63..09e7862ebf42ca991f6c8ee634511532ef4fb241 100644 (file)
 
 /* Get wchar_t, WCHAR_MIN, WCHAR_MAX.  */
 #include <stddef.h>
+/* Some systems define WCHAR_MIN, WCHAR_MAX in <wchar.h>, not <stddef.h>.  */
+#if !(defined(WCHAR_MIN) && defined(WCHAR_MAX)) && @HAVE_WCHAR_H@
+# include <wchar.h>
+#endif
+
 /* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
 #include <limits.h>
 
index 10f1facaa40b38b766304cc8c8f23da437c9e442..05a3739f4b33410f88034092f72ea23308b5852e 100644 (file)
@@ -1,3 +1,7 @@
+2006-06-26  Bruno Haible  <bruno@clisp.org>
+
+       * stdint.m4 (gl_STDINT_H): Test also for <wchar.h>.
+
 2006-06-26  Bruno Haible  <bruno@clisp.org>
 
        * stdint.m4 (gl_STDINT_H): Don't include <stdint.h> when using the
index 67aea94d5d84a3d7048840332683b2a88ec0c7cd..bbc7e5741af251568b18f4144e57b5efea5334bb 100644 (file)
@@ -9,6 +9,15 @@ dnl Test whether <stdint.h> is supported or must be substituted.
 
 AC_DEFUN([gl_STDINT_H],
 [
+  dnl Check for <wchar.h>.
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  if test $ac_cv_header_wchar_h = yes; then
+    HAVE_WCHAR_H=1
+  else
+    HAVE_WCHAR_H=0
+  fi
+  AC_SUBST([HAVE_WCHAR_H])
+
   dnl Check for <stdint.h> that doesn't clash with <sys/types.h>.
   gl_HEADER_STDINT_H
   if test $gl_cv_header_stdint_h = yes; then
@@ -279,7 +288,7 @@ msvc compiler
     gl_STDINT_MISSING_BOUNDS2([SIG_ATOMIC_MIN SIG_ATOMIC_MAX],
       [#include <signal.h>])
     dnl Don't bother defining WCHAR_MIN and WCHAR_MAX, since they should
-    dnl already be defined in <stddef.h>.
+    dnl already be defined in <stddef.h> or <wchar.h>.
     dnl For wint_t we need <wchar.h>.
     dnl Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included
     dnl before <wchar.h>.
index e50bb2b761e38e64f71174ac1f5ed3da6a36944a..03dee34163e47c9410db2840bfbd3f11496465b6 100644 (file)
@@ -22,7 +22,8 @@ EXTRA_DIST += stdint_.h
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
 stdint.h: stdint_.h
-       sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+       sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+           -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
            -e 's|@''FULL_PATH_STDINT_H''@|$(FULL_PATH_STDINT_H)|g' \
            -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
            -e 's|@''FULL_PATH_INTTYPES_H''@|$(FULL_PATH_INTTYPES_H)|g' \