From 4925611808ccb524a6c0bd225fb39b52ae1cf1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 30 Aug 2015 14:39:55 +0200 Subject: [PATCH] Fix dlerror and crypt detection for CMake build This resolves Bug 654 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9465a9c0..0560e7b44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -397,7 +397,28 @@ check_function_exists( madvise HAVE_MADVISE ) check_function_exists( getgroups HAVE_GETGROUPS ) check_function_exists( getcwd HAVE_GETCWD ) check_function_exists( dlerror HAVE_DLERROR ) +if( NOT HAVE_DLERROR ) + check_library_exists( dl dlerror "" HAVE_DLERROR_LIB ) + if( HAVE_DLERROR_LIB ) + set( HAVE_DLERROR 1 ) + set( DLERROR_LIBRARIES dl ) + endif( HAVE_DLERROR_LIB ) +endif( NOT HAVE_DLERROR ) check_function_exists( crypt HAVE_CRYPT ) +if( NOT HAVE_CRYPT ) + check_library_exists( crypt crypt "" HAVE_CRYPT_LIB ) + if( HAVE_CRYPT_LIB ) + set( HAVE_CRYPT 1 ) + set( CRYPT_LIBRARIES crypt ) + endif( HAVE_CRYPT_LIB ) +endif( NOT HAVE_CRYPT ) +if( NOT HAVE_CRYPT ) + check_library_exists( c crypt "" HAVE_CRYPT_LIBC ) + if( HAVE_CRYPT_LIBC ) + set( HAVE_CRYPT 1 ) + set( CRYPT_LIBRARIES c ) + endif( HAVE_CRYPT_LIBC ) +endif( NOT HAVE_CRYPT ) check_function_exists( bcopy HAVE_BCOPY ) check_function_exists( mmap HAVE_MMAP ) check_function_exists( munmap HAVE_MUNMAP )