Improve support for MSVC 9.
authorBruno Haible <bruno@clisp.org>
Sun, 15 Jan 2012 16:35:55 +0000 (17:35 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 15 Jan 2012 16:50:27 +0000 (17:50 +0100)
* lib/unistd.in.h: Include <io.h> when needed to avoid redefinition
clashes on MSVC.
* lib/fcntl.in.h: Likewise.
* lib/stdlib.in.h: Likewise.
* lib/sys_stat.in.h: Likewise.

ChangeLog
lib/fcntl.in.h
lib/stdlib.in.h
lib/sys_stat.in.h
lib/unistd.in.h

index 8b82eed..1e296b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-15  Bruno Haible  <bruno@clisp.org>
+
+       Improve support for MSVC 9.
+       * lib/unistd.in.h: Include <io.h> when needed to avoid redefinition
+       clashes on MSVC.
+       * lib/fcntl.in.h: Likewise.
+       * lib/stdlib.in.h: Likewise.
+       * lib/sys_stat.in.h: Likewise.
+
 2011-01-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        gnupload: we hold the master copy of this script now
index 84ae3ee..344bbe4 100644 (file)
 # include <unistd.h>
 #endif
 
+/* Native Windows platforms declare open(), creat() in <io.h>.  */
+#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+    && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
index c25ce0e..e92a614 100644 (file)
 # include <sys/loadavg.h>
 #endif
 
+/* Native Windows platforms declare mktemp() in <io.h>.  */
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #if @GNULIB_RANDOM_R@
 
 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
index 045cb18..005ad2d 100644 (file)
 # include <direct.h> /* mingw64, MSVC 9 */
 #endif
 
+/* Native Windows platforms declare umask() in <io.h>.  */
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #ifndef S_IFIFO
 # ifdef _S_IFIFO
 #  define S_IFIFO _S_IFIFO
index c579cd4..811a67b 100644 (file)
 #endif
 
 /* Native Windows platforms declare chdir, getcwd, rmdir in
-   <io.h> and/or <direct.h>, not in <unistd.h>.  */
+   <io.h> and/or <direct.h>, not in <unistd.h>.
+   They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
+   lseek(), read(), unlink(), write() in <io.h>.  */
 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
       || defined GNULIB_POSIXCHECK) \
      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
 # include <io.h>     /* mingw32, mingw64 */
 # include <direct.h> /* mingw64, MSVC 9 */
+#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
+       || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
+       || defined GNULIB_POSIXCHECK) \
+      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
 #endif
 
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.