summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2021-11-02 13:14:55 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2021-11-02 12:42:01 -0600
commit5291230e730f10bf14a6ae5068c5826fef615cd9 (patch)
tree6b6804f0265ea5d7c0105459422dc09b6dbf545a
parent15bb23abb7f44aa037b4d8f5fc6718d90ce3db0c (diff)
meson: Simplify finding OpenSSL
Remove duplicated calls to dependency() so we can have fallback in all cases.
-rw-r--r--meson.build23
1 files changed, 11 insertions, 12 deletions
diff --git a/meson.build b/meson.build
index 9d4d759..f4b4552 100644
--- a/meson.build
+++ b/meson.build
@@ -190,23 +190,21 @@ gthread_dep = dependency('gthread-2.0',
# Cryto library
opt_cryptolib = get_option('crypto-library')
message('Crypto library requested: ' + opt_cryptolib)
+crypto_dep = dependency('', required: false) # special always not found
if opt_cryptolib == 'auto' and host_machine.system() == 'windows'
crypto_dep = cc.find_library('advapi32')
-elif opt_cryptolib != 'openssl'
+ cdata.set('USE_WIN32_CRYPTO', crypto_dep.found())
+endif
+
+if not crypto_dep.found() and opt_cryptolib != 'openssl'
crypto_dep = dependency('gnutls', version: gnutls_req, required: false)
cdata.set('HAVE_GNUTLS', crypto_dep.found())
- 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())
- endif
-else
- crypto_dep = dependency('openssl', required: false)
+endif
+
+if not crypto_dep.found() and opt_cryptolib != 'gnutls'
+ crypto_dep = dependency('openssl', required: false,
+ fallback: ['openssl', 'openssl_dep'])
cdata.set('HAVE_OPENSSL', crypto_dep.found())
- if not crypto_dep.found() and opt_cryptolib == 'auto'
- crypto_dep = dependency('gnutls', version: gnutls_req, required: false)
- cdata.set('HAVE_GNUTLS', crypto_dep.found())
- endif
endif
crypto_found = crypto_dep.found()
@@ -240,6 +238,7 @@ if not crypto_found and opt_cryptolib != 'gnutls'
if libcrypto_dep.found() and libssl_dep.found()
crypto_dep = [libcrypto_dep, libssl_dep]
+ cdata.set('HAVE_OPENSSL', crypto_dep.found())
crypto_found = true
endif
endif