From d6330a19b29ebff359a6746250c78437dbcaf77d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 19 Dec 2016 10:34:32 +0100 Subject: Use QT_CONFIG(library) instead of QT_NO_LIBRARY For the windows file system engine, we add an extra macro to use library loading if configured to do so, but avoid it on WinRT, as none of the symbols would be found. We also QT_REQUIRE_CONFIG(library) in the library headers and exclude the sources from the build if library loading is disabled. This, in turn, makes it necessary to clean up some header inclusions. Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec Reviewed-by: Oswald Buddenhagen --- src/network/kernel/qdnslookup_unix.cpp | 6 ++++-- src/network/kernel/qhostinfo_unix.cpp | 4 +++- src/network/ssl/qsslsocket_openssl.cpp | 5 ++--- src/network/ssl/qsslsocket_openssl_symbols.cpp | 13 ++++++------- 4 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/network') diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp index 41038dc8da..1da00813ce 100644 --- a/src/network/kernel/qdnslookup_unix.cpp +++ b/src/network/kernel/qdnslookup_unix.cpp @@ -39,7 +39,9 @@ #include "qdnslookup_p.h" +#if QT_CONFIG(library) #include +#endif #include #include #include @@ -58,7 +60,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) #if defined(Q_OS_OPENBSD) typedef struct __res_state* res_state; @@ -382,6 +384,6 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN return; } -#endif /* ifndef QT_NO_LIBRARY */ +#endif /* QT_CONFIG(library) */ QT_END_NAMESPACE diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 7af8db73e0..cf08a15f96 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -45,7 +45,9 @@ #include "private/qnativesocketengine_p.h" #include "qiodevice.h" #include +#if QT_CONFIG(library) #include +#endif #include #include #include @@ -93,7 +95,7 @@ static res_state_ptr local_res = 0; static bool resolveLibraryInternal() { -#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX) +#if QT_CONFIG(library) && !defined(Q_OS_QNX) QLibrary lib; #ifdef LIBRESOLV_SO lib.setFileName(QStringLiteral(LIBRESOLV_SO)); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index aca7507d13..644dfdb6a8 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -78,7 +78,6 @@ #include #include #include -#include // for loading the security lib for the CA store #include @@ -530,7 +529,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() resetDefaultCiphers(); resetDefaultEllipticCurves(); -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) //load symbols needed to receive certificates from system store #if defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); @@ -558,7 +557,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() } } #endif -#endif //QT_NO_LIBRARY +#endif // QT_CONFIG(library) // if on-demand loading was not enabled, load the certs now if (!s_loadRootCertsOnDemand) setDefaultCaCertificates(systemCaCertificates()); diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 2a0d746fde..1b2419ef07 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -58,7 +58,7 @@ #ifdef Q_OS_WIN # include -#else +#elif QT_CONFIG(library) # include #endif #include @@ -125,7 +125,7 @@ void qsslSocketUnresolvedSymbolWarning(const char *functionName) qCWarning(lcSsl, "QSslSocket: cannot call unresolved function %s", functionName); } -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) void qsslSocketCannotResolveSymbolWarning(const char *functionName) { qCWarning(lcSsl, "QSslSocket: cannot resolve %s", functionName); @@ -468,12 +468,11 @@ DEFINEFUNC(void, PKCS12_free, PKCS12 *pkcs12, pkcs12, return, DUMMYARG) #if !defined QT_LINKED_OPENSSL -#ifdef QT_NO_LIBRARY +#if !QT_CONFIG(library) bool q_resolveOpenSslSymbols() { - qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. " - "QT_NO_LIBRARY is defined which means runtime resolving of " - "libraries won't work."); + qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. Qt is configured without the " + "'library' feature, which means runtime resolving of libraries won't work."); qCWarning(lcSsl, "Either compile Qt statically or with support for runtime resolving " "of libraries."); return false; @@ -1034,7 +1033,7 @@ bool q_resolveOpenSslSymbols() delete libs.second; return true; } -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(library) #else // !defined QT_LINKED_OPENSSL -- cgit v1.2.3