diff options
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r-- | ConfigureChecks.cmake | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 09af851..213e8ba 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -27,7 +27,28 @@ endif( WITH_GCC_VISIBILITY ) ##### check for OpenSSL -find_package( OpenSSL ) -if( NOT OPENSSL_FOUND ) - tde_message_fatal( "SSL support is required but OpenSSL was not found on your system" ) -endif( NOT OPENSSL_FOUND ) +pkg_search_module( SSL openssl ) + +if( NOT SSL_FOUND ) + check_include_file( openssl/ssl.h HAVE_OPENSSL_H ) + check_library_exists( ssl OPENSSL_init_ssl "" HAVE_LIBSSL_11 ) + check_library_exists( crypto EVP_EncryptInit_ex "" HAVE_LIBCRYPTO ) + + if( NOT HAVE_LIBSSL_11 ) + check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL ) + endif() + + if( HAVE_OPENSSL_H AND HAVE_LIBCRYPTO AND (HAVE_LIBSSL_11 OR HAVE_LIBSSL) ) + set( SSL_FOUND 1 CACHE INTERNAL "" FORCE ) + find_file( OPENSSLV_H openssl/opensslv.h ) + file( STRINGS "${OPENSSLV_H}" SSL_VERSION REGEX "#[ \t]*define[ \t]*OPENSSL_VERSION_TEXT" ) + string( REGEX REPLACE "# *define[ \t]*OPENSSL_VERSION_TEXT[ \t]*\"[^0-9 ]* *([^ ]*).*" "\\1" SSL_VERSION "${SSL_VERSION}" ) + set( SSL_VERSION "${SSL_VERSION}" CACHE INTERNAL "" FORCE ) + message( STATUS "Found OpenSSL: version ${SSL_VERSION}" ) + set( SSL_LIBRARIES "ssl;crypto" CACHE INTERNAL "ssl and crypto libs" FORCE ) + endif() +endif( NOT SSL_FOUND ) + +if( NOT SSL_FOUND ) + tde_message_fatal( "SSL support is required but OpenSSL was not found on your system" ) +endif( NOT SSL_FOUND ) |