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