meson, configure: move keyctl test to meson
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/meson.build b/meson.build
index 9c03436..64161df 100644
--- a/meson.build
+++ b/meson.build
@@ -1940,6 +1940,19 @@
return getauxval(AT_HWCAP) == 0;
}'''))
+have_keyring = get_option('keyring') \
+ .require(targetos == 'linux', error_message: 'keyring is only available on Linux') \
+ .require(cc.compiles('''
+ #include <errno.h>
+ #include <asm/unistd.h>
+ #include <linux/keyctl.h>
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ int main(void) {
+ return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
+ }'''), error_message: 'keyctl syscall not available on this system').allowed()
+config_host_data.set('CONFIG_SECRET_KEYRING', have_keyring)
+
have_cpuid_h = cc.links('''
#include <cpuid.h>
int main(void) {
@@ -3698,7 +3711,7 @@
endif
summary_info += {'AF_ALG support': have_afalg}
summary_info += {'rng-none': get_option('rng_none')}
-summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
+summary_info += {'Linux keyring': have_keyring}
summary(summary_info, bool_yn: true, section: 'Crypto')
# Libraries