1 #ifndef HEADER_CARES_SETUP_H
2 #define HEADER_CARES_SETUP_H
5 /* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted, provided
9 * that the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of M.I.T. not be used in advertising or
12 * publicity pertaining to distribution of the software without specific,
13 * written prior permission. M.I.T. makes no representations about the
14 * suitability of this software for any purpose. It is provided "as is"
15 * without express or implied warranty.
19 * Define WIN32 when build target is Win32 API
22 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
27 * Include configuration script results or hand-crafted
28 * configuration file for platforms which lack config tool.
32 #include "ares_config.h"
36 #include "config-win32.h"
39 #endif /* HAVE_CONFIG_H */
41 /* ================================================================ */
42 /* Definition of preprocessor macros/symbols which modify compiler */
43 /* behaviour or generated code characteristics must be done here, */
44 /* as appropriate, before any system header file is included. It is */
45 /* also possible to have them defined in the config file included */
46 /* before this point. As a result of all this we frown inclusion of */
47 /* system header files in our config files, avoid this at any cost. */
48 /* ================================================================ */
51 * AIX 4.3 and newer needs _THREAD_SAFE defined to build
52 * proper reentrant code. Others may also need it.
55 #ifdef NEED_THREAD_SAFE
62 * Tru64 needs _REENTRANT set for a few function prototypes and
63 * things to appear in the system header files. Unixware needs it
64 * to build proper reentrant code. Others may also need it.
73 /* ================================================================ */
74 /* If you need to include a system header file for your platform, */
75 /* please, do it beyond the point further indicated in this file. */
76 /* ================================================================ */
79 * c-ares external interface definitions are also used internally,
80 * and might also include required system header files to define them.
83 #include <ares_build.h>
86 * Compile time sanity checks must also be done when building the library.
89 #include <ares_rules.h>
91 /* ================================================================= */
92 /* No system header file shall be included in this file before this */
93 /* point. The only allowed ones are those included from ares_build.h */
94 /* ================================================================= */
97 * Include header files for windows builds before redefining anything.
98 * Use this preproessor block only to include or exclude windows.h,
99 * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
100 * to any other further and independent block. Under Cygwin things work
101 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
102 * never be included when __CYGWIN__ is defined. configure script takes
103 * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
104 * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
107 #ifdef HAVE_WINDOWS_H
108 # ifndef WIN32_LEAN_AND_MEAN
109 # define WIN32_LEAN_AND_MEAN
111 # include <windows.h>
112 # ifdef HAVE_WINSOCK2_H
113 # include <winsock2.h>
114 # ifdef HAVE_WS2TCPIP_H
115 # include <ws2tcpip.h>
118 # ifdef HAVE_WINSOCK_H
119 # include <winsock.h>
125 * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
126 * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
127 * undefine USE_WINSOCK.
132 #ifdef HAVE_WINSOCK2_H
133 # define USE_WINSOCK 2
135 # ifdef HAVE_WINSOCK_H
136 # define USE_WINSOCK 1
141 * Work-arounds for systems without configure support
144 #ifndef HAVE_CONFIG_H
146 #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
147 #define HAVE_SYS_TIME_H
150 #if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
151 #define HAVE_UNISTD_H 1
154 #if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
155 #define HAVE_SYS_UIO_H
158 #endif /* HAVE_CONFIG_H */
161 # include <sys/types.h>
167 * Recent autoconf versions define these symbols in ares_config.h. We don't
168 * want them (since they collide with the libcurl ones when we build
169 * --enable-debug) so we undef them again here.
172 #undef PACKAGE_STRING
173 #undef PACKAGE_TARNAME
174 #undef PACKAGE_VERSION
175 #undef PACKAGE_BUGREPORT
180 /* IPv6 compatibility */
181 #if !defined(HAVE_AF_INET6)
182 #if defined(HAVE_PF_INET6)
183 #define AF_INET6 PF_INET6
185 #define AF_INET6 AF_MAX+1
190 * Include macros and defines that should only be processed once.
193 #ifndef __SETUP_ONCE_H
194 #include "setup_once.h"
197 #endif /* HEADER_CARES_SETUP_H */