return 1
}
+supported_hvf_target() {
+ test "$hvf" = "yes" || return 1
+ glob "$1" "*-softmmu" || return 1
+ case "${1%-softmmu}" in
+ x86_64)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+supported_whpx_target() {
+ test "$whpx" = "yes" || return 1
+ glob "$1" "*-softmmu" || return 1
+ case "${1%-softmmu}" in
+ i386|x86_64)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
supported_target() {
case "$1" in
*-softmmu)
supported_kvm_target "$1" && return 0
supported_xen_target "$1" && return 0
supported_hax_target "$1" && return 0
+ supported_hvf_target "$1" && return 0
+ supported_whpx_target "$1" && return 0
print_error "TCG disabled, but hardware accelerator not available for '$target'"
return 1
}
vhost_user=""
kvm="no"
hax="no"
+hvf="no"
+whpx="no"
rdma=""
gprof="no"
debug_tcg="no"
debug="no"
+sanitizers="no"
fortify_source=""
strip_opt="yes"
tcg_interpreter="no"
jemalloc="no"
replication="yes"
vxhs=""
+libxml2=""
supported_cpu="no"
supported_os="no"
bogus_os="no"
+malloc_trim=""
# parse CC options first
for opt do
--cpu=*) cpu="$optarg"
;;
--extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
- EXTRA_CFLAGS="$optarg"
;;
--extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
- EXTRA_CXXFLAGS="$optarg"
;;
--extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
EXTRA_LDFLAGS="$optarg"
fi
elif check_define __mips__ ; then
cpu="mips"
-elif check_define __ia64__ ; then
- cpu="ia64"
elif check_define __s390__ ; then
if check_define __s390x__ ; then
cpu="s390x"
bsd="yes"
darwin="yes"
hax="yes"
+ hvf="yes"
LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
if [ "$cpu" = "x86_64" ] ; then
QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
strip_opt="no"
fortify_source="no"
;;
+ --enable-sanitizers) sanitizers="yes"
+ ;;
+ --disable-sanitizers) sanitizers="no"
+ ;;
--enable-sparse) sparse="yes"
;;
--disable-sparse) sparse="no"
;;
--enable-hax) hax="yes"
;;
+ --disable-hvf) hvf="no"
+ ;;
+ --enable-hvf) hvf="yes"
+ ;;
+ --disable-whpx) whpx="no"
+ ;;
+ --enable-whpx) whpx="yes"
+ ;;
--disable-tcg-interpreter) tcg_interpreter="no"
;;
--enable-tcg-interpreter) tcg_interpreter="yes"
;;
--enable-tcg) tcg="yes"
;;
+ --disable-malloc-trim) malloc_trim="no"
+ ;;
+ --enable-malloc-trim) malloc_trim="yes"
+ ;;
--disable-spice) spice="no"
;;
--enable-spice) spice="yes"
;;
--enable-numa) numa="yes"
;;
+ --disable-libxml2) libxml2="no"
+ ;;
+ --enable-libxml2) libxml2="yes"
+ ;;
--disable-tcmalloc) tcmalloc="no"
;;
--enable-tcmalloc) tcmalloc="yes"
esac
QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
-EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
# For user-mode emulation the host arch has to be one we explicitly
# support, even if we're using TCI.
--firmwarepath=PATH search PATH for firmware files
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
--enable-debug enable common debug build options
+ --enable-sanitizers enable default sanitizers
--disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
Default:trace-<pid>
--disable-slirp disable SLIRP userspace network connectivity
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
+ --enable-malloc-trim enable libc malloc_trim() for memory optimization
--oss-lib path to OSS library
--cpu=CPU Build for host CPU [$cpu]
--with-coroutine=BACKEND coroutine backend. Supported options:
bluez bluez stack connectivity
kvm KVM acceleration support
hax HAX acceleration support
- rdma RDMA-based migration support
+ hvf Hypervisor.framework acceleration support
+ whpx Windows Hypervisor Platform acceleration support
+ rdma Enable RDMA-based migration and PVRDMA support
vde support for vde network
netmap support for netmap network
linux-aio Linux AIO support
tpm TPM support
libssh2 ssh block device support
numa libnuma support
+ libxml2 for Parallels image format
tcmalloc tcmalloc support
jemalloc jemalloc support
replication replication support
# Note that if the Python conditional here evaluates True we will exit
# with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
- error_exit "Cannot use '$python', Python 2.6 or later is required." \
- "Note that Python 3 or later is not yet supported." \
+if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then
+ error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
"Use --python=/path/to/python to specify a supported Python."
fi
EOF
if compile_object ; then
- if grep -q BiGeNdIaN $TMPO ; then
+ if strings -a $TMPO | grep -q BiGeNdIaN ; then
bigendian="yes"
- elif grep -q LiTtLeEnDiAn $TMPO ; then
+ elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
bigendian="no"
else
echo big/little test failed
"which requires Xen support."
fi
+##########################################
+# Windows Hypervisor Platform accelerator (WHPX) check
+if test "$whpx" != "no" ; then
+ cat > $TMPC << EOF
+#include <windows.h>
+#include <winhvplatform.h>
+#include <winhvemulation.h>
+int main(void) {
+ WHV_CAPABILITY whpx_cap;
+ WHvGetCapability(WHvCapabilityCodeFeatures, &whpx_cap, sizeof(whpx_cap));
+ return 0;
+}
+EOF
+ if compile_prog "" "-lwinhvplatform -lwinhvemulation" ; then
+ libs_softmmu="$libs_softmmu -lwinhvplatform -lwinhvemulation"
+ whpx="yes"
+ else
+ if test "$whpx" = "yes"; then
+ feature_not_found "winhvplatform" "winhvemulation is not installed"
+ fi
+ whpx="no"
+ fi
+fi
+
##########################################
# Sparse probe
if test "$sparse" != "no" ; then
#include <rdma/rdma_cma.h>
int main(void) { return 0; }
EOF
- rdma_libs="-lrdmacm -libverbs"
+ rdma_libs="-lrdmacm -libverbs -libumad"
if compile_prog "" "$rdma_libs" ; then
rdma="yes"
+ libs_softmmu="$libs_softmmu $rdma_libs"
else
if test "$rdma" = "yes" ; then
error_exit \
- " OpenFabrics librdmacm/libibverbs not present." \
+ " OpenFabrics librdmacm/libibverbs/libibumad not present." \
" Your options:" \
- " (1) Fast: Install infiniband packages from your distro." \
+ " (1) Fast: Install infiniband packages (devel) from your distro." \
" (2) Cleanest: Install libraries from www.openfabrics.org" \
" (3) Also: Install softiwarp if you don't have RDMA hardware"
fi
done
if test "$found" = "no"; then
LIBS="$pthread_lib $LIBS"
+ libs_qga="$pthread_lib $libs_qga"
fi
PTHREAD_LIB="$pthread_lib"
break
fi
fi
+##########################################
+# libxml2 probe
+if test "$libxml2" != "no" ; then
+ if $pkg_config --exists libxml-2.0; then
+ libxml2="yes"
+ libxml2_cflags=$($pkg_config --cflags libxml-2.0)
+ libxml2_libs=$($pkg_config --libs libxml-2.0)
+ else
+ if test "$libxml2" = "yes"; then
+ feature_not_found "libxml2" "Install libxml2 devel"
+ fi
+ libxml2="no"
+ fi
+fi
##########################################
# glusterfs probe
exit 1
fi
+# Even if malloc_trim() is available, these non-libc memory allocators
+# do not support it.
+if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
+ if test "$malloc_trim" = "yes" ; then
+ echo "Disabling malloc_trim with non-libc memory allocator"
+ fi
+ malloc_trim="no"
+fi
+
+#######################################
+# malloc_trim
+
+if test "$malloc_trim" != "no" ; then
+ cat > $TMPC << EOF
+#include <malloc.h>
+int main(void) { malloc_trim(0); return 0; }
+EOF
+ if compile_prog "" "" ; then
+ malloc_trim="yes"
+ else
+ malloc_trim="no"
+ fi
+fi
+
##########################################
# tcmalloc probe
# check if memfd is supported
memfd=no
cat > $TMPC << EOF
-#include <sys/memfd.h>
+#include <sys/mman.h>
int main(void)
{
"" | yes)
if $pkg_config capstone; then
capstone=system
- elif test -e "${source_path}/.git" ; then
+ elif test -e "${source_path}/.git" -a $git_update = 'yes' ; then
capstone=git
elif test -e "${source_path}/capstone/Makefile" ; then
capstone=internal
posix_madvise=yes
fi
+##########################################
+# check if we have posix_memalign()
+
+posix_memalign=no
+cat > $TMPC << EOF
+#include <stdlib.h>
+int main(void) {
+ void *p;
+ return posix_memalign(&p, 8, 8);
+}
+EOF
+if compile_prog "" "" ; then
+ posix_memalign=yes
+fi
+
##########################################
# check if we have posix_syslog
fi
if test "$debug_stack_usage" = "yes"; then
- if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then
- error_exit "stack usage debugging is not supported for $cpu"
- fi
if test "$coroutine_pool" = "yes"; then
echo "WARN: disabling coroutine pool for stack usage debugging"
coroutine_pool=no
atomic64=yes
fi
+########################################
+# See if 16-byte vector operations are supported.
+# Even without a vector unit the compiler may expand these.
+# There is a bug in old GCC for PPC that crashes here.
+# Unfortunately it's the system compiler for Centos 7.
+
+cat > $TMPC << EOF
+typedef unsigned char U1 __attribute__((vector_size(16)));
+typedef unsigned short U2 __attribute__((vector_size(16)));
+typedef unsigned int U4 __attribute__((vector_size(16)));
+typedef unsigned long long U8 __attribute__((vector_size(16)));
+typedef signed char S1 __attribute__((vector_size(16)));
+typedef signed short S2 __attribute__((vector_size(16)));
+typedef signed int S4 __attribute__((vector_size(16)));
+typedef signed long long S8 __attribute__((vector_size(16)));
+static U1 a1, b1;
+static U2 a2, b2;
+static U4 a4, b4;
+static U8 a8, b8;
+static S1 c1;
+static S2 c2;
+static S4 c4;
+static S8 c8;
+static int i;
+int main(void)
+{
+ a1 += b1; a2 += b2; a4 += b4; a8 += b8;
+ a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8;
+ a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8;
+ a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8;
+ a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8;
+ a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8;
+ a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i;
+ a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i;
+ c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i;
+ return 0;
+}
+EOF
+
+vector16=no
+if compile_prog "" "" ; then
+ vector16=yes
+fi
+
########################################
# check if getauxval is available.
fi
+#################################################
+# Check to see if we have the Hypervisor framework
+if [ "$darwin" = "yes" ] ; then
+ cat > $TMPC << EOF
+#include <Hypervisor/hv.h>
+int main() { return 0;}
+EOF
+ if ! compile_object ""; then
+ hvf='no'
+ else
+ hvf='yes'
+ LDFLAGS="-framework Hypervisor $LDFLAGS"
+ fi
+fi
+
#################################################
# Sparc implicitly links with --relax, which is
# incompatible with -r, so --no-relax should be
have_utmpx=yes
fi
+##########################################
+# checks for sanitizers
+
+# we could use a simple skeleton for flags checks, but this also
+# detect the static linking issue of ubsan, see also:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
+cat > $TMPC << EOF
+#include <stdint.h>
+int main(void) {
+ return INT32_MIN / -1;
+}
+EOF
+
+have_asan=no
+have_ubsan=no
+have_asan_iface_h=no
+have_asan_iface_fiber=no
+
+if test "$sanitizers" = "yes" ; then
+ if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
+ have_asan=yes
+ fi
+ if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
+ have_ubsan=yes
+ fi
+
+ if check_include "sanitizer/asan_interface.h" ; then
+ have_asan_iface_h=yes
+ fi
+
+ cat > $TMPC << EOF
+#include <sanitizer/asan_interface.h>
+int main(void) {
+ __sanitizer_start_switch_fiber(0, 0, 0);
+ return 0;
+}
+EOF
+ if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
+ have_asan_iface_fiber=yes
+ fi
+fi
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
+write_c_skeleton
+
if test "$gcov" = "yes" ; then
CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
elif test "$fortify_source" = "yes" ; then
CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
- CFLAGS="-O2 $CFLAGS"
+elif test "$debug" = "yes"; then
+ if compile_prog "-Og" ""; then
+ CFLAGS="-Og $CFLAGS"
+ elif compile_prog "-O1" ""; then
+ CFLAGS="-O1 $CFLAGS"
+ fi
+ # Workaround GCC false-positive Wuninitialized bugs with Og or O1:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
+ if cc_has_warning_flag "-Wno-maybe-uninitialized"; then
+ CFLAGS="-Wno-maybe-uninitialized $CFLAGS"
+ fi
+else
+ CFLAGS="-O2 $CFLAGS"
+fi
+
+if test "$have_asan" = "yes"; then
+ CFLAGS="-fsanitize=address $CFLAGS"
+ if test "$have_asan_iface_h" = "no" ; then
+ echo "ASAN build enabled, but ASAN header missing." \
+ "Without code annotation, the report may be inferior."
+ elif test "$have_asan_iface_fiber" = "no" ; then
+ echo "ASAN build enabled, but ASAN header is too old." \
+ "Without code annotation, the report may be inferior."
+ fi
+fi
+if test "$have_ubsan" = "yes"; then
+ CFLAGS="-fsanitize=undefined $CFLAGS"
fi
##########################################
echo "Install blobs $blobs"
echo "KVM support $kvm"
echo "HAX support $hax"
+echo "HVF support $hvf"
+echo "WHPX support $whpx"
echo "TCG support $tcg"
if test "$tcg" = "yes" ; then
echo "TCG debug enabled $debug_tcg"
echo "TCG interpreter $tcg_interpreter"
fi
+echo "malloc trim support $malloc_trim"
echo "RDMA support $rdma"
echo "fdt support $fdt"
echo "preadv support $preadv"
echo "fdatasync $fdatasync"
echo "madvise $madvise"
echo "posix_madvise $posix_madvise"
+echo "posix_memalign $posix_memalign"
echo "libcap-ng support $cap_ng"
echo "vhost-net support $vhost_net"
echo "vhost-scsi support $vhost_scsi"
echo "snappy support $snappy"
echo "bzip2 support $bzip2"
echo "NUMA host support $numa"
+echo "libxml2 $libxml2"
echo "tcmalloc support $tcmalloc"
echo "jemalloc support $jemalloc"
echo "avx2 optimization $avx2_opt"
echo "-> Your SDL version is too old - please upgrade to have SDL support"
fi
+if test "$gtkabi" = "2.0"; then
+ echo
+ echo "WARNING: Use of GTK 2.0 is deprecated and will be removed in"
+ echo "WARNING: future releases. Please switch to using GTK 3.0"
+fi
+
+if test "$sdlabi" = "1.2"; then
+ echo
+ echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in"
+ echo "WARNING: future releases. Please switch to using SDL 2.0"
+fi
+
if test "$supported_cpu" = "no"; then
echo
echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
fi
echo "qemu_helperdir=$libexecdir" >> $config_host_mak
-echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
-echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
-echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
echo "GIT=$git" >> $config_host_mak
echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
fi
if test "$guest_agent_msi" = "yes"; then
- echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
+ echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
if test "$posix_madvise" = "yes" ; then
echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
fi
+if test "$posix_memalign" = "yes" ; then
+ echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
+fi
if test "$spice" = "yes" ; then
echo "CONFIG_SPICE=y" >> $config_host_mak
fi
fi
+if test "$malloc_trim" = "yes" ; then
+ echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
+fi
+
if test "$avx2_opt" = "yes" ; then
echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
fi
echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
fi
+if test "$have_asan_iface_fiber" = "yes" ; then
+ echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
+fi
+
if test "$has_environ" = "yes" ; then
echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
fi
echo "CONFIG_ATOMIC64=y" >> $config_host_mak
fi
+if test "$vector16" = "yes" ; then
+ echo "CONFIG_VECTOR16=y" >> $config_host_mak
+fi
+
if test "$getauxval" = "yes" ; then
echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
fi
echo "CONFIG_RTNETLINK=y" >> $config_host_mak
fi
+if test "$libxml2" = "yes" ; then
+ echo "CONFIG_LIBXML2=y" >> $config_host_mak
+ echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
+ echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
+fi
+
if test "$replication" = "yes" ; then
echo "CONFIG_REPLICATION=y" >> $config_host_mak
fi
target_bigendian="no"
case "$target_name" in
- armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
+ armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
target_bigendian=yes
;;
esac
mttcg="yes"
gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
;;
- aarch64)
+ aarch64|aarch64_be)
+ TARGET_ARCH=aarch64
TARGET_BASE_ARCH=arm
bflt="yes"
mttcg="yes"
cris)
;;
hppa)
+ mttcg="yes"
;;
lm32)
;;
echo "TARGET_ABI32=y" >> $config_target_mak
;;
s390x)
+ mttcg=yes
gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
;;
tilegx)
if supported_hax_target $target; then
echo "CONFIG_HAX=y" >> $config_target_mak
fi
+if supported_hvf_target $target; then
+ echo "CONFIG_HVF=y" >> $config_target_mak
+fi
+if supported_whpx_target $target; then
+ echo "CONFIG_WHPX=y" >> $config_target_mak
+fi
if test "$target_bigendian" = "yes" ; then
echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
fi