}
do_compiler() {
+ # Run the compiler, capturing its output to the log. First argument
+ # is compiler binary to execute.
+ local compiler="$1"
+ shift
+ if test -n "$BASH_VERSION"; then eval '
+ echo >>config.log "
+funcs: ${FUNCNAME[*]}
+lines: ${BASH_LINENO[*]}"
+ '; fi
+ echo $compiler "$@" >> config.log
+ $compiler "$@" >> config.log 2>&1 || return $?
+}
+
+do_compiler_werror() {
# Run the compiler, capturing its output to the log. First argument
# is compiler binary to execute.
compiler="$1"
}
do_cc() {
- do_compiler "$cc" $CPU_CFLAGS "$@"
+ do_compiler_werror "$cc" $CPU_CFLAGS "$@"
}
do_cxx() {
- do_compiler "$cxx" $CPU_CFLAGS "$@"
+ do_compiler_werror "$cxx" $CPU_CFLAGS "$@"
}
do_objc() {
- do_compiler "$objcc" $CPU_CFLAGS "$@"
+ do_compiler_werror "$objcc" $CPU_CFLAGS "$@"
}
# Append $2 to the variable named $1, with space separation
eval test -z '"${1#'"$2"'}"'
}
-ld_has() {
- $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
-}
-
if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
then
error_exit "main directory cannot contain spaces nor colons"
# default parameters
cpu=""
-iasl="iasl"
-interp_prefix="/usr/gnemul/qemu-%M"
static="no"
cross_compile="no"
cross_prefix=""
-audio_drv_list="default"
-block_drv_rw_whitelist=""
-block_drv_ro_whitelist=""
host_cc="cc"
-lto="false"
stack_protector=""
safe_stack=""
use_containers="yes"
EXTRA_OBJCFLAGS=""
EXTRA_LDFLAGS=""
-vhost_kernel="$default_feature"
-vhost_net="$default_feature"
-vhost_crypto="$default_feature"
-vhost_scsi="$default_feature"
-vhost_vsock="$default_feature"
-vhost_user="no"
-vhost_user_fs="$default_feature"
-vhost_vdpa="$default_feature"
-debug_info="yes"
debug_tcg="no"
-debug="no"
sanitizers="no"
tsan="no"
fortify_source="yes"
-gcov="no"
EXESUF=""
modules="no"
prefix="/usr/local"
softmmu="yes"
linux_user=""
bsd_user=""
-pkgversion=""
pie=""
-trace_file="trace"
coroutine=""
-tls_priority="NORMAL"
plugins="$default_feature"
meson=""
meson_args=""
ninja=""
+bindir="bin"
skip_meson=no
# The following Meson options are handled manually (still they
# 1. Track which submodules are needed
if test "$default_feature" = no ; then
- capstone="disabled"
slirp="disabled"
else
- capstone="auto"
slirp="auto"
fi
fdt="auto"
-# 2. Support --with/--without option
-default_devices="true"
-
-# 3. Automatically enable/disable other options
+# 2. Automatically enable/disable other options
tcg="enabled"
cfi="false"
;;
--cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*}
eval "cross_cc_cflags_${cc_arch}=\$optarg"
- cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}"
;;
--cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
eval "cross_cc_${cc_arch}=\$optarg"
- cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}"
+ ;;
+ --cross-prefix-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-prefix-FOO option"
+ ;;
+ --cross-prefix-*) cc_arch=${opt#--cross-prefix-}; cc_arch=${cc_arch%%=*}
+ eval "cross_prefix_${cc_arch}=\$optarg"
;;
esac
done
ar="${AR-${cross_prefix}ar}"
as="${AS-${cross_prefix}as}"
ccas="${CCAS-$cc}"
-cpp="${CPP-$cc -E}"
objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}"
;;
linux)
linux="yes"
- vhost_user=${default_feature:-yes}
;;
esac
CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS"
write_c_skeleton;
prefix="/qemu"
+ bindir=""
qemu_suffix=""
fi
. $source_path/scripts/meson-buildoptions.sh
meson_options=
+meson_option_add() {
+ meson_options="$meson_options $(quote_sh "$1")"
+}
meson_option_parse() {
meson_options="$meson_options $(_meson_option_parse "$@")"
if test $? -eq 1; then
;;
--prefix=*) prefix="$optarg"
;;
- --interp-prefix=*) interp_prefix="$optarg"
- ;;
--cross-prefix=*)
;;
--cc=*)
;;
--cxx=*)
;;
- --iasl=*) iasl="$optarg"
- ;;
--objcc=*) objcc="$optarg"
;;
--make=*) make="$optarg"
;;
--python=*) python="$optarg" ; explicit_python=yes
;;
- --sphinx-build=*) sphinx_build="$optarg"
- ;;
--skip-meson) skip_meson=yes
;;
--meson=*) meson="$optarg"
;;
--cross-cc-*)
;;
- --enable-debug-info) debug_info="yes"
+ --cross-prefix-*)
+ ;;
+ --enable-debug-info) meson_option_add -Ddebug=true
;;
- --disable-debug-info) debug_info="no"
+ --disable-debug-info) meson_option_add -Ddebug=false
;;
--enable-modules)
modules="yes"
error_exit "Can't mix --target-list-exclude with --target-list"
fi
;;
- --with-trace-file=*) trace_file="$optarg"
+ --with-default-devices) meson_option_add -Ddefault_devices=true
;;
- --with-default-devices) default_devices="true"
- ;;
- --without-default-devices) default_devices="false"
+ --without-default-devices) meson_option_add -Ddefault_devices=false
;;
--with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option"
;;
;;
--without-default-features) # processed above
;;
- --enable-gcov) gcov="yes"
- ;;
--static)
static="yes"
QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
;;
- --mandir=*) mandir="$optarg"
- ;;
--bindir=*) bindir="$optarg"
;;
- --libdir=*) libdir="$optarg"
- ;;
- --libexecdir=*) libexecdir="$optarg"
- ;;
- --includedir=*) includedir="$optarg"
- ;;
- --datadir=*) datadir="$optarg"
- ;;
--with-suffix=*) qemu_suffix="$optarg"
;;
- --docdir=*) docdir="$optarg"
- ;;
- --localedir=*) localedir="$optarg"
- ;;
- --sysconfdir=*) sysconfdir="$optarg"
- ;;
- --localstatedir=*) local_statedir="$optarg"
- ;;
- --firmwarepath=*) firmwarepath="$optarg"
- ;;
--host=*|--build=*|\
--disable-dependency-tracking|\
--sbindir=*|--sharedstatedir=*|\
# configure to be used by RPM and similar macros that set
# lots of directory switches by default.
;;
- --audio-drv-list=*) audio_drv_list="$optarg"
- ;;
- --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
- ;;
- --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
- ;;
--enable-debug-tcg) debug_tcg="yes"
;;
--disable-debug-tcg) debug_tcg="no"
# Enable debugging options that aren't excessively noisy
debug_tcg="yes"
meson_option_parse --enable-debug-mutex ""
- debug="yes"
+ meson_option_add -Doptimization=0
fortify_source="no"
;;
--enable-sanitizers) sanitizers="yes"
;;
--disable-werror) werror="no"
;;
- --enable-lto) lto="true"
- ;;
- --disable-lto) lto="false"
- ;;
--enable-stack-protector) stack_protector="yes"
;;
--disable-stack-protector) stack_protector="no"
;;
--enable-cfi)
cfi="true";
- lto="true";
+ meson_option_add -Db_lto=true
;;
--disable-cfi) cfi="false"
;;
;;
--enable-fdt=*) fdt="$optarg"
;;
- --with-pkgversion=*) pkgversion="$optarg"
- ;;
--with-coroutine=*) coroutine="$optarg"
;;
- --disable-vhost-net) vhost_net="no"
- ;;
- --enable-vhost-net) vhost_net="yes"
- ;;
- --disable-vhost-crypto) vhost_crypto="no"
- ;;
- --enable-vhost-crypto) vhost_crypto="yes"
- ;;
- --disable-vhost-scsi) vhost_scsi="no"
- ;;
- --enable-vhost-scsi) vhost_scsi="yes"
- ;;
- --disable-vhost-vsock) vhost_vsock="no"
- ;;
- --enable-vhost-vsock) vhost_vsock="yes"
- ;;
- --disable-vhost-user-fs) vhost_user_fs="no"
- ;;
- --enable-vhost-user-fs) vhost_user_fs="yes"
- ;;
--disable-zlib-test)
;;
--disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
--enable-uuid|--disable-uuid)
echo "$0: $opt is obsolete, UUID support is always built" >&2
;;
- --tls-priority=*) tls_priority="$optarg"
- ;;
- --disable-vhost-user) vhost_user="no"
- ;;
- --enable-vhost-user) vhost_user="yes"
- ;;
- --disable-vhost-vdpa) vhost_vdpa="no"
- ;;
- --enable-vhost-vdpa) vhost_vdpa="yes"
- ;;
- --disable-vhost-kernel) vhost_kernel="no"
- ;;
- --enable-vhost-kernel) vhost_kernel="yes"
- ;;
- --disable-capstone) capstone="disabled"
- ;;
- --enable-capstone) capstone="enabled"
- ;;
- --enable-capstone=git) capstone="internal"
- ;;
- --enable-capstone=*) capstone="$optarg"
- ;;
--with-git=*) git="$optarg"
;;
--with-git-submodules=*)
--enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
;;
# everything else has the same name in configure and meson
- --enable-* | --disable-*) meson_option_parse "$opt" "$optarg"
- ;;
- *)
- echo "ERROR: unknown option $opt"
- echo "Try '$0 --help' for more information"
- exit 1
+ --*) meson_option_parse "$opt" "$optarg"
;;
esac
done
;;
esac
-libdir="${libdir:-$prefix/lib}"
-libexecdir="${libexecdir:-$prefix/libexec}"
-includedir="${includedir:-$prefix/include}"
-
-if test "$mingw32" = "yes" ; then
- bindir="${bindir:-$prefix}"
-else
- bindir="${bindir:-$prefix/bin}"
-fi
-mandir="${mandir:-$prefix/share/man}"
-datadir="${datadir:-$prefix/share}"
-docdir="${docdir:-$prefix/share/doc}"
-sysconfdir="${sysconfdir:-$prefix/etc}"
-local_statedir="${local_statedir:-$prefix/var}"
-firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
-localedir="${localedir:-$datadir/locale}"
-
-if eval test -z "\${cross_cc_$cpu}"; then
- eval "cross_cc_${cpu}=\$cc"
- cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
-fi
-
default_target_list=""
mak_wilds=""
Standard options:
--help print this message
--prefix=PREFIX install in PREFIX [$prefix]
- --interp-prefix=PREFIX where to find shared libraries, etc.
- use %M for cpu name [$interp_prefix]
--target-list=LIST set target list (default: build all)
$(echo Available targets: $default_target_list | \
fold -s -w 53 | sed -e 's/^/ /')
Advanced options (experts only):
--cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
--cc=CC use C compiler CC [$cc]
- --iasl=IASL use ACPI compiler IASL [$iasl]
--host-cc=CC use C compiler CC [$host_cc] for code run at
build time
--cxx=CXX use C++ compiler CXX [$cxx]
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
--cross-cc-ARCH=CC use compiler when building ARCH guest test cases
--cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests
+ --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
--make=MAKE use specified make [$make]
--python=PYTHON use specified python [$python]
- --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build]
--meson=MESON use specified meson [$meson]
--ninja=NINJA use specified ninja [$ninja]
--smbd=SMBD use specified smbd [$smbd]
--with-git-submodules=validate fail if git submodules are not up to date
--with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
--static enable static build [$static]
- --mandir=PATH install man pages in PATH
- --datadir=PATH install firmware in PATH/$qemu_suffix
- --localedir=PATH install translation in PATH/$qemu_suffix
- --docdir=PATH install documentation in PATH/$qemu_suffix
--bindir=PATH install binaries in PATH
- --libdir=PATH install libraries in PATH
- --libexecdir=PATH install helper binaries in PATH
- --sysconfdir=PATH install config in PATH/$qemu_suffix
- --localstatedir=PATH install local state in PATH (set at runtime on win32)
- --firmwarepath=PATH search PATH for firmware files
- --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
--with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
- --with-pkgversion=VERS use specified string as sub-version of the package
--without-default-features default all --enable-* options to "disabled"
--without-default-devices do not include any device that is not needed to
start the emulator (only use if you are including
--enable-tsan enable thread sanitizer
--disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
- --audio-drv-list=LIST set audio drivers to try if -audiodev is not used
- --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
- --block-drv-rw-whitelist=L
- set block driver read-write whitelist
- (by default affects only QEMU, not tools like qemu-img)
- --block-drv-ro-whitelist=L
- set block driver read-only whitelist
- (by default affects only QEMU, not tools like qemu-img)
- --with-trace-file=NAME Full PATH,NAME of file to store traces
- Default:trace-<pid>
--cpu=CPU Build for host CPU [$cpu]
--with-coroutine=BACKEND coroutine backend. Supported options:
ucontext, sigaltstack, windows
- --enable-gcov enable test coverage analysis with gcov
- --tls-priority default TLS protocol/cipher priority string
--enable-plugins
enable plugins via shared library loading
--disable-containers don't use containers for cross-building
modules modules support (non-Windows)
debug-tcg TCG debugging (default is disabled)
debug-info debugging information
- lto Enable Link-Time Optimization.
safe-stack SafeStack Stack Smash Protection. Depends on
clang/llvm >= 3.7 and requires coroutine backend ucontext.
- vhost-net vhost-net kernel acceleration support
- vhost-vsock virtio sockets device support
- vhost-scsi vhost-scsi kernel target support
- vhost-crypto vhost-user-crypto backend support
- vhost-kernel vhost kernel backend support
- vhost-user vhost-user backend support
- vhost-vdpa vhost-vdpa kernel backend support
NOTE: The object files are built at the place where configure is launched
EOF
exit 1
fi
-#########################################
-# vhost interdependencies and host support
-
-# vhost backends
-if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
- error_exit "vhost-user is not available on Windows"
-fi
-test "$vhost_vdpa" = "" && vhost_vdpa=$linux
-if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
- error_exit "vhost-vdpa is only available on Linux"
-fi
-test "$vhost_kernel" = "" && vhost_kernel=$linux
-if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
- error_exit "vhost-kernel is only available on Linux"
-fi
-
-# vhost-kernel devices
-test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
-if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
- error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
-fi
-test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
-if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
- error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
-fi
-
-# vhost-user backends
-test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
-if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
- error_exit "--enable-vhost-net-user requires --enable-vhost-user"
-fi
-test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
-if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
- error_exit "--enable-vhost-crypto requires --enable-vhost-user"
-fi
-test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user
-if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
- error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
-fi
-#vhost-vdpa backends
-test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa
-if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
- error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
-fi
-
-# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
-if test "$vhost_net" = ""; then
- test "$vhost_net_user" = "yes" && vhost_net=yes
- test "$vhost_net_vdpa" = "yes" && vhost_net=yes
- test "$vhost_kernel" = "yes" && vhost_net=yes
-fi
-
##########################################
# pkg-config probe
##########################################
# glib support probe
+# When bumping glib_req_ver, please check also whether we should increase
+# the _WIN32_WINNT setting in osdep.h according to the value from glib
glib_req_ver=2.56
glib_modules=gthread-2.0
if test "$modules" = yes; then
fi
done
+glib_bindir="$($pkg_config --variable=bindir glib-2.0)"
+if test -z "$glib_bindir" ; then
+ glib_bindir="$($pkg_config --variable=prefix glib-2.0)"/bin
+fi
+
# This workaround is required due to a bug in pkg-config file for glib as it
# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
fi
fi
-##########################################
-# SHA command probe for modules
-if test "$modules" = yes; then
- shacmd_probe="sha1sum sha1 shasum"
- for c in $shacmd_probe; do
- if has $c; then
- shacmd="$c"
- break
- fi
- done
- if test "$shacmd" = ""; then
- error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
- fi
-fi
-
##########################################
# fdt probe
;;
esac
-##########################################
-# capstone
-
-case "$capstone" in
- auto | enabled | internal)
- # Simpler to always update submodule, even if not needed.
- git_submodules="${git_submodules} capstone"
- ;;
-esac
-
##########################################
# check and set a backend for coroutine
;;
esac
+##########################################
+# functions to probe cross compilers
+
+container="no"
+if test $use_containers = "yes"; then
+ if has "docker" || has "podman"; then
+ container=$($python $source_path/tests/docker/docker.py probe)
+ fi
+fi
+
+# cross compilers defaults, can be overridden with --cross-cc-ARCH
+: ${cross_prefix_aarch64="aarch64-linux-gnu-"}
+: ${cross_prefix_aarch64_be="$cross_prefix_aarch64"}
+: ${cross_prefix_alpha="alpha-linux-gnu-"}
+: ${cross_prefix_arm="arm-linux-gnueabihf-"}
+: ${cross_prefix_armeb="$cross_prefix_arm"}
+: ${cross_prefix_hexagon="hexagon-unknown-linux-musl-"}
+: ${cross_prefix_loongarch64="loongarch64-unknown-linux-gnu-"}
+: ${cross_prefix_hppa="hppa-linux-gnu-"}
+: ${cross_prefix_i386="i686-linux-gnu-"}
+: ${cross_prefix_m68k="m68k-linux-gnu-"}
+: ${cross_prefix_microblaze="microblaze-linux-musl-"}
+: ${cross_prefix_mips64el="mips64el-linux-gnuabi64-"}
+: ${cross_prefix_mips64="mips64-linux-gnuabi64-"}
+: ${cross_prefix_mipsel="mipsel-linux-gnu-"}
+: ${cross_prefix_mips="mips-linux-gnu-"}
+: ${cross_prefix_nios2="nios2-linux-gnu-"}
+: ${cross_prefix_ppc="powerpc-linux-gnu-"}
+: ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
+: ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
+: ${cross_prefix_riscv64="riscv64-linux-gnu-"}
+: ${cross_prefix_s390x="s390x-linux-gnu-"}
+: ${cross_prefix_sh4="sh4-linux-gnu-"}
+: ${cross_prefix_sparc64="sparc64-linux-gnu-"}
+: ${cross_prefix_sparc="$cross_prefix_sparc64"}
+: ${cross_prefix_x86_64="x86_64-linux-gnu-"}
+
+: ${cross_cc_aarch64_be="$cross_cc_aarch64"}
+: ${cross_cc_cflags_aarch64_be="-mbig-endian"}
+: ${cross_cc_armeb="$cross_cc_arm"}
+: ${cross_cc_cflags_armeb="-mbig-endian"}
+: ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"}
+: ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
+: ${cross_cc_cflags_i386="-m32"}
+: ${cross_cc_cflags_ppc="-m32"}
+: ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
+: ${cross_cc_ppc64le="$cross_cc_ppc64"}
+: ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
+: ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
+: ${cross_cc_sparc="$cross_cc_sparc64"}
+: ${cross_cc_cflags_sparc="-m32 -mcpu=supersparc"}
+: ${cross_cc_cflags_x86_64="-m64"}
+
+compute_target_variable() {
+ if eval test -n "\"\${cross_prefix_$1}\""; then
+ if eval has "\"\${cross_prefix_$1}\$3\""; then
+ eval "$2=\"\${cross_prefix_$1}\$3\""
+ fi
+ fi
+}
+
+probe_target_compiler() {
+ # reset all output variables
+ container_image=
+ container_hosts=
+ container_cross_cc=
+ container_cross_ar=
+ container_cross_as=
+ container_cross_ld=
+ container_cross_nm=
+ container_cross_objcopy=
+ container_cross_ranlib=
+ container_cross_strip=
+ target_cc=
+ target_ar=
+ target_as=
+ target_ld=
+ target_nm=
+ target_objcopy=
+ target_ranlib=
+ target_strip=
+
+ case $1 in
+ aarch64) container_hosts="x86_64 aarch64" ;;
+ alpha) container_hosts=x86_64 ;;
+ arm) container_hosts="x86_64 aarch64" ;;
+ cris) container_hosts=x86_64 ;;
+ hexagon) container_hosts=x86_64 ;;
+ hppa) container_hosts=x86_64 ;;
+ i386) container_hosts=x86_64 ;;
+ m68k) container_hosts=x86_64 ;;
+ microblaze) container_hosts=x86_64 ;;
+ mips64el) container_hosts=x86_64 ;;
+ mips64) container_hosts=x86_64 ;;
+ mipsel) container_hosts=x86_64 ;;
+ mips) container_hosts=x86_64 ;;
+ nios2) container_hosts=x86_64 ;;
+ ppc) container_hosts=x86_64 ;;
+ ppc64|ppc64le) container_hosts=x86_64 ;;
+ riscv64) container_hosts=x86_64 ;;
+ s390x) container_hosts=x86_64 ;;
+ sh4) container_hosts=x86_64 ;;
+ sparc64) container_hosts=x86_64 ;;
+ tricore) container_hosts=x86_64 ;;
+ x86_64) container_hosts="aarch64 ppc64el x86_64" ;;
+ xtensa*) container_hosts=x86_64 ;;
+ esac
+
+ for host in $container_hosts; do
+ test "$container" != no || continue
+ test "$host" = "$cpu" || continue
+ case $1 in
+ aarch64)
+ # We don't have any bigendian build tools so we only use this for AArch64
+ container_image=debian-arm64-cross
+ container_cross_prefix=aarch64-linux-gnu-
+ container_cross_cc=${container_cross_prefix}gcc-10
+ ;;
+ alpha)
+ container_image=debian-alpha-cross
+ container_cross_prefix=alpha-linux-gnu-
+ ;;
+ arm)
+ # We don't have any bigendian build tools so we only use this for ARM
+ container_image=debian-armhf-cross
+ container_cross_prefix=arm-linux-gnueabihf-
+ ;;
+ cris)
+ container_image=fedora-cris-cross
+ container_cross_prefix=cris-linux-gnu-
+ ;;
+ hexagon)
+ container_image=debian-hexagon-cross
+ container_cross_prefix=hexagon-unknown-linux-musl-
+ container_cross_cc=${container_cross_prefix}clang
+ ;;
+ hppa)
+ container_image=debian-hppa-cross
+ container_cross_prefix=hppa-linux-gnu-
+ ;;
+ i386)
+ container_image=fedora-i386-cross
+ container_cross_prefix=
+ ;;
+ m68k)
+ container_image=debian-m68k-cross
+ container_cross_prefix=m68k-linux-gnu-
+ ;;
+ microblaze)
+ container_image=debian-microblaze-cross
+ container_cross_prefix=microblaze-linux-musl-
+ ;;
+ mips64el)
+ container_image=debian-mips64el-cross
+ container_cross_prefix=mips64el-linux-gnuabi64-
+ ;;
+ mips64)
+ container_image=debian-mips64-cross
+ container_cross_prefix=mips64-linux-gnuabi64-
+ ;;
+ mipsel)
+ container_image=debian-mipsel-cross
+ container_cross_prefix=mipsel-linux-gnu-
+ ;;
+ mips)
+ container_image=debian-mips-cross
+ container_cross_prefix=mips-linux-gnu-
+ ;;
+ nios2)
+ container_image=debian-nios2-cross
+ container_cross_prefix=nios2-linux-gnu-
+ ;;
+ ppc)
+ container_image=debian-powerpc-test-cross
+ container_cross_prefix=powerpc-linux-gnu-
+ container_cross_cc=${container_cross_prefix}gcc-10
+ ;;
+ ppc64|ppc64le)
+ container_image=debian-powerpc-test-cross
+ container_cross_prefix=powerpc${1#ppc}-linux-gnu-
+ container_cross_cc=${container_cross_prefix}gcc-10
+ ;;
+ riscv64)
+ container_image=debian-riscv64-test-cross
+ container_cross_prefix=riscv64-linux-gnu-
+ ;;
+ s390x)
+ container_image=debian-s390x-cross
+ container_cross_prefix=s390x-linux-gnu-
+ ;;
+ sh4)
+ container_image=debian-sh4-cross
+ container_cross_prefix=sh4-linux-gnu-
+ ;;
+ sparc64)
+ container_image=debian-sparc64-cross
+ container_cross_prefix=sparc64-linux-gnu-
+ ;;
+ tricore)
+ container_image=debian-tricore-cross
+ container_cross_prefix=tricore-
+ container_cross_as=tricore-as
+ container_cross_ld=tricore-ld
+ break
+ ;;
+ x86_64)
+ container_image=debian-amd64-cross
+ container_cross_prefix=x86_64-linux-gnu-
+ ;;
+ xtensa*)
+ # FIXME: xtensa-linux-user?
+ container_hosts=x86_64
+ container_image=debian-xtensa-cross
+
+ # default to the dc232b cpu
+ container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf-
+ ;;
+ esac
+ : ${container_cross_cc:=${container_cross_prefix}gcc}
+ : ${container_cross_ar:=${container_cross_prefix}ar}
+ : ${container_cross_as:=${container_cross_prefix}as}
+ : ${container_cross_ld:=${container_cross_prefix}ld}
+ : ${container_cross_nm:=${container_cross_prefix}nm}
+ : ${container_cross_objcopy:=${container_cross_prefix}objcopy}
+ : ${container_cross_ranlib:=${container_cross_prefix}ranlib}
+ : ${container_cross_strip:=${container_cross_prefix}strip}
+ done
+
+ eval "target_cflags=\${cross_cc_cflags_$1}"
+ if eval test -n "\"\${cross_cc_$1}\""; then
+ if eval has "\"\${cross_cc_$1}\""; then
+ eval "target_cc=\"\${cross_cc_$1}\""
+ fi
+ else
+ compute_target_variable $1 target_cc gcc
+ fi
+ target_ccas=$target_cc
+ compute_target_variable $1 target_ar ar
+ compute_target_variable $1 target_as as
+ compute_target_variable $1 target_ld ld
+ compute_target_variable $1 target_nm nm
+ compute_target_variable $1 target_objcopy objcopy
+ compute_target_variable $1 target_ranlib ranlib
+ compute_target_variable $1 target_strip strip
+ if test "$1" = $cpu; then
+ : ${target_cc:=$cc}
+ : ${target_ccas:=$ccas}
+ : ${target_as:=$as}
+ : ${target_ld:=$ld}
+ : ${target_ar:=$ar}
+ : ${target_as:=$as}
+ : ${target_ld:=$ld}
+ : ${target_nm:=$nm}
+ : ${target_objcopy:=$objcopy}
+ : ${target_ranlib:=$ranlib}
+ : ${target_strip:=$strip}
+ fi
+ if test -n "$target_cc"; then
+ case $1 in
+ i386|x86_64)
+ if $target_cc --version | grep -qi "clang"; then
+ unset target_cc
+ fi
+ ;;
+ esac
+ fi
+}
+
+probe_target_compilers() {
+ for i; do
+ probe_target_compiler $i
+ test -n "$target_cc" && return 0
+ done
+}
+
+write_target_makefile() {
+ if test -n "$target_cc"; then
+ echo "CC=$target_cc"
+ echo "CCAS=$target_ccas"
+ fi
+ if test -n "$target_ar"; then
+ echo "AR=$target_ar"
+ fi
+ if test -n "$target_as"; then
+ echo "AS=$target_as"
+ fi
+ if test -n "$target_ld"; then
+ echo "LD=$target_ld"
+ fi
+ if test -n "$target_nm"; then
+ echo "NM=$target_nm"
+ fi
+ if test -n "$target_objcopy"; then
+ echo "OBJCOPY=$target_objcopy"
+ fi
+ if test -n "$target_ranlib"; then
+ echo "RANLIB=$target_ranlib"
+ fi
+ if test -n "$target_strip"; then
+ echo "STRIP=$target_strip"
+ fi
+}
+
+write_container_target_makefile() {
+ if test -n "$container_cross_cc"; then
+ echo "CC=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+ echo "CCAS=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+ fi
+ echo "AR=\$(DOCKER_SCRIPT) cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
+ echo "AS=\$(DOCKER_SCRIPT) cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
+ echo "LD=\$(DOCKER_SCRIPT) cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
+ echo "NM=\$(DOCKER_SCRIPT) cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
+ echo "OBJCOPY=\$(DOCKER_SCRIPT) cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
+ echo "RANLIB=\$(DOCKER_SCRIPT) cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
+ echo "STRIP=\$(DOCKER_SCRIPT) cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
+}
+
+
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
if test "$fortify_source" = "yes" ; then
QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
- debug=no
fi
case "$ARCH" in
fi
fi
-# Use ASLR, no-SEH and DEP if available
-if test "$mingw32" = "yes" ; then
- flags="--no-seh --nxcompat"
-
- # Disable ASLR for debug builds to allow debugging with gdb
- if test "$debug" = "no" ; then
- flags="--dynamicbase $flags"
- fi
-
- for flag in $flags; do
- if ld_has $flag ; then
- QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS"
- fi
- done
-fi
-
# Guest agent Windows MSI package
if test "$QEMU_GA_MANUFACTURER" = ""; then
QEMU_GA_VERSION=$(cat $source_path/VERSION)
fi
-QEMU_GA_MSI_MINGW_BIN_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
+
+#######################################
+# cross-compiled firmware targets
+
+# Set up build tree symlinks that point back into the source tree
+# (these can be both files and directories).
+# Caution: avoid adding files or directories here using wildcards. This
+# will result in problems later if a new file matching the wildcard is
+# added to the source tree -- nothing will cause configure to be rerun
+# so the build tree will be missing the link back to the new file, and
+# tests might fail. Prefer to keep the relevant files in their own
+# directory and symlink the directory instead.
+LINKS="Makefile"
+LINKS="$LINKS tests/tcg/Makefile.target"
+LINKS="$LINKS pc-bios/optionrom/Makefile"
+LINKS="$LINKS pc-bios/s390-ccw/Makefile"
+LINKS="$LINKS pc-bios/vof/Makefile"
+LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
+LINKS="$LINKS tests/avocado tests/data"
+LINKS="$LINKS tests/qemu-iotests/check"
+LINKS="$LINKS python"
+LINKS="$LINKS contrib/plugins/Makefile "
+for f in $LINKS ; do
+ if [ -e "$source_path/$f" ]; then
+ mkdir -p `dirname ./$f`
+ symlink "$source_path/$f" "$f"
+ fi
+done
# Mac OS X ships with a broken assembler
roms=
-if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \
+probe_target_compilers i386 x86_64
+if test -n "$target_cc" &&
test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
test "$targetos" != "haiku" && test "$softmmu" = yes ; then
# Different host OS linkers have different ideas about the name of the ELF
# emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
# variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
- if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
+ if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
ld_i386_emulation="$emu"
- roms="optionrom"
break
fi
done
+ if test -n "$ld_i386_emulation"; then
+ roms="optionrom"
+ config_mak=pc-bios/optionrom/config.mak
+ echo "# Automatically generated by configure - do not modify" > $config_mak
+ echo "TOPSRC_DIR=$source_path" >> $config_mak
+ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_mak
+ write_target_makefile >> $config_mak
+ fi
fi
-# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
-# or -march=z10 (which is the lowest architecture level that Clang supports)
-if test "$cpu" = "s390x" ; then
+probe_target_compilers ppc ppc64
+if test -n "$target_cc" && test "$softmmu" = yes; then
+ roms="$roms vof"
+ config_mak=pc-bios/vof/config.mak
+ echo "# Automatically generated by configure - do not modify" > $config_mak
+ echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
+ write_target_makefile >> $config_mak
+fi
+
+# Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
+# (which is the lowest architecture level that Clang supports)
+probe_target_compiler s390x
+if test -n "$target_cc" && test "$softmmu" = yes; then
write_c_skeleton
- compile_prog "-march=z900" ""
+ do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
has_z900=$?
- if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then
+ if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
if [ $has_z900 != 0 ]; then
echo "WARNING: Your compiler does not support the z900!"
echo " The s390-ccw bios will only work with guest CPUs >= z10."
fi
roms="$roms s390-ccw"
+ config_mak=pc-bios/s390-ccw/config-host.mak
+ echo "# Automatically generated by configure - do not modify" > $config_mak
+ echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
+ write_target_makefile >> $config_mak
# SLOF is required for building the s390-ccw firmware on s390x,
# since it is using the libnet code from SLOF for network booting.
git_submodules="${git_submodules} roms/SLOF"
fi
fi
+#######################################
+# generate config-host.mak
+
# Check that the C++ compiler exists and works with the C compiler.
# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
if has $cxx; then
fi
if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=y" >> $config_host_mak
- echo "QEMU_GA_MSI_MINGW_BIN_PATH=${QEMU_GA_MSI_MINGW_BIN_PATH}" >> $config_host_mak
echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
if test "$static" = "yes" ; then
echo "CONFIG_STATIC=y" >> $config_host_mak
fi
-echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
-echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
-qemu_version=$(head $source_path/VERSION)
-echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak
if test "$modules" = "yes"; then
- # $shacmd can generate a hash started with digit, which the compiler doesn't
- # like as an symbol. So prefix it with an underscore
- echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
echo "CONFIG_MODULES=y" >> $config_host_mak
fi
-echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
-
-if test "$vhost_scsi" = "yes" ; then
- echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
-fi
-if test "$vhost_net" = "yes" ; then
- echo "CONFIG_VHOST_NET=y" >> $config_host_mak
-fi
-if test "$vhost_net_user" = "yes" ; then
- echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
-fi
-if test "$vhost_net_vdpa" = "yes" ; then
- echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
-fi
-if test "$vhost_crypto" = "yes" ; then
- echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
-fi
-if test "$vhost_vsock" = "yes" ; then
- echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
- if test "$vhost_user" = "yes" ; then
- echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
- fi
-fi
-if test "$vhost_kernel" = "yes" ; then
- echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
-fi
-if test "$vhost_user" = "yes" ; then
- echo "CONFIG_VHOST_USER=y" >> $config_host_mak
-fi
-if test "$vhost_vdpa" = "yes" ; then
- echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
-fi
-if test "$vhost_user_fs" = "yes" ; then
- echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
-fi
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
echo "MESON=$meson" >> $config_host_mak
echo "NINJA=$ninja" >> $config_host_mak
echo "CC=$cc" >> $config_host_mak
-echo "AR=$ar" >> $config_host_mak
-echo "AS=$as" >> $config_host_mak
-echo "CCAS=$ccas" >> $config_host_mak
-echo "CPP=$cpp" >> $config_host_mak
-echo "OBJCOPY=$objcopy" >> $config_host_mak
-echo "LD=$ld" >> $config_host_mak
-echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
echo "QEMU_OBJCFLAGS=$QEMU_OBJCFLAGS" >> $config_host_mak
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
+echo "GLIB_BINDIR=$glib_bindir" >> $config_host_mak
echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
-echo "STRIP=$strip" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
# use included Linux headers
esac
done
-echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak
if test "$default_targets" = "yes"; then
echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
fi
echo "CONFIG_SAFESTACK=y" >> $config_host_mak
fi
-# If we're using a separate build tree, set it up now.
-# LINKS are things to symlink back into the source tree
-# (these can be both files and directories).
-# Caution: do not add files or directories here using wildcards. This
-# will result in problems later if a new file matching the wildcard is
-# added to the source tree -- nothing will cause configure to be rerun
-# so the build tree will be missing the link back to the new file, and
-# tests might fail. Prefer to keep the relevant files in their own
-# directory and symlink the directory instead.
-LINKS="Makefile"
-LINKS="$LINKS tests/tcg/Makefile.target"
-LINKS="$LINKS pc-bios/optionrom/Makefile"
-LINKS="$LINKS pc-bios/s390-ccw/Makefile"
-LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
-LINKS="$LINKS tests/avocado tests/data"
-LINKS="$LINKS tests/qemu-iotests/check"
-LINKS="$LINKS python"
-LINKS="$LINKS contrib/plugins/Makefile "
-for bios_file in \
- $source_path/pc-bios/*.bin \
- $source_path/pc-bios/*.elf \
- $source_path/pc-bios/*.lid \
- $source_path/pc-bios/*.rom \
- $source_path/pc-bios/*.dtb \
- $source_path/pc-bios/*.img \
- $source_path/pc-bios/openbios-* \
- $source_path/pc-bios/u-boot.* \
- $source_path/pc-bios/palcode-* \
- $source_path/pc-bios/qemu_vga.ndrv
+# tests/tcg configuration
+(makefile=tests/tcg/Makefile.prereqs
+echo "# Automatically generated by configure - do not modify" > $makefile
-do
- LINKS="$LINKS pc-bios/$(basename $bios_file)"
-done
-for f in $LINKS ; do
- if [ -e "$source_path/$f" ]; then
- mkdir -p `dirname ./$f`
- symlink "$source_path/$f" "$f"
- fi
-done
+config_host_mak=tests/tcg/config-host.mak
+echo "# Automatically generated by configure - do not modify" > $config_host_mak
+echo "SRC_PATH=$source_path" >> $config_host_mak
+echo "HOST_CC=$host_cc" >> $config_host_mak
-(for i in $cross_cc_vars; do
- export $i
-done
-export target_list source_path use_containers cpu host_cc
-$source_path/tests/tcg/configure.sh)
+tcg_tests_targets=
+for target in $target_list; do
+ arch=${target%%-*}
+
+ probe_target_compiler ${arch}
+ config_target_mak=tests/tcg/config-$target.mak
+
+ echo "# Automatically generated by configure - do not modify" > $config_target_mak
+ echo "TARGET_NAME=$arch" >> $config_target_mak
+ case $target in
+ *-softmmu)
+ test -f $source_path/tests/tcg/$arch/Makefile.softmmu-target || continue
+ qemu="qemu-system-$arch"
+ ;;
+ *-linux-user|*-bsd-user)
+ qemu="qemu-$arch"
+ ;;
+ esac
-config_mak=pc-bios/optionrom/config.mak
-echo "# Automatically generated by configure - do not modify" > $config_mak
-echo "TOPSRC_DIR=$source_path" >> $config_mak
+ got_cross_cc=no
+ unset build_static
+
+ if test -n "$target_cc"; then
+ write_c_skeleton
+ if ! do_compiler "$target_cc" $target_cflags \
+ -o $TMPE $TMPC -static ; then
+ # For host systems we might get away with building without -static
+ if do_compiler "$target_cc" $target_cflags \
+ -o $TMPE $TMPC ; then
+ got_cross_cc=yes
+ fi
+ else
+ got_cross_cc=yes
+ build_static=y
+ fi
+ elif test -n "$target_as" && test -n "$target_ld"; then
+ # Special handling for assembler only tests
+ case $target in
+ tricore-softmmu) got_cross_cc=yes ;;
+ esac
+ fi
+
+ if test $got_cross_cc = yes; then
+ # Test for compiler features for optional tests. We only do this
+ # for cross compilers because ensuring the docker containers based
+ # compilers is a requirememt for adding a new test that needs a
+ # compiler feature.
+
+ echo "BUILD_STATIC=$build_static" >> $config_target_mak
+ write_target_makefile >> $config_target_mak
+ case $target in
+ aarch64-*)
+ if do_compiler "$target_cc" $target_cflags \
+ -march=armv8.1-a+sve -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
+ fi
+ if do_compiler "$target_cc" $target_cflags \
+ -march=armv8.1-a+sve2 -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_SVE2=y" >> $config_target_mak
+ fi
+ if do_compiler "$target_cc" $target_cflags \
+ -march=armv8.3-a -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak
+ fi
+ if do_compiler "$target_cc" $target_cflags \
+ -mbranch-protection=standard -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak
+ fi
+ if do_compiler "$target_cc" $target_cflags \
+ -march=armv8.5-a+memtag -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak
+ fi
+ ;;
+ ppc*)
+ if do_compiler "$target_cc" $target_cflags \
+ -mpower8-vector -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
+ fi
+ if do_compiler "$target_cc" $target_cflags \
+ -mpower10 -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
+ fi
+ ;;
+ i386-linux-user)
+ if do_compiler "$target_cc" $target_cflags \
+ -Werror -fno-pie -o $TMPE $TMPC; then
+ echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak
+ fi
+ ;;
+ esac
+ elif test -n "$container_image"; then
+ echo "build-tcg-tests-$target: docker-image-$container_image" >> $makefile
+ echo "BUILD_STATIC=y" >> $config_target_mak
+ write_container_target_makefile >> $config_target_mak
+ case $target in
+ aarch64-*)
+ echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
+ echo "CROSS_CC_HAS_SVE2=y" >> $config_target_mak
+ echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak
+ echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak
+ echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak
+ ;;
+ ppc*)
+ echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
+ echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
+ ;;
+ i386-linux-user)
+ echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak
+ ;;
+ esac
+ got_cross_cc=yes
+ fi
+ if test $got_cross_cc = yes; then
+ mkdir -p tests/tcg/$target
+ echo "QEMU=$PWD/$qemu" >> $config_target_mak
+ echo "EXTRA_CFLAGS=$target_cflags" >> $config_target_mak
+ echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
+ tcg_tests_targets="$tcg_tests_targets $target"
+ fi
+done
+echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $makefile)
if test "$skip_meson" = no; then
cross="config-meson.cross.new"
mv $cross config-meson.cross
rm -rf meson-private meson-info meson-logs
+
+ # Built-in options
+ test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
+ test "$default_feature" = no && meson_option_add -Dauto_features=disabled
+ test "$pie" = no && meson_option_add -Db_pie=false
+ test "$werror" = yes && meson_option_add -Dwerror=true
+
+ # QEMU options
+ test "$cfi" != false && meson_option_add "-Dcfi=$cfi"
+ test "$fdt" != auto && meson_option_add "-Dfdt=$fdt"
+ test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
+ test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
+ test "$slirp" != auto && meson_option_add "-Dslirp=$slirp"
+ test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
+ test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
run_meson() {
- NINJA=$ninja $meson setup \
- --prefix "$prefix" \
- --libdir "$libdir" \
- --libexecdir "$libexecdir" \
- --bindir "$bindir" \
- --includedir "$includedir" \
- --datadir "$datadir" \
- --mandir "$mandir" \
- --sysconfdir "$sysconfdir" \
- --localedir "$localedir" \
- --localstatedir "$local_statedir" \
- -Daudio_drv_list=$audio_drv_list \
- -Ddefault_devices=$default_devices \
- -Ddocdir="$docdir" \
- -Diasl="$iasl" \
- -Dqemu_firmwarepath="$firmwarepath" \
- -Dqemu_suffix="$qemu_suffix" \
- -Dsmbd="$smbd" \
- -Dsphinx_build="$sphinx_build" \
- -Dtrace_file="$trace_file" \
- -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
- -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
- -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
- -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
- -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
- -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg \
- -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
- $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
- $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
- "$@" $cross_arg "$PWD" "$source_path"
+ NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
}
eval run_meson $meson_options
if test "$?" -ne 0 ; then
preserve_env AR
preserve_env AS
preserve_env CC
-preserve_env CPP
preserve_env CFLAGS
preserve_env CXX
preserve_env CXXFLAGS