configure: do not include dependency flags in QEMU_CFLAGS and LIBS

All Meson executables should specify their dependencies explicitly, either
directly or indirectly via declare_dependency.  Makefiles instead did
not propagate dependencies correctly from static libraries, for example.
Therefore, flags for dependencies need not be included in QEMU_CFLAGS.
LIBS is not used at all, so drop that one as well.

In a few cases the dependencies were not yet specified, so add them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-09-01 06:15:41 -04:00
parent de2d30051a
commit feabc71dfa
7 changed files with 7 additions and 46 deletions

View File

@ -155,7 +155,7 @@ dtc/%: .git-submodule-status
# Therefore we replicate some of the logic in the sub-makefile. # Therefore we replicate some of the logic in the sub-makefile.
# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't; # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
# no need to annoy QEMU developers with such things. # no need to annoy QEMU developers with such things.
CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) $(CAPSTONE_CFLAGS)
CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
CAP_CFLAGS += -DCAPSTONE_HAS_ARM CAP_CFLAGS += -DCAPSTONE_HAS_ARM
CAP_CFLAGS += -DCAPSTONE_HAS_ARM64 CAP_CFLAGS += -DCAPSTONE_HAS_ARM64

40
configure vendored
View File

@ -833,7 +833,6 @@ FreeBSD)
audio_drv_list="oss try-sdl" audio_drv_list="oss try-sdl"
audio_possible_drivers="oss sdl pa" audio_possible_drivers="oss sdl pa"
# needed for kinfo_getvmmap(3) in libutil.h # needed for kinfo_getvmmap(3) in libutil.h
LIBS="-lutil $LIBS"
netmap="" # enable netmap autodetect netmap="" # enable netmap autodetect
HOST_VARIANT_DIR="freebsd" HOST_VARIANT_DIR="freebsd"
;; ;;
@ -891,13 +890,10 @@ 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"
solarisnetlibs="-lsocket -lnsl -lresolv"
LIBS="$solarisnetlibs $LIBS"
;; ;;
Haiku) Haiku)
haiku="yes" haiku="yes"
QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS"
LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS"
;; ;;
Linux) Linux)
audio_drv_list="try-pa oss" audio_drv_list="try-pa oss"
@ -967,11 +963,7 @@ if test "$mingw32" = "yes" ; then
HOST_DSOSUF=".dll" HOST_DSOSUF=".dll"
# MinGW needs -mthreads for TLS and macro _MT. # MinGW needs -mthreads for TLS and macro _MT.
CFLAGS="-mthreads $CFLAGS" CFLAGS="-mthreads $CFLAGS"
LIBS="-lwinmm -lws2_32 $LIBS"
write_c_skeleton; write_c_skeleton;
if compile_prog "" "-liberty" ; then
LIBS="-liberty $LIBS"
fi
prefix="c:/Program Files/QEMU" prefix="c:/Program Files/QEMU"
qemu_suffix="" qemu_suffix=""
libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
@ -2692,7 +2684,6 @@ if test "$xen" != "no" ; then
if $pkg_config --exists xentoolcore; then if $pkg_config --exists xentoolcore; then
xen_pc="$xen_pc xentoolcore" xen_pc="$xen_pc xentoolcore"
fi fi
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
xen_cflags="$($pkg_config --cflags $xen_pc)" xen_cflags="$($pkg_config --cflags $xen_pc)"
xen_libs="$($pkg_config --libs $xen_pc)" xen_libs="$($pkg_config --libs $xen_pc)"
else else
@ -3077,8 +3068,6 @@ if test "$gnutls" != "no"; then
# At least ubuntu 18.04 ships only shared libraries. # At least ubuntu 18.04 ships only shared libraries.
write_c_skeleton write_c_skeleton
if compile_prog "" "$gnutls_libs" ; then if compile_prog "" "$gnutls_libs" ; then
LIBS="$gnutls_libs $LIBS"
QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
pass="yes" pass="yes"
fi fi
fi fi
@ -3148,8 +3137,6 @@ if test "$nettle" != "no"; then
# Link test to make sure the given libraries work (e.g for static). # Link test to make sure the given libraries work (e.g for static).
write_c_skeleton write_c_skeleton
if compile_prog "" "$nettle_libs" ; then if compile_prog "" "$nettle_libs" ; then
LIBS="$nettle_libs $LIBS"
QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
if test -z "$gcrypt"; then if test -z "$gcrypt"; then
gcrypt="no" gcrypt="no"
fi fi
@ -3192,8 +3179,6 @@ if test "$gcrypt" != "no"; then
# Link test to make sure the given libraries work (e.g for static). # Link test to make sure the given libraries work (e.g for static).
write_c_skeleton write_c_skeleton
if compile_prog "" "$gcrypt_libs" ; then if compile_prog "" "$gcrypt_libs" ; then
LIBS="$gcrypt_libs $LIBS"
QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
pass="yes" pass="yes"
fi fi
fi fi
@ -3765,7 +3750,6 @@ for i in $glib_modules; do
if $pkg_config --atleast-version=$glib_req_ver $i; then if $pkg_config --atleast-version=$glib_req_ver $i; then
glib_cflags=$($pkg_config --cflags $i) glib_cflags=$($pkg_config --cflags $i)
glib_libs=$($pkg_config --libs $i) glib_libs=$($pkg_config --libs $i)
LIBS="$glib_libs $LIBS"
else else
error_exit "glib-$glib_req_ver $i is required to compile QEMU" error_exit "glib-$glib_req_ver $i is required to compile QEMU"
fi fi
@ -4075,11 +4059,6 @@ if test "$linux_io_uring" != "no" ; then
linux_io_uring_cflags=$($pkg_config --cflags liburing) linux_io_uring_cflags=$($pkg_config --cflags liburing)
linux_io_uring_libs=$($pkg_config --libs liburing) linux_io_uring_libs=$($pkg_config --libs liburing)
linux_io_uring=yes linux_io_uring=yes
# io_uring is used in libqemuutil.a where per-file -libs variables are not
# seen by programs linking the archive. It's not ideal, but just add the
# library dependency globally.
LIBS="$linux_io_uring_libs $LIBS"
else else
if test "$linux_io_uring" = "yes" ; then if test "$linux_io_uring" = "yes" ; then
feature_not_found "linux io_uring" "Install liburing devel" feature_not_found "linux io_uring" "Install liburing devel"
@ -4124,7 +4103,6 @@ EOF
elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
attr=yes attr=yes
libattr_libs="-lattr" libattr_libs="-lattr"
LIBS="$libattr_libs $LIBS"
libattr=yes libattr=yes
else else
if test "$attr" = "yes" ; then if test "$attr" = "yes" ; then
@ -4244,7 +4222,6 @@ if test "$opengl" != "no" ; then
if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
gtk_gl="yes" gtk_gl="yes"
fi fi
QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
else else
if test "$opengl" = "yes" ; then if test "$opengl" = "yes" ; then
feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
@ -4999,7 +4976,6 @@ EOF
$pkg_config --atleast-version=0.12.3 spice-protocol && \ $pkg_config --atleast-version=0.12.3 spice-protocol && \
compile_prog "$spice_cflags" "$spice_libs" ; then compile_prog "$spice_cflags" "$spice_libs" ; then
spice="yes" spice="yes"
QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
else else
if test "$spice" = "yes" ; then if test "$spice" = "yes" ; then
feature_not_found "spice" \ feature_not_found "spice" \
@ -5182,7 +5158,6 @@ case "$capstone" in
git_submodules="${git_submodules} capstone" git_submodules="${git_submodules} capstone"
fi fi
mkdir -p capstone mkdir -p capstone
QEMU_CFLAGS="$QEMU_CFLAGS -I${source_path}/capstone/include"
if test "$mingw32" = "yes"; then if test "$mingw32" = "yes"; then
LIBCAPSTONE=capstone.lib LIBCAPSTONE=capstone.lib
else else
@ -5195,7 +5170,6 @@ case "$capstone" in
system) system)
capstone_libs="$($pkg_config --libs capstone)" capstone_libs="$($pkg_config --libs capstone)"
capstone_cflags="$($pkg_config --cflags capstone)" capstone_cflags="$($pkg_config --cflags capstone)"
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
;; ;;
no) no)
@ -5344,8 +5318,6 @@ EOF
else else
urcu_bp_libs="-lurcu-bp" urcu_bp_libs="-lurcu-bp"
fi fi
LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
else else
error_exit "Trace backend 'ust' missing lttng-ust header files" error_exit "Trace backend 'ust' missing lttng-ust header files"
fi fi
@ -6126,7 +6098,6 @@ if test "$libpmem" != "no"; then
libpmem="yes" libpmem="yes"
libpmem_libs=$($pkg_config --libs libpmem) libpmem_libs=$($pkg_config --libs libpmem)
libpmem_cflags=$($pkg_config --cflags libpmem) libpmem_cflags=$($pkg_config --cflags libpmem)
QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags"
else else
if test "$libpmem" = "yes" ; then if test "$libpmem" = "yes" ; then
feature_not_found "libpmem" "Install nvml or pmdk" feature_not_found "libpmem" "Install nvml or pmdk"
@ -6143,7 +6114,6 @@ if test "$libdaxctl" != "no"; then
libdaxctl="yes" libdaxctl="yes"
libdaxctl_libs=$($pkg_config --libs libdaxctl) libdaxctl_libs=$($pkg_config --libs libdaxctl)
libdaxctl_cflags=$($pkg_config --cflags libdaxctl) libdaxctl_cflags=$($pkg_config --cflags libdaxctl)
QEMU_CFLAGS="$QEMU_CFLAGS $libdaxctl_cflags"
else else
if test "$libdaxctl" = "yes" ; then if test "$libdaxctl" = "yes" ; then
feature_not_found "libdaxctl" "Install libdaxctl" feature_not_found "libdaxctl" "Install libdaxctl"
@ -6326,11 +6296,6 @@ if test "$libudev" != "no" ; then
fi fi
fi fi
# Now we've finished running tests it's OK to add -Werror to the compiler flags
if test "$werror" = "yes"; then
QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
fi
# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
if test "$solaris" = "no" && test "$tsan" = "no"; then if test "$solaris" = "no" && test "$tsan" = "no"; then
if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
@ -6547,10 +6512,6 @@ echo_version() {
fi fi
} }
# prepend ftd flags after all config tests are done
QEMU_CFLAGS="$fdt_cflags $QEMU_CFLAGS"
QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
config_host_mak="config-host.mak" config_host_mak="config-host.mak"
echo "# Automatically generated by configure - do not modify" > $config_host_mak echo "# Automatically generated by configure - do not modify" > $config_host_mak
@ -7485,7 +7446,6 @@ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak

