1 | #ifndef HEADER_CURL_SETUP_H
|
---|
2 | #define HEADER_CURL_SETUP_H
|
---|
3 | /***************************************************************************
|
---|
4 | * _ _ ____ _
|
---|
5 | * Project ___| | | | _ \| |
|
---|
6 | * / __| | | | |_) | |
|
---|
7 | * | (__| |_| | _ <| |___
|
---|
8 | * \___|\___/|_| \_\_____|
|
---|
9 | *
|
---|
10 | * Copyright (C) 1998 - 2018, Daniel Stenberg, <[email protected]>, et al.
|
---|
11 | *
|
---|
12 | * This software is licensed as described in the file COPYING, which
|
---|
13 | * you should have received as part of this distribution. The terms
|
---|
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
|
---|
15 | *
|
---|
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
---|
17 | * copies of the Software, and permit persons to whom the Software is
|
---|
18 | * furnished to do so, under the terms of the COPYING file.
|
---|
19 | *
|
---|
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
---|
21 | * KIND, either express or implied.
|
---|
22 | *
|
---|
23 | ***************************************************************************/
|
---|
24 |
|
---|
25 | #if defined(BUILDING_LIBCURL) && !defined(CURL_NO_OLDIES)
|
---|
26 | #define CURL_NO_OLDIES
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * Define WIN32 when build target is Win32 API
|
---|
31 | */
|
---|
32 |
|
---|
33 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && \
|
---|
34 | !defined(__SYMBIAN32__)
|
---|
35 | #define WIN32
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #ifdef WIN32
|
---|
39 | /*
|
---|
40 | * Don't include unneeded stuff in Windows headers to avoid compiler
|
---|
41 | * warnings and macro clashes.
|
---|
42 | * Make sure to define this macro before including any Windows headers.
|
---|
43 | */
|
---|
44 | # ifndef WIN32_LEAN_AND_MEAN
|
---|
45 | # define WIN32_LEAN_AND_MEAN
|
---|
46 | # endif
|
---|
47 | # ifndef NOGDI
|
---|
48 | # define NOGDI
|
---|
49 | # endif
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * Include configuration script results or hand-crafted
|
---|
54 | * configuration file for platforms which lack config tool.
|
---|
55 | */
|
---|
56 |
|
---|
57 | #ifdef HAVE_CONFIG_H
|
---|
58 |
|
---|
59 | #include "curl_config.h"
|
---|
60 |
|
---|
61 | #else /* HAVE_CONFIG_H */
|
---|
62 |
|
---|
63 | #ifdef _WIN32_WCE
|
---|
64 | # include "config-win32ce.h"
|
---|
65 | #else
|
---|
66 | # ifdef WIN32
|
---|
67 | # include "config-win32.h"
|
---|
68 | # endif
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | #if defined(macintosh) && defined(__MRC__)
|
---|
72 | # include "config-mac.h"
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #ifdef __riscos__
|
---|
76 | # include "config-riscos.h"
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | #ifdef __AMIGA__
|
---|
80 | # include "config-amigaos.h"
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | #ifdef __SYMBIAN32__
|
---|
84 | # include "config-symbian.h"
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #ifdef __OS400__
|
---|
88 | # include "config-os400.h"
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #ifdef TPF
|
---|
92 | # include "config-tpf.h"
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | #ifdef __VXWORKS__
|
---|
96 | # include "config-vxworks.h"
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #endif /* HAVE_CONFIG_H */
|
---|
100 |
|
---|
101 | /* ================================================================ */
|
---|
102 | /* Definition of preprocessor macros/symbols which modify compiler */
|
---|
103 | /* behavior or generated code characteristics must be done here, */
|
---|
104 | /* as appropriate, before any system header file is included. It is */
|
---|
105 | /* also possible to have them defined in the config file included */
|
---|
106 | /* before this point. As a result of all this we frown inclusion of */
|
---|
107 | /* system header files in our config files, avoid this at any cost. */
|
---|
108 | /* ================================================================ */
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * AIX 4.3 and newer needs _THREAD_SAFE defined to build
|
---|
112 | * proper reentrant code. Others may also need it.
|
---|
113 | */
|
---|
114 |
|
---|
115 | #ifdef NEED_THREAD_SAFE
|
---|
116 | # ifndef _THREAD_SAFE
|
---|
117 | # define _THREAD_SAFE
|
---|
118 | # endif
|
---|
119 | #endif
|
---|
120 |
|
---|
121 | /*
|
---|
122 | * Tru64 needs _REENTRANT set for a few function prototypes and
|
---|
123 | * things to appear in the system header files. Unixware needs it
|
---|
124 | * to build proper reentrant code. Others may also need it.
|
---|
125 | */
|
---|
126 |
|
---|
127 | #ifdef NEED_REENTRANT
|
---|
128 | # ifndef _REENTRANT
|
---|
129 | # define _REENTRANT
|
---|
130 | # endif
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | /* Solaris needs this to get a POSIX-conformant getpwuid_r */
|
---|
134 | #if defined(sun) || defined(__sun)
|
---|
135 | # ifndef _POSIX_PTHREAD_SEMANTICS
|
---|
136 | # define _POSIX_PTHREAD_SEMANTICS 1
|
---|
137 | # endif
|
---|
138 | #endif
|
---|
139 |
|
---|
140 | /* ================================================================ */
|
---|
141 | /* If you need to include a system header file for your platform, */
|
---|
142 | /* please, do it beyond the point further indicated in this file. */
|
---|
143 | /* ================================================================ */
|
---|
144 |
|
---|
145 | #include <curl/curl.h>
|
---|
146 |
|
---|
147 | #define CURL_SIZEOF_CURL_OFF_T SIZEOF_CURL_OFF_T
|
---|
148 |
|
---|
149 | /*
|
---|
150 | * Disable other protocols when http is the only one desired.
|
---|
151 | */
|
---|
152 |
|
---|
153 | #ifdef HTTP_ONLY
|
---|
154 | # ifndef CURL_DISABLE_TFTP
|
---|
155 | # define CURL_DISABLE_TFTP
|
---|
156 | # endif
|
---|
157 | # ifndef CURL_DISABLE_FTP
|
---|
158 | # define CURL_DISABLE_FTP
|
---|
159 | # endif
|
---|
160 | # ifndef CURL_DISABLE_LDAP
|
---|
161 | # define CURL_DISABLE_LDAP
|
---|
162 | # endif
|
---|
163 | # ifndef CURL_DISABLE_TELNET
|
---|
164 | # define CURL_DISABLE_TELNET
|
---|
165 | # endif
|
---|
166 | # ifndef CURL_DISABLE_DICT
|
---|
167 | # define CURL_DISABLE_DICT
|
---|
168 | # endif
|
---|
169 | # ifndef CURL_DISABLE_FILE
|
---|
170 | # define CURL_DISABLE_FILE
|
---|
171 | # endif
|
---|
172 | # ifndef CURL_DISABLE_RTSP
|
---|
173 | # define CURL_DISABLE_RTSP
|
---|
174 | # endif
|
---|
175 | # ifndef CURL_DISABLE_POP3
|
---|
176 | # define CURL_DISABLE_POP3
|
---|
177 | # endif
|
---|
178 | # ifndef CURL_DISABLE_IMAP
|
---|
179 | # define CURL_DISABLE_IMAP
|
---|
180 | # endif
|
---|
181 | # ifndef CURL_DISABLE_SMTP
|
---|
182 | # define CURL_DISABLE_SMTP
|
---|
183 | # endif
|
---|
184 | # ifndef CURL_DISABLE_GOPHER
|
---|
185 | # define CURL_DISABLE_GOPHER
|
---|
186 | # endif
|
---|
187 | # ifndef CURL_DISABLE_SMB
|
---|
188 | # define CURL_DISABLE_SMB
|
---|
189 | # endif
|
---|
190 | #endif
|
---|
191 |
|
---|
192 | /*
|
---|
193 | * When http is disabled rtsp is not supported.
|
---|
194 | */
|
---|
195 |
|
---|
196 | #if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)
|
---|
197 | # define CURL_DISABLE_RTSP
|
---|
198 | #endif
|
---|
199 |
|
---|
200 | /* ================================================================ */
|
---|
201 | /* No system header file shall be included in this file before this */
|
---|
202 | /* point. The only allowed ones are those included from curl/system.h */
|
---|
203 | /* ================================================================ */
|
---|
204 |
|
---|
205 | /*
|
---|
206 | * OS/400 setup file includes some system headers.
|
---|
207 | */
|
---|
208 |
|
---|
209 | #ifdef __OS400__
|
---|
210 | # include "setup-os400.h"
|
---|
211 | #endif
|
---|
212 |
|
---|
213 | /*
|
---|
214 | * VMS setup file includes some system headers.
|
---|
215 | */
|
---|
216 |
|
---|
217 | #ifdef __VMS
|
---|
218 | # include "setup-vms.h"
|
---|
219 | #endif
|
---|
220 |
|
---|
221 | /*
|
---|
222 | * Use getaddrinfo to resolve the IPv4 address literal. If the current network
|
---|
223 | * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
|
---|
224 | * performing this task will result in a synthesized IPv6 address.
|
---|
225 | */
|
---|
226 | #ifdef __APPLE__
|
---|
227 | #define USE_RESOLVE_ON_IPS 1
|
---|
228 | #endif
|
---|
229 |
|
---|
230 | /*
|
---|
231 | * Include header files for windows builds before redefining anything.
|
---|
232 | * Use this preprocessor block only to include or exclude windows.h,
|
---|
233 | * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
|
---|
234 | * to any other further and independent block. Under Cygwin things work
|
---|
235 | * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
|
---|
236 | * never be included when __CYGWIN__ is defined. configure script takes
|
---|
237 | * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
|
---|
238 | * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
|
---|
239 | */
|
---|
240 |
|
---|
241 | #ifdef HAVE_WINDOWS_H
|
---|
242 | # if defined(UNICODE) && !defined(_UNICODE)
|
---|
243 | # define _UNICODE
|
---|
244 | # endif
|
---|
245 | # if defined(_UNICODE) && !defined(UNICODE)
|
---|
246 | # define UNICODE
|
---|
247 | # endif
|
---|
248 | # ifdef VBOX
|
---|
249 | # include <iprt/win/windows.h>
|
---|
250 | # else
|
---|
251 | # include <winerror.h>
|
---|
252 | # include <windows.h>
|
---|
253 | # endif
|
---|
254 | # ifdef HAVE_WINSOCK2_H
|
---|
255 | # ifdef VBOX
|
---|
256 | # include <iprt/win/winsock2.h>
|
---|
257 | # else
|
---|
258 | # include <winsock2.h>
|
---|
259 | # endif
|
---|
260 | # ifdef HAVE_WS2TCPIP_H
|
---|
261 | # ifdef VBOX
|
---|
262 | # include <iprt/win/ws2tcpip.h>
|
---|
263 | # else
|
---|
264 | # include <ws2tcpip.h>
|
---|
265 | # endif
|
---|
266 | # endif
|
---|
267 | # else
|
---|
268 | # ifdef HAVE_WINSOCK_H
|
---|
269 | # include <winsock.h>
|
---|
270 | # endif
|
---|
271 | # endif
|
---|
272 | # include <tchar.h>
|
---|
273 | # ifdef UNICODE
|
---|
274 | typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
|
---|
275 | # endif
|
---|
276 | #endif
|
---|
277 |
|
---|
278 | /*
|
---|
279 | * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
|
---|
280 | * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
|
---|
281 | * undefine USE_WINSOCK.
|
---|
282 | */
|
---|
283 |
|
---|
284 | #undef USE_WINSOCK
|
---|
285 |
|
---|
286 | #ifdef HAVE_WINSOCK2_H
|
---|
287 | # define USE_WINSOCK 2
|
---|
288 | #else
|
---|
289 | # ifdef HAVE_WINSOCK_H
|
---|
290 | # define USE_WINSOCK 1
|
---|
291 | # endif
|
---|
292 | #endif
|
---|
293 |
|
---|
294 | #ifdef USE_LWIPSOCK
|
---|
295 | # include <lwip/init.h>
|
---|
296 | # include <lwip/sockets.h>
|
---|
297 | # include <lwip/netdb.h>
|
---|
298 | #endif
|
---|
299 |
|
---|
300 | #ifdef HAVE_EXTRA_STRICMP_H
|
---|
301 | # include <extra/stricmp.h>
|
---|
302 | #endif
|
---|
303 |
|
---|
304 | #ifdef HAVE_EXTRA_STRDUP_H
|
---|
305 | # include <extra/strdup.h>
|
---|
306 | #endif
|
---|
307 |
|
---|
308 | #ifdef TPF
|
---|
309 | # include <strings.h> /* for bzero, strcasecmp, and strncasecmp */
|
---|
310 | # include <string.h> /* for strcpy and strlen */
|
---|
311 | # include <stdlib.h> /* for rand and srand */
|
---|
312 | # include <sys/socket.h> /* for select and ioctl*/
|
---|
313 | # include <netdb.h> /* for in_addr_t definition */
|
---|
314 | # include <tpf/sysapi.h> /* for tpf_process_signals */
|
---|
315 | /* change which select is used for libcurl */
|
---|
316 | # define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
|
---|
317 | #endif
|
---|
318 |
|
---|
319 | #ifdef __VXWORKS__
|
---|
320 | # include <sockLib.h> /* for generic BSD socket functions */
|
---|
321 | # include <ioLib.h> /* for basic I/O interface functions */
|
---|
322 | #endif
|
---|
323 |
|
---|
324 | #ifdef __AMIGA__
|
---|
325 | # ifndef __ixemul__
|
---|
326 | # include <exec/types.h>
|
---|
327 | # include <exec/execbase.h>
|
---|
328 | # include <proto/exec.h>
|
---|
329 | # include <proto/dos.h>
|
---|
330 | # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
|
---|
331 | # endif
|
---|
332 | #endif
|
---|
333 |
|
---|
334 | #include <stdio.h>
|
---|
335 | #ifdef HAVE_ASSERT_H
|
---|
336 | #include <assert.h>
|
---|
337 | #endif
|
---|
338 |
|
---|
339 | #ifdef __TANDEM /* for nsr-tandem-nsk systems */
|
---|
340 | #include <floss.h>
|
---|
341 | #endif
|
---|
342 |
|
---|
343 | #ifndef STDC_HEADERS /* no standard C headers! */
|
---|
344 | #include <curl/stdcheaders.h>
|
---|
345 | #endif
|
---|
346 |
|
---|
347 | #ifdef __POCC__
|
---|
348 | # include <sys/types.h>
|
---|
349 | # include <unistd.h>
|
---|
350 | # define sys_nerr EILSEQ
|
---|
351 | #endif
|
---|
352 |
|
---|
353 | /*
|
---|
354 | * Salford-C kludge section (mostly borrowed from wxWidgets).
|
---|
355 | */
|
---|
356 | #ifdef __SALFORDC__
|
---|
357 | #pragma suppress 353 /* Possible nested comments */
|
---|
358 | #pragma suppress 593 /* Define not used */
|
---|
359 | #pragma suppress 61 /* enum has no name */
|
---|
360 | #pragma suppress 106 /* unnamed, unused parameter */
|
---|
361 | #include <clib.h>
|
---|
362 | #endif
|
---|
363 |
|
---|
364 | /*
|
---|
365 | * Large file (>2Gb) support using WIN32 functions.
|
---|
366 | */
|
---|
367 |
|
---|
368 | #ifdef USE_WIN32_LARGE_FILES
|
---|
369 | # include <io.h>
|
---|
370 | # include <sys/types.h>
|
---|
371 | # include <sys/stat.h>
|
---|
372 | # undef lseek
|
---|
373 | # define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence)
|
---|
374 | # undef fstat
|
---|
375 | # define fstat(fdes,stp) _fstati64(fdes, stp)
|
---|
376 | # undef stat
|
---|
377 | # define stat(fname,stp) _stati64(fname, stp)
|
---|
378 | # define struct_stat struct _stati64
|
---|
379 | # define LSEEK_ERROR (__int64)-1
|
---|
380 | #endif
|
---|
381 |
|
---|
382 | /*
|
---|
383 | * Small file (<2Gb) support using WIN32 functions.
|
---|
384 | */
|
---|
385 |
|
---|
386 | #ifdef USE_WIN32_SMALL_FILES
|
---|
387 | # include <io.h>
|
---|
388 | # include <sys/types.h>
|
---|
389 | # include <sys/stat.h>
|
---|
390 | # ifndef _WIN32_WCE
|
---|
391 | # undef lseek
|
---|
392 | # define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
|
---|
393 | # define fstat(fdes,stp) _fstat(fdes, stp)
|
---|
394 | # define stat(fname,stp) _stat(fname, stp)
|
---|
395 | # define struct_stat struct _stat
|
---|
396 | # endif
|
---|
397 | # define LSEEK_ERROR (long)-1
|
---|
398 | #endif
|
---|
399 |
|
---|
400 | #ifndef struct_stat
|
---|
401 | # define struct_stat struct stat
|
---|
402 | #endif
|
---|
403 |
|
---|
404 | #ifndef LSEEK_ERROR
|
---|
405 | # define LSEEK_ERROR (off_t)-1
|
---|
406 | #endif
|
---|
407 |
|
---|
408 | #ifndef SIZEOF_TIME_T
|
---|
409 | /* assume default size of time_t to be 32 bit */
|
---|
410 | #define SIZEOF_TIME_T 4
|
---|
411 | #endif
|
---|
412 |
|
---|
413 | /*
|
---|
414 | * Default sizeof(off_t) in case it hasn't been defined in config file.
|
---|
415 | */
|
---|
416 |
|
---|
417 | #ifndef SIZEOF_OFF_T
|
---|
418 | # if defined(__VMS) && !defined(__VAX)
|
---|
419 | # if defined(_LARGEFILE)
|
---|
420 | # define SIZEOF_OFF_T 8
|
---|
421 | # endif
|
---|
422 | # elif defined(__OS400__) && defined(__ILEC400__)
|
---|
423 | # if defined(_LARGE_FILES)
|
---|
424 | # define SIZEOF_OFF_T 8
|
---|
425 | # endif
|
---|
426 | # elif defined(__MVS__) && defined(__IBMC__)
|
---|
427 | # if defined(_LP64) || defined(_LARGE_FILES)
|
---|
428 | # define SIZEOF_OFF_T 8
|
---|
429 | # endif
|
---|
430 | # elif defined(__370__) && defined(__IBMC__)
|
---|
431 | # if defined(_LP64) || defined(_LARGE_FILES)
|
---|
432 | # define SIZEOF_OFF_T 8
|
---|
433 | # endif
|
---|
434 | # endif
|
---|
435 | # ifndef SIZEOF_OFF_T
|
---|
436 | # define SIZEOF_OFF_T 4
|
---|
437 | # endif
|
---|
438 | #endif
|
---|
439 |
|
---|
440 | #if (SIZEOF_CURL_OFF_T == 4)
|
---|
441 | # define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF)
|
---|
442 | #else
|
---|
443 | /* assume CURL_SIZEOF_CURL_OFF_T == 8 */
|
---|
444 | # define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)
|
---|
445 | #endif
|
---|
446 | #define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1))
|
---|
447 |
|
---|
448 | #if (SIZEOF_TIME_T == 4)
|
---|
449 | # ifdef HAVE_TIME_T_UNSIGNED
|
---|
450 | # define TIME_T_MAX UINT_MAX
|
---|
451 | # define TIME_T_MIN 0
|
---|
452 | # else
|
---|
453 | # define TIME_T_MAX INT_MAX
|
---|
454 | # define TIME_T_MIN INT_MIN
|
---|
455 | # endif
|
---|
456 | #else
|
---|
457 | # ifdef HAVE_TIME_T_UNSIGNED
|
---|
458 | # define TIME_T_MAX 0xFFFFFFFFFFFFFFFF
|
---|
459 | # define TIME_T_MIN 0
|
---|
460 | # else
|
---|
461 | # define TIME_T_MAX 0x7FFFFFFFFFFFFFFF
|
---|
462 | # define TIME_T_MIN (-TIME_T_MAX - 1)
|
---|
463 | # endif
|
---|
464 | #endif
|
---|
465 |
|
---|
466 | #ifndef SIZE_T_MAX
|
---|
467 | /* some limits.h headers have this defined, some don't */
|
---|
468 | #if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
|
---|
469 | #define SIZE_T_MAX 18446744073709551615U
|
---|
470 | #else
|
---|
471 | #define SIZE_T_MAX 4294967295U
|
---|
472 | #endif
|
---|
473 | #endif
|
---|
474 |
|
---|
475 | /*
|
---|
476 | * Arg 2 type for gethostname in case it hasn't been defined in config file.
|
---|
477 | */
|
---|
478 |
|
---|
479 | #ifndef GETHOSTNAME_TYPE_ARG2
|
---|
480 | # ifdef USE_WINSOCK
|
---|
481 | # define GETHOSTNAME_TYPE_ARG2 int
|
---|
482 | # else
|
---|
483 | # define GETHOSTNAME_TYPE_ARG2 size_t
|
---|
484 | # endif
|
---|
485 | #endif
|
---|
486 |
|
---|
487 | /* Below we define some functions. They should
|
---|
488 |
|
---|
489 | 4. set the SIGALRM signal timeout
|
---|
490 | 5. set dir/file naming defines
|
---|
491 | */
|
---|
492 |
|
---|
493 | #ifdef WIN32
|
---|
494 |
|
---|
495 | # define DIR_CHAR "\\"
|
---|
496 | # define DOT_CHAR "_"
|
---|
497 |
|
---|
498 | #else /* WIN32 */
|
---|
499 |
|
---|
500 | # ifdef MSDOS /* Watt-32 */
|
---|
501 |
|
---|
502 | # include <sys/ioctl.h>
|
---|
503 | # define select(n,r,w,x,t) select_s(n,r,w,x,t)
|
---|
504 | # define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
|
---|
505 | # include <tcp.h>
|
---|
506 | # ifdef word
|
---|
507 | # undef word
|
---|
508 | # endif
|
---|
509 | # ifdef byte
|
---|
510 | # undef byte
|
---|
511 | # endif
|
---|
512 |
|
---|
513 | # endif /* MSDOS */
|
---|
514 |
|
---|
515 | # ifdef __minix
|
---|
516 | /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
|
---|
517 | extern char *strtok_r(char *s, const char *delim, char **last);
|
---|
518 | extern struct tm *gmtime_r(const time_t * const timep, struct tm *tmp);
|
---|
519 | # endif
|
---|
520 |
|
---|
521 | # define DIR_CHAR "/"
|
---|
522 | # ifndef DOT_CHAR
|
---|
523 | # define DOT_CHAR "."
|
---|
524 | # endif
|
---|
525 |
|
---|
526 | # ifdef MSDOS
|
---|
527 | # undef DOT_CHAR
|
---|
528 | # define DOT_CHAR "_"
|
---|
529 | # endif
|
---|
530 |
|
---|
531 | # ifndef fileno /* sunos 4 have this as a macro! */
|
---|
532 | int fileno(FILE *stream);
|
---|
533 | # endif
|
---|
534 |
|
---|
535 | #endif /* WIN32 */
|
---|
536 |
|
---|
537 | /*
|
---|
538 | * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN
|
---|
539 | * defined in ws2tcpip.h as well as to provide IPv6 support.
|
---|
540 | * Does not apply if lwIP is used.
|
---|
541 | */
|
---|
542 |
|
---|
543 | #if defined(_MSC_VER) && !defined(__POCC__) && !defined(USE_LWIPSOCK)
|
---|
544 | # if !defined(HAVE_WS2TCPIP_H) || \
|
---|
545 | ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
|
---|
546 | # undef HAVE_GETADDRINFO_THREADSAFE
|
---|
547 | # undef HAVE_FREEADDRINFO
|
---|
548 | # undef HAVE_GETADDRINFO
|
---|
549 | # undef HAVE_GETNAMEINFO
|
---|
550 | # undef ENABLE_IPV6
|
---|
551 | # endif
|
---|
552 | #endif
|
---|
553 |
|
---|
554 | /* ---------------------------------------------------------------- */
|
---|
555 | /* resolver specialty compile-time defines */
|
---|
556 | /* CURLRES_* defines to use in the host*.c sources */
|
---|
557 | /* ---------------------------------------------------------------- */
|
---|
558 |
|
---|
559 | /*
|
---|
560 | * lcc-win32 doesn't have _beginthreadex(), lacks threads support.
|
---|
561 | */
|
---|
562 |
|
---|
563 | #if defined(__LCC__) && defined(WIN32)
|
---|
564 | # undef USE_THREADS_POSIX
|
---|
565 | # undef USE_THREADS_WIN32
|
---|
566 | #endif
|
---|
567 |
|
---|
568 | /*
|
---|
569 | * MSVC threads support requires a multi-threaded runtime library.
|
---|
570 | * _beginthreadex() is not available in single-threaded ones.
|
---|
571 | */
|
---|
572 |
|
---|
573 | #if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT)
|
---|
574 | # undef USE_THREADS_POSIX
|
---|
575 | # undef USE_THREADS_WIN32
|
---|
576 | #endif
|
---|
577 |
|
---|
578 | /*
|
---|
579 | * Mutually exclusive CURLRES_* definitions.
|
---|
580 | */
|
---|
581 |
|
---|
582 | #ifdef USE_ARES
|
---|
583 | # define CURLRES_ASYNCH
|
---|
584 | # define CURLRES_ARES
|
---|
585 | /* now undef the stock libc functions just to avoid them being used */
|
---|
586 | # undef HAVE_GETADDRINFO
|
---|
587 | # undef HAVE_FREEADDRINFO
|
---|
588 | # undef HAVE_GETHOSTBYNAME
|
---|
589 | #elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
|
---|
590 | # define CURLRES_ASYNCH
|
---|
591 | # define CURLRES_THREADED
|
---|
592 | #else
|
---|
593 | # define CURLRES_SYNCH
|
---|
594 | #endif
|
---|
595 |
|
---|
596 | #ifdef ENABLE_IPV6
|
---|
597 | # define CURLRES_IPV6
|
---|
598 | #else
|
---|
599 | # define CURLRES_IPV4
|
---|
600 | #endif
|
---|
601 |
|
---|
602 | /* ---------------------------------------------------------------- */
|
---|
603 |
|
---|
604 | /*
|
---|
605 | * When using WINSOCK, TELNET protocol requires WINSOCK2 API.
|
---|
606 | */
|
---|
607 |
|
---|
608 | #if defined(USE_WINSOCK) && (USE_WINSOCK != 2)
|
---|
609 | # define CURL_DISABLE_TELNET 1
|
---|
610 | #endif
|
---|
611 |
|
---|
612 | /*
|
---|
613 | * msvc 6.0 does not have struct sockaddr_storage and
|
---|
614 | * does not define IPPROTO_ESP in winsock2.h. But both
|
---|
615 | * are available if PSDK is properly installed.
|
---|
616 | */
|
---|
617 |
|
---|
618 | #if defined(_MSC_VER) && !defined(__POCC__)
|
---|
619 | # if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP))
|
---|
620 | # undef HAVE_STRUCT_SOCKADDR_STORAGE
|
---|
621 | # endif
|
---|
622 | #endif
|
---|
623 |
|
---|
624 | /*
|
---|
625 | * Intentionally fail to build when using msvc 6.0 without PSDK installed.
|
---|
626 | * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK
|
---|
627 | * in lib/config-win32.h although absolutely discouraged and unsupported.
|
---|
628 | */
|
---|
629 |
|
---|
630 | #if defined(_MSC_VER) && !defined(__POCC__)
|
---|
631 | # if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_))
|
---|
632 | # if !defined(ALLOW_MSVC6_WITHOUT_PSDK)
|
---|
633 | # error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. \
|
---|
634 | "Windows Server 2003 PSDK"
|
---|
635 | # else
|
---|
636 | # define CURL_DISABLE_LDAP 1
|
---|
637 | # endif
|
---|
638 | # endif
|
---|
639 | #endif
|
---|
640 |
|
---|
641 | #ifdef NETWARE
|
---|
642 | int netware_init(void);
|
---|
643 | #ifndef __NOVELL_LIBC__
|
---|
644 | #include <sys/bsdskt.h>
|
---|
645 | #include <sys/timeval.h>
|
---|
646 | #endif
|
---|
647 | #endif
|
---|
648 |
|
---|
649 | #if defined(HAVE_LIBIDN2) && defined(HAVE_IDN2_H) && !defined(USE_WIN32_IDN)
|
---|
650 | /* The lib and header are present */
|
---|
651 | #define USE_LIBIDN2
|
---|
652 | #endif
|
---|
653 |
|
---|
654 | #if defined(USE_LIBIDN2) && defined(USE_WIN32_IDN)
|
---|
655 | #error "Both libidn2 and WinIDN are enabled, choose one."
|
---|
656 | #endif
|
---|
657 |
|
---|
658 | #define LIBIDN_REQUIRED_VERSION "0.4.1"
|
---|
659 |
|
---|
660 | #if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
|
---|
661 | defined(USE_POLARSSL) || defined(USE_MBEDTLS) || \
|
---|
662 | defined(USE_CYASSL) || defined(USE_SCHANNEL) || \
|
---|
663 | defined(USE_DARWINSSL) || defined(USE_GSKIT) || defined(USE_MESALINK)
|
---|
664 | #define USE_SSL /* SSL support has been enabled */
|
---|
665 | #endif
|
---|
666 |
|
---|
667 | /* Single point where USE_SPNEGO definition might be defined */
|
---|
668 | #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
|
---|
669 | (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
|
---|
670 | #define USE_SPNEGO
|
---|
671 | #endif
|
---|
672 |
|
---|
673 | /* Single point where USE_KERBEROS5 definition might be defined */
|
---|
674 | #if !defined(CURL_DISABLE_CRYPTO_AUTH) && \
|
---|
675 | (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
|
---|
676 | #define USE_KERBEROS5
|
---|
677 | #endif
|
---|
678 |
|
---|
679 | /* Single point where USE_NTLM definition might be defined */
|
---|
680 | #if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
|
---|
681 | #if defined(USE_OPENSSL) || defined(USE_WINDOWS_SSPI) || \
|
---|
682 | defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) || \
|
---|
683 | defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
|
---|
684 | defined(USE_MBEDTLS)
|
---|
685 |
|
---|
686 | #define USE_NTLM
|
---|
687 |
|
---|
688 | # if defined(USE_MBEDTLS)
|
---|
689 | /* Get definition of MBEDTLS_MD4_C */
|
---|
690 | # include <mbedtls/md4.h>
|
---|
691 | # endif
|
---|
692 |
|
---|
693 | #endif
|
---|
694 | #endif
|
---|
695 |
|
---|
696 | #ifdef CURL_WANTS_CA_BUNDLE_ENV
|
---|
697 | #error "No longer supported. Set CURLOPT_CAINFO at runtime instead."
|
---|
698 | #endif
|
---|
699 |
|
---|
700 | /*
|
---|
701 | * Provide a mechanism to silence picky compilers, such as gcc 4.6+.
|
---|
702 | * Parameters should of course normally not be unused, but for example when
|
---|
703 | * we have multiple implementations of the same interface it may happen.
|
---|
704 | */
|
---|
705 |
|
---|
706 | #if defined(__GNUC__) && ((__GNUC__ >= 3) || \
|
---|
707 | ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
|
---|
708 | # define UNUSED_PARAM __attribute__((__unused__))
|
---|
709 | # define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
---|
710 | #else
|
---|
711 | # define UNUSED_PARAM /*NOTHING*/
|
---|
712 | # define WARN_UNUSED_RESULT
|
---|
713 | #endif
|
---|
714 |
|
---|
715 | /*
|
---|
716 | * Include macros and defines that should only be processed once.
|
---|
717 | */
|
---|
718 |
|
---|
719 | #ifndef HEADER_CURL_SETUP_ONCE_H
|
---|
720 | #include "curl_setup_once.h"
|
---|
721 | #endif
|
---|
722 |
|
---|
723 | /*
|
---|
724 | * Definition of our NOP statement Object-like macro
|
---|
725 | */
|
---|
726 |
|
---|
727 | #ifndef Curl_nop_stmt
|
---|
728 | # define Curl_nop_stmt do { } WHILE_FALSE
|
---|
729 | #endif
|
---|
730 |
|
---|
731 | /*
|
---|
732 | * Ensure that Winsock and lwIP TCP/IP stacks are not mixed.
|
---|
733 | */
|
---|
734 |
|
---|
735 | #if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
|
---|
736 | # if defined(SOCKET) || \
|
---|
737 | defined(USE_WINSOCK) || \
|
---|
738 | defined(HAVE_WINSOCK_H) || \
|
---|
739 | defined(HAVE_WINSOCK2_H) || \
|
---|
740 | defined(HAVE_WS2TCPIP_H)
|
---|
741 | # error "Winsock and lwIP TCP/IP stack definitions shall not coexist!"
|
---|
742 | # endif
|
---|
743 | #endif
|
---|
744 |
|
---|
745 | /*
|
---|
746 | * Portable symbolic names for Winsock shutdown() mode flags.
|
---|
747 | */
|
---|
748 |
|
---|
749 | #ifdef USE_WINSOCK
|
---|
750 | # define SHUT_RD 0x00
|
---|
751 | # define SHUT_WR 0x01
|
---|
752 | # define SHUT_RDWR 0x02
|
---|
753 | #endif
|
---|
754 |
|
---|
755 | /* Define S_ISREG if not defined by system headers, f.e. MSVC */
|
---|
756 | #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
---|
757 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
---|
758 | #endif
|
---|
759 |
|
---|
760 | /* Define S_ISDIR if not defined by system headers, f.e. MSVC */
|
---|
761 | #if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
|
---|
762 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
---|
763 | #endif
|
---|
764 |
|
---|
765 | /* In Windows the default file mode is text but an application can override it.
|
---|
766 | Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
|
---|
767 | */
|
---|
768 | #if defined(WIN32) || defined(MSDOS)
|
---|
769 | #define FOPEN_READTEXT "rt"
|
---|
770 | #define FOPEN_WRITETEXT "wt"
|
---|
771 | #define FOPEN_APPENDTEXT "at"
|
---|
772 | #elif defined(__CYGWIN__)
|
---|
773 | /* Cygwin has specific behavior we need to address when WIN32 is not defined.
|
---|
774 | https://cygwin.com/cygwin-ug-net/using-textbinary.html
|
---|
775 | For write we want our output to have line endings of LF and be compatible with
|
---|
776 | other Cygwin utilities. For read we want to handle input that may have line
|
---|
777 | endings either CRLF or LF so 't' is appropriate.
|
---|
778 | */
|
---|
779 | #define FOPEN_READTEXT "rt"
|
---|
780 | #define FOPEN_WRITETEXT "w"
|
---|
781 | #define FOPEN_APPENDTEXT "a"
|
---|
782 | #else
|
---|
783 | #define FOPEN_READTEXT "r"
|
---|
784 | #define FOPEN_WRITETEXT "w"
|
---|
785 | #define FOPEN_APPENDTEXT "a"
|
---|
786 | #endif
|
---|
787 |
|
---|
788 | /* WinSock destroys recv() buffer when send() failed.
|
---|
789 | * Enabled automatically for Windows and for Cygwin as Cygwin sockets are
|
---|
790 | * wrappers for WinSock sockets. https://github.com/curl/curl/issues/657
|
---|
791 | * Define DONT_USE_RECV_BEFORE_SEND_WORKAROUND to force disable workaround.
|
---|
792 | */
|
---|
793 | #if !defined(DONT_USE_RECV_BEFORE_SEND_WORKAROUND)
|
---|
794 | # if defined(WIN32) || defined(__CYGWIN__)
|
---|
795 | # define USE_RECV_BEFORE_SEND_WORKAROUND
|
---|
796 | # endif
|
---|
797 | #else /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
|
---|
798 | # ifdef USE_RECV_BEFORE_SEND_WORKAROUND
|
---|
799 | # undef USE_RECV_BEFORE_SEND_WORKAROUND
|
---|
800 | # endif
|
---|
801 | #endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
|
---|
802 |
|
---|
803 | /* Detect Windows App environment which has a restricted access
|
---|
804 | * to the Win32 APIs. */
|
---|
805 | # if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
|
---|
806 | defined(WINAPI_FAMILY)
|
---|
807 | # include <winapifamily.h>
|
---|
808 | # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
---|
809 | !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
---|
810 | # define CURL_WINDOWS_APP
|
---|
811 | # endif
|
---|
812 | # endif
|
---|
813 |
|
---|
814 | /* for systems that don't detect this in configure, use a sensible default */
|
---|
815 | #ifndef CURL_SA_FAMILY_T
|
---|
816 | #define CURL_SA_FAMILY_T unsigned short
|
---|
817 | #endif
|
---|
818 |
|
---|
819 | /* Some convenience macros to get the larger/smaller value out of two given.
|
---|
820 | We prefix with CURL to prevent name collisions. */
|
---|
821 | #define CURLMAX(x,y) ((x)>(y)?(x):(y))
|
---|
822 | #define CURLMIN(x,y) ((x)<(y)?(x):(y))
|
---|
823 |
|
---|
824 | /* Some versions of the Android SDK is missing the declaration */
|
---|
825 | #if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING)
|
---|
826 | struct passwd;
|
---|
827 | int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
|
---|
828 | size_t buflen, struct passwd **result);
|
---|
829 | #endif
|
---|
830 |
|
---|
831 | #endif /* HEADER_CURL_SETUP_H */
|
---|