aboutsummaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-09-15 17:14:29 +0000
committerYang Tse <yangsita@gmail.com>2008-09-15 17:14:29 +0000
commitdb80e18308e40d3ef7f0f711be2de1ae23a34242 (patch)
tree5db2acdb2d9a85db4927ddf7d1abc5f5393199ab /ares
parent3081207a4c5c63c8fa609295ff5941f33b26f1cb (diff)
include header file only when available
Diffstat (limited to 'ares')
-rw-r--r--ares/ares__get_hostent.c10
-rw-r--r--ares/ares_expand_name.c4
-rw-r--r--ares/ares_expand_string.c4
-rw-r--r--ares/ares_gethostbyaddr.c11
-rw-r--r--ares/ares_gethostbyname.c13
-rw-r--r--ares/ares_getnameinfo.c10
-rw-r--r--ares/ares_init.c14
-rw-r--r--ares/ares_mkquery.c4
-rw-r--r--ares/ares_parse_a_reply.c12
-rw-r--r--ares/ares_parse_aaaa_reply.c10
-rw-r--r--ares/ares_parse_ns_reply.c12
-rw-r--r--ares/ares_parse_ptr_reply.c8
-rw-r--r--ares/ares_query.c4
-rw-r--r--ares/ares_send.c4
14 files changed, 114 insertions, 6 deletions
diff --git a/ares/ares__get_hostent.c b/ares/ares__get_hostent.c
index cea95aed7..40dad5d56 100644
--- a/ares/ares__get_hostent.c
+++ b/ares/ares__get_hostent.c
@@ -18,11 +18,19 @@
#include "setup.h"
#if !defined(WIN32) || defined(WATT32)
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#endif
#include <stdio.h>
#include <stdlib.h>
diff --git a/ares/ares_expand_name.c b/ares/ares_expand_name.c
index 30499702a..9c05546db 100644
--- a/ares/ares_expand_name.c
+++ b/ares/ares_expand_name.c
@@ -20,8 +20,12 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_expand_string.c b/ares/ares_expand_string.c
index 0c7211ba2..5a3ae182c 100644
--- a/ares/ares_expand_string.c
+++ b/ares/ares_expand_string.c
@@ -20,9 +20,13 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
+#endif
#include <string.h>
#include <stdlib.h>
diff --git a/ares/ares_gethostbyaddr.c b/ares/ares_gethostbyaddr.c
index 7b4a733c3..1274d5acc 100644
--- a/ares/ares_gethostbyaddr.c
+++ b/ares/ares_gethostbyaddr.c
@@ -19,10 +19,21 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_gethostbyname.c b/ares/ares_gethostbyname.c
index be1f92b21..3048bb258 100644
--- a/ares/ares_gethostbyname.c
+++ b/ares/ares_gethostbyname.c
@@ -20,10 +20,21 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
diff --git a/ares/ares_getnameinfo.c b/ares/ares_getnameinfo.c
index 82cad1fde..8a6d4811e 100644
--- a/ares/ares_getnameinfo.c
+++ b/ares/ares_getnameinfo.c
@@ -19,11 +19,21 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_init.c b/ares/ares_init.c
index 406bf88f4..427ee0cc3 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -36,10 +36,22 @@
#include <sys/socket.h>
#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
+
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_mkquery.c b/ares/ares_mkquery.c
index 919ddf3a0..739e235b7 100644
--- a/ares/ares_mkquery.c
+++ b/ares/ares_mkquery.c
@@ -20,8 +20,12 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_parse_a_reply.c b/ares/ares_parse_a_reply.c
index 42c4ff7f2..85af99643 100644
--- a/ares/ares_parse_a_reply.c
+++ b/ares/ares_parse_a_reply.c
@@ -20,11 +20,21 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_parse_aaaa_reply.c b/ares/ares_parse_aaaa_reply.c
index 30706328b..812694eb2 100644
--- a/ares/ares_parse_aaaa_reply.c
+++ b/ares/ares_parse_aaaa_reply.c
@@ -20,10 +20,18 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
diff --git a/ares/ares_parse_ns_reply.c b/ares/ares_parse_ns_reply.c
index 19dd88870..e3a89abb4 100644
--- a/ares/ares_parse_ns_reply.c
+++ b/ares/ares_parse_ns_reply.c
@@ -23,11 +23,21 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_parse_ptr_reply.c b/ares/ares_parse_ptr_reply.c
index 8d3d40dd5..4905e8457 100644
--- a/ares/ares_parse_ptr_reply.c
+++ b/ares/ares_parse_ptr_reply.c
@@ -20,10 +20,18 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_query.c b/ares/ares_query.c
index 3959c0e3f..cc3b63af8 100644
--- a/ares/ares_query.c
+++ b/ares/ares_query.c
@@ -20,8 +20,12 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
diff --git a/ares/ares_send.c b/ares/ares_send.c
index 70518973a..6dc7b762b 100644
--- a/ares/ares_send.c
+++ b/ares/ares_send.c
@@ -20,8 +20,12 @@
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
+#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif