GNU file utilities
[gnulib.git] / lib / savedir.c
index d89adc0..b831c1f 100644 (file)
 
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
 
+#ifdef HAVE_CONFIG_H
+#if defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+   (which it would do because it found this file in $srcdir).  */
+#include <config.h>
+#else
+#include "config.h"
+#endif
+#endif
+
 #include <sys/types.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#if defined(DIRENT) || defined(_POSIX_VERSION)
+#ifdef DIRENT
 #include <dirent.h>
 #define NLENGTH(direct) (strlen((direct)->d_name))
-#else /* not (DIRENT or _POSIX_VERSION) */
+#else /* not DIRENT */
 #define dirent direct
 #define NLENGTH(direct) ((direct)->d_namlen)
 #ifdef SYSNDIR
@@ -38,7 +49,7 @@
 #ifdef NDIR
 #include <ndir.h>
 #endif /* NDIR */
-#endif /* DIRENT or _POSIX_VERSION */
+#endif /* DIRENT */
 
 #ifdef VOID_CLOSEDIR
 /* Fake a return value. */