6 /* Copyright (C) 2004 - 2009 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.
33 #include "ares_config.h"
37 #include "config-win32.h"
40 #endif /* HAVE_CONFIG_H */
42 /* ================================================================ */
43 /* Definition of preprocessor macros/symbols which modify compiler */
44 /* behaviour or generated code characteristics must be done here, */
45 /* as appropriate, before any system header file is included. It is */
46 /* also possible to have them defined in the config file included */
47 /* before this point. As a result of all this we frown inclusion of */
48 /* system header files in our config files, avoid this at any cost. */
49 /* ================================================================ */
52 * Tru64 needs _REENTRANT set for a few function prototypes and
53 * things to appear in the system header files. Unixware needs it
54 * to build proper reentrant code. Others may also need it.
63 /* ================================================================ */
64 /* If you need to include a system header file for your platform, */
65 /* please, do it beyond the point further indicated in this file. */
66 /* ================================================================ */
69 * c-ares external interface definitions are also used internally,
70 * and might also include required system header files to define them.
73 #include <ares_build.h>
76 * Compile time sanity checks must also be done when building the library.
79 #include <ares_rules.h>
81 /* ================================================================ */
82 /* No system header file shall be included in this file before this */
83 /* point. The only allowed ones are those included from curlbuild.h */
84 /* ================================================================ */
87 * Include header files for windows builds before redefining anything.
88 * Use this preproessor block only to include or exclude windows.h,
89 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
90 * to any other further and independent block. Under Cygwin things work
91 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
92 * never be included when __CYGWIN__ is defined. configure script takes
93 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
94 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
98 # ifndef WIN32_LEAN_AND_MEAN
99 # define WIN32_LEAN_AND_MEAN
101 # include <windows.h>
102 # ifdef HAVE_WINSOCK2_H
103 # include <winsock2.h>
104 # ifdef HAVE_WS2TCPIP_H
105 # include <ws2tcpip.h>
108 # ifdef HAVE_WINSOCK_H
109 # include <winsock.h>
115 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
116 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
117 * undefine USE_WINSOCK.
122 #ifdef HAVE_WINSOCK2_H
123 # define USE_WINSOCK 2
125 # ifdef HAVE_WINSOCK_H
126 # define USE_WINSOCK 1
131 * Work-arounds for systems without configure support
134 #ifndef HAVE_CONFIG_H
136 #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
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 #endif /* HAVE_CONFIG_H */
151 # include <sys/types.h>
157 * Recent autoconf versions define these symbols in ares_config.h. We don't
158 * want them (since they collide with the libcurl ones when we build
159 * --enable-debug) so we undef them again here.
162 #undef PACKAGE_STRING
163 #undef PACKAGE_TARNAME
164 #undef PACKAGE_VERSION
165 #undef PACKAGE_BUGREPORT
170 /* IPv6 compatibility */
171 #if !defined(HAVE_AF_INET6)
172 #if defined(HAVE_PF_INET6)
173 #define AF_INET6 PF_INET6
175 #define AF_INET6 AF_MAX+1
180 * Include macros and defines that should only be processed once.
183 #ifndef __SETUP_ONCE_H
184 #include "setup_once.h"
187 #endif /* __ARES_SETUP_H */