6 /* Copyright (C) 2004 - 2005 by Daniel Stenberg et al
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation for any purpose and without fee is hereby granted, provided
10 * that the above copyright notice appear in all copies and that both that
11 * copyright notice and this permission notice appear in supporting
12 * documentation, and that the name of M.I.T. not be used in advertising or
13 * publicity pertaining to distribution of the software without specific,
14 * written prior permission. M.I.T. makes no representations about the
15 * suitability of this software for any purpose. It is provided "as is"
16 * without express or implied warranty.
19 #if !defined(WIN32) && defined(__WIN32__)
24 #if !defined(WIN32) && defined(_WIN32)
25 /* VS2005 on x64 fix */
30 * Include configuration script results or hand-crafted
31 * configuration file for platforms which lack config tool.
39 #include "config-win32.h"
42 #endif /* HAVE_CONFIG_H */
45 * Include header files for windows builds before redefining anything.
46 * Use this preproessor block only to include or exclude windows.h,
47 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
48 * to any other further and independant block. Under Cygwin things work
49 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
50 * never be included when __CYGWIN__ is defined. configure script takes
51 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
52 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
56 # ifndef WIN32_LEAN_AND_MEAN
57 # define WIN32_LEAN_AND_MEAN
60 # ifdef HAVE_WINSOCK2_H
61 # include <winsock2.h>
62 # ifdef HAVE_WS2TCPIP_H
63 # include <ws2tcpip.h>
66 # ifdef HAVE_WINSOCK_H
73 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
74 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
75 * undefine USE_WINSOCK.
80 #ifdef HAVE_WINSOCK2_H
81 # define USE_WINSOCK 2
83 # ifdef HAVE_WINSOCK_H
84 # define USE_WINSOCK 1
89 * Work-arounds for systems without configure support
94 #if defined(__DJGPP__) || (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
100 #ifndef HAVE_WS2TCPIP_H
101 #define socklen_t int
104 #endif /* HAVE_CONFIG_H */
107 * Recent autoconf versions define these symbols in config.h. We don't
108 * want them (since they collide with the libcurl ones when we build
109 * --enable-debug) so we undef them again here.
112 #undef PACKAGE_STRING
113 #undef PACKAGE_TARNAME
114 #undef PACKAGE_VERSION
115 #undef PACKAGE_BUGREPORT
121 * Typedef our socket type
124 #if defined(WIN32) && !defined(WATT32)
125 typedef SOCKET ares_socket_t;
126 #define ARES_SOCKET_BAD INVALID_SOCKET
128 typedef int ares_socket_t;
129 #define ARES_SOCKET_BAD -1
133 * Assume a few thing unless they're set by configure
136 #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER)
137 #define HAVE_SYS_TIME_H
140 #if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
141 #define HAVE_UNISTD_H 1
144 #if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
145 #define HAVE_SYS_UIO_H
148 #if (defined(WIN32) || defined(WATT32)) && \
149 !(defined(__MINGW32__) || defined(NETWARE) || defined(__DJGPP__))
150 /* protos for the functions we provide in windows_port.c */
151 int ares_strncasecmp(const char *s1, const char *s2, int n);
152 int ares_strcasecmp(const char *s1, const char *s2);
154 /* use this define magic to prevent us from adding symbol names to the library
155 that is a high-risk to collide with another libraries' attempts to do the
157 #define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
158 #define strcasecmp(a,b) ares_strcasecmp(a,b)
161 /* IPv6 compatibility */
162 #if !defined(HAVE_AF_INET6)
163 #if defined(HAVE_PF_INET6)
164 #define AF_INET6 PF_INET6
166 #define AF_INET6 AF_MAX+1
171 * Include macros and defines that should only be processed once.
174 #ifndef __SETUP_ONCE_H
175 #include "setup_once.h"
178 #endif /* __ARES_SETUP_H */