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 e58645e..dccbc87 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 0602728..809b26e 100644 (file)
@@ -1,5 +1,11 @@
 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
        in pre-C99 mode.
        Suggested by Mark D. Baushke and Larry Jones.
index 73d4f7d..09e7862 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 10f1fac..05a3739 100644 (file)
@@ -1,5 +1,9 @@
 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
        SGI C compiler in pre-C99 mode.
        Suggested by Mark D. Baushke and Larry Jones.
index 67aea94..bbc7e57 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 e50bb2b..03dee34 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' \