]> Savannah Git Hosting - gnulib.git/commitdiff
dirent: Don't assume <dirent.h> exists.
authorBruno Haible <bruno@clisp.org>
Sun, 11 Sep 2011 19:11:58 +0000 (21:11 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 11 Sep 2011 19:11:58 +0000 (21:11 +0200)
* 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.

ChangeLog
doc/posix-headers/dirent.texi
lib/dirent.in.h
m4/dirent_h.m4
modules/dirent

index 8f5725ae6db60e9d52948d37b05d902747fdd166..f6987e2e0600545d372ca9c3fc49b8b842061d12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-11  Bruno Haible  <bruno@clisp.org>
+
+       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.
+
 2011-09-11  Bruno Haible  <bruno@clisp.org>
 
        Fix wint_t on MSVC.
index a89b2bf0bfafab808182d03fc89e024f40348fcf..84b40782951a1a5427766e75f0fcd6eb74e30617 100644 (file)
@@ -14,4 +14,7 @@ glibc 2.8 and others.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+This header file is missing on some platforms:
+MSVC 9.
 @end itemize
index ebbc425511f3dd53878d37d89ca39b5cfeaee69f..a8b3f490abaf051ca8ada6859537ea249109eb8c 100644 (file)
@@ -22,7 +22,9 @@
 @PRAGMA_COLUMNS@
 
 /* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_DIRENT_H@
+#if @HAVE_DIRENT_H@
+# @INCLUDE_NEXT@ @NEXT_DIRENT_H@
+#endif
 
 #ifndef _@GUARD_PREFIX@_DIRENT_H
 #define _@GUARD_PREFIX@_DIRENT_H
index fdc2c440d646d58f990e9aa1e07471ca3aa511b0..5ecfd8305851f65b8dc9d4934f9efaba4c647fa9 100644 (file)
@@ -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 @@ AC_DEFUN([gl_DIRENT_H],
 
   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.
index 2e4fbee17c1bf1857bfc190bf81abc92ab2504f7..0fdf94b37a95ae7ce7c4583b293e2aa2fc97962f 100644 (file)
@@ -24,6 +24,7 @@ dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
        $(AM_V_GEN)rm -f $@-t $@ && \
        { 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' \