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/transport/TFDTransport.h b/lib/cpp/src/transport/TFDTransport.h
index 1d1a3e6..3ebad5c 100644
--- a/lib/cpp/src/transport/TFDTransport.h
+++ b/lib/cpp/src/transport/TFDTransport.h
@@ -21,7 +21,9 @@
#define _THRIFT_TRANSPORT_TFDTRANSPORT_H_ 1
#include <string>
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
#include "TTransport.h"
#include "TVirtualTransport.h"
diff --git a/lib/cpp/src/transport/TFileTransport.cpp b/lib/cpp/src/transport/TFileTransport.cpp
index 76ef5bd..c6c3155 100644
--- a/lib/cpp/src/transport/TFileTransport.cpp
+++ b/lib/cpp/src/transport/TFileTransport.cpp
@@ -24,7 +24,9 @@
#include "TFileTransport.h"
#include "TTransportUtils.h"
+#ifdef HAVE_PTHREAD_H
#include <pthread.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
@@ -32,14 +34,18 @@
#endif
#include <fcntl.h>
#include <errno.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include <cstdlib>
#include <cstring>
#include <iostream>
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
namespace apache { namespace thrift { namespace transport {
diff --git a/lib/cpp/src/transport/TSSLSocket.cpp b/lib/cpp/src/transport/TSSLSocket.cpp
index 913c258..7865be0 100755
--- a/lib/cpp/src/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/transport/TSSLSocket.cpp
@@ -17,11 +17,18 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <errno.h>
#include <string>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <boost/lexical_cast.hpp>
#include <boost/shared_array.hpp>
#include <openssl/err.h>
diff --git a/lib/cpp/src/transport/TServerSocket.cpp b/lib/cpp/src/transport/TServerSocket.cpp
index 25d33e0..82516ff 100644
--- a/lib/cpp/src/transport/TServerSocket.cpp
+++ b/lib/cpp/src/transport/TServerSocket.cpp
@@ -17,18 +17,32 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <cstring>
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
-#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#include <netinet/tcp.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
#include <fcntl.h>
#include <errno.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "TSocket.h"
#include "TServerSocket.h"
diff --git a/lib/cpp/src/transport/TSimpleFileTransport.cpp b/lib/cpp/src/transport/TSimpleFileTransport.cpp
index e58a574..b9a74aa 100644
--- a/lib/cpp/src/transport/TSimpleFileTransport.cpp
+++ b/lib/cpp/src/transport/TSimpleFileTransport.cpp
@@ -17,10 +17,15 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "TSimpleFileTransport.h"
#include <sys/types.h>
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
#include <fcntl.h>
namespace apache { namespace thrift { namespace transport {
diff --git a/lib/cpp/src/transport/TSocket.cpp b/lib/cpp/src/transport/TSocket.cpp
index b5ed829..bee9d80 100644
--- a/lib/cpp/src/transport/TSocket.cpp
+++ b/lib/cpp/src/transport/TSocket.cpp
@@ -17,17 +17,31 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
#include <cstring>
#include <sstream>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
+#endif
#include <sys/types.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#include <netinet/tcp.h>
+#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include <fcntl.h>
diff --git a/lib/cpp/src/transport/TSocket.h b/lib/cpp/src/transport/TSocket.h
index 5521491..9d07522 100644
--- a/lib/cpp/src/transport/TSocket.h
+++ b/lib/cpp/src/transport/TSocket.h
@@ -21,8 +21,13 @@
#define _THRIFT_TRANSPORT_TSOCKET_H_ 1
#include <string>
+
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
#include "TTransport.h"
#include "TVirtualTransport.h"