build: use getenv() replacement function for systems which lack it
[platform/upstream/c-ares.git] / config-win32.h
1 #ifndef __ARES_CONFIG_WIN32_H
2 #define __ARES_CONFIG_WIN32_H
3
4
5 /* Copyright (C) 2004 - 2011 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 /*   c-ares/config-win32.h - Hand crafted config file for Windows   */
20 /* ================================================================ */
21
22 /* ---------------------------------------------------------------- */
23 /*                          HEADER FILES                            */
24 /* ---------------------------------------------------------------- */
25
26 /* Define if you have the <assert.h> header file.  */
27 #define HAVE_ASSERT_H 1
28
29 /* Define if you have the <errno.h> header file.  */
30 #define HAVE_ERRNO_H 1
31
32 /* Define if you have the <getopt.h> header file.  */
33 #if defined(__MINGW32__) || defined(__POCC__)
34 #define HAVE_GETOPT_H 1
35 #endif
36
37 /* Define if you have the <limits.h> header file.  */
38 #define HAVE_LIMITS_H 1
39
40 /* Define if you have the <process.h> header file.  */
41 #ifndef __SALFORDC__
42 #define HAVE_PROCESS_H 1
43 #endif
44
45 /* Define if you have the <signal.h> header file. */
46 #define HAVE_SIGNAL_H 1
47
48 /* Define if you have the <sys/time.h> header file */
49 /* #define HAVE_SYS_TIME_H 1 */
50
51 /* Define if you have the <time.h> header file.  */
52 #define HAVE_TIME_H 1
53
54 /* Define if you have the <unistd.h> header file.  */
55 #if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \
56     defined(__POCC__)
57 #define HAVE_UNISTD_H 1
58 #endif
59
60 /* Define if you have the <windows.h> header file.  */
61 #define HAVE_WINDOWS_H 1
62
63 /* Define if you have the <winsock.h> header file.  */
64 #define HAVE_WINSOCK_H 1
65
66 /* Define if you have the <winsock2.h> header file.  */
67 #ifndef __SALFORDC__
68 #define HAVE_WINSOCK2_H 1
69 #endif
70
71 /* Define if you have the <ws2tcpip.h> header file.  */
72 #ifndef __SALFORDC__
73 #define HAVE_WS2TCPIP_H 1
74 #endif
75
76 /* ---------------------------------------------------------------- */
77 /*                        OTHER HEADER INFO                         */
78 /* ---------------------------------------------------------------- */
79
80 /* Define if sig_atomic_t is an available typedef. */
81 #define HAVE_SIG_ATOMIC_T 1
82
83 /* Define if you have the ANSI C header files.  */
84 #define STDC_HEADERS 1
85
86 /* Define if you can safely include both <sys/time.h> and <time.h>.  */
87 /* #define TIME_WITH_SYS_TIME 1 */
88
89 /* ---------------------------------------------------------------- */
90 /*                             FUNCTIONS                            */
91 /* ---------------------------------------------------------------- */
92
93 /* Define if you have the closesocket function.  */
94 #define HAVE_CLOSESOCKET 1
95
96 /* Define if you have the getenv function.  */
97 #define HAVE_GETENV 1
98
99 /* Define if you have the gethostname function.  */
100 #define HAVE_GETHOSTNAME 1
101
102 /* Define if you have the ioctlsocket function. */
103 #define HAVE_IOCTLSOCKET 1
104
105 /* Define if you have a working ioctlsocket FIONBIO function. */
106 #define HAVE_IOCTLSOCKET_FIONBIO 1
107
108 /* Define if you have the strcasecmp function. */
109 /* #define HAVE_STRCASECMP 1 */
110
111 /* Define if you have the strdup function. */
112 #define HAVE_STRDUP 1
113
114 /* Define if you have the stricmp function. */
115 #define HAVE_STRICMP 1
116
117 /* Define if you have the strncasecmp function. */
118 /* #define HAVE_STRNCASECMP 1 */
119
120 /* Define if you have the strnicmp function. */
121 #define HAVE_STRNICMP 1
122
123 /* Define if you have the recv function. */
124 #define HAVE_RECV 1
125
126 /* Define to the type of arg 1 for recv. */
127 #define RECV_TYPE_ARG1 SOCKET
128
129 /* Define to the type of arg 2 for recv. */
130 #define RECV_TYPE_ARG2 char *
131
132 /* Define to the type of arg 3 for recv. */
133 #define RECV_TYPE_ARG3 int
134
135 /* Define to the type of arg 4 for recv. */
136 #define RECV_TYPE_ARG4 int
137
138 /* Define to the function return type for recv. */
139 #define RECV_TYPE_RETV int
140
141 /* Define if you have the recvfrom function. */
142 #define HAVE_RECVFROM 1
143
144 /* Define to the type of arg 1 for recvfrom. */
145 #define RECVFROM_TYPE_ARG1 SOCKET
146
147 /* Define to the type pointed by arg 2 for recvfrom. */
148 #define RECVFROM_TYPE_ARG2 char
149
150 /* Define to the type of arg 3 for recvfrom. */
151 #define RECVFROM_TYPE_ARG3 int
152
153 /* Define to the type of arg 4 for recvfrom. */
154 #define RECVFROM_TYPE_ARG4 int
155
156 /* Define to the type pointed by arg 5 for recvfrom. */
157 #define RECVFROM_TYPE_ARG5 struct sockaddr
158
159 /* Define to the type pointed by arg 6 for recvfrom. */
160 #define RECVFROM_TYPE_ARG6 int
161
162 /* Define to the function return type for recvfrom. */
163 #define RECVFROM_TYPE_RETV int
164
165 /* Define if you have the send function. */
166 #define HAVE_SEND 1
167
168 /* Define to the type of arg 1 for send. */
169 #define SEND_TYPE_ARG1 SOCKET
170
171 /* Define to the type qualifier of arg 2 for send. */
172 #define SEND_QUAL_ARG2 const
173
174 /* Define to the type of arg 2 for send. */
175 #define SEND_TYPE_ARG2 char *
176
177 /* Define to the type of arg 3 for send. */
178 #define SEND_TYPE_ARG3 int
179
180 /* Define to the type of arg 4 for send. */
181 #define SEND_TYPE_ARG4 int
182
183 /* Define to the function return type for send. */
184 #define SEND_TYPE_RETV int
185
186 /* Specifics for the Watt-32 tcp/ip stack */
187 #ifdef WATT32
188   #define SOCKET              int
189   #define NS_INADDRSZ         4
190   #define HAVE_ARPA_NAMESER_H 1
191   #define HAVE_ARPA_INET_H    1
192   #define HAVE_NETDB_H        1
193   #define HAVE_NETINET_IN_H   1
194   #define HAVE_SYS_SOCKET_H   1
195   #define HAVE_NETINET_TCP_H  1
196   #define HAVE_AF_INET6       1
197   #define HAVE_PF_INET6       1
198   #define HAVE_STRUCT_IN6_ADDR     1
199   #define HAVE_STRUCT_SOCKADDR_IN6 1
200   #undef HAVE_WINSOCK_H
201   #undef HAVE_WINSOCK2_H
202   #undef HAVE_WS2TCPIP_H
203 #endif
204
205 /* ---------------------------------------------------------------- */
206 /*                       TYPEDEF REPLACEMENTS                       */
207 /* ---------------------------------------------------------------- */
208
209 /* Define this if in_addr_t is not an available 'typedefed' type */
210 #define in_addr_t unsigned long
211
212 /* Define as the return type of signal handlers (int or void).  */
213 #define RETSIGTYPE void
214
215 /* Define ssize_t if it is not an available 'typedefed' type */
216 #ifndef _SSIZE_T_DEFINED
217 #  if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
218       defined(__POCC__) || \
219       defined(__MINGW32__)
220 #  elif defined(_WIN64)
221 #    define _SSIZE_T_DEFINED
222 #    define ssize_t __int64
223 #  else
224 #    define _SSIZE_T_DEFINED
225 #    define ssize_t int
226 #  endif
227 #endif
228
229 /* ---------------------------------------------------------------- */
230 /*                            TYPE SIZES                            */
231 /* ---------------------------------------------------------------- */
232
233 /* The size of `int', as computed by sizeof. */
234 #define SIZEOF_INT 4
235
236 /* The size of `short', as computed by sizeof. */
237 #define SIZEOF_SHORT 2
238
239 /* The size of `size_t', as computed by sizeof. */
240 #if defined(_WIN64)
241 #  define SIZEOF_SIZE_T 8
242 #else
243 #  define SIZEOF_SIZE_T 4
244 #endif
245
246 /* ---------------------------------------------------------------- */
247 /*                          STRUCT RELATED                          */
248 /* ---------------------------------------------------------------- */
249
250 /* Define this if you have struct addrinfo */
251 #define HAVE_STRUCT_ADDRINFO 1
252
253 /* Define this if you have struct sockaddr_storage */
254 #ifndef __SALFORDC__
255 #define HAVE_STRUCT_SOCKADDR_STORAGE 1
256 #endif
257
258 /* Define this if you have struct timeval */
259 #define HAVE_STRUCT_TIMEVAL 1
260
261 /* ---------------------------------------------------------------- */
262 /*                        COMPILER SPECIFIC                         */
263 /* ---------------------------------------------------------------- */
264
265 /* Define to avoid VS2005 complaining about portable C functions */
266 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
267 #define _CRT_SECURE_NO_DEPRECATE 1
268 #define _CRT_NONSTDC_NO_DEPRECATE 1
269 #endif
270
271 /* Officially, Microsoft's Windows SDK versions 6.X do not support Windows
272    2000 as a supported build target. VS2008 default installations provide an
273    embedded Windows SDK v6.0A along with the claim that Windows 2000 is a
274    valid build target for VS2008. Popular belief is that binaries built using
275    Windows SDK versions 6.X and Windows 2000 as a build target are functional */
276 #if defined(_MSC_VER) && (_MSC_VER >= 1500)
277 #  define VS2008_MINIMUM_TARGET 0x0500
278 #endif
279
280 /* When no build target is specified VS2008 default build target is Windows
281    Vista, which leaves out even Winsows XP. If no build target has been given
282    for VS2008 we will target the minimum Officially supported build target,
283    which happens to be Windows XP. */
284 #if defined(_MSC_VER) && (_MSC_VER >= 1500)
285 #  define VS2008_DEFAULT_TARGET  0x0501
286 #endif
287
288 /* VS2008 default target settings and minimum build target check */
289 #if defined(_MSC_VER) && (_MSC_VER >= 1500)
290 #  ifndef _WIN32_WINNT
291 #    define _WIN32_WINNT VS2008_DEFAULT_TARGET
292 #  endif
293 #  ifndef WINVER
294 #    define WINVER VS2008_DEFAULT_TARGET
295 #  endif
296 #  if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET)
297 #    error VS2008 does not support Windows build targets prior to Windows 2000
298 #  endif
299 #endif
300
301 /* When no build target is specified Pelles C 5.00 and later default build
302    target is Windows Vista. We override default target to be Windows 2000. */
303 #if defined(__POCC__) && (__POCC__ >= 500)
304 #  ifndef _WIN32_WINNT
305 #    define _WIN32_WINNT 0x0500
306 #  endif
307 #  ifndef WINVER
308 #    define WINVER 0x0500
309 #  endif
310 #endif
311
312 /* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
313    quite convoluted, compiler dependent and even build target dependent. */
314 #if defined(HAVE_WS2TCPIP_H)
315 #  if defined(__POCC__)
316 #    define HAVE_FREEADDRINFO 1
317 #    define HAVE_GETADDRINFO  1
318 #    define HAVE_GETNAMEINFO  1
319 #  elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
320 #    define HAVE_FREEADDRINFO 1
321 #    define HAVE_GETADDRINFO  1
322 #    define HAVE_GETNAMEINFO  1
323 #  elif defined(_MSC_VER) && (_MSC_VER >= 1200)
324 #    define HAVE_FREEADDRINFO 1
325 #    define HAVE_GETADDRINFO  1
326 #    define HAVE_GETNAMEINFO  1
327 #  endif
328 #endif
329
330 #if defined(__POCC__)
331 #  ifndef _MSC_VER
332 #    error Microsoft extensions /Ze compiler option is required
333 #  endif
334 #  ifndef __POCC__OLDNAMES
335 #    error Compatibility names /Go compiler option is required
336 #  endif
337 #endif
338
339 /* ---------------------------------------------------------------- */
340 /*                         IPV6 COMPATIBILITY                       */
341 /* ---------------------------------------------------------------- */
342
343 /* Define this if you have address family AF_INET6 */
344 #ifdef HAVE_WINSOCK2_H
345 #define HAVE_AF_INET6 1
346 #endif
347
348 /* Define this if you have protocol family PF_INET6 */
349 #ifdef HAVE_WINSOCK2_H
350 #define HAVE_PF_INET6 1
351 #endif
352
353 /* Define this if you have struct in6_addr */
354 #ifdef HAVE_WS2TCPIP_H
355 #define HAVE_STRUCT_IN6_ADDR 1
356 #endif
357
358 /* Define this if you have struct sockaddr_in6 */
359 #ifdef HAVE_WS2TCPIP_H
360 #define HAVE_STRUCT_SOCKADDR_IN6 1
361 #endif
362
363 /* Define this if you have sockaddr_in6 with scopeid */
364 #ifdef HAVE_WS2TCPIP_H
365 #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
366 #endif
367
368
369 #endif  /* __ARES_CONFIG_WIN32_H */