Mercurial > hg > octave-shane > gnulib-hg
changeset 12476:4d9ecf602cb6
getsubopt: work around cygwin bug
On cygwin, compiling with -DGNULIB_POSIXCHECK failed because
the getsubopt link warning definition interfered with the
inclusion of the system header. The fix, as always in these
types of problems, is to ensure that system headers are
completely included before doing any overrides.
* lib/stdlib.in.h (includes): Move unistd inclusion sooner, to
avoid conflicting with system getsubopt.
* doc/posix-functions/getsubopt.texi (getsubopt): Document the
bug.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Mon, 21 Dec 2009 11:14:18 -0700 |
parents | 93deb54acc5b |
children | 72b9e03189fd |
files | ChangeLog doc/posix-functions/getsubopt.texi lib/stdlib.in.h |
diffstat | 3 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-12-22 Eric Blake <ebb9@byu.net> + getsubopt: work around cygwin bug + * lib/stdlib.in.h (includes): Move unistd inclusion sooner, to + avoid conflicting with system getsubopt. + * doc/posix-functions/getsubopt.texi (getsubopt): Document the + bug. + getopt: synchronize from glibc * lib/getopt.c (_getopt_initialize, _getopt_internal_r): Swap parameter order. Adjust all callers.
--- a/doc/posix-functions/getsubopt.texi +++ b/doc/posix-functions/getsubopt.texi @@ -9,6 +9,10 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{unistd.h} instead of +@code{stdlib.h} on some platforms: +Cygwin 1.7.1. +@item This function is missing on some platforms: mingw, BeOS. @end itemize
--- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -66,6 +66,12 @@ }; #endif +#if @GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK +/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ +/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ +# include <unistd.h> +#endif + /* The definition of GL_LINK_WARNING is copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -266,9 +272,6 @@ set. */ # define mkstemp rpl_mkstemp extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1)); -# else -/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ -# include <unistd.h> # endif #elif defined GNULIB_POSIXCHECK # undef mkstemp