View File

@ -1,5 +1,5 @@
arm_ss = ss.source_set() arm_ss = ss.source_set()
arm_ss.add(files('boot.c')) arm_ss.add(files('boot.c'), fdt)
arm_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c')) arm_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c'))
arm_ss.add(when: 'CONFIG_ARM_VIRT', if_true: files('virt.c')) arm_ss.add(when: 'CONFIG_ARM_VIRT', if_true: files('virt.c'))
arm_ss.add(when: 'CONFIG_ACPI', if_true: files('virt-acpi-build.c')) arm_ss.add(when: 'CONFIG_ACPI', if_true: files('virt-acpi-build.c'))

View File

@ -4,7 +4,7 @@ mips_ss.add(when: 'CONFIG_FULOONG', if_true: files('fuloong2e.c'))
mips_ss.add(when: 'CONFIG_JAZZ', if_true: files('jazz.c')) mips_ss.add(when: 'CONFIG_JAZZ', if_true: files('jazz.c'))
mips_ss.add(when: 'CONFIG_MALTA', if_true: files('gt64xxx_pci.c', 'malta.c')) mips_ss.add(when: 'CONFIG_MALTA', if_true: files('gt64xxx_pci.c', 'malta.c'))
mips_ss.add(when: 'CONFIG_MIPSSIM', if_true: files('mipssim.c')) mips_ss.add(when: 'CONFIG_MIPSSIM', if_true: files('mipssim.c'))
mips_ss.add(when: 'CONFIG_MIPS_BOSTON', if_true: files('boston.c')) mips_ss.add(when: 'CONFIG_MIPS_BOSTON', if_true: [files('boston.c'), fdt])
mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c')) mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
mips_ss.add(when: 'CONFIG_R4K', if_true: files('r4k.c')) mips_ss.add(when: 'CONFIG_R4K', if_true: files('r4k.c'))

