diff --git a/ares/config-win32.h b/ares/config-win32.h index 5026728b4..4847507f5 100644 --- a/ares/config-win32.h +++ b/ares/config-win32.h @@ -16,6 +16,10 @@ #ifndef __CONFIG_WIN32_H #define __CONFIG_WIN32_H +#define HAVE_WINDOWS_H +#define HAVE_WINSOCK2_H +#define HAVE_WS2TCPIP_H + #if defined(__MINGW32__) #define HAVE_GETOPT_H #endif diff --git a/ares/setup.h b/ares/setup.h index 831bda460..05eb76b3d 100644 --- a/ares/setup.h +++ b/ares/setup.h @@ -22,6 +22,34 @@ #include "config-win32.h" #endif + +/* + * Include header files for windows builds before redefining anything. + * Use this preproessor block only to include or exclude windows.h, + * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs + * to any other further and independant block. + */ + +#ifdef WIN32 +# ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +# endif +#endif + + /* simple work-around for now, for systems without configure support */ #ifndef __DJGPP__ #define ssize_t int @@ -44,8 +72,6 @@ /* now typedef our socket type */ #if defined(WIN32) && !defined(WATT32) -#include -#include typedef SOCKET ares_socket_t; #define ARES_SOCKET_BAD INVALID_SOCKET #else diff --git a/lib/config-win32.h b/lib/config-win32.h index 030b82dfc..81216461d 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -205,6 +205,9 @@ /* Define if you have the header file. */ #define HAVE_TIME_H 1 +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + /* Define if you have the header file. */ #define HAVE_WINSOCK_H 1 diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h index 84c5eb8f6..ffc89d0b2 100644 --- a/lib/config-win32ce.h +++ b/lib/config-win32ce.h @@ -194,6 +194,9 @@ /* Define if you have the header file. */ #define HAVE_TIME_H 1 +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + /* Define if you have the header file. */ #define HAVE_WINSOCK_H 1 diff --git a/lib/setup.h b/lib/setup.h index 2fcc29cd8..6719aa27d 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -64,6 +64,34 @@ #include "amigaos.h" #endif + +/* + * Include header files for windows builds before redefining anything. + * Use this preproessor block only to include or exclude windows.h, + * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs + * to any other further and independant block. + */ + +#ifdef WIN32 +# ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +# endif +#endif + + #ifndef TRUE #define TRUE 1 #endif @@ -161,20 +189,6 @@ typedef unsigned char bool; #ifdef WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN /* Prevent including in */ -#endif /* WIN32_LEAN_AND_MEAN */ - -#ifdef HAVE_WINSOCK2_H -#include /* required by telnet.c */ -#endif - -#if defined(ENABLE_IPV6) || defined(USE_SSLEAY) -#if !defined(_MSC_VER) || (_MSC_VER >= 1300) -#include -#endif -#endif - #if !defined(__GNUC__) || defined(__MINGW32__) #define sclose(x) closesocket(x) diff --git a/src/config-win32.h b/src/config-win32.h index e6dde29d1..307627f27 100644 --- a/src/config-win32.h +++ b/src/config-win32.h @@ -23,6 +23,18 @@ /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define if you have the header file. */ +#define HAVE_WS2TCPIP_H 1 + /* Define if you have utime() */ #if !defined(__BORLANDC__) #define HAVE_UTIME 1 diff --git a/src/setup.h b/src/setup.h index 01823157c..4cc41dd87 100644 --- a/src/setup.h +++ b/src/setup.h @@ -60,6 +60,34 @@ #include "../lib/setup.h" #endif + +/* + * Include header files for windows builds before redefining anything. + * Use this preproessor block only to include or exclude windows.h, + * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs + * to any other further and independant block. + */ + +#ifdef WIN32 +# ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +# endif +#endif + + #include #ifdef __TANDEM