changeset 15520:8d4beb5eae92

getcwd: fix compilation on mingw64 Mingw 64 added <direct.h> as a place that declared getcwd. It is a non-standard header, but since we already include it in the replacement for <sys/stat.h>, we must also include it in the replacement for <unistd.h> to avoid compilation problems. * lib/unistd.in.h (includes) [mingw]: Include <direct.h> for getcwd. Reported by Marc-André Lureau. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Wed, 17 Aug 2011 14:13:35 -0600
parents 5b310380e54f
children 3d3ec1e46329
files ChangeLog lib/unistd.in.h
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-17  Eric Blake  <eblake@redhat.com>
 
+	getcwd: fix compilation on mingw64
+	* lib/unistd.in.h (includes) [mingw]: Include <direct.h> for
+	getcwd.
+	Reported by Marc-André Lureau.
+
 	pipe2: silence compiler warning
 	* lib/pipe2.c (pipe2): Hide label if it is not used.
 
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -85,7 +85,8 @@
 /* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
 #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-# include <io.h>
+# include <io.h>     /* mingw32, mingw64 */
+# include <direct.h> /* mingw64 */
 #endif
 
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.