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