streamline libdl detection and linking

instead of having a library and a test, use a library with two sources,
the first being empty (i.e., just libc). this allows us doing away with
the "libdl" feature, and using just the "dlopen" one.

subsequently, replace all LIBS+=$$QMAKE_LIBS_DYNLOAD with
QMAKE_USE+=libdl.
the definitions of QMAKE_LIBS_DYNLOAD remain in the qmakespecs for
backwards compat only. n.b.: the only specs where it is not empty or
"-ldl" (i.e., what we support now) are the hpux ones, where the library
is called 'dld'.

technically, the "library" feature should depend on '!unix || dlopen', but
that's for a later patch.

Change-Id: Ib8546affc4b7bc757f1a76729573ddd00e152176
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
bb10
Oswald Buddenhagen 2017-02-10 17:39:47 +01:00
parent 1b81f93183
commit 0d7ed8f5f3
6 changed files with 9 additions and 20 deletions

View File

@ -74,10 +74,10 @@
]
},
"libdl": {
"label": "dlopen() in libdl",
"export": "",
"label": "dlopen()",
"test": "unix/dlopen",
"sources": [
"",
"-ldl"
]
},
@ -131,11 +131,6 @@
"type": "compile",
"test": "unix/cloexec"
},
"dlopen": {
"label": "dlopen() in libc",
"type": "compile",
"test": "unix/dlopen"
},
"eventfd": {
"label": "eventfd",
"type": "compile",
@ -211,12 +206,8 @@
},
"dlopen": {
"label": "dlopen()",
"condition": "tests.dlopen || libs.libdl"
},
"libdl": {
"label": "dlopen() in libdl",
"condition": "!tests.dlopen && libs.libdl",
"output": [ { "type": "privateConfig", "negative": true } ]
"condition": "config.unix && libs.libdl",
"output": [ "privateFeature" ]
},
"doubleconversion": {
"label": "DoubleConversion",

View File

@ -35,4 +35,4 @@ integrity {
SOURCES += plugin/qlibrary_unix.cpp
}
!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl

View File

@ -38,6 +38,6 @@ qtConfig(xlib) {
}
CONFIG += egl
LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
qtConfig(dlopen): QMAKE_USE += libdl
load(qt_module)

View File

@ -17,8 +17,6 @@ QT += \
qtHaveModule(input_support-private): \
QT += input_support-private
LIBS += $$QMAKE_LIBS_DYNLOAD
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11

View File

@ -54,7 +54,7 @@
#include <QtGlxSupport/private/qglxconvenience_p.h>
#include <QtPlatformHeaders/QGLXNativeContext>
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
#if !defined(QT_STATIC) && QT_CONFIG(dlopen)
#include <dlfcn.h>
#endif
@ -564,7 +564,7 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
if (!glXGetProcAddressARB) {
QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' ');
if (glxExt.contains("GLX_ARB_get_proc_address")) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
#if QT_CONFIG(dlopen)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB");

View File

@ -12,7 +12,7 @@ qtConfig(xcb-glx) {
QMAKE_USE += xcb_glx
}
LIBS += $$QMAKE_LIBS_DYNLOAD
!static:qtConfig(dlopen): QMAKE_USE += libdl
HEADERS += \
qxcbglxintegration.h \