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