configure: prepare CFLAGS/CXXFLAGS/LDFLAGS for Meson
Split between CFLAGS/QEMU_CFLAGS and CXXFLAGS/QEMU_CXXFLAGS so that we will use CFLAGS and CXXFLAGS for flags that we do not want to pass to add_project_arguments. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
22a87800e6
commit
086d5f7529
80
configure
vendored
80
configure
vendored
@ -107,15 +107,12 @@ update_cxxflags() {
|
|||||||
# options which some versions of GCC's C++ compiler complain about
|
# options which some versions of GCC's C++ compiler complain about
|
||||||
# because they only make sense for C programs.
|
# because they only make sense for C programs.
|
||||||
QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
|
QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
|
||||||
|
CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/)
|
||||||
for arg in $QEMU_CFLAGS; do
|
for arg in $QEMU_CFLAGS; do
|
||||||
case $arg in
|
case $arg in
|
||||||
-Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
|
-Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
|
||||||
-Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
|
-Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
|
||||||
;;
|
;;
|
||||||
-std=gnu99)
|
|
||||||
QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
|
QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
|
||||||
;;
|
;;
|
||||||
@ -125,13 +122,13 @@ update_cxxflags() {
|
|||||||
|
|
||||||
compile_object() {
|
compile_object() {
|
||||||
local_cflags="$1"
|
local_cflags="$1"
|
||||||
do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
|
do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
|
||||||
}
|
}
|
||||||
|
|
||||||
compile_prog() {
|
compile_prog() {
|
||||||
local_cflags="$1"
|
local_cflags="$1"
|
||||||
local_ldflags="$2"
|
local_ldflags="$2"
|
||||||
do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $QEMU_LDFLAGS $local_ldflags
|
do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $QEMU_LDFLAGS $local_ldflags
|
||||||
}
|
}
|
||||||
|
|
||||||
# symbolically link $1 to $2. Portable version of "ln -sf".
|
# symbolically link $1 to $2. Portable version of "ln -sf".
|
||||||
@ -597,15 +594,14 @@ ARFLAGS="${ARFLAGS-rv}"
|
|||||||
# left shift of signed integers is well defined and has the expected
|
# left shift of signed integers is well defined and has the expected
|
||||||
# 2s-complement style results. (Both clang and gcc agree that it
|
# 2s-complement style results. (Both clang and gcc agree that it
|
||||||
# provides these semantics.)
|
# provides these semantics.)
|
||||||
QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS"
|
QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
|
QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
|
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
|
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
|
||||||
QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include"
|
QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include"
|
||||||
QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
|
QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
|
||||||
if test "$debug_info" = "yes"; then
|
CFLAGS="-std=gnu99 -Wall"
|
||||||
CFLAGS="-g $CFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# running configure in the source tree?
|
# running configure in the source tree?
|
||||||
# we know that's the case if configure is there.
|
# we know that's the case if configure is there.
|
||||||
@ -886,7 +882,6 @@ SunOS)
|
|||||||
QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
|
QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
|
||||||
# needed for TIOCWIN* defines in termios.h
|
# needed for TIOCWIN* defines in termios.h
|
||||||
QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
|
QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
|
|
||||||
solarisnetlibs="-lsocket -lnsl -lresolv"
|
solarisnetlibs="-lsocket -lnsl -lresolv"
|
||||||
LIBS="$solarisnetlibs $LIBS"
|
LIBS="$solarisnetlibs $LIBS"
|
||||||
libs_qga="$solarisnetlibs $libs_qga"
|
libs_qga="$solarisnetlibs $libs_qga"
|
||||||
@ -963,7 +958,7 @@ if test "$mingw32" = "yes" ; then
|
|||||||
EXESUF=".exe"
|
EXESUF=".exe"
|
||||||
DSOSUF=".dll"
|
DSOSUF=".dll"
|
||||||
# MinGW needs -mthreads for TLS and macro _MT.
|
# MinGW needs -mthreads for TLS and macro _MT.
|
||||||
QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
|
CFLAGS="-mthreads $CFLAGS"
|
||||||
LIBS="-lwinmm -lws2_32 $LIBS"
|
LIBS="-lwinmm -lws2_32 $LIBS"
|
||||||
write_c_skeleton;
|
write_c_skeleton;
|
||||||
if compile_prog "" "-liberty" ; then
|
if compile_prog "" "-liberty" ; then
|
||||||
@ -2109,7 +2104,7 @@ EOF
|
|||||||
for flag in $gcc_flags; do
|
for flag in $gcc_flags; do
|
||||||
# We need to check both a compile and a link, since some compiler
|
# We need to check both a compile and a link, since some compiler
|
||||||
# setups fail only on a .c->.o compile and some only at link time
|
# setups fail only on a .c->.o compile and some only at link time
|
||||||
if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
|
if compile_object "-Werror $flag" &&
|
||||||
compile_prog "-Werror $flag" ""; then
|
compile_prog "-Werror $flag" ""; then
|
||||||
QEMU_CFLAGS="$QEMU_CFLAGS $flag"
|
QEMU_CFLAGS="$QEMU_CFLAGS $flag"
|
||||||
QEMU_LDFLAGS="$QEMU_LDFLAGS $flag"
|
QEMU_LDFLAGS="$QEMU_LDFLAGS $flag"
|
||||||
@ -2184,7 +2179,7 @@ fi
|
|||||||
|
|
||||||
if test "$static" = "yes"; then
|
if test "$static" = "yes"; then
|
||||||
if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
|
if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
|
||||||
QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
|
CFLAGS="-fPIE -DPIE $CFLAGS"
|
||||||
QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
|
QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
|
||||||
pie="yes"
|
pie="yes"
|
||||||
elif test "$pie" = "yes"; then
|
elif test "$pie" = "yes"; then
|
||||||
@ -2194,11 +2189,11 @@ if test "$static" = "yes"; then
|
|||||||
pie="no"
|
pie="no"
|
||||||
fi
|
fi
|
||||||
elif test "$pie" = "no"; then
|
elif test "$pie" = "no"; then
|
||||||
QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
|
CFLAGS="$CFLAGS_NOPIE $CFLAGS"
|
||||||
QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
|
LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS"
|
||||||
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
|
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
|
||||||
QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
|
CFLAGS="-fPIE -DPIE $CFLAGS"
|
||||||
QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
|
LDFLAGS="-pie $LDFLAGS"
|
||||||
pie="yes"
|
pie="yes"
|
||||||
elif test "$pie" = "yes"; then
|
elif test "$pie" = "yes"; then
|
||||||
error_exit "PIE not available due to missing toolchain support"
|
error_exit "PIE not available due to missing toolchain support"
|
||||||
@ -3981,7 +3976,7 @@ EOF
|
|||||||
if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
|
if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
|
||||||
if cc_has_warning_flag "-Wno-unknown-attributes"; then
|
if cc_has_warning_flag "-Wno-unknown-attributes"; then
|
||||||
glib_cflags="-Wno-unknown-attributes $glib_cflags"
|
glib_cflags="-Wno-unknown-attributes $glib_cflags"
|
||||||
CFLAGS="-Wno-unknown-attributes $CFLAGS"
|
QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -6506,10 +6501,28 @@ if test "$gcov" = "yes" ; then
|
|||||||
QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
|
QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
|
||||||
QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
|
QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
|
||||||
elif test "$fortify_source" = "yes" ; then
|
elif test "$fortify_source" = "yes" ; then
|
||||||
CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
|
QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
|
||||||
elif test "$debug" = "no"; then
|
debug=no
|
||||||
|
fi
|
||||||
|
if test "$debug" = "no"; then
|
||||||
CFLAGS="-O2 $CFLAGS"
|
CFLAGS="-O2 $CFLAGS"
|
||||||
fi
|
fi
|
||||||
|
if test "$debug_info" = "yes"; then
|
||||||
|
CFLAGS="-g $CFLAGS"
|
||||||
|
LDFLAGS="-g $LDFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$ARCH" in
|
||||||
|
alpha)
|
||||||
|
# Ensure there's only a single GP
|
||||||
|
QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test "$gprof" = "yes" ; then
|
||||||
|
QEMU_CFLAGS="-p $QEMU_CFLAGS"
|
||||||
|
QEMU_LDFLAGS="-p $QEMU_LDFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$have_asan" = "yes"; then
|
if test "$have_asan" = "yes"; then
|
||||||
QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS"
|
QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS"
|
||||||
@ -6782,7 +6795,7 @@ EOF
|
|||||||
|
|
||||||
update_cxxflags
|
update_cxxflags
|
||||||
|
|
||||||
if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
|
if do_cxx $CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
|
||||||
# C++ compiler $cxx works ok with C compiler $cc
|
# C++ compiler $cxx works ok with C compiler $cc
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
@ -7874,7 +7887,7 @@ if test "$fuzzing" = "yes" ; then
|
|||||||
if test "$have_fuzzer" = "yes"; then
|
if test "$have_fuzzer" = "yes"; then
|
||||||
FUZZ_LDFLAGS=" -fsanitize=fuzzer"
|
FUZZ_LDFLAGS=" -fsanitize=fuzzer"
|
||||||
FUZZ_CFLAGS=" -fsanitize=fuzzer"
|
FUZZ_CFLAGS=" -fsanitize=fuzzer"
|
||||||
CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link"
|
QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link"
|
||||||
else
|
else
|
||||||
error_exit "Your compiler doesn't support -fsanitize=fuzzer"
|
error_exit "Your compiler doesn't support -fsanitize=fuzzer"
|
||||||
exit 1
|
exit 1
|
||||||
@ -7961,6 +7974,7 @@ echo "NM=$nm" >> $config_host_mak
|
|||||||
echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak
|
echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak
|
||||||
echo "WINDRES=$windres" >> $config_host_mak
|
echo "WINDRES=$windres" >> $config_host_mak
|
||||||
echo "CFLAGS=$CFLAGS" >> $config_host_mak
|
echo "CFLAGS=$CFLAGS" >> $config_host_mak
|
||||||
|
echo "CXXFLAGS=$CXXFLAGS" >> $config_host_mak
|
||||||
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
|
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
|
||||||
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
||||||
echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
|
echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
|
||||||
@ -8430,24 +8444,6 @@ if test "$tcg_interpreter" = "yes" ; then
|
|||||||
disas_config "TCI"
|
disas_config "TCI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$ARCH" in
|
|
||||||
alpha)
|
|
||||||
# Ensure there's only a single GP
|
|
||||||
cflags="-msmall-data $cflags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test "$gprof" = "yes" ; then
|
|
||||||
if test "$target_linux_user" = "yes" ; then
|
|
||||||
cflags="-p $cflags"
|
|
||||||
ldflags="-p $ldflags"
|
|
||||||
fi
|
|
||||||
if test "$target_softmmu" = "yes" ; then
|
|
||||||
ldflags="-p $ldflags"
|
|
||||||
echo "GPROF_CFLAGS=-p" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Newer kernels on s390 check for an S390_PGSTE program header and
|
# Newer kernels on s390 check for an S390_PGSTE program header and
|
||||||
# enable the pgste page table extensions in that case. This makes
|
# enable the pgste page table extensions in that case. This makes
|
||||||
# the vm.allocate_pgste sysctl unnecessary. We enable this program
|
# the vm.allocate_pgste sysctl unnecessary. We enable this program
|
||||||
|
@ -88,12 +88,12 @@ LINK = $(call quiet-command, $(LINKPROG) $(CFLAGS) $(QEMU_LDFLAGS) -o $@ \
|
|||||||
|
|
||||||
%.o: %.cc
|
%.o: %.cc
|
||||||
$(call quiet-command,$(CXX) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
|
$(call quiet-command,$(CXX) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
|
||||||
$(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
|
$(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CXXFLAGS) $($@-cflags) \
|
||||||
-c -o $@ $<,"CXX","$(TARGET_DIR)$@")
|
-c -o $@ $<,"CXX","$(TARGET_DIR)$@")
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(call quiet-command,$(CXX) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
|
$(call quiet-command,$(CXX) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \
|
||||||
$(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \
|
$(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CXXFLAGS) $($@-cflags) \
|
||||||
-c -o $@ $<,"CXX","$(TARGET_DIR)$@")
|
-c -o $@ $<,"CXX","$(TARGET_DIR)$@")
|
||||||
|
|
||||||
%.o: %.m
|
%.o: %.m
|
||||||
|
@ -11,4 +11,4 @@ obj-y += memory_mapping.o
|
|||||||
obj-y += qtest.o
|
obj-y += qtest.o
|
||||||
|
|
||||||
obj-y += vl.o
|
obj-y += vl.o
|
||||||
vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS)
|
vl.o-cflags := $(SDL_CFLAGS)
|
||||||
|
Loading…
Reference in New Issue
Block a user