diff options
author | Andreas Schneider <asn@samba.org> | 2018-09-27 18:31:26 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2018-10-23 15:38:58 +0200 |
commit | 702f2fb52f90273b86ef6d1f117814bd08fcc542 (patch) | |
tree | d9a6535673fe50efd8143b0598b07effbf6a7e36 /ConfigureChecks.cmake | |
parent | 62080ac13dd2c5e38c49412bced652f1b314bda0 (diff) | |
download | socket_wrapper-702f2fb52f90273b86ef6d1f117814bd08fcc542.tar.gz socket_wrapper-702f2fb52f90273b86ef6d1f117814bd08fcc542.tar.xz socket_wrapper-702f2fb52f90273b86ef6d1f117814bd08fcc542.zip |
cmake: Fix checking for required system libraries
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r-- | ConfigureChecks.cmake | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 9ced360..cb5bf53 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -70,25 +70,33 @@ check_function_exists(pledge HAVE_PLEDGE) if (UNIX) + find_library(DLFCN_LIBRARY dl) + if (DLFCN_LIBRARY) + string(APPEND _REQUIRED_LIBRARIES ${DLFCN_LIBRARY}) + else() + check_function_exists(dlopen HAVE_DLOPEN) + if (NOT HAVE_DLOPEN) + message(FATAL_ERROR "FATAL: No dlopen() function detected") + endif() + endif() + if (NOT LINUX) # libsocket (Solaris) check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET) if (HAVE_LIBSOCKET) - set(_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} socket) + string(APPEND _REQUIRED_LIBRARIES socket) endif (HAVE_LIBSOCKET) # libnsl/inet_pton (Solaris) check_library_exists(nsl inet_pton "" HAVE_LIBNSL) if (HAVE_LIBNSL) - set(_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} nsl) + string(APPEND _REQUIRED_LIBRARIES nsl) endif (HAVE_LIBNSL) endif (NOT LINUX) check_function_exists(getaddrinfo HAVE_GETADDRINFO) endif (UNIX) -set(SWRAP_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} CACHE INTERNAL "socket_wrapper required system libraries") - # STRUCTS check_struct_has_member("struct in_pktinfo" ipi_addr "sys/types.h;sys/socket.h;netinet/in.h" HAVE_STRUCT_IN_PKTINFO) set(CMAKE_REQUIRED_FLAGS -D_GNU_SOURCE) @@ -250,12 +258,6 @@ int main(void) { unset(CMAKE_REQUIRED_FLAGS) ########################################################### -check_library_exists(dl dlopen "" HAVE_LIBDL) -if (HAVE_LIBDL) - find_library(DLFCN_LIBRARY dl) - set(_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} ${DLFCN_LIBRARY}) -endif (HAVE_LIBDL) - if (OSX) set(HAVE_APPLE 1) endif (OSX) @@ -267,4 +269,4 @@ endif (NOT WIN32) check_type_size(pid_t SIZEOF_PID_T) -set(SWRAP_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} CACHE INTERNAL "swrap required system libraries") +set(SWRAP_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} CACHE INTERNAL "socket_wrapper required system libraries") |