VirtualBox

source: vbox/trunk/src/libs/curl-8.4.0/lib/curl_setup.h@ 103582

最後變更 在這個檔案從103582是 101409,由 vboxsync 提交於 16 月 前

curl-8.4.0: Applied and adjusted our curl changes to 8.3.0. bugref:10533

  • 屬性 svn:eol-style 設為 native
檔案大小: 23.2 KB
 
1#ifndef HEADER_CURL_SETUP_H
2#define HEADER_CURL_SETUP_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 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.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 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26
27#if defined(BUILDING_LIBCURL) && !defined(CURL_NO_OLDIES)
28#define CURL_NO_OLDIES
29#endif
30
31/*
32 * Disable Visual Studio warnings:
33 * 4127 "conditional expression is constant"
34 */
35#ifdef _MSC_VER
36#pragma warning(disable:4127)
37#endif
38
39/*
40 * Define WIN32 when build target is Win32 API
41 */
42
43#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
44#define WIN32
45#endif
46
47#ifdef WIN32
48/*
49 * Don't include unneeded stuff in Windows headers to avoid compiler
50 * warnings and macro clashes.
51 * Make sure to define this macro before including any Windows headers.
52 */
53# ifndef WIN32_LEAN_AND_MEAN
54# define WIN32_LEAN_AND_MEAN
55# endif
56# ifndef NOGDI
57# define NOGDI
58# endif
59/* Detect Windows App environment which has a restricted access
60 * to the Win32 APIs. */
61# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
62 defined(WINAPI_FAMILY)
63# include <winapifamily.h>
64# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
65 !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
66# define CURL_WINDOWS_APP
67# endif
68# endif
69#endif
70
71/*
72 * Include configuration script results or hand-crafted
73 * configuration file for platforms which lack config tool.
74 */
75
76#ifdef HAVE_CONFIG_H
77
78#include "curl_config.h"
79
80# ifdef VBOX
81# ifdef WIN32
82 /* Fixing an issue with following #if (SIZEOF_CURL_OFF_T < 8) */
83 /* Define to the size of `curl_off_t', as computed by sizeof. */
84# undef SIZEOF_CURL_OFF_T
85# define SIZEOF_CURL_OFF_T 8
86# endif
87# endif
88
89#else /* HAVE_CONFIG_H */
90
91#ifdef _WIN32_WCE
92# include "config-win32ce.h"
93#else
94# ifdef WIN32
95# include "config-win32.h"
96# endif
97#endif
98
99#ifdef macintosh
100# include "config-mac.h"
101#endif
102
103#ifdef __riscos__
104# include "config-riscos.h"
105#endif
106
107#ifdef __AMIGA__
108# include "config-amigaos.h"
109#endif
110
111#ifdef __OS400__
112# include "config-os400.h"
113#endif
114
115#ifdef __PLAN9__
116# include "config-plan9.h"
117#endif
118
119#ifdef MSDOS
120# include "config-dos.h"
121#endif
122
123#endif /* HAVE_CONFIG_H */
124
125/* ================================================================ */
126/* Definition of preprocessor macros/symbols which modify compiler */
127/* behavior or generated code characteristics must be done here, */
128/* as appropriate, before any system header file is included. It is */
129/* also possible to have them defined in the config file included */
130/* before this point. As a result of all this we frown inclusion of */
131/* system header files in our config files, avoid this at any cost. */
132/* ================================================================ */
133
134/*
135 * AIX 4.3 and newer needs _THREAD_SAFE defined to build
136 * proper reentrant code. Others may also need it.
137 */
138
139#ifdef NEED_THREAD_SAFE
140# ifndef _THREAD_SAFE
141# define _THREAD_SAFE
142# endif
143#endif
144
145/*
146 * Tru64 needs _REENTRANT set for a few function prototypes and
147 * things to appear in the system header files. Unixware needs it
148 * to build proper reentrant code. Others may also need it.
149 */
150
151#ifdef NEED_REENTRANT
152# ifndef _REENTRANT
153# define _REENTRANT
154# endif
155#endif
156
157/* Solaris needs this to get a POSIX-conformant getpwuid_r */
158#if defined(sun) || defined(__sun)
159# ifndef _POSIX_PTHREAD_SEMANTICS
160# define _POSIX_PTHREAD_SEMANTICS 1
161# endif
162#endif
163
164/* ================================================================ */
165/* If you need to include a system header file for your platform, */
166/* please, do it beyond the point further indicated in this file. */
167/* ================================================================ */
168
169/*
170 * Disable other protocols when http is the only one desired.
171 */
172
173#ifdef HTTP_ONLY
174# ifndef CURL_DISABLE_DICT
175# define CURL_DISABLE_DICT
176# endif
177# ifndef CURL_DISABLE_FILE
178# define CURL_DISABLE_FILE
179# endif
180# ifndef CURL_DISABLE_FTP
181# define CURL_DISABLE_FTP
182# endif
183# ifndef CURL_DISABLE_GOPHER
184# define CURL_DISABLE_GOPHER
185# endif
186# ifndef CURL_DISABLE_IMAP
187# define CURL_DISABLE_IMAP
188# endif
189# ifndef CURL_DISABLE_LDAP
190# define CURL_DISABLE_LDAP
191# endif
192# ifndef CURL_DISABLE_LDAPS
193# define CURL_DISABLE_LDAPS
194# endif
195# ifndef CURL_DISABLE_MQTT
196# define CURL_DISABLE_MQTT
197# endif
198# ifndef CURL_DISABLE_POP3
199# define CURL_DISABLE_POP3
200# endif
201# ifndef CURL_DISABLE_RTSP
202# define CURL_DISABLE_RTSP
203# endif
204# ifndef CURL_DISABLE_SMB
205# define CURL_DISABLE_SMB
206# endif
207# ifndef CURL_DISABLE_SMTP
208# define CURL_DISABLE_SMTP
209# endif
210# ifndef CURL_DISABLE_TELNET
211# define CURL_DISABLE_TELNET
212# endif
213# ifndef CURL_DISABLE_TFTP
214# define CURL_DISABLE_TFTP
215# endif
216#endif
217
218/*
219 * When http is disabled rtsp is not supported.
220 */
221
222#if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)
223# define CURL_DISABLE_RTSP
224#endif
225
226/* ================================================================ */
227/* No system header file shall be included in this file before this */
228/* point. */
229/* ================================================================ */
230
231/*
232 * OS/400 setup file includes some system headers.
233 */
234
235#ifdef __OS400__
236# include "setup-os400.h"
237#endif
238
239/*
240 * VMS setup file includes some system headers.
241 */
242
243#ifdef __VMS
244# include "setup-vms.h"
245#endif
246
247/*
248 * Windows setup file includes some system headers.
249 */
250
251#ifdef HAVE_WINDOWS_H
252# include "setup-win32.h"
253#endif
254
255#include <curl/system.h>
256
257/*
258 * Use getaddrinfo to resolve the IPv4 address literal. If the current network
259 * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
260 * performing this task will result in a synthesized IPv6 address.
261 */
262#if defined(__APPLE__) && !defined(USE_ARES)
263#include <TargetConditionals.h>
264#define USE_RESOLVE_ON_IPS 1
265# if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \
266 defined(ENABLE_IPV6)
267# define CURL_MACOS_CALL_COPYPROXIES 1
268# endif
269#endif
270
271#ifdef USE_LWIPSOCK
272# include <lwip/init.h>
273# include <lwip/sockets.h>
274# include <lwip/netdb.h>
275#endif
276
277#ifdef HAVE_EXTRA_STRICMP_H
278# include <extra/stricmp.h>
279#endif
280
281#ifdef HAVE_EXTRA_STRDUP_H
282# include <extra/strdup.h>
283#endif
284
285#ifdef __AMIGA__
286# ifdef __amigaos4__
287# define __USE_INLINE__
288 /* use our own resolver which uses runtime feature detection */
289# define CURLRES_AMIGA
290 /* getaddrinfo() currently crashes bsdsocket.library, so disable */
291# undef HAVE_GETADDRINFO
292# if !(defined(__NEWLIB__) || \
293 (defined(__CLIB2__) && defined(__THREAD_SAFE)))
294 /* disable threaded resolver with clib2 - requires newlib or clib-ts */
295# undef USE_THREADS_POSIX
296# endif
297# endif
298# include <exec/types.h>
299# include <exec/execbase.h>
300# include <proto/exec.h>
301# include <proto/dos.h>
302# include <unistd.h>
303# if defined(HAVE_PROTO_BSDSOCKET_H) && \
304 (!defined(__amigaos4__) || defined(USE_AMISSL))
305 /* use bsdsocket.library directly, instead of libc networking functions */
306# define _SYS_MBUF_H /* m_len define clashes with curl */
307# include <proto/bsdsocket.h>
308# ifdef __amigaos4__
309 int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds,
310 fd_set *errorfds, struct timeval *timeout);
311# define select(a,b,c,d,e) Curl_amiga_select(a,b,c,d,e)
312# else
313# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
314# endif
315 /* must not use libc's fcntl() on bsdsocket.library sockfds! */
316# undef HAVE_FCNTL
317# undef HAVE_FCNTL_O_NONBLOCK
318# else
319 /* use libc networking and hence close() and fnctl() */
320# undef HAVE_CLOSESOCKET_CAMEL
321# undef HAVE_IOCTLSOCKET_CAMEL
322# endif
323/*
324 * In clib2 arpa/inet.h warns that some prototypes may clash
325 * with bsdsocket.library. This avoids the definition of those.
326 */
327# define __NO_NET_API
328#endif
329
330#include <stdio.h>
331#include <assert.h>
332
333#ifdef __TANDEM /* for ns*-tandem-nsk systems */
334# if ! defined __LP64
335# include <floss.h> /* FLOSS is only used for 32-bit builds. */
336# endif
337#endif
338
339#ifndef STDC_HEADERS /* no standard C headers! */
340#include <curl/stdcheaders.h>
341#endif
342
343#ifdef __POCC__
344# include <sys/types.h>
345# include <unistd.h>
346# define sys_nerr EILSEQ
347#endif
348
349/*
350 * Salford-C kludge section (mostly borrowed from wxWidgets).
351 */
352#ifdef __SALFORDC__
353 #pragma suppress 353 /* Possible nested comments */
354 #pragma suppress 593 /* Define not used */
355 #pragma suppress 61 /* enum has no name */
356 #pragma suppress 106 /* unnamed, unused parameter */
357 #include <clib.h>
358#endif
359
360/*
361 * Large file (>2Gb) support using WIN32 functions.
362 */
363
364#ifdef USE_WIN32_LARGE_FILES
365# include <io.h>
366# include <sys/types.h>
367# include <sys/stat.h>
368# undef lseek
369# define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence)
370# undef fstat
371# define fstat(fdes,stp) _fstati64(fdes, stp)
372# undef stat
373# define stat(fname,stp) curlx_win32_stat(fname, stp)
374# define struct_stat struct _stati64
375# define LSEEK_ERROR (__int64)-1
376# define open curlx_win32_open
377# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
378# define access(fname,mode) curlx_win32_access(fname, mode)
379 int curlx_win32_open(const char *filename, int oflag, ...);
380 int curlx_win32_stat(const char *path, struct_stat *buffer);
381 FILE *curlx_win32_fopen(const char *filename, const char *mode);
382 int curlx_win32_access(const char *path, int mode);
383#endif
384
385/*
386 * Small file (<2Gb) support using WIN32 functions.
387 */
388
389#ifdef USE_WIN32_SMALL_FILES
390# include <io.h>
391# include <sys/types.h>
392# include <sys/stat.h>
393# ifndef _WIN32_WCE
394# undef lseek
395# define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
396# define fstat(fdes,stp) _fstat(fdes, stp)
397# define stat(fname,stp) curlx_win32_stat(fname, stp)
398# define struct_stat struct _stat
399# define open curlx_win32_open
400# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
401# define access(fname,mode) curlx_win32_access(fname, mode)
402 int curlx_win32_stat(const char *path, struct_stat *buffer);
403 int curlx_win32_open(const char *filename, int oflag, ...);
404 FILE *curlx_win32_fopen(const char *filename, const char *mode);
405 int curlx_win32_access(const char *path, int mode);
406# endif
407# define LSEEK_ERROR (long)-1
408#endif
409
410#ifndef struct_stat
411# define struct_stat struct stat
412#endif
413
414#ifndef LSEEK_ERROR
415# define LSEEK_ERROR (off_t)-1
416#endif
417
418#ifndef SIZEOF_TIME_T
419/* assume default size of time_t to be 32 bit */
420#define SIZEOF_TIME_T 4
421#endif
422
423/*
424 * Default sizeof(off_t) in case it hasn't been defined in config file.
425 */
426
427#ifndef SIZEOF_OFF_T
428# if defined(__VMS) && !defined(__VAX)
429# if defined(_LARGEFILE)
430# define SIZEOF_OFF_T 8
431# endif
432# elif defined(__OS400__) && defined(__ILEC400__)
433# if defined(_LARGE_FILES)
434# define SIZEOF_OFF_T 8
435# endif
436# elif defined(__MVS__) && defined(__IBMC__)
437# if defined(_LP64) || defined(_LARGE_FILES)
438# define SIZEOF_OFF_T 8
439# endif
440# elif defined(__370__) && defined(__IBMC__)
441# if defined(_LP64) || defined(_LARGE_FILES)
442# define SIZEOF_OFF_T 8
443# endif
444# endif
445# ifndef SIZEOF_OFF_T
446# define SIZEOF_OFF_T 4
447# endif
448#endif
449
450#if (SIZEOF_CURL_OFF_T < 8)
451#error "too small curl_off_t"
452#else
453 /* assume SIZEOF_CURL_OFF_T == 8 */
454# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)
455#endif
456#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1))
457
458#if (SIZEOF_TIME_T == 4)
459# ifdef HAVE_TIME_T_UNSIGNED
460# define TIME_T_MAX UINT_MAX
461# define TIME_T_MIN 0
462# else
463# define TIME_T_MAX INT_MAX
464# define TIME_T_MIN INT_MIN
465# endif
466#else
467# ifdef HAVE_TIME_T_UNSIGNED
468# define TIME_T_MAX 0xFFFFFFFFFFFFFFFF
469# define TIME_T_MIN 0
470# else
471# define TIME_T_MAX 0x7FFFFFFFFFFFFFFF
472# define TIME_T_MIN (-TIME_T_MAX - 1)
473# endif
474#endif
475
476#ifndef SIZE_T_MAX
477/* some limits.h headers have this defined, some don't */
478#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
479#define SIZE_T_MAX 18446744073709551615U
480#else
481#define SIZE_T_MAX 4294967295U
482#endif
483#endif
484
485#ifndef SSIZE_T_MAX
486/* some limits.h headers have this defined, some don't */
487#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
488#define SSIZE_T_MAX 9223372036854775807
489#else
490#define SSIZE_T_MAX 2147483647
491#endif
492#endif
493
494/*
495 * Arg 2 type for gethostname in case it hasn't been defined in config file.
496 */
497
498#ifndef GETHOSTNAME_TYPE_ARG2
499# ifdef USE_WINSOCK
500# define GETHOSTNAME_TYPE_ARG2 int
501# else
502# define GETHOSTNAME_TYPE_ARG2 size_t
503# endif
504#endif
505
506/* Below we define some functions. They should
507
508 4. set the SIGALRM signal timeout
509 5. set dir/file naming defines
510 */
511
512#ifdef WIN32
513
514# define DIR_CHAR "\\"
515
516#else /* WIN32 */
517
518# ifdef MSDOS /* Watt-32 */
519
520# include <sys/ioctl.h>
521# define select(n,r,w,x,t) select_s(n,r,w,x,t)
522# define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
523# include <tcp.h>
524# ifdef word
525# undef word
526# endif
527# ifdef byte
528# undef byte
529# endif
530
531# endif /* MSDOS */
532
533# ifdef __minix
534 /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
535 extern char *strtok_r(char *s, const char *delim, char **last);
536 extern struct tm *gmtime_r(const time_t * const timep, struct tm *tmp);
537# endif
538
539# define DIR_CHAR "/"
540
541# ifndef fileno /* sunos 4 have this as a macro! */
542 int fileno(FILE *stream);
543# endif
544
545#endif /* WIN32 */
546
547/*
548 * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN
549 * defined in ws2tcpip.h as well as to provide IPv6 support.
550 * Does not apply if lwIP is used.
551 */
552
553#if defined(_MSC_VER) && !defined(__POCC__) && !defined(USE_LWIPSOCK)
554# if !defined(HAVE_WS2TCPIP_H) || \
555 ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
556# undef HAVE_GETADDRINFO_THREADSAFE
557# undef HAVE_FREEADDRINFO
558# undef HAVE_GETADDRINFO
559# undef ENABLE_IPV6
560# endif
561#endif
562
563/* ---------------------------------------------------------------- */
564/* resolver specialty compile-time defines */
565/* CURLRES_* defines to use in the host*.c sources */
566/* ---------------------------------------------------------------- */
567
568/*
569 * lcc-win32 doesn't have _beginthreadex(), lacks threads support.
570 */
571
572#if defined(__LCC__) && defined(WIN32)
573# undef USE_THREADS_POSIX
574# undef USE_THREADS_WIN32
575#endif
576
577/*
578 * MSVC threads support requires a multi-threaded runtime library.
579 * _beginthreadex() is not available in single-threaded ones.
580 */
581
582#if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT)
583# undef USE_THREADS_POSIX
584# undef USE_THREADS_WIN32
585#endif
586
587/*
588 * Mutually exclusive CURLRES_* definitions.
589 */
590
591#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
592# define CURLRES_IPV6
593#else
594# define CURLRES_IPV4
595#endif
596
597#ifdef USE_ARES
598# define CURLRES_ASYNCH
599# define CURLRES_ARES
600/* now undef the stock libc functions just to avoid them being used */
601# undef HAVE_GETADDRINFO
602# undef HAVE_FREEADDRINFO
603#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
604# define CURLRES_ASYNCH
605# define CURLRES_THREADED
606#else
607# define CURLRES_SYNCH
608#endif
609
610/* ---------------------------------------------------------------- */
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#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_MBEDTLS) || \
653 defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \
654 defined(USE_BEARSSL) || defined(USE_RUSTLS)
655#define USE_SSL /* SSL support has been enabled */
656#endif
657
658/* Single point where USE_SPNEGO definition might be defined */
659#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \
660 (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
661#define USE_SPNEGO
662#endif
663
664/* Single point where USE_KERBEROS5 definition might be defined */
665#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \
666 (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
667#define USE_KERBEROS5
668#endif
669
670/* Single point where USE_NTLM definition might be defined */
671#if !defined(CURL_DISABLE_NTLM)
672# if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
673 defined(USE_GNUTLS) || defined(USE_SECTRANSP) || \
674 defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
675 (defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
676# define USE_CURL_NTLM_CORE
677# endif
678# if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
679# define USE_NTLM
680# endif
681#endif
682
683#ifdef CURL_WANTS_CA_BUNDLE_ENV
684#error "No longer supported. Set CURLOPT_CAINFO at runtime instead."
685#endif
686
687#if defined(USE_LIBSSH2) || defined(USE_LIBSSH) || defined(USE_WOLFSSH)
688#define USE_SSH
689#endif
690
691/*
692 * Provide a mechanism to silence picky compilers, such as gcc 4.6+.
693 * Parameters should of course normally not be unused, but for example when
694 * we have multiple implementations of the same interface it may happen.
695 */
696
697#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
698 ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
699# define UNUSED_PARAM __attribute__((__unused__))
700# define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
701#else
702# define UNUSED_PARAM /* NOTHING */
703# define WARN_UNUSED_RESULT
704#endif
705
706/*
707 * Include macros and defines that should only be processed once.
708 */
709
710#ifndef HEADER_CURL_SETUP_ONCE_H
711#include "curl_setup_once.h"
712#endif
713
714/*
715 * Definition of our NOP statement Object-like macro
716 */
717
718#ifndef Curl_nop_stmt
719# define Curl_nop_stmt do { } while(0)
720#endif
721
722/*
723 * Ensure that Winsock and lwIP TCP/IP stacks are not mixed.
724 */
725
726#if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
727# if defined(SOCKET) || \
728 defined(USE_WINSOCK) || \
729 defined(HAVE_WINSOCK2_H) || \
730 defined(HAVE_WS2TCPIP_H)
731# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!"
732# endif
733#endif
734
735/*
736 * shutdown() flags for systems that don't define them
737 */
738
739#ifndef SHUT_RD
740#define SHUT_RD 0x00
741#endif
742
743#ifndef SHUT_WR
744#define SHUT_WR 0x01
745#endif
746
747#ifndef SHUT_RDWR
748#define SHUT_RDWR 0x02
749#endif
750
751/* Define S_ISREG if not defined by system headers, e.g. MSVC */
752#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
753#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
754#endif
755
756/* Define S_ISDIR if not defined by system headers, e.g. MSVC */
757#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
758#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
759#endif
760
761/* In Windows the default file mode is text but an application can override it.
762Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
763*/
764#if defined(WIN32) || defined(MSDOS)
765#define FOPEN_READTEXT "rt"
766#define FOPEN_WRITETEXT "wt"
767#define FOPEN_APPENDTEXT "at"
768#elif defined(__CYGWIN__)
769/* Cygwin has specific behavior we need to address when WIN32 is not defined.
770https://cygwin.com/cygwin-ug-net/using-textbinary.html
771For write we want our output to have line endings of LF and be compatible with
772other Cygwin utilities. For read we want to handle input that may have line
773endings either CRLF or LF so 't' is appropriate.
774*/
775#define FOPEN_READTEXT "rt"
776#define FOPEN_WRITETEXT "w"
777#define FOPEN_APPENDTEXT "a"
778#else
779#define FOPEN_READTEXT "r"
780#define FOPEN_WRITETEXT "w"
781#define FOPEN_APPENDTEXT "a"
782#endif
783
784/* for systems that don't detect this in configure */
785#ifndef CURL_SA_FAMILY_T
786# if defined(HAVE_SA_FAMILY_T)
787# define CURL_SA_FAMILY_T sa_family_t
788# elif defined(HAVE_ADDRESS_FAMILY)
789# define CURL_SA_FAMILY_T ADDRESS_FAMILY
790# else
791/* use a sensible default */
792# define CURL_SA_FAMILY_T unsigned short
793# endif
794#endif
795
796/* Some convenience macros to get the larger/smaller value out of two given.
797 We prefix with CURL to prevent name collisions. */
798#define CURLMAX(x,y) ((x)>(y)?(x):(y))
799#define CURLMIN(x,y) ((x)<(y)?(x):(y))
800
801/* A convenience macro to provide both the string literal and the length of
802 the string literal in one go, useful for functions that take "string,len"
803 as their argument */
804#define STRCONST(x) x,sizeof(x)-1
805
806/* Some versions of the Android SDK is missing the declaration */
807#if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING)
808struct passwd;
809int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
810 size_t buflen, struct passwd **result);
811#endif
812
813#ifdef DEBUGBUILD
814#define UNITTEST
815#else
816#define UNITTEST static
817#endif
818
819#if defined(USE_NGHTTP2) || defined(USE_HYPER)
820#define USE_HTTP2
821#endif
822
823#if (defined(USE_NGTCP2) && defined(USE_NGHTTP3)) || \
824 defined(USE_QUICHE) || defined(USE_MSH3)
825#define ENABLE_QUIC
826#define USE_HTTP3
827#endif
828
829/* Certain Windows implementations are not aligned with what curl expects,
830 so always use the local one on this platform. E.g. the mingw-w64
831 implementation can return wrong results for non-ASCII inputs. */
832#if defined(HAVE_BASENAME) && defined(WIN32)
833#undef HAVE_BASENAME
834#endif
835
836#if defined(USE_UNIX_SOCKETS) && defined(WIN32)
837# if !defined(UNIX_PATH_MAX)
838 /* Replicating logic present in afunix.h
839 (distributed with newer Windows 10 SDK versions only) */
840# define UNIX_PATH_MAX 108
841 /* !checksrc! disable TYPEDEFSTRUCT 1 */
842 typedef struct sockaddr_un {
843 ADDRESS_FAMILY sun_family;
844 char sun_path[UNIX_PATH_MAX];
845 } SOCKADDR_UN, *PSOCKADDR_UN;
846# define WIN32_SOCKADDR_UN
847# endif
848#endif
849
850/* OpenSSLv3 marks DES, MD5 and ENGINE functions deprecated but we have no
851 replacements (yet) so tell the compiler to not warn for them. */
852#ifdef USE_OPENSSL
853#define OPENSSL_SUPPRESS_DEPRECATED
854#endif
855
856#endif /* HEADER_CURL_SETUP_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette