VirtualBox

source: vbox/trunk/src/libs/curl-8.7.1/lib/curl_setup.h@ 104083

Last change on this file since 104083 was 104083, checked in by vboxsync, 8 months ago

curl-8.7.1: Applied and adjusted our curl changes to 8.4.0. bugref:10639

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

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