|
|
84a160 |
From 635ab930f6185d1ec3e4d99109e2edf0533b0d00 Mon Sep 17 00:00:00 2001
|
|
|
84a160 |
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
|
|
|
84a160 |
Date: Wed, 23 Jun 2021 21:03:15 +0200
|
|
|
84a160 |
Subject: [PATCH] testDynamicLoader: Use LIBDL_SO macro if defined.
|
|
|
84a160 |
MIME-Version: 1.0
|
|
|
84a160 |
Content-Type: text/plain; charset=UTF-8
|
|
|
84a160 |
Content-Transfer-Encoding: 8bit
|
|
|
84a160 |
|
|
|
84a160 |
Starting with glibc v2.34 there is no external version of libdl.so
|
|
|
84a160 |
anymore. It has been merged into the glibc libc.so.
|
|
|
84a160 |
|
|
|
84a160 |
Assuming libdl.so will be present will break the test, thus the
|
|
|
84a160 |
LIBDL_SO macro should be used. If the macro is not defined on
|
|
|
84a160 |
the system, we ensure it will be defined using the previously
|
|
|
84a160 |
hardcoded value.
|
|
|
84a160 |
|
|
|
84a160 |
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
|
|
|
84a160 |
---
|
|
|
84a160 |
cmake-3.20.4/Source/kwsys/testDynamicLoader.cxx | 14 ++++++++++++--
|
|
|
84a160 |
1 file changed, 12 insertions(+), 2 deletions(-)
|
|
|
84a160 |
|
|
|
84a160 |
Index: cmake-3.21.0-rc1/Source/kwsys/testDynamicLoader.cxx
|
|
|
84a160 |
===================================================================
|
|
|
84a160 |
--- cmake-3.21.0-rc1.orig/Source/kwsys/testDynamicLoader.cxx
|
|
|
84a160 |
+++ cmake-3.21.0-rc1/Source/kwsys/testDynamicLoader.cxx
|
|
|
84a160 |
@@ -8,6 +8,25 @@
|
|
|
84a160 |
# include <be/kernel/OS.h> /* disable_debugger() API. */
|
|
|
84a160 |
#endif
|
|
|
84a160 |
|
|
|
84a160 |
+// Needed for __GLIBC__ test macro.
|
|
|
84a160 |
+#ifdef __linux__
|
|
|
84a160 |
+# include <features.h>
|
|
|
84a160 |
+#endif
|
|
|
84a160 |
+
|
|
|
84a160 |
+// Will define LIBDL_SO macro on systems with glibc.
|
|
|
84a160 |
+#ifdef __GLIBC__
|
|
|
84a160 |
+# include <gnu/lib-names.h>
|
|
|
84a160 |
+// Define to LIBC_SO, if not defined by above header.
|
|
|
84a160 |
+# ifndef LIBDL_SO
|
|
|
84a160 |
+# define LIBDL_SO LIBC_SO
|
|
|
84a160 |
+# endif
|
|
|
84a160 |
+#endif
|
|
|
84a160 |
+
|
|
|
84a160 |
+// Define the LIBDL_SO macro, if not defined above.
|
|
|
84a160 |
+#ifndef LIBDL_SO
|
|
|
84a160 |
+# define LIBDL_SO "libdl.so"
|
|
|
84a160 |
+#endif
|
|
|
84a160 |
+
|
|
|
84a160 |
// Work-around CMake dependency scanning limitation. This must
|
|
|
84a160 |
// duplicate the above list of headers.
|
|
|
84a160 |
#if 0
|
|
|
84a160 |
@@ -107,8 +126,8 @@ int testDynamicLoader(int argc, char* ar
|
|
|
84a160 |
// This one is actually fun to test, since dlopen is by default
|
|
|
84a160 |
// loaded...wonder why :)
|
|
|
84a160 |
res += TestDynamicLoader("foobar.lib", "dlopen", 0, 1, 0);
|
|
|
84a160 |
- res += TestDynamicLoader("libdl.so", "dlopen", 1, 1, 1);
|
|
|
84a160 |
- res += TestDynamicLoader("libdl.so", "TestDynamicLoader", 1, 0, 1);
|
|
|
84a160 |
+ res += TestDynamicLoader(LIBDL_SO, "dlopen", 1, 1, 1);
|
|
|
84a160 |
+ res += TestDynamicLoader(LIBDL_SO, "TestDynamicLoader", 1, 0, 1);
|
|
|
84a160 |
#endif
|
|
|
84a160 |
// Now try on the generated library
|
|
|
84a160 |
std::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");
|