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