Browse Source

Fix openssl >= 1.1 detection without pkg-config file.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Slávek Banko 1 month ago
parent
commit
b1b24c0b64
Signed by: Slávek Banko <slavek.banko@axis.cz> GPG Key ID: 608F5293A04BE668
1 changed files with 12 additions and 3 deletions
  1. 12
    3
      kcontrol/crypto/CMakeLists.txt

+ 12
- 3
kcontrol/crypto/CMakeLists.txt View File

@@ -17,11 +17,20 @@ if( WITH_SSL )
17 17
   pkg_search_module( SSL openssl )
18 18
   if( NOT SSL_FOUND )
19 19
     check_include_file( openssl/ssl.h HAVE_OPENSSL_H )
20
-    check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL )
20
+    check_library_exists( ssl OPENSSL_init_ssl "" HAVE_LIBSSL_11 )
21
+    if( NOT HAVE_LIBSSL_11 )
22
+      check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL )
23
+    endif( )
21 24
     check_library_exists( crypto EVP_EncryptInit_ex "" HAVE_LIBCRYPTO )
22
-    if( HAVE_OPENSSL_H AND HAVE_LIBSSL AND HAVE_LIBCRYPTO )
25
+    if( HAVE_OPENSSL_H AND (HAVE_LIBSSL_11 OR HAVEL_LIBSSL) AND HAVE_LIBCRYPTO )
23 26
       set( SSL_FOUND 1 CACHE INTERNAL "" FORCE )
24
-    endif( HAVE_OPENSSL_H AND HAVE_LIBSSL AND HAVE_LIBCRYPTO )
27
+      find_file( OPENSSLV_H openssl/opensslv.h )
28
+      file( STRINGS "${OPENSSLV_H}" SSL_VERSION REGEX "#[ \t]*define[ \t]*OPENSSL_VERSION_TEXT" )
29
+      string( REGEX REPLACE "# *define[ \t]*OPENSSL_VERSION_TEXT[ \t]*\"[^0-9 ]* *([^ ]*).*" "\\1"
30
+              SSL_VERSION "${SSL_VERSION}" )
31
+      set( SSL_VERSION "${SSL_VERSION}" CACHE INTERNAL "" FORCE )
32
+      message( STATUS "Found OpenSSL: version ${SSL_VERSION}" )
33
+    endif( HAVE_OPENSSL_H AND (HAVE_LIBSSL_11 OR HAVEL_LIBSSL) AND HAVE_LIBCRYPTO )
25 34
   endif( NOT SSL_FOUND )
26 35
   if( NOT SSL_FOUND )
27 36
     tde_message_fatal( "SSL support is requested, but openssl not found on your system" )

Loading…
Cancel
Save