6 /* Copyright (C) 2004 - 2008 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.
20 * Define WIN32 when build target is Win32 API
23 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
28 * Include configuration script results or hand-crafted
29 * configuration file for platforms which lack config tool.
37 #include "config-win32.h"
40 #endif /* HAVE_CONFIG_H */
43 * Tru64 needs _REENTRANT set for a few function prototypes and
44 * things to appear in the system header files. Unixware needs it
45 * to build proper reentrant code. Others may also need it.
55 * Include header files for windows builds before redefining anything.
56 * Use this preproessor block only to include or exclude windows.h,
57 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
58 * to any other further and independant block. Under Cygwin things work
59 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
60 * never be included when __CYGWIN__ is defined. configure script takes
61 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
62 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
66 # ifndef WIN32_LEAN_AND_MEAN
67 # define WIN32_LEAN_AND_MEAN
70 # ifdef HAVE_WINSOCK2_H
71 # include <winsock2.h>
72 # ifdef HAVE_WS2TCPIP_H
73 # include <ws2tcpip.h>
76 # ifdef HAVE_WINSOCK_H
83 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
84 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
85 * undefine USE_WINSOCK.
90 #ifdef HAVE_WINSOCK2_H
91 # define USE_WINSOCK 2
93 # ifdef HAVE_WINSOCK_H
94 # define USE_WINSOCK 1
99 * Work-arounds for systems without configure support
102 #ifndef HAVE_CONFIG_H
104 #if defined(__DJGPP__) || (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
110 #endif /* HAVE_CONFIG_H */
113 * Recent autoconf versions define these symbols in config.h. We don't
114 * want them (since they collide with the libcurl ones when we build
115 * --enable-debug) so we undef them again here.
118 #undef PACKAGE_STRING
119 #undef PACKAGE_TARNAME
120 #undef PACKAGE_VERSION
121 #undef PACKAGE_BUGREPORT
127 * Assume a few thing unless they're set by configure
130 #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
131 #define HAVE_SYS_TIME_H
134 #if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
135 #define HAVE_UNISTD_H 1
138 #if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
139 #define HAVE_SYS_UIO_H
142 #if (defined(WIN32) || defined(WATT32)) && \
143 !(defined(__MINGW32__) || defined(NETWARE) || defined(__DJGPP__))
144 /* protos for the functions we provide in windows_port.c */
145 int ares_strncasecmp(const char *s1, const char *s2, int n);
146 int ares_strcasecmp(const char *s1, const char *s2);
148 /* use this define magic to prevent us from adding symbol names to the library
149 that is a high-risk to collide with another libraries' attempts to do the
151 #define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
152 #define strcasecmp(a,b) ares_strcasecmp(a,b)
154 # if _MSC_VER >= 1400
155 # define strdup(a) _strdup(a)
160 /* IPv6 compatibility */
161 #if !defined(HAVE_AF_INET6)
162 #if defined(HAVE_PF_INET6)
163 #define AF_INET6 PF_INET6
165 #define AF_INET6 AF_MAX+1
170 * Include macros and defines that should only be processed once.
173 #ifndef __SETUP_ONCE_H
174 #include "setup_once.h"
177 #endif /* __ARES_SETUP_H */