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>
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.
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
};
#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. */
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