# HG changeset patch # User Eric Blake # Date 1261659703 25200 # Node ID 9bd9b7a4b42b6521b3e75994ab915a73d0f1c3a4 # Parent 8ba9831d54bf62313034cb0125b460ce21343053 build: pull in conditional headers during GNULIB_POSIXCHECK Any time we conditionally include a header in order to satisfy prerequisites of one module, we must also include that header under GNULIB_POSIXCHECK to avoid compilation errors if that module is not in use. If this is not done, then our link warning override can occur before the system's declaration, which causes a syntax error when the system header is finally included. * lib/stdio.in.h (includes): Using GNULIB_POSIXCHECK also requires definitions from any conditionally-included headers. * lib/stdlib.in.h (includes): Likewise. * lib/unistd.in.h (includes): Likewise. Signed-off-by: Eric Blake diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-12-24 Eric Blake + + build: pull in conditional headers during GNULIB_POSIXCHECK + * lib/stdio.in.h (includes): Using GNULIB_POSIXCHECK also requires + definitions from any conditionally-included headers. + * lib/stdlib.in.h (includes): Likewise. + * lib/unistd.in.h (includes): Likewise. + 2009-12-24 Bruno Haible * tests/test-argv-iter.c: Include header file being tested immediately diff --git a/lib/stdio.in.h b/lib/stdio.in.h --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -39,10 +39,11 @@ #include #include -#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \ - || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \ - || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \ - || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@)) +#if ((@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \ + || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \ + || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \ + || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@)) \ + || defined GNULIB_POSIXCHECK) /* Get off_t and ssize_t. */ # include #endif diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -39,7 +39,7 @@ #include /* Solaris declares getloadavg() in . */ -#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@ +#if (@GNULIB_GETLOADAVG@ || defined GNULIB_GETLOADAVG) && @HAVE_SYS_LOADAVG_H@ # include #endif @@ -49,7 +49,8 @@ # include #endif -#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ +#if (@GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ \ + || defined GNULIB_POSIXCHECK) # include #endif diff --git a/lib/unistd.in.h b/lib/unistd.in.h --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -35,12 +35,12 @@ /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ /* Cygwin 1.7.1 declares symlinkat in , not in . */ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ - || @GNULIB_SYMLINKAT@) + || @GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) # include #endif /* Cygwin 1.7.1 declares unlinkat in , not in . */ -#if @GNULIB_UNLINKAT@ +#if @GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK # include #endif @@ -50,13 +50,15 @@ #include /* mingw declares getcwd in , not in . */ -#if @GNULIB_GETCWD@ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) # include #endif #if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@) \ || (@GNULIB_READLINK@ && (!@HAVE_READLINK@ || @REPLACE_READLINK@)) \ - || (@GNULIB_READLINKAT@ && !@HAVE_READLINKAT@)) + || (@GNULIB_READLINKAT@ && !@HAVE_READLINKAT@) \ + || defined GNULIB_POSIXCHECK) /* Get ssize_t. */ # include #endif