• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef HEADER_CARES_SETUP_H
2 #define HEADER_CARES_SETUP_H
3 
4 
5 /* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
6  *
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.
16  */
17 
18 /*
19  * Define WIN32 when build target is Win32 API
20  */
21 
22 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
23 #define WIN32
24 #endif
25 
26 /*
27  * Include configuration script results or hand-crafted
28  * configuration file for platforms which lack config tool.
29  */
30 
31 #ifdef HAVE_CONFIG_H
32 #include "ares_config.h"
33 #else
34 
35 #ifdef WIN32
36 #include "config-win32.h"
37 #endif
38 
39 #endif /* HAVE_CONFIG_H */
40 
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 /* ================================================================ */
49 
50 /*
51  * AIX 4.3 and newer needs _THREAD_SAFE defined to build
52  * proper reentrant code. Others may also need it.
53  */
54 
55 #ifdef NEED_THREAD_SAFE
56 #  ifndef _THREAD_SAFE
57 #    define _THREAD_SAFE
58 #  endif
59 #endif
60 
61 /*
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.
65  */
66 
67 #ifdef NEED_REENTRANT
68 #  ifndef _REENTRANT
69 #    define _REENTRANT
70 #  endif
71 #endif
72 
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 /* ================================================================ */
77 
78 /*
79  * c-ares external interface definitions are also used internally,
80  * and might also include required system header files to define them.
81  */
82 
83 #include <ares_build.h>
84 
85 /*
86  * Compile time sanity checks must also be done when building the library.
87  */
88 
89 #include <ares_rules.h>
90 
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 /* ================================================================= */
95 
96 /*
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.
105  */
106 
107 #ifdef HAVE_WINDOWS_H
108 #  ifndef WIN32_LEAN_AND_MEAN
109 #    define WIN32_LEAN_AND_MEAN
110 #  endif
111 #  include <windows.h>
112 #  ifdef HAVE_WINSOCK2_H
113 #    include <winsock2.h>
114 #    ifdef HAVE_WS2TCPIP_H
115 #       include <ws2tcpip.h>
116 #    endif
117 #  else
118 #    ifdef HAVE_WINSOCK_H
119 #      include <winsock.h>
120 #    endif
121 #  endif
122 #endif
123 
124 /*
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.
128  */
129 
130 #undef USE_WINSOCK
131 
132 #ifdef HAVE_WINSOCK2_H
133 #  define USE_WINSOCK 2
134 #else
135 #  ifdef HAVE_WINSOCK_H
136 #    define USE_WINSOCK 1
137 #  endif
138 #endif
139 
140 /*
141  * Work-arounds for systems without configure support
142  */
143 
144 #ifndef HAVE_CONFIG_H
145 
146 #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
147 #define HAVE_SYS_TIME_H
148 #endif
149 
150 #if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
151 #define HAVE_UNISTD_H 1
152 #endif
153 
154 #if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
155 #define HAVE_SYS_UIO_H
156 #endif
157 
158 #endif /* HAVE_CONFIG_H */
159 
160 #ifdef __POCC__
161 #  include <sys/types.h>
162 #  include <unistd.h>
163 #  define ESRCH 3
164 #endif
165 
166 /*
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.
170  */
171 
172 #undef PACKAGE_STRING
173 #undef PACKAGE_TARNAME
174 #undef PACKAGE_VERSION
175 #undef PACKAGE_BUGREPORT
176 #undef PACKAGE_NAME
177 #undef VERSION
178 #undef PACKAGE
179 
180 /* IPv6 compatibility */
181 #if !defined(HAVE_AF_INET6)
182 #if defined(HAVE_PF_INET6)
183 #define AF_INET6 PF_INET6
184 #else
185 #define AF_INET6 AF_MAX+1
186 #endif
187 #endif
188 
189 /*
190  * Include macros and defines that should only be processed once.
191  */
192 
193 #ifndef __SETUP_ONCE_H
194 #include "setup_once.h"
195 #endif
196 
197 #endif /* HEADER_CARES_SETUP_H */
198