[epiphany] meson: check if nettle uses mini-gmp, loosen check accordingly



commit 3819085c5e2813430ecb982923cc1f52dda33c86
Author: Daniel Kolesa <daniel octaforge org>
Date:   Fri Jan 7 17:24:17 2022 +0100

    meson: check if nettle uses mini-gmp, loosen check accordingly
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1058>

 lib/sync/ephy-sync-crypto.c |  5 +++++
 meson.build                 | 16 +++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/lib/sync/ephy-sync-crypto.c b/lib/sync/ephy-sync-crypto.c
index a2308e816..8ea85b9a3 100644
--- a/lib/sync/ephy-sync-crypto.c
+++ b/lib/sync/ephy-sync-crypto.c
@@ -32,8 +32,13 @@
 #include <nettle/cbc.h>
 #include <nettle/hkdf.h>
 #include <nettle/hmac.h>
+#include <nettle/bignum.h>
 #include <string.h>
 
+#if !NETTLE_USE_MINI_GMP
+#include <gmp.h>
+#endif
+
 #define HAWK_VERSION  1
 #define NONCE_LEN     6
 #define IV_LEN        16
diff --git a/meson.build b/meson.build
index 6e50f83b7..ed3cb57ae 100644
--- a/meson.build
+++ b/meson.build
@@ -130,7 +130,21 @@ config_h = declare_dependency(
 )
 
 cc = meson.get_compiler('c')
-gmp_dep = cc.find_library('gmp')
+
+mini_gmp_test = '''
+#include <nettle/bignum.h>
+
+#if !NETTLE_USE_MINI_GMP
+# error "gmp is needed"
+#endif
+'''
+
+if cc.compiles(mini_gmp_test, dependencies: hogweed_dep)
+  gmp_dep = dependency('', required: false)
+else
+  gmp_dep = cc.find_library('gmp')
+endif
+
 m_dep = cc.find_library('m', required: false)
 
 cflags = cc.get_supported_arguments(['-Werror=declaration-after-statement',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]