From 8a3ae2fd5c4fc11fafe2ba64cf29a655688f043a Mon Sep 17 00:00:00 2001 From: Jeroen Vermeulen Date: Fri, 10 Apr 2015 12:54:34 +0700 Subject: [PATCH] Portability and include fixes. Add include for srand()/rand(), and for open() etc. Include on Windows if using MinGW. Disable MeteorScorer on Windows, since it doesn't have fork() and pipe(). --- mert/Fdstream.h | 2 ++ mert/MeteorScorer.cpp | 3 ++- mert/evaluator.cpp | 1 + util/unistd.hh | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mert/Fdstream.h b/mert/Fdstream.h index 2258ef4a5..23eecc466 100644 --- a/mert/Fdstream.h +++ b/mert/Fdstream.h @@ -13,6 +13,8 @@ #include #include +#include "util/unistd.hh" + #if defined(__GLIBCXX__) || defined(__GLIBCPP__) #include diff --git a/mert/MeteorScorer.cpp b/mert/MeteorScorer.cpp index 1254ec95f..f4c7997ee 100644 --- a/mert/MeteorScorer.cpp +++ b/mert/MeteorScorer.cpp @@ -18,6 +18,7 @@ #include "ScoreStats.h" #include "Util.h" +#include "util/unistd.hh" using namespace std; @@ -25,7 +26,7 @@ namespace MosesTuning { // Meteor supported -#if defined(__GLIBCXX__) || defined(__GLIBCPP__) +#if (defined(__GLIBCXX__) || defined(__GLIBCPP__)) && !defined(_WIN32) // for clarity #define CHILD_STDIN_READ pipefds_input[0] diff --git a/mert/evaluator.cpp b/mert/evaluator.cpp index 25da9adbc..4e791fc6e 100644 --- a/mert/evaluator.cpp +++ b/mert/evaluator.cpp @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/util/unistd.hh b/util/unistd.hh index 0379c4914..f99be592a 100644 --- a/util/unistd.hh +++ b/util/unistd.hh @@ -1,7 +1,7 @@ #ifndef UTIL_UNISTD_H #define UTIL_UNISTD_H -#if defined(_WIN32) || defined(_WIN64) +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) // Windows doesn't define //