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