1#!/bin/sh 2# 3# qemu configure script (c) 2003 Fabrice Bellard 4# 5 6# Unset some variables known to interfere with behavior of common tools, 7# just as autoconf does. 8CLICOLOR_FORCE= GREP_OPTIONS= 9unset CLICOLOR_FORCE GREP_OPTIONS 10 11# Don't allow CCACHE, if present, to use cached results of compile tests! 12export CCACHE_RECACHE=yes 13 14# Temporary directory used for files created while 15# configure runs. Since it is in the build directory 16# we can safely blow away any previous version of it 17# (and we need not jump through hoops to try to delete 18# it when configure exits.) 19TMPDIR1="config-temp" 20rm -rf "${TMPDIR1}" 21mkdir -p "${TMPDIR1}" 22if [ $? -ne 0 ]; then 23 echo "ERROR: failed to create temporary directory" 24 exit 1 25fi 26 27TMPB="qemu-conf" 28TMPC="${TMPDIR1}/${TMPB}.c" 29TMPO="${TMPDIR1}/${TMPB}.o" 30TMPCXX="${TMPDIR1}/${TMPB}.cxx" 31TMPE="${TMPDIR1}/${TMPB}.exe" 32TMPMO="${TMPDIR1}/${TMPB}.mo" 33TMPTXT="${TMPDIR1}/${TMPB}.txt" 34 35rm -f config.log 36 37# Print a helpful header at the top of config.log 38echo "# QEMU configure log $(date)" >> config.log 39printf "# Configured with:" >> config.log 40printf " '%s'" "$0" "$@" >> config.log 41echo >> config.log 42echo "#" >> config.log 43 44print_error() { 45 (echo 46 echo "ERROR: $1" 47 while test -n "$2"; do 48 echo " $2" 49 shift 50 done 51 echo) >&2 52} 53 54error_exit() { 55 print_error "$@" 56 exit 1 57} 58 59do_compiler() { 60 # Run the compiler, capturing its output to the log. First argument 61 # is compiler binary to execute. 62 local compiler="$1" 63 shift 64 if test -n "$BASH_VERSION"; then eval ' 65 echo >>config.log " 66funcs: ${FUNCNAME[*]} 67lines: ${BASH_LINENO[*]}" 68 '; fi 69 echo $compiler "$@" >> config.log 70 $compiler "$@" >> config.log 2>&1 || return $? 71 # Test passed. If this is an --enable-werror build, rerun 72 # the test with -Werror and bail out if it fails. This 73 # makes warning-generating-errors in configure test code 74 # obvious to developers. 75 if test "$werror" != "yes"; then 76 return 0 77 fi 78 # Don't bother rerunning the compile if we were already using -Werror 79 case "$*" in 80 *-Werror*) 81 return 0 82 ;; 83 esac 84 echo $compiler -Werror "$@" >> config.log 85 $compiler -Werror "$@" >> config.log 2>&1 && return $? 86 error_exit "configure test passed without -Werror but failed with -Werror." \ 87 "This is probably a bug in the configure script. The failing command" \ 88 "will be at the bottom of config.log." \ 89 "You can run configure with --disable-werror to bypass this check." 90} 91 92do_cc() { 93 do_compiler "$cc" "$@" 94} 95 96do_cxx() { 97 do_compiler "$cxx" "$@" 98} 99 100update_cxxflags() { 101 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 102 # options which some versions of GCC's C++ compiler complain about 103 # because they only make sense for C programs. 104 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 105 106 for arg in $QEMU_CFLAGS; do 107 case $arg in 108 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 109 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 110 ;; 111 -std=gnu99) 112 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98" 113 ;; 114 *) 115 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 116 ;; 117 esac 118 done 119} 120 121compile_object() { 122 local_cflags="$1" 123 do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 124} 125 126compile_prog() { 127 local_cflags="$1" 128 local_ldflags="$2" 129 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $QEMU_LDFLAGS $local_ldflags 130} 131 132# symbolically link $1 to $2. Portable version of "ln -sf". 133symlink() { 134 rm -rf "$2" 135 mkdir -p "$(dirname "$2")" 136 ln -s "$1" "$2" 137} 138 139# check whether a command is available to this shell (may be either an 140# executable or a builtin) 141has() { 142 type "$1" >/dev/null 2>&1 143} 144 145# search for an executable in PATH 146path_of() { 147 local_command="$1" 148 local_ifs="$IFS" 149 local_dir="" 150 151 # pathname has a dir component? 152 if [ "${local_command#*/}" != "$local_command" ]; then 153 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 154 echo "$local_command" 155 return 0 156 fi 157 fi 158 if [ -z "$local_command" ]; then 159 return 1 160 fi 161 162 IFS=: 163 for local_dir in $PATH; do 164 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 165 echo "$local_dir/$local_command" 166 IFS="${local_ifs:-$(printf ' \t\n')}" 167 return 0 168 fi 169 done 170 # not found 171 IFS="${local_ifs:-$(printf ' \t\n')}" 172 return 1 173} 174 175have_backend () { 176 echo "$trace_backends" | grep "$1" >/dev/null 177} 178 179glob() { 180 eval test -z '"${1#'"$2"'}"' 181} 182 183supported_hax_target() { 184 test "$hax" = "yes" || return 1 185 glob "$1" "*-softmmu" || return 1 186 case "${1%-softmmu}" in 187 i386|x86_64) 188 return 0 189 ;; 190 esac 191 return 1 192} 193 194supported_kvm_target() { 195 test "$kvm" = "yes" || return 1 196 glob "$1" "*-softmmu" || return 1 197 case "${1%-softmmu}:$cpu" in 198 arm:arm | aarch64:aarch64 | \ 199 i386:i386 | i386:x86_64 | i386:x32 | \ 200 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ 201 mips:mips | mipsel:mips | mips64:mips | mips64el:mips | \ 202 ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \ 203 s390x:s390x) 204 return 0 205 ;; 206 esac 207 return 1 208} 209 210supported_xen_target() { 211 test "$xen" = "yes" || return 1 212 glob "$1" "*-softmmu" || return 1 213 # Only i386 and x86_64 provide the xenpv machine. 214 case "${1%-softmmu}" in 215 i386|x86_64) 216 return 0 217 ;; 218 esac 219 return 1 220} 221 222supported_hvf_target() { 223 test "$hvf" = "yes" || return 1 224 glob "$1" "*-softmmu" || return 1 225 case "${1%-softmmu}" in 226 x86_64) 227 return 0 228 ;; 229 esac 230 return 1 231} 232 233supported_whpx_target() { 234 test "$whpx" = "yes" || return 1 235 glob "$1" "*-softmmu" || return 1 236 case "${1%-softmmu}" in 237 i386|x86_64) 238 return 0 239 ;; 240 esac 241 return 1 242} 243 244supported_target() { 245 case "$1" in 246 *-softmmu) 247 ;; 248 *-linux-user) 249 if test "$linux" != "yes"; then 250 print_error "Target '$target' is only available on a Linux host" 251 return 1 252 fi 253 ;; 254 *-bsd-user) 255 if test "$bsd" != "yes"; then 256 print_error "Target '$target' is only available on a BSD host" 257 return 1 258 fi 259 ;; 260 *) 261 print_error "Invalid target name '$target'" 262 return 1 263 ;; 264 esac 265 test "$tcg" = "yes" && return 0 266 supported_kvm_target "$1" && return 0 267 supported_xen_target "$1" && return 0 268 supported_hax_target "$1" && return 0 269 supported_hvf_target "$1" && return 0 270 supported_whpx_target "$1" && return 0 271 print_error "TCG disabled, but hardware accelerator not available for '$target'" 272 return 1 273} 274 275 276ld_has() { 277 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 278} 279 280# make source path absolute 281source_path=$(cd "$(dirname -- "$0")"; pwd) 282 283if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 284then 285 error_exit "main directory cannot contain spaces nor colons" 286fi 287 288# default parameters 289cpu="" 290iasl="iasl" 291interp_prefix="/usr/gnemul/qemu-%M" 292static="no" 293cross_prefix="" 294audio_drv_list="" 295block_drv_rw_whitelist="" 296block_drv_ro_whitelist="" 297host_cc="cc" 298libs_cpu="" 299libs_softmmu="" 300libs_tools="" 301audio_win_int="" 302libs_qga="" 303debug_info="yes" 304stack_protector="" 305use_containers="yes" 306gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 307 308if test -e "$source_path/.git" 309then 310 git_update=yes 311 git_submodules="ui/keycodemapdb" 312 git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 313 git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 314else 315 git_update=no 316 git_submodules="" 317 318 if ! test -f "$source_path/ui/keycodemapdb/README" 319 then 320 echo 321 echo "ERROR: missing file $source_path/ui/keycodemapdb/README" 322 echo 323 echo "This is not a GIT checkout but module content appears to" 324 echo "be missing. Do not use 'git archive' or GitHub download links" 325 echo "to acquire QEMU source archives. Non-GIT builds are only" 326 echo "supported with source archives linked from:" 327 echo 328 echo " https://www.qemu.org/download/#source" 329 echo 330 echo "Developers working with GIT can use scripts/archive-source.sh" 331 echo "if they need to create valid source archives." 332 echo 333 exit 1 334 fi 335fi 336git="git" 337 338# Don't accept a target_list environment variable. 339unset target_list 340unset target_list_exclude 341 342# Default value for a variable defining feature "foo". 343# * foo="no" feature will only be used if --enable-foo arg is given 344# * foo="" feature will be searched for, and if found, will be used 345# unless --disable-foo is given 346# * foo="yes" this value will only be set by --enable-foo flag. 347# feature will searched for, 348# if not found, configure exits with error 349# 350# Always add --enable-foo and --disable-foo command line args. 351# Distributions want to ensure that several features are compiled in, and it 352# is impossible without a --enable-foo that exits if a feature is not found. 353 354brlapi="" 355curl="" 356curses="" 357docs="" 358fdt="" 359netmap="no" 360sdl="" 361sdl_image="" 362virtfs="" 363mpath="" 364vnc="yes" 365sparse="no" 366vde="" 367vnc_sasl="" 368vnc_jpeg="" 369vnc_png="" 370xkbcommon="" 371xen="" 372xen_ctrl_version="" 373xen_pci_passthrough="" 374linux_aio="" 375linux_io_uring="" 376cap_ng="" 377attr="" 378libattr="" 379xfs="" 380tcg="yes" 381membarrier="" 382vhost_net="" 383vhost_crypto="" 384vhost_scsi="" 385vhost_vsock="" 386vhost_user="" 387vhost_user_fs="" 388kvm="no" 389hax="no" 390hvf="no" 391whpx="no" 392rdma="" 393pvrdma="" 394gprof="no" 395debug_tcg="no" 396debug="no" 397sanitizers="no" 398tsan="no" 399fortify_source="" 400strip_opt="yes" 401tcg_interpreter="no" 402bigendian="no" 403mingw32="no" 404gcov="no" 405gcov_tool="gcov" 406EXESUF="" 407DSOSUF=".so" 408LDFLAGS_SHARED="-shared" 409modules="no" 410module_upgrades="no" 411prefix="/usr/local" 412mandir="\${prefix}/share/man" 413datadir="\${prefix}/share" 414firmwarepath="\${prefix}/share/qemu-firmware" 415qemu_docdir="\${prefix}/share/doc/qemu" 416bindir="\${prefix}/bin" 417libdir="\${prefix}/lib" 418libexecdir="\${prefix}/libexec" 419includedir="\${prefix}/include" 420sysconfdir="\${prefix}/etc" 421local_statedir="\${prefix}/var" 422confsuffix="/qemu" 423slirp="" 424oss_lib="" 425bsd="no" 426linux="no" 427solaris="no" 428profiler="no" 429cocoa="no" 430softmmu="yes" 431linux_user="no" 432bsd_user="no" 433blobs="yes" 434edk2_blobs="no" 435pkgversion="" 436pie="" 437qom_cast_debug="yes" 438trace_backends="log" 439trace_file="trace" 440spice="" 441rbd="" 442smartcard="" 443libusb="" 444usb_redir="" 445opengl="" 446opengl_dmabuf="no" 447cpuid_h="no" 448avx2_opt="" 449zlib="yes" 450capstone="" 451lzo="" 452snappy="" 453bzip2="" 454lzfse="" 455zstd="" 456guest_agent="" 457guest_agent_with_vss="no" 458guest_agent_ntddscsi="no" 459guest_agent_msi="" 460vss_win32_sdk="" 461win_sdk="no" 462want_tools="" 463libiscsi="" 464libnfs="" 465coroutine="" 466coroutine_pool="" 467debug_stack_usage="no" 468crypto_afalg="no" 469seccomp="" 470glusterfs="" 471glusterfs_xlator_opt="no" 472glusterfs_discard="no" 473glusterfs_fallocate="no" 474glusterfs_zerofill="no" 475glusterfs_ftruncate_has_stat="no" 476glusterfs_iocb_has_stat="no" 477gtk="" 478gtk_gl="no" 479tls_priority="NORMAL" 480gnutls="" 481nettle="" 482nettle_xts="no" 483gcrypt="" 484gcrypt_hmac="no" 485gcrypt_xts="no" 486qemu_private_xts="yes" 487auth_pam="" 488vte="" 489virglrenderer="" 490tpm="" 491libssh="" 492live_block_migration="yes" 493numa="" 494tcmalloc="no" 495jemalloc="no" 496replication="yes" 497vxhs="" 498bochs="yes" 499cloop="yes" 500dmg="yes" 501qcow1="yes" 502vdi="yes" 503vvfat="yes" 504qed="yes" 505parallels="yes" 506sheepdog="yes" 507libxml2="" 508debug_mutex="no" 509libpmem="" 510default_devices="yes" 511plugins="no" 512fuzzing="no" 513rng_none="no" 514secret_keyring="" 515 516supported_cpu="no" 517supported_os="no" 518bogus_os="no" 519malloc_trim="" 520 521# parse CC options first 522for opt do 523 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 524 case "$opt" in 525 --cross-prefix=*) cross_prefix="$optarg" 526 ;; 527 --cc=*) CC="$optarg" 528 ;; 529 --cxx=*) CXX="$optarg" 530 ;; 531 --cpu=*) cpu="$optarg" 532 ;; 533 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 534 QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 535 ;; 536 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 537 ;; 538 --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 539 EXTRA_LDFLAGS="$optarg" 540 ;; 541 --enable-debug-info) debug_info="yes" 542 ;; 543 --disable-debug-info) debug_info="no" 544 ;; 545 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 546 ;; 547 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 548 eval "cross_cc_cflags_${cc_arch}=\$optarg" 549 cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 550 ;; 551 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 552 cc_archs="$cc_archs $cc_arch" 553 eval "cross_cc_${cc_arch}=\$optarg" 554 cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 555 ;; 556 esac 557done 558# OS specific 559# Using uname is really, really broken. Once we have the right set of checks 560# we can eliminate its usage altogether. 561 562# Preferred compiler: 563# ${CC} (if set) 564# ${cross_prefix}gcc (if cross-prefix specified) 565# system compiler 566if test -z "${CC}${cross_prefix}"; then 567 cc="$host_cc" 568else 569 cc="${CC-${cross_prefix}gcc}" 570fi 571 572if test -z "${CXX}${cross_prefix}"; then 573 cxx="c++" 574else 575 cxx="${CXX-${cross_prefix}g++}" 576fi 577 578ar="${AR-${cross_prefix}ar}" 579as="${AS-${cross_prefix}as}" 580ccas="${CCAS-$cc}" 581cpp="${CPP-$cc -E}" 582objcopy="${OBJCOPY-${cross_prefix}objcopy}" 583ld="${LD-${cross_prefix}ld}" 584ranlib="${RANLIB-${cross_prefix}ranlib}" 585nm="${NM-${cross_prefix}nm}" 586strip="${STRIP-${cross_prefix}strip}" 587windres="${WINDRES-${cross_prefix}windres}" 588pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 589query_pkg_config() { 590 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 591} 592pkg_config=query_pkg_config 593sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 594 595# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 596ARFLAGS="${ARFLAGS-rv}" 597 598# default flags for all hosts 599# We use -fwrapv to tell the compiler that we require a C dialect where 600# left shift of signed integers is well defined and has the expected 601# 2s-complement style results. (Both clang and gcc agree that it 602# provides these semantics.) 603QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS" 604QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 605QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 606QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 607QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include" 608QEMU_INCLUDES="$QEMU_INCLUDES -iquote \$(SRC_PATH)/disas/libvixl" 609if test "$debug_info" = "yes"; then 610 CFLAGS="-g $CFLAGS" 611fi 612 613# running configure in the source tree? 614# we know that's the case if configure is there. 615if test -f "./configure"; then 616 pwd_is_source_path="y" 617else 618 pwd_is_source_path="n" 619fi 620 621check_define() { 622cat > $TMPC <<EOF 623#if !defined($1) 624#error $1 not defined 625#endif 626int main(void) { return 0; } 627EOF 628 compile_object 629} 630 631check_include() { 632cat > $TMPC <<EOF 633#include <$1> 634int main(void) { return 0; } 635EOF 636 compile_object 637} 638 639write_c_skeleton() { 640 cat > $TMPC <<EOF 641int main(void) { return 0; } 642EOF 643} 644 645write_c_fuzzer_skeleton() { 646 cat > $TMPC <<EOF 647#include <stdint.h> 648#include <sys/types.h> 649int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); 650int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } 651EOF 652} 653 654if check_define __linux__ ; then 655 targetos="Linux" 656elif check_define _WIN32 ; then 657 targetos='MINGW32' 658elif check_define __OpenBSD__ ; then 659 targetos='OpenBSD' 660elif check_define __sun__ ; then 661 targetos='SunOS' 662elif check_define __HAIKU__ ; then 663 targetos='Haiku' 664elif check_define __FreeBSD__ ; then 665 targetos='FreeBSD' 666elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 667 targetos='GNU/kFreeBSD' 668elif check_define __DragonFly__ ; then 669 targetos='DragonFly' 670elif check_define __NetBSD__; then 671 targetos='NetBSD' 672elif check_define __APPLE__; then 673 targetos='Darwin' 674else 675 # This is a fatal error, but don't report it yet, because we 676 # might be going to just print the --help text, or it might 677 # be the result of a missing compiler. 678 targetos='bogus' 679 bogus_os='yes' 680fi 681 682# Some host OSes need non-standard checks for which CPU to use. 683# Note that these checks are broken for cross-compilation: if you're 684# cross-compiling to one of these OSes then you'll need to specify 685# the correct CPU with the --cpu option. 686case $targetos in 687Darwin) 688 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 689 # run 64-bit userspace code. 690 # If the user didn't specify a CPU explicitly and the kernel says this is 691 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 692 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 693 cpu="x86_64" 694 fi 695 ;; 696SunOS) 697 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 698 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 699 cpu="x86_64" 700 fi 701esac 702 703if test ! -z "$cpu" ; then 704 # command line argument 705 : 706elif check_define __i386__ ; then 707 cpu="i386" 708elif check_define __x86_64__ ; then 709 if check_define __ILP32__ ; then 710 cpu="x32" 711 else 712 cpu="x86_64" 713 fi 714elif check_define __sparc__ ; then 715 if check_define __arch64__ ; then 716 cpu="sparc64" 717 else 718 cpu="sparc" 719 fi 720elif check_define _ARCH_PPC ; then 721 if check_define _ARCH_PPC64 ; then 722 if check_define _LITTLE_ENDIAN ; then 723 cpu="ppc64le" 724 else 725 cpu="ppc64" 726 fi 727 else 728 cpu="ppc" 729 fi 730elif check_define __mips__ ; then 731 cpu="mips" 732elif check_define __s390__ ; then 733 if check_define __s390x__ ; then 734 cpu="s390x" 735 else 736 cpu="s390" 737 fi 738elif check_define __riscv ; then 739 if check_define _LP64 ; then 740 cpu="riscv64" 741 else 742 cpu="riscv32" 743 fi 744elif check_define __arm__ ; then 745 cpu="arm" 746elif check_define __aarch64__ ; then 747 cpu="aarch64" 748else 749 cpu=$(uname -m) 750fi 751 752ARCH= 753# Normalise host CPU name and set ARCH. 754# Note that this case should only have supported host CPUs, not guests. 755case "$cpu" in 756 ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 757 supported_cpu="yes" 758 ;; 759 ppc64le) 760 ARCH="ppc64" 761 supported_cpu="yes" 762 ;; 763 i386|i486|i586|i686|i86pc|BePC) 764 cpu="i386" 765 supported_cpu="yes" 766 ;; 767 x86_64|amd64) 768 cpu="x86_64" 769 supported_cpu="yes" 770 ;; 771 armv*b|armv*l|arm) 772 cpu="arm" 773 supported_cpu="yes" 774 ;; 775 aarch64) 776 cpu="aarch64" 777 supported_cpu="yes" 778 ;; 779 mips*) 780 cpu="mips" 781 supported_cpu="yes" 782 ;; 783 sparc|sun4[cdmuv]) 784 cpu="sparc" 785 supported_cpu="yes" 786 ;; 787 *) 788 # This will result in either an error or falling back to TCI later 789 ARCH=unknown 790 ;; 791esac 792if test -z "$ARCH"; then 793 ARCH="$cpu" 794fi 795 796# OS specific 797 798# host *BSD for user mode 799HOST_VARIANT_DIR="" 800 801case $targetos in 802MINGW32*) 803 mingw32="yes" 804 hax="yes" 805 vhost_user="no" 806 audio_possible_drivers="dsound sdl" 807 if check_include dsound.h; then 808 audio_drv_list="dsound" 809 else 810 audio_drv_list="" 811 fi 812 supported_os="yes" 813 pie="no" 814;; 815GNU/kFreeBSD) 816 bsd="yes" 817 audio_drv_list="oss try-sdl" 818 audio_possible_drivers="oss sdl pa" 819;; 820FreeBSD) 821 bsd="yes" 822 make="${MAKE-gmake}" 823 audio_drv_list="oss try-sdl" 824 audio_possible_drivers="oss sdl pa" 825 # needed for kinfo_getvmmap(3) in libutil.h 826 LIBS="-lutil $LIBS" 827 # needed for kinfo_getproc 828 libs_qga="-lutil $libs_qga" 829 netmap="" # enable netmap autodetect 830 HOST_VARIANT_DIR="freebsd" 831 supported_os="yes" 832;; 833DragonFly) 834 bsd="yes" 835 make="${MAKE-gmake}" 836 audio_drv_list="oss try-sdl" 837 audio_possible_drivers="oss sdl pa" 838 HOST_VARIANT_DIR="dragonfly" 839;; 840NetBSD) 841 bsd="yes" 842 hax="yes" 843 make="${MAKE-gmake}" 844 audio_drv_list="oss try-sdl" 845 audio_possible_drivers="oss sdl" 846 oss_lib="-lossaudio" 847 HOST_VARIANT_DIR="netbsd" 848 supported_os="yes" 849;; 850OpenBSD) 851 bsd="yes" 852 make="${MAKE-gmake}" 853 audio_drv_list="try-sdl" 854 audio_possible_drivers="sdl" 855 HOST_VARIANT_DIR="openbsd" 856 supported_os="yes" 857;; 858Darwin) 859 bsd="yes" 860 darwin="yes" 861 hax="yes" 862 hvf="yes" 863 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 864 if [ "$cpu" = "x86_64" ] ; then 865 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 866 QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" 867 fi 868 cocoa="yes" 869 audio_drv_list="coreaudio try-sdl" 870 audio_possible_drivers="coreaudio sdl" 871 QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" 872 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 873 # Disable attempts to use ObjectiveC features in os/object.h since they 874 # won't work when we're compiling with gcc as a C compiler. 875 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 876 HOST_VARIANT_DIR="darwin" 877 supported_os="yes" 878;; 879SunOS) 880 solaris="yes" 881 make="${MAKE-gmake}" 882 install="${INSTALL-ginstall}" 883 smbd="${SMBD-/usr/sfw/sbin/smbd}" 884 if test -f /usr/include/sys/soundcard.h ; then 885 audio_drv_list="oss try-sdl" 886 fi 887 audio_possible_drivers="oss sdl" 888# needed for CMSG_ macros in sys/socket.h 889 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 890# needed for TIOCWIN* defines in termios.h 891 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 892 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 893 solarisnetlibs="-lsocket -lnsl -lresolv" 894 LIBS="$solarisnetlibs $LIBS" 895 libs_qga="$solarisnetlibs $libs_qga" 896;; 897Haiku) 898 haiku="yes" 899 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 900 LIBS="-lposix_error_mapper -lnetwork $LIBS" 901;; 902Linux) 903 audio_drv_list="try-pa oss" 904 audio_possible_drivers="oss alsa sdl pa" 905 linux="yes" 906 linux_user="yes" 907 kvm="yes" 908 QEMU_INCLUDES="-isystem \$(SRC_PATH)/linux-headers -isystem $PWD/linux-headers $QEMU_INCLUDES" 909 supported_os="yes" 910 libudev="yes" 911;; 912esac 913 914if [ "$bsd" = "yes" ] ; then 915 if [ "$darwin" != "yes" ] ; then 916 bsd_user="yes" 917 fi 918fi 919 920: ${make=${MAKE-make}} 921: ${install=${INSTALL-install}} 922# We prefer python 3.x. A bare 'python' is traditionally 923# python 2.x, but some distros have it as python 3.x, so 924# we check that too 925python= 926for binary in "${PYTHON-python3}" python 927do 928 if has "$binary" 929 then 930 python=$(command -v "$binary") 931 break 932 fi 933done 934 935sphinx_build= 936for binary in sphinx-build-3 sphinx-build 937do 938 if has "$binary" 939 then 940 sphinx_build=$(command -v "$binary") 941 break 942 fi 943done 944 945# Check for ancillary tools used in testing 946genisoimage= 947for binary in genisoimage mkisofs 948do 949 if has $binary 950 then 951 genisoimage=$(command -v "$binary") 952 break 953 fi 954done 955 956: ${smbd=${SMBD-/usr/sbin/smbd}} 957 958# Default objcc to clang if available, otherwise use CC 959if has clang; then 960 objcc=clang 961else 962 objcc="$cc" 963fi 964 965if test "$mingw32" = "yes" ; then 966 EXESUF=".exe" 967 DSOSUF=".dll" 968 # MinGW needs -mthreads for TLS and macro _MT. 969 QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" 970 LIBS="-lwinmm -lws2_32 $LIBS" 971 write_c_skeleton; 972 if compile_prog "" "-liberty" ; then 973 LIBS="-liberty $LIBS" 974 fi 975 prefix="c:/Program Files/QEMU" 976 mandir="\${prefix}" 977 datadir="\${prefix}" 978 qemu_docdir="\${prefix}" 979 bindir="\${prefix}" 980 sysconfdir="\${prefix}" 981 local_statedir= 982 confsuffix="" 983 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 984fi 985 986werror="" 987 988for opt do 989 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 990 case "$opt" in 991 --help|-h) show_help=yes 992 ;; 993 --version|-V) exec cat $source_path/VERSION 994 ;; 995 --prefix=*) prefix="$optarg" 996 ;; 997 --interp-prefix=*) interp_prefix="$optarg" 998 ;; 999 --cross-prefix=*) 1000 ;; 1001 --cc=*) 1002 ;; 1003 --host-cc=*) host_cc="$optarg" 1004 ;; 1005 --cxx=*) 1006 ;; 1007 --iasl=*) iasl="$optarg" 1008 ;; 1009 --objcc=*) objcc="$optarg" 1010 ;; 1011 --make=*) make="$optarg" 1012 ;; 1013 --install=*) install="$optarg" 1014 ;; 1015 --python=*) python="$optarg" 1016 ;; 1017 --sphinx-build=*) sphinx_build="$optarg" 1018 ;; 1019 --gcov=*) gcov_tool="$optarg" 1020 ;; 1021 --smbd=*) smbd="$optarg" 1022 ;; 1023 --extra-cflags=*) 1024 ;; 1025 --extra-cxxflags=*) 1026 ;; 1027 --extra-ldflags=*) 1028 ;; 1029 --enable-debug-info) 1030 ;; 1031 --disable-debug-info) 1032 ;; 1033 --cross-cc-*) 1034 ;; 1035 --enable-modules) 1036 modules="yes" 1037 ;; 1038 --disable-modules) 1039 modules="no" 1040 ;; 1041 --disable-module-upgrades) module_upgrades="no" 1042 ;; 1043 --enable-module-upgrades) module_upgrades="yes" 1044 ;; 1045 --cpu=*) 1046 ;; 1047 --target-list=*) target_list="$optarg" 1048 if test "$target_list_exclude"; then 1049 error_exit "Can't mix --target-list with --target-list-exclude" 1050 fi 1051 ;; 1052 --target-list-exclude=*) target_list_exclude="$optarg" 1053 if test "$target_list"; then 1054 error_exit "Can't mix --target-list-exclude with --target-list" 1055 fi 1056 ;; 1057 --enable-trace-backends=*) trace_backends="$optarg" 1058 ;; 1059 # XXX: backwards compatibility 1060 --enable-trace-backend=*) trace_backends="$optarg" 1061 ;; 1062 --with-trace-file=*) trace_file="$optarg" 1063 ;; 1064 --with-default-devices) default_devices="yes" 1065 ;; 1066 --without-default-devices) default_devices="no" 1067 ;; 1068 --enable-gprof) gprof="yes" 1069 ;; 1070 --enable-gcov) gcov="yes" 1071 ;; 1072 --static) 1073 static="yes" 1074 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 1075 ;; 1076 --mandir=*) mandir="$optarg" 1077 ;; 1078 --bindir=*) bindir="$optarg" 1079 ;; 1080 --libdir=*) libdir="$optarg" 1081 ;; 1082 --libexecdir=*) libexecdir="$optarg" 1083 ;; 1084 --includedir=*) includedir="$optarg" 1085 ;; 1086 --datadir=*) datadir="$optarg" 1087 ;; 1088 --with-confsuffix=*) confsuffix="$optarg" 1089 ;; 1090 --docdir=*) qemu_docdir="$optarg" 1091 ;; 1092 --sysconfdir=*) sysconfdir="$optarg" 1093 ;; 1094 --localstatedir=*) local_statedir="$optarg" 1095 ;; 1096 --firmwarepath=*) firmwarepath="$optarg" 1097 ;; 1098 --host=*|--build=*|\ 1099 --disable-dependency-tracking|\ 1100 --sbindir=*|--sharedstatedir=*|\ 1101 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 1102 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 1103 # These switches are silently ignored, for compatibility with 1104 # autoconf-generated configure scripts. This allows QEMU's 1105 # configure to be used by RPM and similar macros that set 1106 # lots of directory switches by default. 1107 ;; 1108 --disable-sdl) sdl="no" 1109 ;; 1110 --enable-sdl) sdl="yes" 1111 ;; 1112 --disable-sdl-image) sdl_image="no" 1113 ;; 1114 --enable-sdl-image) sdl_image="yes" 1115 ;; 1116 --disable-qom-cast-debug) qom_cast_debug="no" 1117 ;; 1118 --enable-qom-cast-debug) qom_cast_debug="yes" 1119 ;; 1120 --disable-virtfs) virtfs="no" 1121 ;; 1122 --enable-virtfs) virtfs="yes" 1123 ;; 1124 --disable-mpath) mpath="no" 1125 ;; 1126 --enable-mpath) mpath="yes" 1127 ;; 1128 --disable-vnc) vnc="no" 1129 ;; 1130 --enable-vnc) vnc="yes" 1131 ;; 1132 --oss-lib=*) oss_lib="$optarg" 1133 ;; 1134 --audio-drv-list=*) audio_drv_list="$optarg" 1135 ;; 1136 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1137 ;; 1138 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1139 ;; 1140 --enable-debug-tcg) debug_tcg="yes" 1141 ;; 1142 --disable-debug-tcg) debug_tcg="no" 1143 ;; 1144 --enable-debug) 1145 # Enable debugging options that aren't excessively noisy 1146 debug_tcg="yes" 1147 debug_mutex="yes" 1148 debug="yes" 1149 strip_opt="no" 1150 fortify_source="no" 1151 ;; 1152 --enable-sanitizers) sanitizers="yes" 1153 ;; 1154 --disable-sanitizers) sanitizers="no" 1155 ;; 1156 --enable-tsan) tsan="yes" 1157 ;; 1158 --disable-tsan) tsan="no" 1159 ;; 1160 --enable-sparse) sparse="yes" 1161 ;; 1162 --disable-sparse) sparse="no" 1163 ;; 1164 --disable-strip) strip_opt="no" 1165 ;; 1166 --disable-vnc-sasl) vnc_sasl="no" 1167 ;; 1168 --enable-vnc-sasl) vnc_sasl="yes" 1169 ;; 1170 --disable-vnc-jpeg) vnc_jpeg="no" 1171 ;; 1172 --enable-vnc-jpeg) vnc_jpeg="yes" 1173 ;; 1174 --disable-vnc-png) vnc_png="no" 1175 ;; 1176 --enable-vnc-png) vnc_png="yes" 1177 ;; 1178 --disable-slirp) slirp="no" 1179 ;; 1180 --enable-slirp=git) slirp="git" 1181 ;; 1182 --enable-slirp=system) slirp="system" 1183 ;; 1184 --disable-vde) vde="no" 1185 ;; 1186 --enable-vde) vde="yes" 1187 ;; 1188 --disable-netmap) netmap="no" 1189 ;; 1190 --enable-netmap) netmap="yes" 1191 ;; 1192 --disable-xen) xen="no" 1193 ;; 1194 --enable-xen) xen="yes" 1195 ;; 1196 --disable-xen-pci-passthrough) xen_pci_passthrough="no" 1197 ;; 1198 --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 1199 ;; 1200 --disable-brlapi) brlapi="no" 1201 ;; 1202 --enable-brlapi) brlapi="yes" 1203 ;; 1204 --disable-kvm) kvm="no" 1205 ;; 1206 --enable-kvm) kvm="yes" 1207 ;; 1208 --disable-hax) hax="no" 1209 ;; 1210 --enable-hax) hax="yes" 1211 ;; 1212 --disable-hvf) hvf="no" 1213 ;; 1214 --enable-hvf) hvf="yes" 1215 ;; 1216 --disable-whpx) whpx="no" 1217 ;; 1218 --enable-whpx) whpx="yes" 1219 ;; 1220 --disable-tcg-interpreter) tcg_interpreter="no" 1221 ;; 1222 --enable-tcg-interpreter) tcg_interpreter="yes" 1223 ;; 1224 --disable-cap-ng) cap_ng="no" 1225 ;; 1226 --enable-cap-ng) cap_ng="yes" 1227 ;; 1228 --disable-tcg) tcg="no" 1229 ;; 1230 --enable-tcg) tcg="yes" 1231 ;; 1232 --disable-malloc-trim) malloc_trim="no" 1233 ;; 1234 --enable-malloc-trim) malloc_trim="yes" 1235 ;; 1236 --disable-spice) spice="no" 1237 ;; 1238 --enable-spice) spice="yes" 1239 ;; 1240 --disable-libiscsi) libiscsi="no" 1241 ;; 1242 --enable-libiscsi) libiscsi="yes" 1243 ;; 1244 --disable-libnfs) libnfs="no" 1245 ;; 1246 --enable-libnfs) libnfs="yes" 1247 ;; 1248 --enable-profiler) profiler="yes" 1249 ;; 1250 --disable-cocoa) cocoa="no" 1251 ;; 1252 --enable-cocoa) 1253 cocoa="yes" ; 1254 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 1255 ;; 1256 --disable-system) softmmu="no" 1257 ;; 1258 --enable-system) softmmu="yes" 1259 ;; 1260 --disable-user) 1261 linux_user="no" ; 1262 bsd_user="no" ; 1263 ;; 1264 --enable-user) ;; 1265 --disable-linux-user) linux_user="no" 1266 ;; 1267 --enable-linux-user) linux_user="yes" 1268 ;; 1269 --disable-bsd-user) bsd_user="no" 1270 ;; 1271 --enable-bsd-user) bsd_user="yes" 1272 ;; 1273 --enable-pie) pie="yes" 1274 ;; 1275 --disable-pie) pie="no" 1276 ;; 1277 --enable-werror) werror="yes" 1278 ;; 1279 --disable-werror) werror="no" 1280 ;; 1281 --enable-stack-protector) stack_protector="yes" 1282 ;; 1283 --disable-stack-protector) stack_protector="no" 1284 ;; 1285 --disable-curses) curses="no" 1286 ;; 1287 --enable-curses) curses="yes" 1288 ;; 1289 --disable-iconv) iconv="no" 1290 ;; 1291 --enable-iconv) iconv="yes" 1292 ;; 1293 --disable-curl) curl="no" 1294 ;; 1295 --enable-curl) curl="yes" 1296 ;; 1297 --disable-fdt) fdt="no" 1298 ;; 1299 --enable-fdt) fdt="yes" 1300 ;; 1301 --disable-linux-aio) linux_aio="no" 1302 ;; 1303 --enable-linux-aio) linux_aio="yes" 1304 ;; 1305 --disable-linux-io-uring) linux_io_uring="no" 1306 ;; 1307 --enable-linux-io-uring) linux_io_uring="yes" 1308 ;; 1309 --disable-attr) attr="no" 1310 ;; 1311 --enable-attr) attr="yes" 1312 ;; 1313 --disable-membarrier) membarrier="no" 1314 ;; 1315 --enable-membarrier) membarrier="yes" 1316 ;; 1317 --disable-blobs) blobs="no" 1318 ;; 1319 --with-pkgversion=*) pkgversion="$optarg" 1320 ;; 1321 --with-coroutine=*) coroutine="$optarg" 1322 ;; 1323 --disable-coroutine-pool) coroutine_pool="no" 1324 ;; 1325 --enable-coroutine-pool) coroutine_pool="yes" 1326 ;; 1327 --enable-debug-stack-usage) debug_stack_usage="yes" 1328 ;; 1329 --enable-crypto-afalg) crypto_afalg="yes" 1330 ;; 1331 --disable-crypto-afalg) crypto_afalg="no" 1332 ;; 1333 --disable-docs) docs="no" 1334 ;; 1335 --enable-docs) docs="yes" 1336 ;; 1337 --disable-vhost-net) vhost_net="no" 1338 ;; 1339 --enable-vhost-net) vhost_net="yes" 1340 ;; 1341 --disable-vhost-crypto) vhost_crypto="no" 1342 ;; 1343 --enable-vhost-crypto) vhost_crypto="yes" 1344 ;; 1345 --disable-vhost-scsi) vhost_scsi="no" 1346 ;; 1347 --enable-vhost-scsi) vhost_scsi="yes" 1348 ;; 1349 --disable-vhost-vsock) vhost_vsock="no" 1350 ;; 1351 --enable-vhost-vsock) vhost_vsock="yes" 1352 ;; 1353 --disable-vhost-user-fs) vhost_user_fs="no" 1354 ;; 1355 --enable-vhost-user-fs) vhost_user_fs="yes" 1356 ;; 1357 --disable-opengl) opengl="no" 1358 ;; 1359 --enable-opengl) opengl="yes" 1360 ;; 1361 --disable-rbd) rbd="no" 1362 ;; 1363 --enable-rbd) rbd="yes" 1364 ;; 1365 --disable-xfsctl) xfs="no" 1366 ;; 1367 --enable-xfsctl) xfs="yes" 1368 ;; 1369 --disable-smartcard) smartcard="no" 1370 ;; 1371 --enable-smartcard) smartcard="yes" 1372 ;; 1373 --disable-libusb) libusb="no" 1374 ;; 1375 --enable-libusb) libusb="yes" 1376 ;; 1377 --disable-usb-redir) usb_redir="no" 1378 ;; 1379 --enable-usb-redir) usb_redir="yes" 1380 ;; 1381 --disable-zlib-test) zlib="no" 1382 ;; 1383 --disable-lzo) lzo="no" 1384 ;; 1385 --enable-lzo) lzo="yes" 1386 ;; 1387 --disable-snappy) snappy="no" 1388 ;; 1389 --enable-snappy) snappy="yes" 1390 ;; 1391 --disable-bzip2) bzip2="no" 1392 ;; 1393 --enable-bzip2) bzip2="yes" 1394 ;; 1395 --enable-lzfse) lzfse="yes" 1396 ;; 1397 --disable-lzfse) lzfse="no" 1398 ;; 1399 --disable-zstd) zstd="no" 1400 ;; 1401 --enable-zstd) zstd="yes" 1402 ;; 1403 --enable-guest-agent) guest_agent="yes" 1404 ;; 1405 --disable-guest-agent) guest_agent="no" 1406 ;; 1407 --enable-guest-agent-msi) guest_agent_msi="yes" 1408 ;; 1409 --disable-guest-agent-msi) guest_agent_msi="no" 1410 ;; 1411 --with-vss-sdk) vss_win32_sdk="" 1412 ;; 1413 --with-vss-sdk=*) vss_win32_sdk="$optarg" 1414 ;; 1415 --without-vss-sdk) vss_win32_sdk="no" 1416 ;; 1417 --with-win-sdk) win_sdk="" 1418 ;; 1419 --with-win-sdk=*) win_sdk="$optarg" 1420 ;; 1421 --without-win-sdk) win_sdk="no" 1422 ;; 1423 --enable-tools) want_tools="yes" 1424 ;; 1425 --disable-tools) want_tools="no" 1426 ;; 1427 --enable-seccomp) seccomp="yes" 1428 ;; 1429 --disable-seccomp) seccomp="no" 1430 ;; 1431 --disable-glusterfs) glusterfs="no" 1432 ;; 1433 --disable-avx2) avx2_opt="no" 1434 ;; 1435 --enable-avx2) avx2_opt="yes" 1436 ;; 1437 --disable-avx512f) avx512f_opt="no" 1438 ;; 1439 --enable-avx512f) avx512f_opt="yes" 1440 ;; 1441 1442 --enable-glusterfs) glusterfs="yes" 1443 ;; 1444 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 1445 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1446 ;; 1447 --enable-vhdx|--disable-vhdx) 1448 echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1449 ;; 1450 --enable-uuid|--disable-uuid) 1451 echo "$0: $opt is obsolete, UUID support is always built" >&2 1452 ;; 1453 --disable-gtk) gtk="no" 1454 ;; 1455 --enable-gtk) gtk="yes" 1456 ;; 1457 --tls-priority=*) tls_priority="$optarg" 1458 ;; 1459 --disable-gnutls) gnutls="no" 1460 ;; 1461 --enable-gnutls) gnutls="yes" 1462 ;; 1463 --disable-nettle) nettle="no" 1464 ;; 1465 --enable-nettle) nettle="yes" 1466 ;; 1467 --disable-gcrypt) gcrypt="no" 1468 ;; 1469 --enable-gcrypt) gcrypt="yes" 1470 ;; 1471 --disable-auth-pam) auth_pam="no" 1472 ;; 1473 --enable-auth-pam) auth_pam="yes" 1474 ;; 1475 --enable-rdma) rdma="yes" 1476 ;; 1477 --disable-rdma) rdma="no" 1478 ;; 1479 --enable-pvrdma) pvrdma="yes" 1480 ;; 1481 --disable-pvrdma) pvrdma="no" 1482 ;; 1483 --disable-vte) vte="no" 1484 ;; 1485 --enable-vte) vte="yes" 1486 ;; 1487 --disable-virglrenderer) virglrenderer="no" 1488 ;; 1489 --enable-virglrenderer) virglrenderer="yes" 1490 ;; 1491 --disable-tpm) tpm="no" 1492 ;; 1493 --enable-tpm) tpm="yes" 1494 ;; 1495 --disable-libssh) libssh="no" 1496 ;; 1497 --enable-libssh) libssh="yes" 1498 ;; 1499 --disable-live-block-migration) live_block_migration="no" 1500 ;; 1501 --enable-live-block-migration) live_block_migration="yes" 1502 ;; 1503 --disable-numa) numa="no" 1504 ;; 1505 --enable-numa) numa="yes" 1506 ;; 1507 --disable-libxml2) libxml2="no" 1508 ;; 1509 --enable-libxml2) libxml2="yes" 1510 ;; 1511 --disable-tcmalloc) tcmalloc="no" 1512 ;; 1513 --enable-tcmalloc) tcmalloc="yes" 1514 ;; 1515 --disable-jemalloc) jemalloc="no" 1516 ;; 1517 --enable-jemalloc) jemalloc="yes" 1518 ;; 1519 --disable-replication) replication="no" 1520 ;; 1521 --enable-replication) replication="yes" 1522 ;; 1523 --disable-vxhs) vxhs="no" 1524 ;; 1525 --enable-vxhs) vxhs="yes" 1526 ;; 1527 --disable-bochs) bochs="no" 1528 ;; 1529 --enable-bochs) bochs="yes" 1530 ;; 1531 --disable-cloop) cloop="no" 1532 ;; 1533 --enable-cloop) cloop="yes" 1534 ;; 1535 --disable-dmg) dmg="no" 1536 ;; 1537 --enable-dmg) dmg="yes" 1538 ;; 1539 --disable-qcow1) qcow1="no" 1540 ;; 1541 --enable-qcow1) qcow1="yes" 1542 ;; 1543 --disable-vdi) vdi="no" 1544 ;; 1545 --enable-vdi) vdi="yes" 1546 ;; 1547 --disable-vvfat) vvfat="no" 1548 ;; 1549 --enable-vvfat) vvfat="yes" 1550 ;; 1551 --disable-qed) qed="no" 1552 ;; 1553 --enable-qed) qed="yes" 1554 ;; 1555 --disable-parallels) parallels="no" 1556 ;; 1557 --enable-parallels) parallels="yes" 1558 ;; 1559 --disable-sheepdog) sheepdog="no" 1560 ;; 1561 --enable-sheepdog) sheepdog="yes" 1562 ;; 1563 --disable-vhost-user) vhost_user="no" 1564 ;; 1565 --enable-vhost-user) vhost_user="yes" 1566 ;; 1567 --disable-vhost-kernel) vhost_kernel="no" 1568 ;; 1569 --enable-vhost-kernel) vhost_kernel="yes" 1570 ;; 1571 --disable-capstone) capstone="no" 1572 ;; 1573 --enable-capstone) capstone="yes" 1574 ;; 1575 --enable-capstone=git) capstone="git" 1576 ;; 1577 --enable-capstone=system) capstone="system" 1578 ;; 1579 --with-git=*) git="$optarg" 1580 ;; 1581 --enable-git-update) git_update=yes 1582 ;; 1583 --disable-git-update) git_update=no 1584 ;; 1585 --enable-debug-mutex) debug_mutex=yes 1586 ;; 1587 --disable-debug-mutex) debug_mutex=no 1588 ;; 1589 --enable-libpmem) libpmem=yes 1590 ;; 1591 --disable-libpmem) libpmem=no 1592 ;; 1593 --enable-xkbcommon) xkbcommon=yes 1594 ;; 1595 --disable-xkbcommon) xkbcommon=no 1596 ;; 1597 --enable-plugins) plugins="yes" 1598 ;; 1599 --disable-plugins) plugins="no" 1600 ;; 1601 --enable-containers) use_containers="yes" 1602 ;; 1603 --disable-containers) use_containers="no" 1604 ;; 1605 --enable-fuzzing) fuzzing=yes 1606 ;; 1607 --disable-fuzzing) fuzzing=no 1608 ;; 1609 --gdb=*) gdb_bin="$optarg" 1610 ;; 1611 --enable-rng-none) rng_none=yes 1612 ;; 1613 --disable-rng-none) rng_none=no 1614 ;; 1615 --enable-keyring) secret_keyring="yes" 1616 ;; 1617 --disable-keyring) secret_keyring="no" 1618 ;; 1619 *) 1620 echo "ERROR: unknown option $opt" 1621 echo "Try '$0 --help' for more information" 1622 exit 1 1623 ;; 1624 esac 1625done 1626 1627case "$cpu" in 1628 ppc) 1629 CPU_CFLAGS="-m32" 1630 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1631 ;; 1632 ppc64) 1633 CPU_CFLAGS="-m64" 1634 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1635 ;; 1636 sparc) 1637 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1638 QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 1639 ;; 1640 sparc64) 1641 CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1642 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1643 ;; 1644 s390) 1645 CPU_CFLAGS="-m31" 1646 QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 1647 ;; 1648 s390x) 1649 CPU_CFLAGS="-m64" 1650 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1651 ;; 1652 i386) 1653 CPU_CFLAGS="-m32" 1654 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1655 ;; 1656 x86_64) 1657 # ??? Only extremely old AMD cpus do not have cmpxchg16b. 1658 # If we truly care, we should simply detect this case at 1659 # runtime and generate the fallback to serial emulation. 1660 CPU_CFLAGS="-m64 -mcx16" 1661 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1662 ;; 1663 x32) 1664 CPU_CFLAGS="-mx32" 1665 QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1666 ;; 1667 # No special flags required for other host CPUs 1668esac 1669 1670eval "cross_cc_${cpu}=\$host_cc" 1671cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 1672QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 1673 1674# For user-mode emulation the host arch has to be one we explicitly 1675# support, even if we're using TCI. 1676if [ "$ARCH" = "unknown" ]; then 1677 bsd_user="no" 1678 linux_user="no" 1679fi 1680 1681if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then 1682 tcg="no" 1683fi 1684 1685default_target_list="" 1686 1687mak_wilds="" 1688 1689if [ "$softmmu" = "yes" ]; then 1690 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 1691fi 1692if [ "$linux_user" = "yes" ]; then 1693 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 1694fi 1695if [ "$bsd_user" = "yes" ]; then 1696 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 1697fi 1698 1699if test -z "$target_list_exclude"; then 1700 for config in $mak_wilds; do 1701 default_target_list="${default_target_list} $(basename "$config" .mak)" 1702 done 1703else 1704 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g') 1705 for config in $mak_wilds; do 1706 target="$(basename "$config" .mak)" 1707 exclude="no" 1708 for excl in $exclude_list; do 1709 if test "$excl" = "$target"; then 1710 exclude="yes" 1711 break; 1712 fi 1713 done 1714 if test "$exclude" = "no"; then 1715 default_target_list="${default_target_list} $target" 1716 fi 1717 done 1718fi 1719 1720# Enumerate public trace backends for --help output 1721trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1722 1723if test x"$show_help" = x"yes" ; then 1724cat << EOF 1725 1726Usage: configure [options] 1727Options: [defaults in brackets after descriptions] 1728 1729Standard options: 1730 --help print this message 1731 --prefix=PREFIX install in PREFIX [$prefix] 1732 --interp-prefix=PREFIX where to find shared libraries, etc. 1733 use %M for cpu name [$interp_prefix] 1734 --target-list=LIST set target list (default: build everything) 1735$(echo Available targets: $default_target_list | \ 1736 fold -s -w 53 | sed -e 's/^/ /') 1737 --target-list-exclude=LIST exclude a set of targets from the default target-list 1738 1739Advanced options (experts only): 1740 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 1741 --cc=CC use C compiler CC [$cc] 1742 --iasl=IASL use ACPI compiler IASL [$iasl] 1743 --host-cc=CC use C compiler CC [$host_cc] for code run at 1744 build time 1745 --cxx=CXX use C++ compiler CXX [$cxx] 1746 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 1747 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 1748 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 1749 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1750 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1751 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 1752 --make=MAKE use specified make [$make] 1753 --install=INSTALL use specified install [$install] 1754 --python=PYTHON use specified python [$python] 1755 --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1756 --smbd=SMBD use specified smbd [$smbd] 1757 --with-git=GIT use specified git [$git] 1758 --static enable static build [$static] 1759 --mandir=PATH install man pages in PATH 1760 --datadir=PATH install firmware in PATH$confsuffix 1761 --docdir=PATH install documentation in PATH$confsuffix 1762 --bindir=PATH install binaries in PATH 1763 --libdir=PATH install libraries in PATH 1764 --libexecdir=PATH install helper binaries in PATH 1765 --sysconfdir=PATH install config in PATH$confsuffix 1766 --localstatedir=PATH install local state in PATH (set at runtime on win32) 1767 --firmwarepath=PATH search PATH for firmware files 1768 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 1769 --with-pkgversion=VERS use specified string as sub-version of the package 1770 --enable-debug enable common debug build options 1771 --enable-sanitizers enable default sanitizers 1772 --enable-tsan enable thread sanitizer 1773 --disable-strip disable stripping binaries 1774 --disable-werror disable compilation abort on warning 1775 --disable-stack-protector disable compiler-provided stack protection 1776 --audio-drv-list=LIST set audio drivers list: 1777 Available drivers: $audio_possible_drivers 1778 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 1779 --block-drv-rw-whitelist=L 1780 set block driver read-write whitelist 1781 (affects only QEMU, not qemu-img) 1782 --block-drv-ro-whitelist=L 1783 set block driver read-only whitelist 1784 (affects only QEMU, not qemu-img) 1785 --enable-trace-backends=B Set trace backend 1786 Available backends: $trace_backend_list 1787 --with-trace-file=NAME Full PATH,NAME of file to store traces 1788 Default:trace-<pid> 1789 --disable-slirp disable SLIRP userspace network connectivity 1790 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 1791 --enable-malloc-trim enable libc malloc_trim() for memory optimization 1792 --oss-lib path to OSS library 1793 --cpu=CPU Build for host CPU [$cpu] 1794 --with-coroutine=BACKEND coroutine backend. Supported options: 1795 ucontext, sigaltstack, windows 1796 --enable-gcov enable test coverage analysis with gcov 1797 --gcov=GCOV use specified gcov [$gcov_tool] 1798 --disable-blobs disable installing provided firmware blobs 1799 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1800 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1801 --tls-priority default TLS protocol/cipher priority string 1802 --enable-gprof QEMU profiling with gprof 1803 --enable-profiler profiler support 1804 --enable-debug-stack-usage 1805 track the maximum stack usage of stacks created by qemu_alloc_stack 1806 --enable-plugins 1807 enable plugins via shared library loading 1808 --disable-containers don't use containers for cross-building 1809 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1810 1811Optional features, enabled with --enable-FEATURE and 1812disabled with --disable-FEATURE, default is enabled if available: 1813 1814 system all system emulation targets 1815 user supported user emulation targets 1816 linux-user all linux usermode emulation targets 1817 bsd-user all BSD usermode emulation targets 1818 docs build documentation 1819 guest-agent build the QEMU Guest Agent 1820 guest-agent-msi build guest agent Windows MSI installation package 1821 pie Position Independent Executables 1822 modules modules support (non-Windows) 1823 module-upgrades try to load modules from alternate paths for upgrades 1824 debug-tcg TCG debugging (default is disabled) 1825 debug-info debugging information 1826 sparse sparse checker 1827 1828 gnutls GNUTLS cryptography support 1829 nettle nettle cryptography support 1830 gcrypt libgcrypt cryptography support 1831 auth-pam PAM access control 1832 sdl SDL UI 1833 sdl-image SDL Image support for icons 1834 gtk gtk UI 1835 vte vte support for the gtk UI 1836 curses curses UI 1837 iconv font glyph conversion support 1838 vnc VNC UI support 1839 vnc-sasl SASL encryption for VNC server 1840 vnc-jpeg JPEG lossy compression for VNC server 1841 vnc-png PNG compression for VNC server 1842 cocoa Cocoa UI (Mac OS X only) 1843 virtfs VirtFS 1844 mpath Multipath persistent reservation passthrough 1845 xen xen backend driver support 1846 xen-pci-passthrough PCI passthrough support for Xen 1847 brlapi BrlAPI (Braile) 1848 curl curl connectivity 1849 membarrier membarrier system call (for Linux 4.14+ or Windows) 1850 fdt fdt device tree 1851 kvm KVM acceleration support 1852 hax HAX acceleration support 1853 hvf Hypervisor.framework acceleration support 1854 whpx Windows Hypervisor Platform acceleration support 1855 rdma Enable RDMA-based migration 1856 pvrdma Enable PVRDMA support 1857 vde support for vde network 1858 netmap support for netmap network 1859 linux-aio Linux AIO support 1860 linux-io-uring Linux io_uring support 1861 cap-ng libcap-ng support 1862 attr attr and xattr support 1863 vhost-net vhost-net kernel acceleration support 1864 vhost-vsock virtio sockets device support 1865 vhost-scsi vhost-scsi kernel target support 1866 vhost-crypto vhost-user-crypto backend support 1867 vhost-kernel vhost kernel backend support 1868 vhost-user vhost-user backend support 1869 spice spice 1870 rbd rados block device (rbd) 1871 libiscsi iscsi support 1872 libnfs nfs support 1873 smartcard smartcard support (libcacard) 1874 libusb libusb (for usb passthrough) 1875 live-block-migration Block migration in the main migration stream 1876 usb-redir usb network redirection support 1877 lzo support of lzo compression library 1878 snappy support of snappy compression library 1879 bzip2 support of bzip2 compression library 1880 (for reading bzip2-compressed dmg images) 1881 lzfse support of lzfse compression library 1882 (for reading lzfse-compressed dmg images) 1883 zstd support for zstd compression library 1884 (for migration compression and qcow2 cluster compression) 1885 seccomp seccomp support 1886 coroutine-pool coroutine freelist (better performance) 1887 glusterfs GlusterFS backend 1888 tpm TPM support 1889 libssh ssh block device support 1890 numa libnuma support 1891 libxml2 for Parallels image format 1892 tcmalloc tcmalloc support 1893 jemalloc jemalloc support 1894 avx2 AVX2 optimization support 1895 avx512f AVX512F optimization support 1896 replication replication support 1897 opengl opengl support 1898 virglrenderer virgl rendering support 1899 xfsctl xfsctl support 1900 qom-cast-debug cast debugging support 1901 tools build qemu-io, qemu-nbd and qemu-img tools 1902 vxhs Veritas HyperScale vDisk backend support 1903 bochs bochs image format support 1904 cloop cloop image format support 1905 dmg dmg image format support 1906 qcow1 qcow v1 image format support 1907 vdi vdi image format support 1908 vvfat vvfat image format support 1909 qed qed image format support 1910 parallels parallels image format support 1911 sheepdog sheepdog block driver support 1912 crypto-afalg Linux AF_ALG crypto backend driver 1913 capstone capstone disassembler support 1914 debug-mutex mutex debugging support 1915 libpmem libpmem support 1916 xkbcommon xkbcommon support 1917 rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 1918 1919NOTE: The object files are built at the place where configure is launched 1920EOF 1921exit 0 1922fi 1923 1924# Remove old dependency files to make sure that they get properly regenerated 1925rm -f */config-devices.mak.d 1926 1927# Remove syscall_nr.h to be sure they will be regenerated in the build 1928# directory, not in the source directory 1929for arch in alpha hppa m68k xtensa sh4 microblaze arm ppc s390x sparc sparc64 \ 1930 i386 x86_64 mips mips64 ; do 1931 # remove the file if it has been generated in the source directory 1932 rm -f "${source_path}/linux-user/${arch}/syscall_nr.h" 1933 # remove the dependency files 1934 for target in ${arch}*-linux-user ; do 1935 test -d "${target}" && find "${target}" -type f -name "*.d" \ 1936 -exec grep -q "${source_path}/linux-user/${arch}/syscall_nr.h" {} \; \ 1937 -print | while read file ; do rm "${file}" "${file%.d}.o" ; done 1938 done 1939done 1940 1941if test -z "$python" 1942then 1943 error_exit "Python not found. Use --python=/path/to/python" 1944fi 1945 1946# Note that if the Python conditional here evaluates True we will exit 1947# with status 1 which is a shell 'false' value. 1948if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then 1949 error_exit "Cannot use '$python', Python >= 3.5 is required." \ 1950 "Use --python=/path/to/python to specify a supported Python." 1951fi 1952 1953# Preserve python version since some functionality is dependent on it 1954python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) 1955 1956# Suppress writing compiled files 1957python="$python -B" 1958 1959# Check that the C compiler works. Doing this here before testing 1960# the host CPU ensures that we had a valid CC to autodetect the 1961# $cpu var (and we should bail right here if that's not the case). 1962# It also allows the help message to be printed without a CC. 1963write_c_skeleton; 1964if compile_object ; then 1965 : C compiler works ok 1966else 1967 error_exit "\"$cc\" either does not exist or does not work" 1968fi 1969if ! compile_prog ; then 1970 error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 1971fi 1972 1973# Now we have handled --enable-tcg-interpreter and know we're not just 1974# printing the help message, bail out if the host CPU isn't supported. 1975if test "$ARCH" = "unknown"; then 1976 if test "$tcg_interpreter" = "yes" ; then 1977 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1978 else 1979 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1980 fi 1981fi 1982 1983# Consult white-list to determine whether to enable werror 1984# by default. Only enable by default for git builds 1985if test -z "$werror" ; then 1986 if test -e "$source_path/.git" && \ 1987 { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 1988 werror="yes" 1989 else 1990 werror="no" 1991 fi 1992fi 1993 1994if test "$bogus_os" = "yes"; then 1995 # Now that we know that we're not printing the help and that 1996 # the compiler works (so the results of the check_defines we used 1997 # to identify the OS are reliable), if we didn't recognize the 1998 # host OS we should stop now. 1999 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 2000fi 2001 2002# Check whether the compiler matches our minimum requirements: 2003cat > $TMPC << EOF 2004#if defined(__clang_major__) && defined(__clang_minor__) 2005# ifdef __apple_build_version__ 2006# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) 2007# error You need at least XCode Clang v5.1 to compile QEMU 2008# endif 2009# else 2010# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) 2011# error You need at least Clang v3.4 to compile QEMU 2012# endif 2013# endif 2014#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 2015# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 2016# error You need at least GCC v4.8 to compile QEMU 2017# endif 2018#else 2019# error You either need GCC or Clang to compiler QEMU 2020#endif 2021int main (void) { return 0; } 2022EOF 2023if ! compile_prog "" "" ; then 2024 error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" 2025fi 2026 2027gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 2028gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 2029gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 2030gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" 2031gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" 2032gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags" 2033# Note that we do not add -Werror to gcc_flags here, because that would 2034# enable it for all configure tests. If a configure test failed due 2035# to -Werror this would just silently disable some features, 2036# so it's too error prone. 2037 2038cc_has_warning_flag() { 2039 write_c_skeleton; 2040 2041 # Use the positive sense of the flag when testing for -Wno-wombat 2042 # support (gcc will happily accept the -Wno- form of unknown 2043 # warning options). 2044 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 2045 compile_prog "-Werror $optflag" "" 2046} 2047 2048for flag in $gcc_flags; do 2049 if cc_has_warning_flag $flag ; then 2050 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2051 fi 2052done 2053 2054if test "$stack_protector" != "no"; then 2055 cat > $TMPC << EOF 2056int main(int argc, char *argv[]) 2057{ 2058 char arr[64], *p = arr, *c = argv[0]; 2059 while (*c) { 2060 *p++ = *c++; 2061 } 2062 return 0; 2063} 2064EOF 2065 gcc_flags="-fstack-protector-strong -fstack-protector-all" 2066 sp_on=0 2067 for flag in $gcc_flags; do 2068 # We need to check both a compile and a link, since some compiler 2069 # setups fail only on a .c->.o compile and some only at link time 2070 if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && 2071 compile_prog "-Werror $flag" ""; then 2072 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2073 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 2074 sp_on=1 2075 break 2076 fi 2077 done 2078 if test "$stack_protector" = yes; then 2079 if test $sp_on = 0; then 2080 error_exit "Stack protector not supported" 2081 fi 2082 fi 2083fi 2084 2085# Disable -Wmissing-braces on older compilers that warn even for 2086# the "universal" C zero initializer {0}. 2087cat > $TMPC << EOF 2088struct { 2089 int a[2]; 2090} x = {0}; 2091EOF 2092if compile_object "-Werror" "" ; then 2093 : 2094else 2095 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 2096fi 2097 2098# Our module code doesn't support Windows 2099if test "$modules" = "yes" && test "$mingw32" = "yes" ; then 2100 error_exit "Modules are not available for Windows" 2101fi 2102 2103# module_upgrades is only reasonable if modules are enabled 2104if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2105 error_exit "Can't enable module-upgrades as Modules are not enabled" 2106fi 2107 2108# Static linking is not possible with modules or PIE 2109if test "$static" = "yes" ; then 2110 if test "$modules" = "yes" ; then 2111 error_exit "static and modules are mutually incompatible" 2112 fi 2113fi 2114 2115# Unconditional check for compiler __thread support 2116 cat > $TMPC << EOF 2117static __thread int tls_var; 2118int main(void) { return tls_var; } 2119EOF 2120 2121if ! compile_prog "-Werror" "" ; then 2122 error_exit "Your compiler does not support the __thread specifier for " \ 2123 "Thread-Local Storage (TLS). Please upgrade to a version that does." 2124fi 2125 2126cat > $TMPC << EOF 2127 2128#ifdef __linux__ 2129# define THREAD __thread 2130#else 2131# define THREAD 2132#endif 2133static THREAD int tls_var; 2134int main(void) { return tls_var; } 2135EOF 2136 2137# Check we support --no-pie first; we will need this for building ROMs. 2138if compile_prog "-Werror -fno-pie" "-no-pie"; then 2139 CFLAGS_NOPIE="-fno-pie" 2140 LDFLAGS_NOPIE="-no-pie" 2141fi 2142 2143if test "$static" = "yes"; then 2144 if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 2145 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 2146 QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 2147 pie="yes" 2148 elif test "$pie" = "yes"; then 2149 error_exit "-static-pie not available due to missing toolchain support" 2150 else 2151 QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 2152 pie="no" 2153 fi 2154elif test "$pie" = "no"; then 2155 QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" 2156 QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS" 2157elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 2158 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 2159 QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" 2160 pie="yes" 2161elif test "$pie" = "yes"; then 2162 error_exit "PIE not available due to missing toolchain support" 2163else 2164 echo "Disabling PIE due to missing toolchain support" 2165 pie="no" 2166fi 2167 2168# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2169# The combination is known as "full relro", because .got.plt is read-only too. 2170if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2171 QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2172fi 2173 2174########################################## 2175# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2176# use i686 as default anyway, but for those that don't, an explicit 2177# specification is necessary 2178 2179if test "$cpu" = "i386"; then 2180 cat > $TMPC << EOF 2181static int sfaa(int *ptr) 2182{ 2183 return __sync_fetch_and_and(ptr, 0); 2184} 2185 2186int main(void) 2187{ 2188 int val = 42; 2189 val = __sync_val_compare_and_swap(&val, 0, 1); 2190 sfaa(&val); 2191 return val; 2192} 2193EOF 2194 if ! compile_prog "" "" ; then 2195 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 2196 fi 2197fi 2198 2199######################################### 2200# Solaris specific configure tool chain decisions 2201 2202if test "$solaris" = "yes" ; then 2203 if has $install; then 2204 : 2205 else 2206 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 2207 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 2208 "to get ginstall which is used by default (which lives in /opt/csw/bin)" 2209 fi 2210 if test "$(path_of $install)" = "/usr/sbin/install" ; then 2211 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 2212 "try ginstall from the GNU fileutils available from www.blastwave.org" \ 2213 "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 2214 fi 2215 if has ar; then 2216 : 2217 else 2218 if test -f /usr/ccs/bin/ar ; then 2219 error_exit "No path includes ar" \ 2220 "Add /usr/ccs/bin to your path and rerun configure" 2221 fi 2222 error_exit "No path includes ar" 2223 fi 2224fi 2225 2226if test -z "${target_list+xxx}" ; then 2227 for target in $default_target_list; do 2228 supported_target $target 2>/dev/null && \ 2229 target_list="$target_list $target" 2230 done 2231 target_list="${target_list# }" 2232else 2233 target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2234 for target in $target_list; do 2235 # Check that we recognised the target name; this allows a more 2236 # friendly error message than if we let it fall through. 2237 case " $default_target_list " in 2238 *" $target "*) 2239 ;; 2240 *) 2241 error_exit "Unknown target name '$target'" 2242 ;; 2243 esac 2244 supported_target $target || exit 1 2245 done 2246fi 2247 2248# see if system emulation was really requested 2249case " $target_list " in 2250 *"-softmmu "*) softmmu=yes 2251 ;; 2252 *) softmmu=no 2253 ;; 2254esac 2255 2256for target in $target_list; do 2257 case "$target" in 2258 arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu) 2259 edk2_blobs="yes" 2260 ;; 2261 esac 2262done 2263# The EDK2 binaries are compressed with bzip2 2264if test "$edk2_blobs" = "yes" && ! has bzip2; then 2265 error_exit "The bzip2 program is required for building QEMU" 2266fi 2267 2268feature_not_found() { 2269 feature=$1 2270 remedy=$2 2271 2272 error_exit "User requested feature $feature" \ 2273 "configure was not able to find it." \ 2274 "$remedy" 2275} 2276 2277# --- 2278# big/little endian test 2279cat > $TMPC << EOF 2280short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 2281short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 2282extern int foo(short *, short *); 2283int main(int argc, char *argv[]) { 2284 return foo(big_endian, little_endian); 2285} 2286EOF 2287 2288if compile_object ; then 2289 if strings -a $TMPO | grep -q BiGeNdIaN ; then 2290 bigendian="yes" 2291 elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 2292 bigendian="no" 2293 else 2294 echo big/little test failed 2295 fi 2296else 2297 echo big/little test failed 2298fi 2299 2300########################################## 2301# system tools 2302if test -z "$want_tools"; then 2303 if test "$softmmu" = "no"; then 2304 want_tools=no 2305 else 2306 want_tools=yes 2307 fi 2308fi 2309 2310########################################## 2311# cocoa implies not SDL or GTK 2312# (the cocoa UI code currently assumes it is always the active UI 2313# and doesn't interact well with other UI frontend code) 2314if test "$cocoa" = "yes"; then 2315 if test "$sdl" = "yes"; then 2316 error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2317 fi 2318 if test "$gtk" = "yes"; then 2319 error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2320 fi 2321 gtk=no 2322 sdl=no 2323fi 2324 2325# Some versions of Mac OS X incorrectly define SIZE_MAX 2326cat > $TMPC << EOF 2327#include <stdint.h> 2328#include <stdio.h> 2329int main(int argc, char *argv[]) { 2330 return printf("%zu", SIZE_MAX); 2331} 2332EOF 2333have_broken_size_max=no 2334if ! compile_object -Werror ; then 2335 have_broken_size_max=yes 2336fi 2337 2338########################################## 2339# L2TPV3 probe 2340 2341cat > $TMPC <<EOF 2342#include <sys/socket.h> 2343#include <linux/ip.h> 2344int main(void) { return sizeof(struct mmsghdr); } 2345EOF 2346if compile_prog "" "" ; then 2347 l2tpv3=yes 2348else 2349 l2tpv3=no 2350fi 2351 2352######################################### 2353# vhost interdependencies and host support 2354 2355# vhost backends 2356test "$vhost_user" = "" && vhost_user=yes 2357if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then 2358 error_exit "vhost-user isn't available on win32" 2359fi 2360test "$vhost_kernel" = "" && vhost_kernel=$linux 2361if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2362 error_exit "vhost-kernel is only available on Linux" 2363fi 2364 2365# vhost-kernel devices 2366test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2367if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2368 error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2369fi 2370test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2371if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2372 error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2373fi 2374 2375# vhost-user backends 2376test "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2377if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2378 error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2379fi 2380test "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2381if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2382 error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2383fi 2384test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 2385if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 2386 error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 2387fi 2388 2389# OR the vhost-kernel and vhost-user values for simplicity 2390if test "$vhost_net" = ""; then 2391 test "$vhost_net_user" = "yes" && vhost_net=yes 2392 test "$vhost_kernel" = "yes" && vhost_net=yes 2393fi 2394 2395########################################## 2396# MinGW / Mingw-w64 localtime_r/gmtime_r check 2397 2398if test "$mingw32" = "yes"; then 2399 # Some versions of MinGW / Mingw-w64 lack localtime_r 2400 # and gmtime_r entirely. 2401 # 2402 # Some versions of Mingw-w64 define a macro for 2403 # localtime_r/gmtime_r. 2404 # 2405 # Some versions of Mingw-w64 will define functions 2406 # for localtime_r/gmtime_r, but only if you have 2407 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 2408 # though, unistd.h and pthread.h both define 2409 # that for you. 2410 # 2411 # So this #undef localtime_r and #include <unistd.h> 2412 # are not in fact redundant. 2413cat > $TMPC << EOF 2414#include <unistd.h> 2415#include <time.h> 2416#undef localtime_r 2417int main(void) { localtime_r(NULL, NULL); return 0; } 2418EOF 2419 if compile_prog "" "" ; then 2420 localtime_r="yes" 2421 else 2422 localtime_r="no" 2423 fi 2424fi 2425 2426########################################## 2427# pkg-config probe 2428 2429if ! has "$pkg_config_exe"; then 2430 error_exit "pkg-config binary '$pkg_config_exe' not found" 2431fi 2432 2433########################################## 2434# NPTL probe 2435 2436if test "$linux_user" = "yes"; then 2437 cat > $TMPC <<EOF 2438#include <sched.h> 2439#include <linux/futex.h> 2440int main(void) { 2441#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2442#error bork 2443#endif 2444 return 0; 2445} 2446EOF 2447 if ! compile_object ; then 2448 feature_not_found "nptl" "Install glibc and linux kernel headers." 2449 fi 2450fi 2451 2452########################################## 2453# lzo check 2454 2455if test "$lzo" != "no" ; then 2456 cat > $TMPC << EOF 2457#include <lzo/lzo1x.h> 2458int main(void) { lzo_version(); return 0; } 2459EOF 2460 if compile_prog "" "-llzo2" ; then 2461 libs_softmmu="$libs_softmmu -llzo2" 2462 lzo="yes" 2463 else 2464 if test "$lzo" = "yes"; then 2465 feature_not_found "liblzo2" "Install liblzo2 devel" 2466 fi 2467 lzo="no" 2468 fi 2469fi 2470 2471########################################## 2472# snappy check 2473 2474if test "$snappy" != "no" ; then 2475 cat > $TMPC << EOF 2476#include <snappy-c.h> 2477int main(void) { snappy_max_compressed_length(4096); return 0; } 2478EOF 2479 if compile_prog "" "-lsnappy" ; then 2480 libs_softmmu="$libs_softmmu -lsnappy" 2481 snappy="yes" 2482 else 2483 if test "$snappy" = "yes"; then 2484 feature_not_found "libsnappy" "Install libsnappy devel" 2485 fi 2486 snappy="no" 2487 fi 2488fi 2489 2490########################################## 2491# bzip2 check 2492 2493if test "$bzip2" != "no" ; then 2494 cat > $TMPC << EOF 2495#include <bzlib.h> 2496int main(void) { BZ2_bzlibVersion(); return 0; } 2497EOF 2498 if compile_prog "" "-lbz2" ; then 2499 bzip2="yes" 2500 else 2501 if test "$bzip2" = "yes"; then 2502 feature_not_found "libbzip2" "Install libbzip2 devel" 2503 fi 2504 bzip2="no" 2505 fi 2506fi 2507 2508########################################## 2509# lzfse check 2510 2511if test "$lzfse" != "no" ; then 2512 cat > $TMPC << EOF 2513#include <lzfse.h> 2514int main(void) { lzfse_decode_scratch_size(); return 0; } 2515EOF 2516 if compile_prog "" "-llzfse" ; then 2517 lzfse="yes" 2518 else 2519 if test "$lzfse" = "yes"; then 2520 feature_not_found "lzfse" "Install lzfse devel" 2521 fi 2522 lzfse="no" 2523 fi 2524fi 2525 2526########################################## 2527# zstd check 2528 2529if test "$zstd" != "no" ; then 2530 libzstd_minver="1.4.0" 2531 if $pkg_config --atleast-version=$libzstd_minver libzstd ; then 2532 zstd_cflags="$($pkg_config --cflags libzstd)" 2533 zstd_libs="$($pkg_config --libs libzstd)" 2534 LIBS="$zstd_libs $LIBS" 2535 QEMU_CFLAGS="$QEMU_CFLAGS $zstd_cflags" 2536 zstd="yes" 2537 else 2538 if test "$zstd" = "yes" ; then 2539 feature_not_found "libzstd" "Install libzstd devel" 2540 fi 2541 zstd="no" 2542 fi 2543fi 2544 2545########################################## 2546# libseccomp check 2547 2548if test "$seccomp" != "no" ; then 2549 libseccomp_minver="2.3.0" 2550 if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2551 seccomp_cflags="$($pkg_config --cflags libseccomp)" 2552 seccomp_libs="$($pkg_config --libs libseccomp)" 2553 seccomp="yes" 2554 else 2555 if test "$seccomp" = "yes" ; then 2556 feature_not_found "libseccomp" \ 2557 "Install libseccomp devel >= $libseccomp_minver" 2558 fi 2559 seccomp="no" 2560 fi 2561fi 2562########################################## 2563# xen probe 2564 2565if test "$xen" != "no" ; then 2566 # Check whether Xen library path is specified via --extra-ldflags to avoid 2567 # overriding this setting with pkg-config output. If not, try pkg-config 2568 # to obtain all needed flags. 2569 2570 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2571 $pkg_config --exists xencontrol ; then 2572 xen_ctrl_version="$(printf '%d%02d%02d' \ 2573 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2574 xen=yes 2575 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2576 xen_pc="$xen_pc xenevtchn xendevicemodel" 2577 if $pkg_config --exists xentoolcore; then 2578 xen_pc="$xen_pc xentoolcore" 2579 fi 2580 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" 2581 libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" 2582 else 2583 2584 xen_libs="-lxenstore -lxenctrl -lxenguest" 2585 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2586 2587 # First we test whether Xen headers and libraries are available. 2588 # If no, we are done and there is no Xen support. 2589 # If yes, more tests are run to detect the Xen version. 2590 2591 # Xen (any) 2592 cat > $TMPC <<EOF 2593#include <xenctrl.h> 2594int main(void) { 2595 return 0; 2596} 2597EOF 2598 if ! compile_prog "" "$xen_libs" ; then 2599 # Xen not found 2600 if test "$xen" = "yes" ; then 2601 feature_not_found "xen" "Install xen devel" 2602 fi 2603 xen=no 2604 2605 # Xen unstable 2606 elif 2607 cat > $TMPC <<EOF && 2608#undef XC_WANT_COMPAT_DEVICEMODEL_API 2609#define __XEN_TOOLS__ 2610#include <xendevicemodel.h> 2611#include <xenforeignmemory.h> 2612int main(void) { 2613 xendevicemodel_handle *xd; 2614 xenforeignmemory_handle *xfmem; 2615 2616 xd = xendevicemodel_open(0, 0); 2617 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 2618 2619 xfmem = xenforeignmemory_open(0, 0); 2620 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2621 2622 return 0; 2623} 2624EOF 2625 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 2626 then 2627 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 2628 xen_ctrl_version=41100 2629 xen=yes 2630 elif 2631 cat > $TMPC <<EOF && 2632#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2633#include <xenforeignmemory.h> 2634#include <xentoolcore.h> 2635int main(void) { 2636 xenforeignmemory_handle *xfmem; 2637 2638 xfmem = xenforeignmemory_open(0, 0); 2639 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 2640 xentoolcore_restrict_all(0); 2641 2642 return 0; 2643} 2644EOF 2645 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 2646 then 2647 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 2648 xen_ctrl_version=41000 2649 xen=yes 2650 elif 2651 cat > $TMPC <<EOF && 2652#undef XC_WANT_COMPAT_DEVICEMODEL_API 2653#define __XEN_TOOLS__ 2654#include <xendevicemodel.h> 2655int main(void) { 2656 xendevicemodel_handle *xd; 2657 2658 xd = xendevicemodel_open(0, 0); 2659 xendevicemodel_close(xd); 2660 2661 return 0; 2662} 2663EOF 2664 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2665 then 2666 xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2667 xen_ctrl_version=40900 2668 xen=yes 2669 elif 2670 cat > $TMPC <<EOF && 2671/* 2672 * If we have stable libs the we don't want the libxc compat 2673 * layers, regardless of what CFLAGS we may have been given. 2674 * 2675 * Also, check if xengnttab_grant_copy_segment_t is defined and 2676 * grant copy operation is implemented. 2677 */ 2678#undef XC_WANT_COMPAT_EVTCHN_API 2679#undef XC_WANT_COMPAT_GNTTAB_API 2680#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2681#include <xenctrl.h> 2682#include <xenstore.h> 2683#include <xenevtchn.h> 2684#include <xengnttab.h> 2685#include <xenforeignmemory.h> 2686#include <stdint.h> 2687#include <xen/hvm/hvm_info_table.h> 2688#if !defined(HVM_MAX_VCPUS) 2689# error HVM_MAX_VCPUS not defined 2690#endif 2691int main(void) { 2692 xc_interface *xc = NULL; 2693 xenforeignmemory_handle *xfmem; 2694 xenevtchn_handle *xe; 2695 xengnttab_handle *xg; 2696 xengnttab_grant_copy_segment_t* seg = NULL; 2697 2698 xs_daemon_open(); 2699 2700 xc = xc_interface_open(0, 0, 0); 2701 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2702 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2703 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2704 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2705 2706 xfmem = xenforeignmemory_open(0, 0); 2707 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2708 2709 xe = xenevtchn_open(0, 0); 2710 xenevtchn_fd(xe); 2711 2712 xg = xengnttab_open(0, 0); 2713 xengnttab_grant_copy(xg, 0, seg); 2714 2715 return 0; 2716} 2717EOF 2718 compile_prog "" "$xen_libs $xen_stable_libs" 2719 then 2720 xen_ctrl_version=40800 2721 xen=yes 2722 elif 2723 cat > $TMPC <<EOF && 2724/* 2725 * If we have stable libs the we don't want the libxc compat 2726 * layers, regardless of what CFLAGS we may have been given. 2727 */ 2728#undef XC_WANT_COMPAT_EVTCHN_API 2729#undef XC_WANT_COMPAT_GNTTAB_API 2730#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2731#include <xenctrl.h> 2732#include <xenstore.h> 2733#include <xenevtchn.h> 2734#include <xengnttab.h> 2735#include <xenforeignmemory.h> 2736#include <stdint.h> 2737#include <xen/hvm/hvm_info_table.h> 2738#if !defined(HVM_MAX_VCPUS) 2739# error HVM_MAX_VCPUS not defined 2740#endif 2741int main(void) { 2742 xc_interface *xc = NULL; 2743 xenforeignmemory_handle *xfmem; 2744 xenevtchn_handle *xe; 2745 xengnttab_handle *xg; 2746 2747 xs_daemon_open(); 2748 2749 xc = xc_interface_open(0, 0, 0); 2750 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2751 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2752 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2753 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2754 2755 xfmem = xenforeignmemory_open(0, 0); 2756 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2757 2758 xe = xenevtchn_open(0, 0); 2759 xenevtchn_fd(xe); 2760 2761 xg = xengnttab_open(0, 0); 2762 xengnttab_map_grant_ref(xg, 0, 0, 0); 2763 2764 return 0; 2765} 2766EOF 2767 compile_prog "" "$xen_libs $xen_stable_libs" 2768 then 2769 xen_ctrl_version=40701 2770 xen=yes 2771 2772 # Xen 4.6 2773 elif 2774 cat > $TMPC <<EOF && 2775#include <xenctrl.h> 2776#include <xenstore.h> 2777#include <stdint.h> 2778#include <xen/hvm/hvm_info_table.h> 2779#if !defined(HVM_MAX_VCPUS) 2780# error HVM_MAX_VCPUS not defined 2781#endif 2782int main(void) { 2783 xc_interface *xc; 2784 xs_daemon_open(); 2785 xc = xc_interface_open(0, 0, 0); 2786 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2787 xc_gnttab_open(NULL, 0); 2788 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2789 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2790 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2791 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2792 return 0; 2793} 2794EOF 2795 compile_prog "" "$xen_libs" 2796 then 2797 xen_ctrl_version=40600 2798 xen=yes 2799 2800 # Xen 4.5 2801 elif 2802 cat > $TMPC <<EOF && 2803#include <xenctrl.h> 2804#include <xenstore.h> 2805#include <stdint.h> 2806#include <xen/hvm/hvm_info_table.h> 2807#if !defined(HVM_MAX_VCPUS) 2808# error HVM_MAX_VCPUS not defined 2809#endif 2810int main(void) { 2811 xc_interface *xc; 2812 xs_daemon_open(); 2813 xc = xc_interface_open(0, 0, 0); 2814 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2815 xc_gnttab_open(NULL, 0); 2816 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2817 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2818 xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 2819 return 0; 2820} 2821EOF 2822 compile_prog "" "$xen_libs" 2823 then 2824 xen_ctrl_version=40500 2825 xen=yes 2826 2827 elif 2828 cat > $TMPC <<EOF && 2829#include <xenctrl.h> 2830#include <xenstore.h> 2831#include <stdint.h> 2832#include <xen/hvm/hvm_info_table.h> 2833#if !defined(HVM_MAX_VCPUS) 2834# error HVM_MAX_VCPUS not defined 2835#endif 2836int main(void) { 2837 xc_interface *xc; 2838 xs_daemon_open(); 2839 xc = xc_interface_open(0, 0, 0); 2840 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2841 xc_gnttab_open(NULL, 0); 2842 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2843 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2844 return 0; 2845} 2846EOF 2847 compile_prog "" "$xen_libs" 2848 then 2849 xen_ctrl_version=40200 2850 xen=yes 2851 2852 else 2853 if test "$xen" = "yes" ; then 2854 feature_not_found "xen (unsupported version)" \ 2855 "Install a supported xen (xen 4.2 or newer)" 2856 fi 2857 xen=no 2858 fi 2859 2860 if test "$xen" = yes; then 2861 if test $xen_ctrl_version -ge 40701 ; then 2862 libs_softmmu="$xen_stable_libs $libs_softmmu" 2863 fi 2864 libs_softmmu="$xen_libs $libs_softmmu" 2865 fi 2866 fi 2867fi 2868 2869if test "$xen_pci_passthrough" != "no"; then 2870 if test "$xen" = "yes" && test "$linux" = "yes"; then 2871 xen_pci_passthrough=yes 2872 else 2873 if test "$xen_pci_passthrough" = "yes"; then 2874 error_exit "User requested feature Xen PCI Passthrough" \ 2875 " but this feature requires /sys from Linux" 2876 fi 2877 xen_pci_passthrough=no 2878 fi 2879fi 2880 2881########################################## 2882# Windows Hypervisor Platform accelerator (WHPX) check 2883if test "$whpx" != "no" ; then 2884 if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then 2885 whpx="yes" 2886 else 2887 if test "$whpx" = "yes"; then 2888 feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" 2889 fi 2890 whpx="no" 2891 fi 2892fi 2893 2894########################################## 2895# Sparse probe 2896if test "$sparse" != "no" ; then 2897 if has cgcc; then 2898 sparse=yes 2899 else 2900 if test "$sparse" = "yes" ; then 2901 feature_not_found "sparse" "Install sparse binary" 2902 fi 2903 sparse=no 2904 fi 2905fi 2906 2907########################################## 2908# X11 probe 2909if $pkg_config --exists "x11"; then 2910 have_x11=yes 2911 x11_cflags=$($pkg_config --cflags x11) 2912 x11_libs=$($pkg_config --libs x11) 2913fi 2914 2915########################################## 2916# GTK probe 2917 2918if test "$gtk" != "no"; then 2919 gtkpackage="gtk+-3.0" 2920 gtkx11package="gtk+-x11-3.0" 2921 gtkversion="3.22.0" 2922 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 2923 gtk_cflags=$($pkg_config --cflags $gtkpackage) 2924 gtk_libs=$($pkg_config --libs $gtkpackage) 2925 gtk_version=$($pkg_config --modversion $gtkpackage) 2926 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 2927 need_x11=yes 2928 gtk_cflags="$gtk_cflags $x11_cflags" 2929 gtk_libs="$gtk_libs $x11_libs" 2930 fi 2931 gtk="yes" 2932 elif test "$gtk" = "yes"; then 2933 feature_not_found "gtk" "Install gtk3-devel" 2934 else 2935 gtk="no" 2936 fi 2937fi 2938 2939 2940########################################## 2941# GNUTLS probe 2942 2943if test "$gnutls" != "no"; then 2944 pass="no" 2945 if $pkg_config --exists "gnutls >= 3.1.18"; then 2946 gnutls_cflags=$($pkg_config --cflags gnutls) 2947 gnutls_libs=$($pkg_config --libs gnutls) 2948 # Packaging for the static libraries is not always correct. 2949 # At least ubuntu 18.04 ships only shared libraries. 2950 write_c_skeleton 2951 if compile_prog "" "$gnutls_libs" ; then 2952 LIBS="$gnutls_libs $LIBS" 2953 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 2954 pass="yes" 2955 fi 2956 fi 2957 if test "$pass" = "no" && test "$gnutls" = "yes"; then 2958 feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 2959 else 2960 gnutls="$pass" 2961 fi 2962fi 2963 2964 2965# If user didn't give a --disable/enable-gcrypt flag, 2966# then mark as disabled if user requested nettle 2967# explicitly 2968if test -z "$gcrypt" 2969then 2970 if test "$nettle" = "yes" 2971 then 2972 gcrypt="no" 2973 fi 2974fi 2975 2976# If user didn't give a --disable/enable-nettle flag, 2977# then mark as disabled if user requested gcrypt 2978# explicitly 2979if test -z "$nettle" 2980then 2981 if test "$gcrypt" = "yes" 2982 then 2983 nettle="no" 2984 fi 2985fi 2986 2987has_libgcrypt() { 2988 if ! has "libgcrypt-config" 2989 then 2990 return 1 2991 fi 2992 2993 if test -n "$cross_prefix" 2994 then 2995 host=$(libgcrypt-config --host) 2996 if test "$host-" != $cross_prefix 2997 then 2998 return 1 2999 fi 3000 fi 3001 3002 maj=`libgcrypt-config --version | awk -F . '{print $1}'` 3003 min=`libgcrypt-config --version | awk -F . '{print $2}'` 3004 3005 if test $maj != 1 || test $min -lt 5 3006 then 3007 return 1 3008 fi 3009 3010 return 0 3011} 3012 3013 3014if test "$nettle" != "no"; then 3015 pass="no" 3016 if $pkg_config --exists "nettle >= 2.7.1"; then 3017 nettle_cflags=$($pkg_config --cflags nettle) 3018 nettle_libs=$($pkg_config --libs nettle) 3019 nettle_version=$($pkg_config --modversion nettle) 3020 # Link test to make sure the given libraries work (e.g for static). 3021 write_c_skeleton 3022 if compile_prog "" "$nettle_libs" ; then 3023 LIBS="$nettle_libs $LIBS" 3024 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 3025 if test -z "$gcrypt"; then 3026 gcrypt="no" 3027 fi 3028 pass="yes" 3029 fi 3030 fi 3031 if test "$pass" = "yes" 3032 then 3033 cat > $TMPC << EOF 3034#include <nettle/xts.h> 3035int main(void) { 3036 return 0; 3037} 3038EOF 3039 if compile_prog "$nettle_cflags" "$nettle_libs" ; then 3040 nettle_xts=yes 3041 qemu_private_xts=no 3042 fi 3043 fi 3044 if test "$pass" = "no" && test "$nettle" = "yes"; then 3045 feature_not_found "nettle" "Install nettle devel >= 2.7.1" 3046 else 3047 nettle="$pass" 3048 fi 3049fi 3050 3051if test "$gcrypt" != "no"; then 3052 pass="no" 3053 if has_libgcrypt; then 3054 gcrypt_cflags=$(libgcrypt-config --cflags) 3055 gcrypt_libs=$(libgcrypt-config --libs) 3056 # Debian has removed -lgpg-error from libgcrypt-config 3057 # as it "spreads unnecessary dependencies" which in 3058 # turn breaks static builds... 3059 if test "$static" = "yes" 3060 then 3061 gcrypt_libs="$gcrypt_libs -lgpg-error" 3062 fi 3063 3064 # Link test to make sure the given libraries work (e.g for static). 3065 write_c_skeleton 3066 if compile_prog "" "$gcrypt_libs" ; then 3067 LIBS="$gcrypt_libs $LIBS" 3068 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 3069 pass="yes" 3070 fi 3071 fi 3072 if test "$pass" = "yes"; then 3073 gcrypt="yes" 3074 cat > $TMPC << EOF 3075#include <gcrypt.h> 3076int main(void) { 3077 gcry_mac_hd_t handle; 3078 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 3079 GCRY_MAC_FLAG_SECURE, NULL); 3080 return 0; 3081} 3082EOF 3083 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3084 gcrypt_hmac=yes 3085 fi 3086 cat > $TMPC << EOF 3087#include <gcrypt.h> 3088int main(void) { 3089 gcry_cipher_hd_t handle; 3090 gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); 3091 return 0; 3092} 3093EOF 3094 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3095 gcrypt_xts=yes 3096 qemu_private_xts=no 3097 fi 3098 elif test "$gcrypt" = "yes"; then 3099 feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 3100 else 3101 gcrypt="no" 3102 fi 3103fi 3104 3105 3106if test "$gcrypt" = "yes" && test "$nettle" = "yes" 3107then 3108 error_exit "Only one of gcrypt & nettle can be enabled" 3109fi 3110 3111########################################## 3112# libtasn1 - only for the TLS creds/session test suite 3113 3114tasn1=yes 3115tasn1_cflags="" 3116tasn1_libs="" 3117if $pkg_config --exists "libtasn1"; then 3118 tasn1_cflags=$($pkg_config --cflags libtasn1) 3119 tasn1_libs=$($pkg_config --libs libtasn1) 3120else 3121 tasn1=no 3122fi 3123 3124 3125########################################## 3126# PAM probe 3127 3128if test "$auth_pam" != "no"; then 3129 cat > $TMPC <<EOF 3130#include <security/pam_appl.h> 3131#include <stdio.h> 3132int main(void) { 3133 const char *service_name = "qemu"; 3134 const char *user = "frank"; 3135 const struct pam_conv pam_conv = { 0 }; 3136 pam_handle_t *pamh = NULL; 3137 pam_start(service_name, user, &pam_conv, &pamh); 3138 return 0; 3139} 3140EOF 3141 if compile_prog "" "-lpam" ; then 3142 auth_pam=yes 3143 else 3144 if test "$auth_pam" = "yes"; then 3145 feature_not_found "PAM" "Install PAM development package" 3146 else 3147 auth_pam=no 3148 fi 3149 fi 3150fi 3151 3152########################################## 3153# getifaddrs (for tests/test-io-channel-socket ) 3154 3155have_ifaddrs_h=yes 3156if ! check_include "ifaddrs.h" ; then 3157 have_ifaddrs_h=no 3158fi 3159 3160########################################## 3161# VTE probe 3162 3163if test "$vte" != "no"; then 3164 vteminversion="0.32.0" 3165 if $pkg_config --exists "vte-2.91"; then 3166 vtepackage="vte-2.91" 3167 else 3168 vtepackage="vte-2.90" 3169 fi 3170 if $pkg_config --exists "$vtepackage >= $vteminversion"; then 3171 vte_cflags=$($pkg_config --cflags $vtepackage) 3172 vte_libs=$($pkg_config --libs $vtepackage) 3173 vteversion=$($pkg_config --modversion $vtepackage) 3174 vte="yes" 3175 elif test "$vte" = "yes"; then 3176 feature_not_found "vte" "Install libvte-2.90/2.91 devel" 3177 else 3178 vte="no" 3179 fi 3180fi 3181 3182########################################## 3183# SDL probe 3184 3185# Look for sdl configuration program (pkg-config or sdl2-config). Try 3186# sdl2-config even without cross prefix, and favour pkg-config over sdl2-config. 3187 3188sdl_probe () 3189{ 3190 if $pkg_config sdl2 --exists; then 3191 sdlconfig="$pkg_config sdl2" 3192 sdlversion=$($sdlconfig --modversion 2>/dev/null) 3193 elif has "$sdl2_config"; then 3194 sdlconfig="$sdl2_config" 3195 sdlversion=$($sdlconfig --version) 3196 else 3197 if test "$sdl" = "yes" ; then 3198 feature_not_found "sdl" "Install SDL2-devel" 3199 fi 3200 sdl=no 3201 # no need to do the rest 3202 return 3203 fi 3204 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then 3205 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 3206 fi 3207 3208 cat > $TMPC << EOF 3209#include <SDL.h> 3210#undef main /* We don't want SDL to override our main() */ 3211int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 3212EOF 3213 sdl_cflags=$($sdlconfig --cflags 2>/dev/null) 3214 sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug 3215 if test "$static" = "yes" ; then 3216 if $pkg_config sdl2 --exists; then 3217 sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null) 3218 else 3219 sdl_libs=$($sdlconfig --static-libs 2>/dev/null) 3220 fi 3221 else 3222 sdl_libs=$($sdlconfig --libs 2>/dev/null) 3223 fi 3224 if compile_prog "$sdl_cflags" "$sdl_libs" ; then 3225 sdl=yes 3226 3227 # static link with sdl ? (note: sdl.pc's --static --libs is broken) 3228 if test "$sdl" = "yes" && test "$static" = "yes" ; then 3229 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 3230 sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" 3231 sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" 3232 fi 3233 if compile_prog "$sdl_cflags" "$sdl_libs" ; then 3234 : 3235 else 3236 sdl=no 3237 fi 3238 fi # static link 3239 else # sdl not found 3240 if test "$sdl" = "yes" ; then 3241 feature_not_found "sdl" "Install SDL2 devel" 3242 fi 3243 sdl=no 3244 fi # sdl compile test 3245} 3246 3247sdl_image_probe () 3248{ 3249 if test "$sdl_image" != "no" ; then 3250 if $pkg_config SDL2_image --exists; then 3251 if test "$static" = "yes"; then 3252 sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null) 3253 else 3254 sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null) 3255 fi 3256 sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null) 3257 sdl_image=yes 3258 3259 sdl_cflags="$sdl_cflags $sdl_image_cflags" 3260 sdl_libs="$sdl_libs $sdl_image_libs" 3261 else 3262 if test "$sdl_image" = "yes" ; then 3263 feature_not_found "sdl_image" "Install SDL Image devel" 3264 else 3265 sdl_image=no 3266 fi 3267 fi 3268 fi 3269} 3270 3271if test "$sdl" != "no" ; then 3272 sdl_probe 3273fi 3274 3275if test "$sdl" = "yes" ; then 3276 sdl_image_probe 3277else 3278 if test "$sdl_image" = "yes"; then 3279 echo "warning: SDL Image requested, but SDL is not available, disabling" 3280 fi 3281 sdl_image=no 3282fi 3283 3284if test "$sdl" = "yes" ; then 3285 cat > $TMPC <<EOF 3286#include <SDL.h> 3287#if defined(SDL_VIDEO_DRIVER_X11) 3288#include <X11/XKBlib.h> 3289#else 3290#error No x11 support 3291#endif 3292int main(void) { return 0; } 3293EOF 3294 if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then 3295 need_x11=yes 3296 sdl_cflags="$sdl_cflags $x11_cflags" 3297 sdl_libs="$sdl_libs $x11_libs" 3298 fi 3299fi 3300 3301########################################## 3302# RDMA needs OpenFabrics libraries 3303if test "$rdma" != "no" ; then 3304 cat > $TMPC <<EOF 3305#include <rdma/rdma_cma.h> 3306int main(void) { return 0; } 3307EOF 3308 rdma_libs="-lrdmacm -libverbs -libumad" 3309 if compile_prog "" "$rdma_libs" ; then 3310 rdma="yes" 3311 libs_softmmu="$libs_softmmu $rdma_libs" 3312 else 3313 if test "$rdma" = "yes" ; then 3314 error_exit \ 3315 " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 3316 " Your options:" \ 3317 " (1) Fast: Install infiniband packages (devel) from your distro." \ 3318 " (2) Cleanest: Install libraries from www.openfabrics.org" \ 3319 " (3) Also: Install softiwarp if you don't have RDMA hardware" 3320 fi 3321 rdma="no" 3322 fi 3323fi 3324 3325########################################## 3326# PVRDMA detection 3327 3328cat > $TMPC <<EOF && 3329#include <sys/mman.h> 3330 3331int 3332main(void) 3333{ 3334 char buf = 0; 3335 void *addr = &buf; 3336 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 3337 3338 return 0; 3339} 3340EOF 3341 3342if test "$rdma" = "yes" ; then 3343 case "$pvrdma" in 3344 "") 3345 if compile_prog "" ""; then 3346 pvrdma="yes" 3347 else 3348 pvrdma="no" 3349 fi 3350 ;; 3351 "yes") 3352 if ! compile_prog "" ""; then 3353 error_exit "PVRDMA is not supported since mremap is not implemented" 3354 fi 3355 pvrdma="yes" 3356 ;; 3357 "no") 3358 pvrdma="no" 3359 ;; 3360 esac 3361else 3362 if test "$pvrdma" = "yes" ; then 3363 error_exit "PVRDMA requires rdma suppport" 3364 fi 3365 pvrdma="no" 3366fi 3367 3368# Let's see if enhanced reg_mr is supported 3369if test "$pvrdma" = "yes" ; then 3370 3371cat > $TMPC <<EOF && 3372#include <infiniband/verbs.h> 3373 3374int 3375main(void) 3376{ 3377 struct ibv_mr *mr; 3378 struct ibv_pd *pd = NULL; 3379 size_t length = 10; 3380 uint64_t iova = 0; 3381 int access = 0; 3382 void *addr = NULL; 3383 3384 mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 3385 3386 ibv_dereg_mr(mr); 3387 3388 return 0; 3389} 3390EOF 3391 if ! compile_prog "" "-libverbs"; then 3392 QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 3393 fi 3394fi 3395 3396########################################## 3397# VNC SASL detection 3398if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then 3399 cat > $TMPC <<EOF 3400#include <sasl/sasl.h> 3401#include <stdio.h> 3402int main(void) { sasl_server_init(NULL, "qemu"); return 0; } 3403EOF 3404 # Assuming Cyrus-SASL installed in /usr prefix 3405 # QEMU defines struct iovec in "qemu/osdep.h", 3406 # we don't want libsasl to redefine it in <sasl/sasl.h>. 3407 vnc_sasl_cflags="-DSTRUCT_IOVEC_DEFINED" 3408 vnc_sasl_libs="-lsasl2" 3409 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 3410 vnc_sasl=yes 3411 libs_softmmu="$vnc_sasl_libs $libs_softmmu" 3412 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 3413 else 3414 if test "$vnc_sasl" = "yes" ; then 3415 feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 3416 fi 3417 vnc_sasl=no 3418 fi 3419fi 3420 3421########################################## 3422# VNC JPEG detection 3423if test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then 3424cat > $TMPC <<EOF 3425#include <stdio.h> 3426#include <jpeglib.h> 3427int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 3428EOF 3429 vnc_jpeg_cflags="" 3430 vnc_jpeg_libs="-ljpeg" 3431 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 3432 vnc_jpeg=yes 3433 libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 3434 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 3435 else 3436 if test "$vnc_jpeg" = "yes" ; then 3437 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 3438 fi 3439 vnc_jpeg=no 3440 fi 3441fi 3442 3443########################################## 3444# VNC PNG detection 3445if test "$vnc" = "yes" && test "$vnc_png" != "no" ; then 3446cat > $TMPC <<EOF 3447//#include <stdio.h> 3448#include <png.h> 3449#include <stddef.h> 3450int main(void) { 3451 png_structp png_ptr; 3452 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 3453 return png_ptr != 0; 3454} 3455EOF 3456 if $pkg_config libpng --exists; then 3457 vnc_png_cflags=$($pkg_config libpng --cflags) 3458 vnc_png_libs=$($pkg_config libpng --libs) 3459 else 3460 vnc_png_cflags="" 3461 vnc_png_libs="-lpng" 3462 fi 3463 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 3464 vnc_png=yes 3465 libs_softmmu="$vnc_png_libs $libs_softmmu" 3466 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 3467 else 3468 if test "$vnc_png" = "yes" ; then 3469 feature_not_found "vnc-png" "Install libpng devel" 3470 fi 3471 vnc_png=no 3472 fi 3473fi 3474 3475########################################## 3476# xkbcommon probe 3477if test "$xkbcommon" != "no" ; then 3478 if $pkg_config xkbcommon --exists; then 3479 xkbcommon_cflags=$($pkg_config xkbcommon --cflags) 3480 xkbcommon_libs=$($pkg_config xkbcommon --libs) 3481 xkbcommon=yes 3482 else 3483 if test "$xkbcommon" = "yes" ; then 3484 feature_not_found "xkbcommon" "Install libxkbcommon-devel" 3485 fi 3486 xkbcommon=no 3487 fi 3488fi 3489 3490 3491########################################## 3492# xfsctl() probe, used for file-posix.c 3493if test "$xfs" != "no" ; then 3494 cat > $TMPC << EOF 3495#include <stddef.h> /* NULL */ 3496#include <xfs/xfs.h> 3497int main(void) 3498{ 3499 xfsctl(NULL, 0, 0, NULL); 3500 return 0; 3501} 3502EOF 3503 if compile_prog "" "" ; then 3504 xfs="yes" 3505 else 3506 if test "$xfs" = "yes" ; then 3507 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 3508 fi 3509 xfs=no 3510 fi 3511fi 3512 3513########################################## 3514# vde libraries probe 3515if test "$vde" != "no" ; then 3516 vde_libs="-lvdeplug" 3517 cat > $TMPC << EOF 3518#include <libvdeplug.h> 3519int main(void) 3520{ 3521 struct vde_open_args a = {0, 0, 0}; 3522 char s[] = ""; 3523 vde_open(s, s, &a); 3524 return 0; 3525} 3526EOF 3527 if compile_prog "" "$vde_libs" ; then 3528 vde=yes 3529 else 3530 if test "$vde" = "yes" ; then 3531 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3532 fi 3533 vde=no 3534 fi 3535fi 3536 3537########################################## 3538# netmap support probe 3539# Apart from looking for netmap headers, we make sure that the host API version 3540# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 3541# a minor/major version number. Minor new features will be marked with values up 3542# to 15, and if something happens that requires a change to the backend we will 3543# move above 15, submit the backend fixes and modify this two bounds. 3544if test "$netmap" != "no" ; then 3545 cat > $TMPC << EOF 3546#include <inttypes.h> 3547#include <net/if.h> 3548#include <net/netmap.h> 3549#include <net/netmap_user.h> 3550#if (NETMAP_API < 11) || (NETMAP_API > 15) 3551#error 3552#endif 3553int main(void) { return 0; } 3554EOF 3555 if compile_prog "" "" ; then 3556 netmap=yes 3557 else 3558 if test "$netmap" = "yes" ; then 3559 feature_not_found "netmap" 3560 fi 3561 netmap=no 3562 fi 3563fi 3564 3565########################################## 3566# libcap-ng library probe 3567if test "$cap_ng" != "no" ; then 3568 cap_libs="-lcap-ng" 3569 cat > $TMPC << EOF 3570#include <cap-ng.h> 3571int main(void) 3572{ 3573 capng_capability_to_name(CAPNG_EFFECTIVE); 3574 return 0; 3575} 3576EOF 3577 if compile_prog "" "$cap_libs" ; then 3578 cap_ng=yes 3579 libs_tools="$cap_libs $libs_tools" 3580 else 3581 if test "$cap_ng" = "yes" ; then 3582 feature_not_found "cap_ng" "Install libcap-ng devel" 3583 fi 3584 cap_ng=no 3585 fi 3586fi 3587 3588########################################## 3589# Sound support libraries probe 3590 3591audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3592for drv in $audio_drv_list; do 3593 case $drv in 3594 alsa | try-alsa) 3595 if $pkg_config alsa --exists; then 3596 alsa_libs=$($pkg_config alsa --libs) 3597 if test "$drv" = "try-alsa"; then 3598 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') 3599 fi 3600 else 3601 if test "$drv" = "try-alsa"; then 3602 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') 3603 else 3604 error_exit "$drv check failed" \ 3605 "Make sure to have the $drv libs and headers installed." 3606 fi 3607 fi 3608 ;; 3609 3610 pa | try-pa) 3611 if $pkg_config libpulse --exists; then 3612 pulse_libs=$($pkg_config libpulse --libs) 3613 if test "$drv" = "try-pa"; then 3614 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') 3615 fi 3616 else 3617 if test "$drv" = "try-pa"; then 3618 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') 3619 else 3620 error_exit "$drv check failed" \ 3621 "Make sure to have the $drv libs and headers installed." 3622 fi 3623 fi 3624 ;; 3625 3626 sdl) 3627 if test "$sdl" = "no"; then 3628 error_exit "sdl not found or disabled, can not use sdl audio driver" 3629 fi 3630 ;; 3631 3632 try-sdl) 3633 if test "$sdl" = "no"; then 3634 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') 3635 else 3636 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') 3637 fi 3638 ;; 3639 3640 coreaudio) 3641 coreaudio_libs="-framework CoreAudio" 3642 ;; 3643 3644 dsound) 3645 dsound_libs="-lole32 -ldxguid" 3646 audio_win_int="yes" 3647 ;; 3648 3649 oss) 3650 oss_libs="$oss_lib" 3651 ;; 3652 3653 jack | try-jack) 3654 if $pkg_config jack --exists; then 3655 jack_libs=$($pkg_config jack --libs) 3656 if test "$drv" = "try-jack"; then 3657 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') 3658 fi 3659 else 3660 if test "$drv" = "try-jack"; then 3661 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') 3662 else 3663 error_exit "$drv check failed" \ 3664 "Make sure to have the $drv libs and headers installed." 3665 fi 3666 fi 3667 ;; 3668 3669 *) 3670 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 3671 error_exit "Unknown driver '$drv' selected" \ 3672 "Possible drivers are: $audio_possible_drivers" 3673 } 3674 ;; 3675 esac 3676done 3677 3678########################################## 3679# BrlAPI probe 3680 3681if test "$brlapi" != "no" ; then 3682 brlapi_libs="-lbrlapi" 3683 cat > $TMPC << EOF 3684#include <brlapi.h> 3685#include <stddef.h> 3686int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 3687EOF 3688 if compile_prog "" "$brlapi_libs" ; then 3689 brlapi=yes 3690 else 3691 if test "$brlapi" = "yes" ; then 3692 feature_not_found "brlapi" "Install brlapi devel" 3693 fi 3694 brlapi=no 3695 fi 3696fi 3697 3698########################################## 3699# iconv probe 3700if test "$iconv" != "no" ; then 3701 cat > $TMPC << EOF 3702#include <iconv.h> 3703int main(void) { 3704 iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); 3705 return conv != (iconv_t) -1; 3706} 3707EOF 3708 iconv_prefix_list="/usr/local:/usr" 3709 iconv_lib_list=":-liconv" 3710 IFS=: 3711 for iconv_prefix in $iconv_prefix_list; do 3712 IFS=: 3713 iconv_cflags="-I$iconv_prefix/include" 3714 iconv_ldflags="-L$iconv_prefix/lib" 3715 for iconv_link in $iconv_lib_list; do 3716 unset IFS 3717 iconv_lib="$iconv_ldflags $iconv_link" 3718 echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log 3719 if compile_prog "$iconv_cflags" "$iconv_lib" ; then 3720 iconv_found=yes 3721 break 3722 fi 3723 done 3724 if test "$iconv_found" = yes ; then 3725 break 3726 fi 3727 done 3728 if test "$iconv_found" = "yes" ; then 3729 iconv=yes 3730 else 3731 if test "$iconv" = "yes" ; then 3732 feature_not_found "iconv" "Install iconv devel" 3733 fi 3734 iconv=no 3735 fi 3736fi 3737 3738########################################## 3739# curses probe 3740if test "$iconv" = "no" ; then 3741 # curses will need iconv 3742 curses=no 3743fi 3744if test "$curses" != "no" ; then 3745 if test "$mingw32" = "yes" ; then 3746 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 3747 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3748 else 3749 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 3750 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3751 fi 3752 curses_found=no 3753 cat > $TMPC << EOF 3754#include <locale.h> 3755#include <curses.h> 3756#include <wchar.h> 3757#include <langinfo.h> 3758int main(void) { 3759 const char *codeset; 3760 wchar_t wch = L'w'; 3761 setlocale(LC_ALL, ""); 3762 resize_term(0, 0); 3763 addwstr(L"wide chars\n"); 3764 addnwstr(&wch, 1); 3765 add_wch(WACS_DEGREE); 3766 codeset = nl_langinfo(CODESET); 3767 return codeset != 0; 3768} 3769EOF 3770 IFS=: 3771 for curses_inc in $curses_inc_list; do 3772 # Make sure we get the wide character prototypes 3773 curses_inc="-DNCURSES_WIDECHAR $curses_inc" 3774 IFS=: 3775 for curses_lib in $curses_lib_list; do 3776 unset IFS 3777 if compile_prog "$curses_inc" "$curses_lib" ; then 3778 curses_found=yes 3779 break 3780 fi 3781 done 3782 if test "$curses_found" = yes ; then 3783 break 3784 fi 3785 done 3786 unset IFS 3787 if test "$curses_found" = "yes" ; then 3788 curses=yes 3789 else 3790 if test "$curses" = "yes" ; then 3791 feature_not_found "curses" "Install ncurses devel" 3792 fi 3793 curses=no 3794 fi 3795fi 3796 3797########################################## 3798# curl probe 3799if test "$curl" != "no" ; then 3800 if $pkg_config libcurl --exists; then 3801 curlconfig="$pkg_config libcurl" 3802 else 3803 curlconfig=curl-config 3804 fi 3805 cat > $TMPC << EOF 3806#include <curl/curl.h> 3807int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3808EOF 3809 curl_cflags=$($curlconfig --cflags 2>/dev/null) 3810 curl_libs=$($curlconfig --libs 2>/dev/null) 3811 if compile_prog "$curl_cflags" "$curl_libs" ; then 3812 curl=yes 3813 else 3814 if test "$curl" = "yes" ; then 3815 feature_not_found "curl" "Install libcurl devel" 3816 fi 3817 curl=no 3818 fi 3819fi # test "$curl" 3820 3821########################################## 3822# glib support probe 3823 3824glib_req_ver=2.48 3825glib_modules=gthread-2.0 3826if test "$modules" = yes; then 3827 glib_modules="$glib_modules gmodule-export-2.0" 3828fi 3829if test "$plugins" = yes; then 3830 glib_modules="$glib_modules gmodule-2.0" 3831fi 3832 3833# This workaround is required due to a bug in pkg-config file for glib as it 3834# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 3835 3836if test "$static" = yes && test "$mingw32" = yes; then 3837 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" 3838fi 3839 3840for i in $glib_modules; do 3841 if $pkg_config --atleast-version=$glib_req_ver $i; then 3842 glib_cflags=$($pkg_config --cflags $i) 3843 glib_libs=$($pkg_config --libs $i) 3844 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" 3845 LIBS="$glib_libs $LIBS" 3846 libs_qga="$glib_libs $libs_qga" 3847 else 3848 error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3849 fi 3850done 3851 3852if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 3853 gio=yes 3854 gio_cflags=$($pkg_config --cflags gio-2.0) 3855 gio_libs=$($pkg_config --libs gio-2.0) 3856 gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 3857 if [ ! -x "$gdbus_codegen" ]; then 3858 gdbus_codegen= 3859 fi 3860else 3861 gio=no 3862fi 3863 3864if $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 3865 gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 3866 gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 3867fi 3868 3869# Sanity check that the current size_t matches the 3870# size that glib thinks it should be. This catches 3871# problems on multi-arch where people try to build 3872# 32-bit QEMU while pointing at 64-bit glib headers 3873cat > $TMPC <<EOF 3874#include <glib.h> 3875#include <unistd.h> 3876 3877#define QEMU_BUILD_BUG_ON(x) \ 3878 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3879 3880int main(void) { 3881 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3882 return 0; 3883} 3884EOF 3885 3886if ! compile_prog "$CFLAGS" "$LIBS" ; then 3887 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3888 "You probably need to set PKG_CONFIG_LIBDIR"\ 3889 "to point to the right pkg-config files for your"\ 3890 "build target" 3891fi 3892 3893# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3894cat > $TMPC << EOF 3895#include <glib.h> 3896int main(void) { return 0; } 3897EOF 3898if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3899 if cc_has_warning_flag "-Wno-unknown-attributes"; then 3900 glib_cflags="-Wno-unknown-attributes $glib_cflags" 3901 CFLAGS="-Wno-unknown-attributes $CFLAGS" 3902 fi 3903fi 3904 3905# Silence clang warnings triggered by glib < 2.57.2 3906cat > $TMPC << EOF 3907#include <glib.h> 3908typedef struct Foo { 3909 int i; 3910} Foo; 3911static void foo_free(Foo *f) 3912{ 3913 g_free(f); 3914} 3915G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 3916int main(void) { return 0; } 3917EOF 3918if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3919 if cc_has_warning_flag "-Wno-unused-function"; then 3920 glib_cflags="$glib_cflags -Wno-unused-function" 3921 CFLAGS="$CFLAGS -Wno-unused-function" 3922 fi 3923fi 3924 3925######################################### 3926# zlib check 3927 3928if test "$zlib" != "no" ; then 3929 if $pkg_config --exists zlib; then 3930 zlib_cflags=$($pkg_config --cflags zlib) 3931 zlib_libs=$($pkg_config --libs zlib) 3932 QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" 3933 LIBS="$zlib_libs $LIBS" 3934 else 3935 cat > $TMPC << EOF 3936#include <zlib.h> 3937int main(void) { zlibVersion(); return 0; } 3938EOF 3939 if compile_prog "" "-lz" ; then 3940 LIBS="$LIBS -lz" 3941 else 3942 error_exit "zlib check failed" \ 3943 "Make sure to have the zlib libs and headers installed." 3944 fi 3945 fi 3946fi 3947 3948########################################## 3949# SHA command probe for modules 3950if test "$modules" = yes; then 3951 shacmd_probe="sha1sum sha1 shasum" 3952 for c in $shacmd_probe; do 3953 if has $c; then 3954 shacmd="$c" 3955 break 3956 fi 3957 done 3958 if test "$shacmd" = ""; then 3959 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3960 fi 3961fi 3962 3963########################################## 3964# pixman support probe 3965 3966if test "$want_tools" = "no" && test "$softmmu" = "no"; then 3967 pixman_cflags= 3968 pixman_libs= 3969elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then 3970 pixman_cflags=$($pkg_config --cflags pixman-1) 3971 pixman_libs=$($pkg_config --libs pixman-1) 3972else 3973 error_exit "pixman >= 0.21.8 not present." \ 3974 "Please install the pixman devel package." 3975fi 3976 3977########################################## 3978# libmpathpersist probe 3979 3980if test "$mpath" != "no" ; then 3981 # probe for the new API 3982 cat > $TMPC <<EOF 3983#include <libudev.h> 3984#include <mpath_persist.h> 3985unsigned mpath_mx_alloc_len = 1024; 3986int logsink; 3987static struct config *multipath_conf; 3988extern struct udev *udev; 3989extern struct config *get_multipath_config(void); 3990extern void put_multipath_config(struct config *conf); 3991struct udev *udev; 3992struct config *get_multipath_config(void) { return multipath_conf; } 3993void put_multipath_config(struct config *conf) { } 3994 3995int main(void) { 3996 udev = udev_new(); 3997 multipath_conf = mpath_lib_init(); 3998 return 0; 3999} 4000EOF 4001 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 4002 mpathpersist=yes 4003 mpathpersist_new_api=yes 4004 else 4005 # probe for the old API 4006 cat > $TMPC <<EOF 4007#include <libudev.h> 4008#include <mpath_persist.h> 4009unsigned mpath_mx_alloc_len = 1024; 4010int logsink; 4011int main(void) { 4012 struct udev *udev = udev_new(); 4013 mpath_lib_init(udev); 4014 return 0; 4015} 4016EOF 4017 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 4018 mpathpersist=yes 4019 mpathpersist_new_api=no 4020 else 4021 mpathpersist=no 4022 fi 4023 fi 4024else 4025 mpathpersist=no 4026fi 4027 4028########################################## 4029# pthread probe 4030PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 4031 4032pthread=no 4033cat > $TMPC << EOF 4034#include <pthread.h> 4035static void *f(void *p) { return NULL; } 4036int main(void) { 4037 pthread_t thread; 4038 pthread_create(&thread, 0, f, 0); 4039 return 0; 4040} 4041EOF 4042if compile_prog "" "" ; then 4043 pthread=yes 4044else 4045 for pthread_lib in $PTHREADLIBS_LIST; do 4046 if compile_prog "" "$pthread_lib" ; then 4047 pthread=yes 4048 found=no 4049 for lib_entry in $LIBS; do 4050 if test "$lib_entry" = "$pthread_lib"; then 4051 found=yes 4052 break 4053 fi 4054 done 4055 if test "$found" = "no"; then 4056 LIBS="$pthread_lib $LIBS" 4057 libs_qga="$pthread_lib $libs_qga" 4058 fi 4059 PTHREAD_LIB="$pthread_lib" 4060 break 4061 fi 4062 done 4063fi 4064 4065if test "$mingw32" != yes && test "$pthread" = no; then 4066 error_exit "pthread check failed" \ 4067 "Make sure to have the pthread libs and headers installed." 4068fi 4069 4070# check for pthread_setname_np with thread id 4071pthread_setname_np_w_tid=no 4072cat > $TMPC << EOF 4073#include <pthread.h> 4074 4075static void *f(void *p) { return NULL; } 4076int main(void) 4077{ 4078 pthread_t thread; 4079 pthread_create(&thread, 0, f, 0); 4080 pthread_setname_np(thread, "QEMU"); 4081 return 0; 4082} 4083EOF 4084if compile_prog "" "$pthread_lib" ; then 4085 pthread_setname_np_w_tid=yes 4086fi 4087 4088# check for pthread_setname_np without thread id 4089pthread_setname_np_wo_tid=no 4090cat > $TMPC << EOF 4091#include <pthread.h> 4092 4093static void *f(void *p) { pthread_setname_np("QEMU"); } 4094int main(void) 4095{ 4096 pthread_t thread; 4097 pthread_create(&thread, 0, f, 0); 4098 return 0; 4099} 4100EOF 4101if compile_prog "" "$pthread_lib" ; then 4102 pthread_setname_np_wo_tid=yes 4103fi 4104 4105########################################## 4106# rbd probe 4107if test "$rbd" != "no" ; then 4108 cat > $TMPC <<EOF 4109#include <stdio.h> 4110#include <rbd/librbd.h> 4111int main(void) { 4112 rados_t cluster; 4113 rados_create(&cluster, NULL); 4114 return 0; 4115} 4116EOF 4117 rbd_libs="-lrbd -lrados" 4118 if compile_prog "" "$rbd_libs" ; then 4119 rbd=yes 4120 else 4121 if test "$rbd" = "yes" ; then 4122 feature_not_found "rados block device" "Install librbd/ceph devel" 4123 fi 4124 rbd=no 4125 fi 4126fi 4127 4128########################################## 4129# libssh probe 4130if test "$libssh" != "no" ; then 4131 if $pkg_config --exists libssh; then 4132 libssh_cflags=$($pkg_config libssh --cflags) 4133 libssh_libs=$($pkg_config libssh --libs) 4134 libssh=yes 4135 else 4136 if test "$libssh" = "yes" ; then 4137 error_exit "libssh required for --enable-libssh" 4138 fi 4139 libssh=no 4140 fi 4141fi 4142 4143########################################## 4144# Check for libssh 0.8 4145# This is done like this instead of using the LIBSSH_VERSION_* and 4146# SSH_VERSION_* macros because some distributions in the past shipped 4147# snapshots of the future 0.8 from Git, and those snapshots did not 4148# have updated version numbers (still referring to 0.7.0). 4149 4150if test "$libssh" = "yes"; then 4151 cat > $TMPC <<EOF 4152#include <libssh/libssh.h> 4153int main(void) { return ssh_get_server_publickey(NULL, NULL); } 4154EOF 4155 if compile_prog "$libssh_cflags" "$libssh_libs"; then 4156 libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" 4157 fi 4158fi 4159 4160########################################## 4161# linux-aio probe 4162 4163if test "$linux_aio" != "no" ; then 4164 cat > $TMPC <<EOF 4165#include <libaio.h> 4166#include <sys/eventfd.h> 4167#include <stddef.h> 4168int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 4169EOF 4170 if compile_prog "" "-laio" ; then 4171 linux_aio=yes 4172 else 4173 if test "$linux_aio" = "yes" ; then 4174 feature_not_found "linux AIO" "Install libaio devel" 4175 fi 4176 linux_aio=no 4177 fi 4178fi 4179########################################## 4180# linux-io-uring probe 4181 4182if test "$linux_io_uring" != "no" ; then 4183 if $pkg_config liburing; then 4184 linux_io_uring_cflags=$($pkg_config --cflags liburing) 4185 linux_io_uring_libs=$($pkg_config --libs liburing) 4186 linux_io_uring=yes 4187 4188 # io_uring is used in libqemuutil.a where per-file -libs variables are not 4189 # seen by programs linking the archive. It's not ideal, but just add the 4190 # library dependency globally. 4191 LIBS="$linux_io_uring_libs $LIBS" 4192 else 4193 if test "$linux_io_uring" = "yes" ; then 4194 feature_not_found "linux io_uring" "Install liburing devel" 4195 fi 4196 linux_io_uring=no 4197 fi 4198fi 4199 4200########################################## 4201# TPM emulation is only on POSIX 4202 4203if test "$tpm" = ""; then 4204 if test "$mingw32" = "yes"; then 4205 tpm=no 4206 else 4207 tpm=yes 4208 fi 4209elif test "$tpm" = "yes"; then 4210 if test "$mingw32" = "yes" ; then 4211 error_exit "TPM emulation only available on POSIX systems" 4212 fi 4213fi 4214 4215########################################## 4216# attr probe 4217 4218if test "$attr" != "no" ; then 4219 cat > $TMPC <<EOF 4220#include <stdio.h> 4221#include <sys/types.h> 4222#ifdef CONFIG_LIBATTR 4223#include <attr/xattr.h> 4224#else 4225#include <sys/xattr.h> 4226#endif 4227int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 4228EOF 4229 if compile_prog "" "" ; then 4230 attr=yes 4231 # Older distros have <attr/xattr.h>, and need -lattr: 4232 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 4233 attr=yes 4234 LIBS="-lattr $LIBS" 4235 libattr=yes 4236 else 4237 if test "$attr" = "yes" ; then 4238 feature_not_found "ATTR" "Install libc6 or libattr devel" 4239 fi 4240 attr=no 4241 fi 4242fi 4243 4244########################################## 4245# iovec probe 4246cat > $TMPC <<EOF 4247#include <sys/types.h> 4248#include <sys/uio.h> 4249#include <unistd.h> 4250int main(void) { return sizeof(struct iovec); } 4251EOF 4252iovec=no 4253if compile_prog "" "" ; then 4254 iovec=yes 4255fi 4256 4257########################################## 4258# preadv probe 4259cat > $TMPC <<EOF 4260#include <sys/types.h> 4261#include <sys/uio.h> 4262#include <unistd.h> 4263int main(void) { return preadv(0, 0, 0, 0); } 4264EOF 4265preadv=no 4266if compile_prog "" "" ; then 4267 preadv=yes 4268fi 4269 4270########################################## 4271# fdt probe 4272# fdt support is mandatory for at least some target architectures, 4273# so insist on it if we're building those system emulators. 4274fdt_required=no 4275for target in $target_list; do 4276 case $target in 4277 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu) 4278 fdt_required=yes 4279 ;; 4280 esac 4281done 4282 4283if test "$fdt_required" = "yes"; then 4284 if test "$fdt" = "no"; then 4285 error_exit "fdt disabled but some requested targets require it." \ 4286 "You can turn off fdt only if you also disable all the system emulation" \ 4287 "targets which need it (by specifying a cut down --target-list)." 4288 fi 4289 fdt=yes 4290elif test "$fdt" != "yes" ; then 4291 fdt=no 4292fi 4293 4294# fdt is only required when building softmmu targets 4295if test -z "$fdt" -a "$softmmu" != "yes" ; then 4296 fdt="no" 4297fi 4298 4299if test "$fdt" != "no" ; then 4300 fdt_libs="-lfdt" 4301 # explicitly check for libfdt_env.h as it is missing in some stable installs 4302 # and test for required functions to make sure we are on a version >= 1.4.2 4303 cat > $TMPC << EOF 4304#include <libfdt.h> 4305#include <libfdt_env.h> 4306int main(void) { fdt_check_full(NULL, 0); return 0; } 4307EOF 4308 if compile_prog "" "$fdt_libs" ; then 4309 # system DTC is good - use it 4310 fdt=system 4311 else 4312 # have GIT checkout, so activate dtc submodule 4313 if test -e "${source_path}/.git" ; then 4314 git_submodules="${git_submodules} dtc" 4315 fi 4316 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then 4317 fdt=git 4318 mkdir -p dtc 4319 if [ "$pwd_is_source_path" != "y" ] ; then 4320 symlink "$source_path/dtc/Makefile" "dtc/Makefile" 4321 fi 4322 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 4323 fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" 4324 fdt_libs="$fdt_libs" 4325 elif test "$fdt" = "yes" ; then 4326 # Not a git build & no libfdt found, prompt for system install 4327 error_exit "DTC (libfdt) version >= 1.4.2 not present." \ 4328 "Please install the DTC (libfdt) devel package" 4329 else 4330 # don't have and don't want 4331 fdt_libs= 4332 fdt=no 4333 fi 4334 fi 4335fi 4336 4337libs_softmmu="$libs_softmmu $fdt_libs" 4338 4339########################################## 4340# opengl probe (for sdl2, gtk, milkymist-tmu2) 4341 4342gbm="no" 4343if $pkg_config gbm; then 4344 gbm_cflags="$($pkg_config --cflags gbm)" 4345 gbm_libs="$($pkg_config --libs gbm)" 4346 gbm="yes" 4347fi 4348 4349if test "$opengl" != "no" ; then 4350 opengl_pkgs="epoxy gbm" 4351 if $pkg_config $opengl_pkgs; then 4352 opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 4353 opengl_libs="$($pkg_config --libs $opengl_pkgs)" 4354 opengl=yes 4355 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 4356 gtk_gl="yes" 4357 fi 4358 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" 4359 else 4360 if test "$opengl" = "yes" ; then 4361 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 4362 fi 4363 opengl_cflags="" 4364 opengl_libs="" 4365 opengl=no 4366 fi 4367fi 4368 4369if test "$opengl" = "yes"; then 4370 cat > $TMPC << EOF 4371#include <epoxy/egl.h> 4372#ifndef EGL_MESA_image_dma_buf_export 4373# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 4374#endif 4375int main(void) { return 0; } 4376EOF 4377 if compile_prog "" "" ; then 4378 opengl_dmabuf=yes 4379 fi 4380fi 4381 4382if test "$opengl" = "yes" && test "$have_x11" = "yes"; then 4383 for target in $target_list; do 4384 case $target in 4385 lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL 4386 need_x11=yes 4387 ;; 4388 esac 4389 done 4390fi 4391 4392########################################## 4393# libxml2 probe 4394if test "$libxml2" != "no" ; then 4395 if $pkg_config --exists libxml-2.0; then 4396 libxml2="yes" 4397 libxml2_cflags=$($pkg_config --cflags libxml-2.0) 4398 libxml2_libs=$($pkg_config --libs libxml-2.0) 4399 else 4400 if test "$libxml2" = "yes"; then 4401 feature_not_found "libxml2" "Install libxml2 devel" 4402 fi 4403 libxml2="no" 4404 fi 4405fi 4406 4407########################################## 4408# glusterfs probe 4409if test "$glusterfs" != "no" ; then 4410 if $pkg_config --atleast-version=3 glusterfs-api; then 4411 glusterfs="yes" 4412 glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 4413 glusterfs_libs=$($pkg_config --libs glusterfs-api) 4414 if $pkg_config --atleast-version=4 glusterfs-api; then 4415 glusterfs_xlator_opt="yes" 4416 fi 4417 if $pkg_config --atleast-version=5 glusterfs-api; then 4418 glusterfs_discard="yes" 4419 fi 4420 if $pkg_config --atleast-version=6 glusterfs-api; then 4421 glusterfs_fallocate="yes" 4422 glusterfs_zerofill="yes" 4423 fi 4424 cat > $TMPC << EOF 4425#include <glusterfs/api/glfs.h> 4426 4427int 4428main(void) 4429{ 4430 /* new glfs_ftruncate() passes two additional args */ 4431 return glfs_ftruncate(NULL, 0, NULL, NULL); 4432} 4433EOF 4434 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 4435 glusterfs_ftruncate_has_stat="yes" 4436 fi 4437 cat > $TMPC << EOF 4438#include <glusterfs/api/glfs.h> 4439 4440/* new glfs_io_cbk() passes two additional glfs_stat structs */ 4441static void 4442glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) 4443{} 4444 4445int 4446main(void) 4447{ 4448 glfs_io_cbk iocb = &glusterfs_iocb; 4449 iocb(NULL, 0 , NULL, NULL, NULL); 4450 return 0; 4451} 4452EOF 4453 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 4454 glusterfs_iocb_has_stat="yes" 4455 fi 4456 else 4457 if test "$glusterfs" = "yes" ; then 4458 feature_not_found "GlusterFS backend support" \ 4459 "Install glusterfs-api devel >= 3" 4460 fi 4461 glusterfs="no" 4462 fi 4463fi 4464 4465# Check for inotify functions when we are building linux-user 4466# emulator. This is done because older glibc versions don't 4467# have syscall stubs for these implemented. In that case we 4468# don't provide them even if kernel supports them. 4469# 4470inotify=no 4471cat > $TMPC << EOF 4472#include <sys/inotify.h> 4473 4474int 4475main(void) 4476{ 4477 /* try to start inotify */ 4478 return inotify_init(); 4479} 4480EOF 4481if compile_prog "" "" ; then 4482 inotify=yes 4483fi 4484 4485inotify1=no 4486cat > $TMPC << EOF 4487#include <sys/inotify.h> 4488 4489int 4490main(void) 4491{ 4492 /* try to start inotify */ 4493 return inotify_init1(0); 4494} 4495EOF 4496if compile_prog "" "" ; then 4497 inotify1=yes 4498fi 4499 4500# check if pipe2 is there 4501pipe2=no 4502cat > $TMPC << EOF 4503#include <unistd.h> 4504#include <fcntl.h> 4505 4506int main(void) 4507{ 4508 int pipefd[2]; 4509 return pipe2(pipefd, O_CLOEXEC); 4510} 4511EOF 4512if compile_prog "" "" ; then 4513 pipe2=yes 4514fi 4515 4516# check if accept4 is there 4517accept4=no 4518cat > $TMPC << EOF 4519#include <sys/socket.h> 4520#include <stddef.h> 4521 4522int main(void) 4523{ 4524 accept4(0, NULL, NULL, SOCK_CLOEXEC); 4525 return 0; 4526} 4527EOF 4528if compile_prog "" "" ; then 4529 accept4=yes 4530fi 4531 4532# check if tee/splice is there. vmsplice was added same time. 4533splice=no 4534cat > $TMPC << EOF 4535#include <unistd.h> 4536#include <fcntl.h> 4537#include <limits.h> 4538 4539int main(void) 4540{ 4541 int len, fd = 0; 4542 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 4543 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 4544 return 0; 4545} 4546EOF 4547if compile_prog "" "" ; then 4548 splice=yes 4549fi 4550 4551########################################## 4552# libnuma probe 4553 4554if test "$numa" != "no" ; then 4555 cat > $TMPC << EOF 4556#include <numa.h> 4557int main(void) { return numa_available(); } 4558EOF 4559 4560 if compile_prog "" "-lnuma" ; then 4561 numa=yes 4562 libs_softmmu="-lnuma $libs_softmmu" 4563 else 4564 if test "$numa" = "yes" ; then 4565 feature_not_found "numa" "install numactl devel" 4566 fi 4567 numa=no 4568 fi 4569fi 4570 4571if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 4572 echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 4573 exit 1 4574fi 4575 4576# Even if malloc_trim() is available, these non-libc memory allocators 4577# do not support it. 4578if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then 4579 if test "$malloc_trim" = "yes" ; then 4580 echo "Disabling malloc_trim with non-libc memory allocator" 4581 fi 4582 malloc_trim="no" 4583fi 4584 4585####################################### 4586# malloc_trim 4587 4588if test "$malloc_trim" != "no" ; then 4589 cat > $TMPC << EOF 4590#include <malloc.h> 4591int main(void) { malloc_trim(0); return 0; } 4592EOF 4593 if compile_prog "" "" ; then 4594 malloc_trim="yes" 4595 else 4596 malloc_trim="no" 4597 fi 4598fi 4599 4600########################################## 4601# tcmalloc probe 4602 4603if test "$tcmalloc" = "yes" ; then 4604 cat > $TMPC << EOF 4605#include <stdlib.h> 4606int main(void) { 4607 void *tmp = malloc(1); 4608 if (tmp != NULL) { 4609 return 0; 4610 } 4611 return 1; 4612} 4613EOF 4614 4615 if compile_prog "" "-ltcmalloc" ; then 4616 LIBS="-ltcmalloc $LIBS" 4617 else 4618 feature_not_found "tcmalloc" "install gperftools devel" 4619 fi 4620fi 4621 4622########################################## 4623# jemalloc probe 4624 4625if test "$jemalloc" = "yes" ; then 4626 cat > $TMPC << EOF 4627#include <stdlib.h> 4628int main(void) { 4629 void *tmp = malloc(1); 4630 if (tmp != NULL) { 4631 return 0; 4632 } 4633 return 1; 4634} 4635EOF 4636 4637 if compile_prog "" "-ljemalloc" ; then 4638 LIBS="-ljemalloc $LIBS" 4639 else 4640 feature_not_found "jemalloc" "install jemalloc devel" 4641 fi 4642fi 4643 4644########################################## 4645# signalfd probe 4646signalfd="no" 4647cat > $TMPC << EOF 4648#include <unistd.h> 4649#include <sys/syscall.h> 4650#include <signal.h> 4651int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4652EOF 4653 4654if compile_prog "" "" ; then 4655 signalfd=yes 4656fi 4657 4658# check if optreset global is declared by <getopt.h> 4659optreset="no" 4660cat > $TMPC << EOF 4661#include <getopt.h> 4662int main(void) { return optreset; } 4663EOF 4664 4665if compile_prog "" "" ; then 4666 optreset=yes 4667fi 4668 4669# check if eventfd is supported 4670eventfd=no 4671cat > $TMPC << EOF 4672#include <sys/eventfd.h> 4673 4674int main(void) 4675{ 4676 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4677} 4678EOF 4679if compile_prog "" "" ; then 4680 eventfd=yes 4681fi 4682 4683# check if memfd is supported 4684memfd=no 4685cat > $TMPC << EOF 4686#include <sys/mman.h> 4687 4688int main(void) 4689{ 4690 return memfd_create("foo", MFD_ALLOW_SEALING); 4691} 4692EOF 4693if compile_prog "" "" ; then 4694 memfd=yes 4695fi 4696 4697# check for usbfs 4698have_usbfs=no 4699if test "$linux_user" = "yes"; then 4700 cat > $TMPC << EOF 4701#include <linux/usbdevice_fs.h> 4702 4703#ifndef USBDEVFS_GET_CAPABILITIES 4704#error "USBDEVFS_GET_CAPABILITIES undefined" 4705#endif 4706 4707#ifndef USBDEVFS_DISCONNECT_CLAIM 4708#error "USBDEVFS_DISCONNECT_CLAIM undefined" 4709#endif 4710 4711int main(void) 4712{ 4713 return 0; 4714} 4715EOF 4716 if compile_prog "" ""; then 4717 have_usbfs=yes 4718 fi 4719fi 4720 4721# check for fallocate 4722fallocate=no 4723cat > $TMPC << EOF 4724#include <fcntl.h> 4725 4726int main(void) 4727{ 4728 fallocate(0, 0, 0, 0); 4729 return 0; 4730} 4731EOF 4732if compile_prog "" "" ; then 4733 fallocate=yes 4734fi 4735 4736# check for fallocate hole punching 4737fallocate_punch_hole=no 4738cat > $TMPC << EOF 4739#include <fcntl.h> 4740#include <linux/falloc.h> 4741 4742int main(void) 4743{ 4744 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 4745 return 0; 4746} 4747EOF 4748if compile_prog "" "" ; then 4749 fallocate_punch_hole=yes 4750fi 4751 4752# check that fallocate supports range zeroing inside the file 4753fallocate_zero_range=no 4754cat > $TMPC << EOF 4755#include <fcntl.h> 4756#include <linux/falloc.h> 4757 4758int main(void) 4759{ 4760 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4761 return 0; 4762} 4763EOF 4764if compile_prog "" "" ; then 4765 fallocate_zero_range=yes 4766fi 4767 4768# check for posix_fallocate 4769posix_fallocate=no 4770cat > $TMPC << EOF 4771#include <fcntl.h> 4772 4773int main(void) 4774{ 4775 posix_fallocate(0, 0, 0); 4776 return 0; 4777} 4778EOF 4779if compile_prog "" "" ; then 4780 posix_fallocate=yes 4781fi 4782 4783# check for sync_file_range 4784sync_file_range=no 4785cat > $TMPC << EOF 4786#include <fcntl.h> 4787 4788int main(void) 4789{ 4790 sync_file_range(0, 0, 0, 0); 4791 return 0; 4792} 4793EOF 4794if compile_prog "" "" ; then 4795 sync_file_range=yes 4796fi 4797 4798# check for linux/fiemap.h and FS_IOC_FIEMAP 4799fiemap=no 4800cat > $TMPC << EOF 4801#include <sys/ioctl.h> 4802#include <linux/fs.h> 4803#include <linux/fiemap.h> 4804 4805int main(void) 4806{ 4807 ioctl(0, FS_IOC_FIEMAP, 0); 4808 return 0; 4809} 4810EOF 4811if compile_prog "" "" ; then 4812 fiemap=yes 4813fi 4814 4815# check for dup3 4816dup3=no 4817cat > $TMPC << EOF 4818#include <unistd.h> 4819 4820int main(void) 4821{ 4822 dup3(0, 0, 0); 4823 return 0; 4824} 4825EOF 4826if compile_prog "" "" ; then 4827 dup3=yes 4828fi 4829 4830# check for ppoll support 4831ppoll=no 4832cat > $TMPC << EOF 4833#include <poll.h> 4834 4835int main(void) 4836{ 4837 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 4838 ppoll(&pfd, 1, 0, 0); 4839 return 0; 4840} 4841EOF 4842if compile_prog "" "" ; then 4843 ppoll=yes 4844fi 4845 4846# check for prctl(PR_SET_TIMERSLACK , ... ) support 4847prctl_pr_set_timerslack=no 4848cat > $TMPC << EOF 4849#include <sys/prctl.h> 4850 4851int main(void) 4852{ 4853 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4854 return 0; 4855} 4856EOF 4857if compile_prog "" "" ; then 4858 prctl_pr_set_timerslack=yes 4859fi 4860 4861# check for epoll support 4862epoll=no 4863cat > $TMPC << EOF 4864#include <sys/epoll.h> 4865 4866int main(void) 4867{ 4868 epoll_create(0); 4869 return 0; 4870} 4871EOF 4872if compile_prog "" "" ; then 4873 epoll=yes 4874fi 4875 4876# epoll_create1 is a later addition 4877# so we must check separately for its presence 4878epoll_create1=no 4879cat > $TMPC << EOF 4880#include <sys/epoll.h> 4881 4882int main(void) 4883{ 4884 /* Note that we use epoll_create1 as a value, not as 4885 * a function being called. This is necessary so that on 4886 * old SPARC glibc versions where the function was present in 4887 * the library but not declared in the header file we will 4888 * fail the configure check. (Otherwise we will get a compiler 4889 * warning but not an error, and will proceed to fail the 4890 * qemu compile where we compile with -Werror.) 4891 */ 4892 return (int)(uintptr_t)&epoll_create1; 4893} 4894EOF 4895if compile_prog "" "" ; then 4896 epoll_create1=yes 4897fi 4898 4899# check for sendfile support 4900sendfile=no 4901cat > $TMPC << EOF 4902#include <sys/sendfile.h> 4903 4904int main(void) 4905{ 4906 return sendfile(0, 0, 0, 0); 4907} 4908EOF 4909if compile_prog "" "" ; then 4910 sendfile=yes 4911fi 4912 4913# check for timerfd support (glibc 2.8 and newer) 4914timerfd=no 4915cat > $TMPC << EOF 4916#include <sys/timerfd.h> 4917 4918int main(void) 4919{ 4920 return(timerfd_create(CLOCK_REALTIME, 0)); 4921} 4922EOF 4923if compile_prog "" "" ; then 4924 timerfd=yes 4925fi 4926 4927# check for setns and unshare support 4928setns=no 4929cat > $TMPC << EOF 4930#include <sched.h> 4931 4932int main(void) 4933{ 4934 int ret; 4935 ret = setns(0, 0); 4936 ret = unshare(0); 4937 return ret; 4938} 4939EOF 4940if compile_prog "" "" ; then 4941 setns=yes 4942fi 4943 4944# clock_adjtime probe 4945clock_adjtime=no 4946cat > $TMPC <<EOF 4947#include <time.h> 4948 4949int main(void) 4950{ 4951 return clock_adjtime(0, 0); 4952} 4953EOF 4954clock_adjtime=no 4955if compile_prog "" "" ; then 4956 clock_adjtime=yes 4957fi 4958 4959# syncfs probe 4960syncfs=no 4961cat > $TMPC <<EOF 4962#include <unistd.h> 4963 4964int main(void) 4965{ 4966 return syncfs(0); 4967} 4968EOF 4969syncfs=no 4970if compile_prog "" "" ; then 4971 syncfs=yes 4972fi 4973 4974# check for kcov support (kernel must be 4.4+, compiled with certain options) 4975kcov=no 4976if check_include sys/kcov.h ; then 4977 kcov=yes 4978fi 4979 4980# If we're making warnings fatal, apply this to Sphinx runs as well 4981sphinx_werror="" 4982if test "$werror" = "yes"; then 4983 sphinx_werror="-W" 4984fi 4985 4986# Check we have a new enough version of sphinx-build 4987has_sphinx_build() { 4988 # This is a bit awkward but works: create a trivial document and 4989 # try to run it with our configuration file (which enforces a 4990 # version requirement). This will fail if either 4991 # sphinx-build doesn't exist at all or if it is too old. 4992 mkdir -p "$TMPDIR1/sphinx" 4993 touch "$TMPDIR1/sphinx/index.rst" 4994 "$sphinx_build" $sphinx_werror -c "$source_path/docs" \ 4995 -b html "$TMPDIR1/sphinx" \ 4996 "$TMPDIR1/sphinx/out" >> config.log 2>&1 4997} 4998 4999# Check if tools are available to build documentation. 5000if test "$docs" != "no" ; then 5001 if has_sphinx_build; then 5002 sphinx_ok=yes 5003 else 5004 sphinx_ok=no 5005 fi 5006 if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then 5007 docs=yes 5008 else 5009 if test "$docs" = "yes" ; then 5010 if has $sphinx_build && test "$sphinx_ok" != "yes"; then 5011 echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 5012 fi 5013 feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a Python 3 version of python-sphinx" 5014 fi 5015 docs=no 5016 fi 5017fi 5018 5019# Search for bswap_32 function 5020byteswap_h=no 5021cat > $TMPC << EOF 5022#include <byteswap.h> 5023int main(void) { return bswap_32(0); } 5024EOF 5025if compile_prog "" "" ; then 5026 byteswap_h=yes 5027fi 5028 5029# Search for bswap32 function 5030bswap_h=no 5031cat > $TMPC << EOF 5032#include <sys/endian.h> 5033#include <sys/types.h> 5034#include <machine/bswap.h> 5035int main(void) { return bswap32(0); } 5036EOF 5037if compile_prog "" "" ; then 5038 bswap_h=yes 5039fi 5040 5041########################################## 5042# Do we have libiscsi >= 1.9.0 5043if test "$libiscsi" != "no" ; then 5044 if $pkg_config --atleast-version=1.9.0 libiscsi; then 5045 libiscsi="yes" 5046 libiscsi_cflags=$($pkg_config --cflags libiscsi) 5047 libiscsi_libs=$($pkg_config --libs libiscsi) 5048 else 5049 if test "$libiscsi" = "yes" ; then 5050 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 5051 fi 5052 libiscsi="no" 5053 fi 5054fi 5055 5056########################################## 5057# Do we need libm 5058cat > $TMPC << EOF 5059#include <math.h> 5060int main(int argc, char **argv) { return isnan(sin((double)argc)); } 5061EOF 5062if compile_prog "" "" ; then 5063 : 5064elif compile_prog "" "-lm" ; then 5065 LIBS="-lm $LIBS" 5066 libs_qga="-lm $libs_qga" 5067else 5068 error_exit "libm check failed" 5069fi 5070 5071########################################## 5072# Do we need librt 5073# uClibc provides 2 versions of clock_gettime(), one with realtime 5074# support and one without. This means that the clock_gettime() don't 5075# need -lrt. We still need it for timer_create() so we check for this 5076# function in addition. 5077cat > $TMPC <<EOF 5078#include <signal.h> 5079#include <time.h> 5080int main(void) { 5081 timer_create(CLOCK_REALTIME, NULL, NULL); 5082 return clock_gettime(CLOCK_REALTIME, NULL); 5083} 5084EOF 5085 5086if compile_prog "" "" ; then 5087 : 5088# we need pthread for static linking. use previous pthread test result 5089elif compile_prog "" "$pthread_lib -lrt" ; then 5090 LIBS="$LIBS -lrt" 5091 libs_qga="$libs_qga -lrt" 5092fi 5093 5094# Check whether we need to link libutil for openpty() 5095cat > $TMPC << EOF 5096extern int openpty(int *am, int *as, char *name, void *termp, void *winp); 5097int main(void) { return openpty(0, 0, 0, 0, 0); } 5098EOF 5099 5100if ! compile_prog "" "" ; then 5101 if compile_prog "" "-lutil" ; then 5102 libs_softmmu="-lutil $libs_softmmu" 5103 libs_tools="-lutil $libs_tools" 5104 fi 5105fi 5106 5107########################################## 5108# spice probe 5109if test "$spice" != "no" ; then 5110 cat > $TMPC << EOF 5111#include <spice.h> 5112int main(void) { spice_server_new(); return 0; } 5113EOF 5114 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 5115 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 5116 if $pkg_config --atleast-version=0.12.5 spice-server && \ 5117 $pkg_config --atleast-version=0.12.3 spice-protocol && \ 5118 compile_prog "$spice_cflags" "$spice_libs" ; then 5119 spice="yes" 5120 libs_softmmu="$libs_softmmu $spice_libs" 5121 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 5122 spice_protocol_version=$($pkg_config --modversion spice-protocol) 5123 spice_server_version=$($pkg_config --modversion spice-server) 5124 else 5125 if test "$spice" = "yes" ; then 5126 feature_not_found "spice" \ 5127 "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" 5128 fi 5129 spice="no" 5130 fi 5131fi 5132 5133# check for smartcard support 5134if test "$smartcard" != "no"; then 5135 if $pkg_config --atleast-version=2.5.1 libcacard; then 5136 libcacard_cflags=$($pkg_config --cflags libcacard) 5137 libcacard_libs=$($pkg_config --libs libcacard) 5138 smartcard="yes" 5139 else 5140 if test "$smartcard" = "yes"; then 5141 feature_not_found "smartcard" "Install libcacard devel" 5142 fi 5143 smartcard="no" 5144 fi 5145fi 5146 5147# check for libusb 5148if test "$libusb" != "no" ; then 5149 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 5150 libusb="yes" 5151 libusb_cflags=$($pkg_config --cflags libusb-1.0) 5152 libusb_libs=$($pkg_config --libs libusb-1.0) 5153 else 5154 if test "$libusb" = "yes"; then 5155 feature_not_found "libusb" "Install libusb devel >= 1.0.13" 5156 fi 5157 libusb="no" 5158 fi 5159fi 5160 5161# check for usbredirparser for usb network redirection support 5162if test "$usb_redir" != "no" ; then 5163 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 5164 usb_redir="yes" 5165 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 5166 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 5167 else 5168 if test "$usb_redir" = "yes"; then 5169 feature_not_found "usb-redir" "Install usbredir devel" 5170 fi 5171 usb_redir="no" 5172 fi 5173fi 5174 5175########################################## 5176# check if we have VSS SDK headers for win 5177 5178if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 5179 test "$vss_win32_sdk" != "no" ; then 5180 case "$vss_win32_sdk" in 5181 "") vss_win32_include="-isystem $source_path" ;; 5182 *\ *) # The SDK is installed in "Program Files" by default, but we cannot 5183 # handle path with spaces. So we symlink the headers into ".sdk/vss". 5184 vss_win32_include="-isystem $source_path/.sdk/vss" 5185 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 5186 ;; 5187 *) vss_win32_include="-isystem $vss_win32_sdk" 5188 esac 5189 cat > $TMPC << EOF 5190#define __MIDL_user_allocate_free_DEFINED__ 5191#include <inc/win2003/vss.h> 5192int main(void) { return VSS_CTX_BACKUP; } 5193EOF 5194 if compile_prog "$vss_win32_include" "" ; then 5195 guest_agent_with_vss="yes" 5196 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 5197 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 5198 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 5199 else 5200 if test "$vss_win32_sdk" != "" ; then 5201 echo "ERROR: Please download and install Microsoft VSS SDK:" 5202 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 5203 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 5204 echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 5205 echo "ERROR: The headers are extracted in the directory \`inc'." 5206 feature_not_found "VSS support" 5207 fi 5208 guest_agent_with_vss="no" 5209 fi 5210fi 5211 5212########################################## 5213# lookup Windows platform SDK (if not specified) 5214# The SDK is needed only to build .tlb (type library) file of guest agent 5215# VSS provider from the source. It is usually unnecessary because the 5216# pre-compiled .tlb file is included. 5217 5218if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 5219 test "$guest_agent_with_vss" = "yes" ; then 5220 if test -z "$win_sdk"; then 5221 programfiles="$PROGRAMFILES" 5222 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 5223 if test -n "$programfiles"; then 5224 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 5225 else 5226 feature_not_found "Windows SDK" 5227 fi 5228 elif test "$win_sdk" = "no"; then 5229 win_sdk="" 5230 fi 5231fi 5232 5233########################################## 5234# check if mingw environment provides a recent ntddscsi.h 5235if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 5236 cat > $TMPC << EOF 5237#include <windows.h> 5238#include <ntddscsi.h> 5239int main(void) { 5240#if !defined(IOCTL_SCSI_GET_ADDRESS) 5241#error Missing required ioctl definitions 5242#endif 5243 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 5244 return addr.Lun; 5245} 5246EOF 5247 if compile_prog "" "" ; then 5248 guest_agent_ntddscsi=yes 5249 libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 5250 fi 5251fi 5252 5253########################################## 5254# virgl renderer probe 5255 5256if test "$virglrenderer" != "no" ; then 5257 cat > $TMPC << EOF 5258#include <virglrenderer.h> 5259int main(void) { virgl_renderer_poll(); return 0; } 5260EOF 5261 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 5262 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 5263 virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 5264 if $pkg_config virglrenderer >/dev/null 2>&1 && \ 5265 compile_prog "$virgl_cflags" "$virgl_libs" ; then 5266 virglrenderer="yes" 5267 else 5268 if test "$virglrenderer" = "yes" ; then 5269 feature_not_found "virglrenderer" 5270 fi 5271 virglrenderer="no" 5272 fi 5273fi 5274 5275########################################## 5276# capstone 5277 5278case "$capstone" in 5279 "" | yes) 5280 if $pkg_config capstone; then 5281 capstone=system 5282 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 5283 capstone=git 5284 elif test -e "${source_path}/capstone/Makefile" ; then 5285 capstone=internal 5286 elif test -z "$capstone" ; then 5287 capstone=no 5288 else 5289 feature_not_found "capstone" "Install capstone devel or git submodule" 5290 fi 5291 ;; 5292 5293 system) 5294 if ! $pkg_config capstone; then 5295 feature_not_found "capstone" "Install capstone devel" 5296 fi 5297 ;; 5298esac 5299 5300case "$capstone" in 5301 git | internal) 5302 if test "$capstone" = git; then 5303 git_submodules="${git_submodules} capstone" 5304 fi 5305 mkdir -p capstone 5306 QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" 5307 if test "$mingw32" = "yes"; then 5308 LIBCAPSTONE=capstone.lib 5309 else 5310 LIBCAPSTONE=libcapstone.a 5311 fi 5312 libs_cpu="-L\$(BUILD_DIR)/capstone -lcapstone $libs_cpu" 5313 ;; 5314 5315 system) 5316 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" 5317 libs_cpu="$($pkg_config --libs capstone) $libs_cpu" 5318 ;; 5319 5320 no) 5321 ;; 5322 *) 5323 error_exit "Unknown state for capstone: $capstone" 5324 ;; 5325esac 5326 5327########################################## 5328# check if we have fdatasync 5329 5330fdatasync=no 5331cat > $TMPC << EOF 5332#include <unistd.h> 5333int main(void) { 5334#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 5335return fdatasync(0); 5336#else 5337#error Not supported 5338#endif 5339} 5340EOF 5341if compile_prog "" "" ; then 5342 fdatasync=yes 5343fi 5344 5345########################################## 5346# check if we have madvise 5347 5348madvise=no 5349cat > $TMPC << EOF 5350#include <sys/types.h> 5351#include <sys/mman.h> 5352#include <stddef.h> 5353int main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 5354EOF 5355if compile_prog "" "" ; then 5356 madvise=yes 5357fi 5358 5359########################################## 5360# check if we have posix_madvise 5361 5362posix_madvise=no 5363cat > $TMPC << EOF 5364#include <sys/mman.h> 5365#include <stddef.h> 5366int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 5367EOF 5368if compile_prog "" "" ; then 5369 posix_madvise=yes 5370fi 5371 5372########################################## 5373# check if we have posix_memalign() 5374 5375posix_memalign=no 5376cat > $TMPC << EOF 5377#include <stdlib.h> 5378int main(void) { 5379 void *p; 5380 return posix_memalign(&p, 8, 8); 5381} 5382EOF 5383if compile_prog "" "" ; then 5384 posix_memalign=yes 5385fi 5386 5387########################################## 5388# check if we have posix_syslog 5389 5390posix_syslog=no 5391cat > $TMPC << EOF 5392#include <syslog.h> 5393int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 5394EOF 5395if compile_prog "" "" ; then 5396 posix_syslog=yes 5397fi 5398 5399########################################## 5400# check if we have sem_timedwait 5401 5402sem_timedwait=no 5403cat > $TMPC << EOF 5404#include <semaphore.h> 5405int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } 5406EOF 5407if compile_prog "" "" ; then 5408 sem_timedwait=yes 5409fi 5410 5411########################################## 5412# check if we have strchrnul 5413 5414strchrnul=no 5415cat > $TMPC << EOF 5416#include <string.h> 5417int main(void); 5418// Use a haystack that the compiler shouldn't be able to constant fold 5419char *haystack = (char*)&main; 5420int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 5421EOF 5422if compile_prog "" "" ; then 5423 strchrnul=yes 5424fi 5425 5426######################################### 5427# check if we have st_atim 5428 5429st_atim=no 5430cat > $TMPC << EOF 5431#include <sys/stat.h> 5432#include <stddef.h> 5433int main(void) { return offsetof(struct stat, st_atim); } 5434EOF 5435if compile_prog "" "" ; then 5436 st_atim=yes 5437fi 5438 5439########################################## 5440# check if trace backend exists 5441 5442$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 5443if test "$?" -ne 0 ; then 5444 error_exit "invalid trace backends" \ 5445 "Please choose supported trace backends." 5446fi 5447 5448########################################## 5449# For 'ust' backend, test if ust headers are present 5450if have_backend "ust"; then 5451 cat > $TMPC << EOF 5452#include <lttng/tracepoint.h> 5453int main(void) { return 0; } 5454EOF 5455 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 5456 if $pkg_config lttng-ust --exists; then 5457 lttng_ust_libs=$($pkg_config --libs lttng-ust) 5458 else 5459 lttng_ust_libs="-llttng-ust -ldl" 5460 fi 5461 if $pkg_config liburcu-bp --exists; then 5462 urcu_bp_libs=$($pkg_config --libs liburcu-bp) 5463 else 5464 urcu_bp_libs="-lurcu-bp" 5465 fi 5466 5467 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 5468 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 5469 else 5470 error_exit "Trace backend 'ust' missing lttng-ust header files" 5471 fi 5472fi 5473 5474########################################## 5475# For 'dtrace' backend, test if 'dtrace' command is present 5476if have_backend "dtrace"; then 5477 if ! has 'dtrace' ; then 5478 error_exit "dtrace command is not found in PATH $PATH" 5479 fi 5480 trace_backend_stap="no" 5481 if has 'stap' ; then 5482 trace_backend_stap="yes" 5483 fi 5484fi 5485 5486########################################## 5487# check and set a backend for coroutine 5488 5489# We prefer ucontext, but it's not always possible. The fallback 5490# is sigcontext. On Windows the only valid backend is the Windows 5491# specific one. 5492 5493ucontext_works=no 5494if test "$darwin" != "yes"; then 5495 cat > $TMPC << EOF 5496#include <ucontext.h> 5497#ifdef __stub_makecontext 5498#error Ignoring glibc stub makecontext which will always fail 5499#endif 5500int main(void) { makecontext(0, 0, 0); return 0; } 5501EOF 5502 if compile_prog "" "" ; then 5503 ucontext_works=yes 5504 fi 5505fi 5506 5507if test "$coroutine" = ""; then 5508 if test "$mingw32" = "yes"; then 5509 coroutine=win32 5510 elif test "$ucontext_works" = "yes"; then 5511 coroutine=ucontext 5512 else 5513 coroutine=sigaltstack 5514 fi 5515else 5516 case $coroutine in 5517 windows) 5518 if test "$mingw32" != "yes"; then 5519 error_exit "'windows' coroutine backend only valid for Windows" 5520 fi 5521 # Unfortunately the user visible backend name doesn't match the 5522 # coroutine-*.c filename for this case, so we have to adjust it here. 5523 coroutine=win32 5524 ;; 5525 ucontext) 5526 if test "$ucontext_works" != "yes"; then 5527 feature_not_found "ucontext" 5528 fi 5529 ;; 5530 sigaltstack) 5531 if test "$mingw32" = "yes"; then 5532 error_exit "only the 'windows' coroutine backend is valid for Windows" 5533 fi 5534 ;; 5535 *) 5536 error_exit "unknown coroutine backend $coroutine" 5537 ;; 5538 esac 5539fi 5540 5541if test "$coroutine_pool" = ""; then 5542 coroutine_pool=yes 5543fi 5544 5545if test "$debug_stack_usage" = "yes"; then 5546 if test "$coroutine_pool" = "yes"; then 5547 echo "WARN: disabling coroutine pool for stack usage debugging" 5548 coroutine_pool=no 5549 fi 5550fi 5551 5552 5553########################################## 5554# check if we have open_by_handle_at 5555 5556open_by_handle_at=no 5557cat > $TMPC << EOF 5558#include <fcntl.h> 5559#if !defined(AT_EMPTY_PATH) 5560# error missing definition 5561#else 5562int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 5563#endif 5564EOF 5565if compile_prog "" "" ; then 5566 open_by_handle_at=yes 5567fi 5568 5569######################################## 5570# check if we have linux/magic.h 5571 5572linux_magic_h=no 5573cat > $TMPC << EOF 5574#include <linux/magic.h> 5575int main(void) { 5576 return 0; 5577} 5578EOF 5579if compile_prog "" "" ; then 5580 linux_magic_h=yes 5581fi 5582 5583######################################## 5584# check whether we can disable warning option with a pragma (this is needed 5585# to silence warnings in the headers of some versions of external libraries). 5586# This test has to be compiled with -Werror as otherwise an unknown pragma is 5587# only a warning. 5588# 5589# If we can't selectively disable warning in the code, disable -Werror so that 5590# the build doesn't fail anyway. 5591 5592pragma_disable_unused_but_set=no 5593cat > $TMPC << EOF 5594#pragma GCC diagnostic push 5595#pragma GCC diagnostic ignored "-Wstrict-prototypes" 5596#pragma GCC diagnostic pop 5597 5598int main(void) { 5599 return 0; 5600} 5601EOF 5602if compile_prog "-Werror" "" ; then 5603 pragma_diagnostic_available=yes 5604else 5605 werror=no 5606fi 5607 5608######################################## 5609# check if we have valgrind/valgrind.h 5610 5611valgrind_h=no 5612cat > $TMPC << EOF 5613#include <valgrind/valgrind.h> 5614int main(void) { 5615 return 0; 5616} 5617EOF 5618if compile_prog "" "" ; then 5619 valgrind_h=yes 5620fi 5621 5622######################################## 5623# check if environ is declared 5624 5625has_environ=no 5626cat > $TMPC << EOF 5627#include <unistd.h> 5628int main(void) { 5629 environ = 0; 5630 return 0; 5631} 5632EOF 5633if compile_prog "" "" ; then 5634 has_environ=yes 5635fi 5636 5637######################################## 5638# check if cpuid.h is usable. 5639 5640cat > $TMPC << EOF 5641#include <cpuid.h> 5642int main(void) { 5643 unsigned a, b, c, d; 5644 int max = __get_cpuid_max(0, 0); 5645 5646 if (max >= 1) { 5647 __cpuid(1, a, b, c, d); 5648 } 5649 5650 if (max >= 7) { 5651 __cpuid_count(7, 0, a, b, c, d); 5652 } 5653 5654 return 0; 5655} 5656EOF 5657if compile_prog "" "" ; then 5658 cpuid_h=yes 5659fi 5660 5661########################################## 5662# avx2 optimization requirement check 5663# 5664# There is no point enabling this if cpuid.h is not usable, 5665# since we won't be able to select the new routines. 5666 5667if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 5668 cat > $TMPC << EOF 5669#pragma GCC push_options 5670#pragma GCC target("avx2") 5671#include <cpuid.h> 5672#include <immintrin.h> 5673static int bar(void *a) { 5674 __m256i x = *(__m256i *)a; 5675 return _mm256_testz_si256(x, x); 5676} 5677int main(int argc, char *argv[]) { return bar(argv[0]); } 5678EOF 5679 if compile_object "" ; then 5680 avx2_opt="yes" 5681 else 5682 avx2_opt="no" 5683 fi 5684fi 5685 5686########################################## 5687# avx512f optimization requirement check 5688# 5689# There is no point enabling this if cpuid.h is not usable, 5690# since we won't be able to select the new routines. 5691# by default, it is turned off. 5692# if user explicitly want to enable it, check environment 5693 5694if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 5695 cat > $TMPC << EOF 5696#pragma GCC push_options 5697#pragma GCC target("avx512f") 5698#include <cpuid.h> 5699#include <immintrin.h> 5700static int bar(void *a) { 5701 __m512i x = *(__m512i *)a; 5702 return _mm512_test_epi64_mask(x, x); 5703} 5704int main(int argc, char *argv[]) 5705{ 5706 return bar(argv[0]); 5707} 5708EOF 5709 if ! compile_object "" ; then 5710 avx512f_opt="no" 5711 fi 5712else 5713 avx512f_opt="no" 5714fi 5715 5716######################################## 5717# check if __[u]int128_t is usable. 5718 5719int128=no 5720cat > $TMPC << EOF 5721__int128_t a; 5722__uint128_t b; 5723int main (void) { 5724 a = a + b; 5725 b = a * b; 5726 a = a * a; 5727 return 0; 5728} 5729EOF 5730if compile_prog "" "" ; then 5731 int128=yes 5732fi 5733 5734######################################### 5735# See if 128-bit atomic operations are supported. 5736 5737atomic128=no 5738if test "$int128" = "yes"; then 5739 cat > $TMPC << EOF 5740int main(void) 5741{ 5742 unsigned __int128 x = 0, y = 0; 5743 y = __atomic_load_16(&x, 0); 5744 __atomic_store_16(&x, y, 0); 5745 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 5746 return 0; 5747} 5748EOF 5749 if compile_prog "" "" ; then 5750 atomic128=yes 5751 fi 5752fi 5753 5754cmpxchg128=no 5755if test "$int128" = yes && test "$atomic128" = no; then 5756 cat > $TMPC << EOF 5757int main(void) 5758{ 5759 unsigned __int128 x = 0, y = 0; 5760 __sync_val_compare_and_swap_16(&x, y, x); 5761 return 0; 5762} 5763EOF 5764 if compile_prog "" "" ; then 5765 cmpxchg128=yes 5766 fi 5767fi 5768 5769######################################### 5770# See if 64-bit atomic operations are supported. 5771# Note that without __atomic builtins, we can only 5772# assume atomic loads/stores max at pointer size. 5773 5774cat > $TMPC << EOF 5775#include <stdint.h> 5776int main(void) 5777{ 5778 uint64_t x = 0, y = 0; 5779#ifdef __ATOMIC_RELAXED 5780 y = __atomic_load_8(&x, 0); 5781 __atomic_store_8(&x, y, 0); 5782 __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); 5783 __atomic_exchange_8(&x, y, 0); 5784 __atomic_fetch_add_8(&x, y, 0); 5785#else 5786 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5787 __sync_lock_test_and_set(&x, y); 5788 __sync_val_compare_and_swap(&x, y, 0); 5789 __sync_fetch_and_add(&x, y); 5790#endif 5791 return 0; 5792} 5793EOF 5794if compile_prog "" "" ; then 5795 atomic64=yes 5796fi 5797 5798######################################### 5799# See if --dynamic-list is supported by the linker 5800ld_dynamic_list="no" 5801if test "$static" = "no" ; then 5802 cat > $TMPTXT <<EOF 5803{ 5804 foo; 5805}; 5806EOF 5807 5808 cat > $TMPC <<EOF 5809#include <stdio.h> 5810void foo(void); 5811 5812void foo(void) 5813{ 5814 printf("foo\n"); 5815} 5816 5817int main(void) 5818{ 5819 foo(); 5820 return 0; 5821} 5822EOF 5823 5824 if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 5825 ld_dynamic_list="yes" 5826 fi 5827fi 5828 5829######################################### 5830# See if -exported_symbols_list is supported by the linker 5831 5832ld_exported_symbols_list="no" 5833if test "$static" = "no" ; then 5834 cat > $TMPTXT <<EOF 5835 _foo 5836EOF 5837 5838 if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 5839 ld_exported_symbols_list="yes" 5840 fi 5841fi 5842 5843if test "$plugins" = "yes" && 5844 test "$ld_dynamic_list" = "no" && 5845 test "$ld_exported_symbols_list" = "no" ; then 5846 error_exit \ 5847 "Plugin support requires dynamic linking and specifying a set of symbols " \ 5848 "that are exported to plugins. Unfortunately your linker doesn't " \ 5849 "support the flag (--dynamic-list or -exported_symbols_list) used " \ 5850 "for this purpose. You can't build with --static." 5851fi 5852 5853######################################## 5854# See if __attribute__((alias)) is supported. 5855# This false for Xcode 9, but has been remedied for Xcode 10. 5856# Unfortunately, travis uses Xcode 9 by default. 5857 5858attralias=no 5859cat > $TMPC << EOF 5860int x = 1; 5861extern const int y __attribute__((alias("x"))); 5862int main(void) { return 0; } 5863EOF 5864if compile_prog "" "" ; then 5865 attralias=yes 5866fi 5867 5868######################################## 5869# check if getauxval is available. 5870 5871getauxval=no 5872cat > $TMPC << EOF 5873#include <sys/auxv.h> 5874int main(void) { 5875 return getauxval(AT_HWCAP) == 0; 5876} 5877EOF 5878if compile_prog "" "" ; then 5879 getauxval=yes 5880fi 5881 5882######################################## 5883# check if ccache is interfering with 5884# semantic analysis of macros 5885 5886unset CCACHE_CPP2 5887ccache_cpp2=no 5888cat > $TMPC << EOF 5889static const int Z = 1; 5890#define fn() ({ Z; }) 5891#define TAUT(X) ((X) == Z) 5892#define PAREN(X, Y) (X == Y) 5893#define ID(X) (X) 5894int main(int argc, char *argv[]) 5895{ 5896 int x = 0, y = 0; 5897 x = ID(x); 5898 x = fn(); 5899 fn(); 5900 if (PAREN(x, y)) return 0; 5901 if (TAUT(Z)) return 0; 5902 return 0; 5903} 5904EOF 5905 5906if ! compile_object "-Werror"; then 5907 ccache_cpp2=yes 5908fi 5909 5910################################################# 5911# clang does not support glibc + FORTIFY_SOURCE. 5912 5913if test "$fortify_source" != "no"; then 5914 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5915 fortify_source="no"; 5916 elif test -n "$cxx" && has $cxx && 5917 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5918 fortify_source="no"; 5919 else 5920 fortify_source="yes" 5921 fi 5922fi 5923 5924############################################### 5925# Check if copy_file_range is provided by glibc 5926have_copy_file_range=no 5927cat > $TMPC << EOF 5928#include <unistd.h> 5929int main(void) { 5930 copy_file_range(0, NULL, 0, NULL, 0, 0); 5931 return 0; 5932} 5933EOF 5934if compile_prog "" "" ; then 5935 have_copy_file_range=yes 5936fi 5937 5938########################################## 5939# check if struct fsxattr is available via linux/fs.h 5940 5941have_fsxattr=no 5942cat > $TMPC << EOF 5943#include <linux/fs.h> 5944struct fsxattr foo; 5945int main(void) { 5946 return 0; 5947} 5948EOF 5949if compile_prog "" "" ; then 5950 have_fsxattr=yes 5951fi 5952 5953########################################## 5954# check for usable membarrier system call 5955if test "$membarrier" = "yes"; then 5956 have_membarrier=no 5957 if test "$mingw32" = "yes" ; then 5958 have_membarrier=yes 5959 elif test "$linux" = "yes" ; then 5960 cat > $TMPC << EOF 5961 #include <linux/membarrier.h> 5962 #include <sys/syscall.h> 5963 #include <unistd.h> 5964 #include <stdlib.h> 5965 int main(void) { 5966 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5967 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5968 exit(0); 5969 } 5970EOF 5971 if compile_prog "" "" ; then 5972 have_membarrier=yes 5973 fi 5974 fi 5975 if test "$have_membarrier" = "no"; then 5976 feature_not_found "membarrier" "membarrier system call not available" 5977 fi 5978else 5979 # Do not enable it by default even for Mingw32, because it doesn't 5980 # work on Wine. 5981 membarrier=no 5982fi 5983 5984########################################## 5985# check if rtnetlink.h exists and is useful 5986have_rtnetlink=no 5987cat > $TMPC << EOF 5988#include <linux/rtnetlink.h> 5989int main(void) { 5990 return IFLA_PROTO_DOWN; 5991} 5992EOF 5993if compile_prog "" "" ; then 5994 have_rtnetlink=yes 5995fi 5996 5997########################################## 5998# check for usable AF_VSOCK environment 5999have_af_vsock=no 6000cat > $TMPC << EOF 6001#include <errno.h> 6002#include <sys/types.h> 6003#include <sys/socket.h> 6004#if !defined(AF_VSOCK) 6005# error missing AF_VSOCK flag 6006#endif 6007#include <linux/vm_sockets.h> 6008int main(void) { 6009 int sock, ret; 6010 struct sockaddr_vm svm; 6011 socklen_t len = sizeof(svm); 6012 sock = socket(AF_VSOCK, SOCK_STREAM, 0); 6013 ret = getpeername(sock, (struct sockaddr *)&svm, &len); 6014 if ((ret == -1) && (errno == ENOTCONN)) { 6015 return 0; 6016 } 6017 return -1; 6018} 6019EOF 6020if compile_prog "" "" ; then 6021 have_af_vsock=yes 6022fi 6023 6024########################################## 6025# check for usable AF_ALG environment 6026have_afalg=no 6027cat > $TMPC << EOF 6028#include <errno.h> 6029#include <sys/types.h> 6030#include <sys/socket.h> 6031#include <linux/if_alg.h> 6032int main(void) { 6033 int sock; 6034 sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 6035 return sock; 6036} 6037EOF 6038if compile_prog "" "" ; then 6039 have_afalg=yes 6040fi 6041if test "$crypto_afalg" = "yes" 6042then 6043 if test "$have_afalg" != "yes" 6044 then 6045 error_exit "AF_ALG requested but could not be detected" 6046 fi 6047fi 6048 6049 6050################################################# 6051# Check to see if we have the Hypervisor framework 6052if [ "$darwin" = "yes" ] ; then 6053 cat > $TMPC << EOF 6054#include <Hypervisor/hv.h> 6055int main() { return 0;} 6056EOF 6057 if ! compile_object ""; then 6058 hvf='no' 6059 else 6060 hvf='yes' 6061 QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS" 6062 fi 6063fi 6064 6065################################################# 6066# Sparc implicitly links with --relax, which is 6067# incompatible with -r, so --no-relax should be 6068# given. It does no harm to give it on other 6069# platforms too. 6070 6071# Note: the prototype is needed since QEMU_CFLAGS 6072# contains -Wmissing-prototypes 6073cat > $TMPC << EOF 6074extern int foo(void); 6075int foo(void) { return 0; } 6076EOF 6077if ! compile_object ""; then 6078 error_exit "Failed to compile object file for LD_REL_FLAGS test" 6079fi 6080for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do 6081 if do_cc -nostdlib $i -o $TMPMO $TMPO; then 6082 LD_REL_FLAGS=$i 6083 break 6084 fi 6085done 6086if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then 6087 feature_not_found "modules" "Cannot find how to build relocatable objects" 6088fi 6089 6090########################################## 6091# check for sysmacros.h 6092 6093have_sysmacros=no 6094cat > $TMPC << EOF 6095#include <sys/sysmacros.h> 6096int main(void) { 6097 return makedev(0, 0); 6098} 6099EOF 6100if compile_prog "" "" ; then 6101 have_sysmacros=yes 6102fi 6103 6104########################################## 6105# Veritas HyperScale block driver VxHS 6106# Check if libvxhs is installed 6107 6108if test "$vxhs" != "no" ; then 6109 cat > $TMPC <<EOF 6110#include <stdint.h> 6111#include <qnio/qnio_api.h> 6112 6113void *vxhs_callback; 6114 6115int main(void) { 6116 iio_init(QNIO_VERSION, vxhs_callback); 6117 return 0; 6118} 6119EOF 6120 vxhs_libs="-lvxhs -lssl" 6121 if compile_prog "" "$vxhs_libs" ; then 6122 vxhs=yes 6123 else 6124 if test "$vxhs" = "yes" ; then 6125 feature_not_found "vxhs block device" "Install libvxhs See github" 6126 fi 6127 vxhs=no 6128 fi 6129fi 6130 6131########################################## 6132# check for _Static_assert() 6133 6134have_static_assert=no 6135cat > $TMPC << EOF 6136_Static_assert(1, "success"); 6137int main(void) { 6138 return 0; 6139} 6140EOF 6141if compile_prog "" "" ; then 6142 have_static_assert=yes 6143fi 6144 6145########################################## 6146# check for utmpx.h, it is missing e.g. on OpenBSD 6147 6148have_utmpx=no 6149cat > $TMPC << EOF 6150#include <utmpx.h> 6151struct utmpx user_info; 6152int main(void) { 6153 return 0; 6154} 6155EOF 6156if compile_prog "" "" ; then 6157 have_utmpx=yes 6158fi 6159 6160########################################## 6161# check for getrandom() 6162 6163have_getrandom=no 6164cat > $TMPC << EOF 6165#include <sys/random.h> 6166int main(void) { 6167 return getrandom(0, 0, GRND_NONBLOCK); 6168} 6169EOF 6170if compile_prog "" "" ; then 6171 have_getrandom=yes 6172fi 6173 6174########################################## 6175# checks for sanitizers 6176 6177have_asan=no 6178have_ubsan=no 6179have_asan_iface_h=no 6180have_asan_iface_fiber=no 6181 6182if test "$sanitizers" = "yes" ; then 6183 write_c_skeleton 6184 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 6185 have_asan=yes 6186 fi 6187 6188 # we could use a simple skeleton for flags checks, but this also 6189 # detect the static linking issue of ubsan, see also: 6190 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 6191 cat > $TMPC << EOF 6192#include <stdlib.h> 6193int main(void) { 6194 void *tmp = malloc(10); 6195 if (tmp != NULL) { 6196 return *(int *)(tmp + 2); 6197 } 6198} 6199EOF 6200 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 6201 have_ubsan=yes 6202 fi 6203 6204 if check_include "sanitizer/asan_interface.h" ; then 6205 have_asan_iface_h=yes 6206 fi 6207 6208 cat > $TMPC << EOF 6209#include <sanitizer/asan_interface.h> 6210int main(void) { 6211 __sanitizer_start_switch_fiber(0, 0, 0); 6212 return 0; 6213} 6214EOF 6215 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 6216 have_asan_iface_fiber=yes 6217 fi 6218fi 6219 6220########################################## 6221# checks for fuzzer 6222if test "$fuzzing" = "yes" ; then 6223 write_c_fuzzer_skeleton 6224 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address,fuzzer" ""; then 6225 have_fuzzer=yes 6226 fi 6227fi 6228 6229# Thread sanitizer is, for now, much noisier than the other sanitizers; 6230# keep it separate until that is not the case. 6231if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 6232 error_exit "TSAN is not supported with other sanitiziers." 6233fi 6234have_tsan=no 6235have_tsan_iface_fiber=no 6236if test "$tsan" = "yes" ; then 6237 write_c_skeleton 6238 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 6239 have_tsan=yes 6240 fi 6241 cat > $TMPC << EOF 6242#include <sanitizer/tsan_interface.h> 6243int main(void) { 6244 __tsan_create_fiber(0); 6245 return 0; 6246} 6247EOF 6248 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 6249 have_tsan_iface_fiber=yes 6250 fi 6251fi 6252 6253########################################## 6254# check for libpmem 6255 6256if test "$libpmem" != "no"; then 6257 if $pkg_config --exists "libpmem"; then 6258 libpmem="yes" 6259 libpmem_libs=$($pkg_config --libs libpmem) 6260 libpmem_cflags=$($pkg_config --cflags libpmem) 6261 libs_softmmu="$libs_softmmu $libpmem_libs" 6262 QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" 6263 else 6264 if test "$libpmem" = "yes" ; then 6265 feature_not_found "libpmem" "Install nvml or pmdk" 6266 fi 6267 libpmem="no" 6268 fi 6269fi 6270 6271########################################## 6272# check for slirp 6273 6274# slirp is only required when building softmmu targets 6275if test -z "$slirp" -a "$softmmu" != "yes" ; then 6276 slirp="no" 6277fi 6278 6279case "$slirp" in 6280 "" | yes) 6281 if $pkg_config slirp; then 6282 slirp=system 6283 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 6284 slirp=git 6285 elif test -e "${source_path}/slirp/Makefile" ; then 6286 slirp=internal 6287 elif test -z "$slirp" ; then 6288 slirp=no 6289 else 6290 feature_not_found "slirp" "Install slirp devel or git submodule" 6291 fi 6292 ;; 6293 6294 system) 6295 if ! $pkg_config slirp; then 6296 feature_not_found "slirp" "Install slirp devel" 6297 fi 6298 ;; 6299esac 6300 6301case "$slirp" in 6302 git | internal) 6303 if test "$slirp" = git; then 6304 git_submodules="${git_submodules} slirp" 6305 fi 6306 mkdir -p slirp 6307 slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src" 6308 slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp" 6309 if test "$mingw32" = "yes" ; then 6310 slirp_libs="$slirp_libs -lws2_32 -liphlpapi" 6311 fi 6312 ;; 6313 6314 system) 6315 slirp_version=$($pkg_config --modversion slirp 2>/dev/null) 6316 slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null) 6317 slirp_libs=$($pkg_config --libs slirp 2>/dev/null) 6318 ;; 6319 6320 no) 6321 ;; 6322 *) 6323 error_exit "Unknown state for slirp: $slirp" 6324 ;; 6325esac 6326 6327########################################## 6328# check for usable __NR_keyctl syscall 6329 6330if test "$linux" = "yes" ; then 6331 6332 have_keyring=no 6333 cat > $TMPC << EOF 6334#include <errno.h> 6335#include <asm/unistd.h> 6336#include <linux/keyctl.h> 6337#include <unistd.h> 6338int main(void) { 6339 return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 6340} 6341EOF 6342 if compile_prog "" "" ; then 6343 have_keyring=yes 6344 fi 6345fi 6346if test "$secret_keyring" != "no" 6347then 6348 if test "$have_keyring" == "yes" 6349 then 6350 secret_keyring=yes 6351 else 6352 if test "$secret_keyring" = "yes" 6353 then 6354 error_exit "syscall __NR_keyctl requested, \ 6355but not implemented on your system" 6356 else 6357 secret_keyring=no 6358 fi 6359 fi 6360fi 6361 6362########################################## 6363# check for usable keyutils.h 6364 6365if test "$linux" = "yes" ; then 6366 6367 have_keyutils=no 6368 cat > $TMPC << EOF 6369#include <errno.h> 6370#include <asm/unistd.h> 6371#include <unistd.h> 6372#include <sys/types.h> 6373#include <keyutils.h> 6374int main(void) { 6375 return request_key("user", NULL, NULL, 0); 6376} 6377EOF 6378 if compile_prog "" "-lkeyutils"; then 6379 have_keyutils=yes 6380 fi 6381fi 6382 6383 6384########################################## 6385# End of CC checks 6386# After here, no more $cc or $ld runs 6387 6388write_c_skeleton 6389 6390if test "$gcov" = "yes" ; then 6391 QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS" 6392 QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS" 6393elif test "$fortify_source" = "yes" ; then 6394 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" 6395elif test "$debug" = "no"; then 6396 CFLAGS="-O2 $CFLAGS" 6397fi 6398 6399if test "$have_asan" = "yes"; then 6400 QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 6401 QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 6402 if test "$have_asan_iface_h" = "no" ; then 6403 echo "ASAN build enabled, but ASAN header missing." \ 6404 "Without code annotation, the report may be inferior." 6405 elif test "$have_asan_iface_fiber" = "no" ; then 6406 echo "ASAN build enabled, but ASAN header is too old." \ 6407 "Without code annotation, the report may be inferior." 6408 fi 6409fi 6410if test "$have_tsan" = "yes" ; then 6411 if test "$have_tsan_iface_fiber" = "yes" ; then 6412 QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 6413 QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 6414 else 6415 error_exit "Cannot enable TSAN due to missing fiber annotation interface." 6416 fi 6417elif test "$tsan" = "yes" ; then 6418 error_exit "Cannot enable TSAN due to missing sanitize thread interface." 6419fi 6420if test "$have_ubsan" = "yes"; then 6421 QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 6422 QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 6423fi 6424 6425########################################## 6426# Do we have libnfs 6427if test "$libnfs" != "no" ; then 6428 if $pkg_config --atleast-version=1.9.3 libnfs; then 6429 libnfs="yes" 6430 libnfs_libs=$($pkg_config --libs libnfs) 6431 else 6432 if test "$libnfs" = "yes" ; then 6433 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 6434 fi 6435 libnfs="no" 6436 fi 6437fi 6438 6439########################################## 6440# Do we have libudev 6441if test "$libudev" != "no" ; then 6442 if $pkg_config libudev && test "$static" != "yes"; then 6443 libudev="yes" 6444 libudev_libs=$($pkg_config --libs libudev) 6445 else 6446 libudev="no" 6447 fi 6448fi 6449 6450# Now we've finished running tests it's OK to add -Werror to the compiler flags 6451if test "$werror" = "yes"; then 6452 QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 6453fi 6454 6455# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 6456if test "$solaris" = "no" && test "$tsan" = "no"; then 6457 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 6458 QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 6459 fi 6460fi 6461 6462# test if pod2man has --utf8 option 6463if pod2man --help | grep -q utf8; then 6464 POD2MAN="pod2man --utf8" 6465else 6466 POD2MAN="pod2man" 6467fi 6468 6469# Use ASLR, no-SEH and DEP if available 6470if test "$mingw32" = "yes" ; then 6471 for flag in --dynamicbase --no-seh --nxcompat; do 6472 if ld_has $flag ; then 6473 QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 6474 fi 6475 done 6476fi 6477 6478# Disable OpenBSD W^X if available 6479if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then 6480 cat > $TMPC <<EOF 6481 int main(void) { return 0; } 6482EOF 6483 wx_ldflags="-Wl,-z,wxneeded" 6484 if compile_prog "" "$wx_ldflags"; then 6485 QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags" 6486 fi 6487fi 6488 6489qemu_confdir=$sysconfdir$confsuffix 6490qemu_moddir=$libdir$confsuffix 6491qemu_datadir=$datadir$confsuffix 6492qemu_localedir="$datadir/locale" 6493qemu_icondir="$datadir/icons" 6494qemu_desktopdir="$datadir/applications" 6495 6496# We can only support ivshmem if we have eventfd 6497if [ "$eventfd" = "yes" ]; then 6498 ivshmem=yes 6499fi 6500 6501tools="" 6502if test "$want_tools" = "yes" ; then 6503 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools" 6504 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 6505 tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools" 6506 fi 6507 if [ "$ivshmem" = "yes" ]; then 6508 tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" 6509 fi 6510 if [ "$curl" = "yes" ]; then 6511 tools="elf2dmp\$(EXESUF) $tools" 6512 fi 6513fi 6514if test "$softmmu" = yes ; then 6515 if test "$linux" = yes; then 6516 if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then 6517 virtfs=yes 6518 helpers="$helpers fsdev/virtfs-proxy-helper\$(EXESUF)" 6519 else 6520 if test "$virtfs" = yes; then 6521 error_exit "VirtFS requires libcap-ng devel and libattr devel" 6522 fi 6523 virtfs=no 6524 fi 6525 if test "$mpath" != no && test "$mpathpersist" = yes ; then 6526 mpath=yes 6527 else 6528 if test "$mpath" = yes; then 6529 error_exit "Multipath requires libmpathpersist devel" 6530 fi 6531 mpath=no 6532 fi 6533 helpers="$helpers scsi/qemu-pr-helper\$(EXESUF)" 6534 else 6535 if test "$virtfs" = yes; then 6536 error_exit "VirtFS is supported only on Linux" 6537 fi 6538 virtfs=no 6539 if test "$mpath" = yes; then 6540 error_exit "Multipath is supported only on Linux" 6541 fi 6542 mpath=no 6543 fi 6544 if test "$xkbcommon" = "yes"; then 6545 tools="qemu-keymap\$(EXESUF) $tools" 6546 fi 6547fi 6548 6549# Probe for guest agent support/options 6550 6551if [ "$guest_agent" != "no" ]; then 6552 if [ "$softmmu" = no -a "$want_tools" = no ] ; then 6553 guest_agent=no 6554 elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 6555 tools="qemu-ga\$(EXESUF) $tools" 6556 guest_agent=yes 6557 elif [ "$guest_agent" != yes ]; then 6558 guest_agent=no 6559 else 6560 error_exit "Guest agent is not supported on this platform" 6561 fi 6562fi 6563 6564# Guest agent Window MSI package 6565 6566if test "$guest_agent" != yes; then 6567 if test "$guest_agent_msi" = yes; then 6568 error_exit "MSI guest agent package requires guest agent enabled" 6569 fi 6570 guest_agent_msi=no 6571elif test "$mingw32" != "yes"; then 6572 if test "$guest_agent_msi" = "yes"; then 6573 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 6574 fi 6575 guest_agent_msi=no 6576elif ! has wixl; then 6577 if test "$guest_agent_msi" = "yes"; then 6578 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 6579 fi 6580 guest_agent_msi=no 6581else 6582 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 6583 # disabled explicitly 6584 if test "$guest_agent_msi" != "no"; then 6585 guest_agent_msi=yes 6586 fi 6587fi 6588 6589if test "$guest_agent_msi" = "yes"; then 6590 if test "$guest_agent_with_vss" = "yes"; then 6591 QEMU_GA_MSI_WITH_VSS="-D InstallVss" 6592 fi 6593 6594 if test "$QEMU_GA_MANUFACTURER" = ""; then 6595 QEMU_GA_MANUFACTURER=QEMU 6596 fi 6597 6598 if test "$QEMU_GA_DISTRO" = ""; then 6599 QEMU_GA_DISTRO=Linux 6600 fi 6601 6602 if test "$QEMU_GA_VERSION" = ""; then 6603 QEMU_GA_VERSION=$(cat $source_path/VERSION) 6604 fi 6605 6606 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 6607 6608 case "$cpu" in 6609 x86_64) 6610 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 6611 ;; 6612 i386) 6613 QEMU_GA_MSI_ARCH="-D Arch=32" 6614 ;; 6615 *) 6616 error_exit "CPU $cpu not supported for building installation package" 6617 ;; 6618 esac 6619fi 6620 6621# Mac OS X ships with a broken assembler 6622roms= 6623if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 6624 test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 6625 test "$softmmu" = yes ; then 6626 # Different host OS linkers have different ideas about the name of the ELF 6627 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 6628 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 6629 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 6630 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 6631 ld_i386_emulation="$emu" 6632 roms="optionrom" 6633 break 6634 fi 6635 done 6636fi 6637 6638# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 6639if test "$cpu" = "s390x" ; then 6640 write_c_skeleton 6641 if compile_prog "-march=z900" ""; then 6642 roms="$roms s390-ccw" 6643 # SLOF is required for building the s390-ccw firmware on s390x, 6644 # since it is using the libnet code from SLOF for network booting. 6645 if test -e "${source_path}/.git" ; then 6646 git_submodules="${git_submodules} roms/SLOF" 6647 fi 6648 fi 6649fi 6650 6651# Check that the C++ compiler exists and works with the C compiler. 6652# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. 6653if has $cxx; then 6654 cat > $TMPC <<EOF 6655int c_function(void); 6656int main(void) { return c_function(); } 6657EOF 6658 6659 compile_object 6660 6661 cat > $TMPCXX <<EOF 6662extern "C" { 6663 int c_function(void); 6664} 6665int c_function(void) { return 42; } 6666EOF 6667 6668 update_cxxflags 6669 6670 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 6671 # C++ compiler $cxx works ok with C compiler $cc 6672 : 6673 else 6674 echo "C++ compiler $cxx does not work with C compiler $cc" 6675 echo "Disabling C++ specific optional code" 6676 cxx= 6677 fi 6678else 6679 echo "No C++ compiler available; disabling C++ specific optional code" 6680 cxx= 6681fi 6682 6683echo_version() { 6684 if test "$1" = "yes" ; then 6685 echo "($2)" 6686 fi 6687} 6688 6689# prepend pixman and ftd flags after all config tests are done 6690QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" 6691QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" 6692libs_softmmu="$pixman_libs $libs_softmmu" 6693 6694echo "Install prefix $prefix" 6695echo "BIOS directory $(eval echo $qemu_datadir)" 6696echo "firmware path $(eval echo $firmwarepath)" 6697echo "binary directory $(eval echo $bindir)" 6698echo "library directory $(eval echo $libdir)" 6699echo "module directory $(eval echo $qemu_moddir)" 6700echo "libexec directory $(eval echo $libexecdir)" 6701echo "include directory $(eval echo $includedir)" 6702echo "config directory $(eval echo $sysconfdir)" 6703if test "$mingw32" = "no" ; then 6704echo "local state directory $(eval echo $local_statedir)" 6705echo "Manual directory $(eval echo $mandir)" 6706echo "ELF interp prefix $interp_prefix" 6707else 6708echo "local state directory queried at runtime" 6709echo "Windows SDK $win_sdk" 6710fi 6711echo "Build directory $(pwd)" 6712echo "Source path $source_path" 6713echo "GIT binary $git" 6714echo "GIT submodules $git_submodules" 6715echo "C compiler $cc" 6716echo "Host C compiler $host_cc" 6717echo "C++ compiler $cxx" 6718echo "Objective-C compiler $objcc" 6719echo "ARFLAGS $ARFLAGS" 6720echo "CFLAGS $CFLAGS" 6721echo "QEMU_CFLAGS $QEMU_CFLAGS" 6722echo "QEMU_LDFLAGS $QEMU_LDFLAGS" 6723echo "make $make" 6724echo "install $install" 6725echo "python $python ($python_version)" 6726if test "$docs" != "no"; then 6727 echo "sphinx-build $sphinx_build" 6728fi 6729echo "genisoimage $genisoimage" 6730echo "slirp support $slirp $(echo_version $slirp $slirp_version)" 6731if test "$slirp" != "no" ; then 6732 echo "smbd $smbd" 6733fi 6734echo "module support $modules" 6735echo "alt path mod load $module_upgrades" 6736echo "host CPU $cpu" 6737echo "host big endian $bigendian" 6738echo "target list $target_list" 6739echo "gprof enabled $gprof" 6740echo "sparse enabled $sparse" 6741echo "strip binaries $strip_opt" 6742echo "profiler $profiler" 6743echo "static build $static" 6744if test "$darwin" = "yes" ; then 6745 echo "Cocoa support $cocoa" 6746fi 6747echo "SDL support $sdl $(echo_version $sdl $sdlversion)" 6748echo "SDL image support $sdl_image" 6749echo "GTK support $gtk $(echo_version $gtk $gtk_version)" 6750echo "GTK GL support $gtk_gl" 6751echo "VTE support $vte $(echo_version $vte $vteversion)" 6752echo "TLS priority $tls_priority" 6753echo "GNUTLS support $gnutls" 6754echo "libgcrypt $gcrypt" 6755if test "$gcrypt" = "yes" 6756then 6757 echo " hmac $gcrypt_hmac" 6758 echo " XTS $gcrypt_xts" 6759fi 6760echo "nettle $nettle $(echo_version $nettle $nettle_version)" 6761if test "$nettle" = "yes" 6762then 6763 echo " XTS $nettle_xts" 6764fi 6765echo "libtasn1 $tasn1" 6766echo "PAM $auth_pam" 6767echo "iconv support $iconv" 6768echo "curses support $curses" 6769echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)" 6770echo "curl support $curl" 6771echo "mingw32 support $mingw32" 6772echo "Audio drivers $audio_drv_list" 6773echo "Block whitelist (rw) $block_drv_rw_whitelist" 6774echo "Block whitelist (ro) $block_drv_ro_whitelist" 6775echo "VirtFS support $virtfs" 6776echo "Multipath support $mpath" 6777echo "VNC support $vnc" 6778if test "$vnc" = "yes" ; then 6779 echo "VNC SASL support $vnc_sasl" 6780 echo "VNC JPEG support $vnc_jpeg" 6781 echo "VNC PNG support $vnc_png" 6782fi 6783echo "xen support $xen" 6784if test "$xen" = "yes" ; then 6785 echo "xen ctrl version $xen_ctrl_version" 6786fi 6787echo "brlapi support $brlapi" 6788echo "Documentation $docs" 6789echo "PIE $pie" 6790echo "vde support $vde" 6791echo "netmap support $netmap" 6792echo "Linux AIO support $linux_aio" 6793echo "Linux io_uring support $linux_io_uring" 6794echo "ATTR/XATTR support $attr" 6795echo "Install blobs $blobs" 6796echo "KVM support $kvm" 6797echo "HAX support $hax" 6798echo "HVF support $hvf" 6799echo "WHPX support $whpx" 6800echo "TCG support $tcg" 6801if test "$tcg" = "yes" ; then 6802 echo "TCG debug enabled $debug_tcg" 6803 echo "TCG interpreter $tcg_interpreter" 6804fi 6805echo "malloc trim support $malloc_trim" 6806echo "RDMA support $rdma" 6807echo "PVRDMA support $pvrdma" 6808echo "fdt support $fdt" 6809echo "membarrier $membarrier" 6810echo "preadv support $preadv" 6811echo "fdatasync $fdatasync" 6812echo "madvise $madvise" 6813echo "posix_madvise $posix_madvise" 6814echo "posix_memalign $posix_memalign" 6815echo "libcap-ng support $cap_ng" 6816echo "vhost-net support $vhost_net" 6817echo "vhost-crypto support $vhost_crypto" 6818echo "vhost-scsi support $vhost_scsi" 6819echo "vhost-vsock support $vhost_vsock" 6820echo "vhost-user support $vhost_user" 6821echo "vhost-user-fs support $vhost_user_fs" 6822echo "Trace backends $trace_backends" 6823if have_backend "simple"; then 6824echo "Trace output file $trace_file-<pid>" 6825fi 6826echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" 6827echo "rbd support $rbd" 6828echo "xfsctl support $xfs" 6829echo "smartcard support $smartcard" 6830echo "libusb $libusb" 6831echo "usb net redir $usb_redir" 6832echo "OpenGL support $opengl" 6833echo "OpenGL dmabufs $opengl_dmabuf" 6834echo "libiscsi support $libiscsi" 6835echo "libnfs support $libnfs" 6836echo "build guest agent $guest_agent" 6837echo "QGA VSS support $guest_agent_with_vss" 6838echo "QGA w32 disk info $guest_agent_ntddscsi" 6839echo "QGA MSI support $guest_agent_msi" 6840echo "seccomp support $seccomp" 6841echo "coroutine backend $coroutine" 6842echo "coroutine pool $coroutine_pool" 6843echo "debug stack usage $debug_stack_usage" 6844echo "mutex debugging $debug_mutex" 6845echo "crypto afalg $crypto_afalg" 6846echo "GlusterFS support $glusterfs" 6847echo "gcov $gcov_tool" 6848echo "gcov enabled $gcov" 6849echo "TPM support $tpm" 6850echo "libssh support $libssh" 6851echo "QOM debugging $qom_cast_debug" 6852echo "Live block migration $live_block_migration" 6853echo "lzo support $lzo" 6854echo "snappy support $snappy" 6855echo "bzip2 support $bzip2" 6856echo "lzfse support $lzfse" 6857echo "zstd support $zstd" 6858echo "NUMA host support $numa" 6859echo "libxml2 $libxml2" 6860echo "tcmalloc support $tcmalloc" 6861echo "jemalloc support $jemalloc" 6862echo "avx2 optimization $avx2_opt" 6863echo "avx512f optimization $avx512f_opt" 6864echo "replication support $replication" 6865echo "VxHS block device $vxhs" 6866echo "bochs support $bochs" 6867echo "cloop support $cloop" 6868echo "dmg support $dmg" 6869echo "qcow v1 support $qcow1" 6870echo "vdi support $vdi" 6871echo "vvfat support $vvfat" 6872echo "qed support $qed" 6873echo "parallels support $parallels" 6874echo "sheepdog support $sheepdog" 6875echo "capstone $capstone" 6876echo "libpmem support $libpmem" 6877echo "libudev $libudev" 6878echo "default devices $default_devices" 6879echo "plugin support $plugins" 6880echo "fuzzing support $fuzzing" 6881echo "gdb $gdb_bin" 6882echo "rng-none $rng_none" 6883echo "Linux keyring $secret_keyring" 6884 6885if test "$supported_cpu" = "no"; then 6886 echo 6887 echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!" 6888 echo 6889 echo "CPU host architecture $cpu support is not currently maintained." 6890 echo "The QEMU project intends to remove support for this host CPU in" 6891 echo "a future release if nobody volunteers to maintain it and to" 6892 echo "provide a build host for our continuous integration setup." 6893 echo "configure has succeeded and you can continue to build, but" 6894 echo "if you care about QEMU on this platform you should contact" 6895 echo "us upstream at qemu-devel@nongnu.org." 6896fi 6897 6898if test "$supported_os" = "no"; then 6899 echo 6900 echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!" 6901 echo 6902 echo "Host OS $targetos support is not currently maintained." 6903 echo "The QEMU project intends to remove support for this host OS in" 6904 echo "a future release if nobody volunteers to maintain it and to" 6905 echo "provide a build host for our continuous integration setup." 6906 echo "configure has succeeded and you can continue to build, but" 6907 echo "if you care about QEMU on this platform you should contact" 6908 echo "us upstream at qemu-devel@nongnu.org." 6909fi 6910 6911config_host_mak="config-host.mak" 6912 6913echo "# Automatically generated by configure - do not modify" >config-all-disas.mak 6914 6915echo "# Automatically generated by configure - do not modify" > $config_host_mak 6916echo >> $config_host_mak 6917 6918echo all: >> $config_host_mak 6919echo "prefix=$prefix" >> $config_host_mak 6920echo "bindir=$bindir" >> $config_host_mak 6921echo "libdir=$libdir" >> $config_host_mak 6922echo "libexecdir=$libexecdir" >> $config_host_mak 6923echo "includedir=$includedir" >> $config_host_mak 6924echo "mandir=$mandir" >> $config_host_mak 6925echo "sysconfdir=$sysconfdir" >> $config_host_mak 6926echo "qemu_confdir=$qemu_confdir" >> $config_host_mak 6927echo "qemu_datadir=$qemu_datadir" >> $config_host_mak 6928echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 6929echo "qemu_docdir=$qemu_docdir" >> $config_host_mak 6930echo "qemu_moddir=$qemu_moddir" >> $config_host_mak 6931if test "$mingw32" = "no" ; then 6932 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 6933fi 6934echo "qemu_helperdir=$libexecdir" >> $config_host_mak 6935echo "qemu_localedir=$qemu_localedir" >> $config_host_mak 6936echo "qemu_icondir=$qemu_icondir" >> $config_host_mak 6937echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak 6938echo "libs_cpu=$libs_cpu" >> $config_host_mak 6939echo "libs_softmmu=$libs_softmmu" >> $config_host_mak 6940echo "GIT=$git" >> $config_host_mak 6941echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6942echo "GIT_UPDATE=$git_update" >> $config_host_mak 6943 6944echo "ARCH=$ARCH" >> $config_host_mak 6945 6946if test "$default_devices" = "yes" ; then 6947 echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak 6948else 6949 echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak 6950fi 6951if test "$debug_tcg" = "yes" ; then 6952 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6953fi 6954if test "$strip_opt" = "yes" ; then 6955 echo "STRIP=${strip}" >> $config_host_mak 6956fi 6957if test "$bigendian" = "yes" ; then 6958 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 6959fi 6960if test "$mingw32" = "yes" ; then 6961 echo "CONFIG_WIN32=y" >> $config_host_mak 6962 rc_version=$(cat $source_path/VERSION) 6963 version_major=${rc_version%%.*} 6964 rc_version=${rc_version#*.} 6965 version_minor=${rc_version%%.*} 6966 rc_version=${rc_version#*.} 6967 version_subminor=${rc_version%%.*} 6968 version_micro=0 6969 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6970 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6971 if test "$guest_agent_with_vss" = "yes" ; then 6972 echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6973 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6974 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6975 fi 6976 if test "$guest_agent_ntddscsi" = "yes" ; then 6977 echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 6978 fi 6979 if test "$guest_agent_msi" = "yes"; then 6980 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 6981 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 6982 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 6983 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 6984 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 6985 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 6986 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 6987 fi 6988else 6989 echo "CONFIG_POSIX=y" >> $config_host_mak 6990fi 6991 6992if test "$linux" = "yes" ; then 6993 echo "CONFIG_LINUX=y" >> $config_host_mak 6994fi 6995 6996if test "$darwin" = "yes" ; then 6997 echo "CONFIG_DARWIN=y" >> $config_host_mak 6998fi 6999 7000if test "$solaris" = "yes" ; then 7001 echo "CONFIG_SOLARIS=y" >> $config_host_mak 7002fi 7003if test "$haiku" = "yes" ; then 7004 echo "CONFIG_HAIKU=y" >> $config_host_mak 7005fi 7006if test "$static" = "yes" ; then 7007 echo "CONFIG_STATIC=y" >> $config_host_mak 7008fi 7009if test "$profiler" = "yes" ; then 7010 echo "CONFIG_PROFILER=y" >> $config_host_mak 7011fi 7012if test "$want_tools" = "yes" ; then 7013 echo "CONFIG_TOOLS=y" >> $config_host_mak 7014fi 7015if test "$slirp" != "no"; then 7016 echo "CONFIG_SLIRP=y" >> $config_host_mak 7017 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 7018 echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak 7019 echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak 7020fi 7021if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then 7022 echo "config-host.h: slirp/all" >> $config_host_mak 7023fi 7024if test "$vde" = "yes" ; then 7025 echo "CONFIG_VDE=y" >> $config_host_mak 7026 echo "VDE_LIBS=$vde_libs" >> $config_host_mak 7027fi 7028if test "$netmap" = "yes" ; then 7029 echo "CONFIG_NETMAP=y" >> $config_host_mak 7030fi 7031if test "$l2tpv3" = "yes" ; then 7032 echo "CONFIG_L2TPV3=y" >> $config_host_mak 7033fi 7034if test "$gprof" = "yes" ; then 7035 echo "CONFIG_GPROF=y" >> $config_host_mak 7036fi 7037if test "$cap_ng" = "yes" ; then 7038 echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak 7039fi 7040echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 7041for drv in $audio_drv_list; do 7042 def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 7043 case "$drv" in 7044 alsa | oss | pa | sdl) 7045 echo "$def=m" >> $config_host_mak ;; 7046 *) 7047 echo "$def=y" >> $config_host_mak ;; 7048 esac 7049done 7050echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak 7051echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak 7052echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 7053echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 7054echo "OSS_LIBS=$oss_libs" >> $config_host_mak 7055echo "JACK_LIBS=$jack_libs" >> $config_host_mak 7056if test "$audio_win_int" = "yes" ; then 7057 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 7058fi 7059echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 7060echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 7061if test "$vnc" = "yes" ; then 7062 echo "CONFIG_VNC=y" >> $config_host_mak 7063fi 7064if test "$vnc_sasl" = "yes" ; then 7065 echo "CONFIG_VNC_SASL=y" >> $config_host_mak 7066fi 7067if test "$vnc_jpeg" = "yes" ; then 7068 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 7069fi 7070if test "$vnc_png" = "yes" ; then 7071 echo "CONFIG_VNC_PNG=y" >> $config_host_mak 7072fi 7073if test "$xkbcommon" = "yes" ; then 7074 echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak 7075 echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak 7076fi 7077if test "$xfs" = "yes" ; then 7078 echo "CONFIG_XFS=y" >> $config_host_mak 7079fi 7080qemu_version=$(head $source_path/VERSION) 7081echo "VERSION=$qemu_version" >>$config_host_mak 7082echo "PKGVERSION=$pkgversion" >>$config_host_mak 7083echo "SRC_PATH=$source_path" >> $config_host_mak 7084echo "TARGET_DIRS=$target_list" >> $config_host_mak 7085if [ "$docs" = "yes" ] ; then 7086 echo "BUILD_DOCS=yes" >> $config_host_mak 7087fi 7088if test "$modules" = "yes"; then 7089 # $shacmd can generate a hash started with digit, which the compiler doesn't 7090 # like as an symbol. So prefix it with an underscore 7091 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 7092 echo "CONFIG_MODULES=y" >> $config_host_mak 7093fi 7094if test "$module_upgrades" = "yes"; then 7095 echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 7096fi 7097if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then 7098 echo "CONFIG_X11=y" >> $config_host_mak 7099 echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 7100 echo "X11_LIBS=$x11_libs" >> $config_host_mak 7101fi 7102if test "$sdl" = "yes" ; then 7103 echo "CONFIG_SDL=m" >> $config_host_mak 7104 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 7105 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak 7106 if test "$sdl_image" = "yes" ; then 7107 echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak 7108 fi 7109fi 7110if test "$cocoa" = "yes" ; then 7111 echo "CONFIG_COCOA=y" >> $config_host_mak 7112fi 7113if test "$iconv" = "yes" ; then 7114 echo "CONFIG_ICONV=y" >> $config_host_mak 7115 echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak 7116 echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak 7117fi 7118if test "$curses" = "yes" ; then 7119 echo "CONFIG_CURSES=m" >> $config_host_mak 7120 echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 7121 echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 7122fi 7123if test "$pipe2" = "yes" ; then 7124 echo "CONFIG_PIPE2=y" >> $config_host_mak 7125fi 7126if test "$accept4" = "yes" ; then 7127 echo "CONFIG_ACCEPT4=y" >> $config_host_mak 7128fi 7129if test "$splice" = "yes" ; then 7130 echo "CONFIG_SPLICE=y" >> $config_host_mak 7131fi 7132if test "$eventfd" = "yes" ; then 7133 echo "CONFIG_EVENTFD=y" >> $config_host_mak 7134fi 7135if test "$memfd" = "yes" ; then 7136 echo "CONFIG_MEMFD=y" >> $config_host_mak 7137fi 7138if test "$have_usbfs" = "yes" ; then 7139 echo "CONFIG_USBFS=y" >> $config_host_mak 7140fi 7141if test "$fallocate" = "yes" ; then 7142 echo "CONFIG_FALLOCATE=y" >> $config_host_mak 7143fi 7144if test "$fallocate_punch_hole" = "yes" ; then 7145 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 7146fi 7147if test "$fallocate_zero_range" = "yes" ; then 7148 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 7149fi 7150if test "$posix_fallocate" = "yes" ; then 7151 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 7152fi 7153if test "$sync_file_range" = "yes" ; then 7154 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 7155fi 7156if test "$fiemap" = "yes" ; then 7157 echo "CONFIG_FIEMAP=y" >> $config_host_mak 7158fi 7159if test "$dup3" = "yes" ; then 7160 echo "CONFIG_DUP3=y" >> $config_host_mak 7161fi 7162if test "$ppoll" = "yes" ; then 7163 echo "CONFIG_PPOLL=y" >> $config_host_mak 7164fi 7165if test "$prctl_pr_set_timerslack" = "yes" ; then 7166 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 7167fi 7168if test "$epoll" = "yes" ; then 7169 echo "CONFIG_EPOLL=y" >> $config_host_mak 7170fi 7171if test "$epoll_create1" = "yes" ; then 7172 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 7173fi 7174if test "$sendfile" = "yes" ; then 7175 echo "CONFIG_SENDFILE=y" >> $config_host_mak 7176fi 7177if test "$timerfd" = "yes" ; then 7178 echo "CONFIG_TIMERFD=y" >> $config_host_mak 7179fi 7180if test "$setns" = "yes" ; then 7181 echo "CONFIG_SETNS=y" >> $config_host_mak 7182fi 7183if test "$clock_adjtime" = "yes" ; then 7184 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 7185fi 7186if test "$syncfs" = "yes" ; then 7187 echo "CONFIG_SYNCFS=y" >> $config_host_mak 7188fi 7189if test "$kcov" = "yes" ; then 7190 echo "CONFIG_KCOV=y" >> $config_host_mak 7191fi 7192if test "$inotify" = "yes" ; then 7193 echo "CONFIG_INOTIFY=y" >> $config_host_mak 7194fi 7195if test "$inotify1" = "yes" ; then 7196 echo "CONFIG_INOTIFY1=y" >> $config_host_mak 7197fi 7198if test "$sem_timedwait" = "yes" ; then 7199 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 7200fi 7201if test "$strchrnul" = "yes" ; then 7202 echo "HAVE_STRCHRNUL=y" >> $config_host_mak 7203fi 7204if test "$st_atim" = "yes" ; then 7205 echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak 7206fi 7207if test "$byteswap_h" = "yes" ; then 7208 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 7209fi 7210if test "$bswap_h" = "yes" ; then 7211 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 7212fi 7213if test "$curl" = "yes" ; then 7214 echo "CONFIG_CURL=m" >> $config_host_mak 7215 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 7216 echo "CURL_LIBS=$curl_libs" >> $config_host_mak 7217fi 7218if test "$brlapi" = "yes" ; then 7219 echo "CONFIG_BRLAPI=y" >> $config_host_mak 7220 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 7221fi 7222if test "$gtk" = "yes" ; then 7223 echo "CONFIG_GTK=m" >> $config_host_mak 7224 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 7225 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 7226 if test "$gtk_gl" = "yes" ; then 7227 echo "CONFIG_GTK_GL=y" >> $config_host_mak 7228 fi 7229fi 7230if test "$gio" = "yes" ; then 7231 echo "CONFIG_GIO=y" >> $config_host_mak 7232 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 7233 echo "GIO_LIBS=$gio_libs" >> $config_host_mak 7234 echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 7235fi 7236echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 7237if test "$gnutls" = "yes" ; then 7238 echo "CONFIG_GNUTLS=y" >> $config_host_mak 7239fi 7240if test "$gcrypt" = "yes" ; then 7241 echo "CONFIG_GCRYPT=y" >> $config_host_mak 7242 if test "$gcrypt_hmac" = "yes" ; then 7243 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 7244 fi 7245fi 7246if test "$nettle" = "yes" ; then 7247 echo "CONFIG_NETTLE=y" >> $config_host_mak 7248 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 7249fi 7250if test "$qemu_private_xts" = "yes" ; then 7251 echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak 7252fi 7253if test "$tasn1" = "yes" ; then 7254 echo "CONFIG_TASN1=y" >> $config_host_mak 7255fi 7256if test "$auth_pam" = "yes" ; then 7257 echo "CONFIG_AUTH_PAM=y" >> $config_host_mak 7258fi 7259if test "$have_ifaddrs_h" = "yes" ; then 7260 echo "HAVE_IFADDRS_H=y" >> $config_host_mak 7261fi 7262if test "$have_broken_size_max" = "yes" ; then 7263 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 7264fi 7265 7266# Work around a system header bug with some kernel/XFS header 7267# versions where they both try to define 'struct fsxattr': 7268# xfs headers will not try to redefine structs from linux headers 7269# if this macro is set. 7270if test "$have_fsxattr" = "yes" ; then 7271 echo "HAVE_FSXATTR=y" >> $config_host_mak 7272fi 7273if test "$have_copy_file_range" = "yes" ; then 7274 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 7275fi 7276if test "$vte" = "yes" ; then 7277 echo "CONFIG_VTE=y" >> $config_host_mak 7278 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 7279 echo "VTE_LIBS=$vte_libs" >> $config_host_mak 7280fi 7281if test "$virglrenderer" = "yes" ; then 7282 echo "CONFIG_VIRGL=y" >> $config_host_mak 7283 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 7284 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 7285fi 7286if test "$xen" = "yes" ; then 7287 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 7288 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 7289fi 7290if test "$linux_aio" = "yes" ; then 7291 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 7292fi 7293if test "$linux_io_uring" = "yes" ; then 7294 echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak 7295 echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak 7296 echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak 7297fi 7298if test "$attr" = "yes" ; then 7299 echo "CONFIG_ATTR=y" >> $config_host_mak 7300fi 7301if test "$libattr" = "yes" ; then 7302 echo "CONFIG_LIBATTR=y" >> $config_host_mak 7303fi 7304if test "$virtfs" = "yes" ; then 7305 echo "CONFIG_VIRTFS=y" >> $config_host_mak 7306fi 7307if test "$mpath" = "yes" ; then 7308 echo "CONFIG_MPATH=y" >> $config_host_mak 7309 if test "$mpathpersist_new_api" = "yes"; then 7310 echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak 7311 fi 7312fi 7313if test "$vhost_scsi" = "yes" ; then 7314 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 7315fi 7316if test "$vhost_net" = "yes" ; then 7317 echo "CONFIG_VHOST_NET=y" >> $config_host_mak 7318fi 7319if test "$vhost_net_user" = "yes" ; then 7320 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 7321fi 7322if test "$vhost_crypto" = "yes" ; then 7323 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 7324fi 7325if test "$vhost_vsock" = "yes" ; then 7326 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 7327 if test "$vhost_user" = "yes" ; then 7328 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 7329 fi 7330fi 7331if test "$vhost_kernel" = "yes" ; then 7332 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 7333fi 7334if test "$vhost_user" = "yes" ; then 7335 echo "CONFIG_VHOST_USER=y" >> $config_host_mak 7336fi 7337if test "$vhost_user_fs" = "yes" ; then 7338 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 7339fi 7340if test "$blobs" = "yes" ; then 7341 echo "INSTALL_BLOBS=yes" >> $config_host_mak 7342fi 7343if test "$iovec" = "yes" ; then 7344 echo "CONFIG_IOVEC=y" >> $config_host_mak 7345fi 7346if test "$preadv" = "yes" ; then 7347 echo "CONFIG_PREADV=y" >> $config_host_mak 7348fi 7349if test "$fdt" != "no" ; then 7350 echo "CONFIG_FDT=y" >> $config_host_mak 7351fi 7352if test "$membarrier" = "yes" ; then 7353 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 7354fi 7355if test "$signalfd" = "yes" ; then 7356 echo "CONFIG_SIGNALFD=y" >> $config_host_mak 7357fi 7358if test "$optreset" = "yes" ; then 7359 echo "HAVE_OPTRESET=y" >> $config_host_mak 7360fi 7361if test "$tcg" = "yes"; then 7362 echo "CONFIG_TCG=y" >> $config_host_mak 7363 if test "$tcg_interpreter" = "yes" ; then 7364 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 7365 fi 7366fi 7367if test "$fdatasync" = "yes" ; then 7368 echo "CONFIG_FDATASYNC=y" >> $config_host_mak 7369fi 7370if test "$madvise" = "yes" ; then 7371 echo "CONFIG_MADVISE=y" >> $config_host_mak 7372fi 7373if test "$posix_madvise" = "yes" ; then 7374 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 7375fi 7376if test "$posix_memalign" = "yes" ; then 7377 echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 7378fi 7379 7380if test "$spice" = "yes" ; then 7381 echo "CONFIG_SPICE=y" >> $config_host_mak 7382fi 7383 7384if test "$smartcard" = "yes" ; then 7385 echo "CONFIG_SMARTCARD=y" >> $config_host_mak 7386 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 7387 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 7388fi 7389 7390if test "$libusb" = "yes" ; then 7391 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 7392 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 7393 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 7394fi 7395 7396if test "$usb_redir" = "yes" ; then 7397 echo "CONFIG_USB_REDIR=y" >> $config_host_mak 7398 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 7399 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 7400fi 7401 7402if test "$opengl" = "yes" ; then 7403 echo "CONFIG_OPENGL=y" >> $config_host_mak 7404 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 7405 if test "$opengl_dmabuf" = "yes" ; then 7406 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 7407 fi 7408fi 7409 7410if test "$gbm" = "yes" ; then 7411 echo "CONFIG_GBM=y" >> $config_host_mak 7412 echo "GBM_LIBS=$gbm_libs" >> $config_host_mak 7413 echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak 7414fi 7415 7416 7417if test "$malloc_trim" = "yes" ; then 7418 echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak 7419fi 7420 7421if test "$avx2_opt" = "yes" ; then 7422 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 7423fi 7424 7425if test "$avx512f_opt" = "yes" ; then 7426 echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 7427fi 7428 7429if test "$lzo" = "yes" ; then 7430 echo "CONFIG_LZO=y" >> $config_host_mak 7431fi 7432 7433if test "$snappy" = "yes" ; then 7434 echo "CONFIG_SNAPPY=y" >> $config_host_mak 7435fi 7436 7437if test "$bzip2" = "yes" ; then 7438 echo "CONFIG_BZIP2=y" >> $config_host_mak 7439 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 7440fi 7441 7442if test "$lzfse" = "yes" ; then 7443 echo "CONFIG_LZFSE=y" >> $config_host_mak 7444 echo "LZFSE_LIBS=-llzfse" >> $config_host_mak 7445fi 7446 7447if test "$zstd" = "yes" ; then 7448 echo "CONFIG_ZSTD=y" >> $config_host_mak 7449fi 7450 7451if test "$libiscsi" = "yes" ; then 7452 echo "CONFIG_LIBISCSI=m" >> $config_host_mak 7453 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 7454 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 7455fi 7456 7457if test "$libnfs" = "yes" ; then 7458 echo "CONFIG_LIBNFS=m" >> $config_host_mak 7459 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 7460fi 7461 7462if test "$seccomp" = "yes"; then 7463 echo "CONFIG_SECCOMP=y" >> $config_host_mak 7464 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 7465 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 7466fi 7467 7468# XXX: suppress that 7469if [ "$bsd" = "yes" ] ; then 7470 echo "CONFIG_BSD=y" >> $config_host_mak 7471fi 7472 7473if test "$localtime_r" = "yes" ; then 7474 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 7475fi 7476if test "$qom_cast_debug" = "yes" ; then 7477 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 7478fi 7479if test "$rbd" = "yes" ; then 7480 echo "CONFIG_RBD=m" >> $config_host_mak 7481 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 7482 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 7483fi 7484 7485echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 7486if test "$coroutine_pool" = "yes" ; then 7487 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 7488else 7489 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 7490fi 7491 7492if test "$debug_stack_usage" = "yes" ; then 7493 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 7494fi 7495 7496if test "$crypto_afalg" = "yes" ; then 7497 echo "CONFIG_AF_ALG=y" >> $config_host_mak 7498fi 7499 7500if test "$open_by_handle_at" = "yes" ; then 7501 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 7502fi 7503 7504if test "$linux_magic_h" = "yes" ; then 7505 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 7506fi 7507 7508if test "$pragma_diagnostic_available" = "yes" ; then 7509 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 7510fi 7511 7512if test "$valgrind_h" = "yes" ; then 7513 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 7514fi 7515 7516if test "$have_asan_iface_fiber" = "yes" ; then 7517 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 7518fi 7519 7520if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 7521 echo "CONFIG_TSAN=y" >> $config_host_mak 7522fi 7523 7524if test "$has_environ" = "yes" ; then 7525 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 7526fi 7527 7528if test "$cpuid_h" = "yes" ; then 7529 echo "CONFIG_CPUID_H=y" >> $config_host_mak 7530fi 7531 7532if test "$int128" = "yes" ; then 7533 echo "CONFIG_INT128=y" >> $config_host_mak 7534fi 7535 7536if test "$atomic128" = "yes" ; then 7537 echo "CONFIG_ATOMIC128=y" >> $config_host_mak 7538fi 7539 7540if test "$cmpxchg128" = "yes" ; then 7541 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 7542fi 7543 7544if test "$atomic64" = "yes" ; then 7545 echo "CONFIG_ATOMIC64=y" >> $config_host_mak 7546fi 7547 7548if test "$attralias" = "yes" ; then 7549 echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak 7550fi 7551 7552if test "$getauxval" = "yes" ; then 7553 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 7554fi 7555 7556if test "$glusterfs" = "yes" ; then 7557 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 7558 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 7559 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 7560fi 7561 7562if test "$glusterfs_xlator_opt" = "yes" ; then 7563 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 7564fi 7565 7566if test "$glusterfs_discard" = "yes" ; then 7567 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 7568fi 7569 7570if test "$glusterfs_fallocate" = "yes" ; then 7571 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 7572fi 7573 7574if test "$glusterfs_zerofill" = "yes" ; then 7575 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 7576fi 7577 7578if test "$glusterfs_ftruncate_has_stat" = "yes" ; then 7579 echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak 7580fi 7581 7582if test "$glusterfs_iocb_has_stat" = "yes" ; then 7583 echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak 7584fi 7585 7586if test "$libssh" = "yes" ; then 7587 echo "CONFIG_LIBSSH=m" >> $config_host_mak 7588 echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 7589 echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 7590fi 7591 7592if test "$live_block_migration" = "yes" ; then 7593 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 7594fi 7595 7596if test "$tpm" = "yes"; then 7597 echo 'CONFIG_TPM=y' >> $config_host_mak 7598fi 7599 7600echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 7601if have_backend "nop"; then 7602 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 7603fi 7604if have_backend "simple"; then 7605 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 7606 # Set the appropriate trace file. 7607 trace_file="\"$trace_file-\" FMT_pid" 7608fi 7609if have_backend "log"; then 7610 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 7611fi 7612if have_backend "ust"; then 7613 echo "CONFIG_TRACE_UST=y" >> $config_host_mak 7614fi 7615if have_backend "dtrace"; then 7616 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 7617 if test "$trace_backend_stap" = "yes" ; then 7618 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 7619 fi 7620fi 7621if have_backend "ftrace"; then 7622 if test "$linux" = "yes" ; then 7623 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 7624 else 7625 feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 7626 fi 7627fi 7628if have_backend "syslog"; then 7629 if test "$posix_syslog" = "yes" ; then 7630 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 7631 else 7632 feature_not_found "syslog(trace backend)" "syslog not available" 7633 fi 7634fi 7635echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 7636 7637if test "$rdma" = "yes" ; then 7638 echo "CONFIG_RDMA=y" >> $config_host_mak 7639 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 7640fi 7641 7642if test "$pvrdma" = "yes" ; then 7643 echo "CONFIG_PVRDMA=y" >> $config_host_mak 7644fi 7645 7646if test "$have_rtnetlink" = "yes" ; then 7647 echo "CONFIG_RTNETLINK=y" >> $config_host_mak 7648fi 7649 7650if test "$libxml2" = "yes" ; then 7651 echo "CONFIG_LIBXML2=y" >> $config_host_mak 7652 echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 7653 echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 7654fi 7655 7656if test "$replication" = "yes" ; then 7657 echo "CONFIG_REPLICATION=y" >> $config_host_mak 7658fi 7659 7660if test "$have_af_vsock" = "yes" ; then 7661 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 7662fi 7663 7664if test "$have_sysmacros" = "yes" ; then 7665 echo "CONFIG_SYSMACROS=y" >> $config_host_mak 7666fi 7667 7668if test "$have_static_assert" = "yes" ; then 7669 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 7670fi 7671 7672if test "$have_utmpx" = "yes" ; then 7673 echo "HAVE_UTMPX=y" >> $config_host_mak 7674fi 7675if test "$have_getrandom" = "yes" ; then 7676 echo "CONFIG_GETRANDOM=y" >> $config_host_mak 7677fi 7678if test "$ivshmem" = "yes" ; then 7679 echo "CONFIG_IVSHMEM=y" >> $config_host_mak 7680fi 7681if test "$capstone" != "no" ; then 7682 echo "CONFIG_CAPSTONE=y" >> $config_host_mak 7683fi 7684if test "$debug_mutex" = "yes" ; then 7685 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 7686fi 7687 7688# Hold two types of flag: 7689# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 7690# a thread we have a handle to 7691# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular 7692# platform 7693if test "$pthread_setname_np_w_tid" = "yes" ; then 7694 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 7695 echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak 7696elif test "$pthread_setname_np_wo_tid" = "yes" ; then 7697 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 7698 echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak 7699fi 7700 7701if test "$vxhs" = "yes" ; then 7702 echo "CONFIG_VXHS=y" >> $config_host_mak 7703 echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak 7704fi 7705 7706if test "$libpmem" = "yes" ; then 7707 echo "CONFIG_LIBPMEM=y" >> $config_host_mak 7708fi 7709 7710if test "$bochs" = "yes" ; then 7711 echo "CONFIG_BOCHS=y" >> $config_host_mak 7712fi 7713if test "$cloop" = "yes" ; then 7714 echo "CONFIG_CLOOP=y" >> $config_host_mak 7715fi 7716if test "$dmg" = "yes" ; then 7717 echo "CONFIG_DMG=y" >> $config_host_mak 7718fi 7719if test "$qcow1" = "yes" ; then 7720 echo "CONFIG_QCOW1=y" >> $config_host_mak 7721fi 7722if test "$vdi" = "yes" ; then 7723 echo "CONFIG_VDI=y" >> $config_host_mak 7724fi 7725if test "$vvfat" = "yes" ; then 7726 echo "CONFIG_VVFAT=y" >> $config_host_mak 7727fi 7728if test "$qed" = "yes" ; then 7729 echo "CONFIG_QED=y" >> $config_host_mak 7730fi 7731if test "$parallels" = "yes" ; then 7732 echo "CONFIG_PARALLELS=y" >> $config_host_mak 7733fi 7734if test "$sheepdog" = "yes" ; then 7735 echo "CONFIG_SHEEPDOG=y" >> $config_host_mak 7736fi 7737if test "$fuzzing" = "yes" ; then 7738 if test "$have_fuzzer" = "yes"; then 7739 FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" 7740 FUZZ_CFLAGS=" -fsanitize=address,fuzzer" 7741 CFLAGS=" -fsanitize=address,fuzzer-no-link" 7742 else 7743 error_exit "Your compiler doesn't support -fsanitize=address,fuzzer" 7744 exit 1 7745 fi 7746fi 7747 7748if test "$plugins" = "yes" ; then 7749 echo "CONFIG_PLUGIN=y" >> $config_host_mak 7750 LIBS="-ldl $LIBS" 7751 # Copy the export object list to the build dir 7752 if test "$ld_dynamic_list" = "yes" ; then 7753 echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 7754 ld_symbols=qemu-plugins-ld.symbols 7755 cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 7756 elif test "$ld_exported_symbols_list" = "yes" ; then 7757 echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 7758 ld64_symbols=qemu-plugins-ld64.symbols 7759 echo "# Automatically generated by configure - do not modify" > $ld64_symbols 7760 grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 7761 sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 7762 else 7763 error_exit \ 7764 "If \$plugins=yes, either \$ld_dynamic_list or " \ 7765 "\$ld_exported_symbols_list should have been set to 'yes'." 7766 fi 7767fi 7768 7769if test -n "$gdb_bin" ; then 7770 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 7771fi 7772 7773if test "$secret_keyring" = "yes" ; then 7774 echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 7775 if test "$have_keyutils" = "yes" ; then 7776 echo "CONFIG_TEST_SECRET_KEYRING=y" >> $config_host_mak 7777 fi 7778fi 7779 7780if test "$tcg_interpreter" = "yes"; then 7781 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 7782elif test "$ARCH" = "sparc64" ; then 7783 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 7784elif test "$ARCH" = "s390x" ; then 7785 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 7786elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then 7787 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 7788elif test "$ARCH" = "ppc64" ; then 7789 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" 7790elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then 7791 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES" 7792else 7793 QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 7794fi 7795 7796echo "HELPERS=$helpers" >> $config_host_mak 7797echo "TOOLS=$tools" >> $config_host_mak 7798echo "ROMS=$roms" >> $config_host_mak 7799echo "MAKE=$make" >> $config_host_mak 7800echo "INSTALL=$install" >> $config_host_mak 7801echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 7802echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 7803echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 7804echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 7805echo "PYTHON=$python" >> $config_host_mak 7806echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak 7807echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak 7808echo "GENISOIMAGE=$genisoimage" >> $config_host_mak 7809echo "CC=$cc" >> $config_host_mak 7810if $iasl -h > /dev/null 2>&1; then 7811 echo "IASL=$iasl" >> $config_host_mak 7812fi 7813echo "HOST_CC=$host_cc" >> $config_host_mak 7814echo "CXX=$cxx" >> $config_host_mak 7815echo "OBJCC=$objcc" >> $config_host_mak 7816echo "AR=$ar" >> $config_host_mak 7817echo "ARFLAGS=$ARFLAGS" >> $config_host_mak 7818echo "AS=$as" >> $config_host_mak 7819echo "CCAS=$ccas" >> $config_host_mak 7820echo "CPP=$cpp" >> $config_host_mak 7821echo "OBJCOPY=$objcopy" >> $config_host_mak 7822echo "LD=$ld" >> $config_host_mak 7823echo "RANLIB=$ranlib" >> $config_host_mak 7824echo "NM=$nm" >> $config_host_mak 7825echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak 7826echo "WINDRES=$windres" >> $config_host_mak 7827echo "CFLAGS=$CFLAGS" >> $config_host_mak 7828echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 7829echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 7830echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 7831echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 7832if test "$sparse" = "yes" ; then 7833 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 7834 echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak 7835 echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak 7836 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 7837 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 7838fi 7839echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 7840echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 7841echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak 7842echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 7843echo "LIBS+=$LIBS" >> $config_host_mak 7844echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 7845echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 7846echo "EXESUF=$EXESUF" >> $config_host_mak 7847echo "DSOSUF=$DSOSUF" >> $config_host_mak 7848echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 7849echo "LIBS_QGA+=$libs_qga" >> $config_host_mak 7850echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 7851echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 7852echo "POD2MAN=$POD2MAN" >> $config_host_mak 7853if test "$gcov" = "yes" ; then 7854 echo "CONFIG_GCOV=y" >> $config_host_mak 7855 echo "GCOV=$gcov_tool" >> $config_host_mak 7856fi 7857 7858if test "$libudev" != "no"; then 7859 echo "CONFIG_LIBUDEV=y" >> $config_host_mak 7860 echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak 7861fi 7862if test "$fuzzing" != "no"; then 7863 echo "CONFIG_FUZZ=y" >> $config_host_mak 7864 echo "FUZZ_CFLAGS=$FUZZ_CFLAGS" >> $config_host_mak 7865 echo "FUZZ_LDFLAGS=$FUZZ_LDFLAGS" >> $config_host_mak 7866fi 7867 7868if test "$edk2_blobs" = "yes" ; then 7869 echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak 7870fi 7871 7872if test "$rng_none" = "yes"; then 7873 echo "CONFIG_RNG_NONE=y" >> $config_host_mak 7874fi 7875 7876# use included Linux headers 7877if test "$linux" = "yes" ; then 7878 mkdir -p linux-headers 7879 case "$cpu" in 7880 i386|x86_64|x32) 7881 linux_arch=x86 7882 ;; 7883 ppc|ppc64|ppc64le) 7884 linux_arch=powerpc 7885 ;; 7886 s390x) 7887 linux_arch=s390 7888 ;; 7889 aarch64) 7890 linux_arch=arm64 7891 ;; 7892 mips64) 7893 linux_arch=mips 7894 ;; 7895 *) 7896 # For most CPUs the kernel architecture name and QEMU CPU name match. 7897 linux_arch="$cpu" 7898 ;; 7899 esac 7900 # For non-KVM architectures we will not have asm headers 7901 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 7902 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 7903 fi 7904fi 7905 7906for target in $target_list; do 7907target_dir="$target" 7908config_target_mak=$target_dir/config-target.mak 7909target_name=$(echo $target | cut -d '-' -f 1) 7910target_aligned_only="no" 7911case "$target_name" in 7912 alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) 7913 target_aligned_only="yes" 7914 ;; 7915esac 7916target_bigendian="no" 7917case "$target_name" in 7918 armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 7919 target_bigendian="yes" 7920 ;; 7921esac 7922target_softmmu="no" 7923target_user_only="no" 7924target_linux_user="no" 7925target_bsd_user="no" 7926case "$target" in 7927 ${target_name}-softmmu) 7928 target_softmmu="yes" 7929 ;; 7930 ${target_name}-linux-user) 7931 target_user_only="yes" 7932 target_linux_user="yes" 7933 ;; 7934 ${target_name}-bsd-user) 7935 target_user_only="yes" 7936 target_bsd_user="yes" 7937 ;; 7938 *) 7939 error_exit "Target '$target' not recognised" 7940 exit 1 7941 ;; 7942esac 7943 7944mkdir -p $target_dir 7945echo "# Automatically generated by configure - do not modify" > $config_target_mak 7946 7947bflt="no" 7948mttcg="no" 7949interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") 7950gdb_xml_files="" 7951 7952TARGET_ARCH="$target_name" 7953TARGET_BASE_ARCH="" 7954TARGET_ABI_DIR="" 7955 7956case "$target_name" in 7957 i386) 7958 mttcg="yes" 7959 gdb_xml_files="i386-32bit.xml" 7960 TARGET_SYSTBL_ABI=i386 7961 ;; 7962 x86_64) 7963 TARGET_BASE_ARCH=i386 7964 TARGET_SYSTBL_ABI=common,64 7965 mttcg="yes" 7966 gdb_xml_files="i386-64bit.xml" 7967 ;; 7968 alpha) 7969 mttcg="yes" 7970 TARGET_SYSTBL_ABI=common 7971 ;; 7972 arm|armeb) 7973 TARGET_ARCH=arm 7974 TARGET_SYSTBL_ABI=common,oabi 7975 bflt="yes" 7976 mttcg="yes" 7977 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" 7978 ;; 7979 aarch64|aarch64_be) 7980 TARGET_ARCH=aarch64 7981 TARGET_BASE_ARCH=arm 7982 bflt="yes" 7983 mttcg="yes" 7984 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" 7985 ;; 7986 cris) 7987 ;; 7988 hppa) 7989 mttcg="yes" 7990 TARGET_SYSTBL_ABI=common,32 7991 ;; 7992 lm32) 7993 ;; 7994 m68k) 7995 bflt="yes" 7996 gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" 7997 TARGET_SYSTBL_ABI=common 7998 ;; 7999 microblaze|microblazeel) 8000 TARGET_ARCH=microblaze 8001 TARGET_SYSTBL_ABI=common 8002 bflt="yes" 8003 echo "TARGET_ABI32=y" >> $config_target_mak 8004 ;; 8005 mips|mipsel) 8006 mttcg="yes" 8007 TARGET_ARCH=mips 8008 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 8009 TARGET_SYSTBL_ABI=o32 8010 ;; 8011 mipsn32|mipsn32el) 8012 mttcg="yes" 8013 TARGET_ARCH=mips64 8014 TARGET_BASE_ARCH=mips 8015 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 8016 echo "TARGET_ABI32=y" >> $config_target_mak 8017 TARGET_SYSTBL_ABI=n32 8018 ;; 8019 mips64|mips64el) 8020 mttcg="no" 8021 TARGET_ARCH=mips64 8022 TARGET_BASE_ARCH=mips 8023 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 8024 TARGET_SYSTBL_ABI=n64 8025 ;; 8026 moxie) 8027 ;; 8028 nios2) 8029 ;; 8030 or1k) 8031 TARGET_ARCH=openrisc 8032 TARGET_BASE_ARCH=openrisc 8033 ;; 8034 ppc) 8035 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 8036 TARGET_SYSTBL_ABI=common,nospu,32 8037 ;; 8038 ppc64) 8039 TARGET_BASE_ARCH=ppc 8040 TARGET_ABI_DIR=ppc 8041 TARGET_SYSTBL_ABI=common,nospu,64 8042 mttcg=yes 8043 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 8044 ;; 8045 ppc64le) 8046 TARGET_ARCH=ppc64 8047 TARGET_BASE_ARCH=ppc 8048 TARGET_ABI_DIR=ppc 8049 TARGET_SYSTBL_ABI=common,nospu,64 8050 mttcg=yes 8051 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 8052 ;; 8053 ppc64abi32) 8054 TARGET_ARCH=ppc64 8055 TARGET_BASE_ARCH=ppc 8056 TARGET_ABI_DIR=ppc 8057 TARGET_SYSTBL_ABI=common,nospu,32 8058 echo "TARGET_ABI32=y" >> $config_target_mak 8059 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 8060 ;; 8061 riscv32) 8062 TARGET_BASE_ARCH=riscv 8063 TARGET_ABI_DIR=riscv 8064 mttcg=yes 8065 gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-32bit-csr.xml riscv-32bit-virtual.xml" 8066 ;; 8067 riscv64) 8068 TARGET_BASE_ARCH=riscv 8069 TARGET_ABI_DIR=riscv 8070 mttcg=yes 8071 gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml" 8072 ;; 8073 rx) 8074 TARGET_ARCH=rx 8075 bflt="yes" 8076 target_compiler=$cross_cc_rx 8077 gdb_xml_files="rx-core.xml" 8078 ;; 8079 sh4|sh4eb) 8080 TARGET_ARCH=sh4 8081 TARGET_SYSTBL_ABI=common 8082 bflt="yes" 8083 ;; 8084 sparc) 8085 TARGET_SYSTBL_ABI=common,32 8086 ;; 8087 sparc64) 8088 TARGET_BASE_ARCH=sparc 8089 TARGET_SYSTBL_ABI=common,64 8090 ;; 8091 sparc32plus) 8092 TARGET_ARCH=sparc64 8093 TARGET_BASE_ARCH=sparc 8094 TARGET_ABI_DIR=sparc 8095 TARGET_SYSTBL_ABI=common,32 8096 echo "TARGET_ABI32=y" >> $config_target_mak 8097 ;; 8098 s390x) 8099 TARGET_SYSTBL_ABI=common,64 8100 mttcg=yes 8101 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" 8102 ;; 8103 tilegx) 8104 ;; 8105 tricore) 8106 ;; 8107 unicore32) 8108 ;; 8109 xtensa|xtensaeb) 8110 TARGET_ARCH=xtensa 8111 TARGET_SYSTBL_ABI=common 8112 bflt="yes" 8113 mttcg="yes" 8114 ;; 8115 *) 8116 error_exit "Unsupported target CPU" 8117 ;; 8118esac 8119# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 8120if [ "$TARGET_BASE_ARCH" = "" ]; then 8121 TARGET_BASE_ARCH=$TARGET_ARCH 8122fi 8123 8124symlink "$source_path/Makefile.target" "$target_dir/Makefile" 8125 8126upper() { 8127 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 8128} 8129 8130target_arch_name="$(upper $TARGET_ARCH)" 8131echo "TARGET_$target_arch_name=y" >> $config_target_mak 8132echo "TARGET_NAME=$target_name" >> $config_target_mak 8133echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 8134if [ "$TARGET_ABI_DIR" = "" ]; then 8135 TARGET_ABI_DIR=$TARGET_ARCH 8136fi 8137echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 8138if [ "$HOST_VARIANT_DIR" != "" ]; then 8139 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 8140fi 8141if [ "$TARGET_SYSTBL_ABI" != "" ]; then 8142 echo "TARGET_SYSTBL_ABI=$TARGET_SYSTBL_ABI" >> $config_target_mak 8143fi 8144 8145if supported_xen_target $target; then 8146 echo "CONFIG_XEN=y" >> $config_target_mak 8147 echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak 8148 if test "$xen_pci_passthrough" = yes; then 8149 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 8150 fi 8151else 8152 echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak 8153fi 8154if supported_kvm_target $target; then 8155 echo "CONFIG_KVM=y" >> $config_target_mak 8156 echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak 8157else 8158 echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak 8159fi 8160if supported_hax_target $target; then 8161 echo "CONFIG_HAX=y" >> $config_target_mak 8162fi 8163if supported_hvf_target $target; then 8164 echo "CONFIG_HVF=y" >> $config_target_mak 8165fi 8166if supported_whpx_target $target; then 8167 echo "CONFIG_WHPX=y" >> $config_target_mak 8168fi 8169if test "$target_aligned_only" = "yes" ; then 8170 echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak 8171fi 8172if test "$target_bigendian" = "yes" ; then 8173 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 8174fi 8175if test "$target_softmmu" = "yes" ; then 8176 echo "CONFIG_SOFTMMU=y" >> $config_target_mak 8177 if test "$mttcg" = "yes" ; then 8178 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak 8179 fi 8180fi 8181if test "$target_user_only" = "yes" ; then 8182 echo "CONFIG_USER_ONLY=y" >> $config_target_mak 8183 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 8184fi 8185if test "$target_linux_user" = "yes" ; then 8186 echo "CONFIG_LINUX_USER=y" >> $config_target_mak 8187fi 8188list="" 8189if test ! -z "$gdb_xml_files" ; then 8190 for x in $gdb_xml_files; do 8191 list="$list $source_path/gdb-xml/$x" 8192 done 8193 echo "TARGET_XML_FILES=$list" >> $config_target_mak 8194fi 8195 8196if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then 8197 echo "TARGET_HAS_BFLT=y" >> $config_target_mak 8198fi 8199if test "$target_bsd_user" = "yes" ; then 8200 echo "CONFIG_BSD_USER=y" >> $config_target_mak 8201fi 8202 8203 8204# generate QEMU_CFLAGS/QEMU_LDFLAGS for targets 8205 8206cflags="" 8207ldflags="" 8208 8209disas_config() { 8210 echo "CONFIG_${1}_DIS=y" >> $config_target_mak 8211 echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak 8212} 8213 8214for i in $ARCH $TARGET_BASE_ARCH ; do 8215 case "$i" in 8216 alpha) 8217 disas_config "ALPHA" 8218 ;; 8219 aarch64) 8220 if test -n "${cxx}"; then 8221 disas_config "ARM_A64" 8222 fi 8223 ;; 8224 arm) 8225 disas_config "ARM" 8226 if test -n "${cxx}"; then 8227 disas_config "ARM_A64" 8228 fi 8229 ;; 8230 cris) 8231 disas_config "CRIS" 8232 ;; 8233 hppa) 8234 disas_config "HPPA" 8235 ;; 8236 i386|x86_64|x32) 8237 disas_config "I386" 8238 ;; 8239 lm32) 8240 disas_config "LM32" 8241 ;; 8242 m68k) 8243 disas_config "M68K" 8244 ;; 8245 microblaze*) 8246 disas_config "MICROBLAZE" 8247 ;; 8248 mips*) 8249 disas_config "MIPS" 8250 if test -n "${cxx}"; then 8251 disas_config "NANOMIPS" 8252 fi 8253 ;; 8254 moxie*) 8255 disas_config "MOXIE" 8256 ;; 8257 nios2) 8258 disas_config "NIOS2" 8259 ;; 8260 or1k) 8261 disas_config "OPENRISC" 8262 ;; 8263 ppc*) 8264 disas_config "PPC" 8265 ;; 8266 riscv*) 8267 disas_config "RISCV" 8268 ;; 8269 rx) 8270 disas_config "RX" 8271 ;; 8272 s390*) 8273 disas_config "S390" 8274 ;; 8275 sh4) 8276 disas_config "SH4" 8277 ;; 8278 sparc*) 8279 disas_config "SPARC" 8280 ;; 8281 xtensa*) 8282 disas_config "XTENSA" 8283 ;; 8284 esac 8285done 8286if test "$tcg_interpreter" = "yes" ; then 8287 disas_config "TCI" 8288fi 8289 8290case "$ARCH" in 8291alpha) 8292 # Ensure there's only a single GP 8293 cflags="-msmall-data $cflags" 8294;; 8295esac 8296 8297if test "$gprof" = "yes" ; then 8298 if test "$target_linux_user" = "yes" ; then 8299 cflags="-p $cflags" 8300 ldflags="-p $ldflags" 8301 fi 8302 if test "$target_softmmu" = "yes" ; then 8303 ldflags="-p $ldflags" 8304 echo "GPROF_CFLAGS=-p" >> $config_target_mak 8305 fi 8306fi 8307 8308# Newer kernels on s390 check for an S390_PGSTE program header and 8309# enable the pgste page table extensions in that case. This makes 8310# the vm.allocate_pgste sysctl unnecessary. We enable this program 8311# header if 8312# - we build on s390x 8313# - we build the system emulation for s390x (qemu-system-s390x) 8314# - KVM is enabled 8315# - the linker supports --s390-pgste 8316if test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \ 8317 test "$ARCH" = "s390x" && test "$kvm" = "yes"; then 8318 if ld_has --s390-pgste ; then 8319 ldflags="-Wl,--s390-pgste $ldflags" 8320 fi 8321fi 8322 8323echo "QEMU_LDFLAGS+=$ldflags" >> $config_target_mak 8324echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak 8325 8326done # for target in $targets 8327 8328echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak 8329echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak 8330 8331if [ "$fdt" = "git" ]; then 8332 echo "config-host.h: dtc/all" >> $config_host_mak 8333fi 8334if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then 8335 echo "config-host.h: capstone/all" >> $config_host_mak 8336fi 8337if test -n "$LIBCAPSTONE"; then 8338 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak 8339fi 8340 8341if test "$numa" = "yes"; then 8342 echo "CONFIG_NUMA=y" >> $config_host_mak 8343fi 8344 8345if test "$ccache_cpp2" = "yes"; then 8346 echo "export CCACHE_CPP2=y" >> $config_host_mak 8347fi 8348 8349# If we're using a separate build tree, set it up now. 8350# DIRS are directories which we simply mkdir in the build tree; 8351# LINKS are things to symlink back into the source tree 8352# (these can be both files and directories). 8353# Caution: do not add files or directories here using wildcards. This 8354# will result in problems later if a new file matching the wildcard is 8355# added to the source tree -- nothing will cause configure to be rerun 8356# so the build tree will be missing the link back to the new file, and 8357# tests might fail. Prefer to keep the relevant files in their own 8358# directory and symlink the directory instead. 8359DIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" 8360DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 8361DIRS="$DIRS docs docs/interop fsdev scsi" 8362DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 8363DIRS="$DIRS roms/seabios roms/vgabios" 8364LINKS="Makefile" 8365LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile" 8366LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile" 8367LINKS="$LINKS tests/plugin/Makefile" 8368LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" 8369LINKS="$LINKS pc-bios/s390-ccw/Makefile" 8370LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" 8371LINKS="$LINKS pc-bios/qemu-icon.bmp" 8372LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 8373LINKS="$LINKS tests/acceptance tests/data" 8374LINKS="$LINKS tests/qemu-iotests/check" 8375LINKS="$LINKS python" 8376for bios_file in \ 8377 $source_path/pc-bios/*.bin \ 8378 $source_path/pc-bios/*.lid \ 8379 $source_path/pc-bios/*.rom \ 8380 $source_path/pc-bios/*.dtb \ 8381 $source_path/pc-bios/*.img \ 8382 $source_path/pc-bios/openbios-* \ 8383 $source_path/pc-bios/u-boot.* \ 8384 $source_path/pc-bios/edk2-*.fd.bz2 \ 8385 $source_path/pc-bios/palcode-* 8386do 8387 LINKS="$LINKS pc-bios/$(basename $bios_file)" 8388done 8389mkdir -p $DIRS 8390for f in $LINKS ; do 8391 if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then 8392 symlink "$source_path/$f" "$f" 8393 fi 8394done 8395 8396(for i in $cross_cc_vars; do 8397 export $i 8398done 8399export target_list source_path use_containers 8400$source_path/tests/tcg/configure.sh) 8401 8402# temporary config to build submodules 8403for rom in seabios vgabios ; do 8404 config_mak=roms/$rom/config.mak 8405 echo "# Automatically generated by configure - do not modify" > $config_mak 8406 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 8407 echo "AS=$as" >> $config_mak 8408 echo "CCAS=$ccas" >> $config_mak 8409 echo "CC=$cc" >> $config_mak 8410 echo "BCC=bcc" >> $config_mak 8411 echo "CPP=$cpp" >> $config_mak 8412 echo "OBJCOPY=objcopy" >> $config_mak 8413 echo "IASL=$iasl" >> $config_mak 8414 echo "LD=$ld" >> $config_mak 8415 echo "RANLIB=$ranlib" >> $config_mak 8416done 8417 8418# set up qemu-iotests in this build directory 8419iotests_common_env="tests/qemu-iotests/common.env" 8420 8421echo "# Automatically generated by configure - do not modify" > "$iotests_common_env" 8422echo >> "$iotests_common_env" 8423echo "export PYTHON='$python'" >> "$iotests_common_env" 8424 8425# Save the configure command line for later reuse. 8426cat <<EOD >config.status 8427#!/bin/sh 8428# Generated by configure. 8429# Run this file to recreate the current configuration. 8430# Compiler output produced by configure, useful for debugging 8431# configure, is in config.log if it exists. 8432EOD 8433 8434preserve_env() { 8435 envname=$1 8436 8437 eval envval=\$$envname 8438 8439 if test -n "$envval" 8440 then 8441 echo "$envname='$envval'" >> config.status 8442 echo "export $envname" >> config.status 8443 else 8444 echo "unset $envname" >> config.status 8445 fi 8446} 8447 8448# Preserve various env variables that influence what 8449# features/build target configure will detect 8450preserve_env AR 8451preserve_env AS 8452preserve_env CC 8453preserve_env CPP 8454preserve_env CXX 8455preserve_env INSTALL 8456preserve_env LD 8457preserve_env LD_LIBRARY_PATH 8458preserve_env LIBTOOL 8459preserve_env MAKE 8460preserve_env NM 8461preserve_env OBJCOPY 8462preserve_env PATH 8463preserve_env PKG_CONFIG 8464preserve_env PKG_CONFIG_LIBDIR 8465preserve_env PKG_CONFIG_PATH 8466preserve_env PYTHON 8467preserve_env SDL2_CONFIG 8468preserve_env SMBD 8469preserve_env STRIP 8470preserve_env WINDRES 8471 8472printf "exec" >>config.status 8473printf " '%s'" "$0" "$@" >>config.status 8474echo ' "$@"' >>config.status 8475chmod +x config.status 8476 8477rm -r "$TMPDIR1" 8478