From: Bruno Haible <bruno@clisp.org>
Date: Sat, 19 Feb 2011 07:08:54 +0000 (-0800)
Subject: stdint: Cut dependency to module 'wchar'.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a354cd888172af4869f8d0227d37906e5e99256;p=pspp

stdint: Cut dependency to module 'wchar'.

* lib/stdint.in.h: Include wchar.h only when HAVE_WCHAR_H is 1. Also
include the necessary prerequisites.
* m4/stdint.m4 (gl_STDINT_H): Test whether wchar.h exists.
* modules/stdint (Depends-on): Remove wchar.
(Makefile.am): Substitute HAVE_WCHAR_H.
This reverts part of a 2007-01-06 commit. Reported by Paul Eggert.
---

diff --git a/ChangeLog b/ChangeLog
index fad8587ff3..79688671e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-18  Bruno Haible  <bruno@clisp.org>
+
+	stdint: Cut dependency to module 'wchar'.
+	* lib/stdint.in.h: Include wchar.h only when HAVE_WCHAR_H is 1. Also
+	include the necessary prerequisites.
+	* m4/stdint.m4 (gl_STDINT_H): Test whether wchar.h exists.
+	* modules/stdint (Depends-on): Remove wchar.
+	(Makefile.am): Substitute HAVE_WCHAR_H.
+	This reverts part of a 2007-01-06 commit. Reported by Paul Eggert.
+
 2011-02-18  Eric Blake  <eblake@redhat.com>
 
 	longlong: skip, rather than fail, on cross-compilation
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index c48be52d5e..c518f3bd41 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -497,7 +497,12 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
    sequence of nested includes
    <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
    <stdint.h> and assumes its types are already defined.  */
-#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
+  /* 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>
 # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
 # include <wchar.h>
 # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index 26654c68e0..2b67952e87 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 37
+# stdint.m4 serial 38
 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,15 @@ AC_DEFUN([gl_STDINT_H],
   fi
   AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
 
+  dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
+  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 <inttypes.h>.
   dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
   if test $ac_cv_header_inttypes_h = yes; then
diff --git a/modules/stdint b/modules/stdint
index 9e5f7ad4eb..45b02d453e 100644
--- a/modules/stdint
+++ b/modules/stdint
@@ -14,7 +14,6 @@ m4/longlong.m4
 Depends-on:
 include_next
 multiarch
-wchar
 
 configure.ac:
 gl_STDINT_H
@@ -36,6 +35,7 @@ stdint.h: stdint.in.h
 	      -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
 	      -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
 	      -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
+	      -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
 	      -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
 	      -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
 	      -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \