Here's a proposed patch for that; it's pretty simple and if your analysis is correct it should do the trick.
Another possibility would be to remove all BSD/OS hacks in gnulib. BSD/OS hasn't been supported since 2004, according to Wikipedia, and perhaps it's time we retire it from gnulib. >From 6afd986a90574af557bd048f6441495fd6ccd058 Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Fri, 20 Jan 2012 17:13:45 -0800 Subject: [PATCH] stdint: port to Android by limiting use of BSD/OS cruft Proactively fix similar issues with wchar and wctype-h. stdint.h problem reported by Simon Josefsson in <http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00277.html>. * lib/stdint.in.h, lib/wchar.in.h: Include <stddef.h>, <stdio.h>, and <time.h> only on platforms that need it, to work around bugs. * lib/wctype.in.h: Include <wchar.h> only on Solaris; that way, there's no need for the <stddef.h> etc. workaround. --- ChangeLog | 11 +++++++++++ lib/stdint.in.h | 8 +++++--- lib/wchar.in.h | 9 +++++---- lib/wctype.in.h | 11 ++--------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07c8a13..df91bcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-01-20 Paul Eggert <egg...@cs.ucla.edu> + + stdint: port to Android by limiting use of BSD/OS cruft + Proactively fix similar issues with wchar and wctype-h. + stdint.h problem reported by Simon Josefsson in + <http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00277.html>. + * lib/stdint.in.h, lib/wchar.in.h: Include <stddef.h>, <stdio.h>, + and <time.h> only on platforms that need it, to work around bugs. + * lib/wctype.in.h: Include <wchar.h> only on Solaris; that way, + there's no need for the <stddef.h> etc. workaround. + 2012-01-19 Jim Meyering <meyer...@redhat.com> bootstrap: add bootstrap_post_import_hook diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 69e83dc..ae652d6 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -521,9 +521,11 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) #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> +# ifdef __bsdi__ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +# endif # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # include <wchar.h> # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 02fc143..231b109 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -62,13 +62,14 @@ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included before <wchar.h>. In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined - by <stddef.h>. - But avoid namespace pollution on glibc systems. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) + by <stddef.h>. */ +#if defined __UCLIBC__ || defined __bsdi__ # include <stddef.h> #endif -#ifndef __GLIBC__ +#if defined __osf || defined __bsdi__ # include <stdio.h> +#endif +#ifdef __bsdi__ # include <time.h> #endif diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 527d70b..51788b3 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -33,15 +33,8 @@ #endif @PRAGMA_COLUMNS@ -#if @HAVE_WINT_T@ -/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. - Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - 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> +#if @HAVE_WINT_T@ && defined __sun +/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ # include <wchar.h> #endif -- 1.7.6.5