ruby: bump version to 2.4.1
[buildroot-gz.git] / package / qt / 0011-Link-with-ldl-option-only-when-it-is-supported.patch
blobf3d47f754e6930a0e935452ebbaa580207c216cb
1 From 438f088ad520ac91ae47dba9a515ab0d1088c89c Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
3 Date: Fri, 15 Apr 2016 03:32:02 +0200
4 Subject: [PATCH] Link with -ldl option only when it is supported
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 `-ldl` option is used unconditionally in `QMAKE_LIBS_DYNLOAD` while libdl is
10 not supported when libc is static. As the value of `QMAKE_LIBS_DYNLOAD` goes
11 into 'Libs.private' field of the pkgconfig files created by qmake, static
12 linking with qt will fail with:
13 /usr/bin/ld: cannot find -ldl
15 Fix this issue by adding a build test to configure to check if libdl is
16 supported. `QMAKE_LIBS_DYNLOAD` in "src/corelib/plugin/plugin.pri" is now used
17 only if libdl is available.
19 Backported from Qt5:
20 https://github.com/qtproject/qtbase/commit/f669ea0d54302de31456d57286aa0e4ca1443e98
22 Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
23 ---
24 config.tests/unix/libdl/libdl.cpp | 39 +++++++++++++++++++++++++++++++++++++++
25 config.tests/unix/libdl/libdl.pro | 3 +++
26 configure | 6 ++++++
27 src/corelib/plugin/plugin.pri | 2 +-
28 4 files changed, 49 insertions(+), 1 deletion(-)
29 create mode 100644 config.tests/unix/libdl/libdl.cpp
30 create mode 100644 config.tests/unix/libdl/libdl.pro
32 diff --git a/config.tests/unix/libdl/libdl.cpp b/config.tests/unix/libdl/libdl.cpp
33 new file mode 100644
34 index 0000000..28a8233
35 --- /dev/null
36 +++ b/config.tests/unix/libdl/libdl.cpp
37 @@ -0,0 +1,39 @@
38 +/****************************************************************************
39 +**
40 +** Copyright (C) 2015 The Qt Company Ltd.
41 +** Contact: http://www.qt.io/licensing/
42 +**
43 +** This file is part of the config.tests of the Qt Toolkit.
44 +**
45 +** $QT_BEGIN_LICENSE:LGPL21$
46 +** Commercial License Usage
47 +** Licensees holding valid commercial Qt licenses may use this file in
48 +** accordance with the commercial license agreement provided with the
49 +** Software or, alternatively, in accordance with the terms contained in
50 +** a written agreement between you and The Qt Company. For licensing terms
51 +** and conditions see http://www.qt.io/terms-conditions. For further
52 +** information use the contact form at http://www.qt.io/contact-us.
53 +**
54 +** GNU Lesser General Public License Usage
55 +** Alternatively, this file may be used under the terms of the GNU Lesser
56 +** General Public License version 2.1 or version 3 as published by the Free
57 +** Software Foundation and appearing in the file LICENSE.LGPLv21 and
58 +** LICENSE.LGPLv3 included in the packaging of this file. Please review the
59 +** following information to ensure the GNU Lesser General Public License
60 +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
61 +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
62 +**
63 +** As a special exception, The Qt Company gives you certain additional
64 +** rights. These rights are described in The Qt Company LGPL Exception
65 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
66 +**
67 +** $QT_END_LICENSE$
68 +**
69 +****************************************************************************/
71 +#include <dlfcn.h>
73 +int main(int, char **)
75 + dlopen(0, 0);
77 diff --git a/config.tests/unix/libdl/libdl.pro b/config.tests/unix/libdl/libdl.pro
78 new file mode 100644
79 index 0000000..a643934
80 --- /dev/null
81 +++ b/config.tests/unix/libdl/libdl.pro
82 @@ -0,0 +1,3 @@
83 +SOURCES = libdl.cpp
84 +CONFIG -= qt dylib
85 +LIBS += -ldl
86 \ No newline at end of file
87 diff --git a/configure b/configure
88 index 10ad7ca..1c70691 100755
89 --- a/configure
90 +++ b/configure
91 @@ -5506,6 +5506,12 @@ if [ "$CFG_LIBPNG" = "auto" ]; then
95 +# detect dl
96 +if ! compileTest unix/libdl "libdl"; then
97 + QMakeVar add DEFINES QT_NO_DYNAMIC_LIBRARY
98 + QMAKE_CONFIG="$QMAKE_CONFIG no-libdl"
99 +fi
101 # detect accessibility
102 if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
103 if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
104 diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri
105 index eb7a7f7..c342f2e 100644
106 --- a/src/corelib/plugin/plugin.pri
107 +++ b/src/corelib/plugin/plugin.pri
108 @@ -32,4 +32,4 @@ integrity {
109 SOURCES += plugin/qlibrary_unix.cpp
112 -LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
113 +!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
115 2.8.0