]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3553] Added botan check
authorFrancis Dupont <fdupont@isc.org>
Wed, 26 Mar 2025 09:30:04 +0000 (10:30 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 22 Jul 2025 14:49:16 +0000 (16:49 +0200)
compiler-checks/botan-hash.cc [new file with mode: 0644]
meson.build

diff --git a/compiler-checks/botan-hash.cc b/compiler-checks/botan-hash.cc
new file mode 100644 (file)
index 0000000..8b496bc
--- /dev/null
@@ -0,0 +1,7 @@
+#include <botan/hash.h>
+using namespace Botan;
+auto h = HashFunction::create("MD5");
+
+int main() {
+    return 0;
+}
index a281aa851a2093de0ee7372ded861bd8d2f1b4aa..24ab9b5bd76a8e661a9144d57ebcb3f008f5673a 100644 (file)
@@ -223,15 +223,9 @@ LOG4CPLUS_DEP = dependency('log4cplus', fallback: ['log4cplus', 'log4cplus'])
 CRYPTO_DEP = disabler()
 botan = disabler()
 foreach dep : ['botan-3', 'botan']
-    botan = dependency(dep, required: false)
+    botan = dependency(dep, version: '>=3.4.0', required: false)
     if botan.found()
-        version = botan.version()
-        if version.version_compare('<3.4.0')
-            message(f'Rejecting too old Botan (@version@ < 3.4.0)')
-            botan = disabler()
-        else
-            break
-        endif
+        break
     endif
 endforeach
 openssl = dependency('openssl', required: false)
@@ -411,7 +405,6 @@ if cpp_standard.version_compare('<201400')
         error('\n'.join(msgs))
     endif
 endif
-# Add Botan 3 to this.
 if NETCONF_DEP.found() and cpp_standard.version_compare('<202000')
     msgs = ['NETCONF dependency requires at least C++20.']
     if cpp_std_opt == 'none'
@@ -427,6 +420,15 @@ if NETCONF_DEP.found() and cpp_standard.version_compare('<202000')
         NETCONF_DEP = disabler()
     endif
 endif
+if CRYPTO_DEP.name() == botan.name() and cpp_standard.version_compare('<202000')
+    msgs = ['Botan dependency requires at least C++20.']
+    if cpp_std_opt == 'none'
+        msgs += no_cpp_std_opt_msg
+    else
+        msgs += cpp_std_opt_msg
+    endif
+    error('\n'.join(msgs))
+endif
 
 result = cpp.run(
     fs.read('compiler-checks/boost-has-threads.cc'),
@@ -470,6 +472,17 @@ if CRYPTO_DEP.name() == openssl.name()
     endif
 endif
 
+if CRYPTO_DEP.name() == botan.name()
+    result = cpp.run(
+        fs.read('compiler-checks/botan-hash.cc'),
+        name: 'CHECK_BOTAN_LIBRARY',
+        dependencies: [boost_dep, CRYPTO_DEP, threads_dep],
+    )
+    if result.returncode() != 0
+        error('Botan library does not work.')
+    endif
+endif
+
 result = cpp.run(
     fs.read('compiler-checks/have-optreset.cc'),
     name: 'HAVE_OPTRESET',