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.
This commit is contained in:
Vadim Zeitlin
2020-12-13 15:51:12 +01:00
parent b7450f52ff
commit 181be127a5
10 changed files with 161 additions and 251 deletions

View File

@@ -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.