summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-11-02 19:16:36 +0000
committerOlivier Crête <olivier.crete@collabora.com>2018-12-14 14:47:01 -0500
commitfefe511922f8831377020810cb3f09e227c16690 (patch)
tree67096e054d398c141270e62b138473cebe5dc730 /meson.build
parent0e0f89d2b916dc0475787e0970bb692882ee3de2 (diff)
meson: allow selecting crypto library manually via an option
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build32
1 files changed, 30 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index f57a669..7233dea 100644
--- a/meson.build
+++ b/meson.build
@@ -165,10 +165,38 @@ foreach w : warnings
endforeach
# Dependencies
-gnutls_dep = dependency('gnutls', version: gnutls_req)
glib_dep = dependency('gio-2.0', version: glib_req)
gthread_dep = dependency('gthread-2.0')
+# Cryto library
+opt_cryptolib = get_option('crypto-library')
+message('Crypto library: ' + 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
+ crypto_dep = dependency('openssl', required: false)
+ cdata.set('HAVE_OPENSSL', crypto_dep.found())
+ endif
+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
+ crypto_dep = dependency('gnutls', version: gnutls_req, required: false)
+ cdata.set('HAVE_GNUTLS', crypto_dep.found())
+ endif
+endif
+
+if not crypto_dep.found()
+ error('Either GnuTLS or OpenSSL is required as crypto library, but neither was found')
+endif
+
# GStreamer
gst_dep = dependency('gstreamer-base-1.0', version: gst_req,
required: get_option('gstreamer'),
@@ -184,7 +212,7 @@ libm = cc.find_library('m', required: false)
nice_incs = include_directories('.', 'agent', 'random', 'socket', 'stun')
-nice_deps = [glib_dep, gthread_dep, gnutls_dep, gupnp_igd_dep] + syslibs
+nice_deps = [glib_dep, gthread_dep, crypto_dep, gupnp_igd_dep] + syslibs
ignored_iface_prefix = get_option('ignored-network-interface-prefix')
if ignored_iface_prefix != ''