From 51c086b9cc4374fab0c5162fb5d31a11f8437984 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 5 Mar 2025 22:00:41 +0900 Subject: [PATCH] meson: use more features provided by newer meson No functional change. Preparation for future bump of required meson version. --- meson.build | 22 +++++++++++++++++----- test/fuzz/meson.build | 15 +++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index 26e3f2771fc..d87c651fc66 100644 --- a/meson.build +++ b/meson.build @@ -1245,18 +1245,30 @@ foreach ident : ['crypt_set_metadata_size', endforeach conf.set10('HAVE_LIBCRYPTSETUP', have) -# TODO: Use has_function(required : libcryptsetup_plugins) with meson >= 1.3.0 -if libcryptsetup_plugins.allowed() +if meson.version().version_compare('>=1.3.0') have = (cc.has_function( 'crypt_activate_by_token_pin', prefix : '#include ', - dependencies : libcryptsetup) and + dependencies : libcryptsetup, + required : libcryptsetup_plugins) and cc.has_function( 'crypt_token_external_path', prefix : '#include ', - dependencies : libcryptsetup)) + dependencies : libcryptsetup, + required : libcryptsetup_plugins)) else - have = false + if libcryptsetup_plugins.allowed() + have = (cc.has_function( + 'crypt_activate_by_token_pin', + prefix : '#include ', + dependencies : libcryptsetup) and + cc.has_function( + 'crypt_token_external_path', + prefix : '#include ', + dependencies : libcryptsetup)) + else + have = false + endif endif conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have) diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build index 54cbb75532d..d88d6218d2f 100644 --- a/test/fuzz/meson.build +++ b/test/fuzz/meson.build @@ -36,13 +36,16 @@ fuzz_regression_tests += { 'fuzz-unit-file' : dict } ############################################################ -# TODO: Use native string formatting with meson >= 1.3.0 -if get_option('auto_features').enabled() - sanitize_auto_features = 'enabled' -elif get_option('auto_features').disabled() - sanitize_auto_features = 'disabled' +if meson.version().version_compare('>=1.3.0') + sanitize_auto_features = '@0@'.format(get_option('auto_features')) else - sanitize_auto_features = 'auto' + if get_option('auto_features').enabled() + sanitize_auto_features = 'enabled' + elif get_option('auto_features').disabled() + sanitize_auto_features = 'disabled' + else + sanitize_auto_features = 'auto' + endif endif fuzz_c_args = get_option('c_args') -- 2.47.3