mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-05 02:29:49 +00:00
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>
This commit is contained in:
parent
a988b4c561
commit
13f60de816
25
configure
vendored
25
configure
vendored
|
@ -1128,31 +1128,6 @@ if test "$targetos" = "bogus"; then
|
||||||
error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
|
error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check whether the compiler matches our minimum requirements:
|
|
||||||
cat > $TMPC << EOF
|
|
||||||
#if defined(__clang_major__) && defined(__clang_minor__)
|
|
||||||
# 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
|
|
||||||
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
|
|
||||||
# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
|
|
||||||
# error You need at least GCC v7.4.0 to compile QEMU
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# error You either need GCC or Clang to compiler QEMU
|
|
||||||
#endif
|
|
||||||
int main (void) { return 0; }
|
|
||||||
EOF
|
|
||||||
if ! compile_prog "" "" ; then
|
|
||||||
error_exit "You need at least GCC v7.4 or Clang v10.0 (or XCode Clang v12.0)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$static" = "yes" ; then
|
if test "$static" = "yes" ; then
|
||||||
if test "$plugins" = "yes"; then
|
if test "$plugins" = "yes"; then
|
||||||
error_exit "static and plugins are mutually incompatible"
|
error_exit "static and plugins are mutually incompatible"
|
||||||
|
|
20
meson.build
20
meson.build
|
@ -190,6 +190,26 @@ endif
|
||||||
# Compiler flags #
|
# 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
|
# default flags for all hosts
|
||||||
# We use -fwrapv to tell the compiler that we require a C dialect where
|
# 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
|
# left shift of signed integers is well defined and has the expected
|
||||||
|
|
Loading…
Reference in a new issue