]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: PKCS11
authorFred Morcos <fred.morcos@open-xchange.com>
Fri, 7 Jul 2023 10:07:24 +0000 (12:07 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:28 +0000 (13:28 +0100)
meson.build
meson/pkcs11/meson.build [new file with mode: 0644]
meson_options.txt

index 63f0557360697fe3d63d54b7f6ce8154f308ce89..3ba5f5cce5eedc37ec89c8a76ed993ab4dd90636 100644 (file)
@@ -51,6 +51,7 @@ subdir('meson/python-venv')     # Python Venv
 subdir('meson/from-git')        # From Git
 subdir('meson/dlopen')          # dlopen
 subdir('meson/verbose-logging') # Verbose Logging
+subdir('meson/pkcs11')          # PKCS11
 
 # Find or generate pdns/dnslabeltext.cc
 if not ragel.found() and not fs.exists('pdns/dnslabeltext.cc')
diff --git a/meson/pkcs11/meson.build b/meson/pkcs11/meson.build
new file mode 100644 (file)
index 0000000..8f899b2
--- /dev/null
@@ -0,0 +1,28 @@
+# PKCS11
+# Inputs: conf deps
+
+prog = '''
+#include <p11-kit/p11-kit.h>
+
+int main() {
+    void *foo = p11_kit_module_for_name(0, 0);
+    return 0;
+}
+'''
+
+opt_pkcs11 = get_option('pkcs11')
+conf.set10('PKCS11', opt_pkcs11, description: 'Whether to enable PKCS11 support (experimental)')
+
+if opt_pkcs11
+  dep_pkcs11 = dependency('p11-kit-1', required: opt_pkcs11)
+  conf.set10('HAVE_P11KIT1', dep_pkcs11.found(), description: 'Whether we have p11-kit-1')
+
+  has = cxx.links(prog, dependencies: dep_pkcs11, name: 'we can link to p11kit1')
+  conf.set10('HAVE_P11KIT1_V2', has, description: 'Whether we have p11-kit-1 0.20 or newer')
+
+  if not has
+    warning('Could not find p11-kit-1')
+  endif
+
+  deps += dep_pkcs11
+endif
index 21db1d8a3f81db87c01271f2022931931ee2409b..c0706472e8dd9cc80133bea89c96745769dc6d81 100644 (file)
@@ -15,3 +15,4 @@ option('reproducible', type: 'boolean', value: false, description: 'Create repro
 option('fuzz-targets', type: 'boolean', value: false, description: 'Enable fuzzing targets')
 option('sqlite3', type: 'boolean', value: false, description: 'Include the sqlite3 driver')
 option('verbose-logging', type: 'boolean', value: false, description: 'Enable verbose logging')
+option('pkcs11', type: 'boolean', value: false, description: 'Enable PKCS11 support (experimental)')