Commit 549f9576 authored by Olivier Crête's avatar Olivier Crête
Browse files

meson: Add non-pkgconfig test for OpenSSL

This makes it work with Windows MSVC builds of OpenSSL which
don't include a pkg-config file.
parent 48bb9711
......@@ -186,14 +186,11 @@ gthread_dep = dependency('gthread-2.0',
# Cryto library
opt_cryptolib = get_option('crypto-library')
message('Crypto library: ' + opt_cryptolib)
message('Crypto librar requested: ' + opt_cryptolib)
if opt_cryptolib != 'openssl'
crypto_dep = dependency('gnutls', version: gnutls_req, required: false)
cdata.set('HAVE_GNUTLS', crypto_dep.found())
if not crypto_dep.found()
if opt_cryptolib != 'auto'
error('GnuTLS requested as crypto library, but not found')
endif
if not crypto_dep.found() and opt_cryptolib == 'auto'
crypto_dep = dependency('openssl', required: false,
fallback: ['openssl', 'openssl_dep'])
cdata.set('HAVE_OPENSSL', crypto_dep.found())
......@@ -201,17 +198,53 @@ if opt_cryptolib != 'openssl'
else
crypto_dep = dependency('openssl', required: false)
cdata.set('HAVE_OPENSSL', crypto_dep.found())
if not crypto_dep.found()
if opt_cryptolib != 'auto'
error('OpenSSL requested as crypto library, but not found')
endif
if not crypto_dep.found() and openssl == 'auto'
crypto_dep = dependency('gnutls', version: gnutls_req, required: false)
cdata.set('HAVE_GNUTLS', crypto_dep.found())
endif
endif
if not crypto_dep.found() and opt_cryptolib != 'gnutls'
# MSVC builds of OpenSSL does not generate pkg-config files,
# so we check for it manually here in this case, if we can't find those files
# Based on the CMake check for OpenSSL in CURL's CMakeLists.txt,
# on which headers we should check for
openssl_headers = []
foreach h : ['crypto.h', 'engine.h', 'err.h', 'pem.h',
'rsa.h', 'ssl.h', 'x509.h', 'rand.h', 'tls1.h']
openssl_headers += 'openssl/' + h
endforeach
# OpenSSL 1.1.x and 1.0.x (or earlier) have different .lib names,
# so we need to look for the correct pair
# Find either libcrypto.lib (1.1.x) or libeay32.lib (1.0.x or earlier) first
libcrypto_dep = cc.find_library('crypto', required: false)
if libcrypto_dep.found()
libssl = 'ssl'
else
libcrypto_dep = cc.find_library('eay32', required: false)
libssl = 'ssleay32'
endif
if libcrypto_dep.found()
# Find the corresponding SSL library depending on which crypto .lib we found
libssl_dep = cc.find_library(libssl, required: false, has_headers: openssl_headers)
endif
if libcrypto_dep.found() and libssl_dep.found()
crypto_dep = [libcrypto_dep, libssl_dep]
endif
endif
if not crypto_dep.found()
if opt_cryptolib == 'gnutls'
error('GnuTLS requested as crypto library, but not found')
elif opt_cryptolib == 'gnutls'
error('OpenSSL requested as crypto library, but not found')
else
error('Either GnuTLS or OpenSSL is required as crypto library, but neither was found')
endif
endif
# GStreamer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment