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