cmake: Fix configure check for libdl
authorAndreas Schneider <asn@samba.org>
Fri, 15 Feb 2019 12:26:42 +0000 (13:26 +0100)
committerAndreas Schneider <asn@samba.org>
Thu, 28 Feb 2019 11:49:23 +0000 (12:49 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
ConfigureChecks.cmake

index 2d90f8fadfb14d19829edb51d512ed53afd302a7..040aaee7bad7869f543c0a6a3f7ac788c41e8570 100644 (file)
@@ -259,11 +259,15 @@ int main(void) {
     return 0;
 }" HAVE_DESTRUCTOR_ATTRIBUTE)
 
-check_library_exists(dl dlopen "" HAVE_LIBDL)
-if (HAVE_LIBDL)
-    find_library(DLFCN_LIBRARY dl)
+find_library(DLFCN_LIBRARY dl)
+if (DLFCN_LIBRARY)
     list(APPEND _REQUIRED_LIBRARIES ${DLFCN_LIBRARY})
-endif (HAVE_LIBDL)
+else()
+    check_function_exists(dlopen HAVE_DLOPEN)
+    if (NOT HAVE_DLOPEN)
+        message(FATAL_ERROR "FATAL: No dlopen() function detected")
+    endif()
+endif()
 
 # ENDIAN
 if (NOT WIN32)