# 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 $?
# Test passed. If this is an --enable-werror build, rerun
libattr=""
xfs=""
tcg="yes"
-
+membarrier=""
vhost_net="no"
vhost_crypto="no"
vhost_scsi="no"
replication="yes"
vxhs=""
libxml2=""
+docker="no"
supported_cpu="no"
supported_os="no"
QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $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_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/accel/tcg -I\$(SRC_PATH)/include"
+QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include"
if test "$debug_info" = "yes"; then
CFLAGS="-g $CFLAGS"
LDFLAGS="-g $LDFLAGS"
;;
--firmwarepath=*) firmwarepath="$optarg"
;;
+ --host=*|--build=*|\
+ --disable-dependency-tracking|\
--sbindir=*|--sharedstatedir=*|\
--oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
--htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
;;
--enable-attr) attr="yes"
;;
+ --disable-membarrier) membarrier="no"
+ ;;
+ --enable-membarrier) membarrier="yes"
+ ;;
--disable-blobs) blobs="no"
;;
- --with-pkgversion=*) pkgversion=" ($optarg)"
+ --with-pkgversion=*) pkgversion="$optarg"
;;
--with-coroutine=*) coroutine="$optarg"
;;
--install=INSTALL use specified install [$install]
--python=PYTHON use specified python [$python]
--smbd=SMBD use specified smbd [$smbd]
+ --with-git=GIT use specified git [$git]
--static enable static build [$static]
--mandir=PATH install man pages in PATH
--datadir=PATH install firmware in PATH$confsuffix
--docdir=PATH install documentation in PATH$confsuffix
--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$confsuffix
--localstatedir=PATH install local state in PATH (set at runtime on win32)
--firmwarepath=PATH search PATH for firmware files
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
+ --with-pkgversion=VERS use specified string as sub-version of the package
--enable-debug enable common debug build options
--enable-sanitizers enable default sanitizers
--disable-strip disable stripping binaries
virtfs VirtFS
mpath Multipath persistent reservation passthrough
xen xen backend driver support
- xen-pci-passthrough
+ xen-pci-passthrough PCI passthrough support for Xen
brlapi BrlAPI (Braile)
curl curl connectivity
+ membarrier membarrier system call (for Linux 4.14+ or Windows)
fdt fdt device tree
bluez bluez stack connectivity
kvm KVM acceleration 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))'; then
- error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
+if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
+ error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
"Use --python=/path/to/python to specify a supported Python."
fi
xen=yes
xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
xen_pc="$xen_pc xenevtchn xendevicemodel"
+ if $pkg_config --exists xentoolcore; then
+ xen_pc="$xen_pc xentoolcore"
+ fi
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
# Xen unstable
elif
cat > $TMPC <<EOF &&
+#undef XC_WANT_COMPAT_DEVICEMODEL_API
+#define __XEN_TOOLS__
+#include <xendevicemodel.h>
+#include <xenforeignmemory.h>
+int main(void) {
+ xendevicemodel_handle *xd;
+ xenforeignmemory_handle *xfmem;
+
+ xd = xendevicemodel_open(0, 0);
+ xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
+
+ xfmem = xenforeignmemory_open(0, 0);
+ xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
+
+ return 0;
+}
+EOF
+ compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
+ then
+ xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
+ xen_ctrl_version=41100
+ xen=yes
+ elif
+ cat > $TMPC <<EOF &&
#undef XC_WANT_COMPAT_MAP_FOREIGN_API
#include <xenforeignmemory.h>
+#include <xentoolcore.h>
int main(void) {
xenforeignmemory_handle *xfmem;
xfmem = xenforeignmemory_open(0, 0);
xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
+ xentoolcore_restrict_all(0);
return 0;
}
EOF
- compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
+ compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
then
- xen_stable_libs="-lxendevicemodel $xen_stable_libs"
+ xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
xen_ctrl_version=41000
xen=yes
elif
##########################################
# 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"
+ if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
whpx="yes"
else
if test "$whpx" = "yes"; then
##########################################
# GTK probe
-if test "$gtkabi" = ""; then
- # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
- # Use 2.0 as a fallback if that is available.
- if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
- gtkabi=3.0
- elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
- gtkabi=2.0
- else
- gtkabi=3.0
- fi
-fi
-
if test "$gtk" != "no"; then
+ if test "$gtkabi" = ""; then
+ # The GTK ABI was not specified explicitly, so try whether 3.0 is available.
+ # Use 2.0 as a fallback if that is available.
+ if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
+ gtkabi=3.0
+ elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
+ gtkabi=2.0
+ else
+ gtkabi=3.0
+ fi
+ fi
gtkpackage="gtk+-$gtkabi"
gtkx11package="gtk+-x11-$gtkabi"
if test "$gtkabi" = "3.0" ; then
# Look for sdl configuration program (pkg-config or sdl-config). Try
# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
-if test "$sdlabi" = ""; then
- if $pkg_config --exists "sdl2"; then
- sdlabi=2.0
- elif $pkg_config --exists "sdl"; then
- sdlabi=1.2
- else
- sdlabi=2.0
- fi
-fi
+sdl_probe ()
+{
+ sdl_too_old=no
+ if test "$sdlabi" = ""; then
+ if $pkg_config --exists "sdl2"; then
+ sdlabi=2.0
+ elif $pkg_config --exists "sdl"; then
+ sdlabi=1.2
+ else
+ sdlabi=2.0
+ fi
+ fi
-if test $sdlabi = "2.0"; then
- sdl_config=$sdl2_config
- sdlname=sdl2
- sdlconfigname=sdl2_config
-elif test $sdlabi = "1.2"; then
- sdlname=sdl
- sdlconfigname=sdl_config
-else
- error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
-fi
+ if test $sdlabi = "2.0"; then
+ sdl_config=$sdl2_config
+ sdlname=sdl2
+ sdlconfigname=sdl2_config
+ elif test $sdlabi = "1.2"; then
+ sdlname=sdl
+ sdlconfigname=sdl_config
+ else
+ error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
+ fi
-if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
- sdl_config=$sdlconfigname
-fi
+ if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
+ sdl_config=$sdlconfigname
+ fi
-if $pkg_config $sdlname --exists; then
- sdlconfig="$pkg_config $sdlname"
- sdlversion=$($sdlconfig --modversion 2>/dev/null)
-elif has ${sdl_config}; then
- sdlconfig="$sdl_config"
- sdlversion=$($sdlconfig --version)
-else
- if test "$sdl" = "yes" ; then
- feature_not_found "sdl" "Install SDL2-devel"
+ if $pkg_config $sdlname --exists; then
+ sdlconfig="$pkg_config $sdlname"
+ sdlversion=$($sdlconfig --modversion 2>/dev/null)
+ elif has ${sdl_config}; then
+ sdlconfig="$sdl_config"
+ sdlversion=$($sdlconfig --version)
+ else
+ if test "$sdl" = "yes" ; then
+ feature_not_found "sdl" "Install SDL2-devel"
+ fi
+ sdl=no
+ # no need to do the rest
+ return
+ fi
+ if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
+ echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
fi
- sdl=no
-fi
-if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
- echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
-fi
-sdl_too_old=no
-if test "$sdl" != "no" ; then
cat > $TMPC << EOF
#include <SDL.h>
#undef main /* We don't want SDL to override our main() */
fi
sdl=no
fi # sdl compile test
+}
+
+if test "$sdl" != "no" ; then
+ sdl_probe
fi
if test "$sdl" = "yes" ; then
fdt_required=no
for target in $target_list; do
case $target in
- aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu)
+ aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu)
fdt_required=yes
;;
esac
EOF
if compile_prog "" "$fdt_libs" ; then
# system DTC is good - use it
- fdt=yes
+ fdt=system
else
# have GIT checkout, so activate dtc submodule
if test -e "${source_path}/.git" ; then
git_submodules="${git_submodules} dtc"
fi
if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
- fdt=yes
- dtc_internal="yes"
+ fdt=git
mkdir -p dtc
if [ "$pwd_is_source_path" != "y" ] ; then
symlink "$source_path/dtc/Makefile" "dtc/Makefile"
symlink "$source_path/dtc/scripts" "dtc/scripts"
fi
fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
- fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
+ fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
+ fdt_libs="$fdt_libs"
elif test "$fdt" = "yes" ; then
# Not a git build & no libfdt found, prompt for system install
error_exit "DTC (libfdt) version >= 1.4.2 not present." \
# check for smartcard support
if test "$smartcard" != "no"; then
- if $pkg_config libcacard; then
+ if $pkg_config --atleast-version=2.5.1 libcacard; then
libcacard_cflags=$($pkg_config --cflags libcacard)
libcacard_libs=$($pkg_config --libs libcacard)
smartcard="yes"
static S4 c4;
static S8 c8;
static int i;
+void helper(void *d, void *a, int shift, int i);
+void helper(void *d, void *a, int shift, int i)
+{
+ *(U1 *)(d + i) = *(U1 *)(a + i) << shift;
+ *(U2 *)(d + i) = *(U2 *)(a + i) << shift;
+ *(U4 *)(d + i) = *(U4 *)(a + i) << shift;
+ *(U8 *)(d + i) = *(U8 *)(a + i) << shift;
+}
int main(void)
{
a1 += b1; a2 += b2; a4 += b4; a8 += b8;
fi
fi
+###############################################
+# Check if copy_file_range is provided by glibc
+have_copy_file_range=no
+cat > $TMPC << EOF
+#include <unistd.h>
+int main(void) {
+ copy_file_range(0, NULL, 0, NULL, 0, 0);
+ return 0;
+}
+EOF
+if compile_prog "" "" ; then
+ have_copy_file_range=yes
+fi
+
##########################################
# check if struct fsxattr is available via linux/fs.h
have_fsxattr=yes
fi
+##########################################
+# check for usable membarrier system call
+if test "$membarrier" = "yes"; then
+ have_membarrier=no
+ if test "$mingw32" = "yes" ; then
+ have_membarrier=yes
+ elif test "$linux" = "yes" ; then
+ cat > $TMPC << EOF
+ #include <linux/membarrier.h>
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ int main(void) {
+ syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
+ syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
+ exit(0);
+ }
+EOF
+ if compile_prog "" "" ; then
+ have_membarrier=yes
+ fi
+ fi
+ if test "$have_membarrier" = "no"; then
+ feature_not_found "membarrier" "membarrier system call not available"
+ fi
+else
+ # Do not enable it by default even for Mingw32, because it doesn't
+ # work on Wine.
+ membarrier=no
+fi
+
##########################################
# check if rtnetlink.h exists and is useful
have_rtnetlink=no
fi
fi
+##########################################
+# Docker and cross-compiler support
+#
+# This is specifically for building test
+# cases for foreign architectures, not
+# cross-compiling QEMU itself.
+
+if has "docker"; then
+ docker=$($python $source_path/tests/docker/docker.py probe)
+fi
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
# prepend pixman and ftd flags after all config tests are done
QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
+QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
libs_softmmu="$pixman_libs $libs_softmmu"
echo "Install prefix $prefix"
echo "CFLAGS $CFLAGS"
echo "QEMU_CFLAGS $QEMU_CFLAGS"
echo "LDFLAGS $LDFLAGS"
+echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
echo "make $make"
echo "install $install"
echo "python $python"
echo "malloc trim support $malloc_trim"
echo "RDMA support $rdma"
echo "fdt support $fdt"
+echo "membarrier $membarrier"
echo "preadv support $preadv"
echo "fdatasync $fdatasync"
echo "madvise $madvise"
echo "replication support $replication"
echo "VxHS block device $vxhs"
echo "capstone $capstone"
+echo "docker $docker"
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
echo "VERSION=$qemu_version" >>$config_host_mak
echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
-echo "TARGET_DIRS=$target_list" >> $config_host_mak
+echo "TARGET_LIST=$target_list" >> $config_host_mak
if [ "$docs" = "yes" ] ; then
echo "BUILD_DOCS=yes" >> $config_host_mak
fi
if test "$have_fsxattr" = "yes" ; then
echo "HAVE_FSXATTR=y" >> $config_host_mak
fi
+if test "$have_copy_file_range" = "yes" ; then
+ echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
+fi
if test "$vte" = "yes" ; then
echo "CONFIG_VTE=y" >> $config_host_mak
echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
if test "$preadv" = "yes" ; then
echo "CONFIG_PREADV=y" >> $config_host_mak
fi
-if test "$fdt" = "yes" ; then
+if test "$fdt" != "no" ; then
echo "CONFIG_FDT=y" >> $config_host_mak
fi
+if test "$membarrier" = "yes" ; then
+ echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
+fi
if test "$signalfd" = "yes" ; then
echo "CONFIG_SIGNALFD=y" >> $config_host_mak
fi
fi
if test "$tcg_interpreter" = "yes"; then
- QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
+ QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
elif test "$ARCH" = "sparc64" ; then
- QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
+ QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
elif test "$ARCH" = "s390x" ; then
- QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
+ QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
- QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
+ QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
elif test "$ARCH" = "ppc64" ; then
- QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
+ QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
else
- QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
+ QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
fi
-QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
+QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES"
echo "TOOLS=$tools" >> $config_host_mak
echo "ROMS=$roms" >> $config_host_mak
fi
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
+echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak
echo "GCOV=$gcov_tool" >> $config_host_mak
fi
+if test "$docker" != "no"; then
+ echo "HAVE_USER_DOCKER=y" >> $config_host_mak
+fi
+
# use included Linux headers
if test "$linux" = "yes" ; then
mkdir -p linux-headers
microblaze|microblazeel)
TARGET_ARCH=microblaze
bflt="yes"
+ echo "TARGET_ABI32=y" >> $config_target_mak
;;
mips|mipsel)
TARGET_ARCH=mips
done # for target in $targets
-if [ "$dtc_internal" = "yes" ]; then
+if [ "$fdt" = "git" ]; then
echo "config-host.h: subdir-dtc" >> $config_host_mak
fi
if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then