View File

@ -1,5 +1,5 @@
riscv_ss = ss.source_set() riscv_ss = ss.source_set()
riscv_ss.add(files('boot.c')) riscv_ss.add(files('boot.c'), fdt)
riscv_ss.add(files('numa.c')) riscv_ss.add(files('numa.c'))
riscv_ss.add(when: 'CONFIG_HART', if_true: files('riscv_hart.c')) riscv_ss.add(when: 'CONFIG_HART', if_true: files('riscv_hart.c'))
riscv_ss.add(when: 'CONFIG_OPENTITAN', if_true: files('opentitan.c')) riscv_ss.add(when: 'CONFIG_OPENTITAN', if_true: files('opentitan.c'))

View File

@ -6,4 +6,4 @@ softmmu_ss.add(files(
'qmp-cmds.c', 'qmp-cmds.c',
)) ))
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('misc.c')) specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('misc.c'), spice])

View File

@ -1,5 +1,5 @@
softmmu_ss.add(pixman) softmmu_ss.add(pixman)
specific_ss.add(pixman) # for the include path specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: pixman) # for the include path
softmmu_ss.add(files( softmmu_ss.add(files(
'console.c', 'console.c',
@ -35,6 +35,7 @@ softmmu_ss.add_all(when: vnc, if_true: vnc_ss)
softmmu_ss.add(when: vnc, if_false: files('vnc-stubs.c')) softmmu_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
softmmu_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c', 'egl-context.c')) softmmu_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c', 'egl-context.c'))
softmmu_ss.add(when: [opengl, 'CONFIG_OPENGL_DMABUF'], if_true: files('egl-headless.c')) softmmu_ss.add(when: [opengl, 'CONFIG_OPENGL_DMABUF'], if_true: files('egl-headless.c'))
specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl)
ui_modules = {} ui_modules = {}