# HG changeset patch # User Bruno Haible # Date 1181223195 0 # Node ID 4d1bebb0f82b1e6557c1f1bf367ff5870ac250cb # Parent 28ffab893f7ab9610c618dcd214d92265536366a Linux uClibc built without wide character support lacks . diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-06-07 Bruno Haible + + Work around the lack of on some builds of uClibc. + * doc/headers/wchar.texi: Update. + * lib/wchar_.h: Include only if it exists. + * m4/wchar.m4 (gl_WCHAR_H): Check for . Set HAVE_WCHAR_H. + * m4/stdint.m4 (gl_STDINT_H): Check for . + (gl_STDINT_TYPE_PROPERTIES): Don't try to include 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 Work around problem reported by Steven M. Schweda in diff --git a/doc/headers/wchar.texi b/doc/headers/wchar.texi --- a/doc/headers/wchar.texi +++ b/doc/headers/wchar.texi @@ -8,6 +8,9 @@ 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 diff --git a/lib/wchar_.h b/lib/wchar_.h --- a/lib/wchar_.h +++ b/lib/wchar_.h @@ -35,12 +35,15 @@ #include #include -/* Include the original . */ +/* Include the original if it exists. + Some builds of uClibc lack it. */ /* The include_next requires a split double-inclusion guard. */ -#if @HAVE_INCLUDE_NEXT@ -# include_next -#else -# include @ABSOLUTE_WCHAR_H@ +#if @HAVE_WCHAR_H@ +# if @HAVE_INCLUDE_NEXT@ +# include_next +# else +# include @ABSOLUTE_WCHAR_H@ +# endif #endif #ifndef _GL_WCHAR_H diff --git a/m4/stdint.m4 b/m4/stdint.m4 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -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 @@ fi AC_SUBST([HAVE_SYS_BITYPES_H]) + dnl Check for (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 @@ included before . */ #include #include - #include - #include - #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif ]]) dnl gl_STDINT_TYPE_PROPERTIES diff --git a/m4/wchar.m4 b/m4/wchar.m4 --- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -7,7 +7,7 @@ dnl Written by Eric Blake. -# wchar.m4 serial 1 +# wchar.m4 serial 2 AC_DEFUN([gl_WCHAR_H], [ @@ -20,6 +20,15 @@ if test $gl_cv_header_wchar_h_standalone = yes; then WCHAR_H= else + dnl Check for (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 diff --git a/modules/mbfile b/modules/mbfile --- a/modules/mbfile +++ b/modules/mbfile @@ -8,6 +8,7 @@ Depends-on: mbchar +wchar stdbool configure.ac: diff --git a/modules/mbiter b/modules/mbiter --- a/modules/mbiter +++ b/modules/mbiter @@ -8,6 +8,7 @@ Depends-on: mbchar +wchar stdbool configure.ac: diff --git a/modules/mbuiter b/modules/mbuiter --- a/modules/mbuiter +++ b/modules/mbuiter @@ -8,6 +8,7 @@ Depends-on: mbchar +wchar stdbool strnlen1 diff --git a/modules/wchar b/modules/wchar --- a/modules/wchar +++ b/modules/wchar @@ -21,6 +21,7 @@ { 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 $@