From b87df9043ce44dd2de36a09846be2e398a827aad Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 8 Nov 2021 13:52:11 +0100 Subject: configure, meson: move membarrier test to meson The test is a bit different from the others, in that it does not run if $membarrier is empty. For meson, the default can simply be disabled; if one day we will toggle the default, no change is needed in meson.build. Signed-off-by: Paolo Bonzini --- meson.build | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 7a262051b7..6dc38a7916 100644 --- a/meson.build +++ b/meson.build @@ -1808,6 +1808,26 @@ config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \ int main(int argc, char *argv[]) { return bar(argv[0]); } '''), error_message: 'AVX512F not available').allowed()) +if get_option('membarrier').disabled() + have_membarrier = false +elif targetos == 'windows' + have_membarrier = true +elif targetos == 'linux' + have_membarrier = cc.compiles(''' + #include + #include + #include + #include + int main(void) { + syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); + syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); + exit(0); + }''') +endif +config_host_data.set('CONFIG_MEMBARRIER', get_option('membarrier') \ + .require(have_membarrier, error_message: 'membarrier system call not available') \ + .allowed()) + config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' #include #include @@ -3331,7 +3351,7 @@ summary_info += {'link-time optimization (LTO)': get_option('b_lto')} summary_info += {'PIE': get_option('b_pie')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} summary_info += {'malloc trim support': has_malloc_trim} -summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} +summary_info += {'membarrier': have_membarrier} summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} summary_info += {'memory allocator': get_option('malloc')} -- cgit v1.2.3