merge with 1.8.1h
[gnulib.git] / lib / makepath.c
index 123d6ab..bb6a09c 100644 (file)
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu> and
    Jim Meyering <meyering@cs.utexas.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
+
 #ifdef __GNUC__
 #define alloca __builtin_alloca
 #else
@@ -38,17 +49,26 @@ char *alloca ();
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+
+#ifdef STAT_MACROS_BROKEN
+#ifdef S_ISDIR
+#undef S_ISDIR
+#endif
+#endif /* STAT_MACROS_BROKEN.  */
+
 #if !defined(S_ISDIR) && defined(S_IFDIR)
-#define        S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
 #endif
 
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #endif
 
-#if defined (STDC_HEADERS) || defined (HAVE_ERRNO_H)
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
-#else
+#endif
+
+#ifndef STDC_HEADERS
 extern int errno;
 #endif