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