For PR351:
[oota-llvm.git] / lib / System / Unix / Path.cpp
index f1d6938e31f37f8e492bdd729ef8fb5056091aae..99923335c5aab2a9f289a0775fdec0da30d65637 100644 (file)
 
 #include "llvm/Config/alloca.h"
 #include "Unix.h"
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_FCNTL_H
 #include <fcntl.h>
+#endif
+#if HAVE_UTIME_H
 #include <utime.h>
-#include <dirent.h>
+#endif
+#if HAVE_TIME_H
 #include <time.h>
+#endif
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+
 
 namespace llvm {
 using namespace sys;