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