Hi Albert, > Why does lib/wchar.in.h have: > #ifndef _GL_WCHAR_H > ... > #ifndef _GL_WCHAR_H > #define _GL_WCHAR_H > rather than just: > #ifndef _GL_WCHAR_H > #define _GL_WCHAR_H
This is the necessary idiom when using #include_next. > This causes a problem on HP-UX 11.00 because <wchar.h> is included more > than once. > $ ./gnulib-tool --create-testdir --dir=t arpa_inet crypto/md5 \ > environ filemode fnmatch fnmatch-gnu getdate gettext glob human \ > iconv_open inet_pton lstat mbswidth memmem mktime modechange poll \ > regex socklen strcase strftime strptime strtok_r vsnprintf \ > vsnprintf-posix wcwidth > $ cd t > $ ./configure > $ gmake > ... > cc -DHAVE_CONFIG_H -I. -I.. -I../intl -g -c -o btowc.o btowc.c > cc: "wchar.h", line 124: error 1000: Unexpected symbol: "btowc". > cc: panic 2017: Cannot recover from earlier errors, terminating. > gmake[4]: *** [btowc.o] Error 1 > > $ cd gllib > > $ cc -DHAVE_CONFIG_H -I. -I.. -I../intl -g -E btowc.c | grep wchar.h > # 1 "./wchar.h" > # 49 "./wchar.h" > # 50 "./wchar.h" > # 51 "./wchar.h" > # 1 "///usr/include/wchar.h" > # 33 "///usr/include/wchar.h" > # 1 "./wchar.h" > # 49 "./wchar.h" > # 50 "./wchar.h" > # 51 "./wchar.h" > # 1 "///usr/include/wchar.h" > # 57 "./wchar.h" > # 1 "./wchar.h" > # 42 "///usr/include/wchar.h" > # 57 "./wchar.h" I reproduce. But I needed to look at the entire preprocessed output in order to understand what happens. Fixed as follows: 2009-01-14 Bruno Haible <br...@clisp.org> * lib/stdint.in.h (_GL_JUST_INCLUDE_SYSTEM_WCHAR_H): New macro, defined while including <wchar.h>. * lib/wchar.in.h: In two particular situations on HP-UX, include only the system's <wchar.h> file. Reported by Albert Chin <bug-gnu...@mlists.thewrittenword.com>. --- lib/stdint.in.h.orig 2009-01-15 00:21:46.000000000 +0100 +++ lib/stdint.in.h 2009-01-15 00:02:16.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2008 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -478,7 +478,9 @@ 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) +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # include <wchar.h> +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H #endif #undef WCHAR_MIN #undef WCHAR_MAX --- lib/wchar.in.h.orig 2009-01-15 00:21:46.000000000 +0100 +++ lib/wchar.in.h 2009-01-15 00:20:59.000000000 +0100 @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +30,15 @@ @PRAGMA_SYSTEM_HEADER@ #endif -#ifdef __need_mbstate_t -/* Special invocation convention inside uClibc header files. */ +#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) +/* Special invocation convention: + - Inside uClibc header files. + - On HP-UX 11.00 we have a sequence of nested includes + <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, + once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> + and once directly. In both situations 'wint_t' is not yet defined, + therefore we cannot provide the function overrides; instead include only + the system's <wchar.h>. */ #...@include_next@ @NEXT_WCHAR_H@