THRIFT-1320 Consistency of configure generated config.h
Patch: Alexandre Parenteau
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1165400 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Mutex.cpp b/lib/cpp/src/concurrency/Mutex.cpp
index 8d52452..0cfa0ad 100644
--- a/lib/cpp/src/concurrency/Mutex.cpp
+++ b/lib/cpp/src/concurrency/Mutex.cpp
@@ -17,11 +17,16 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "Mutex.h"
#include "Util.h"
#include <assert.h>
+#ifdef HAVE_PTHREAD_H
#include <pthread.h>
+#endif
#include <signal.h>
using boost::shared_ptr;
diff --git a/lib/cpp/src/concurrency/Util.cpp b/lib/cpp/src/concurrency/Util.cpp
index af23449..73b0c05 100644
--- a/lib/cpp/src/concurrency/Util.cpp
+++ b/lib/cpp/src/concurrency/Util.cpp
@@ -17,15 +17,15 @@
* under the License.
*/
-#include "Util.h"
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include "Util.h"
+
#if defined(HAVE_CLOCK_GETTIME)
#include <time.h>
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif // defined(HAVE_CLOCK_GETTIME)
diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h
index c6bd25e..8ef07ef 100644
--- a/lib/cpp/src/concurrency/Util.h
+++ b/lib/cpp/src/concurrency/Util.h
@@ -24,7 +24,10 @@
#include <stddef.h>
#include <stdint.h>
#include <time.h>
+
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
namespace apache { namespace thrift { namespace concurrency {