summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Steinert <mike.steinert@gmail.com>2012-05-25 14:25:31 -0600
committerMichael Steinert <mike.steinert@gmail.com>2012-05-27 10:39:58 -0600
commitf8b02344d9607f1b8471d172a82a5e71677752c2 (patch)
treea251f83938a6bb5e0afbb38caa6492fb10152fba
parent6975333a871f976726925e8b358f22dbd92a683c (diff)
downloadrabbitmq-c-github-ask-f8b02344d9607f1b8471d172a82a5e71677752c2.tar.gz
Add checks for Unix-specific header files
Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
-rw-r--r--configure.ac3
-rw-r--r--librabbitmq/amqp-openssl.c1
-rw-r--r--librabbitmq/amqp_private.h5
-rw-r--r--librabbitmq/amqp_socket.c11
4 files changed, 15 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index cfd93ef..efad735 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,9 @@ PKG_PROG_PKG_CONFIG([0.17])
AC_CANONICAL_HOST
AC_C_BIGENDIAN
AC_C_INLINE
+AC_CHECK_HEADERS([arpa/inet.h])
+AC_CHECK_HEADERS([netdb.h])
+AC_CHECK_HEADERS([netinet/tcp.h])
# Set compiler flags
AX_TRY_CFLAGS([-Wall], [AX_CFLAGS([-Wall])])
diff --git a/librabbitmq/amqp-openssl.c b/librabbitmq/amqp-openssl.c
index d15bb6b..4e32b73 100644
--- a/librabbitmq/amqp-openssl.c
+++ b/librabbitmq/amqp-openssl.c
@@ -31,7 +31,6 @@
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <stdlib.h>
-#include <unistd.h>
struct amqp_ssl_socket_context {
BIO *bio;
diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h
index d0a5dac..20cde99 100644
--- a/librabbitmq/amqp_private.h
+++ b/librabbitmq/amqp_private.h
@@ -39,9 +39,12 @@
#include "amqp.h"
#include "amqp_framing.h"
-#include <arpa/inet.h>
#include <string.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
/* Error numbering: Because of differences in error numbering on
* different platforms, we want to keep error numbers opaque for
* client code. Internally, we encode the category of an error
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index 2025549..747ab8a 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -36,9 +36,6 @@
#include "amqp_private.h"
#include <assert.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
@@ -46,6 +43,14 @@
#include <string.h>
#include <sys/socket.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
int amqp_open_socket(char const *hostname,
int portnumber)
{