summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorPaolo Bonzini2021-11-04 14:35:14 +0100
committerPaolo Bonzini2021-11-08 10:55:58 +0100
commit565174d08ed34a849f8420f0d9c97d08be3835aa (patch)
treea728e7e4c252353a07f52cd5ec26a18f55e03176 /meson.build
parenthw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands (diff)
downloadqemu-565174d08ed34a849f8420f0d9c97d08be3835aa.tar.gz
qemu-565174d08ed34a849f8420f0d9c97d08be3835aa.tar.xz
qemu-565174d08ed34a849f8420f0d9c97d08be3835aa.zip
meson: perform snappy test with the C++ compiler if used
Snappy is written in C++ and as such needs to link against libstdc++. When linking statically, this means that the compile test cannot succeed unless performed with a C++ compiler. Do so if link_language is set to C++; if it is C, the test will usually fail and snappy will be disabled. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build6
1 files changed, 5 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 47df10afc2..6bfed294d0 100644
--- a/meson.build
+++ b/meson.build
@@ -197,6 +197,10 @@ add_project_arguments('-iquote', '.',
link_language = meson.get_external_property('link_language', 'cpp')
if link_language == 'cpp'
add_languages('cpp', required: true, native: false)
+ cxx = meson.get_compiler('cpp')
+ linker = cxx
+else
+ linker = cc
endif
if host_machine.system() == 'darwin'
add_languages('objc', required: false, native: false)
@@ -1109,7 +1113,7 @@ if not get_option('snappy').auto() or have_system
required: get_option('snappy'),
kwargs: static_kwargs)
endif
-if snappy.found() and not cc.links('''
+if snappy.found() and not linker.links('''
#include <snappy-c.h>
int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy)
snappy = not_found