summaryrefslogtreecommitdiffstats
path: root/FindDL.cmake
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-07-01 20:45:25 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-07-01 20:45:25 +0200
commitfd68c0f047bbd40d02cad5a84584cc74979c993a (patch)
tree1c4b3f4a66d08ceed9cdf2f862a0222610a5b27f /FindDL.cmake
parent664b4dd6ebfac5cb3bf3412a6d81a8f04b8d23b3 (diff)
downloadmad-fd68c0f047bbd40d02cad5a84584cc74979c993a.tar
mad-fd68c0f047bbd40d02cad5a84584cc74979c993a.zip
ModuleManager: Benutze libdl anstatt ltdl
Diffstat (limited to 'FindDL.cmake')
-rw-r--r--FindDL.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/FindDL.cmake b/FindDL.cmake
new file mode 100644
index 0000000..584650f
--- /dev/null
+++ b/FindDL.cmake
@@ -0,0 +1,37 @@
+# - Find dl functions
+# This module finds dl libraries.
+#
+# It sets the following variables:
+# DL_FOUND - Set to false, or undefined, if dl libraries aren't found.
+# DL_INCLUDE_DIR - The dl include directory.
+# DL_LIBRARY - The dl library to link against.
+
+INCLUDE(CheckFunctionExists)
+
+FIND_PATH(DL_INCLUDE_DIR NAMES dlfcn.h)
+FIND_LIBRARY(DL_LIBRARY NAMES dl)
+
+IF (DL_LIBRARY)
+ SET(DL_FOUND TRUE)
+ELSE (DL_LIBRARY)
+ # if dlopen can be found without linking in dl then,
+ # dlopen is part of libc, so don't need to link extra libs.
+ CHECK_FUNCTION_EXISTS(dlopen DL_FOUND)
+ SET(DL_LIBRARY "")
+ENDIF (DL_LIBRARY)
+
+IF (DL_FOUND)
+
+ # show which dl was found only if not quiet
+ IF (NOT DL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found dl: ${DL_LIBRARY}")
+ ENDIF (NOT DL_FIND_QUIETLY)
+
+ELSE (DL_FOUND)
+
+ # fatal error if dl is required but not found
+ IF (DL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find dl")
+ ENDIF (DL_FIND_REQUIRED)
+
+ENDIF (DL_FOUND)