From 181be127a57f14394a0b31393f481b8569138929 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Dec 2020 15:51:12 +0100 Subject: [PATCH] Simplify wxUSE_WEBREQUEST_XXX logic Remove automatic definition of wxUSE_WEBREQUEST depending on whether wxUSE_WEBREQUEST_XXX are defined and follow the same approach as with wxUSE_GRAPHICS_XXX, i.e. define wxUSE_WEBREQUEST_XXX as wxUSE_WEBREQUEST by default instead. Move wxUSE_WEBREQUEST_WINHTTP to wxMSW-specific file, it doesn't need to be in common one (unfortunately this can't be done for the Mac-specific wxUSE_WEBREQUEST_URLSESSION yet, because macOS-specific settings are not injected into setup.h.in currently). Also fix test for winhttp.h availability: it seems to be present in all MinGW64 distributions, but not in MinGW32, so test for this and not for gcc version. Finally remove the now unnecessary test for macOS 10.9, as we only support 10.10+ anyhow by now. --- build/cmake/setup.h.in | 28 ++++++------------ include/wx/android/setup.h | 44 +++++++++------------------- include/wx/gtk/setup0.h | 60 ++++++++++++++++++-------------------- include/wx/motif/setup0.h | 44 +++++++++------------------- include/wx/msw/setup0.h | 60 ++++++++++++++++++-------------------- include/wx/msw/setup_inc.h | 16 +++++++++- include/wx/osx/setup0.h | 44 +++++++++------------------- include/wx/setup_inc.h | 44 +++++++++------------------- include/wx/univ/setup0.h | 44 +++++++++------------------- setup.h.in | 28 ++++++------------ 10 files changed, 161 insertions(+), 251 deletions(-) diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in index 506c4655f4..db6e294e51 100644 --- a/build/cmake/setup.h.in +++ b/build/cmake/setup.h.in @@ -294,31 +294,15 @@ #cmakedefine01 wxUSE_MIMETYPE +#cmakedefine01 wxUSE_WEBREQUEST -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#cmakedefine01 wxUSE_WEBREQUEST_WINHTTP -#else -#cmakedefine01 wxUSE_WEBREQUEST_WINHTTP -#endif - -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#cmakedefine01 wxUSE_WEBREQUEST_URLSESSION +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #cmakedefine01 wxUSE_WEBREQUEST_URLSESSION #endif -#if defined(__WINDOWS__) || defined(__APPLE__) #cmakedefine01 wxUSE_WEBREQUEST_CURL -#else -#cmakedefine01 wxUSE_WEBREQUEST_CURL -#endif - -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#cmakedefine01 wxUSE_WEBREQUEST -#else -#cmakedefine01 wxUSE_WEBREQUEST -#endif #cmakedefine01 wxUSE_PROTOCOL @@ -707,6 +691,12 @@ #cmakedefine01 wxUSE_GRAPHICS_DIRECT2D #endif +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + #cmakedefine01 wxUSE_WEBREQUEST_WINHTTP +#else + #cmakedefine01 wxUSE_WEBREQUEST_WINHTTP +#endif + #cmakedefine01 wxUSE_OLE diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h index 0443cf7f9e..3fd3ce552b 100644 --- a/include/wx/android/setup.h +++ b/include/wx/android/setup.h @@ -632,53 +632,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. diff --git a/include/wx/gtk/setup0.h b/include/wx/gtk/setup0.h index d22b87749a..77b1827e0f 100644 --- a/include/wx/gtk/setup0.h +++ b/include/wx/gtk/setup0.h @@ -633,53 +633,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. @@ -1630,7 +1614,7 @@ /* --- start MSW options --- */ // ---------------------------------------------------------------------------- -// Graphics backends choices for Windows +// Windows-specific backends choices // ---------------------------------------------------------------------------- // The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. @@ -1658,6 +1642,20 @@ #define wxUSE_GRAPHICS_DIRECT2D 0 #endif +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + #define wxUSE_WEBREQUEST_WINHTTP 1 +#else + #define wxUSE_WEBREQUEST_WINHTTP 0 +#endif + // ---------------------------------------------------------------------------- // Windows-only settings // ---------------------------------------------------------------------------- diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index f88c0fefb7..9a6b48601d 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -633,53 +633,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index ed9a9e5072..28a21cffed 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -633,53 +633,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. @@ -1630,7 +1614,7 @@ /* --- start MSW options --- */ // ---------------------------------------------------------------------------- -// Graphics backends choices for Windows +// Windows-specific backends choices // ---------------------------------------------------------------------------- // The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. @@ -1658,6 +1642,20 @@ #define wxUSE_GRAPHICS_DIRECT2D 0 #endif +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + #define wxUSE_WEBREQUEST_WINHTTP 1 +#else + #define wxUSE_WEBREQUEST_WINHTTP 0 +#endif + // ---------------------------------------------------------------------------- // Windows-only settings // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/setup_inc.h b/include/wx/msw/setup_inc.h index c764432c9d..9a077f6156 100644 --- a/include/wx/msw/setup_inc.h +++ b/include/wx/msw/setup_inc.h @@ -8,7 +8,7 @@ /////////////////////////////////////////////////////////////////////////////// // ---------------------------------------------------------------------------- -// Graphics backends choices for Windows +// Windows-specific backends choices // ---------------------------------------------------------------------------- // The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. @@ -36,6 +36,20 @@ #define wxUSE_GRAPHICS_DIRECT2D 0 #endif +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + #define wxUSE_WEBREQUEST_WINHTTP 1 +#else + #define wxUSE_WEBREQUEST_WINHTTP 0 +#endif + // ---------------------------------------------------------------------------- // Windows-only settings // ---------------------------------------------------------------------------- diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index ead9701e87..5d20b4e33d 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -639,53 +639,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 1eb66bcaa6..28c9c6d5f8 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -629,53 +629,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index 9c057c2977..72b1ea4a43 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -632,53 +632,37 @@ // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 -// wxWebRequest backend based on WinHTTP +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. // // Default is 1 // -// Recommended setting: 1 on Windows - -// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() -// here as this file is included from wx/platform.h before they're defined. -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 1 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 // wxWebRequest backend based on NSURLSession // -// Default is 1 +// Default is 1 under macOS. // -// Recommended setting: 1 on macOS 10.9+ -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 1 +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif // wxWebRequest backend based on libcurl, can be used under all platforms. // -// Default is 1 +// Default is 0 for MSW and macOS, detected automatically when using configure. // // Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required // for wxWebRequest to be available at all. -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 1 -#endif - -// wxWebRequest and related classes: This will allow usage of system libraries -// for HTTP(S) requests -// -// Default is 1 -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 1 -#else -#define wxUSE_WEBREQUEST 0 -#endif // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. diff --git a/setup.h.in b/setup.h.in index 640791704a..711f4dc682 100644 --- a/setup.h.in +++ b/setup.h.in @@ -294,31 +294,15 @@ #define wxUSE_MIMETYPE 0 +#define wxUSE_WEBREQUEST 0 -#if defined(_MSC_VER) || \ - (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define wxUSE_WEBREQUEST_WINHTTP 0 -#else -#define wxUSE_WEBREQUEST_WINHTTP 0 -#endif - -#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 -#define wxUSE_WEBREQUEST_URLSESSION 0 +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST #else #define wxUSE_WEBREQUEST_URLSESSION 0 #endif -#if defined(__WINDOWS__) || defined(__APPLE__) #define wxUSE_WEBREQUEST_CURL 0 -#else -#define wxUSE_WEBREQUEST_CURL 0 -#endif - -#if wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL -#define wxUSE_WEBREQUEST 0 -#else -#define wxUSE_WEBREQUEST 0 -#endif #define wxUSE_PROTOCOL 0 @@ -707,6 +691,12 @@ #define wxUSE_GRAPHICS_DIRECT2D 0 #endif +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + #define wxUSE_WEBREQUEST_WINHTTP 0 +#else + #define wxUSE_WEBREQUEST_WINHTTP 0 +#endif + #define wxUSE_OLE 0