aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m4118
-rw-r--r--ares/acinclude.m4159
-rw-r--r--ares/configure.ac208
-rw-r--r--configure.ac29
4 files changed, 444 insertions, 70 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 66cbdae45..47aada309 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -9,7 +9,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
],[
int dummy=2*WINVER;
@@ -39,7 +41,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#include <winsock.h>
],[
@@ -68,7 +72,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#include <winsock2.h>
],[
@@ -97,7 +103,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -134,7 +142,9 @@ AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
AC_LANG_PROGRAM([
#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
@@ -170,10 +180,18 @@ AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
[type to use in place of socklen_t if not defined])
fi
],[
+#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -210,18 +228,16 @@ AC_DEFUN([CURL_FUNC_GETNAMEINFO_ARGTYPES], [
AC_LANG_PROGRAM([
#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
-#if defined(__MINGW32__) && ( (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) )
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -272,6 +288,8 @@ AC_DEFUN([CURL_FUNC_GETNAMEINFO_ARGTYPES], [
])
+dnl CURL_CHECK_NONBLOCKING_SOCKET
+dnl -------------------------------------------------
dnl Check for how to set a socket to non-blocking state. There seems to exist
dnl four known different ways, with the one used almost everywhere being POSIX
dnl and XPG3, while the other different ways for different systems (old BSD,
@@ -333,8 +351,21 @@ dnl FIONBIO test was also bad
dnl the code was bad, try a different program now, test 3
AC_TRY_COMPILE([
-/* headers for ioctlsocket test (cygwin?) */
+/* headers for ioctlsocket test (Windows) */
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#endif
],[
/* ioctlsocket source code */
int socket;
@@ -396,6 +427,9 @@ dnl end of non-blocking try-compile test
fi
])
+
+dnl TYPE_SOCKADDR_STORAGE
+dnl -------------------------------------------------
dnl Check for struct sockaddr_storage. Most IPv6-enabled hosts have it, but
dnl AIX 4.3 is one known exception.
AC_DEFUN([TYPE_SOCKADDR_STORAGE],
@@ -404,6 +438,16 @@ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
[if struct sockaddr_storage is defined]), ,
[
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -416,14 +460,13 @@ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
#endif
])
-
])
+dnl TYPE_IN_ADDR_T
+dnl -------------------------------------------------
dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
dnl and a few other things.
AC_DEFUN([TYPE_IN_ADDR_T],
@@ -435,15 +478,30 @@ AC_DEFUN([TYPE_IN_ADDR_T],
curl_cv_in_addr_t_equiv=
for t in "unsigned long" int size_t unsigned long; do
AC_TRY_COMPILE([
- #ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
- #endif
- #ifdef HAVE_ARPA_INET_H
- #include <arpa/inet.h>
- #endif
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#endif
],[
$t data = inet_addr ("1.2.3.4");
],[
@@ -459,9 +517,31 @@ AC_DEFUN([TYPE_IN_ADDR_T],
AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
[type to use in place of in_addr_t if not defined])],
- [#include <sys/types.h>
+ [
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
-#include <arpa/inet.h>])
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#endif
])
dnl ************************************************************
diff --git a/ares/acinclude.m4 b/ares/acinclude.m4
index be1e4aed2..d66351ea2 100644
--- a/ares/acinclude.m4
+++ b/ares/acinclude.m4
@@ -9,7 +9,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
],[
int dummy=2*WINVER;
@@ -39,7 +41,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#include <winsock.h>
],[
@@ -68,7 +72,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#include <winsock2.h>
],[
@@ -97,7 +103,9 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -134,7 +142,9 @@ AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
AC_LANG_PROGRAM([
#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
@@ -170,10 +180,18 @@ AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
[type to use in place of socklen_t if not defined])
fi
],[
+#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -210,18 +228,16 @@ AC_DEFUN([CURL_FUNC_GETNAMEINFO_ARGTYPES], [
AC_LANG_PROGRAM([
#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
-#if defined(__MINGW32__) && ( (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) )
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -272,6 +288,8 @@ AC_DEFUN([CURL_FUNC_GETNAMEINFO_ARGTYPES], [
])
+dnl CURL_CHECK_NONBLOCKING_SOCKET
+dnl -------------------------------------------------
dnl Check for how to set a socket to non-blocking state. There seems to exist
dnl four known different ways, with the one used almost everywhere being POSIX
dnl and XPG3, while the other different ways for different systems (old BSD,
@@ -333,8 +351,21 @@ dnl FIONBIO test was also bad
dnl the code was bad, try a different program now, test 3
AC_TRY_COMPILE([
-/* headers for ioctlsocket test (cygwin?) */
+/* headers for ioctlsocket test (Windows) */
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#endif
],[
/* ioctlsocket source code */
int socket;
@@ -396,6 +427,124 @@ dnl end of non-blocking try-compile test
fi
])
+
+dnl TYPE_SOCKADDR_STORAGE
+dnl -------------------------------------------------
+dnl Check for struct sockaddr_storage. Most IPv6-enabled hosts have it, but
+dnl AIX 4.3 is one known exception.
+AC_DEFUN([TYPE_SOCKADDR_STORAGE],
+[
+ AC_CHECK_TYPE([struct sockaddr_storage],
+ AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
+ [if struct sockaddr_storage is defined]), ,
+ [
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#endif
+ ])
+])
+
+
+dnl TYPE_IN_ADDR_T
+dnl -------------------------------------------------
+dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
+dnl and a few other things.
+AC_DEFUN([TYPE_IN_ADDR_T],
+[
+ AC_CHECK_TYPE([in_addr_t], ,[
+ AC_MSG_CHECKING([for in_addr_t equivalent])
+ AC_CACHE_VAL([curl_cv_in_addr_t_equiv],
+ [
+ curl_cv_in_addr_t_equiv=
+ for t in "unsigned long" int size_t unsigned long; do
+ AC_TRY_COMPILE([
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#endif
+ ],[
+ $t data = inet_addr ("1.2.3.4");
+ ],[
+ curl_cv_in_addr_t_equiv="$t"
+ break
+ ])
+ done
+
+ if test "x$curl_cv_in_addr_t_equiv" = x; then
+ AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
+ fi
+ ])
+ AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
+ AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
+ [type to use in place of in_addr_t if not defined])],
+ [
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#endif
+])
+
+
dnl We create a function for detecting which compiler we use and then set as
dnl pendantic compiler options as possible for that particular compiler. The
dnl options are only used for debug-builds.
diff --git a/ares/configure.ac b/ares/configure.ac
index fe21513a5..094294253 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -1,3 +1,4 @@
+
dnl Process this file with autoconf to produce a configure script.
AC_INIT(ares_init.c)
AM_CONFIG_HEADER(config.h)
@@ -13,13 +14,15 @@ solaris*)
;;
esac
-# check for ssize_t
-AC_CHECK_TYPE(ssize_t, ,
- AC_DEFINE(ssize_t, int, [the signed version of size_t]))
-
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket)
+dnl check for cygwin stuff
+AC_LIBTOOL_WIN32_DLL
+
+dnl libtool setup
+AC_PROG_LIBTOOL
+
dnl ************************************************************
dnl Option to switch on debug options. This makes an assumption that
dnl this is built as an 'ares' subdir in the curl source tree. Subject for
@@ -38,9 +41,6 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
dnl when doing the debug stuff, use static library only
AC_DISABLE_SHARED
- dnl Checks for standard header files, to make memdebug.h inclusions bettter
- AC_HEADER_STDC
-
dnl the entire --enable-debug is a hack that lives and runs on top of
dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
@@ -57,7 +57,8 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
AC_MSG_RESULT(no)
)
-AC_PROG_LIBTOOL
+dnl Checks for header files.
+AC_HEADER_STDC
dnl **********************************************************************
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
@@ -83,11 +84,19 @@ AC_CHECK_HEADERS(
net/if.h \
arpa/nameser.h \
arpa/nameser_compat.h \
- arpa/inet.h, , ,
+ arpa/inet.h,
+dnl to do if not found
+[],
+dnl to do if found
+[],
+dnl default includes
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
dnl We do this default-include simply to make sure that the nameser_compat.h
dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
dnl (and others?) is not designed to allow this.
@@ -99,28 +108,72 @@ dnl *Sigh* these are needed in order for net/if.h to get properly detected.
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
#endif
]
+)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+AC_CHECK_SIZEOF(curl_off_t, ,[
+#include <stdio.h>
+#include "$srcdir/include/curl/curl.h"
+])
+AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(time_t)
+
+AC_CHECK_TYPE(long long,
+ [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
+ longlong="yes"
+)
+
+if test "xyes" = "x$longlong"; then
+ AC_MSG_CHECKING([if numberLL works])
+ AC_COMPILE_IFELSE([long long val = 1000LL;],
+ [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no)
)
+fi
+
+
+# check for ssize_t
+AC_CHECK_TYPE(ssize_t, ,
+ AC_DEFINE(ssize_t, int, [the signed version of size_t]))
# Check for socklen_t or equivalent
CURL_CHECK_TYPE_SOCKLEN_T
+TYPE_IN_ADDR_T
+
+TYPE_SOCKADDR_STORAGE
+
+
dnl check for AF_INET6
CARES_CHECK_CONSTANT(
[
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
#endif
-
], [PF_INET6],
AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
)
@@ -128,16 +181,23 @@ CARES_CHECK_CONSTANT(
dnl check for PF_INET6
CARES_CHECK_CONSTANT(
[
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
#endif
-
], [AF_INET6],
AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
)
@@ -146,18 +206,26 @@ CARES_CHECK_CONSTANT(
dnl check for the in6_addr structure
CARES_CHECK_STRUCT(
[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
#endif
+#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#endif
], [in6_addr],
AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
)
@@ -165,18 +233,26 @@ CARES_CHECK_STRUCT(
dnl check for the sockaddr_in6 structure
CARES_CHECK_STRUCT(
[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
#endif
+#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#endif
], [sockaddr_in6],
AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
[Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
@@ -187,18 +263,26 @@ AC_CHECK_MEMBER(struct sockaddr_in6.sin6_scope_id,
[Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
, ,
[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
#endif
+#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#endif
])
dnl check for the addrinfo structure
@@ -206,15 +290,22 @@ AC_CHECK_MEMBER(struct addrinfo.ai_flags,
AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
[Define to 1 if you have struct addrinfo.]),,
[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
#endif
-#ifdef HAVE_WINSOCaK2_H
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -224,6 +315,7 @@ AC_CHECK_MEMBER(struct addrinfo.ai_flags,
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
+#endif
]
)
@@ -254,15 +346,27 @@ if test "$ac_cv_func_getnameinfo" = "no"; then
AC_TRY_LINK([
#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
+#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
+#endif
+#endif
#else
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
+#endif
],[
getnameinfo(0, 0, 0, 0, 0, 0, 0);
],[
@@ -289,9 +393,6 @@ AC_TRY_RUN(
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -321,9 +422,6 @@ AC_TRY_RUN(
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -355,9 +453,6 @@ AC_TRY_RUN(
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -379,34 +474,57 @@ fi
AC_CHECK_SIZEOF(struct in6_addr, ,
[
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#endif
+#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#endif
]
)
+
AC_CHECK_SIZEOF(struct in_addr, ,
[
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#endif
+#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#endif
]
)
diff --git a/configure.ac b/configure.ac
index 34de0bfa5..1abe464a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1579,7 +1579,22 @@ dnl For some reason, the check above doesn't properly detect select() with
dnl Msys/Mingw
if test "$ac_cv_func_select" != "yes"; then
AC_MSG_CHECKING([for select in ws2_32])
- AC_TRY_LINK([#include <winsock2.h>],
+ AC_TRY_LINK([
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#endif
+#endif
+ ],
[select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);],
[ dnl worked!
AC_MSG_RESULT([yes])
@@ -1596,15 +1611,27 @@ if test "$ac_cv_func_getnameinfo" = "no"; then
AC_TRY_LINK([
#undef inline
#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
+#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
+#endif
+#endif
#else
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
+#endif
],[
getnameinfo(0, 0, 0, 0, 0, 0, 0);
],[