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