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