bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dirent.h on MSVC


From: Bruno Haible
Subject: dirent.h on MSVC
Date: Sun, 11 Sep 2011 21:12:40 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

The MSVC compilers don't have <dirent.h> and associated functions. Here's
a preliminary patch that will at least avoid to include a non-existent
header file.


2011-09-11  Bruno Haible  <address@hidden>

        dirent: Don't assume <dirent.h> exists.
        * lib/dirent.in.h: Include <dirent.h> only if HAVE_DIRENT_H is 1.
        * m4/dirent_h.m4 (gl_DIRENT_H): Set HAVE_DIRENT_H.
        * modules/dirent (Makefile.am): Substitute HAVE_DIRENT_H.
        * doc/posix-headers/dirent.texi: Mention the MSVC problem.

--- doc/posix-headers/dirent.texi.orig  Sun Sep 11 21:07:30 2011
+++ doc/posix-headers/dirent.texi       Sun Sep 11 18:26:01 2011
@@ -14,4 +14,7 @@
 
 Portability problems not fixed by Gnulib:
 @itemize
address@hidden
+This header file is missing on some platforms:
+MSVC 9.
 @end itemize
--- lib/dirent.in.h.orig        Sun Sep 11 21:07:30 2011
+++ lib/dirent.in.h     Sun Sep 11 18:26:01 2011
@@ -22,7 +22,9 @@
 @PRAGMA_COLUMNS@
 
 /* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_DIRENT_H@
+#if @HAVE_DIRENT_H@
+# @INCLUDE_NEXT@ @NEXT_DIRENT_H@
+#endif
 
 #ifndef address@hidden@_DIRENT_H
 #define address@hidden@_DIRENT_H
--- m4/dirent_h.m4.orig Sun Sep 11 21:07:31 2011
+++ m4/dirent_h.m4      Sun Sep 11 18:26:01 2011
@@ -1,4 +1,4 @@
-# dirent_h.m4 serial 14
+# dirent_h.m4 serial 15
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,12 @@
 
   dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([dirent.h])
+  if test $ac_cv_header_dirent_h = yes; then
+    HAVE_DIRENT_H=1
+  else
+    HAVE_DIRENT_H=0
+  fi
+  AC_SUBST([HAVE_DIRENT_H])
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
--- modules/dirent.orig Sun Sep 11 21:07:31 2011
+++ modules/dirent      Sun Sep 11 21:07:01 2011
@@ -24,6 +24,7 @@
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+             -e 's|@''HAVE_DIRENT_H''@|$(HAVE_DIRENT_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \

-- 
In memoriam Georgi Markov <http://en.wikipedia.org/wiki/Georgi_Markov>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]