aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-10-20 14:34:27 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-05-18 13:35:28 +0200
commit13f60de816cc88577e2432014b84d702cc082160 (patch)
treeb558f2e43052539179f3683f7e8aa814d2cff738 /meson.build
parenta988b4c56143d90f98034daf176e416b08dddf36 (diff)
build: move compiler version check to meson
Use the slighly nicer .version_compare() function for GCC; for Clang that is not possible due to the mess that Apple does with version numbers. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build20
1 files changed, 20 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 2d3e468730..41c87c441f 100644
--- a/meson.build
+++ b/meson.build
@@ -190,6 +190,26 @@ endif
# Compiler flags #
##################
+foreach lang : all_languages
+ compiler = meson.get_compiler(lang)
+ if compiler.get_id() == 'gcc' and compiler.version().version_compare('>=7.4')
+ # ok
+ elif compiler.get_id() == 'clang' and compiler.compiles('''
+ #ifdef __apple_build_version__
+ # if __clang_major__ < 12 || (__clang_major__ == 12 && __clang_minor__ < 0)
+ # error You need at least XCode Clang v12.0 to compile QEMU
+ # endif
+ #else
+ # if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
+ # error You need at least Clang v10.0 to compile QEMU
+ # endif
+ #endif''')
+ # ok
+ else
+ error('You either need GCC v7.4 or Clang v10.0 (or XCode Clang v12.0) to compile QEMU')
+ endif
+endforeach
+
# default flags for all hosts
# We use -fwrapv to tell the compiler that we require a C dialect where
# left shift of signed integers is well defined and has the expected