1#!/bin/sh 2# 3# qemu configure script (c) 2003 Fabrice Bellard 4# 5 6# Unset some variables known to interfere with behavior of common tools, 7# just as autoconf does. 8CLICOLOR_FORCE= GREP_OPTIONS= 9unset CLICOLOR_FORCE GREP_OPTIONS 10 11# Don't allow CCACHE, if present, to use cached results of compile tests! 12export CCACHE_RECACHE=yes 13 14# make source path absolute 15source_path=$(cd "$(dirname -- "$0")"; pwd) 16 17if test "$PWD" = "$source_path" 18then 19 echo "Using './build' as the directory for build output" 20 21 MARKER=build/auto-created-by-configure 22 23 if test -e build 24 then 25 if test -f $MARKER 26 then 27 rm -rf build 28 else 29 echo "ERROR: ./build dir already exists and was not previously created by configure" 30 exit 1 31 fi 32 fi 33 34 mkdir build 35 touch $MARKER 36 37 cat > GNUmakefile <<'EOF' 38# This file is auto-generated by configure to support in-source tree 39# 'make' command invocation 40 41ifeq ($(MAKECMDGOALS),) 42recurse: all 43endif 44 45.NOTPARALLEL: % 46%: force 47 @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...' 48 @$(MAKE) -C build -f Makefile $(MAKECMDGOALS) 49 @if test "$(MAKECMDGOALS)" = "distclean" && \ 50 test -e build/auto-created-by-configure ; \ 51 then \ 52 rm -rf build GNUmakefile ; \ 53 fi 54force: ; 55.PHONY: force 56GNUmakefile: ; 57 58EOF 59 cd build 60 exec $source_path/configure "$@" 61fi 62 63# Temporary directory used for files created while 64# configure runs. Since it is in the build directory 65# we can safely blow away any previous version of it 66# (and we need not jump through hoops to try to delete 67# it when configure exits.) 68TMPDIR1="config-temp" 69rm -rf "${TMPDIR1}" 70mkdir -p "${TMPDIR1}" 71if [ $? -ne 0 ]; then 72 echo "ERROR: failed to create temporary directory" 73 exit 1 74fi 75 76TMPB="qemu-conf" 77TMPC="${TMPDIR1}/${TMPB}.c" 78TMPO="${TMPDIR1}/${TMPB}.o" 79TMPCXX="${TMPDIR1}/${TMPB}.cxx" 80TMPE="${TMPDIR1}/${TMPB}.exe" 81TMPTXT="${TMPDIR1}/${TMPB}.txt" 82 83rm -f config.log 84 85# Print a helpful header at the top of config.log 86echo "# QEMU configure log $(date)" >> config.log 87printf "# Configured with:" >> config.log 88printf " '%s'" "$0" "$@" >> config.log 89echo >> config.log 90echo "#" >> config.log 91 92quote_sh() { 93 printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," 94} 95 96print_error() { 97 (echo 98 echo "ERROR: $1" 99 while test -n "$2"; do 100 echo " $2" 101 shift 102 done 103 echo) >&2 104} 105 106error_exit() { 107 print_error "$@" 108 exit 1 109} 110 111do_compiler() { 112 # Run the compiler, capturing its output to the log. First argument 113 # is compiler binary to execute. 114 compiler="$1" 115 shift 116 if test -n "$BASH_VERSION"; then eval ' 117 echo >>config.log " 118funcs: ${FUNCNAME[*]} 119lines: ${BASH_LINENO[*]}" 120 '; fi 121 echo $compiler "$@" >> config.log 122 $compiler "$@" >> config.log 2>&1 || return $? 123 # Test passed. If this is an --enable-werror build, rerun 124 # the test with -Werror and bail out if it fails. This 125 # makes warning-generating-errors in configure test code 126 # obvious to developers. 127 if test "$werror" != "yes"; then 128 return 0 129 fi 130 # Don't bother rerunning the compile if we were already using -Werror 131 case "$*" in 132 *-Werror*) 133 return 0 134 ;; 135 esac 136 echo $compiler -Werror "$@" >> config.log 137 $compiler -Werror "$@" >> config.log 2>&1 && return $? 138 error_exit "configure test passed without -Werror but failed with -Werror." \ 139 "This is probably a bug in the configure script. The failing command" \ 140 "will be at the bottom of config.log." \ 141 "You can run configure with --disable-werror to bypass this check." 142} 143 144do_cc() { 145 do_compiler "$cc" $CPU_CFLAGS "$@" 146} 147 148do_cxx() { 149 do_compiler "$cxx" $CPU_CFLAGS "$@" 150} 151 152# Append $2 to the variable named $1, with space separation 153add_to() { 154 eval $1=\${$1:+\"\$$1 \"}\$2 155} 156 157update_cxxflags() { 158 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 159 # options which some versions of GCC's C++ compiler complain about 160 # because they only make sense for C programs. 161 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 162 CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu11/-std=gnu++11/) 163 for arg in $QEMU_CFLAGS; do 164 case $arg in 165 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 166 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 167 ;; 168 *) 169 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 170 ;; 171 esac 172 done 173} 174 175compile_object() { 176 local_cflags="$1" 177 do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 178} 179 180compile_prog() { 181 local_cflags="$1" 182 local_ldflags="$2" 183 do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \ 184 $LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags 185} 186 187# symbolically link $1 to $2. Portable version of "ln -sf". 188symlink() { 189 rm -rf "$2" 190 mkdir -p "$(dirname "$2")" 191 ln -s "$1" "$2" 192} 193 194# check whether a command is available to this shell (may be either an 195# executable or a builtin) 196has() { 197 type "$1" >/dev/null 2>&1 198} 199 200version_ge () { 201 local_ver1=$(expr "$1" : '\([0-9.]*\)' | tr . ' ') 202 local_ver2=$(echo "$2" | tr . ' ') 203 while true; do 204 set x $local_ver1 205 local_first=${2-0} 206 # 'shift 2' if $2 is set, or 'shift' if $2 is not set 207 shift ${2:+2} 208 local_ver1=$* 209 set x $local_ver2 210 # the second argument finished, the first must be greater or equal 211 test $# = 1 && return 0 212 test $local_first -lt $2 && return 1 213 test $local_first -gt $2 && return 0 214 shift ${2:+2} 215 local_ver2=$* 216 done 217} 218 219glob() { 220 eval test -z '"${1#'"$2"'}"' 221} 222 223ld_has() { 224 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 225} 226 227if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 228then 229 error_exit "main directory cannot contain spaces nor colons" 230fi 231 232# default parameters 233cpu="" 234iasl="iasl" 235interp_prefix="/usr/gnemul/qemu-%M" 236static="no" 237cross_compile="no" 238cross_prefix="" 239audio_drv_list="default" 240block_drv_rw_whitelist="" 241block_drv_ro_whitelist="" 242block_drv_whitelist_tools="no" 243host_cc="cc" 244libs_qga="" 245debug_info="yes" 246lto="false" 247stack_protector="" 248safe_stack="" 249use_containers="yes" 250gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 251 252if test -e "$source_path/.git" 253then 254 git_submodules_action="update" 255else 256 git_submodules_action="ignore" 257fi 258 259git_submodules="ui/keycodemapdb" 260git="git" 261 262# Don't accept a target_list environment variable. 263unset target_list 264unset target_list_exclude 265 266# Default value for a variable defining feature "foo". 267# * foo="no" feature will only be used if --enable-foo arg is given 268# * foo="" feature will be searched for, and if found, will be used 269# unless --disable-foo is given 270# * foo="yes" this value will only be set by --enable-foo flag. 271# feature will searched for, 272# if not found, configure exits with error 273# 274# Always add --enable-foo and --disable-foo command line args. 275# Distributions want to ensure that several features are compiled in, and it 276# is impossible without a --enable-foo that exits if a feature is not found. 277 278default_feature="" 279# parse CC options second 280for opt do 281 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 282 case "$opt" in 283 --without-default-features) 284 default_feature="no" 285 ;; 286 esac 287done 288 289brlapi="auto" 290curl="auto" 291iconv="auto" 292curses="auto" 293docs="auto" 294fdt="auto" 295netmap="no" 296sdl="auto" 297sdl_image="auto" 298virtiofsd="auto" 299virtfs="auto" 300libudev="auto" 301mpath="auto" 302vnc="auto" 303sparse="auto" 304vde="auto" 305vnc_sasl="auto" 306vnc_jpeg="auto" 307vnc_png="auto" 308xkbcommon="auto" 309alsa="auto" 310coreaudio="auto" 311dsound="auto" 312jack="auto" 313oss="auto" 314pa="auto" 315xen=${default_feature:+disabled} 316xen_ctrl_version="$default_feature" 317xen_pci_passthrough="auto" 318linux_aio="auto" 319linux_io_uring="auto" 320cap_ng="auto" 321attr="auto" 322xfs="$default_feature" 323tcg="enabled" 324membarrier="$default_feature" 325vhost_kernel="$default_feature" 326vhost_net="$default_feature" 327vhost_crypto="$default_feature" 328vhost_scsi="$default_feature" 329vhost_vsock="$default_feature" 330vhost_user="no" 331vhost_user_blk_server="auto" 332vhost_user_fs="$default_feature" 333vhost_vdpa="$default_feature" 334bpf="auto" 335kvm="auto" 336hax="auto" 337hvf="auto" 338whpx="auto" 339nvmm="auto" 340rdma="$default_feature" 341pvrdma="$default_feature" 342gprof="no" 343debug_tcg="no" 344debug="no" 345sanitizers="no" 346tsan="no" 347fortify_source="$default_feature" 348strip_opt="yes" 349tcg_interpreter="false" 350mingw32="no" 351gcov="no" 352EXESUF="" 353modules="no" 354module_upgrades="no" 355prefix="/usr/local" 356qemu_suffix="qemu" 357slirp="auto" 358bsd="no" 359linux="no" 360solaris="no" 361profiler="no" 362cocoa="auto" 363softmmu="yes" 364linux_user="no" 365bsd_user="no" 366blobs="true" 367pkgversion="" 368pie="" 369qom_cast_debug="yes" 370trace_backends="log" 371trace_file="trace" 372spice="$default_feature" 373spice_protocol="auto" 374rbd="auto" 375smartcard="auto" 376u2f="auto" 377libusb="auto" 378usb_redir="auto" 379opengl="$default_feature" 380cpuid_h="no" 381avx2_opt="$default_feature" 382capstone="auto" 383lzo="auto" 384snappy="auto" 385bzip2="auto" 386lzfse="auto" 387zstd="auto" 388guest_agent="$default_feature" 389guest_agent_with_vss="no" 390guest_agent_ntddscsi="no" 391guest_agent_msi="auto" 392vss_win32_sdk="$default_feature" 393win_sdk="no" 394want_tools="$default_feature" 395libiscsi="auto" 396libnfs="auto" 397coroutine="" 398coroutine_pool="$default_feature" 399debug_stack_usage="no" 400crypto_afalg="no" 401cfi="false" 402cfi_debug="false" 403seccomp="auto" 404glusterfs="auto" 405gtk="auto" 406tls_priority="NORMAL" 407gnutls="auto" 408nettle="auto" 409gcrypt="auto" 410auth_pam="auto" 411vte="auto" 412virglrenderer="auto" 413tpm="$default_feature" 414libssh="$default_feature" 415live_block_migration=${default_feature:-yes} 416numa="$default_feature" 417tcmalloc="no" 418jemalloc="no" 419replication=${default_feature:-yes} 420bochs=${default_feature:-yes} 421cloop=${default_feature:-yes} 422dmg=${default_feature:-yes} 423qcow1=${default_feature:-yes} 424vdi=${default_feature:-yes} 425vvfat=${default_feature:-yes} 426qed=${default_feature:-yes} 427parallels=${default_feature:-yes} 428libxml2="auto" 429debug_mutex="no" 430libpmem="auto" 431default_devices="true" 432plugins="$default_feature" 433fuzzing="false" 434rng_none="no" 435secret_keyring="$default_feature" 436libdaxctl="auto" 437meson="" 438ninja="" 439skip_meson=no 440gettext="auto" 441fuse="auto" 442fuse_lseek="auto" 443multiprocess="auto" 444slirp_smbd="$default_feature" 445 446malloc_trim="auto" 447gio="$default_feature" 448 449# parse CC options second 450for opt do 451 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 452 case "$opt" in 453 --cross-prefix=*) cross_prefix="$optarg" 454 cross_compile="yes" 455 ;; 456 --cc=*) CC="$optarg" 457 ;; 458 --cxx=*) CXX="$optarg" 459 ;; 460 --cpu=*) cpu="$optarg" 461 ;; 462 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 463 QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 464 ;; 465 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 466 ;; 467 --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 468 EXTRA_LDFLAGS="$optarg" 469 ;; 470 --enable-debug-info) debug_info="yes" 471 ;; 472 --disable-debug-info) debug_info="no" 473 ;; 474 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 475 ;; 476 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 477 eval "cross_cc_cflags_${cc_arch}=\$optarg" 478 cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 479 ;; 480 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 481 cc_archs="$cc_archs $cc_arch" 482 eval "cross_cc_${cc_arch}=\$optarg" 483 cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 484 ;; 485 esac 486done 487# OS specific 488# Using uname is really, really broken. Once we have the right set of checks 489# we can eliminate its usage altogether. 490 491# Preferred compiler: 492# ${CC} (if set) 493# ${cross_prefix}gcc (if cross-prefix specified) 494# system compiler 495if test -z "${CC}${cross_prefix}"; then 496 cc="$host_cc" 497else 498 cc="${CC-${cross_prefix}gcc}" 499fi 500 501if test -z "${CXX}${cross_prefix}"; then 502 cxx="c++" 503else 504 cxx="${CXX-${cross_prefix}g++}" 505fi 506 507ar="${AR-${cross_prefix}ar}" 508as="${AS-${cross_prefix}as}" 509ccas="${CCAS-$cc}" 510cpp="${CPP-$cc -E}" 511objcopy="${OBJCOPY-${cross_prefix}objcopy}" 512ld="${LD-${cross_prefix}ld}" 513ranlib="${RANLIB-${cross_prefix}ranlib}" 514nm="${NM-${cross_prefix}nm}" 515strip="${STRIP-${cross_prefix}strip}" 516windres="${WINDRES-${cross_prefix}windres}" 517pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 518query_pkg_config() { 519 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 520} 521pkg_config=query_pkg_config 522sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 523 524# default flags for all hosts 525# We use -fwrapv to tell the compiler that we require a C dialect where 526# left shift of signed integers is well defined and has the expected 527# 2s-complement style results. (Both clang and gcc agree that it 528# provides these semantics.) 529QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 530QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 531QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 532QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 533 534# Flags that are needed during configure but later taken care of by Meson 535CONFIGURE_CFLAGS="-std=gnu11 -Wall" 536CONFIGURE_LDFLAGS= 537 538 539check_define() { 540cat > $TMPC <<EOF 541#if !defined($1) 542#error $1 not defined 543#endif 544int main(void) { return 0; } 545EOF 546 compile_object 547} 548 549check_include() { 550cat > $TMPC <<EOF 551#include <$1> 552int main(void) { return 0; } 553EOF 554 compile_object 555} 556 557write_c_skeleton() { 558 cat > $TMPC <<EOF 559int main(void) { return 0; } 560EOF 561} 562 563if check_define __linux__ ; then 564 targetos="Linux" 565elif check_define _WIN32 ; then 566 targetos='MINGW32' 567elif check_define __OpenBSD__ ; then 568 targetos='OpenBSD' 569elif check_define __sun__ ; then 570 targetos='SunOS' 571elif check_define __HAIKU__ ; then 572 targetos='Haiku' 573elif check_define __FreeBSD__ ; then 574 targetos='FreeBSD' 575elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 576 targetos='GNU/kFreeBSD' 577elif check_define __DragonFly__ ; then 578 targetos='DragonFly' 579elif check_define __NetBSD__; then 580 targetos='NetBSD' 581elif check_define __APPLE__; then 582 targetos='Darwin' 583else 584 # This is a fatal error, but don't report it yet, because we 585 # might be going to just print the --help text, or it might 586 # be the result of a missing compiler. 587 targetos='bogus' 588fi 589 590# Some host OSes need non-standard checks for which CPU to use. 591# Note that these checks are broken for cross-compilation: if you're 592# cross-compiling to one of these OSes then you'll need to specify 593# the correct CPU with the --cpu option. 594case $targetos in 595SunOS) 596 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 597 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 598 cpu="x86_64" 599 fi 600esac 601 602if test ! -z "$cpu" ; then 603 # command line argument 604 : 605elif check_define __i386__ ; then 606 cpu="i386" 607elif check_define __x86_64__ ; then 608 if check_define __ILP32__ ; then 609 cpu="x32" 610 else 611 cpu="x86_64" 612 fi 613elif check_define __sparc__ ; then 614 if check_define __arch64__ ; then 615 cpu="sparc64" 616 else 617 cpu="sparc" 618 fi 619elif check_define _ARCH_PPC ; then 620 if check_define _ARCH_PPC64 ; then 621 if check_define _LITTLE_ENDIAN ; then 622 cpu="ppc64le" 623 else 624 cpu="ppc64" 625 fi 626 else 627 cpu="ppc" 628 fi 629elif check_define __mips__ ; then 630 cpu="mips" 631elif check_define __s390__ ; then 632 if check_define __s390x__ ; then 633 cpu="s390x" 634 else 635 cpu="s390" 636 fi 637elif check_define __riscv ; then 638 if check_define _LP64 ; then 639 cpu="riscv64" 640 else 641 cpu="riscv32" 642 fi 643elif check_define __arm__ ; then 644 cpu="arm" 645elif check_define __aarch64__ ; then 646 cpu="aarch64" 647else 648 cpu=$(uname -m) 649fi 650 651ARCH= 652# Normalise host CPU name and set ARCH. 653# Note that this case should only have supported host CPUs, not guests. 654case "$cpu" in 655 ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 656 ;; 657 ppc64le) 658 ARCH="ppc64" 659 ;; 660 i386|i486|i586|i686|i86pc|BePC) 661 cpu="i386" 662 ;; 663 x86_64|amd64) 664 cpu="x86_64" 665 ;; 666 armv*b|armv*l|arm) 667 cpu="arm" 668 ;; 669 aarch64) 670 cpu="aarch64" 671 ;; 672 mips*) 673 cpu="mips" 674 ;; 675 sparc|sun4[cdmuv]) 676 cpu="sparc" 677 ;; 678 *) 679 # This will result in either an error or falling back to TCI later 680 ARCH=unknown 681 ;; 682esac 683if test -z "$ARCH"; then 684 ARCH="$cpu" 685fi 686 687# OS specific 688 689case $targetos in 690MINGW32*) 691 mingw32="yes" 692 supported_os="yes" 693 plugins="no" 694 pie="no" 695;; 696GNU/kFreeBSD) 697 bsd="yes" 698;; 699FreeBSD) 700 bsd="yes" 701 bsd_user="yes" 702 make="${MAKE-gmake}" 703 # needed for kinfo_getvmmap(3) in libutil.h 704 netmap="" # enable netmap autodetect 705;; 706DragonFly) 707 bsd="yes" 708 make="${MAKE-gmake}" 709;; 710NetBSD) 711 bsd="yes" 712 make="${MAKE-gmake}" 713;; 714OpenBSD) 715 bsd="yes" 716 make="${MAKE-gmake}" 717;; 718Darwin) 719 bsd="yes" 720 darwin="yes" 721 # Disable attempts to use ObjectiveC features in os/object.h since they 722 # won't work when we're compiling with gcc as a C compiler. 723 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 724;; 725SunOS) 726 solaris="yes" 727 make="${MAKE-gmake}" 728 smbd="${SMBD-/usr/sfw/sbin/smbd}" 729# needed for CMSG_ macros in sys/socket.h 730 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 731# needed for TIOCWIN* defines in termios.h 732 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 733;; 734Haiku) 735 haiku="yes" 736 pie="no" 737 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" 738;; 739Linux) 740 linux="yes" 741 linux_user="yes" 742 vhost_user=${default_feature:-yes} 743;; 744esac 745 746: ${make=${MAKE-make}} 747 748# We prefer python 3.x. A bare 'python' is traditionally 749# python 2.x, but some distros have it as python 3.x, so 750# we check that too 751python= 752explicit_python=no 753for binary in "${PYTHON-python3}" python 754do 755 if has "$binary" 756 then 757 python=$(command -v "$binary") 758 break 759 fi 760done 761 762 763# Check for ancillary tools used in testing 764genisoimage= 765for binary in genisoimage mkisofs 766do 767 if has $binary 768 then 769 genisoimage=$(command -v "$binary") 770 break 771 fi 772done 773 774# Default objcc to clang if available, otherwise use CC 775if has clang; then 776 objcc=clang 777else 778 objcc="$cc" 779fi 780 781if test "$mingw32" = "yes" ; then 782 EXESUF=".exe" 783 # MinGW needs -mthreads for TLS and macro _MT. 784 CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS" 785 write_c_skeleton; 786 prefix="/qemu" 787 qemu_suffix="" 788 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 789fi 790 791werror="" 792 793for opt do 794 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 795 case "$opt" in 796 --help|-h) show_help=yes 797 ;; 798 --version|-V) exec cat $source_path/VERSION 799 ;; 800 --prefix=*) prefix="$optarg" 801 ;; 802 --interp-prefix=*) interp_prefix="$optarg" 803 ;; 804 --cross-prefix=*) 805 ;; 806 --cc=*) 807 ;; 808 --host-cc=*) host_cc="$optarg" 809 ;; 810 --cxx=*) 811 ;; 812 --iasl=*) iasl="$optarg" 813 ;; 814 --objcc=*) objcc="$optarg" 815 ;; 816 --make=*) make="$optarg" 817 ;; 818 --install=*) 819 ;; 820 --python=*) python="$optarg" ; explicit_python=yes 821 ;; 822 --sphinx-build=*) sphinx_build="$optarg" 823 ;; 824 --skip-meson) skip_meson=yes 825 ;; 826 --meson=*) meson="$optarg" 827 ;; 828 --ninja=*) ninja="$optarg" 829 ;; 830 --smbd=*) smbd="$optarg" 831 ;; 832 --extra-cflags=*) 833 ;; 834 --extra-cxxflags=*) 835 ;; 836 --extra-ldflags=*) 837 ;; 838 --enable-debug-info) 839 ;; 840 --disable-debug-info) 841 ;; 842 --cross-cc-*) 843 ;; 844 --enable-modules) 845 modules="yes" 846 ;; 847 --disable-modules) 848 modules="no" 849 ;; 850 --disable-module-upgrades) module_upgrades="no" 851 ;; 852 --enable-module-upgrades) module_upgrades="yes" 853 ;; 854 --cpu=*) 855 ;; 856 --target-list=*) target_list="$optarg" 857 if test "$target_list_exclude"; then 858 error_exit "Can't mix --target-list with --target-list-exclude" 859 fi 860 ;; 861 --target-list-exclude=*) target_list_exclude="$optarg" 862 if test "$target_list"; then 863 error_exit "Can't mix --target-list-exclude with --target-list" 864 fi 865 ;; 866 --enable-trace-backends=*) trace_backends="$optarg" 867 ;; 868 # XXX: backwards compatibility 869 --enable-trace-backend=*) trace_backends="$optarg" 870 ;; 871 --with-trace-file=*) trace_file="$optarg" 872 ;; 873 --with-default-devices) default_devices="true" 874 ;; 875 --without-default-devices) default_devices="false" 876 ;; 877 --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option" 878 ;; 879 --with-devices-*) device_arch=${opt#--with-devices-}; 880 device_arch=${device_arch%%=*} 881 cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak 882 if test -f "$cf"; then 883 device_archs="$device_archs $device_arch" 884 eval "devices_${device_arch}=\$optarg" 885 else 886 error_exit "File $cf does not exist" 887 fi 888 ;; 889 --without-default-features) # processed above 890 ;; 891 --enable-gprof) gprof="yes" 892 ;; 893 --enable-gcov) gcov="yes" 894 ;; 895 --static) 896 static="yes" 897 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 898 ;; 899 --mandir=*) mandir="$optarg" 900 ;; 901 --bindir=*) bindir="$optarg" 902 ;; 903 --libdir=*) libdir="$optarg" 904 ;; 905 --libexecdir=*) libexecdir="$optarg" 906 ;; 907 --includedir=*) includedir="$optarg" 908 ;; 909 --datadir=*) datadir="$optarg" 910 ;; 911 --with-suffix=*) qemu_suffix="$optarg" 912 ;; 913 --docdir=*) docdir="$optarg" 914 ;; 915 --localedir=*) localedir="$optarg" 916 ;; 917 --sysconfdir=*) sysconfdir="$optarg" 918 ;; 919 --localstatedir=*) local_statedir="$optarg" 920 ;; 921 --firmwarepath=*) firmwarepath="$optarg" 922 ;; 923 --host=*|--build=*|\ 924 --disable-dependency-tracking|\ 925 --sbindir=*|--sharedstatedir=*|\ 926 --oldincludedir=*|--datarootdir=*|--infodir=*|\ 927 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 928 # These switches are silently ignored, for compatibility with 929 # autoconf-generated configure scripts. This allows QEMU's 930 # configure to be used by RPM and similar macros that set 931 # lots of directory switches by default. 932 ;; 933 --disable-sdl) sdl="disabled" 934 ;; 935 --enable-sdl) sdl="enabled" 936 ;; 937 --disable-sdl-image) sdl_image="disabled" 938 ;; 939 --enable-sdl-image) sdl_image="enabled" 940 ;; 941 --disable-qom-cast-debug) qom_cast_debug="no" 942 ;; 943 --enable-qom-cast-debug) qom_cast_debug="yes" 944 ;; 945 --disable-virtfs) virtfs="disabled" 946 ;; 947 --enable-virtfs) virtfs="enabled" 948 ;; 949 --disable-libudev) libudev="disabled" 950 ;; 951 --enable-libudev) libudev="enabled" 952 ;; 953 --disable-virtiofsd) virtiofsd="disabled" 954 ;; 955 --enable-virtiofsd) virtiofsd="enabled" 956 ;; 957 --disable-mpath) mpath="disabled" 958 ;; 959 --enable-mpath) mpath="enabled" 960 ;; 961 --disable-vnc) vnc="disabled" 962 ;; 963 --enable-vnc) vnc="enabled" 964 ;; 965 --disable-gettext) gettext="disabled" 966 ;; 967 --enable-gettext) gettext="enabled" 968 ;; 969 --audio-drv-list=*) audio_drv_list="$optarg" 970 ;; 971 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 972 ;; 973 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 974 ;; 975 --enable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="yes" 976 ;; 977 --disable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="no" 978 ;; 979 --enable-debug-tcg) debug_tcg="yes" 980 ;; 981 --disable-debug-tcg) debug_tcg="no" 982 ;; 983 --enable-debug) 984 # Enable debugging options that aren't excessively noisy 985 debug_tcg="yes" 986 debug_mutex="yes" 987 debug="yes" 988 strip_opt="no" 989 fortify_source="no" 990 ;; 991 --enable-sanitizers) sanitizers="yes" 992 ;; 993 --disable-sanitizers) sanitizers="no" 994 ;; 995 --enable-tsan) tsan="yes" 996 ;; 997 --disable-tsan) tsan="no" 998 ;; 999 --enable-sparse) sparse="enabled" 1000 ;; 1001 --disable-sparse) sparse="disabled" 1002 ;; 1003 --disable-strip) strip_opt="no" 1004 ;; 1005 --disable-vnc-sasl) vnc_sasl="disabled" 1006 ;; 1007 --enable-vnc-sasl) vnc_sasl="enabled" 1008 ;; 1009 --disable-vnc-jpeg) vnc_jpeg="disabled" 1010 ;; 1011 --enable-vnc-jpeg) vnc_jpeg="enabled" 1012 ;; 1013 --disable-vnc-png) vnc_png="disabled" 1014 ;; 1015 --enable-vnc-png) vnc_png="enabled" 1016 ;; 1017 --disable-slirp) slirp="disabled" 1018 ;; 1019 --enable-slirp) slirp="enabled" 1020 ;; 1021 --enable-slirp=git) slirp="internal" 1022 ;; 1023 --enable-slirp=system) slirp="system" 1024 ;; 1025 --disable-vde) vde="disabled" 1026 ;; 1027 --enable-vde) vde="enabled" 1028 ;; 1029 --disable-netmap) netmap="no" 1030 ;; 1031 --enable-netmap) netmap="yes" 1032 ;; 1033 --disable-xen) xen="disabled" 1034 ;; 1035 --enable-xen) xen="enabled" 1036 ;; 1037 --disable-xen-pci-passthrough) xen_pci_passthrough="disabled" 1038 ;; 1039 --enable-xen-pci-passthrough) xen_pci_passthrough="enabled" 1040 ;; 1041 --disable-alsa) alsa="disabled" 1042 ;; 1043 --enable-alsa) alsa="enabled" 1044 ;; 1045 --disable-coreaudio) coreaudio="disabled" 1046 ;; 1047 --enable-coreaudio) coreaudio="enabled" 1048 ;; 1049 --disable-dsound) dsound="disabled" 1050 ;; 1051 --enable-dsound) dsound="enabled" 1052 ;; 1053 --disable-jack) jack="disabled" 1054 ;; 1055 --enable-jack) jack="enabled" 1056 ;; 1057 --disable-oss) oss="disabled" 1058 ;; 1059 --enable-oss) oss="enabled" 1060 ;; 1061 --disable-pa) pa="disabled" 1062 ;; 1063 --enable-pa) pa="enabled" 1064 ;; 1065 --disable-brlapi) brlapi="disabled" 1066 ;; 1067 --enable-brlapi) brlapi="enabled" 1068 ;; 1069 --disable-kvm) kvm="disabled" 1070 ;; 1071 --enable-kvm) kvm="enabled" 1072 ;; 1073 --disable-hax) hax="disabled" 1074 ;; 1075 --enable-hax) hax="enabled" 1076 ;; 1077 --disable-hvf) hvf="disabled" 1078 ;; 1079 --enable-hvf) hvf="enabled" 1080 ;; 1081 --disable-nvmm) nvmm="disabled" 1082 ;; 1083 --enable-nvmm) nvmm="enabled" 1084 ;; 1085 --disable-whpx) whpx="disabled" 1086 ;; 1087 --enable-whpx) whpx="enabled" 1088 ;; 1089 --disable-tcg-interpreter) tcg_interpreter="false" 1090 ;; 1091 --enable-tcg-interpreter) tcg_interpreter="true" 1092 ;; 1093 --disable-cap-ng) cap_ng="disabled" 1094 ;; 1095 --enable-cap-ng) cap_ng="enabled" 1096 ;; 1097 --disable-tcg) tcg="disabled" 1098 plugins="no" 1099 ;; 1100 --enable-tcg) tcg="enabled" 1101 ;; 1102 --disable-malloc-trim) malloc_trim="disabled" 1103 ;; 1104 --enable-malloc-trim) malloc_trim="enabled" 1105 ;; 1106 --disable-spice) spice="no" 1107 ;; 1108 --enable-spice) 1109 spice_protocol="yes" 1110 spice="yes" 1111 ;; 1112 --disable-spice-protocol) 1113 spice_protocol="no" 1114 spice="no" 1115 ;; 1116 --enable-spice-protocol) spice_protocol="yes" 1117 ;; 1118 --disable-libiscsi) libiscsi="disabled" 1119 ;; 1120 --enable-libiscsi) libiscsi="enabled" 1121 ;; 1122 --disable-libnfs) libnfs="disabled" 1123 ;; 1124 --enable-libnfs) libnfs="enabled" 1125 ;; 1126 --enable-profiler) profiler="yes" 1127 ;; 1128 --disable-cocoa) cocoa="disabled" 1129 ;; 1130 --enable-cocoa) cocoa="enabled" 1131 ;; 1132 --disable-system) softmmu="no" 1133 ;; 1134 --enable-system) softmmu="yes" 1135 ;; 1136 --disable-user) 1137 linux_user="no" ; 1138 bsd_user="no" ; 1139 ;; 1140 --enable-user) ;; 1141 --disable-linux-user) linux_user="no" 1142 ;; 1143 --enable-linux-user) linux_user="yes" 1144 ;; 1145 --disable-bsd-user) bsd_user="no" 1146 ;; 1147 --enable-bsd-user) bsd_user="yes" 1148 ;; 1149 --enable-pie) pie="yes" 1150 ;; 1151 --disable-pie) pie="no" 1152 ;; 1153 --enable-werror) werror="yes" 1154 ;; 1155 --disable-werror) werror="no" 1156 ;; 1157 --enable-lto) lto="true" 1158 ;; 1159 --disable-lto) lto="false" 1160 ;; 1161 --enable-stack-protector) stack_protector="yes" 1162 ;; 1163 --disable-stack-protector) stack_protector="no" 1164 ;; 1165 --enable-safe-stack) safe_stack="yes" 1166 ;; 1167 --disable-safe-stack) safe_stack="no" 1168 ;; 1169 --enable-cfi) 1170 cfi="true"; 1171 lto="true"; 1172 ;; 1173 --disable-cfi) cfi="false" 1174 ;; 1175 --enable-cfi-debug) cfi_debug="true" 1176 ;; 1177 --disable-cfi-debug) cfi_debug="false" 1178 ;; 1179 --disable-curses) curses="disabled" 1180 ;; 1181 --enable-curses) curses="enabled" 1182 ;; 1183 --disable-iconv) iconv="disabled" 1184 ;; 1185 --enable-iconv) iconv="enabled" 1186 ;; 1187 --disable-curl) curl="disabled" 1188 ;; 1189 --enable-curl) curl="enabled" 1190 ;; 1191 --disable-fdt) fdt="disabled" 1192 ;; 1193 --enable-fdt) fdt="enabled" 1194 ;; 1195 --enable-fdt=git) fdt="internal" 1196 ;; 1197 --enable-fdt=system) fdt="system" 1198 ;; 1199 --disable-linux-aio) linux_aio="disabled" 1200 ;; 1201 --enable-linux-aio) linux_aio="enabled" 1202 ;; 1203 --disable-linux-io-uring) linux_io_uring="disabled" 1204 ;; 1205 --enable-linux-io-uring) linux_io_uring="enabled" 1206 ;; 1207 --disable-attr) attr="disabled" 1208 ;; 1209 --enable-attr) attr="enabled" 1210 ;; 1211 --disable-membarrier) membarrier="no" 1212 ;; 1213 --enable-membarrier) membarrier="yes" 1214 ;; 1215 --disable-bpf) bpf="disabled" 1216 ;; 1217 --enable-bpf) bpf="enabled" 1218 ;; 1219 --disable-blobs) blobs="false" 1220 ;; 1221 --with-pkgversion=*) pkgversion="$optarg" 1222 ;; 1223 --with-coroutine=*) coroutine="$optarg" 1224 ;; 1225 --disable-coroutine-pool) coroutine_pool="no" 1226 ;; 1227 --enable-coroutine-pool) coroutine_pool="yes" 1228 ;; 1229 --enable-debug-stack-usage) debug_stack_usage="yes" 1230 ;; 1231 --enable-crypto-afalg) crypto_afalg="yes" 1232 ;; 1233 --disable-crypto-afalg) crypto_afalg="no" 1234 ;; 1235 --disable-docs) docs="disabled" 1236 ;; 1237 --enable-docs) docs="enabled" 1238 ;; 1239 --disable-vhost-net) vhost_net="no" 1240 ;; 1241 --enable-vhost-net) vhost_net="yes" 1242 ;; 1243 --disable-vhost-crypto) vhost_crypto="no" 1244 ;; 1245 --enable-vhost-crypto) vhost_crypto="yes" 1246 ;; 1247 --disable-vhost-scsi) vhost_scsi="no" 1248 ;; 1249 --enable-vhost-scsi) vhost_scsi="yes" 1250 ;; 1251 --disable-vhost-vsock) vhost_vsock="no" 1252 ;; 1253 --enable-vhost-vsock) vhost_vsock="yes" 1254 ;; 1255 --disable-vhost-user-blk-server) vhost_user_blk_server="disabled" 1256 ;; 1257 --enable-vhost-user-blk-server) vhost_user_blk_server="enabled" 1258 ;; 1259 --disable-vhost-user-fs) vhost_user_fs="no" 1260 ;; 1261 --enable-vhost-user-fs) vhost_user_fs="yes" 1262 ;; 1263 --disable-opengl) opengl="no" 1264 ;; 1265 --enable-opengl) opengl="yes" 1266 ;; 1267 --disable-rbd) rbd="disabled" 1268 ;; 1269 --enable-rbd) rbd="enabled" 1270 ;; 1271 --disable-xfsctl) xfs="no" 1272 ;; 1273 --enable-xfsctl) xfs="yes" 1274 ;; 1275 --disable-smartcard) smartcard="disabled" 1276 ;; 1277 --enable-smartcard) smartcard="enabled" 1278 ;; 1279 --disable-u2f) u2f="disabled" 1280 ;; 1281 --enable-u2f) u2f="enabled" 1282 ;; 1283 --disable-libusb) libusb="disabled" 1284 ;; 1285 --enable-libusb) libusb="enabled" 1286 ;; 1287 --disable-usb-redir) usb_redir="disabled" 1288 ;; 1289 --enable-usb-redir) usb_redir="enabled" 1290 ;; 1291 --disable-zlib-test) 1292 ;; 1293 --disable-lzo) lzo="disabled" 1294 ;; 1295 --enable-lzo) lzo="enabled" 1296 ;; 1297 --disable-snappy) snappy="disabled" 1298 ;; 1299 --enable-snappy) snappy="enabled" 1300 ;; 1301 --disable-bzip2) bzip2="disabled" 1302 ;; 1303 --enable-bzip2) bzip2="enabled" 1304 ;; 1305 --enable-lzfse) lzfse="enabled" 1306 ;; 1307 --disable-lzfse) lzfse="disabled" 1308 ;; 1309 --disable-zstd) zstd="disabled" 1310 ;; 1311 --enable-zstd) zstd="enabled" 1312 ;; 1313 --enable-guest-agent) guest_agent="yes" 1314 ;; 1315 --disable-guest-agent) guest_agent="no" 1316 ;; 1317 --enable-guest-agent-msi) guest_agent_msi="enabled" 1318 ;; 1319 --disable-guest-agent-msi) guest_agent_msi="disabled" 1320 ;; 1321 --with-vss-sdk) vss_win32_sdk="" 1322 ;; 1323 --with-vss-sdk=*) vss_win32_sdk="$optarg" 1324 ;; 1325 --without-vss-sdk) vss_win32_sdk="no" 1326 ;; 1327 --with-win-sdk) win_sdk="" 1328 ;; 1329 --with-win-sdk=*) win_sdk="$optarg" 1330 ;; 1331 --without-win-sdk) win_sdk="no" 1332 ;; 1333 --enable-tools) want_tools="yes" 1334 ;; 1335 --disable-tools) want_tools="no" 1336 ;; 1337 --enable-seccomp) seccomp="enabled" 1338 ;; 1339 --disable-seccomp) seccomp="disabled" 1340 ;; 1341 --disable-glusterfs) glusterfs="disabled" 1342 ;; 1343 --disable-avx2) avx2_opt="no" 1344 ;; 1345 --enable-avx2) avx2_opt="yes" 1346 ;; 1347 --disable-avx512f) avx512f_opt="no" 1348 ;; 1349 --enable-avx512f) avx512f_opt="yes" 1350 ;; 1351 1352 --enable-glusterfs) glusterfs="enabled" 1353 ;; 1354 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 1355 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1356 ;; 1357 --enable-vhdx|--disable-vhdx) 1358 echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1359 ;; 1360 --enable-uuid|--disable-uuid) 1361 echo "$0: $opt is obsolete, UUID support is always built" >&2 1362 ;; 1363 --disable-gtk) gtk="disabled" 1364 ;; 1365 --enable-gtk) gtk="enabled" 1366 ;; 1367 --tls-priority=*) tls_priority="$optarg" 1368 ;; 1369 --disable-gnutls) gnutls="disabled" 1370 ;; 1371 --enable-gnutls) gnutls="enabled" 1372 ;; 1373 --disable-nettle) nettle="disabled" 1374 ;; 1375 --enable-nettle) nettle="enabled" 1376 ;; 1377 --disable-gcrypt) gcrypt="disabled" 1378 ;; 1379 --enable-gcrypt) gcrypt="enabled" 1380 ;; 1381 --disable-auth-pam) auth_pam="disabled" 1382 ;; 1383 --enable-auth-pam) auth_pam="enabled" 1384 ;; 1385 --enable-rdma) rdma="yes" 1386 ;; 1387 --disable-rdma) rdma="no" 1388 ;; 1389 --enable-pvrdma) pvrdma="yes" 1390 ;; 1391 --disable-pvrdma) pvrdma="no" 1392 ;; 1393 --disable-vte) vte="disabled" 1394 ;; 1395 --enable-vte) vte="enabled" 1396 ;; 1397 --disable-virglrenderer) virglrenderer="disabled" 1398 ;; 1399 --enable-virglrenderer) virglrenderer="enabled" 1400 ;; 1401 --disable-tpm) tpm="no" 1402 ;; 1403 --enable-tpm) tpm="yes" 1404 ;; 1405 --disable-libssh) libssh="no" 1406 ;; 1407 --enable-libssh) libssh="yes" 1408 ;; 1409 --disable-live-block-migration) live_block_migration="no" 1410 ;; 1411 --enable-live-block-migration) live_block_migration="yes" 1412 ;; 1413 --disable-numa) numa="no" 1414 ;; 1415 --enable-numa) numa="yes" 1416 ;; 1417 --disable-libxml2) libxml2="disabled" 1418 ;; 1419 --enable-libxml2) libxml2="enabled" 1420 ;; 1421 --disable-tcmalloc) tcmalloc="no" 1422 ;; 1423 --enable-tcmalloc) tcmalloc="yes" 1424 ;; 1425 --disable-jemalloc) jemalloc="no" 1426 ;; 1427 --enable-jemalloc) jemalloc="yes" 1428 ;; 1429 --disable-replication) replication="no" 1430 ;; 1431 --enable-replication) replication="yes" 1432 ;; 1433 --disable-bochs) bochs="no" 1434 ;; 1435 --enable-bochs) bochs="yes" 1436 ;; 1437 --disable-cloop) cloop="no" 1438 ;; 1439 --enable-cloop) cloop="yes" 1440 ;; 1441 --disable-dmg) dmg="no" 1442 ;; 1443 --enable-dmg) dmg="yes" 1444 ;; 1445 --disable-qcow1) qcow1="no" 1446 ;; 1447 --enable-qcow1) qcow1="yes" 1448 ;; 1449 --disable-vdi) vdi="no" 1450 ;; 1451 --enable-vdi) vdi="yes" 1452 ;; 1453 --disable-vvfat) vvfat="no" 1454 ;; 1455 --enable-vvfat) vvfat="yes" 1456 ;; 1457 --disable-qed) qed="no" 1458 ;; 1459 --enable-qed) qed="yes" 1460 ;; 1461 --disable-parallels) parallels="no" 1462 ;; 1463 --enable-parallels) parallels="yes" 1464 ;; 1465 --disable-vhost-user) vhost_user="no" 1466 ;; 1467 --enable-vhost-user) vhost_user="yes" 1468 ;; 1469 --disable-vhost-vdpa) vhost_vdpa="no" 1470 ;; 1471 --enable-vhost-vdpa) vhost_vdpa="yes" 1472 ;; 1473 --disable-vhost-kernel) vhost_kernel="no" 1474 ;; 1475 --enable-vhost-kernel) vhost_kernel="yes" 1476 ;; 1477 --disable-capstone) capstone="disabled" 1478 ;; 1479 --enable-capstone) capstone="enabled" 1480 ;; 1481 --enable-capstone=git) capstone="internal" 1482 ;; 1483 --enable-capstone=system) capstone="system" 1484 ;; 1485 --with-git=*) git="$optarg" 1486 ;; 1487 --enable-git-update) 1488 git_submodules_action="update" 1489 echo "--enable-git-update deprecated, use --with-git-submodules=update" 1490 ;; 1491 --disable-git-update) 1492 git_submodules_action="validate" 1493 echo "--disable-git-update deprecated, use --with-git-submodules=validate" 1494 ;; 1495 --with-git-submodules=*) 1496 git_submodules_action="$optarg" 1497 ;; 1498 --enable-debug-mutex) debug_mutex=yes 1499 ;; 1500 --disable-debug-mutex) debug_mutex=no 1501 ;; 1502 --enable-libpmem) libpmem="enabled" 1503 ;; 1504 --disable-libpmem) libpmem="disabled" 1505 ;; 1506 --enable-xkbcommon) xkbcommon="enabled" 1507 ;; 1508 --disable-xkbcommon) xkbcommon="disabled" 1509 ;; 1510 --enable-plugins) if test "$mingw32" = "yes"; then 1511 error_exit "TCG plugins not currently supported on Windows platforms" 1512 else 1513 plugins="yes" 1514 fi 1515 ;; 1516 --disable-plugins) plugins="no" 1517 ;; 1518 --enable-containers) use_containers="yes" 1519 ;; 1520 --disable-containers) use_containers="no" 1521 ;; 1522 --enable-fuzzing) fuzzing=true 1523 ;; 1524 --disable-fuzzing) fuzzing=false 1525 ;; 1526 --gdb=*) gdb_bin="$optarg" 1527 ;; 1528 --enable-rng-none) rng_none=yes 1529 ;; 1530 --disable-rng-none) rng_none=no 1531 ;; 1532 --enable-keyring) secret_keyring="yes" 1533 ;; 1534 --disable-keyring) secret_keyring="no" 1535 ;; 1536 --enable-libdaxctl) libdaxctl="enabled" 1537 ;; 1538 --disable-libdaxctl) libdaxctl="disabled" 1539 ;; 1540 --enable-fuse) fuse="enabled" 1541 ;; 1542 --disable-fuse) fuse="disabled" 1543 ;; 1544 --enable-fuse-lseek) fuse_lseek="enabled" 1545 ;; 1546 --disable-fuse-lseek) fuse_lseek="disabled" 1547 ;; 1548 --enable-multiprocess) multiprocess="enabled" 1549 ;; 1550 --disable-multiprocess) multiprocess="disabled" 1551 ;; 1552 --enable-gio) gio=yes 1553 ;; 1554 --disable-gio) gio=no 1555 ;; 1556 --enable-slirp-smbd) slirp_smbd=yes 1557 ;; 1558 --disable-slirp-smbd) slirp_smbd=no 1559 ;; 1560 *) 1561 echo "ERROR: unknown option $opt" 1562 echo "Try '$0 --help' for more information" 1563 exit 1 1564 ;; 1565 esac 1566done 1567 1568# test for any invalid configuration combinations 1569if test "$plugins" = "yes" -a "$tcg" = "disabled"; then 1570 error_exit "Can't enable plugins on non-TCG builds" 1571fi 1572 1573case $git_submodules_action in 1574 update|validate) 1575 if test ! -e "$source_path/.git"; then 1576 echo "ERROR: cannot $git_submodules_action git submodules without .git" 1577 exit 1 1578 fi 1579 ;; 1580 ignore) 1581 if ! test -f "$source_path/ui/keycodemapdb/README" 1582 then 1583 echo 1584 echo "ERROR: missing GIT submodules" 1585 echo 1586 if test -e "$source_path/.git"; then 1587 echo "--with-git-submodules=ignore specified but submodules were not" 1588 echo "checked out. Please initialize and update submodules." 1589 else 1590 echo "This is not a GIT checkout but module content appears to" 1591 echo "be missing. Do not use 'git archive' or GitHub download links" 1592 echo "to acquire QEMU source archives. Non-GIT builds are only" 1593 echo "supported with source archives linked from:" 1594 echo 1595 echo " https://www.qemu.org/download/#source" 1596 echo 1597 echo "Developers working with GIT can use scripts/archive-source.sh" 1598 echo "if they need to create valid source archives." 1599 fi 1600 echo 1601 exit 1 1602 fi 1603 ;; 1604 *) 1605 echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'" 1606 exit 1 1607 ;; 1608esac 1609 1610libdir="${libdir:-$prefix/lib}" 1611libexecdir="${libexecdir:-$prefix/libexec}" 1612includedir="${includedir:-$prefix/include}" 1613 1614if test "$mingw32" = "yes" ; then 1615 bindir="${bindir:-$prefix}" 1616else 1617 bindir="${bindir:-$prefix/bin}" 1618fi 1619mandir="${mandir:-$prefix/share/man}" 1620datadir="${datadir:-$prefix/share}" 1621docdir="${docdir:-$prefix/share/doc}" 1622sysconfdir="${sysconfdir:-$prefix/etc}" 1623local_statedir="${local_statedir:-$prefix/var}" 1624firmwarepath="${firmwarepath:-$datadir/qemu-firmware}" 1625localedir="${localedir:-$datadir/locale}" 1626 1627case "$cpu" in 1628 ppc) 1629 CPU_CFLAGS="-m32" 1630 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1631 ;; 1632 ppc64) 1633 CPU_CFLAGS="-m64" 1634 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1635 ;; 1636 sparc) 1637 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1638 QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 1639 ;; 1640 sparc64) 1641 CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1642 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1643 ;; 1644 s390) 1645 CPU_CFLAGS="-m31" 1646 QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 1647 ;; 1648 s390x) 1649 CPU_CFLAGS="-m64" 1650 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1651 ;; 1652 i386) 1653 CPU_CFLAGS="-m32" 1654 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1655 ;; 1656 x86_64) 1657 # ??? Only extremely old AMD cpus do not have cmpxchg16b. 1658 # If we truly care, we should simply detect this case at 1659 # runtime and generate the fallback to serial emulation. 1660 CPU_CFLAGS="-m64 -mcx16" 1661 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1662 ;; 1663 x32) 1664 CPU_CFLAGS="-mx32" 1665 QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1666 ;; 1667 # No special flags required for other host CPUs 1668esac 1669 1670if eval test -z "\${cross_cc_$cpu}"; then 1671 eval "cross_cc_${cpu}=\$cc" 1672 cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 1673fi 1674 1675# For user-mode emulation the host arch has to be one we explicitly 1676# support, even if we're using TCI. 1677if [ "$ARCH" = "unknown" ]; then 1678 bsd_user="no" 1679 linux_user="no" 1680fi 1681 1682default_target_list="" 1683deprecated_targets_list=ppc64abi32-linux-user 1684deprecated_features="" 1685mak_wilds="" 1686 1687if [ "$softmmu" = "yes" ]; then 1688 mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak" 1689fi 1690if [ "$linux_user" = "yes" ]; then 1691 mak_wilds="${mak_wilds} $source_path/configs/targets/*-linux-user.mak" 1692fi 1693if [ "$bsd_user" = "yes" ]; then 1694 mak_wilds="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak" 1695fi 1696 1697# If the user doesn't explicitly specify a deprecated target we will 1698# skip it. 1699if test -z "$target_list"; then 1700 if test -z "$target_list_exclude"; then 1701 target_list_exclude="$deprecated_targets_list" 1702 else 1703 target_list_exclude="$target_list_exclude,$deprecated_targets_list" 1704 fi 1705fi 1706 1707for config in $mak_wilds; do 1708 target="$(basename "$config" .mak)" 1709 if echo "$target_list_exclude" | grep -vq "$target"; then 1710 default_target_list="${default_target_list} $target" 1711 fi 1712done 1713 1714# Enumerate public trace backends for --help output 1715trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1716 1717if test x"$show_help" = x"yes" ; then 1718cat << EOF 1719 1720Usage: configure [options] 1721Options: [defaults in brackets after descriptions] 1722 1723Standard options: 1724 --help print this message 1725 --prefix=PREFIX install in PREFIX [$prefix] 1726 --interp-prefix=PREFIX where to find shared libraries, etc. 1727 use %M for cpu name [$interp_prefix] 1728 --target-list=LIST set target list (default: build all non-deprecated) 1729$(echo Available targets: $default_target_list | \ 1730 fold -s -w 53 | sed -e 's/^/ /') 1731$(echo Deprecated targets: $deprecated_targets_list | \ 1732 fold -s -w 53 | sed -e 's/^/ /') 1733 --target-list-exclude=LIST exclude a set of targets from the default target-list 1734 1735Advanced options (experts only): 1736 --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] 1737 --cc=CC use C compiler CC [$cc] 1738 --iasl=IASL use ACPI compiler IASL [$iasl] 1739 --host-cc=CC use C compiler CC [$host_cc] for code run at 1740 build time 1741 --cxx=CXX use C++ compiler CXX [$cxx] 1742 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 1743 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 1744 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 1745 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1746 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1747 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 1748 --make=MAKE use specified make [$make] 1749 --python=PYTHON use specified python [$python] 1750 --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1751 --meson=MESON use specified meson [$meson] 1752 --ninja=NINJA use specified ninja [$ninja] 1753 --smbd=SMBD use specified smbd [$smbd] 1754 --with-git=GIT use specified git [$git] 1755 --with-git-submodules=update update git submodules (default if .git dir exists) 1756 --with-git-submodules=validate fail if git submodules are not up to date 1757 --with-git-submodules=ignore do not update or check git submodules (default if no .git dir) 1758 --static enable static build [$static] 1759 --mandir=PATH install man pages in PATH 1760 --datadir=PATH install firmware in PATH/$qemu_suffix 1761 --localedir=PATH install translation in PATH/$qemu_suffix 1762 --docdir=PATH install documentation in PATH/$qemu_suffix 1763 --bindir=PATH install binaries in PATH 1764 --libdir=PATH install libraries in PATH 1765 --libexecdir=PATH install helper binaries in PATH 1766 --sysconfdir=PATH install config in PATH/$qemu_suffix 1767 --localstatedir=PATH install local state in PATH (set at runtime on win32) 1768 --firmwarepath=PATH search PATH for firmware files 1769 --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1770 --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1771 --with-pkgversion=VERS use specified string as sub-version of the package 1772 --without-default-features default all --enable-* options to "disabled" 1773 --without-default-devices do not include any device that is not needed to 1774 start the emulator (only use if you are including 1775 desired devices in configs/devices/) 1776 --with-devices-ARCH=NAME override default configs/devices 1777 --enable-debug enable common debug build options 1778 --enable-sanitizers enable default sanitizers 1779 --enable-tsan enable thread sanitizer 1780 --disable-strip disable stripping binaries 1781 --disable-werror disable compilation abort on warning 1782 --disable-stack-protector disable compiler-provided stack protection 1783 --audio-drv-list=LIST set audio drivers list 1784 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 1785 --block-drv-rw-whitelist=L 1786 set block driver read-write whitelist 1787 (by default affects only QEMU, not tools like qemu-img) 1788 --block-drv-ro-whitelist=L 1789 set block driver read-only whitelist 1790 (by default affects only QEMU, not tools like qemu-img) 1791 --enable-block-drv-whitelist-in-tools 1792 use block whitelist also in tools instead of only QEMU 1793 --enable-trace-backends=B Set trace backend 1794 Available backends: $trace_backend_list 1795 --with-trace-file=NAME Full PATH,NAME of file to store traces 1796 Default:trace-<pid> 1797 --disable-slirp disable SLIRP userspace network connectivity 1798 --enable-tcg-interpreter enable TCI (TCG with bytecode interpreter, experimental and slow) 1799 --enable-malloc-trim enable libc malloc_trim() for memory optimization 1800 --cpu=CPU Build for host CPU [$cpu] 1801 --with-coroutine=BACKEND coroutine backend. Supported options: 1802 ucontext, sigaltstack, windows 1803 --enable-gcov enable test coverage analysis with gcov 1804 --disable-blobs disable installing provided firmware blobs 1805 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1806 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1807 --tls-priority default TLS protocol/cipher priority string 1808 --enable-gprof QEMU profiling with gprof 1809 --enable-profiler profiler support 1810 --enable-debug-stack-usage 1811 track the maximum stack usage of stacks created by qemu_alloc_stack 1812 --enable-plugins 1813 enable plugins via shared library loading 1814 --disable-containers don't use containers for cross-building 1815 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1816 1817Optional features, enabled with --enable-FEATURE and 1818disabled with --disable-FEATURE, default is enabled if available 1819(unless built with --without-default-features): 1820 1821 system all system emulation targets 1822 user supported user emulation targets 1823 linux-user all linux usermode emulation targets 1824 bsd-user all BSD usermode emulation targets 1825 docs build documentation 1826 guest-agent build the QEMU Guest Agent 1827 guest-agent-msi build guest agent Windows MSI installation package 1828 pie Position Independent Executables 1829 modules modules support (non-Windows) 1830 module-upgrades try to load modules from alternate paths for upgrades 1831 debug-tcg TCG debugging (default is disabled) 1832 debug-info debugging information 1833 lto Enable Link-Time Optimization. 1834 sparse sparse checker 1835 safe-stack SafeStack Stack Smash Protection. Depends on 1836 clang/llvm >= 3.7 and requires coroutine backend ucontext. 1837 cfi Enable Control-Flow Integrity for indirect function calls. 1838 In case of a cfi violation, QEMU is terminated with SIGILL 1839 Depends on lto and is incompatible with modules 1840 Automatically enables Link-Time Optimization (lto) 1841 cfi-debug In case of a cfi violation, a message containing the line that 1842 triggered the error is written to stderr. After the error, 1843 QEMU is still terminated with SIGILL 1844 gnutls GNUTLS cryptography support 1845 nettle nettle cryptography support 1846 gcrypt libgcrypt cryptography support 1847 auth-pam PAM access control 1848 sdl SDL UI 1849 sdl-image SDL Image support for icons 1850 gtk gtk UI 1851 vte vte support for the gtk UI 1852 curses curses UI 1853 iconv font glyph conversion support 1854 vnc VNC UI support 1855 vnc-sasl SASL encryption for VNC server 1856 vnc-jpeg JPEG lossy compression for VNC server 1857 vnc-png PNG compression for VNC server 1858 cocoa Cocoa UI (Mac OS X only) 1859 virtfs VirtFS 1860 virtiofsd build virtiofs daemon (virtiofsd) 1861 libudev Use libudev to enumerate host devices 1862 mpath Multipath persistent reservation passthrough 1863 xen xen backend driver support 1864 xen-pci-passthrough PCI passthrough support for Xen 1865 alsa ALSA sound support 1866 coreaudio CoreAudio sound support 1867 dsound DirectSound sound support 1868 jack JACK sound support 1869 oss OSS sound support 1870 pa PulseAudio sound support 1871 brlapi BrlAPI (Braile) 1872 curl curl connectivity 1873 membarrier membarrier system call (for Linux 4.14+ or Windows) 1874 fdt fdt device tree 1875 kvm KVM acceleration support 1876 hax HAX acceleration support 1877 hvf Hypervisor.framework acceleration support 1878 nvmm NVMM acceleration support 1879 whpx Windows Hypervisor Platform acceleration support 1880 rdma Enable RDMA-based migration 1881 pvrdma Enable PVRDMA support 1882 vde support for vde network 1883 netmap support for netmap network 1884 linux-aio Linux AIO support 1885 linux-io-uring Linux io_uring support 1886 cap-ng libcap-ng support 1887 attr attr and xattr support 1888 vhost-net vhost-net kernel acceleration support 1889 vhost-vsock virtio sockets device support 1890 vhost-scsi vhost-scsi kernel target support 1891 vhost-crypto vhost-user-crypto backend support 1892 vhost-kernel vhost kernel backend support 1893 vhost-user vhost-user backend support 1894 vhost-user-blk-server vhost-user-blk server support 1895 vhost-vdpa vhost-vdpa kernel backend support 1896 bpf BPF kernel support 1897 spice spice 1898 spice-protocol spice-protocol 1899 rbd rados block device (rbd) 1900 libiscsi iscsi support 1901 libnfs nfs support 1902 smartcard smartcard support (libcacard) 1903 u2f U2F support (u2f-emu) 1904 libusb libusb (for usb passthrough) 1905 live-block-migration Block migration in the main migration stream 1906 usb-redir usb network redirection support 1907 lzo support of lzo compression library 1908 snappy support of snappy compression library 1909 bzip2 support of bzip2 compression library 1910 (for reading bzip2-compressed dmg images) 1911 lzfse support of lzfse compression library 1912 (for reading lzfse-compressed dmg images) 1913 zstd support for zstd compression library 1914 (for migration compression and qcow2 cluster compression) 1915 seccomp seccomp support 1916 coroutine-pool coroutine freelist (better performance) 1917 glusterfs GlusterFS backend 1918 tpm TPM support 1919 libssh ssh block device support 1920 numa libnuma support 1921 libxml2 for Parallels image format 1922 tcmalloc tcmalloc support 1923 jemalloc jemalloc support 1924 avx2 AVX2 optimization support 1925 avx512f AVX512F optimization support 1926 replication replication support 1927 opengl opengl support 1928 virglrenderer virgl rendering support 1929 xfsctl xfsctl support 1930 qom-cast-debug cast debugging support 1931 tools build qemu-io, qemu-nbd and qemu-img tools 1932 bochs bochs image format support 1933 cloop cloop image format support 1934 dmg dmg image format support 1935 qcow1 qcow v1 image format support 1936 vdi vdi image format support 1937 vvfat vvfat image format support 1938 qed qed image format support 1939 parallels parallels image format support 1940 crypto-afalg Linux AF_ALG crypto backend driver 1941 capstone capstone disassembler support 1942 debug-mutex mutex debugging support 1943 libpmem libpmem support 1944 xkbcommon xkbcommon support 1945 rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 1946 libdaxctl libdaxctl support 1947 fuse FUSE block device export 1948 fuse-lseek SEEK_HOLE/SEEK_DATA support for FUSE exports 1949 multiprocess Out of process device emulation support 1950 gio libgio support 1951 slirp-smbd use smbd (at path --smbd=*) in slirp networking 1952 1953NOTE: The object files are built at the place where configure is launched 1954EOF 1955exit 0 1956fi 1957 1958# Remove old dependency files to make sure that they get properly regenerated 1959rm -f */config-devices.mak.d 1960 1961if test -z "$python" 1962then 1963 error_exit "Python not found. Use --python=/path/to/python" 1964fi 1965if ! has "$make" 1966then 1967 error_exit "GNU make ($make) not found" 1968fi 1969 1970# Note that if the Python conditional here evaluates True we will exit 1971# with status 1 which is a shell 'false' value. 1972if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then 1973 error_exit "Cannot use '$python', Python >= 3.6 is required." \ 1974 "Use --python=/path/to/python to specify a supported Python." 1975fi 1976 1977# Preserve python version since some functionality is dependent on it 1978python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) 1979 1980# Suppress writing compiled files 1981python="$python -B" 1982 1983if test -z "$meson"; then 1984 if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.2; then 1985 meson=meson 1986 elif test $git_submodules_action != 'ignore' ; then 1987 meson=git 1988 elif test -e "${source_path}/meson/meson.py" ; then 1989 meson=internal 1990 else 1991 if test "$explicit_python" = yes; then 1992 error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 1993 else 1994 error_exit "Meson not found. Use --meson=/path/to/meson" 1995 fi 1996 fi 1997else 1998 # Meson uses its own Python interpreter to invoke other Python scripts, 1999 # but the user wants to use the one they specified with --python. 2000 # 2001 # We do not want to override the distro Python interpreter (and sometimes 2002 # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 2003 # just require --meson=git|internal together with --python. 2004 if test "$explicit_python" = yes; then 2005 case "$meson" in 2006 git | internal) ;; 2007 *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 2008 esac 2009 fi 2010fi 2011 2012if test "$meson" = git; then 2013 git_submodules="${git_submodules} meson" 2014fi 2015 2016case "$meson" in 2017 git | internal) 2018 meson="$python ${source_path}/meson/meson.py" 2019 ;; 2020 *) meson=$(command -v "$meson") ;; 2021esac 2022 2023# Probe for ninja 2024 2025if test -z "$ninja"; then 2026 for c in ninja ninja-build samu; do 2027 if has $c; then 2028 ninja=$(command -v "$c") 2029 break 2030 fi 2031 done 2032 if test -z "$ninja"; then 2033 error_exit "Cannot find Ninja" 2034 fi 2035fi 2036 2037# Check that the C compiler works. Doing this here before testing 2038# the host CPU ensures that we had a valid CC to autodetect the 2039# $cpu var (and we should bail right here if that's not the case). 2040# It also allows the help message to be printed without a CC. 2041write_c_skeleton; 2042if compile_object ; then 2043 : C compiler works ok 2044else 2045 error_exit "\"$cc\" either does not exist or does not work" 2046fi 2047if ! compile_prog ; then 2048 error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 2049fi 2050 2051# Consult white-list to determine whether to enable werror 2052# by default. Only enable by default for git builds 2053if test -z "$werror" ; then 2054 if test "$git_submodules_action" != "ignore" && \ 2055 { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 2056 werror="yes" 2057 else 2058 werror="no" 2059 fi 2060fi 2061 2062if test "$targetos" = "bogus"; then 2063 # Now that we know that we're not printing the help and that 2064 # the compiler works (so the results of the check_defines we used 2065 # to identify the OS are reliable), if we didn't recognize the 2066 # host OS we should stop now. 2067 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 2068fi 2069 2070# Check whether the compiler matches our minimum requirements: 2071cat > $TMPC << EOF 2072#if defined(__clang_major__) && defined(__clang_minor__) 2073# ifdef __apple_build_version__ 2074# if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0) 2075# error You need at least XCode Clang v10.0 to compile QEMU 2076# endif 2077# else 2078# if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0) 2079# error You need at least Clang v6.0 to compile QEMU 2080# endif 2081# endif 2082#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 2083# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) 2084# error You need at least GCC v7.4.0 to compile QEMU 2085# endif 2086#else 2087# error You either need GCC or Clang to compiler QEMU 2088#endif 2089int main (void) { return 0; } 2090EOF 2091if ! compile_prog "" "" ; then 2092 error_exit "You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)" 2093fi 2094 2095# Accumulate -Wfoo and -Wno-bar separately. 2096# We will list all of the enable flags first, and the disable flags second. 2097# Note that we do not add -Werror, because that would enable it for all 2098# configure tests. If a configure test failed due to -Werror this would 2099# just silently disable some features, so it's too error prone. 2100 2101warn_flags= 2102add_to warn_flags -Wold-style-declaration 2103add_to warn_flags -Wold-style-definition 2104add_to warn_flags -Wtype-limits 2105add_to warn_flags -Wformat-security 2106add_to warn_flags -Wformat-y2k 2107add_to warn_flags -Winit-self 2108add_to warn_flags -Wignored-qualifiers 2109add_to warn_flags -Wempty-body 2110add_to warn_flags -Wnested-externs 2111add_to warn_flags -Wendif-labels 2112add_to warn_flags -Wexpansion-to-defined 2113add_to warn_flags -Wimplicit-fallthrough=2 2114 2115nowarn_flags= 2116add_to nowarn_flags -Wno-initializer-overrides 2117add_to nowarn_flags -Wno-missing-include-dirs 2118add_to nowarn_flags -Wno-shift-negative-value 2119add_to nowarn_flags -Wno-string-plus-int 2120add_to nowarn_flags -Wno-typedef-redefinition 2121add_to nowarn_flags -Wno-tautological-type-limit-compare 2122add_to nowarn_flags -Wno-psabi 2123 2124gcc_flags="$warn_flags $nowarn_flags" 2125 2126cc_has_warning_flag() { 2127 write_c_skeleton; 2128 2129 # Use the positive sense of the flag when testing for -Wno-wombat 2130 # support (gcc will happily accept the -Wno- form of unknown 2131 # warning options). 2132 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 2133 compile_prog "-Werror $optflag" "" 2134} 2135 2136for flag in $gcc_flags; do 2137 if cc_has_warning_flag $flag ; then 2138 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2139 fi 2140done 2141 2142if test "$stack_protector" != "no"; then 2143 cat > $TMPC << EOF 2144int main(int argc, char *argv[]) 2145{ 2146 char arr[64], *p = arr, *c = argv[0]; 2147 while (*c) { 2148 *p++ = *c++; 2149 } 2150 return 0; 2151} 2152EOF 2153 gcc_flags="-fstack-protector-strong -fstack-protector-all" 2154 sp_on=0 2155 for flag in $gcc_flags; do 2156 # We need to check both a compile and a link, since some compiler 2157 # setups fail only on a .c->.o compile and some only at link time 2158 if compile_object "-Werror $flag" && 2159 compile_prog "-Werror $flag" ""; then 2160 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2161 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 2162 sp_on=1 2163 break 2164 fi 2165 done 2166 if test "$stack_protector" = yes; then 2167 if test $sp_on = 0; then 2168 error_exit "Stack protector not supported" 2169 fi 2170 fi 2171fi 2172 2173# Disable -Wmissing-braces on older compilers that warn even for 2174# the "universal" C zero initializer {0}. 2175cat > $TMPC << EOF 2176struct { 2177 int a[2]; 2178} x = {0}; 2179EOF 2180if compile_object "-Werror" "" ; then 2181 : 2182else 2183 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 2184fi 2185 2186# Our module code doesn't support Windows 2187if test "$modules" = "yes" && test "$mingw32" = "yes" ; then 2188 error_exit "Modules are not available for Windows" 2189fi 2190 2191# module_upgrades is only reasonable if modules are enabled 2192if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2193 error_exit "Can't enable module-upgrades as Modules are not enabled" 2194fi 2195 2196# Static linking is not possible with plugins, modules or PIE 2197if test "$static" = "yes" ; then 2198 if test "$modules" = "yes" ; then 2199 error_exit "static and modules are mutually incompatible" 2200 fi 2201 if test "$plugins" = "yes"; then 2202 error_exit "static and plugins are mutually incompatible" 2203 else 2204 plugins="no" 2205 fi 2206fi 2207 2208# Unconditional check for compiler __thread support 2209 cat > $TMPC << EOF 2210static __thread int tls_var; 2211int main(void) { return tls_var; } 2212EOF 2213 2214if ! compile_prog "-Werror" "" ; then 2215 error_exit "Your compiler does not support the __thread specifier for " \ 2216 "Thread-Local Storage (TLS). Please upgrade to a version that does." 2217fi 2218 2219cat > $TMPC << EOF 2220 2221#ifdef __linux__ 2222# define THREAD __thread 2223#else 2224# define THREAD 2225#endif 2226static THREAD int tls_var; 2227int main(void) { return tls_var; } 2228EOF 2229 2230# Check we support --no-pie first; we will need this for building ROMs. 2231if compile_prog "-Werror -fno-pie" "-no-pie"; then 2232 CFLAGS_NOPIE="-fno-pie" 2233fi 2234 2235if test "$static" = "yes"; then 2236 if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 2237 CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 2238 QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 2239 pie="yes" 2240 elif test "$pie" = "yes"; then 2241 error_exit "-static-pie not available due to missing toolchain support" 2242 else 2243 QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 2244 pie="no" 2245 fi 2246elif test "$pie" = "no"; then 2247 CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" 2248elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 2249 CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 2250 CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" 2251 pie="yes" 2252elif test "$pie" = "yes"; then 2253 error_exit "PIE not available due to missing toolchain support" 2254else 2255 echo "Disabling PIE due to missing toolchain support" 2256 pie="no" 2257fi 2258 2259# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2260# The combination is known as "full relro", because .got.plt is read-only too. 2261if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2262 QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2263fi 2264 2265########################################## 2266# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2267# use i686 as default anyway, but for those that don't, an explicit 2268# specification is necessary 2269 2270if test "$cpu" = "i386"; then 2271 cat > $TMPC << EOF 2272static int sfaa(int *ptr) 2273{ 2274 return __sync_fetch_and_and(ptr, 0); 2275} 2276 2277int main(void) 2278{ 2279 int val = 42; 2280 val = __sync_val_compare_and_swap(&val, 0, 1); 2281 sfaa(&val); 2282 return val; 2283} 2284EOF 2285 if ! compile_prog "" "" ; then 2286 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 2287 fi 2288fi 2289 2290######################################### 2291# Solaris specific configure tool chain decisions 2292 2293if test "$solaris" = "yes" ; then 2294 if has ar; then 2295 : 2296 else 2297 if test -f /usr/ccs/bin/ar ; then 2298 error_exit "No path includes ar" \ 2299 "Add /usr/ccs/bin to your path and rerun configure" 2300 fi 2301 error_exit "No path includes ar" 2302 fi 2303fi 2304 2305if test "$tcg" = "enabled"; then 2306 git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 2307 git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 2308fi 2309 2310if test -z "${target_list+xxx}" ; then 2311 default_targets=yes 2312 for target in $default_target_list; do 2313 target_list="$target_list $target" 2314 done 2315 target_list="${target_list# }" 2316else 2317 default_targets=no 2318 target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2319 for target in $target_list; do 2320 # Check that we recognised the target name; this allows a more 2321 # friendly error message than if we let it fall through. 2322 case " $default_target_list " in 2323 *" $target "*) 2324 ;; 2325 *) 2326 error_exit "Unknown target name '$target'" 2327 ;; 2328 esac 2329 done 2330fi 2331 2332for target in $target_list; do 2333 # if a deprecated target is enabled we note it here 2334 if echo "$deprecated_targets_list" | grep -q "$target"; then 2335 add_to deprecated_features $target 2336 fi 2337done 2338 2339# see if system emulation was really requested 2340case " $target_list " in 2341 *"-softmmu "*) softmmu=yes 2342 ;; 2343 *) softmmu=no 2344 ;; 2345esac 2346 2347feature_not_found() { 2348 feature=$1 2349 remedy=$2 2350 2351 error_exit "User requested feature $feature" \ 2352 "configure was not able to find it." \ 2353 "$remedy" 2354} 2355 2356# --- 2357# big/little endian test 2358cat > $TMPC << EOF 2359#include <stdio.h> 2360short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 2361short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 2362int main(int argc, char *argv[]) 2363{ 2364 return printf("%s %s\n", (char *)big_endian, (char *)little_endian); 2365} 2366EOF 2367 2368if compile_prog ; then 2369 if strings -a $TMPE | grep -q BiGeNdIaN ; then 2370 bigendian="yes" 2371 elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then 2372 bigendian="no" 2373 else 2374 echo big/little test failed 2375 exit 1 2376 fi 2377else 2378 echo big/little test failed 2379 exit 1 2380fi 2381 2382########################################## 2383# system tools 2384if test -z "$want_tools"; then 2385 if test "$softmmu" = "no"; then 2386 want_tools=no 2387 else 2388 want_tools=yes 2389 fi 2390fi 2391 2392########################################## 2393# L2TPV3 probe 2394 2395cat > $TMPC <<EOF 2396#include <sys/socket.h> 2397#include <linux/ip.h> 2398int main(void) { return sizeof(struct mmsghdr); } 2399EOF 2400if compile_prog "" "" ; then 2401 l2tpv3=yes 2402else 2403 l2tpv3=no 2404fi 2405 2406######################################### 2407# vhost interdependencies and host support 2408 2409# vhost backends 2410if test "$vhost_user" = "yes" && test "$linux" != "yes"; then 2411 error_exit "vhost-user is only available on Linux" 2412fi 2413test "$vhost_vdpa" = "" && vhost_vdpa=$linux 2414if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 2415 error_exit "vhost-vdpa is only available on Linux" 2416fi 2417test "$vhost_kernel" = "" && vhost_kernel=$linux 2418if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2419 error_exit "vhost-kernel is only available on Linux" 2420fi 2421 2422# vhost-kernel devices 2423test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2424if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2425 error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2426fi 2427test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2428if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2429 error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2430fi 2431 2432# vhost-user backends 2433test "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2434if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2435 error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2436fi 2437test "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2438if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2439 error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2440fi 2441test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 2442if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 2443 error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 2444fi 2445#vhost-vdpa backends 2446test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 2447if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 2448 error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 2449fi 2450 2451# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity 2452if test "$vhost_net" = ""; then 2453 test "$vhost_net_user" = "yes" && vhost_net=yes 2454 test "$vhost_net_vdpa" = "yes" && vhost_net=yes 2455 test "$vhost_kernel" = "yes" && vhost_net=yes 2456fi 2457 2458########################################## 2459# pkg-config probe 2460 2461if ! has "$pkg_config_exe"; then 2462 error_exit "pkg-config binary '$pkg_config_exe' not found" 2463fi 2464 2465########################################## 2466# NPTL probe 2467 2468if test "$linux_user" = "yes"; then 2469 cat > $TMPC <<EOF 2470#include <sched.h> 2471#include <linux/futex.h> 2472int main(void) { 2473#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2474#error bork 2475#endif 2476 return 0; 2477} 2478EOF 2479 if ! compile_object ; then 2480 feature_not_found "nptl" "Install glibc and linux kernel headers." 2481 fi 2482fi 2483 2484########################################## 2485# xen probe 2486 2487if test "$xen" != "disabled" ; then 2488 # Check whether Xen library path is specified via --extra-ldflags to avoid 2489 # overriding this setting with pkg-config output. If not, try pkg-config 2490 # to obtain all needed flags. 2491 2492 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2493 $pkg_config --exists xencontrol ; then 2494 xen_ctrl_version="$(printf '%d%02d%02d' \ 2495 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2496 xen=enabled 2497 xen_pc="xencontrol xenstore xenforeignmemory xengnttab" 2498 xen_pc="$xen_pc xenevtchn xendevicemodel" 2499 if $pkg_config --exists xentoolcore; then 2500 xen_pc="$xen_pc xentoolcore" 2501 fi 2502 xen_cflags="$($pkg_config --cflags $xen_pc)" 2503 xen_libs="$($pkg_config --libs $xen_pc)" 2504 else 2505 2506 xen_libs="-lxenstore -lxenctrl" 2507 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2508 2509 # First we test whether Xen headers and libraries are available. 2510 # If no, we are done and there is no Xen support. 2511 # If yes, more tests are run to detect the Xen version. 2512 2513 # Xen (any) 2514 cat > $TMPC <<EOF 2515#include <xenctrl.h> 2516int main(void) { 2517 return 0; 2518} 2519EOF 2520 if ! compile_prog "" "$xen_libs" ; then 2521 # Xen not found 2522 if test "$xen" = "enabled" ; then 2523 feature_not_found "xen" "Install xen devel" 2524 fi 2525 xen=disabled 2526 2527 # Xen unstable 2528 elif 2529 cat > $TMPC <<EOF && 2530#undef XC_WANT_COMPAT_DEVICEMODEL_API 2531#define __XEN_TOOLS__ 2532#include <xendevicemodel.h> 2533#include <xenforeignmemory.h> 2534int main(void) { 2535 xendevicemodel_handle *xd; 2536 xenforeignmemory_handle *xfmem; 2537 2538 xd = xendevicemodel_open(0, 0); 2539 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 2540 2541 xfmem = xenforeignmemory_open(0, 0); 2542 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2543 2544 return 0; 2545} 2546EOF 2547 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 2548 then 2549 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 2550 xen_ctrl_version=41100 2551 xen=enabled 2552 elif 2553 cat > $TMPC <<EOF && 2554#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2555#include <xenforeignmemory.h> 2556#include <xentoolcore.h> 2557int main(void) { 2558 xenforeignmemory_handle *xfmem; 2559 2560 xfmem = xenforeignmemory_open(0, 0); 2561 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 2562 xentoolcore_restrict_all(0); 2563 2564 return 0; 2565} 2566EOF 2567 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 2568 then 2569 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 2570 xen_ctrl_version=41000 2571 xen=enabled 2572 elif 2573 cat > $TMPC <<EOF && 2574#undef XC_WANT_COMPAT_DEVICEMODEL_API 2575#define __XEN_TOOLS__ 2576#include <xendevicemodel.h> 2577int main(void) { 2578 xendevicemodel_handle *xd; 2579 2580 xd = xendevicemodel_open(0, 0); 2581 xendevicemodel_close(xd); 2582 2583 return 0; 2584} 2585EOF 2586 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2587 then 2588 xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2589 xen_ctrl_version=40900 2590 xen=enabled 2591 elif 2592 cat > $TMPC <<EOF && 2593/* 2594 * If we have stable libs the we don't want the libxc compat 2595 * layers, regardless of what CFLAGS we may have been given. 2596 * 2597 * Also, check if xengnttab_grant_copy_segment_t is defined and 2598 * grant copy operation is implemented. 2599 */ 2600#undef XC_WANT_COMPAT_EVTCHN_API 2601#undef XC_WANT_COMPAT_GNTTAB_API 2602#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2603#include <xenctrl.h> 2604#include <xenstore.h> 2605#include <xenevtchn.h> 2606#include <xengnttab.h> 2607#include <xenforeignmemory.h> 2608#include <stdint.h> 2609#include <xen/hvm/hvm_info_table.h> 2610#if !defined(HVM_MAX_VCPUS) 2611# error HVM_MAX_VCPUS not defined 2612#endif 2613int main(void) { 2614 xc_interface *xc = NULL; 2615 xenforeignmemory_handle *xfmem; 2616 xenevtchn_handle *xe; 2617 xengnttab_handle *xg; 2618 xengnttab_grant_copy_segment_t* seg = NULL; 2619 2620 xs_daemon_open(); 2621 2622 xc = xc_interface_open(0, 0, 0); 2623 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2624 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2625 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2626 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2627 2628 xfmem = xenforeignmemory_open(0, 0); 2629 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2630 2631 xe = xenevtchn_open(0, 0); 2632 xenevtchn_fd(xe); 2633 2634 xg = xengnttab_open(0, 0); 2635 xengnttab_grant_copy(xg, 0, seg); 2636 2637 return 0; 2638} 2639EOF 2640 compile_prog "" "$xen_libs $xen_stable_libs" 2641 then 2642 xen_ctrl_version=40800 2643 xen=enabled 2644 elif 2645 cat > $TMPC <<EOF && 2646/* 2647 * If we have stable libs the we don't want the libxc compat 2648 * layers, regardless of what CFLAGS we may have been given. 2649 */ 2650#undef XC_WANT_COMPAT_EVTCHN_API 2651#undef XC_WANT_COMPAT_GNTTAB_API 2652#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2653#include <xenctrl.h> 2654#include <xenstore.h> 2655#include <xenevtchn.h> 2656#include <xengnttab.h> 2657#include <xenforeignmemory.h> 2658#include <stdint.h> 2659#include <xen/hvm/hvm_info_table.h> 2660#if !defined(HVM_MAX_VCPUS) 2661# error HVM_MAX_VCPUS not defined 2662#endif 2663int main(void) { 2664 xc_interface *xc = NULL; 2665 xenforeignmemory_handle *xfmem; 2666 xenevtchn_handle *xe; 2667 xengnttab_handle *xg; 2668 2669 xs_daemon_open(); 2670 2671 xc = xc_interface_open(0, 0, 0); 2672 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2673 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2674 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2675 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2676 2677 xfmem = xenforeignmemory_open(0, 0); 2678 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2679 2680 xe = xenevtchn_open(0, 0); 2681 xenevtchn_fd(xe); 2682 2683 xg = xengnttab_open(0, 0); 2684 xengnttab_map_grant_ref(xg, 0, 0, 0); 2685 2686 return 0; 2687} 2688EOF 2689 compile_prog "" "$xen_libs $xen_stable_libs" 2690 then 2691 xen_ctrl_version=40701 2692 xen=enabled 2693 2694 # Xen 4.6 2695 elif 2696 cat > $TMPC <<EOF && 2697#include <xenctrl.h> 2698#include <xenstore.h> 2699#include <stdint.h> 2700#include <xen/hvm/hvm_info_table.h> 2701#if !defined(HVM_MAX_VCPUS) 2702# error HVM_MAX_VCPUS not defined 2703#endif 2704int main(void) { 2705 xc_interface *xc; 2706 xs_daemon_open(); 2707 xc = xc_interface_open(0, 0, 0); 2708 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2709 xc_gnttab_open(NULL, 0); 2710 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2711 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2712 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2713 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2714 return 0; 2715} 2716EOF 2717 compile_prog "" "$xen_libs" 2718 then 2719 xen_ctrl_version=40600 2720 xen=enabled 2721 2722 # Xen 4.5 2723 elif 2724 cat > $TMPC <<EOF && 2725#include <xenctrl.h> 2726#include <xenstore.h> 2727#include <stdint.h> 2728#include <xen/hvm/hvm_info_table.h> 2729#if !defined(HVM_MAX_VCPUS) 2730# error HVM_MAX_VCPUS not defined 2731#endif 2732int main(void) { 2733 xc_interface *xc; 2734 xs_daemon_open(); 2735 xc = xc_interface_open(0, 0, 0); 2736 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2737 xc_gnttab_open(NULL, 0); 2738 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2739 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2740 xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 2741 return 0; 2742} 2743EOF 2744 compile_prog "" "$xen_libs" 2745 then 2746 xen_ctrl_version=40500 2747 xen=enabled 2748 2749 elif 2750 cat > $TMPC <<EOF && 2751#include <xenctrl.h> 2752#include <xenstore.h> 2753#include <stdint.h> 2754#include <xen/hvm/hvm_info_table.h> 2755#if !defined(HVM_MAX_VCPUS) 2756# error HVM_MAX_VCPUS not defined 2757#endif 2758int main(void) { 2759 xc_interface *xc; 2760 xs_daemon_open(); 2761 xc = xc_interface_open(0, 0, 0); 2762 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2763 xc_gnttab_open(NULL, 0); 2764 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2765 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2766 return 0; 2767} 2768EOF 2769 compile_prog "" "$xen_libs" 2770 then 2771 xen_ctrl_version=40200 2772 xen=enabled 2773 2774 else 2775 if test "$xen" = "enabled" ; then 2776 feature_not_found "xen (unsupported version)" \ 2777 "Install a supported xen (xen 4.2 or newer)" 2778 fi 2779 xen=disabled 2780 fi 2781 2782 if test "$xen" = enabled; then 2783 if test $xen_ctrl_version -ge 40701 ; then 2784 xen_libs="$xen_libs $xen_stable_libs " 2785 fi 2786 fi 2787 fi 2788fi 2789 2790########################################## 2791# RDMA needs OpenFabrics libraries 2792if test "$rdma" != "no" ; then 2793 cat > $TMPC <<EOF 2794#include <rdma/rdma_cma.h> 2795int main(void) { return 0; } 2796EOF 2797 rdma_libs="-lrdmacm -libverbs -libumad" 2798 if compile_prog "" "$rdma_libs" ; then 2799 rdma="yes" 2800 else 2801 if test "$rdma" = "yes" ; then 2802 error_exit \ 2803 " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 2804 " Your options:" \ 2805 " (1) Fast: Install infiniband packages (devel) from your distro." \ 2806 " (2) Cleanest: Install libraries from www.openfabrics.org" \ 2807 " (3) Also: Install softiwarp if you don't have RDMA hardware" 2808 fi 2809 rdma="no" 2810 fi 2811fi 2812 2813########################################## 2814# PVRDMA detection 2815 2816cat > $TMPC <<EOF && 2817#include <sys/mman.h> 2818 2819int 2820main(void) 2821{ 2822 char buf = 0; 2823 void *addr = &buf; 2824 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 2825 2826 return 0; 2827} 2828EOF 2829 2830if test "$rdma" = "yes" ; then 2831 case "$pvrdma" in 2832 "") 2833 if compile_prog "" ""; then 2834 pvrdma="yes" 2835 else 2836 pvrdma="no" 2837 fi 2838 ;; 2839 "yes") 2840 if ! compile_prog "" ""; then 2841 error_exit "PVRDMA is not supported since mremap is not implemented" 2842 fi 2843 pvrdma="yes" 2844 ;; 2845 "no") 2846 pvrdma="no" 2847 ;; 2848 esac 2849else 2850 if test "$pvrdma" = "yes" ; then 2851 error_exit "PVRDMA requires rdma suppport" 2852 fi 2853 pvrdma="no" 2854fi 2855 2856# Let's see if enhanced reg_mr is supported 2857if test "$pvrdma" = "yes" ; then 2858 2859cat > $TMPC <<EOF && 2860#include <infiniband/verbs.h> 2861 2862int 2863main(void) 2864{ 2865 struct ibv_mr *mr; 2866 struct ibv_pd *pd = NULL; 2867 size_t length = 10; 2868 uint64_t iova = 0; 2869 int access = 0; 2870 void *addr = NULL; 2871 2872 mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 2873 2874 ibv_dereg_mr(mr); 2875 2876 return 0; 2877} 2878EOF 2879 if ! compile_prog "" "-libverbs"; then 2880 QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 2881 fi 2882fi 2883 2884########################################## 2885# xfsctl() probe, used for file-posix.c 2886if test "$xfs" != "no" ; then 2887 cat > $TMPC << EOF 2888#include <stddef.h> /* NULL */ 2889#include <xfs/xfs.h> 2890int main(void) 2891{ 2892 xfsctl(NULL, 0, 0, NULL); 2893 return 0; 2894} 2895EOF 2896 if compile_prog "" "" ; then 2897 xfs="yes" 2898 else 2899 if test "$xfs" = "yes" ; then 2900 feature_not_found "xfs" "Install xfsprogs/xfslibs devel" 2901 fi 2902 xfs=no 2903 fi 2904fi 2905 2906########################################## 2907# netmap support probe 2908# Apart from looking for netmap headers, we make sure that the host API version 2909# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 2910# a minor/major version number. Minor new features will be marked with values up 2911# to 15, and if something happens that requires a change to the backend we will 2912# move above 15, submit the backend fixes and modify this two bounds. 2913if test "$netmap" != "no" ; then 2914 cat > $TMPC << EOF 2915#include <inttypes.h> 2916#include <net/if.h> 2917#include <net/netmap.h> 2918#include <net/netmap_user.h> 2919#if (NETMAP_API < 11) || (NETMAP_API > 15) 2920#error 2921#endif 2922int main(void) { return 0; } 2923EOF 2924 if compile_prog "" "" ; then 2925 netmap=yes 2926 else 2927 if test "$netmap" = "yes" ; then 2928 feature_not_found "netmap" 2929 fi 2930 netmap=no 2931 fi 2932fi 2933 2934########################################## 2935# plugin linker support probe 2936 2937if test "$plugins" != "no"; then 2938 2939 ######################################### 2940 # See if --dynamic-list is supported by the linker 2941 2942 ld_dynamic_list="no" 2943 cat > $TMPTXT <<EOF 2944{ 2945 foo; 2946}; 2947EOF 2948 2949 cat > $TMPC <<EOF 2950#include <stdio.h> 2951void foo(void); 2952 2953void foo(void) 2954{ 2955 printf("foo\n"); 2956} 2957 2958int main(void) 2959{ 2960 foo(); 2961 return 0; 2962} 2963EOF 2964 2965 if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 2966 ld_dynamic_list="yes" 2967 fi 2968 2969 ######################################### 2970 # See if -exported_symbols_list is supported by the linker 2971 2972 ld_exported_symbols_list="no" 2973 cat > $TMPTXT <<EOF 2974 _foo 2975EOF 2976 2977 if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 2978 ld_exported_symbols_list="yes" 2979 fi 2980 2981 if test "$ld_dynamic_list" = "no" && 2982 test "$ld_exported_symbols_list" = "no" ; then 2983 if test "$plugins" = "yes"; then 2984 error_exit \ 2985 "Plugin support requires dynamic linking and specifying a set of symbols " \ 2986 "that are exported to plugins. Unfortunately your linker doesn't " \ 2987 "support the flag (--dynamic-list or -exported_symbols_list) used " \ 2988 "for this purpose." 2989 else 2990 plugins="no" 2991 fi 2992 else 2993 plugins="yes" 2994 fi 2995fi 2996 2997########################################## 2998# glib support probe 2999 3000glib_req_ver=2.56 3001glib_modules=gthread-2.0 3002if test "$modules" = yes; then 3003 glib_modules="$glib_modules gmodule-export-2.0" 3004elif test "$plugins" = "yes"; then 3005 glib_modules="$glib_modules gmodule-no-export-2.0" 3006fi 3007 3008for i in $glib_modules; do 3009 if $pkg_config --atleast-version=$glib_req_ver $i; then 3010 glib_cflags=$($pkg_config --cflags $i) 3011 glib_libs=$($pkg_config --libs $i) 3012 else 3013 error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3014 fi 3015done 3016 3017# This workaround is required due to a bug in pkg-config file for glib as it 3018# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 3019 3020if test "$static" = yes && test "$mingw32" = yes; then 3021 glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags" 3022fi 3023 3024if ! test "$gio" = "no"; then 3025 pass=no 3026 if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 3027 gio_cflags=$($pkg_config --cflags gio-2.0) 3028 gio_libs=$($pkg_config --libs gio-2.0) 3029 gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 3030 if ! has "$gdbus_codegen"; then 3031 gdbus_codegen= 3032 fi 3033 # Check that the libraries actually work -- Ubuntu 18.04 ships 3034 # with pkg-config --static --libs data for gio-2.0 that is missing 3035 # -lblkid and will give a link error. 3036 cat > $TMPC <<EOF 3037#include <gio/gio.h> 3038int main(void) 3039{ 3040 g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); 3041 return 0; 3042} 3043EOF 3044 if compile_prog "$gio_cflags" "$gio_libs" ; then 3045 pass=yes 3046 else 3047 pass=no 3048 fi 3049 3050 if test "$pass" = "yes" && 3051 $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 3052 gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 3053 gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 3054 fi 3055 fi 3056 3057 if test "$pass" = "no"; then 3058 if test "$gio" = "yes"; then 3059 feature_not_found "gio" "Install libgio >= 2.0" 3060 else 3061 gio=no 3062 fi 3063 else 3064 gio=yes 3065 fi 3066fi 3067 3068# Sanity check that the current size_t matches the 3069# size that glib thinks it should be. This catches 3070# problems on multi-arch where people try to build 3071# 32-bit QEMU while pointing at 64-bit glib headers 3072cat > $TMPC <<EOF 3073#include <glib.h> 3074#include <unistd.h> 3075 3076#define QEMU_BUILD_BUG_ON(x) \ 3077 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3078 3079int main(void) { 3080 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3081 return 0; 3082} 3083EOF 3084 3085if ! compile_prog "$glib_cflags" "$glib_libs" ; then 3086 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3087 "You probably need to set PKG_CONFIG_LIBDIR"\ 3088 "to point to the right pkg-config files for your"\ 3089 "build target" 3090fi 3091 3092# Silence clang warnings triggered by glib < 2.57.2 3093cat > $TMPC << EOF 3094#include <glib.h> 3095typedef struct Foo { 3096 int i; 3097} Foo; 3098static void foo_free(Foo *f) 3099{ 3100 g_free(f); 3101} 3102G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 3103int main(void) { return 0; } 3104EOF 3105if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3106 if cc_has_warning_flag "-Wno-unused-function"; then 3107 glib_cflags="$glib_cflags -Wno-unused-function" 3108 CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function" 3109 fi 3110fi 3111 3112########################################## 3113# SHA command probe for modules 3114if test "$modules" = yes; then 3115 shacmd_probe="sha1sum sha1 shasum" 3116 for c in $shacmd_probe; do 3117 if has $c; then 3118 shacmd="$c" 3119 break 3120 fi 3121 done 3122 if test "$shacmd" = ""; then 3123 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3124 fi 3125fi 3126 3127########################################## 3128# libssh probe 3129if test "$libssh" != "no" ; then 3130 if $pkg_config --exists "libssh >= 0.8.7"; then 3131 libssh_cflags=$($pkg_config libssh --cflags) 3132 libssh_libs=$($pkg_config libssh --libs) 3133 libssh=yes 3134 else 3135 if test "$libssh" = "yes" ; then 3136 error_exit "libssh required for --enable-libssh" 3137 fi 3138 libssh=no 3139 fi 3140fi 3141 3142########################################## 3143# TPM emulation is only on POSIX 3144 3145if test "$tpm" = ""; then 3146 if test "$mingw32" = "yes"; then 3147 tpm=no 3148 else 3149 tpm=yes 3150 fi 3151elif test "$tpm" = "yes"; then 3152 if test "$mingw32" = "yes" ; then 3153 error_exit "TPM emulation only available on POSIX systems" 3154 fi 3155fi 3156 3157########################################## 3158# iovec probe 3159cat > $TMPC <<EOF 3160#include <sys/types.h> 3161#include <sys/uio.h> 3162#include <unistd.h> 3163int main(void) { return sizeof(struct iovec); } 3164EOF 3165iovec=no 3166if compile_prog "" "" ; then 3167 iovec=yes 3168fi 3169 3170########################################## 3171# fdt probe 3172 3173case "$fdt" in 3174 auto | enabled | internal) 3175 # Simpler to always update submodule, even if not needed. 3176 git_submodules="${git_submodules} dtc" 3177 ;; 3178esac 3179 3180########################################## 3181# opengl probe (for sdl2, gtk) 3182 3183if test "$opengl" != "no" ; then 3184 epoxy=no 3185 if $pkg_config epoxy; then 3186 cat > $TMPC << EOF 3187#include <epoxy/egl.h> 3188int main(void) { return 0; } 3189EOF 3190 if compile_prog "" "" ; then 3191 epoxy=yes 3192 fi 3193 fi 3194 3195 if test "$epoxy" = "yes" ; then 3196 opengl_cflags="$($pkg_config --cflags epoxy)" 3197 opengl_libs="$($pkg_config --libs epoxy)" 3198 opengl=yes 3199 else 3200 if test "$opengl" = "yes" ; then 3201 feature_not_found "opengl" "Please install epoxy with EGL" 3202 fi 3203 opengl_cflags="" 3204 opengl_libs="" 3205 opengl=no 3206 fi 3207fi 3208 3209########################################## 3210# libnuma probe 3211 3212if test "$numa" != "no" ; then 3213 cat > $TMPC << EOF 3214#include <numa.h> 3215int main(void) { return numa_available(); } 3216EOF 3217 3218 if compile_prog "" "-lnuma" ; then 3219 numa=yes 3220 numa_libs="-lnuma" 3221 else 3222 if test "$numa" = "yes" ; then 3223 feature_not_found "numa" "install numactl devel" 3224 fi 3225 numa=no 3226 fi 3227fi 3228 3229malloc=system 3230if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 3231 echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 3232 exit 1 3233elif test "$tcmalloc" = "yes" ; then 3234 malloc=tcmalloc 3235elif test "$jemalloc" = "yes" ; then 3236 malloc=jemalloc 3237fi 3238 3239# check for usbfs 3240have_usbfs=no 3241if test "$linux_user" = "yes"; then 3242 cat > $TMPC << EOF 3243#include <linux/usbdevice_fs.h> 3244 3245#ifndef USBDEVFS_GET_CAPABILITIES 3246#error "USBDEVFS_GET_CAPABILITIES undefined" 3247#endif 3248 3249#ifndef USBDEVFS_DISCONNECT_CLAIM 3250#error "USBDEVFS_DISCONNECT_CLAIM undefined" 3251#endif 3252 3253int main(void) 3254{ 3255 return 0; 3256} 3257EOF 3258 if compile_prog "" ""; then 3259 have_usbfs=yes 3260 fi 3261fi 3262 3263########################################## 3264# spice probe 3265if test "$spice_protocol" != "no" ; then 3266 spice_protocol_cflags=$($pkg_config --cflags spice-protocol 2>/dev/null) 3267 if $pkg_config --atleast-version=0.12.3 spice-protocol; then 3268 spice_protocol="yes" 3269 else 3270 if test "$spice_protocol" = "yes" ; then 3271 feature_not_found "spice_protocol" \ 3272 "Install spice-protocol(>=0.12.3) devel" 3273 fi 3274 spice_protocol="no" 3275 fi 3276fi 3277 3278if test "$spice" != "no" ; then 3279 cat > $TMPC << EOF 3280#include <spice.h> 3281int main(void) { spice_server_new(); return 0; } 3282EOF 3283 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 3284 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 3285 if $pkg_config --atleast-version=0.12.5 spice-server && \ 3286 test "$spice_protocol" = "yes" && \ 3287 compile_prog "$spice_cflags" "$spice_libs" ; then 3288 spice="yes" 3289 else 3290 if test "$spice" = "yes" ; then 3291 feature_not_found "spice" \ 3292 "Install spice-server(>=0.12.5) devel" 3293 fi 3294 spice="no" 3295 fi 3296fi 3297 3298########################################## 3299# check if we have VSS SDK headers for win 3300 3301if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 3302 test "$vss_win32_sdk" != "no" ; then 3303 case "$vss_win32_sdk" in 3304 "") vss_win32_include="-isystem $source_path" ;; 3305 *\ *) # The SDK is installed in "Program Files" by default, but we cannot 3306 # handle path with spaces. So we symlink the headers into ".sdk/vss". 3307 vss_win32_include="-isystem $source_path/.sdk/vss" 3308 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 3309 ;; 3310 *) vss_win32_include="-isystem $vss_win32_sdk" 3311 esac 3312 cat > $TMPC << EOF 3313#define __MIDL_user_allocate_free_DEFINED__ 3314#include <inc/win2003/vss.h> 3315int main(void) { return VSS_CTX_BACKUP; } 3316EOF 3317 if compile_prog "$vss_win32_include" "" ; then 3318 guest_agent_with_vss="yes" 3319 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 3320 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 3321 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 3322 else 3323 if test "$vss_win32_sdk" != "" ; then 3324 echo "ERROR: Please download and install Microsoft VSS SDK:" 3325 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 3326 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 3327 echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 3328 echo "ERROR: The headers are extracted in the directory \`inc'." 3329 feature_not_found "VSS support" 3330 fi 3331 guest_agent_with_vss="no" 3332 fi 3333fi 3334 3335########################################## 3336# lookup Windows platform SDK (if not specified) 3337# The SDK is needed only to build .tlb (type library) file of guest agent 3338# VSS provider from the source. It is usually unnecessary because the 3339# pre-compiled .tlb file is included. 3340 3341if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 3342 test "$guest_agent_with_vss" = "yes" ; then 3343 if test -z "$win_sdk"; then 3344 programfiles="$PROGRAMFILES" 3345 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 3346 if test -n "$programfiles"; then 3347 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 3348 else 3349 feature_not_found "Windows SDK" 3350 fi 3351 elif test "$win_sdk" = "no"; then 3352 win_sdk="" 3353 fi 3354fi 3355 3356########################################## 3357# check if mingw environment provides a recent ntddscsi.h 3358if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 3359 cat > $TMPC << EOF 3360#include <windows.h> 3361#include <ntddscsi.h> 3362int main(void) { 3363#if !defined(IOCTL_SCSI_GET_ADDRESS) 3364#error Missing required ioctl definitions 3365#endif 3366 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 3367 return addr.Lun; 3368} 3369EOF 3370 if compile_prog "" "" ; then 3371 guest_agent_ntddscsi=yes 3372 libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 3373 fi 3374fi 3375 3376########################################## 3377# capstone 3378 3379case "$capstone" in 3380 auto | enabled | internal) 3381 # Simpler to always update submodule, even if not needed. 3382 git_submodules="${git_submodules} capstone" 3383 ;; 3384esac 3385 3386########################################## 3387# check and set a backend for coroutine 3388 3389# We prefer ucontext, but it's not always possible. The fallback 3390# is sigcontext. On Windows the only valid backend is the Windows 3391# specific one. 3392 3393ucontext_works=no 3394if test "$darwin" != "yes"; then 3395 cat > $TMPC << EOF 3396#include <ucontext.h> 3397#ifdef __stub_makecontext 3398#error Ignoring glibc stub makecontext which will always fail 3399#endif 3400int main(void) { makecontext(0, 0, 0); return 0; } 3401EOF 3402 if compile_prog "" "" ; then 3403 ucontext_works=yes 3404 fi 3405fi 3406 3407if test "$coroutine" = ""; then 3408 if test "$mingw32" = "yes"; then 3409 coroutine=win32 3410 elif test "$ucontext_works" = "yes"; then 3411 coroutine=ucontext 3412 else 3413 coroutine=sigaltstack 3414 fi 3415else 3416 case $coroutine in 3417 windows) 3418 if test "$mingw32" != "yes"; then 3419 error_exit "'windows' coroutine backend only valid for Windows" 3420 fi 3421 # Unfortunately the user visible backend name doesn't match the 3422 # coroutine-*.c filename for this case, so we have to adjust it here. 3423 coroutine=win32 3424 ;; 3425 ucontext) 3426 if test "$ucontext_works" != "yes"; then 3427 feature_not_found "ucontext" 3428 fi 3429 ;; 3430 sigaltstack) 3431 if test "$mingw32" = "yes"; then 3432 error_exit "only the 'windows' coroutine backend is valid for Windows" 3433 fi 3434 ;; 3435 *) 3436 error_exit "unknown coroutine backend $coroutine" 3437 ;; 3438 esac 3439fi 3440 3441if test "$coroutine_pool" = ""; then 3442 coroutine_pool=yes 3443fi 3444 3445if test "$debug_stack_usage" = "yes"; then 3446 if test "$coroutine_pool" = "yes"; then 3447 echo "WARN: disabling coroutine pool for stack usage debugging" 3448 coroutine_pool=no 3449 fi 3450fi 3451 3452################################################## 3453# SafeStack 3454 3455 3456if test "$safe_stack" = "yes"; then 3457cat > $TMPC << EOF 3458int main(int argc, char *argv[]) 3459{ 3460#if ! __has_feature(safe_stack) 3461#error SafeStack Disabled 3462#endif 3463 return 0; 3464} 3465EOF 3466 flag="-fsanitize=safe-stack" 3467 # Check that safe-stack is supported and enabled. 3468 if compile_prog "-Werror $flag" "$flag"; then 3469 # Flag needed both at compilation and at linking 3470 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 3471 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 3472 else 3473 error_exit "SafeStack not supported by your compiler" 3474 fi 3475 if test "$coroutine" != "ucontext"; then 3476 error_exit "SafeStack is only supported by the coroutine backend ucontext" 3477 fi 3478else 3479cat > $TMPC << EOF 3480int main(int argc, char *argv[]) 3481{ 3482#if defined(__has_feature) 3483#if __has_feature(safe_stack) 3484#error SafeStack Enabled 3485#endif 3486#endif 3487 return 0; 3488} 3489EOF 3490if test "$safe_stack" = "no"; then 3491 # Make sure that safe-stack is disabled 3492 if ! compile_prog "-Werror" ""; then 3493 # SafeStack was already enabled, try to explicitly remove the feature 3494 flag="-fno-sanitize=safe-stack" 3495 if ! compile_prog "-Werror $flag" "$flag"; then 3496 error_exit "Configure cannot disable SafeStack" 3497 fi 3498 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 3499 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 3500 fi 3501else # "$safe_stack" = "" 3502 # Set safe_stack to yes or no based on pre-existing flags 3503 if compile_prog "-Werror" ""; then 3504 safe_stack="no" 3505 else 3506 safe_stack="yes" 3507 if test "$coroutine" != "ucontext"; then 3508 error_exit "SafeStack is only supported by the coroutine backend ucontext" 3509 fi 3510 fi 3511fi 3512fi 3513 3514######################################## 3515# check if cpuid.h is usable. 3516 3517cat > $TMPC << EOF 3518#include <cpuid.h> 3519int main(void) { 3520 unsigned a, b, c, d; 3521 int max = __get_cpuid_max(0, 0); 3522 3523 if (max >= 1) { 3524 __cpuid(1, a, b, c, d); 3525 } 3526 3527 if (max >= 7) { 3528 __cpuid_count(7, 0, a, b, c, d); 3529 } 3530 3531 return 0; 3532} 3533EOF 3534if compile_prog "" "" ; then 3535 cpuid_h=yes 3536fi 3537 3538########################################## 3539# avx2 optimization requirement check 3540# 3541# There is no point enabling this if cpuid.h is not usable, 3542# since we won't be able to select the new routines. 3543 3544if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 3545 cat > $TMPC << EOF 3546#pragma GCC push_options 3547#pragma GCC target("avx2") 3548#include <cpuid.h> 3549#include <immintrin.h> 3550static int bar(void *a) { 3551 __m256i x = *(__m256i *)a; 3552 return _mm256_testz_si256(x, x); 3553} 3554int main(int argc, char *argv[]) { return bar(argv[0]); } 3555EOF 3556 if compile_object "-Werror" ; then 3557 avx2_opt="yes" 3558 else 3559 avx2_opt="no" 3560 fi 3561fi 3562 3563########################################## 3564# avx512f optimization requirement check 3565# 3566# There is no point enabling this if cpuid.h is not usable, 3567# since we won't be able to select the new routines. 3568# by default, it is turned off. 3569# if user explicitly want to enable it, check environment 3570 3571if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 3572 cat > $TMPC << EOF 3573#pragma GCC push_options 3574#pragma GCC target("avx512f") 3575#include <cpuid.h> 3576#include <immintrin.h> 3577static int bar(void *a) { 3578 __m512i x = *(__m512i *)a; 3579 return _mm512_test_epi64_mask(x, x); 3580} 3581int main(int argc, char *argv[]) 3582{ 3583 return bar(argv[0]); 3584} 3585EOF 3586 if ! compile_object "-Werror" ; then 3587 avx512f_opt="no" 3588 fi 3589else 3590 avx512f_opt="no" 3591fi 3592 3593######################################## 3594# check if __[u]int128_t is usable. 3595 3596int128=no 3597cat > $TMPC << EOF 3598__int128_t a; 3599__uint128_t b; 3600int main (void) { 3601 a = a + b; 3602 b = a * b; 3603 a = a * a; 3604 return 0; 3605} 3606EOF 3607if compile_prog "" "" ; then 3608 int128=yes 3609fi 3610 3611######################################### 3612# See if 128-bit atomic operations are supported. 3613 3614atomic128=no 3615if test "$int128" = "yes"; then 3616 cat > $TMPC << EOF 3617int main(void) 3618{ 3619 unsigned __int128 x = 0, y = 0; 3620 y = __atomic_load(&x, 0); 3621 __atomic_store(&x, y, 0); 3622 __atomic_compare_exchange(&x, &y, x, 0, 0, 0); 3623 return 0; 3624} 3625EOF 3626 if compile_prog "" "" ; then 3627 atomic128=yes 3628 fi 3629fi 3630 3631cmpxchg128=no 3632if test "$int128" = yes && test "$atomic128" = no; then 3633 cat > $TMPC << EOF 3634int main(void) 3635{ 3636 unsigned __int128 x = 0, y = 0; 3637 __sync_val_compare_and_swap_16(&x, y, x); 3638 return 0; 3639} 3640EOF 3641 if compile_prog "" "" ; then 3642 cmpxchg128=yes 3643 fi 3644fi 3645 3646######################################### 3647# See if 64-bit atomic operations are supported. 3648# Note that without __atomic builtins, we can only 3649# assume atomic loads/stores max at pointer size. 3650 3651cat > $TMPC << EOF 3652#include <stdint.h> 3653int main(void) 3654{ 3655 uint64_t x = 0, y = 0; 3656 y = __atomic_load_n(&x, __ATOMIC_RELAXED); 3657 __atomic_store_n(&x, y, __ATOMIC_RELAXED); 3658 __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); 3659 __atomic_exchange_n(&x, y, __ATOMIC_RELAXED); 3660 __atomic_fetch_add(&x, y, __ATOMIC_RELAXED); 3661 return 0; 3662} 3663EOF 3664if compile_prog "" "" ; then 3665 atomic64=yes 3666fi 3667 3668######################################## 3669# check if getauxval is available. 3670 3671getauxval=no 3672cat > $TMPC << EOF 3673#include <sys/auxv.h> 3674int main(void) { 3675 return getauxval(AT_HWCAP) == 0; 3676} 3677EOF 3678if compile_prog "" "" ; then 3679 getauxval=yes 3680fi 3681 3682######################################## 3683# check if ccache is interfering with 3684# semantic analysis of macros 3685 3686unset CCACHE_CPP2 3687ccache_cpp2=no 3688cat > $TMPC << EOF 3689static const int Z = 1; 3690#define fn() ({ Z; }) 3691#define TAUT(X) ((X) == Z) 3692#define PAREN(X, Y) (X == Y) 3693#define ID(X) (X) 3694int main(int argc, char *argv[]) 3695{ 3696 int x = 0, y = 0; 3697 x = ID(x); 3698 x = fn(); 3699 fn(); 3700 if (PAREN(x, y)) return 0; 3701 if (TAUT(Z)) return 0; 3702 return 0; 3703} 3704EOF 3705 3706if ! compile_object "-Werror"; then 3707 ccache_cpp2=yes 3708fi 3709 3710################################################# 3711# clang does not support glibc + FORTIFY_SOURCE. 3712 3713if test "$fortify_source" != "no"; then 3714 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 3715 fortify_source="no"; 3716 elif test -n "$cxx" && has $cxx && 3717 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 3718 fortify_source="no"; 3719 else 3720 fortify_source="yes" 3721 fi 3722fi 3723 3724########################################## 3725# check for usable membarrier system call 3726if test "$membarrier" = "yes"; then 3727 have_membarrier=no 3728 if test "$mingw32" = "yes" ; then 3729 have_membarrier=yes 3730 elif test "$linux" = "yes" ; then 3731 cat > $TMPC << EOF 3732 #include <linux/membarrier.h> 3733 #include <sys/syscall.h> 3734 #include <unistd.h> 3735 #include <stdlib.h> 3736 int main(void) { 3737 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 3738 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 3739 exit(0); 3740 } 3741EOF 3742 if compile_prog "" "" ; then 3743 have_membarrier=yes 3744 fi 3745 fi 3746 if test "$have_membarrier" = "no"; then 3747 feature_not_found "membarrier" "membarrier system call not available" 3748 fi 3749else 3750 # Do not enable it by default even for Mingw32, because it doesn't 3751 # work on Wine. 3752 membarrier=no 3753fi 3754 3755########################################## 3756# check for usable AF_VSOCK environment 3757have_af_vsock=no 3758cat > $TMPC << EOF 3759#include <errno.h> 3760#include <sys/types.h> 3761#include <sys/socket.h> 3762#if !defined(AF_VSOCK) 3763# error missing AF_VSOCK flag 3764#endif 3765#include <linux/vm_sockets.h> 3766int main(void) { 3767 int sock, ret; 3768 struct sockaddr_vm svm; 3769 socklen_t len = sizeof(svm); 3770 sock = socket(AF_VSOCK, SOCK_STREAM, 0); 3771 ret = getpeername(sock, (struct sockaddr *)&svm, &len); 3772 if ((ret == -1) && (errno == ENOTCONN)) { 3773 return 0; 3774 } 3775 return -1; 3776} 3777EOF 3778if compile_prog "" "" ; then 3779 have_af_vsock=yes 3780fi 3781 3782########################################## 3783# check for usable AF_ALG environment 3784have_afalg=no 3785cat > $TMPC << EOF 3786#include <errno.h> 3787#include <sys/types.h> 3788#include <sys/socket.h> 3789#include <linux/if_alg.h> 3790int main(void) { 3791 int sock; 3792 sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 3793 return sock; 3794} 3795EOF 3796if compile_prog "" "" ; then 3797 have_afalg=yes 3798fi 3799if test "$crypto_afalg" = "yes" 3800then 3801 if test "$have_afalg" != "yes" 3802 then 3803 error_exit "AF_ALG requested but could not be detected" 3804 fi 3805fi 3806 3807 3808########################################## 3809# checks for sanitizers 3810 3811have_asan=no 3812have_ubsan=no 3813have_asan_iface_h=no 3814have_asan_iface_fiber=no 3815 3816if test "$sanitizers" = "yes" ; then 3817 write_c_skeleton 3818 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 3819 have_asan=yes 3820 fi 3821 3822 # we could use a simple skeleton for flags checks, but this also 3823 # detect the static linking issue of ubsan, see also: 3824 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 3825 cat > $TMPC << EOF 3826#include <stdlib.h> 3827int main(void) { 3828 void *tmp = malloc(10); 3829 if (tmp != NULL) { 3830 return *(int *)(tmp + 2); 3831 } 3832 return 1; 3833} 3834EOF 3835 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 3836 have_ubsan=yes 3837 fi 3838 3839 if check_include "sanitizer/asan_interface.h" ; then 3840 have_asan_iface_h=yes 3841 fi 3842 3843 cat > $TMPC << EOF 3844#include <sanitizer/asan_interface.h> 3845int main(void) { 3846 __sanitizer_start_switch_fiber(0, 0, 0); 3847 return 0; 3848} 3849EOF 3850 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 3851 have_asan_iface_fiber=yes 3852 fi 3853fi 3854 3855# Thread sanitizer is, for now, much noisier than the other sanitizers; 3856# keep it separate until that is not the case. 3857if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 3858 error_exit "TSAN is not supported with other sanitiziers." 3859fi 3860have_tsan=no 3861have_tsan_iface_fiber=no 3862if test "$tsan" = "yes" ; then 3863 write_c_skeleton 3864 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 3865 have_tsan=yes 3866 fi 3867 cat > $TMPC << EOF 3868#include <sanitizer/tsan_interface.h> 3869int main(void) { 3870 __tsan_create_fiber(0); 3871 return 0; 3872} 3873EOF 3874 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 3875 have_tsan_iface_fiber=yes 3876 fi 3877fi 3878 3879########################################## 3880# check for slirp 3881 3882case "$slirp" in 3883 auto | enabled | internal) 3884 # Simpler to always update submodule, even if not needed. 3885 git_submodules="${git_submodules} slirp" 3886 ;; 3887esac 3888 3889# Check for slirp smbd dupport 3890: ${smbd=${SMBD-/usr/sbin/smbd}} 3891if test "$slirp_smbd" != "no" ; then 3892 if test "$mingw32" = "yes" ; then 3893 if test "$slirp_smbd" = "yes" ; then 3894 error_exit "Host smbd not supported on this platform." 3895 fi 3896 slirp_smbd=no 3897 else 3898 slirp_smbd=yes 3899 fi 3900fi 3901 3902########################################## 3903# check for usable __NR_keyctl syscall 3904 3905if test "$linux" = "yes" ; then 3906 3907 have_keyring=no 3908 cat > $TMPC << EOF 3909#include <errno.h> 3910#include <asm/unistd.h> 3911#include <linux/keyctl.h> 3912#include <unistd.h> 3913int main(void) { 3914 return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 3915} 3916EOF 3917 if compile_prog "" "" ; then 3918 have_keyring=yes 3919 fi 3920fi 3921if test "$secret_keyring" != "no" 3922then 3923 if test "$have_keyring" = "yes" 3924 then 3925 secret_keyring=yes 3926 else 3927 if test "$secret_keyring" = "yes" 3928 then 3929 error_exit "syscall __NR_keyctl requested, \ 3930but not implemented on your system" 3931 else 3932 secret_keyring=no 3933 fi 3934 fi 3935fi 3936 3937########################################## 3938# End of CC checks 3939# After here, no more $cc or $ld runs 3940 3941write_c_skeleton 3942 3943if test "$gcov" = "yes" ; then 3944 : 3945elif test "$fortify_source" = "yes" ; then 3946 QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 3947 debug=no 3948fi 3949 3950case "$ARCH" in 3951alpha) 3952 # Ensure there's only a single GP 3953 QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 3954;; 3955esac 3956 3957if test "$gprof" = "yes" ; then 3958 QEMU_CFLAGS="-p $QEMU_CFLAGS" 3959 QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 3960fi 3961 3962if test "$have_asan" = "yes"; then 3963 QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 3964 QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 3965 if test "$have_asan_iface_h" = "no" ; then 3966 echo "ASAN build enabled, but ASAN header missing." \ 3967 "Without code annotation, the report may be inferior." 3968 elif test "$have_asan_iface_fiber" = "no" ; then 3969 echo "ASAN build enabled, but ASAN header is too old." \ 3970 "Without code annotation, the report may be inferior." 3971 fi 3972fi 3973if test "$have_tsan" = "yes" ; then 3974 if test "$have_tsan_iface_fiber" = "yes" ; then 3975 QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 3976 QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 3977 else 3978 error_exit "Cannot enable TSAN due to missing fiber annotation interface." 3979 fi 3980elif test "$tsan" = "yes" ; then 3981 error_exit "Cannot enable TSAN due to missing sanitize thread interface." 3982fi 3983if test "$have_ubsan" = "yes"; then 3984 QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 3985 QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 3986fi 3987 3988########################################## 3989 3990# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 3991if test "$solaris" = "no" && test "$tsan" = "no"; then 3992 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 3993 QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 3994 fi 3995fi 3996 3997# Use ASLR, no-SEH and DEP if available 3998if test "$mingw32" = "yes" ; then 3999 flags="--no-seh --nxcompat" 4000 4001 # Disable ASLR for debug builds to allow debugging with gdb 4002 if test "$debug" = "no" ; then 4003 flags="--dynamicbase $flags" 4004 fi 4005 4006 for flag in $flags; do 4007 if ld_has $flag ; then 4008 QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 4009 fi 4010 done 4011fi 4012 4013# Probe for guest agent support/options 4014 4015if [ "$guest_agent" != "no" ]; then 4016 if [ "$softmmu" = no -a "$want_tools" = no ] ; then 4017 guest_agent=no 4018 elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 4019 guest_agent=yes 4020 elif [ "$guest_agent" != yes ]; then 4021 guest_agent=no 4022 else 4023 error_exit "Guest agent is not supported on this platform" 4024 fi 4025fi 4026 4027# Guest agent Windows MSI package 4028 4029if test "$QEMU_GA_MANUFACTURER" = ""; then 4030 QEMU_GA_MANUFACTURER=QEMU 4031fi 4032if test "$QEMU_GA_DISTRO" = ""; then 4033 QEMU_GA_DISTRO=Linux 4034fi 4035if test "$QEMU_GA_VERSION" = ""; then 4036 QEMU_GA_VERSION=$(cat $source_path/VERSION) 4037fi 4038 4039QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin" 4040 4041# Mac OS X ships with a broken assembler 4042roms= 4043if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 4044 test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 4045 test "$targetos" != "Haiku" && test "$softmmu" = yes ; then 4046 # Different host OS linkers have different ideas about the name of the ELF 4047 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 4048 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 4049 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 4050 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 4051 ld_i386_emulation="$emu" 4052 roms="optionrom" 4053 break 4054 fi 4055 done 4056fi 4057 4058# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 4059# or -march=z10 (which is the lowest architecture level that Clang supports) 4060if test "$cpu" = "s390x" ; then 4061 write_c_skeleton 4062 compile_prog "-march=z900" "" 4063 has_z900=$? 4064 if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then 4065 if [ $has_z900 != 0 ]; then 4066 echo "WARNING: Your compiler does not support the z900!" 4067 echo " The s390-ccw bios will only work with guest CPUs >= z10." 4068 fi 4069 roms="$roms s390-ccw" 4070 # SLOF is required for building the s390-ccw firmware on s390x, 4071 # since it is using the libnet code from SLOF for network booting. 4072 git_submodules="${git_submodules} roms/SLOF" 4073 fi 4074fi 4075 4076# Check that the C++ compiler exists and works with the C compiler. 4077# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. 4078if has $cxx; then 4079 cat > $TMPC <<EOF 4080int c_function(void); 4081int main(void) { return c_function(); } 4082EOF 4083 4084 compile_object 4085 4086 cat > $TMPCXX <<EOF 4087extern "C" { 4088 int c_function(void); 4089} 4090int c_function(void) { return 42; } 4091EOF 4092 4093 update_cxxflags 4094 4095 if do_cxx $CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 4096 # C++ compiler $cxx works ok with C compiler $cc 4097 : 4098 else 4099 echo "C++ compiler $cxx does not work with C compiler $cc" 4100 echo "Disabling C++ specific optional code" 4101 cxx= 4102 fi 4103else 4104 echo "No C++ compiler available; disabling C++ specific optional code" 4105 cxx= 4106fi 4107 4108if !(GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then 4109 exit 1 4110fi 4111 4112config_host_mak="config-host.mak" 4113 4114echo "# Automatically generated by configure - do not modify" > $config_host_mak 4115echo >> $config_host_mak 4116 4117echo all: >> $config_host_mak 4118echo "GIT=$git" >> $config_host_mak 4119echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 4120echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak 4121 4122echo "ARCH=$ARCH" >> $config_host_mak 4123 4124if test "$debug_tcg" = "yes" ; then 4125 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 4126fi 4127if test "$strip_opt" = "yes" ; then 4128 echo "STRIP=${strip}" >> $config_host_mak 4129fi 4130if test "$mingw32" = "yes" ; then 4131 echo "CONFIG_WIN32=y" >> $config_host_mak 4132 if test "$guest_agent_with_vss" = "yes" ; then 4133 echo "CONFIG_QGA_VSS=y" >> $config_host_mak 4134 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 4135 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 4136 fi 4137 if test "$guest_agent_ntddscsi" = "yes" ; then 4138 echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 4139 fi 4140 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 4141 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 4142 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 4143 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 4144else 4145 echo "CONFIG_POSIX=y" >> $config_host_mak 4146fi 4147 4148if test "$linux" = "yes" ; then 4149 echo "CONFIG_LINUX=y" >> $config_host_mak 4150fi 4151 4152if test "$darwin" = "yes" ; then 4153 echo "CONFIG_DARWIN=y" >> $config_host_mak 4154fi 4155 4156if test "$solaris" = "yes" ; then 4157 echo "CONFIG_SOLARIS=y" >> $config_host_mak 4158fi 4159if test "$haiku" = "yes" ; then 4160 echo "CONFIG_HAIKU=y" >> $config_host_mak 4161fi 4162if test "$static" = "yes" ; then 4163 echo "CONFIG_STATIC=y" >> $config_host_mak 4164fi 4165if test "$profiler" = "yes" ; then 4166 echo "CONFIG_PROFILER=y" >> $config_host_mak 4167fi 4168if test "$want_tools" = "yes" ; then 4169 echo "CONFIG_TOOLS=y" >> $config_host_mak 4170fi 4171if test "$guest_agent" = "yes" ; then 4172 echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 4173fi 4174if test "$slirp_smbd" = "yes" ; then 4175 echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak 4176 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 4177fi 4178if test "$netmap" = "yes" ; then 4179 echo "CONFIG_NETMAP=y" >> $config_host_mak 4180fi 4181if test "$l2tpv3" = "yes" ; then 4182 echo "CONFIG_L2TPV3=y" >> $config_host_mak 4183fi 4184if test "$gprof" = "yes" ; then 4185 echo "CONFIG_GPROF=y" >> $config_host_mak 4186fi 4187echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 4188echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 4189if test "$block_drv_whitelist_tools" = "yes" ; then 4190 echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak 4191fi 4192if test "$xfs" = "yes" ; then 4193 echo "CONFIG_XFS=y" >> $config_host_mak 4194fi 4195qemu_version=$(head $source_path/VERSION) 4196echo "PKGVERSION=$pkgversion" >>$config_host_mak 4197echo "SRC_PATH=$source_path" >> $config_host_mak 4198echo "TARGET_DIRS=$target_list" >> $config_host_mak 4199if test "$modules" = "yes"; then 4200 # $shacmd can generate a hash started with digit, which the compiler doesn't 4201 # like as an symbol. So prefix it with an underscore 4202 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 4203 echo "CONFIG_MODULES=y" >> $config_host_mak 4204fi 4205if test "$module_upgrades" = "yes"; then 4206 echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 4207fi 4208if test "$have_usbfs" = "yes" ; then 4209 echo "CONFIG_USBFS=y" >> $config_host_mak 4210fi 4211if test "$gio" = "yes" ; then 4212 echo "CONFIG_GIO=y" >> $config_host_mak 4213 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 4214 echo "GIO_LIBS=$gio_libs" >> $config_host_mak 4215fi 4216if test "$gdbus_codegen" != "" ; then 4217 echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 4218fi 4219echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 4220 4221if test "$xen" = "enabled" ; then 4222 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 4223 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 4224 echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 4225 echo "XEN_LIBS=$xen_libs" >> $config_host_mak 4226fi 4227if test "$vhost_scsi" = "yes" ; then 4228 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 4229fi 4230if test "$vhost_net" = "yes" ; then 4231 echo "CONFIG_VHOST_NET=y" >> $config_host_mak 4232fi 4233if test "$vhost_net_user" = "yes" ; then 4234 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 4235fi 4236if test "$vhost_net_vdpa" = "yes" ; then 4237 echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 4238fi 4239if test "$vhost_crypto" = "yes" ; then 4240 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 4241fi 4242if test "$vhost_vsock" = "yes" ; then 4243 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 4244 if test "$vhost_user" = "yes" ; then 4245 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 4246 fi 4247fi 4248if test "$vhost_kernel" = "yes" ; then 4249 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 4250fi 4251if test "$vhost_user" = "yes" ; then 4252 echo "CONFIG_VHOST_USER=y" >> $config_host_mak 4253fi 4254if test "$vhost_vdpa" = "yes" ; then 4255 echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 4256fi 4257if test "$vhost_user_fs" = "yes" ; then 4258 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 4259fi 4260if test "$iovec" = "yes" ; then 4261 echo "CONFIG_IOVEC=y" >> $config_host_mak 4262fi 4263if test "$membarrier" = "yes" ; then 4264 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 4265fi 4266if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then 4267 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 4268fi 4269 4270if test "$spice_protocol" = "yes" ; then 4271 echo "CONFIG_SPICE_PROTOCOL=y" >> $config_host_mak 4272 echo "SPICE_PROTOCOL_CFLAGS=$spice_protocol_cflags" >> $config_host_mak 4273fi 4274if test "$spice" = "yes" ; then 4275 echo "CONFIG_SPICE=y" >> $config_host_mak 4276 echo "SPICE_CFLAGS=$spice_cflags $spice_protocol_cflags" >> $config_host_mak 4277 echo "SPICE_LIBS=$spice_libs" >> $config_host_mak 4278fi 4279 4280if test "$opengl" = "yes" ; then 4281 echo "CONFIG_OPENGL=y" >> $config_host_mak 4282 echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 4283 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 4284fi 4285 4286if test "$avx2_opt" = "yes" ; then 4287 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 4288fi 4289 4290if test "$avx512f_opt" = "yes" ; then 4291 echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 4292fi 4293 4294# XXX: suppress that 4295if [ "$bsd" = "yes" ] ; then 4296 echo "CONFIG_BSD=y" >> $config_host_mak 4297fi 4298 4299if test "$qom_cast_debug" = "yes" ; then 4300 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 4301fi 4302 4303echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 4304if test "$coroutine_pool" = "yes" ; then 4305 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 4306else 4307 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 4308fi 4309 4310if test "$debug_stack_usage" = "yes" ; then 4311 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 4312fi 4313 4314if test "$crypto_afalg" = "yes" ; then 4315 echo "CONFIG_AF_ALG=y" >> $config_host_mak 4316fi 4317 4318if test "$have_asan_iface_fiber" = "yes" ; then 4319 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 4320fi 4321 4322if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 4323 echo "CONFIG_TSAN=y" >> $config_host_mak 4324fi 4325 4326if test "$cpuid_h" = "yes" ; then 4327 echo "CONFIG_CPUID_H=y" >> $config_host_mak 4328fi 4329 4330if test "$int128" = "yes" ; then 4331 echo "CONFIG_INT128=y" >> $config_host_mak 4332fi 4333 4334if test "$atomic128" = "yes" ; then 4335 echo "CONFIG_ATOMIC128=y" >> $config_host_mak 4336fi 4337 4338if test "$cmpxchg128" = "yes" ; then 4339 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 4340fi 4341 4342if test "$atomic64" = "yes" ; then 4343 echo "CONFIG_ATOMIC64=y" >> $config_host_mak 4344fi 4345 4346if test "$getauxval" = "yes" ; then 4347 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 4348fi 4349 4350if test "$libssh" = "yes" ; then 4351 echo "CONFIG_LIBSSH=y" >> $config_host_mak 4352 echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 4353 echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 4354fi 4355 4356if test "$live_block_migration" = "yes" ; then 4357 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 4358fi 4359 4360if test "$tpm" = "yes"; then 4361 echo 'CONFIG_TPM=y' >> $config_host_mak 4362fi 4363 4364if test "$rdma" = "yes" ; then 4365 echo "CONFIG_RDMA=y" >> $config_host_mak 4366 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 4367fi 4368 4369if test "$pvrdma" = "yes" ; then 4370 echo "CONFIG_PVRDMA=y" >> $config_host_mak 4371fi 4372 4373if test "$replication" = "yes" ; then 4374 echo "CONFIG_REPLICATION=y" >> $config_host_mak 4375fi 4376 4377if test "$have_af_vsock" = "yes" ; then 4378 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 4379fi 4380 4381if test "$debug_mutex" = "yes" ; then 4382 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 4383fi 4384 4385if test "$bochs" = "yes" ; then 4386 echo "CONFIG_BOCHS=y" >> $config_host_mak 4387fi 4388if test "$cloop" = "yes" ; then 4389 echo "CONFIG_CLOOP=y" >> $config_host_mak 4390fi 4391if test "$dmg" = "yes" ; then 4392 echo "CONFIG_DMG=y" >> $config_host_mak 4393fi 4394if test "$qcow1" = "yes" ; then 4395 echo "CONFIG_QCOW1=y" >> $config_host_mak 4396fi 4397if test "$vdi" = "yes" ; then 4398 echo "CONFIG_VDI=y" >> $config_host_mak 4399fi 4400if test "$vvfat" = "yes" ; then 4401 echo "CONFIG_VVFAT=y" >> $config_host_mak 4402fi 4403if test "$qed" = "yes" ; then 4404 echo "CONFIG_QED=y" >> $config_host_mak 4405fi 4406if test "$parallels" = "yes" ; then 4407 echo "CONFIG_PARALLELS=y" >> $config_host_mak 4408fi 4409 4410if test "$plugins" = "yes" ; then 4411 echo "CONFIG_PLUGIN=y" >> $config_host_mak 4412 # Copy the export object list to the build dir 4413 if test "$ld_dynamic_list" = "yes" ; then 4414 echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 4415 ld_symbols=qemu-plugins-ld.symbols 4416 cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 4417 elif test "$ld_exported_symbols_list" = "yes" ; then 4418 echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 4419 ld64_symbols=qemu-plugins-ld64.symbols 4420 echo "# Automatically generated by configure - do not modify" > $ld64_symbols 4421 grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 4422 sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 4423 else 4424 error_exit \ 4425 "If \$plugins=yes, either \$ld_dynamic_list or " \ 4426 "\$ld_exported_symbols_list should have been set to 'yes'." 4427 fi 4428fi 4429 4430if test -n "$gdb_bin"; then 4431 gdb_version=$($gdb_bin --version | head -n 1) 4432 if version_ge ${gdb_version##* } 9.1; then 4433 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 4434 fi 4435fi 4436 4437if test "$secret_keyring" = "yes" ; then 4438 echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 4439fi 4440 4441echo "ROMS=$roms" >> $config_host_mak 4442echo "MAKE=$make" >> $config_host_mak 4443echo "PYTHON=$python" >> $config_host_mak 4444echo "GENISOIMAGE=$genisoimage" >> $config_host_mak 4445echo "MESON=$meson" >> $config_host_mak 4446echo "NINJA=$ninja" >> $config_host_mak 4447echo "CC=$cc" >> $config_host_mak 4448echo "HOST_CC=$host_cc" >> $config_host_mak 4449if $iasl -h > /dev/null 2>&1; then 4450 echo "CONFIG_IASL=$iasl" >> $config_host_mak 4451fi 4452echo "AR=$ar" >> $config_host_mak 4453echo "AS=$as" >> $config_host_mak 4454echo "CCAS=$ccas" >> $config_host_mak 4455echo "CPP=$cpp" >> $config_host_mak 4456echo "OBJCOPY=$objcopy" >> $config_host_mak 4457echo "LD=$ld" >> $config_host_mak 4458echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 4459echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 4460echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 4461echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 4462echo "GLIB_LIBS=$glib_libs" >> $config_host_mak 4463echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 4464echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 4465echo "EXESUF=$EXESUF" >> $config_host_mak 4466echo "LIBS_QGA=$libs_qga" >> $config_host_mak 4467 4468if test "$rng_none" = "yes"; then 4469 echo "CONFIG_RNG_NONE=y" >> $config_host_mak 4470fi 4471 4472# use included Linux headers 4473if test "$linux" = "yes" ; then 4474 mkdir -p linux-headers 4475 case "$cpu" in 4476 i386|x86_64|x32) 4477 linux_arch=x86 4478 ;; 4479 ppc|ppc64|ppc64le) 4480 linux_arch=powerpc 4481 ;; 4482 s390x) 4483 linux_arch=s390 4484 ;; 4485 aarch64) 4486 linux_arch=arm64 4487 ;; 4488 mips64) 4489 linux_arch=mips 4490 ;; 4491 *) 4492 # For most CPUs the kernel architecture name and QEMU CPU name match. 4493 linux_arch="$cpu" 4494 ;; 4495 esac 4496 # For non-KVM architectures we will not have asm headers 4497 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 4498 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 4499 fi 4500fi 4501 4502for target in $target_list; do 4503 target_dir="$target" 4504 target_name=$(echo $target | cut -d '-' -f 1) 4505 mkdir -p $target_dir 4506 case $target in 4507 *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; 4508 *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; 4509 esac 4510done 4511 4512echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak 4513if test "$default_targets" = "yes"; then 4514 echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 4515fi 4516 4517if test "$numa" = "yes"; then 4518 echo "CONFIG_NUMA=y" >> $config_host_mak 4519 echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 4520fi 4521 4522if test "$ccache_cpp2" = "yes"; then 4523 echo "export CCACHE_CPP2=y" >> $config_host_mak 4524fi 4525 4526if test "$safe_stack" = "yes"; then 4527 echo "CONFIG_SAFESTACK=y" >> $config_host_mak 4528fi 4529 4530# If we're using a separate build tree, set it up now. 4531# DIRS are directories which we simply mkdir in the build tree; 4532# LINKS are things to symlink back into the source tree 4533# (these can be both files and directories). 4534# Caution: do not add files or directories here using wildcards. This 4535# will result in problems later if a new file matching the wildcard is 4536# added to the source tree -- nothing will cause configure to be rerun 4537# so the build tree will be missing the link back to the new file, and 4538# tests might fail. Prefer to keep the relevant files in their own 4539# directory and symlink the directory instead. 4540# UNLINK is used to remove symlinks from older development versions 4541# that might get into the way when doing "git update" without doing 4542# a "make distclean" in between. 4543DIRS="tests tests/tcg tests/qapi-schema tests/qtest/libqos" 4544DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 4545DIRS="$DIRS docs docs/interop fsdev scsi" 4546DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 4547DIRS="$DIRS roms/seabios" 4548DIRS="$DIRS contrib/plugins/" 4549LINKS="Makefile" 4550LINKS="$LINKS tests/tcg/Makefile.target" 4551LINKS="$LINKS pc-bios/optionrom/Makefile" 4552LINKS="$LINKS pc-bios/s390-ccw/Makefile" 4553LINKS="$LINKS roms/seabios/Makefile" 4554LINKS="$LINKS pc-bios/qemu-icon.bmp" 4555LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 4556LINKS="$LINKS tests/acceptance tests/data" 4557LINKS="$LINKS tests/qemu-iotests/check" 4558LINKS="$LINKS python" 4559LINKS="$LINKS contrib/plugins/Makefile " 4560UNLINK="pc-bios/keymaps" 4561for bios_file in \ 4562 $source_path/pc-bios/*.bin \ 4563 $source_path/pc-bios/*.elf \ 4564 $source_path/pc-bios/*.lid \ 4565 $source_path/pc-bios/*.rom \ 4566 $source_path/pc-bios/*.dtb \ 4567 $source_path/pc-bios/*.img \ 4568 $source_path/pc-bios/openbios-* \ 4569 $source_path/pc-bios/u-boot.* \ 4570 $source_path/pc-bios/edk2-*.fd.bz2 \ 4571 $source_path/pc-bios/palcode-* \ 4572 $source_path/pc-bios/qemu_vga.ndrv 4573 4574do 4575 LINKS="$LINKS pc-bios/$(basename $bios_file)" 4576done 4577mkdir -p $DIRS 4578for f in $LINKS ; do 4579 if [ -e "$source_path/$f" ]; then 4580 symlink "$source_path/$f" "$f" 4581 fi 4582done 4583for f in $UNLINK ; do 4584 if [ -L "$f" ]; then 4585 rm -f "$f" 4586 fi 4587done 4588 4589(for i in $cross_cc_vars; do 4590 export $i 4591done 4592export target_list source_path use_containers ARCH 4593$source_path/tests/tcg/configure.sh) 4594 4595# temporary config to build submodules 4596for rom in seabios; do 4597 config_mak=roms/$rom/config.mak 4598 echo "# Automatically generated by configure - do not modify" > $config_mak 4599 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 4600 echo "AS=$as" >> $config_mak 4601 echo "CCAS=$ccas" >> $config_mak 4602 echo "CC=$cc" >> $config_mak 4603 echo "BCC=bcc" >> $config_mak 4604 echo "CPP=$cpp" >> $config_mak 4605 echo "OBJCOPY=objcopy" >> $config_mak 4606 echo "IASL=$iasl" >> $config_mak 4607 echo "LD=$ld" >> $config_mak 4608 echo "RANLIB=$ranlib" >> $config_mak 4609done 4610 4611if test "$skip_meson" = no; then 4612 cross="config-meson.cross.new" 4613 meson_quote() { 4614 echo "'$(echo $* | sed "s/ /','/g")'" 4615 } 4616 4617 echo "# Automatically generated by configure - do not modify" > $cross 4618 echo "[properties]" >> $cross 4619 4620 # unroll any custom device configs 4621 for a in $device_archs; do 4622 eval "c=\$devices_${a}" 4623 echo "${a}-softmmu = '$c'" >> $cross 4624 done 4625 4626 test -z "$cxx" && echo "link_language = 'c'" >> $cross 4627 echo "[built-in options]" >> $cross 4628 echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross 4629 echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross 4630 echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 4631 echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 4632 echo "[binaries]" >> $cross 4633 echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross 4634 test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross 4635 test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross 4636 echo "ar = [$(meson_quote $ar)]" >> $cross 4637 echo "nm = [$(meson_quote $nm)]" >> $cross 4638 echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross 4639 echo "ranlib = [$(meson_quote $ranlib)]" >> $cross 4640 if has $sdl2_config; then 4641 echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 4642 fi 4643 echo "strip = [$(meson_quote $strip)]" >> $cross 4644 echo "windres = [$(meson_quote $windres)]" >> $cross 4645 if test "$cross_compile" = "yes"; then 4646 cross_arg="--cross-file config-meson.cross" 4647 echo "[host_machine]" >> $cross 4648 if test "$mingw32" = "yes" ; then 4649 echo "system = 'windows'" >> $cross 4650 fi 4651 if test "$linux" = "yes" ; then 4652 echo "system = 'linux'" >> $cross 4653 fi 4654 if test "$darwin" = "yes" ; then 4655 echo "system = 'darwin'" >> $cross 4656 fi 4657 case "$ARCH" in 4658 i386) 4659 echo "cpu_family = 'x86'" >> $cross 4660 ;; 4661 x86_64|x32) 4662 echo "cpu_family = 'x86_64'" >> $cross 4663 ;; 4664 ppc64le) 4665 echo "cpu_family = 'ppc64'" >> $cross 4666 ;; 4667 *) 4668 echo "cpu_family = '$ARCH'" >> $cross 4669 ;; 4670 esac 4671 echo "cpu = '$cpu'" >> $cross 4672 if test "$bigendian" = "yes" ; then 4673 echo "endian = 'big'" >> $cross 4674 else 4675 echo "endian = 'little'" >> $cross 4676 fi 4677 else 4678 cross_arg="--native-file config-meson.cross" 4679 fi 4680 mv $cross config-meson.cross 4681 4682 rm -rf meson-private meson-info meson-logs 4683 NINJA=$ninja $meson setup \ 4684 --prefix "$prefix" \ 4685 --libdir "$libdir" \ 4686 --libexecdir "$libexecdir" \ 4687 --bindir "$bindir" \ 4688 --includedir "$includedir" \ 4689 --datadir "$datadir" \ 4690 --mandir "$mandir" \ 4691 --sysconfdir "$sysconfdir" \ 4692 --localedir "$localedir" \ 4693 --localstatedir "$local_statedir" \ 4694 -Ddocdir="$docdir" \ 4695 -Dqemu_firmwarepath="$firmwarepath" \ 4696 -Dqemu_suffix="$qemu_suffix" \ 4697 -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 4698 -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 4699 -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 4700 -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 4701 -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 4702 -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 4703 -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug -Dfuzzing=$fuzzing \ 4704 $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \ 4705 -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ 4706 -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \ 4707 -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ 4708 -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ 4709 -Dlibusb=$libusb -Dsmartcard=$smartcard -Dusb_redir=$usb_redir -Dvte=$vte \ 4710 -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ 4711 -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ 4712 -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ 4713 -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \ 4714 -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ 4715 -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse -Dlibxml2=$libxml2 \ 4716 -Dlibdaxctl=$libdaxctl -Dlibpmem=$libpmem -Dlinux_io_uring=$linux_io_uring \ 4717 -Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt -Dauth_pam=$auth_pam \ 4718 -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \ 4719 -Dattr=$attr -Ddefault_devices=$default_devices -Dvirglrenderer=$virglrenderer \ 4720 -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ 4721 -Dvhost_user_blk_server=$vhost_user_blk_server -Dmultiprocess=$multiprocess \ 4722 -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi -Dbpf=$bpf\ 4723 $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \ 4724 -Dalsa=$alsa -Dcoreaudio=$coreaudio -Ddsound=$dsound -Djack=$jack -Doss=$oss \ 4725 -Dpa=$pa -Daudio_drv_list=$audio_drv_list -Dtcg_interpreter=$tcg_interpreter \ 4726 -Dtrace_backends=$trace_backends -Dtrace_file=$trace_file -Dlinux_aio=$linux_aio \ 4727 -Dvde=$vde \ 4728 $cross_arg \ 4729 "$PWD" "$source_path" 4730 4731 if test "$?" -ne 0 ; then 4732 error_exit "meson setup failed" 4733 fi 4734else 4735 if test -f meson-private/cmd_line.txt; then 4736 # Adjust old command line options whose type was changed 4737 # Avoids having to use "setup --wipe" when Meson is upgraded 4738 perl -i -ne ' 4739 s/^gettext = true$/gettext = auto/; 4740 s/^gettext = false$/gettext = disabled/; 4741 /^b_staticpic/ && next; 4742 print;' meson-private/cmd_line.txt 4743 fi 4744fi 4745 4746if test -n "${deprecated_features}"; then 4747 echo "Warning, deprecated features enabled." 4748 echo "Please see docs/about/deprecated.rst" 4749 echo " features: ${deprecated_features}" 4750fi 4751 4752# Create list of config switches that should be poisoned in common code... 4753# but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special. 4754target_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null) 4755if test -n "$target_configs_h" ; then 4756 sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \ 4757 -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \ 4758 $target_configs_h | sort -u > config-poison.h 4759else 4760 :> config-poison.h 4761fi 4762 4763# Save the configure command line for later reuse. 4764cat <<EOD >config.status 4765#!/bin/sh 4766# Generated by configure. 4767# Run this file to recreate the current configuration. 4768# Compiler output produced by configure, useful for debugging 4769# configure, is in config.log if it exists. 4770EOD 4771 4772preserve_env() { 4773 envname=$1 4774 4775 eval envval=\$$envname 4776 4777 if test -n "$envval" 4778 then 4779 echo "$envname='$envval'" >> config.status 4780 echo "export $envname" >> config.status 4781 else 4782 echo "unset $envname" >> config.status 4783 fi 4784} 4785 4786# Preserve various env variables that influence what 4787# features/build target configure will detect 4788preserve_env AR 4789preserve_env AS 4790preserve_env CC 4791preserve_env CPP 4792preserve_env CXX 4793preserve_env INSTALL 4794preserve_env LD 4795preserve_env LD_LIBRARY_PATH 4796preserve_env LIBTOOL 4797preserve_env MAKE 4798preserve_env NM 4799preserve_env OBJCOPY 4800preserve_env PATH 4801preserve_env PKG_CONFIG 4802preserve_env PKG_CONFIG_LIBDIR 4803preserve_env PKG_CONFIG_PATH 4804preserve_env PYTHON 4805preserve_env SDL2_CONFIG 4806preserve_env SMBD 4807preserve_env STRIP 4808preserve_env WINDRES 4809 4810printf "exec" >>config.status 4811for i in "$0" "$@"; do 4812 test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status 4813done 4814echo ' "$@"' >>config.status 4815chmod +x config.status 4816 4817rm -r "$TMPDIR1" 4818