Index: raw_ostream.cpp
===================================================================
--- raw_ostream.cpp	(revision 55118)
+++ raw_ostream.cpp	(working copy)
@@ -11,11 +11,16 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Config/config.h"
 #include "llvm/Support/raw_ostream.h"
 #include <ostream>
-using namespace llvm;
 
-#include <fcntl.h>
+#if defined(HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+#if defined(HAVE_FCNTL_H)
+# include <fcntl.h>
+#endif
 
 #if defined(_MSC_VER)
 #include <io.h>
@@ -30,6 +35,8 @@
 #endif
 #endif
 
+using namespace llvm;
+
 // An out of line virtual method to provide a home for the class vtable.
 void raw_ostream::handle() {}
 
