summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/curl_setup.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/curl_setup.h')
-rw-r--r--libs/libcurl/src/curl_setup.h204
1 files changed, 114 insertions, 90 deletions
diff --git a/libs/libcurl/src/curl_setup.h b/libs/libcurl/src/curl_setup.h
index 1d0a3965a4..bc863fbb97 100644
--- a/libs/libcurl/src/curl_setup.h
+++ b/libs/libcurl/src/curl_setup.h
@@ -31,13 +31,6 @@
/* Tell "curl/curl.h" not to include "curl/mprintf.h" */
#define CURL_SKIP_INCLUDE_MPRINTF
-/* FIXME: Delete this once the warnings have been fixed. */
-#if !defined(CURL_WARN_SIGN_CONVERSION)
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#endif
-#endif
-
/* Set default _WIN32_WINNT */
#ifdef __MINGW32__
#include <_mingw.h>
@@ -85,13 +78,17 @@
#endif
#endif
-/*
- * Disable Visual Studio warnings:
- * 4127 "conditional expression is constant"
- */
#ifdef _MSC_VER
+/* Disable Visual Studio warnings: 4127 "conditional expression is constant" */
#pragma warning(disable:4127)
+/* Avoid VS2005 and upper complaining about portable C functions. */
+#ifndef _CRT_NONSTDC_NO_DEPRECATE
+#define _CRT_NONSTDC_NO_DEPRECATE /* for strdup(), write(), etc. */
+#endif
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE /* for fopen(), getenv(), etc. */
#endif
+#endif /* _MSC_VER */
#ifdef _WIN32
/*
@@ -100,16 +97,26 @@
* Make sure to define this macro before including any Windows headers.
*/
# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
# endif
# ifndef NOGDI
-# define NOGDI
+# define NOGDI
+# endif
+/* Detect Windows App environment which has a restricted access
+ * to the Win32 APIs. */
+# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
+ defined(WINAPI_FAMILY)
+# include <winapifamily.h>
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+# define CURL_WINDOWS_UWP
+# endif
# endif
#endif
/* Compatibility */
-#if defined(ENABLE_IPV6)
-# define USE_IPV6 1
+#ifdef ENABLE_IPV6
+#define USE_IPV6 1
#endif
/*
@@ -123,12 +130,8 @@
#else /* HAVE_CONFIG_H */
-#ifdef _WIN32_WCE
-# include "config-win32ce.h"
-#else
-# ifdef _WIN32
-# include "config-win32.h"
-# endif
+#ifdef _WIN32
+# include "config-win32.h"
#endif
#ifdef macintosh
@@ -139,10 +142,6 @@
# include "config-riscos.h"
#endif
-#ifdef __AMIGA__
-# include "config-amigaos.h"
-#endif
-
#ifdef __OS400__
# include "config-os400.h"
#endif
@@ -151,10 +150,6 @@
# include "config-plan9.h"
#endif
-#ifdef MSDOS
-# include "config-dos.h"
-#endif
-
#endif /* HAVE_CONFIG_H */
/* ================================================================ */
@@ -173,7 +168,7 @@
#ifdef NEED_THREAD_SAFE
# ifndef _THREAD_SAFE
-# define _THREAD_SAFE
+# define _THREAD_SAFE
# endif
#endif
@@ -185,14 +180,14 @@
#ifdef NEED_REENTRANT
# ifndef _REENTRANT
-# define _REENTRANT
+# define _REENTRANT
# endif
#endif
/* Solaris needs this to get a POSIX-conformant getpwuid_r */
#if defined(sun) || defined(__sun)
# ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
+# define _POSIX_PTHREAD_SEMANTICS 1
# endif
#endif
@@ -280,14 +275,6 @@
# define CURL_DISABLE_HTTP_AUTH 1
#endif
-/*
- * ECH requires HTTPSRR.
- */
-
-#if defined(USE_ECH) && !defined(USE_HTTPSRR)
-# define USE_HTTPSRR
-#endif
-
/* ================================================================ */
/* No system header file shall be included in this file before this */
/* point. */
@@ -383,17 +370,23 @@
# endif
#endif
+#ifdef USE_ARES
+# ifndef CARES_NO_DEPRECATED
+# define CARES_NO_DEPRECATED /* for ares_getsock() */
+# endif
+# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && defined(_WIN32)
+# define CARES_STATICLIB /* define it before including ares.h */
+# endif
+#endif
+
#ifdef USE_LWIPSOCK
# include <lwip/init.h>
# include <lwip/sockets.h>
# include <lwip/netdb.h>
#endif
-#ifdef HAVE_EXTRA_STRICMP_H
+#ifdef macintosh
# include <extra/stricmp.h>
-#endif
-
-#ifdef HAVE_EXTRA_STRDUP_H
# include <extra/strdup.h>
#endif
@@ -446,9 +439,9 @@
#include <assert.h>
#ifdef __TANDEM /* for ns*-tandem-nsk systems */
-# if ! defined __LP64
-# include <floss.h> /* FLOSS is only used for 32-bit builds. */
-# endif
+# if ! defined __LP64
+# include <floss.h> /* FLOSS is only used for 32-bit builds. */
+# endif
#endif
#ifndef STDC_HEADERS /* no standard C headers! */
@@ -484,11 +477,19 @@
FILE *curlx_win32_fopen(const char *filename, const char *mode);
#endif
+#ifdef __DJGPP__
+/* Requires DJGPP 2.04 */
+# include <unistd.h>
+# undef lseek
+# define lseek(fdes,offset,whence) llseek(fdes, offset, whence)
+# define LSEEK_ERROR (offset_t)-1
+#endif
+
/*
* Small file (<2Gb) support using Win32 functions.
*/
-#ifdef USE_WIN32_SMALL_FILES
+#if defined(_WIN32) && !defined(USE_WIN32_LARGE_FILES)
# include <io.h>
# include <sys/types.h>
# include <sys/stat.h>
@@ -508,11 +509,11 @@
#endif
#ifndef struct_stat
-# define struct_stat struct stat
+#define struct_stat struct stat
#endif
#ifndef LSEEK_ERROR
-# define LSEEK_ERROR (off_t)-1
+#define LSEEK_ERROR (off_t)-1
#endif
#ifndef SIZEOF_TIME_T
@@ -583,8 +584,8 @@
# endif
# define CURL_UINT64_SUFFIX CURL_SUFFIX_CURL_OFF_TU
# define CURL_UINT64_C(val) CURL_CONC_MACROS(val,CURL_UINT64_SUFFIX)
-# define FMT_PRId64 CURL_FORMAT_CURL_OFF_T
-# define FMT_PRIu64 CURL_FORMAT_CURL_OFF_TU
+# define FMT_PRId64 CURL_FORMAT_CURL_OFF_T
+# define FMT_PRIu64 CURL_FORMAT_CURL_OFF_TU
#endif
#define FMT_OFF_T CURL_FORMAT_CURL_OFF_T
@@ -683,9 +684,9 @@
/*
* MSVC threads support requires a multi-threaded runtime library.
* _beginthreadex() is not available in single-threaded ones.
+ * Single-threaded option was last available in VS2005: _MSC_VER <= 1400
*/
-
-#if defined(_MSC_VER) && !defined(_MT)
+#if defined(_MSC_VER) && !defined(_MT) /* available in _MSC_VER <= 1400 */
# undef USE_THREADS_POSIX
# undef USE_THREADS_WIN32
#endif
@@ -703,15 +704,15 @@
# define CURLRES_IPV4
#endif
-#ifdef USE_ARES
+#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
+# define CURLRES_ASYNCH
+# define CURLRES_THREADED
+#elif defined(USE_ARES)
# define CURLRES_ASYNCH
# define CURLRES_ARES
/* now undef the stock libc functions just to avoid them being used */
# undef HAVE_GETADDRINFO
# undef HAVE_FREEADDRINFO
-#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
-# define CURLRES_ASYNCH
-# define CURLRES_THREADED
#else
# define CURLRES_SYNCH
#endif
@@ -728,14 +729,23 @@
#error "libidn2 cannot be enabled with WinIDN or AppleIDN, choose one."
#endif
-#define LIBIDN_REQUIRED_VERSION "0.4.1"
-
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \
defined(USE_BEARSSL) || defined(USE_RUSTLS)
#define USE_SSL /* SSL support has been enabled */
#endif
+#if defined(USE_OPENSSL) && defined(USE_WOLFSSL)
+# include <wolfssl/version.h>
+# if LIBWOLFSSL_VERSION_HEX >= 0x05007006
+# ifndef OPENSSL_COEXIST
+# define OPENSSL_COEXIST
+# endif
+# else
+# error "OpenSSL can only coexist with wolfSSL v5.7.6 or upper"
+# endif
+#endif
+
#if defined(USE_WOLFSSL) && defined(USE_GNUTLS)
/* Avoid defining unprefixed wolfSSL SHA macros colliding with nettle ones */
#define NO_OLD_WC_NAMES
@@ -766,10 +776,6 @@
# endif
#endif
-#ifdef CURL_WANTS_CA_BUNDLE_ENV
-#error "No longer supported. Set CURLOPT_CAINFO at runtime instead."
-#endif
-
#if defined(USE_LIBSSH2) || defined(USE_LIBSSH) || defined(USE_WOLFSSH)
#define USE_SSH
#endif
@@ -802,7 +808,7 @@
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) || \
defined(__IAR_SYSTEMS_ICC__)
# define CURL_NORETURN __attribute__((__noreturn__))
-#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
+#elif defined(_MSC_VER)
# define CURL_NORETURN __declspec(noreturn)
#else
# define CURL_NORETURN
@@ -833,7 +839,7 @@
*/
#ifndef Curl_nop_stmt
-# define Curl_nop_stmt do { } while(0)
+#define Curl_nop_stmt do { } while(0)
#endif
/*
@@ -872,6 +878,14 @@
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
+/* Since O_BINARY is used in bitmasks, setting it to zero makes it usable in
+ source code but yet it does not ruin anything */
+#ifdef O_BINARY
+#define CURL_O_BINARY O_BINARY
+#else
+#define CURL_O_BINARY 0
+#endif
+
/* In Windows the default file mode is text but an application can override it.
Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
*/
@@ -901,6 +915,8 @@ endings either CRLF or LF so 't' is appropriate.
# define CURL_SA_FAMILY_T sa_family_t
# elif defined(HAVE_ADDRESS_FAMILY)
# define CURL_SA_FAMILY_T ADDRESS_FAMILY
+# elif defined(__AMIGA__)
+# define CURL_SA_FAMILY_T unsigned char
# else
/* use a sensible default */
# define CURL_SA_FAMILY_T unsigned short
@@ -917,8 +933,11 @@ endings either CRLF or LF so 't' is appropriate.
as their argument */
#define STRCONST(x) x,sizeof(x)-1
-/* Some versions of the Android SDK is missing the declaration */
-#if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING)
+#define CURL_ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
+
+/* Some versions of the Android NDK is missing the declaration */
+#if defined(HAVE_GETPWUID_R) && \
+ defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
struct passwd;
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
size_t buflen, struct passwd **result);
@@ -930,8 +949,7 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
#define UNITTEST static
#endif
-/* Hyper supports HTTP2 also, but Curl's integration with Hyper does not */
-#if defined(USE_NGHTTP2)
+#ifdef USE_NGHTTP2
#define USE_HTTP2
#endif
@@ -940,7 +958,7 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
defined(USE_QUICHE) || defined(USE_MSH3)
#ifdef CURL_WITH_MULTI_SSL
-#error "Multi-SSL combined with QUIC is not supported"
+#error "MultiSSL combined with QUIC is not supported"
#endif
#define USE_HTTP3
@@ -960,39 +978,45 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
# define UNIX_PATH_MAX 108
/* !checksrc! disable TYPEDEFSTRUCT 1 */
typedef struct sockaddr_un {
- ADDRESS_FAMILY sun_family;
+ CURL_SA_FAMILY_T sun_family;
char sun_path[UNIX_PATH_MAX];
} SOCKADDR_UN, *PSOCKADDR_UN;
# define WIN32_SOCKADDR_UN
# endif
#endif
+#ifdef USE_OPENSSL
/* OpenSSLv3 marks DES, MD5 and ENGINE functions deprecated but we have no
replacements (yet) so tell the compiler to not warn for them. */
-#ifdef USE_OPENSSL
-#define OPENSSL_SUPPRESS_DEPRECATED
+# define OPENSSL_SUPPRESS_DEPRECATED
+# ifdef _WIN32
+/* Silence LibreSSL warnings about wincrypt.h collision. Works in 3.8.2+ */
+# ifndef LIBRESSL_DISABLE_OVERRIDE_WINCRYPT_DEFINES_WARNING
+# define LIBRESSL_DISABLE_OVERRIDE_WINCRYPT_DEFINES_WARNING
+# endif
+# endif
#endif
-#if defined(inline)
- /* 'inline' is defined as macro and assumed to be correct */
- /* No need for 'inline' replacement */
+#if defined(CURL_INLINE)
+/* 'CURL_INLINE' defined, use as-is */
+#elif defined(inline)
+# define CURL_INLINE inline /* 'inline' defined, assumed correct */
#elif defined(__cplusplus)
- /* The code is compiled with C++ compiler.
- C++ always supports 'inline'. */
- /* No need for 'inline' replacement */
+/* The code is compiled with C++ compiler.
+ C++ always supports 'inline'. */
+# define CURL_INLINE inline /* 'inline' keyword supported */
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
- /* C99 (and later) supports 'inline' keyword */
- /* No need for 'inline' replacement */
+/* C99 (and later) supports 'inline' keyword */
+# define CURL_INLINE inline /* 'inline' keyword supported */
#elif defined(__GNUC__) && __GNUC__ >= 3
- /* GCC supports '__inline__' as an extension */
-# define inline __inline__
-#elif defined(_MSC_VER) && _MSC_VER >= 1400
- /* MSC supports '__inline' from VS 2005 (or even earlier) */
-# define inline __inline
+/* GCC supports '__inline__' as an extension */
+# define CURL_INLINE __inline__
+#elif defined(_MSC_VER)
+# define CURL_INLINE __inline
#else
- /* Probably 'inline' is not supported by compiler.
- Define to the empty string to be on the safe side. */
-# define inline /* empty */
+/* Probably 'inline' is not supported by compiler.
+ Define to the empty string to be on the safe side. */
+# define CURL_INLINE /* empty */
#endif
#endif /* HEADER_CURL_SETUP_H */