Linux uClibc built without wide character support lacks <wchar.h>.
authorBruno Haible <bruno@clisp.org>
Thu, 7 Jun 2007 13:33:15 +0000 (13:33 +0000)
committerBruno Haible <bruno@clisp.org>
Thu, 7 Jun 2007 13:33:15 +0000 (13:33 +0000)
ChangeLog
doc/headers/wchar.texi
lib/wchar_.h
m4/stdint.m4
m4/wchar.m4
modules/mbfile
modules/mbiter
modules/mbuiter
modules/wchar

index ce26322c818c256d4b688e1c47c39b88a21cf719..e849664075216260afc36e66f0f0682a8fc14430 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-06-07  Bruno Haible  <bruno@clisp.org>
+
+       Work around the lack of <wchar.h> on some builds of uClibc.
+       * doc/headers/wchar.texi: Update.
+       * lib/wchar_.h: Include <wchar.h> only if it exists.
+       * m4/wchar.m4 (gl_WCHAR_H): Check for <wchar.h>. Set HAVE_WCHAR_H.
+       * m4/stdint.m4 (gl_STDINT_H): Check for <wchar.h>.
+       (gl_STDINT_TYPE_PROPERTIES): Don't try to include <wchar.h> if it
+       doesn't exist.
+       * modules/wchar (wchar.h): Substitute HAVE_WCHAR_H.
+       * modules/mbfile (Depends-on): Add wchar.
+       * modules/mbiter (Depends-on): Likewise.
+       * modules/mbuiter (Depends-on): Likewise.
+
 2007-06-06  Paul Eggert  <eggert@cs.ucla.edu>
 
        Work around problem reported by Steven M. Schweda in
index a9175b3d742df48e9170d6731e9ee5e37e14ee5b..163109f5e387663faee390c1f0e5ecafc1c6bb2b 100644 (file)
@@ -8,6 +8,9 @@ Gnulib module: wchar
 Portability problems fixed by Gnulib:
 @itemize
 @item
+This header file cannot be included on some platforms:
+Linux uClibc built without wide character support.
+@item
 This header file is not self-contained on some platforms:
 OSF/1 with Desktop Toolkit C, BSD/OS 4.0.1.
 @end itemize
index 2a71b8b35e996005a49e1149b872d21bd702a5c5..6e04ccca7f278e3e37ff85a78881e76281c0d1a7 100644 (file)
 #include <stdio.h>
 #include <time.h>
 
-/* Include the original <wchar.h>.  */
+/* Include the original <wchar.h> if it exists.
+   Some builds of uClibc lack it.  */
 /* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_INCLUDE_NEXT@
-# include_next <wchar.h>
-#else
-# include @ABSOLUTE_WCHAR_H@
+#if @HAVE_WCHAR_H@
+# if @HAVE_INCLUDE_NEXT@
+#  include_next <wchar.h>
+# else
+#  include @ABSOLUTE_WCHAR_H@
+# endif
 #endif
 
 #ifndef _GL_WCHAR_H
index d902a4163f1fa405931f694d7304d79b8fe898ea..c12311d2742057626664cea8ce55ce024fca8b3a 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 25
+# stdint.m4 serial 26
 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -222,6 +222,10 @@ struct s {
     fi
     AC_SUBST([HAVE_SYS_BITYPES_H])
 
+    dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+    dnl character support).
+    AC_CHECK_HEADERS_ONCE([wchar.h])
+
     gl_STDINT_TYPE_PROPERTIES
     STDINT_H=stdint.h
   fi
@@ -357,9 +361,11 @@ AC_DEFUN([gl_STDINT_INCLUDES],
      included before <wchar.h>.  */
   #include <stddef.h>
   #include <signal.h>
-  #include <stdio.h>
-  #include <time.h>
-  #include <wchar.h>
+  #if HAVE_WCHAR_H
+  # include <stdio.h>
+  # include <time.h>
+  # include <wchar.h>
+  #endif
 ]])
 
 dnl gl_STDINT_TYPE_PROPERTIES
index 068f22d31b4219aa129680d5979f5123104b2cbe..30377ca12d95ac116a166def7c7f65dd63fb99f8 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 1
+# wchar.m4 serial 2
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -20,6 +20,15 @@ wchar_t w;]],
   if test $gl_cv_header_wchar_h_standalone = yes; then
     WCHAR_H=
   else
+    dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+    dnl character support).
+    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])
     gl_ABSOLUTE_HEADER([wchar.h])
     ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\"
     WCHAR_H=wchar.h
index 585364f446037dfae48abea52c39b4745c7631f5..d6787b41c1b9e16d25bc7d143ce43e374e67c2a7 100644 (file)
@@ -8,6 +8,7 @@ m4/mbrtowc.m4
 
 Depends-on:
 mbchar
+wchar
 stdbool
 
 configure.ac:
index e0daf82c822f60f5a672bb1196b1ad1fc676f219..427cbe104d74012ec63dab2ea3381ebdcdf86510 100644 (file)
@@ -8,6 +8,7 @@ m4/mbrtowc.m4
 
 Depends-on:
 mbchar
+wchar
 stdbool
 
 configure.ac:
index 9c58466b1394c998b77796f33b42a65545400cd1..fbcabe3cf37f984fd3bb83817709514161f86c3b 100644 (file)
@@ -8,6 +8,7 @@ m4/mbrtowc.m4
 
 Depends-on:
 mbchar
+wchar
 stdbool
 strnlen1
 
index 7a61c8472de165efb2271c4567cefb111b87f2f0..93ebd4f7e1d790697fad84f9935759c0cabc1756 100644 (file)
@@ -21,6 +21,7 @@ wchar.h: wchar_.h
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''ABSOLUTE_WCHAR_H''@|$(ABSOLUTE_WCHAR_H)|g' \
              -e 's/@''HAVE_INCLUDE_NEXT''@/$(HAVE_INCLUDE_NEXT)/g' \
+             -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
            < $(srcdir)/wchar_.h; \
        } > $@-t
        mv $@-t $@