cmake: Fix configure check for libdl
authorAndreas Schneider <asn@samba.org>
Tue, 7 May 2019 10:46:47 +0000 (12:46 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 3 Jun 2019 10:54:22 +0000 (12:54 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@samba.org>
ConfigureChecks.cmake

index 263da900955e291d40ebc7ee253892881d21e659..444de9b81125450eab784a03efbd859930dfc678 100644 (file)
@@ -217,11 +217,15 @@ int main(void) {
 
 # SYSTEM LIBRARIES
 
-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()
 
 if (OSX)
     set(HAVE_APPLE 1)