diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-27 14:37:17 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-27 14:37:17 -0800 |
commit | 76aeb920f4698a9544c32da50fc3b84cdc080ae7 (patch) | |
tree | 03f78326990459f94b60b101d0bf553456761705 /rpcapd/CMakeLists.txt | |
parent | 20cf0cba9bf55227460884fe7adef0134acd67bf (diff) | |
download | libpcap-76aeb920f4698a9544c32da50fc3b84cdc080ae7.tar.gz |
Look for getaddrinfo() in additional libraries.
Solaris doesn't put everything into the system library.
Diffstat (limited to 'rpcapd/CMakeLists.txt')
-rw-r--r-- | rpcapd/CMakeLists.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rpcapd/CMakeLists.txt b/rpcapd/CMakeLists.txt index 0b6e9033..643e7a8a 100644 --- a/rpcapd/CMakeLists.txt +++ b/rpcapd/CMakeLists.txt @@ -22,6 +22,29 @@ if(WIN32 OR ((CMAKE_USE_PTHREADS_INIT OR PTHREADS_FOUND) AND HAVE_CRYPT)) # Do we have getspnam()? # check_function_exists(getspnam HAVE_GETSPNAM) + + # + # Find library needed for getaddrinfo. + # NOTE: if you hand check_library_exists as its last argument a variable + # that's been set, it skips the test, so we need different variables. + # + include(CheckLibraryExists) + check_function_exists(getaddrinfo STDLIBS_HAVE_GETADDRINFO) + if(NOT STDLIBS_HAVE_GETADDRINFO) + check_library_exists(xnet getaddrinfo "" LIBXNET_HAS_GETADDRINFO) + if(LIBXNET_HAS_GETADDRINFO) + set(RPCAPD_LINK_LIBRARIES ${RPCAPD_LINK_LIBRARIES} xnet) + else(LIBXNET_HAS_GETADDRINFO) + include(CMakePushCheckState) + cmake_push_check_state() + set(CMAKE_REQUIRED_LIBRARIES nsl) + check_library_exists(socket getaddrinfo "" LIBSOCKET_HAS_GETADDRINFO) + cmake_pop_check_state() + if(LIBSOCKET_HAS_GETADDRINFO) + set(RPCAPD_LINK_LIBRARIES ${RPCAPD_LINK_LIBRARIES} socket nsl) + endif(LIBSOCKET_HAS_GETADDRINFO) + endif(LIBXNET_HAS_GETADDRINFO) + endif(NOT STDLIBS_HAVE_GETADDRINFO) endif(UNIX) if(WIN32) |