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 92print_error() { 93 (echo 94 echo "ERROR: $1" 95 while test -n "$2"; do 96 echo " $2" 97 shift 98 done 99 echo) >&2 100} 101 102error_exit() { 103 print_error "$@" 104 exit 1 105} 106 107do_compiler() { 108 # Run the compiler, capturing its output to the log. First argument 109 # is compiler binary to execute. 110 local compiler="$1" 111 shift 112 if test -n "$BASH_VERSION"; then eval ' 113 echo >>config.log " 114funcs: ${FUNCNAME[*]} 115lines: ${BASH_LINENO[*]}" 116 '; fi 117 echo $compiler "$@" >> config.log 118 $compiler "$@" >> config.log 2>&1 || return $? 119 # Test passed. If this is an --enable-werror build, rerun 120 # the test with -Werror and bail out if it fails. This 121 # makes warning-generating-errors in configure test code 122 # obvious to developers. 123 if test "$werror" != "yes"; then 124 return 0 125 fi 126 # Don't bother rerunning the compile if we were already using -Werror 127 case "$*" in 128 *-Werror*) 129 return 0 130 ;; 131 esac 132 echo $compiler -Werror "$@" >> config.log 133 $compiler -Werror "$@" >> config.log 2>&1 && return $? 134 error_exit "configure test passed without -Werror but failed with -Werror." \ 135 "This is probably a bug in the configure script. The failing command" \ 136 "will be at the bottom of config.log." \ 137 "You can run configure with --disable-werror to bypass this check." 138} 139 140do_cc() { 141 do_compiler "$cc" "$@" 142} 143 144do_cxx() { 145 do_compiler "$cxx" "$@" 146} 147 148# Append $2 to the variable named $1, with space separation 149add_to() { 150 eval $1=\${$1:+\"\$$1 \"}\$2 151} 152 153update_cxxflags() { 154 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 155 # options which some versions of GCC's C++ compiler complain about 156 # because they only make sense for C programs. 157 QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 158 CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/) 159 for arg in $QEMU_CFLAGS; do 160 case $arg in 161 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 162 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 163 ;; 164 *) 165 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 166 ;; 167 esac 168 done 169} 170 171compile_object() { 172 local_cflags="$1" 173 do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 174} 175 176compile_prog() { 177 local_cflags="$1" 178 local_ldflags="$2" 179 do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $QEMU_LDFLAGS $local_ldflags 180} 181 182# symbolically link $1 to $2. Portable version of "ln -sf". 183symlink() { 184 rm -rf "$2" 185 mkdir -p "$(dirname "$2")" 186 ln -s "$1" "$2" 187} 188 189# check whether a command is available to this shell (may be either an 190# executable or a builtin) 191has() { 192 type "$1" >/dev/null 2>&1 193} 194 195version_ge () { 196 local_ver1=`echo $1 | tr . ' '` 197 local_ver2=`echo $2 | tr . ' '` 198 while true; do 199 set x $local_ver1 200 local_first=${2-0} 201 # 'shift 2' if $2 is set, or 'shift' if $2 is not set 202 shift ${2:+2} 203 local_ver1=$* 204 set x $local_ver2 205 # the second argument finished, the first must be greater or equal 206 test $# = 1 && return 0 207 test $local_first -lt $2 && return 1 208 test $local_first -gt $2 && return 0 209 shift ${2:+2} 210 local_ver2=$* 211 done 212} 213 214have_backend () { 215 echo "$trace_backends" | grep "$1" >/dev/null 216} 217 218glob() { 219 eval test -z '"${1#'"$2"'}"' 220} 221 222supported_hax_target() { 223 test "$hax" = "yes" || return 1 224 glob "$1" "*-softmmu" || return 1 225 case "${1%-softmmu}" in 226 i386|x86_64) 227 return 0 228 ;; 229 esac 230 return 1 231} 232 233supported_kvm_target() { 234 test "$kvm" = "yes" || return 1 235 glob "$1" "*-softmmu" || return 1 236 case "${1%-softmmu}:$cpu" in 237 arm:arm | aarch64:aarch64 | \ 238 i386:i386 | i386:x86_64 | i386:x32 | \ 239 x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ 240 mips:mips | mipsel:mips | mips64:mips | mips64el:mips | \ 241 ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \ 242 s390x:s390x) 243 return 0 244 ;; 245 esac 246 return 1 247} 248 249supported_xen_target() { 250 test "$xen" = "yes" || return 1 251 glob "$1" "*-softmmu" || return 1 252 # Only i386 and x86_64 provide the xenpv machine. 253 case "${1%-softmmu}" in 254 i386|x86_64) 255 return 0 256 ;; 257 esac 258 return 1 259} 260 261supported_hvf_target() { 262 test "$hvf" = "yes" || return 1 263 glob "$1" "*-softmmu" || return 1 264 case "${1%-softmmu}" in 265 x86_64) 266 return 0 267 ;; 268 esac 269 return 1 270} 271 272supported_whpx_target() { 273 test "$whpx" = "yes" || return 1 274 glob "$1" "*-softmmu" || return 1 275 case "${1%-softmmu}" in 276 i386|x86_64) 277 return 0 278 ;; 279 esac 280 return 1 281} 282 283supported_target() { 284 case "$1" in 285 *-softmmu) 286 ;; 287 *-linux-user) 288 if test "$linux" != "yes"; then 289 print_error "Target '$target' is only available on a Linux host" 290 return 1 291 fi 292 ;; 293 *-bsd-user) 294 if test "$bsd" != "yes"; then 295 print_error "Target '$target' is only available on a BSD host" 296 return 1 297 fi 298 ;; 299 *) 300 print_error "Invalid target name '$target'" 301 return 1 302 ;; 303 esac 304 test "$tcg" = "yes" && return 0 305 supported_kvm_target "$1" && return 0 306 supported_xen_target "$1" && return 0 307 supported_hax_target "$1" && return 0 308 supported_hvf_target "$1" && return 0 309 supported_whpx_target "$1" && return 0 310 print_error "TCG disabled, but hardware accelerator not available for '$target'" 311 return 1 312} 313 314 315ld_has() { 316 $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 317} 318 319if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 320then 321 error_exit "main directory cannot contain spaces nor colons" 322fi 323 324# default parameters 325cpu="" 326iasl="iasl" 327interp_prefix="/usr/gnemul/qemu-%M" 328static="no" 329cross_prefix="" 330audio_drv_list="" 331block_drv_rw_whitelist="" 332block_drv_ro_whitelist="" 333host_cc="cc" 334libs_tools="" 335audio_win_int="" 336libs_qga="" 337debug_info="yes" 338stack_protector="" 339safe_stack="" 340use_containers="yes" 341gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 342 343if test -e "$source_path/.git" 344then 345 git_update=yes 346 git_submodules="ui/keycodemapdb" 347 git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 348 git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 349else 350 git_update=no 351 git_submodules="" 352 353 if ! test -f "$source_path/ui/keycodemapdb/README" 354 then 355 echo 356 echo "ERROR: missing file $source_path/ui/keycodemapdb/README" 357 echo 358 echo "This is not a GIT checkout but module content appears to" 359 echo "be missing. Do not use 'git archive' or GitHub download links" 360 echo "to acquire QEMU source archives. Non-GIT builds are only" 361 echo "supported with source archives linked from:" 362 echo 363 echo " https://www.qemu.org/download/#source" 364 echo 365 echo "Developers working with GIT can use scripts/archive-source.sh" 366 echo "if they need to create valid source archives." 367 echo 368 exit 1 369 fi 370fi 371git="git" 372 373# Don't accept a target_list environment variable. 374unset target_list 375unset target_list_exclude 376 377# Default value for a variable defining feature "foo". 378# * foo="no" feature will only be used if --enable-foo arg is given 379# * foo="" feature will be searched for, and if found, will be used 380# unless --disable-foo is given 381# * foo="yes" this value will only be set by --enable-foo flag. 382# feature will searched for, 383# if not found, configure exits with error 384# 385# Always add --enable-foo and --disable-foo command line args. 386# Distributions want to ensure that several features are compiled in, and it 387# is impossible without a --enable-foo that exits if a feature is not found. 388 389brlapi="" 390curl="" 391curses="" 392docs="" 393fdt="" 394netmap="no" 395sdl="auto" 396sdl_image="auto" 397virtfs="" 398mpath="" 399vnc="enabled" 400sparse="no" 401vde="" 402vnc_sasl="auto" 403vnc_jpeg="auto" 404vnc_png="auto" 405xkbcommon="auto" 406xen="" 407xen_ctrl_version="" 408xen_pci_passthrough="" 409linux_aio="" 410linux_io_uring="" 411cap_ng="" 412attr="" 413libattr="" 414xfs="" 415tcg="yes" 416membarrier="" 417vhost_net="" 418vhost_crypto="" 419vhost_scsi="" 420vhost_vsock="" 421vhost_user="" 422vhost_user_fs="" 423kvm="no" 424hax="no" 425hvf="no" 426whpx="no" 427rdma="" 428pvrdma="" 429gprof="no" 430debug_tcg="no" 431debug="no" 432sanitizers="no" 433tsan="no" 434fortify_source="" 435strip_opt="yes" 436tcg_interpreter="no" 437bigendian="no" 438mingw32="no" 439gcov="no" 440EXESUF="" 441HOST_DSOSUF=".so" 442LDFLAGS_SHARED="-shared" 443modules="no" 444module_upgrades="no" 445prefix="/usr/local" 446qemu_suffix="qemu" 447slirp="" 448oss_lib="" 449bsd="no" 450linux="no" 451solaris="no" 452profiler="no" 453cocoa="no" 454softmmu="yes" 455linux_user="no" 456bsd_user="no" 457blobs="yes" 458edk2_blobs="no" 459pkgversion="" 460pie="" 461qom_cast_debug="yes" 462trace_backends="log" 463trace_file="trace" 464spice="" 465rbd="" 466smartcard="" 467u2f="auto" 468libusb="" 469usb_redir="" 470opengl="" 471opengl_dmabuf="no" 472cpuid_h="no" 473avx2_opt="" 474capstone="" 475lzo="" 476snappy="" 477bzip2="" 478lzfse="" 479zstd="" 480guest_agent="" 481guest_agent_with_vss="no" 482guest_agent_ntddscsi="no" 483guest_agent_msi="" 484vss_win32_sdk="" 485win_sdk="no" 486want_tools="" 487libiscsi="" 488libnfs="" 489coroutine="" 490coroutine_pool="" 491debug_stack_usage="no" 492crypto_afalg="no" 493seccomp="" 494glusterfs="" 495glusterfs_xlator_opt="no" 496glusterfs_discard="no" 497glusterfs_fallocate="no" 498glusterfs_zerofill="no" 499glusterfs_ftruncate_has_stat="no" 500glusterfs_iocb_has_stat="no" 501gtk="" 502gtk_gl="no" 503tls_priority="NORMAL" 504gnutls="" 505nettle="" 506nettle_xts="no" 507gcrypt="" 508gcrypt_hmac="no" 509gcrypt_xts="no" 510qemu_private_xts="yes" 511auth_pam="" 512vte="" 513virglrenderer="" 514tpm="" 515libssh="" 516live_block_migration="yes" 517numa="" 518tcmalloc="no" 519jemalloc="no" 520replication="yes" 521bochs="yes" 522cloop="yes" 523dmg="yes" 524qcow1="yes" 525vdi="yes" 526vvfat="yes" 527qed="yes" 528parallels="yes" 529sheepdog="yes" 530libxml2="" 531debug_mutex="no" 532libpmem="" 533default_devices="yes" 534plugins="no" 535fuzzing="no" 536rng_none="no" 537secret_keyring="" 538libdaxctl="" 539meson="" 540ninja="" 541skip_meson=no 542gettext="" 543 544bogus_os="no" 545malloc_trim="" 546 547# parse CC options first 548for opt do 549 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 550 case "$opt" in 551 --cross-prefix=*) cross_prefix="$optarg" 552 ;; 553 --cc=*) CC="$optarg" 554 ;; 555 --cxx=*) CXX="$optarg" 556 ;; 557 --cpu=*) cpu="$optarg" 558 ;; 559 --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 560 QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 561 ;; 562 --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 563 ;; 564 --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 565 EXTRA_LDFLAGS="$optarg" 566 ;; 567 --enable-debug-info) debug_info="yes" 568 ;; 569 --disable-debug-info) debug_info="no" 570 ;; 571 --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 572 ;; 573 --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 574 eval "cross_cc_cflags_${cc_arch}=\$optarg" 575 cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 576 ;; 577 --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 578 cc_archs="$cc_archs $cc_arch" 579 eval "cross_cc_${cc_arch}=\$optarg" 580 cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 581 ;; 582 esac 583done 584# OS specific 585# Using uname is really, really broken. Once we have the right set of checks 586# we can eliminate its usage altogether. 587 588# Preferred compiler: 589# ${CC} (if set) 590# ${cross_prefix}gcc (if cross-prefix specified) 591# system compiler 592if test -z "${CC}${cross_prefix}"; then 593 cc="$host_cc" 594else 595 cc="${CC-${cross_prefix}gcc}" 596fi 597 598if test -z "${CXX}${cross_prefix}"; then 599 cxx="c++" 600else 601 cxx="${CXX-${cross_prefix}g++}" 602fi 603 604ar="${AR-${cross_prefix}ar}" 605as="${AS-${cross_prefix}as}" 606ccas="${CCAS-$cc}" 607cpp="${CPP-$cc -E}" 608objcopy="${OBJCOPY-${cross_prefix}objcopy}" 609ld="${LD-${cross_prefix}ld}" 610ranlib="${RANLIB-${cross_prefix}ranlib}" 611nm="${NM-${cross_prefix}nm}" 612strip="${STRIP-${cross_prefix}strip}" 613windres="${WINDRES-${cross_prefix}windres}" 614pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 615query_pkg_config() { 616 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 617} 618pkg_config=query_pkg_config 619sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 620 621# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 622ARFLAGS="${ARFLAGS-rv}" 623 624# default flags for all hosts 625# We use -fwrapv to tell the compiler that we require a C dialect where 626# left shift of signed integers is well defined and has the expected 627# 2s-complement style results. (Both clang and gcc agree that it 628# provides these semantics.) 629QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 630QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 631QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 632QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 633QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include" 634QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl" 635CFLAGS="-std=gnu99 -Wall" 636 637 638check_define() { 639cat > $TMPC <<EOF 640#if !defined($1) 641#error $1 not defined 642#endif 643int main(void) { return 0; } 644EOF 645 compile_object 646} 647 648check_include() { 649cat > $TMPC <<EOF 650#include <$1> 651int main(void) { return 0; } 652EOF 653 compile_object 654} 655 656write_c_skeleton() { 657 cat > $TMPC <<EOF 658int main(void) { return 0; } 659EOF 660} 661 662write_c_fuzzer_skeleton() { 663 cat > $TMPC <<EOF 664#include <stdint.h> 665#include <sys/types.h> 666int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); 667int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } 668EOF 669} 670 671if check_define __linux__ ; then 672 targetos="Linux" 673elif check_define _WIN32 ; then 674 targetos='MINGW32' 675elif check_define __OpenBSD__ ; then 676 targetos='OpenBSD' 677elif check_define __sun__ ; then 678 targetos='SunOS' 679elif check_define __HAIKU__ ; then 680 targetos='Haiku' 681elif check_define __FreeBSD__ ; then 682 targetos='FreeBSD' 683elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 684 targetos='GNU/kFreeBSD' 685elif check_define __DragonFly__ ; then 686 targetos='DragonFly' 687elif check_define __NetBSD__; then 688 targetos='NetBSD' 689elif check_define __APPLE__; then 690 targetos='Darwin' 691else 692 # This is a fatal error, but don't report it yet, because we 693 # might be going to just print the --help text, or it might 694 # be the result of a missing compiler. 695 targetos='bogus' 696 bogus_os='yes' 697fi 698 699# Some host OSes need non-standard checks for which CPU to use. 700# Note that these checks are broken for cross-compilation: if you're 701# cross-compiling to one of these OSes then you'll need to specify 702# the correct CPU with the --cpu option. 703case $targetos in 704Darwin) 705 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 706 # run 64-bit userspace code. 707 # If the user didn't specify a CPU explicitly and the kernel says this is 708 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 709 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 710 cpu="x86_64" 711 fi 712 ;; 713SunOS) 714 # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 715 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 716 cpu="x86_64" 717 fi 718esac 719 720if test ! -z "$cpu" ; then 721 # command line argument 722 : 723elif check_define __i386__ ; then 724 cpu="i386" 725elif check_define __x86_64__ ; then 726 if check_define __ILP32__ ; then 727 cpu="x32" 728 else 729 cpu="x86_64" 730 fi 731elif check_define __sparc__ ; then 732 if check_define __arch64__ ; then 733 cpu="sparc64" 734 else 735 cpu="sparc" 736 fi 737elif check_define _ARCH_PPC ; then 738 if check_define _ARCH_PPC64 ; then 739 if check_define _LITTLE_ENDIAN ; then 740 cpu="ppc64le" 741 else 742 cpu="ppc64" 743 fi 744 else 745 cpu="ppc" 746 fi 747elif check_define __mips__ ; then 748 cpu="mips" 749elif check_define __s390__ ; then 750 if check_define __s390x__ ; then 751 cpu="s390x" 752 else 753 cpu="s390" 754 fi 755elif check_define __riscv ; then 756 if check_define _LP64 ; then 757 cpu="riscv64" 758 else 759 cpu="riscv32" 760 fi 761elif check_define __arm__ ; then 762 cpu="arm" 763elif check_define __aarch64__ ; then 764 cpu="aarch64" 765else 766 cpu=$(uname -m) 767fi 768 769ARCH= 770# Normalise host CPU name and set ARCH. 771# Note that this case should only have supported host CPUs, not guests. 772case "$cpu" in 773 ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 774 ;; 775 ppc64le) 776 ARCH="ppc64" 777 ;; 778 i386|i486|i586|i686|i86pc|BePC) 779 cpu="i386" 780 ;; 781 x86_64|amd64) 782 cpu="x86_64" 783 ;; 784 armv*b|armv*l|arm) 785 cpu="arm" 786 ;; 787 aarch64) 788 cpu="aarch64" 789 ;; 790 mips*) 791 cpu="mips" 792 ;; 793 sparc|sun4[cdmuv]) 794 cpu="sparc" 795 ;; 796 *) 797 # This will result in either an error or falling back to TCI later 798 ARCH=unknown 799 ;; 800esac 801if test -z "$ARCH"; then 802 ARCH="$cpu" 803fi 804 805# OS specific 806 807# host *BSD for user mode 808HOST_VARIANT_DIR="" 809 810case $targetos in 811MINGW32*) 812 mingw32="yes" 813 hax="yes" 814 whpx="" 815 vhost_user="no" 816 audio_possible_drivers="dsound sdl" 817 if check_include dsound.h; then 818 audio_drv_list="dsound" 819 else 820 audio_drv_list="" 821 fi 822 supported_os="yes" 823 pie="no" 824;; 825GNU/kFreeBSD) 826 bsd="yes" 827 audio_drv_list="oss try-sdl" 828 audio_possible_drivers="oss sdl pa" 829;; 830FreeBSD) 831 bsd="yes" 832 make="${MAKE-gmake}" 833 audio_drv_list="oss try-sdl" 834 audio_possible_drivers="oss sdl pa" 835 # needed for kinfo_getvmmap(3) in libutil.h 836 LIBS="-lutil $LIBS" 837 netmap="" # enable netmap autodetect 838 HOST_VARIANT_DIR="freebsd" 839;; 840DragonFly) 841 bsd="yes" 842 make="${MAKE-gmake}" 843 audio_drv_list="oss try-sdl" 844 audio_possible_drivers="oss sdl pa" 845 HOST_VARIANT_DIR="dragonfly" 846;; 847NetBSD) 848 bsd="yes" 849 hax="yes" 850 make="${MAKE-gmake}" 851 audio_drv_list="oss try-sdl" 852 audio_possible_drivers="oss sdl" 853 oss_lib="-lossaudio" 854 HOST_VARIANT_DIR="netbsd" 855;; 856OpenBSD) 857 bsd="yes" 858 make="${MAKE-gmake}" 859 audio_drv_list="try-sdl" 860 audio_possible_drivers="sdl" 861 HOST_VARIANT_DIR="openbsd" 862;; 863Darwin) 864 bsd="yes" 865 darwin="yes" 866 hax="yes" 867 hvf="yes" 868 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 869 if [ "$cpu" = "x86_64" ] ; then 870 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 871 QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" 872 fi 873 cocoa="yes" 874 audio_drv_list="coreaudio try-sdl" 875 audio_possible_drivers="coreaudio sdl" 876 QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" 877 # Disable attempts to use ObjectiveC features in os/object.h since they 878 # won't work when we're compiling with gcc as a C compiler. 879 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 880 HOST_VARIANT_DIR="darwin" 881;; 882SunOS) 883 solaris="yes" 884 make="${MAKE-gmake}" 885 smbd="${SMBD-/usr/sfw/sbin/smbd}" 886 if test -f /usr/include/sys/soundcard.h ; then 887 audio_drv_list="oss try-sdl" 888 fi 889 audio_possible_drivers="oss sdl" 890# needed for CMSG_ macros in sys/socket.h 891 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 892# needed for TIOCWIN* defines in termios.h 893 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 894 solarisnetlibs="-lsocket -lnsl -lresolv" 895 LIBS="$solarisnetlibs $LIBS" 896;; 897Haiku) 898 haiku="yes" 899 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" 900 LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS" 901;; 902Linux) 903 audio_drv_list="try-pa oss" 904 audio_possible_drivers="oss alsa sdl pa" 905 linux="yes" 906 linux_user="yes" 907 kvm="yes" 908 QEMU_INCLUDES="-isystem ${source_path}/linux-headers -Ilinux-headers $QEMU_INCLUDES" 909 libudev="yes" 910;; 911esac 912 913if [ "$bsd" = "yes" ] ; then 914 if [ "$darwin" != "yes" ] ; then 915 bsd_user="yes" 916 fi 917fi 918 919: ${make=${MAKE-make}} 920 921# We prefer python 3.x. A bare 'python' is traditionally 922# python 2.x, but some distros have it as python 3.x, so 923# we check that too 924python= 925explicit_python=no 926for binary in "${PYTHON-python3}" python 927do 928 if has "$binary" 929 then 930 python=$(command -v "$binary") 931 break 932 fi 933done 934 935sphinx_build= 936for binary in sphinx-build-3 sphinx-build 937do 938 if has "$binary" 939 then 940 sphinx_build=$(command -v "$binary") 941 break 942 fi 943done 944 945# Check for ancillary tools used in testing 946genisoimage= 947for binary in genisoimage mkisofs 948do 949 if has $binary 950 then 951 genisoimage=$(command -v "$binary") 952 break 953 fi 954done 955 956: ${smbd=${SMBD-/usr/sbin/smbd}} 957 958# Default objcc to clang if available, otherwise use CC 959if has clang; then 960 objcc=clang 961else 962 objcc="$cc" 963fi 964 965if test "$mingw32" = "yes" ; then 966 EXESUF=".exe" 967 HOST_DSOSUF=".dll" 968 # MinGW needs -mthreads for TLS and macro _MT. 969 CFLAGS="-mthreads $CFLAGS" 970 LIBS="-lwinmm -lws2_32 $LIBS" 971 write_c_skeleton; 972 if compile_prog "" "-liberty" ; then 973 LIBS="-liberty $LIBS" 974 fi 975 prefix="c:/Program Files/QEMU" 976 qemu_suffix="" 977 libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 978fi 979 980werror="" 981 982for opt do 983 optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 984 case "$opt" in 985 --help|-h) show_help=yes 986 ;; 987 --version|-V) exec cat $source_path/VERSION 988 ;; 989 --prefix=*) prefix="$optarg" 990 ;; 991 --interp-prefix=*) interp_prefix="$optarg" 992 ;; 993 --cross-prefix=*) 994 ;; 995 --cc=*) 996 ;; 997 --host-cc=*) host_cc="$optarg" 998 ;; 999 --cxx=*) 1000 ;; 1001 --iasl=*) iasl="$optarg" 1002 ;; 1003 --objcc=*) objcc="$optarg" 1004 ;; 1005 --make=*) make="$optarg" 1006 ;; 1007 --install=*) 1008 ;; 1009 --python=*) python="$optarg" ; explicit_python=yes 1010 ;; 1011 --sphinx-build=*) sphinx_build="$optarg" 1012 ;; 1013 --skip-meson) skip_meson=yes 1014 ;; 1015 --meson=*) meson="$optarg" 1016 ;; 1017 --ninja=*) ninja="$optarg" 1018 ;; 1019 --smbd=*) smbd="$optarg" 1020 ;; 1021 --extra-cflags=*) 1022 ;; 1023 --extra-cxxflags=*) 1024 ;; 1025 --extra-ldflags=*) 1026 ;; 1027 --enable-debug-info) 1028 ;; 1029 --disable-debug-info) 1030 ;; 1031 --cross-cc-*) 1032 ;; 1033 --enable-modules) 1034 modules="yes" 1035 ;; 1036 --disable-modules) 1037 modules="no" 1038 ;; 1039 --disable-module-upgrades) module_upgrades="no" 1040 ;; 1041 --enable-module-upgrades) module_upgrades="yes" 1042 ;; 1043 --cpu=*) 1044 ;; 1045 --target-list=*) target_list="$optarg" 1046 if test "$target_list_exclude"; then 1047 error_exit "Can't mix --target-list with --target-list-exclude" 1048 fi 1049 ;; 1050 --target-list-exclude=*) target_list_exclude="$optarg" 1051 if test "$target_list"; then 1052 error_exit "Can't mix --target-list-exclude with --target-list" 1053 fi 1054 ;; 1055 --enable-trace-backends=*) trace_backends="$optarg" 1056 ;; 1057 # XXX: backwards compatibility 1058 --enable-trace-backend=*) trace_backends="$optarg" 1059 ;; 1060 --with-trace-file=*) trace_file="$optarg" 1061 ;; 1062 --with-default-devices) default_devices="yes" 1063 ;; 1064 --without-default-devices) default_devices="no" 1065 ;; 1066 --enable-gprof) gprof="yes" 1067 ;; 1068 --enable-gcov) gcov="yes" 1069 ;; 1070 --static) 1071 static="yes" 1072 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 1073 ;; 1074 --mandir=*) mandir="$optarg" 1075 ;; 1076 --bindir=*) bindir="$optarg" 1077 ;; 1078 --libdir=*) libdir="$optarg" 1079 ;; 1080 --libexecdir=*) libexecdir="$optarg" 1081 ;; 1082 --includedir=*) includedir="$optarg" 1083 ;; 1084 --datadir=*) datadir="$optarg" 1085 ;; 1086 --with-suffix=*) qemu_suffix="$optarg" 1087 ;; 1088 --docdir=*) qemu_docdir="$optarg" 1089 ;; 1090 --sysconfdir=*) sysconfdir="$optarg" 1091 ;; 1092 --localstatedir=*) local_statedir="$optarg" 1093 ;; 1094 --firmwarepath=*) firmwarepath="$optarg" 1095 ;; 1096 --host=*|--build=*|\ 1097 --disable-dependency-tracking|\ 1098 --sbindir=*|--sharedstatedir=*|\ 1099 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 1100 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 1101 # These switches are silently ignored, for compatibility with 1102 # autoconf-generated configure scripts. This allows QEMU's 1103 # configure to be used by RPM and similar macros that set 1104 # lots of directory switches by default. 1105 ;; 1106 --disable-sdl) sdl="disabled" 1107 ;; 1108 --enable-sdl) sdl="enabled" 1109 ;; 1110 --disable-sdl-image) sdl_image="disabled" 1111 ;; 1112 --enable-sdl-image) sdl_image="enabled" 1113 ;; 1114 --disable-qom-cast-debug) qom_cast_debug="no" 1115 ;; 1116 --enable-qom-cast-debug) qom_cast_debug="yes" 1117 ;; 1118 --disable-virtfs) virtfs="no" 1119 ;; 1120 --enable-virtfs) virtfs="yes" 1121 ;; 1122 --disable-mpath) mpath="no" 1123 ;; 1124 --enable-mpath) mpath="yes" 1125 ;; 1126 --disable-vnc) vnc="disabled" 1127 ;; 1128 --enable-vnc) vnc="enabled" 1129 ;; 1130 --disable-gettext) gettext="false" 1131 ;; 1132 --enable-gettext) gettext="true" 1133 ;; 1134 --oss-lib=*) oss_lib="$optarg" 1135 ;; 1136 --audio-drv-list=*) audio_drv_list="$optarg" 1137 ;; 1138 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1139 ;; 1140 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1141 ;; 1142 --enable-debug-tcg) debug_tcg="yes" 1143 ;; 1144 --disable-debug-tcg) debug_tcg="no" 1145 ;; 1146 --enable-debug) 1147 # Enable debugging options that aren't excessively noisy 1148 debug_tcg="yes" 1149 debug_mutex="yes" 1150 debug="yes" 1151 strip_opt="no" 1152 fortify_source="no" 1153 ;; 1154 --enable-sanitizers) sanitizers="yes" 1155 ;; 1156 --disable-sanitizers) sanitizers="no" 1157 ;; 1158 --enable-tsan) tsan="yes" 1159 ;; 1160 --disable-tsan) tsan="no" 1161 ;; 1162 --enable-sparse) sparse="yes" 1163 ;; 1164 --disable-sparse) sparse="no" 1165 ;; 1166 --disable-strip) strip_opt="no" 1167 ;; 1168 --disable-vnc-sasl) vnc_sasl="disabled" 1169 ;; 1170 --enable-vnc-sasl) vnc_sasl="enabled" 1171 ;; 1172 --disable-vnc-jpeg) vnc_jpeg="disabled" 1173 ;; 1174 --enable-vnc-jpeg) vnc_jpeg="enabled" 1175 ;; 1176 --disable-vnc-png) vnc_png="disabled" 1177 ;; 1178 --enable-vnc-png) vnc_png="enabled" 1179 ;; 1180 --disable-slirp) slirp="no" 1181 ;; 1182 --enable-slirp=git) slirp="git" 1183 ;; 1184 --enable-slirp=system) slirp="system" 1185 ;; 1186 --disable-vde) vde="no" 1187 ;; 1188 --enable-vde) vde="yes" 1189 ;; 1190 --disable-netmap) netmap="no" 1191 ;; 1192 --enable-netmap) netmap="yes" 1193 ;; 1194 --disable-xen) xen="no" 1195 ;; 1196 --enable-xen) xen="yes" 1197 ;; 1198 --disable-xen-pci-passthrough) xen_pci_passthrough="no" 1199 ;; 1200 --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 1201 ;; 1202 --disable-brlapi) brlapi="no" 1203 ;; 1204 --enable-brlapi) brlapi="yes" 1205 ;; 1206 --disable-kvm) kvm="no" 1207 ;; 1208 --enable-kvm) kvm="yes" 1209 ;; 1210 --disable-hax) hax="no" 1211 ;; 1212 --enable-hax) hax="yes" 1213 ;; 1214 --disable-hvf) hvf="no" 1215 ;; 1216 --enable-hvf) hvf="yes" 1217 ;; 1218 --disable-whpx) whpx="no" 1219 ;; 1220 --enable-whpx) whpx="yes" 1221 ;; 1222 --disable-tcg-interpreter) tcg_interpreter="no" 1223 ;; 1224 --enable-tcg-interpreter) tcg_interpreter="yes" 1225 ;; 1226 --disable-cap-ng) cap_ng="no" 1227 ;; 1228 --enable-cap-ng) cap_ng="yes" 1229 ;; 1230 --disable-tcg) tcg="no" 1231 ;; 1232 --enable-tcg) tcg="yes" 1233 ;; 1234 --disable-malloc-trim) malloc_trim="no" 1235 ;; 1236 --enable-malloc-trim) malloc_trim="yes" 1237 ;; 1238 --disable-spice) spice="no" 1239 ;; 1240 --enable-spice) spice="yes" 1241 ;; 1242 --disable-libiscsi) libiscsi="no" 1243 ;; 1244 --enable-libiscsi) libiscsi="yes" 1245 ;; 1246 --disable-libnfs) libnfs="no" 1247 ;; 1248 --enable-libnfs) libnfs="yes" 1249 ;; 1250 --enable-profiler) profiler="yes" 1251 ;; 1252 --disable-cocoa) cocoa="no" 1253 ;; 1254 --enable-cocoa) 1255 cocoa="yes" ; 1256 audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 1257 ;; 1258 --disable-system) softmmu="no" 1259 ;; 1260 --enable-system) softmmu="yes" 1261 ;; 1262 --disable-user) 1263 linux_user="no" ; 1264 bsd_user="no" ; 1265 ;; 1266 --enable-user) ;; 1267 --disable-linux-user) linux_user="no" 1268 ;; 1269 --enable-linux-user) linux_user="yes" 1270 ;; 1271 --disable-bsd-user) bsd_user="no" 1272 ;; 1273 --enable-bsd-user) bsd_user="yes" 1274 ;; 1275 --enable-pie) pie="yes" 1276 ;; 1277 --disable-pie) pie="no" 1278 ;; 1279 --enable-werror) werror="yes" 1280 ;; 1281 --disable-werror) werror="no" 1282 ;; 1283 --enable-stack-protector) stack_protector="yes" 1284 ;; 1285 --disable-stack-protector) stack_protector="no" 1286 ;; 1287 --enable-safe-stack) safe_stack="yes" 1288 ;; 1289 --disable-safe-stack) safe_stack="no" 1290 ;; 1291 --disable-curses) curses="no" 1292 ;; 1293 --enable-curses) curses="yes" 1294 ;; 1295 --disable-iconv) iconv="no" 1296 ;; 1297 --enable-iconv) iconv="yes" 1298 ;; 1299 --disable-curl) curl="no" 1300 ;; 1301 --enable-curl) curl="yes" 1302 ;; 1303 --disable-fdt) fdt="no" 1304 ;; 1305 --enable-fdt) fdt="yes" 1306 ;; 1307 --disable-linux-aio) linux_aio="no" 1308 ;; 1309 --enable-linux-aio) linux_aio="yes" 1310 ;; 1311 --disable-linux-io-uring) linux_io_uring="no" 1312 ;; 1313 --enable-linux-io-uring) linux_io_uring="yes" 1314 ;; 1315 --disable-attr) attr="no" 1316 ;; 1317 --enable-attr) attr="yes" 1318 ;; 1319 --disable-membarrier) membarrier="no" 1320 ;; 1321 --enable-membarrier) membarrier="yes" 1322 ;; 1323 --disable-blobs) blobs="no" 1324 ;; 1325 --with-pkgversion=*) pkgversion="$optarg" 1326 ;; 1327 --with-coroutine=*) coroutine="$optarg" 1328 ;; 1329 --disable-coroutine-pool) coroutine_pool="no" 1330 ;; 1331 --enable-coroutine-pool) coroutine_pool="yes" 1332 ;; 1333 --enable-debug-stack-usage) debug_stack_usage="yes" 1334 ;; 1335 --enable-crypto-afalg) crypto_afalg="yes" 1336 ;; 1337 --disable-crypto-afalg) crypto_afalg="no" 1338 ;; 1339 --disable-docs) docs="no" 1340 ;; 1341 --enable-docs) docs="yes" 1342 ;; 1343 --disable-vhost-net) vhost_net="no" 1344 ;; 1345 --enable-vhost-net) vhost_net="yes" 1346 ;; 1347 --disable-vhost-crypto) vhost_crypto="no" 1348 ;; 1349 --enable-vhost-crypto) vhost_crypto="yes" 1350 ;; 1351 --disable-vhost-scsi) vhost_scsi="no" 1352 ;; 1353 --enable-vhost-scsi) vhost_scsi="yes" 1354 ;; 1355 --disable-vhost-vsock) vhost_vsock="no" 1356 ;; 1357 --enable-vhost-vsock) vhost_vsock="yes" 1358 ;; 1359 --disable-vhost-user-fs) vhost_user_fs="no" 1360 ;; 1361 --enable-vhost-user-fs) vhost_user_fs="yes" 1362 ;; 1363 --disable-opengl) opengl="no" 1364 ;; 1365 --enable-opengl) opengl="yes" 1366 ;; 1367 --disable-rbd) rbd="no" 1368 ;; 1369 --enable-rbd) rbd="yes" 1370 ;; 1371 --disable-xfsctl) xfs="no" 1372 ;; 1373 --enable-xfsctl) xfs="yes" 1374 ;; 1375 --disable-smartcard) smartcard="no" 1376 ;; 1377 --enable-smartcard) smartcard="yes" 1378 ;; 1379 --disable-u2f) u2f="disabled" 1380 ;; 1381 --enable-u2f) u2f="enabled" 1382 ;; 1383 --disable-libusb) libusb="no" 1384 ;; 1385 --enable-libusb) libusb="yes" 1386 ;; 1387 --disable-usb-redir) usb_redir="no" 1388 ;; 1389 --enable-usb-redir) usb_redir="yes" 1390 ;; 1391 --disable-zlib-test) 1392 ;; 1393 --disable-lzo) lzo="no" 1394 ;; 1395 --enable-lzo) lzo="yes" 1396 ;; 1397 --disable-snappy) snappy="no" 1398 ;; 1399 --enable-snappy) snappy="yes" 1400 ;; 1401 --disable-bzip2) bzip2="no" 1402 ;; 1403 --enable-bzip2) bzip2="yes" 1404 ;; 1405 --enable-lzfse) lzfse="yes" 1406 ;; 1407 --disable-lzfse) lzfse="no" 1408 ;; 1409 --disable-zstd) zstd="no" 1410 ;; 1411 --enable-zstd) zstd="yes" 1412 ;; 1413 --enable-guest-agent) guest_agent="yes" 1414 ;; 1415 --disable-guest-agent) guest_agent="no" 1416 ;; 1417 --enable-guest-agent-msi) guest_agent_msi="yes" 1418 ;; 1419 --disable-guest-agent-msi) guest_agent_msi="no" 1420 ;; 1421 --with-vss-sdk) vss_win32_sdk="" 1422 ;; 1423 --with-vss-sdk=*) vss_win32_sdk="$optarg" 1424 ;; 1425 --without-vss-sdk) vss_win32_sdk="no" 1426 ;; 1427 --with-win-sdk) win_sdk="" 1428 ;; 1429 --with-win-sdk=*) win_sdk="$optarg" 1430 ;; 1431 --without-win-sdk) win_sdk="no" 1432 ;; 1433 --enable-tools) want_tools="yes" 1434 ;; 1435 --disable-tools) want_tools="no" 1436 ;; 1437 --enable-seccomp) seccomp="yes" 1438 ;; 1439 --disable-seccomp) seccomp="no" 1440 ;; 1441 --disable-glusterfs) glusterfs="no" 1442 ;; 1443 --disable-avx2) avx2_opt="no" 1444 ;; 1445 --enable-avx2) avx2_opt="yes" 1446 ;; 1447 --disable-avx512f) avx512f_opt="no" 1448 ;; 1449 --enable-avx512f) avx512f_opt="yes" 1450 ;; 1451 1452 --enable-glusterfs) glusterfs="yes" 1453 ;; 1454 --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 1455 echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1456 ;; 1457 --enable-vhdx|--disable-vhdx) 1458 echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1459 ;; 1460 --enable-uuid|--disable-uuid) 1461 echo "$0: $opt is obsolete, UUID support is always built" >&2 1462 ;; 1463 --disable-gtk) gtk="no" 1464 ;; 1465 --enable-gtk) gtk="yes" 1466 ;; 1467 --tls-priority=*) tls_priority="$optarg" 1468 ;; 1469 --disable-gnutls) gnutls="no" 1470 ;; 1471 --enable-gnutls) gnutls="yes" 1472 ;; 1473 --disable-nettle) nettle="no" 1474 ;; 1475 --enable-nettle) nettle="yes" 1476 ;; 1477 --disable-gcrypt) gcrypt="no" 1478 ;; 1479 --enable-gcrypt) gcrypt="yes" 1480 ;; 1481 --disable-auth-pam) auth_pam="no" 1482 ;; 1483 --enable-auth-pam) auth_pam="yes" 1484 ;; 1485 --enable-rdma) rdma="yes" 1486 ;; 1487 --disable-rdma) rdma="no" 1488 ;; 1489 --enable-pvrdma) pvrdma="yes" 1490 ;; 1491 --disable-pvrdma) pvrdma="no" 1492 ;; 1493 --disable-vte) vte="no" 1494 ;; 1495 --enable-vte) vte="yes" 1496 ;; 1497 --disable-virglrenderer) virglrenderer="no" 1498 ;; 1499 --enable-virglrenderer) virglrenderer="yes" 1500 ;; 1501 --disable-tpm) tpm="no" 1502 ;; 1503 --enable-tpm) tpm="yes" 1504 ;; 1505 --disable-libssh) libssh="no" 1506 ;; 1507 --enable-libssh) libssh="yes" 1508 ;; 1509 --disable-live-block-migration) live_block_migration="no" 1510 ;; 1511 --enable-live-block-migration) live_block_migration="yes" 1512 ;; 1513 --disable-numa) numa="no" 1514 ;; 1515 --enable-numa) numa="yes" 1516 ;; 1517 --disable-libxml2) libxml2="no" 1518 ;; 1519 --enable-libxml2) libxml2="yes" 1520 ;; 1521 --disable-tcmalloc) tcmalloc="no" 1522 ;; 1523 --enable-tcmalloc) tcmalloc="yes" 1524 ;; 1525 --disable-jemalloc) jemalloc="no" 1526 ;; 1527 --enable-jemalloc) jemalloc="yes" 1528 ;; 1529 --disable-replication) replication="no" 1530 ;; 1531 --enable-replication) replication="yes" 1532 ;; 1533 --disable-bochs) bochs="no" 1534 ;; 1535 --enable-bochs) bochs="yes" 1536 ;; 1537 --disable-cloop) cloop="no" 1538 ;; 1539 --enable-cloop) cloop="yes" 1540 ;; 1541 --disable-dmg) dmg="no" 1542 ;; 1543 --enable-dmg) dmg="yes" 1544 ;; 1545 --disable-qcow1) qcow1="no" 1546 ;; 1547 --enable-qcow1) qcow1="yes" 1548 ;; 1549 --disable-vdi) vdi="no" 1550 ;; 1551 --enable-vdi) vdi="yes" 1552 ;; 1553 --disable-vvfat) vvfat="no" 1554 ;; 1555 --enable-vvfat) vvfat="yes" 1556 ;; 1557 --disable-qed) qed="no" 1558 ;; 1559 --enable-qed) qed="yes" 1560 ;; 1561 --disable-parallels) parallels="no" 1562 ;; 1563 --enable-parallels) parallels="yes" 1564 ;; 1565 --disable-sheepdog) sheepdog="no" 1566 ;; 1567 --enable-sheepdog) sheepdog="yes" 1568 ;; 1569 --disable-vhost-user) vhost_user="no" 1570 ;; 1571 --enable-vhost-user) vhost_user="yes" 1572 ;; 1573 --disable-vhost-vdpa) vhost_vdpa="no" 1574 ;; 1575 --enable-vhost-vdpa) vhost_vdpa="yes" 1576 ;; 1577 --disable-vhost-kernel) vhost_kernel="no" 1578 ;; 1579 --enable-vhost-kernel) vhost_kernel="yes" 1580 ;; 1581 --disable-capstone) capstone="no" 1582 ;; 1583 --enable-capstone) capstone="yes" 1584 ;; 1585 --enable-capstone=git) capstone="git" 1586 ;; 1587 --enable-capstone=system) capstone="system" 1588 ;; 1589 --with-git=*) git="$optarg" 1590 ;; 1591 --enable-git-update) git_update=yes 1592 ;; 1593 --disable-git-update) git_update=no 1594 ;; 1595 --enable-debug-mutex) debug_mutex=yes 1596 ;; 1597 --disable-debug-mutex) debug_mutex=no 1598 ;; 1599 --enable-libpmem) libpmem=yes 1600 ;; 1601 --disable-libpmem) libpmem=no 1602 ;; 1603 --enable-xkbcommon) xkbcommon="enabled" 1604 ;; 1605 --disable-xkbcommon) xkbcommon="disabled" 1606 ;; 1607 --enable-plugins) plugins="yes" 1608 ;; 1609 --disable-plugins) plugins="no" 1610 ;; 1611 --enable-containers) use_containers="yes" 1612 ;; 1613 --disable-containers) use_containers="no" 1614 ;; 1615 --enable-fuzzing) fuzzing=yes 1616 ;; 1617 --disable-fuzzing) fuzzing=no 1618 ;; 1619 --gdb=*) gdb_bin="$optarg" 1620 ;; 1621 --enable-rng-none) rng_none=yes 1622 ;; 1623 --disable-rng-none) rng_none=no 1624 ;; 1625 --enable-keyring) secret_keyring="yes" 1626 ;; 1627 --disable-keyring) secret_keyring="no" 1628 ;; 1629 --enable-libdaxctl) libdaxctl=yes 1630 ;; 1631 --disable-libdaxctl) libdaxctl=no 1632 ;; 1633 *) 1634 echo "ERROR: unknown option $opt" 1635 echo "Try '$0 --help' for more information" 1636 exit 1 1637 ;; 1638 esac 1639done 1640 1641firmwarepath="${firmwarepath:-$prefix/share/qemu-firmware}" 1642libdir="${libdir:-$prefix/lib}" 1643libexecdir="${libexecdir:-$prefix/libexec}" 1644includedir="${includedir:-$prefix/include}" 1645 1646if test "$mingw32" = "yes" ; then 1647 mandir="$prefix" 1648 datadir="$prefix" 1649 docdir="$prefix" 1650 bindir="$prefix" 1651 sysconfdir="$prefix" 1652 local_statedir= 1653else 1654 mandir="${mandir:-$prefix/share/man}" 1655 datadir="${datadir:-$prefix/share}" 1656 docdir="${docdir:-$prefix/share/doc}" 1657 bindir="${bindir:-$prefix/bin}" 1658 sysconfdir="${sysconfdir:-$prefix/etc}" 1659 local_statedir="${local_statedir:-$prefix/var}" 1660fi 1661 1662case "$cpu" in 1663 ppc) 1664 CPU_CFLAGS="-m32" 1665 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1666 ;; 1667 ppc64) 1668 CPU_CFLAGS="-m64" 1669 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1670 ;; 1671 sparc) 1672 CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1673 QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 1674 ;; 1675 sparc64) 1676 CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1677 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1678 ;; 1679 s390) 1680 CPU_CFLAGS="-m31" 1681 QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 1682 ;; 1683 s390x) 1684 CPU_CFLAGS="-m64" 1685 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1686 ;; 1687 i386) 1688 CPU_CFLAGS="-m32" 1689 QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1690 ;; 1691 x86_64) 1692 # ??? Only extremely old AMD cpus do not have cmpxchg16b. 1693 # If we truly care, we should simply detect this case at 1694 # runtime and generate the fallback to serial emulation. 1695 CPU_CFLAGS="-m64 -mcx16" 1696 QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1697 ;; 1698 x32) 1699 CPU_CFLAGS="-mx32" 1700 QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1701 ;; 1702 # No special flags required for other host CPUs 1703esac 1704 1705eval "cross_cc_${cpu}=\$host_cc" 1706cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 1707QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 1708 1709# For user-mode emulation the host arch has to be one we explicitly 1710# support, even if we're using TCI. 1711if [ "$ARCH" = "unknown" ]; then 1712 bsd_user="no" 1713 linux_user="no" 1714fi 1715 1716if [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then 1717 tcg="no" 1718fi 1719 1720default_target_list="" 1721 1722mak_wilds="" 1723 1724if [ "$softmmu" = "yes" ]; then 1725 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 1726fi 1727if [ "$linux_user" = "yes" ]; then 1728 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 1729fi 1730if [ "$bsd_user" = "yes" ]; then 1731 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 1732fi 1733 1734if test -z "$target_list_exclude"; then 1735 for config in $mak_wilds; do 1736 default_target_list="${default_target_list} $(basename "$config" .mak)" 1737 done 1738else 1739 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g') 1740 for config in $mak_wilds; do 1741 target="$(basename "$config" .mak)" 1742 exclude="no" 1743 for excl in $exclude_list; do 1744 if test "$excl" = "$target"; then 1745 exclude="yes" 1746 break; 1747 fi 1748 done 1749 if test "$exclude" = "no"; then 1750 default_target_list="${default_target_list} $target" 1751 fi 1752 done 1753fi 1754 1755# Enumerate public trace backends for --help output 1756trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1757 1758if test x"$show_help" = x"yes" ; then 1759cat << EOF 1760 1761Usage: configure [options] 1762Options: [defaults in brackets after descriptions] 1763 1764Standard options: 1765 --help print this message 1766 --prefix=PREFIX install in PREFIX [$prefix] 1767 --interp-prefix=PREFIX where to find shared libraries, etc. 1768 use %M for cpu name [$interp_prefix] 1769 --target-list=LIST set target list (default: build everything) 1770$(echo Available targets: $default_target_list | \ 1771 fold -s -w 53 | sed -e 's/^/ /') 1772 --target-list-exclude=LIST exclude a set of targets from the default target-list 1773 1774Advanced options (experts only): 1775 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 1776 --cc=CC use C compiler CC [$cc] 1777 --iasl=IASL use ACPI compiler IASL [$iasl] 1778 --host-cc=CC use C compiler CC [$host_cc] for code run at 1779 build time 1780 --cxx=CXX use C++ compiler CXX [$cxx] 1781 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 1782 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 1783 --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 1784 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1785 --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1786 --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 1787 --make=MAKE use specified make [$make] 1788 --python=PYTHON use specified python [$python] 1789 --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1790 --meson=MESON use specified meson [$meson] 1791 --ninja=NINJA use specified ninja [$ninja] 1792 --smbd=SMBD use specified smbd [$smbd] 1793 --with-git=GIT use specified git [$git] 1794 --static enable static build [$static] 1795 --mandir=PATH install man pages in PATH 1796 --datadir=PATH install firmware in PATH/$qemu_suffix 1797 --docdir=PATH install documentation in PATH/$qemu_suffix 1798 --bindir=PATH install binaries in PATH 1799 --libdir=PATH install libraries in PATH 1800 --libexecdir=PATH install helper binaries in PATH 1801 --sysconfdir=PATH install config in PATH/$qemu_suffix 1802 --localstatedir=PATH install local state in PATH (set at runtime on win32) 1803 --firmwarepath=PATH search PATH for firmware files 1804 --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1805 --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1806 --with-pkgversion=VERS use specified string as sub-version of the package 1807 --enable-debug enable common debug build options 1808 --enable-sanitizers enable default sanitizers 1809 --enable-tsan enable thread sanitizer 1810 --disable-strip disable stripping binaries 1811 --disable-werror disable compilation abort on warning 1812 --disable-stack-protector disable compiler-provided stack protection 1813 --audio-drv-list=LIST set audio drivers list: 1814 Available drivers: $audio_possible_drivers 1815 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 1816 --block-drv-rw-whitelist=L 1817 set block driver read-write whitelist 1818 (affects only QEMU, not qemu-img) 1819 --block-drv-ro-whitelist=L 1820 set block driver read-only whitelist 1821 (affects only QEMU, not qemu-img) 1822 --enable-trace-backends=B Set trace backend 1823 Available backends: $trace_backend_list 1824 --with-trace-file=NAME Full PATH,NAME of file to store traces 1825 Default:trace-<pid> 1826 --disable-slirp disable SLIRP userspace network connectivity 1827 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 1828 --enable-malloc-trim enable libc malloc_trim() for memory optimization 1829 --oss-lib path to OSS library 1830 --cpu=CPU Build for host CPU [$cpu] 1831 --with-coroutine=BACKEND coroutine backend. Supported options: 1832 ucontext, sigaltstack, windows 1833 --enable-gcov enable test coverage analysis with gcov 1834 --disable-blobs disable installing provided firmware blobs 1835 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1836 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1837 --tls-priority default TLS protocol/cipher priority string 1838 --enable-gprof QEMU profiling with gprof 1839 --enable-profiler profiler support 1840 --enable-debug-stack-usage 1841 track the maximum stack usage of stacks created by qemu_alloc_stack 1842 --enable-plugins 1843 enable plugins via shared library loading 1844 --disable-containers don't use containers for cross-building 1845 --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1846 1847Optional features, enabled with --enable-FEATURE and 1848disabled with --disable-FEATURE, default is enabled if available: 1849 1850 system all system emulation targets 1851 user supported user emulation targets 1852 linux-user all linux usermode emulation targets 1853 bsd-user all BSD usermode emulation targets 1854 docs build documentation 1855 guest-agent build the QEMU Guest Agent 1856 guest-agent-msi build guest agent Windows MSI installation package 1857 pie Position Independent Executables 1858 modules modules support (non-Windows) 1859 module-upgrades try to load modules from alternate paths for upgrades 1860 debug-tcg TCG debugging (default is disabled) 1861 debug-info debugging information 1862 sparse sparse checker 1863 safe-stack SafeStack Stack Smash Protection. Depends on 1864 clang/llvm >= 3.7 and requires coroutine backend ucontext. 1865 1866 gnutls GNUTLS cryptography support 1867 nettle nettle cryptography support 1868 gcrypt libgcrypt cryptography support 1869 auth-pam PAM access control 1870 sdl SDL UI 1871 sdl-image SDL Image support for icons 1872 gtk gtk UI 1873 vte vte support for the gtk UI 1874 curses curses UI 1875 iconv font glyph conversion support 1876 vnc VNC UI support 1877 vnc-sasl SASL encryption for VNC server 1878 vnc-jpeg JPEG lossy compression for VNC server 1879 vnc-png PNG compression for VNC server 1880 cocoa Cocoa UI (Mac OS X only) 1881 virtfs VirtFS 1882 mpath Multipath persistent reservation passthrough 1883 xen xen backend driver support 1884 xen-pci-passthrough PCI passthrough support for Xen 1885 brlapi BrlAPI (Braile) 1886 curl curl connectivity 1887 membarrier membarrier system call (for Linux 4.14+ or Windows) 1888 fdt fdt device tree 1889 kvm KVM acceleration support 1890 hax HAX acceleration support 1891 hvf Hypervisor.framework acceleration support 1892 whpx Windows Hypervisor Platform acceleration support 1893 rdma Enable RDMA-based migration 1894 pvrdma Enable PVRDMA support 1895 vde support for vde network 1896 netmap support for netmap network 1897 linux-aio Linux AIO support 1898 linux-io-uring Linux io_uring support 1899 cap-ng libcap-ng support 1900 attr attr and xattr support 1901 vhost-net vhost-net kernel acceleration support 1902 vhost-vsock virtio sockets device support 1903 vhost-scsi vhost-scsi kernel target support 1904 vhost-crypto vhost-user-crypto backend support 1905 vhost-kernel vhost kernel backend support 1906 vhost-user vhost-user backend support 1907 vhost-vdpa vhost-vdpa kernel backend support 1908 spice spice 1909 rbd rados block device (rbd) 1910 libiscsi iscsi support 1911 libnfs nfs support 1912 smartcard smartcard support (libcacard) 1913 u2f U2F support (u2f-emu) 1914 libusb libusb (for usb passthrough) 1915 live-block-migration Block migration in the main migration stream 1916 usb-redir usb network redirection support 1917 lzo support of lzo compression library 1918 snappy support of snappy compression library 1919 bzip2 support of bzip2 compression library 1920 (for reading bzip2-compressed dmg images) 1921 lzfse support of lzfse compression library 1922 (for reading lzfse-compressed dmg images) 1923 zstd support for zstd compression library 1924 (for migration compression and qcow2 cluster compression) 1925 seccomp seccomp support 1926 coroutine-pool coroutine freelist (better performance) 1927 glusterfs GlusterFS backend 1928 tpm TPM support 1929 libssh ssh block device support 1930 numa libnuma support 1931 libxml2 for Parallels image format 1932 tcmalloc tcmalloc support 1933 jemalloc jemalloc support 1934 avx2 AVX2 optimization support 1935 avx512f AVX512F optimization support 1936 replication replication support 1937 opengl opengl support 1938 virglrenderer virgl rendering support 1939 xfsctl xfsctl support 1940 qom-cast-debug cast debugging support 1941 tools build qemu-io, qemu-nbd and qemu-img tools 1942 bochs bochs image format support 1943 cloop cloop image format support 1944 dmg dmg image format support 1945 qcow1 qcow v1 image format support 1946 vdi vdi image format support 1947 vvfat vvfat image format support 1948 qed qed image format support 1949 parallels parallels image format support 1950 sheepdog sheepdog block driver support 1951 crypto-afalg Linux AF_ALG crypto backend driver 1952 capstone capstone disassembler support 1953 debug-mutex mutex debugging support 1954 libpmem libpmem support 1955 xkbcommon xkbcommon support 1956 rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 1957 libdaxctl libdaxctl support 1958 1959NOTE: The object files are built at the place where configure is launched 1960EOF 1961exit 0 1962fi 1963 1964# Remove old dependency files to make sure that they get properly regenerated 1965rm -f */config-devices.mak.d 1966 1967if test -z "$python" 1968then 1969 error_exit "Python not found. Use --python=/path/to/python" 1970fi 1971 1972# Note that if the Python conditional here evaluates True we will exit 1973# with status 1 which is a shell 'false' value. 1974if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then 1975 error_exit "Cannot use '$python', Python >= 3.5 is required." \ 1976 "Use --python=/path/to/python to specify a supported Python." 1977fi 1978 1979# Preserve python version since some functionality is dependent on it 1980python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) 1981 1982# Suppress writing compiled files 1983python="$python -B" 1984 1985if test -z "$meson"; then 1986 if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.1; then 1987 meson=meson 1988 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 1989 meson=git 1990 elif test -e "${source_path}/meson/meson.py" ; then 1991 meson=internal 1992 else 1993 if test "$explicit_python" = yes; then 1994 error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 1995 else 1996 error_exit "Meson not found. Use --meson=/path/to/meson" 1997 fi 1998 fi 1999else 2000 # Meson uses its own Python interpreter to invoke other Python scripts, 2001 # but the user wants to use the one they specified with --python. 2002 # 2003 # We do not want to override the distro Python interpreter (and sometimes 2004 # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 2005 # just require --meson=git|internal together with --python. 2006 if test "$explicit_python" = yes; then 2007 case "$meson" in 2008 git | internal) ;; 2009 *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 2010 esac 2011 fi 2012fi 2013 2014if test "$meson" = git; then 2015 git_submodules="${git_submodules} meson" 2016fi 2017if test "$git_update" = yes; then 2018 (cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update "$git_submodules") 2019fi 2020 2021case "$meson" in 2022 git | internal) 2023 if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then 2024 error_exit "Python setuptools not found" 2025 fi 2026 meson="$python ${source_path}/meson/meson.py" 2027 ;; 2028 *) meson=$(command -v meson) ;; 2029esac 2030 2031# Probe for ninja (used for compdb) 2032 2033if test -z "$ninja"; then 2034 for c in ninja ninja-build samu; do 2035 if has $c; then 2036 ninja=$(command -v "$c") 2037 break 2038 fi 2039 done 2040fi 2041 2042# Check that the C compiler works. Doing this here before testing 2043# the host CPU ensures that we had a valid CC to autodetect the 2044# $cpu var (and we should bail right here if that's not the case). 2045# It also allows the help message to be printed without a CC. 2046write_c_skeleton; 2047if compile_object ; then 2048 : C compiler works ok 2049else 2050 error_exit "\"$cc\" either does not exist or does not work" 2051fi 2052if ! compile_prog ; then 2053 error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 2054fi 2055 2056# Now we have handled --enable-tcg-interpreter and know we're not just 2057# printing the help message, bail out if the host CPU isn't supported. 2058if test "$ARCH" = "unknown"; then 2059 if test "$tcg_interpreter" = "yes" ; then 2060 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 2061 else 2062 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 2063 fi 2064fi 2065 2066# Consult white-list to determine whether to enable werror 2067# by default. Only enable by default for git builds 2068if test -z "$werror" ; then 2069 if test -e "$source_path/.git" && \ 2070 { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 2071 werror="yes" 2072 else 2073 werror="no" 2074 fi 2075fi 2076 2077if test "$bogus_os" = "yes"; then 2078 # Now that we know that we're not printing the help and that 2079 # the compiler works (so the results of the check_defines we used 2080 # to identify the OS are reliable), if we didn't recognize the 2081 # host OS we should stop now. 2082 error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 2083fi 2084 2085# Check whether the compiler matches our minimum requirements: 2086cat > $TMPC << EOF 2087#if defined(__clang_major__) && defined(__clang_minor__) 2088# ifdef __apple_build_version__ 2089# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) 2090# error You need at least XCode Clang v5.1 to compile QEMU 2091# endif 2092# else 2093# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) 2094# error You need at least Clang v3.4 to compile QEMU 2095# endif 2096# endif 2097#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 2098# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 2099# error You need at least GCC v4.8 to compile QEMU 2100# endif 2101#else 2102# error You either need GCC or Clang to compiler QEMU 2103#endif 2104int main (void) { return 0; } 2105EOF 2106if ! compile_prog "" "" ; then 2107 error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" 2108fi 2109 2110# Accumulate -Wfoo and -Wno-bar separately. 2111# We will list all of the enable flags first, and the disable flags second. 2112# Note that we do not add -Werror, because that would enable it for all 2113# configure tests. If a configure test failed due to -Werror this would 2114# just silently disable some features, so it's too error prone. 2115 2116warn_flags= 2117add_to warn_flags -Wold-style-declaration 2118add_to warn_flags -Wold-style-definition 2119add_to warn_flags -Wtype-limits 2120add_to warn_flags -Wformat-security 2121add_to warn_flags -Wformat-y2k 2122add_to warn_flags -Winit-self 2123add_to warn_flags -Wignored-qualifiers 2124add_to warn_flags -Wempty-body 2125add_to warn_flags -Wnested-externs 2126add_to warn_flags -Wendif-labels 2127add_to warn_flags -Wexpansion-to-defined 2128 2129nowarn_flags= 2130add_to nowarn_flags -Wno-initializer-overrides 2131add_to nowarn_flags -Wno-missing-include-dirs 2132add_to nowarn_flags -Wno-shift-negative-value 2133add_to nowarn_flags -Wno-string-plus-int 2134add_to nowarn_flags -Wno-typedef-redefinition 2135add_to nowarn_flags -Wno-tautological-type-limit-compare 2136add_to nowarn_flags -Wno-psabi 2137 2138gcc_flags="$warn_flags $nowarn_flags" 2139 2140cc_has_warning_flag() { 2141 write_c_skeleton; 2142 2143 # Use the positive sense of the flag when testing for -Wno-wombat 2144 # support (gcc will happily accept the -Wno- form of unknown 2145 # warning options). 2146 optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 2147 compile_prog "-Werror $optflag" "" 2148} 2149 2150for flag in $gcc_flags; do 2151 if cc_has_warning_flag $flag ; then 2152 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2153 fi 2154done 2155 2156if test "$stack_protector" != "no"; then 2157 cat > $TMPC << EOF 2158int main(int argc, char *argv[]) 2159{ 2160 char arr[64], *p = arr, *c = argv[0]; 2161 while (*c) { 2162 *p++ = *c++; 2163 } 2164 return 0; 2165} 2166EOF 2167 gcc_flags="-fstack-protector-strong -fstack-protector-all" 2168 sp_on=0 2169 for flag in $gcc_flags; do 2170 # We need to check both a compile and a link, since some compiler 2171 # setups fail only on a .c->.o compile and some only at link time 2172 if compile_object "-Werror $flag" && 2173 compile_prog "-Werror $flag" ""; then 2174 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2175 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 2176 sp_on=1 2177 break 2178 fi 2179 done 2180 if test "$stack_protector" = yes; then 2181 if test $sp_on = 0; then 2182 error_exit "Stack protector not supported" 2183 fi 2184 fi 2185fi 2186 2187# Disable -Wmissing-braces on older compilers that warn even for 2188# the "universal" C zero initializer {0}. 2189cat > $TMPC << EOF 2190struct { 2191 int a[2]; 2192} x = {0}; 2193EOF 2194if compile_object "-Werror" "" ; then 2195 : 2196else 2197 QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 2198fi 2199 2200# Our module code doesn't support Windows 2201if test "$modules" = "yes" && test "$mingw32" = "yes" ; then 2202 error_exit "Modules are not available for Windows" 2203fi 2204 2205# module_upgrades is only reasonable if modules are enabled 2206if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2207 error_exit "Can't enable module-upgrades as Modules are not enabled" 2208fi 2209 2210# Static linking is not possible with modules or PIE 2211if test "$static" = "yes" ; then 2212 if test "$modules" = "yes" ; then 2213 error_exit "static and modules are mutually incompatible" 2214 fi 2215fi 2216 2217# Unconditional check for compiler __thread support 2218 cat > $TMPC << EOF 2219static __thread int tls_var; 2220int main(void) { return tls_var; } 2221EOF 2222 2223if ! compile_prog "-Werror" "" ; then 2224 error_exit "Your compiler does not support the __thread specifier for " \ 2225 "Thread-Local Storage (TLS). Please upgrade to a version that does." 2226fi 2227 2228cat > $TMPC << EOF 2229 2230#ifdef __linux__ 2231# define THREAD __thread 2232#else 2233# define THREAD 2234#endif 2235static THREAD int tls_var; 2236int main(void) { return tls_var; } 2237EOF 2238 2239# Check we support --no-pie first; we will need this for building ROMs. 2240if compile_prog "-Werror -fno-pie" "-no-pie"; then 2241 CFLAGS_NOPIE="-fno-pie" 2242 LDFLAGS_NOPIE="-no-pie" 2243fi 2244 2245if test "$static" = "yes"; then 2246 if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 2247 CFLAGS="-fPIE -DPIE $CFLAGS" 2248 QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 2249 pie="yes" 2250 elif test "$pie" = "yes"; then 2251 error_exit "-static-pie not available due to missing toolchain support" 2252 else 2253 QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 2254 pie="no" 2255 fi 2256elif test "$pie" = "no"; then 2257 CFLAGS="$CFLAGS_NOPIE $CFLAGS" 2258 LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS" 2259elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 2260 CFLAGS="-fPIE -DPIE $CFLAGS" 2261 LDFLAGS="-pie $LDFLAGS" 2262 pie="yes" 2263elif test "$pie" = "yes"; then 2264 error_exit "PIE not available due to missing toolchain support" 2265else 2266 echo "Disabling PIE due to missing toolchain support" 2267 pie="no" 2268fi 2269 2270# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2271# The combination is known as "full relro", because .got.plt is read-only too. 2272if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2273 QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2274fi 2275 2276########################################## 2277# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2278# use i686 as default anyway, but for those that don't, an explicit 2279# specification is necessary 2280 2281if test "$cpu" = "i386"; then 2282 cat > $TMPC << EOF 2283static int sfaa(int *ptr) 2284{ 2285 return __sync_fetch_and_and(ptr, 0); 2286} 2287 2288int main(void) 2289{ 2290 int val = 42; 2291 val = __sync_val_compare_and_swap(&val, 0, 1); 2292 sfaa(&val); 2293 return val; 2294} 2295EOF 2296 if ! compile_prog "" "" ; then 2297 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 2298 fi 2299fi 2300 2301######################################### 2302# Solaris specific configure tool chain decisions 2303 2304if test "$solaris" = "yes" ; then 2305 if has ar; then 2306 : 2307 else 2308 if test -f /usr/ccs/bin/ar ; then 2309 error_exit "No path includes ar" \ 2310 "Add /usr/ccs/bin to your path and rerun configure" 2311 fi 2312 error_exit "No path includes ar" 2313 fi 2314fi 2315 2316if test -z "${target_list+xxx}" ; then 2317 for target in $default_target_list; do 2318 supported_target $target 2>/dev/null && \ 2319 target_list="$target_list $target" 2320 done 2321 target_list="${target_list# }" 2322else 2323 target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2324 for target in $target_list; do 2325 # Check that we recognised the target name; this allows a more 2326 # friendly error message than if we let it fall through. 2327 case " $default_target_list " in 2328 *" $target "*) 2329 ;; 2330 *) 2331 error_exit "Unknown target name '$target'" 2332 ;; 2333 esac 2334 supported_target $target || exit 1 2335 done 2336fi 2337 2338# see if system emulation was really requested 2339case " $target_list " in 2340 *"-softmmu "*) softmmu=yes 2341 ;; 2342 *) softmmu=no 2343 ;; 2344esac 2345 2346for target in $target_list; do 2347 case "$target" in 2348 arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu) 2349 edk2_blobs="yes" 2350 ;; 2351 esac 2352done 2353# The EDK2 binaries are compressed with bzip2 2354if test "$edk2_blobs" = "yes" && ! has bzip2; then 2355 error_exit "The bzip2 program is required for building QEMU" 2356fi 2357 2358feature_not_found() { 2359 feature=$1 2360 remedy=$2 2361 2362 error_exit "User requested feature $feature" \ 2363 "configure was not able to find it." \ 2364 "$remedy" 2365} 2366 2367# --- 2368# big/little endian test 2369cat > $TMPC << EOF 2370short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 2371short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 2372extern int foo(short *, short *); 2373int main(int argc, char *argv[]) { 2374 return foo(big_endian, little_endian); 2375} 2376EOF 2377 2378if compile_object ; then 2379 if strings -a $TMPO | grep -q BiGeNdIaN ; then 2380 bigendian="yes" 2381 elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 2382 bigendian="no" 2383 else 2384 echo big/little test failed 2385 fi 2386else 2387 echo big/little test failed 2388fi 2389 2390########################################## 2391# system tools 2392if test -z "$want_tools"; then 2393 if test "$softmmu" = "no"; then 2394 want_tools=no 2395 else 2396 want_tools=yes 2397 fi 2398fi 2399 2400########################################## 2401# cocoa implies not SDL or GTK 2402# (the cocoa UI code currently assumes it is always the active UI 2403# and doesn't interact well with other UI frontend code) 2404if test "$cocoa" = "yes"; then 2405 if test "$sdl" = "yes"; then 2406 error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2407 fi 2408 if test "$gtk" = "yes"; then 2409 error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2410 fi 2411 gtk=no 2412 sdl=disabled 2413fi 2414 2415# Some versions of Mac OS X incorrectly define SIZE_MAX 2416cat > $TMPC << EOF 2417#include <stdint.h> 2418#include <stdio.h> 2419int main(int argc, char *argv[]) { 2420 return printf("%zu", SIZE_MAX); 2421} 2422EOF 2423have_broken_size_max=no 2424if ! compile_object -Werror ; then 2425 have_broken_size_max=yes 2426fi 2427 2428########################################## 2429# L2TPV3 probe 2430 2431cat > $TMPC <<EOF 2432#include <sys/socket.h> 2433#include <linux/ip.h> 2434int main(void) { return sizeof(struct mmsghdr); } 2435EOF 2436if compile_prog "" "" ; then 2437 l2tpv3=yes 2438else 2439 l2tpv3=no 2440fi 2441 2442if check_include "pty.h" ; then 2443 pty_h=yes 2444else 2445 pty_h=no 2446fi 2447 2448cat > $TMPC <<EOF 2449#include <sys/mman.h> 2450int main(int argc, char *argv[]) { 2451 return mlockall(MCL_FUTURE); 2452} 2453EOF 2454if compile_prog "" "" ; then 2455 have_mlockall=yes 2456else 2457 have_mlockall=no 2458fi 2459 2460######################################### 2461# vhost interdependencies and host support 2462 2463# vhost backends 2464test "$vhost_user" = "" && vhost_user=yes 2465if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then 2466 error_exit "vhost-user isn't available on win32" 2467fi 2468test "$vhost_vdpa" = "" && vhost_vdpa=$linux 2469if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 2470 error_exit "vhost-vdpa is only available on Linux" 2471fi 2472test "$vhost_kernel" = "" && vhost_kernel=$linux 2473if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2474 error_exit "vhost-kernel is only available on Linux" 2475fi 2476 2477# vhost-kernel devices 2478test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2479if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2480 error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2481fi 2482test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2483if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2484 error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2485fi 2486 2487# vhost-user backends 2488test "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2489if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2490 error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2491fi 2492test "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2493if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2494 error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2495fi 2496test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 2497if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 2498 error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 2499fi 2500#vhost-vdpa backends 2501test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 2502if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 2503 error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 2504fi 2505 2506# OR the vhost-kernel and vhost-user values for simplicity 2507if test "$vhost_net" = ""; then 2508 test "$vhost_net_user" = "yes" && vhost_net=yes 2509 test "$vhost_kernel" = "yes" && vhost_net=yes 2510fi 2511 2512########################################## 2513# MinGW / Mingw-w64 localtime_r/gmtime_r check 2514 2515if test "$mingw32" = "yes"; then 2516 # Some versions of MinGW / Mingw-w64 lack localtime_r 2517 # and gmtime_r entirely. 2518 # 2519 # Some versions of Mingw-w64 define a macro for 2520 # localtime_r/gmtime_r. 2521 # 2522 # Some versions of Mingw-w64 will define functions 2523 # for localtime_r/gmtime_r, but only if you have 2524 # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 2525 # though, unistd.h and pthread.h both define 2526 # that for you. 2527 # 2528 # So this #undef localtime_r and #include <unistd.h> 2529 # are not in fact redundant. 2530cat > $TMPC << EOF 2531#include <unistd.h> 2532#include <time.h> 2533#undef localtime_r 2534int main(void) { localtime_r(NULL, NULL); return 0; } 2535EOF 2536 if compile_prog "" "" ; then 2537 localtime_r="yes" 2538 else 2539 localtime_r="no" 2540 fi 2541fi 2542 2543########################################## 2544# pkg-config probe 2545 2546if ! has "$pkg_config_exe"; then 2547 error_exit "pkg-config binary '$pkg_config_exe' not found" 2548fi 2549 2550########################################## 2551# NPTL probe 2552 2553if test "$linux_user" = "yes"; then 2554 cat > $TMPC <<EOF 2555#include <sched.h> 2556#include <linux/futex.h> 2557int main(void) { 2558#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2559#error bork 2560#endif 2561 return 0; 2562} 2563EOF 2564 if ! compile_object ; then 2565 feature_not_found "nptl" "Install glibc and linux kernel headers." 2566 fi 2567fi 2568 2569########################################## 2570# lzo check 2571 2572if test "$lzo" != "no" ; then 2573 cat > $TMPC << EOF 2574#include <lzo/lzo1x.h> 2575int main(void) { lzo_version(); return 0; } 2576EOF 2577 if compile_prog "" "-llzo2" ; then 2578 lzo_libs="-llzo2" 2579 lzo="yes" 2580 else 2581 if test "$lzo" = "yes"; then 2582 feature_not_found "liblzo2" "Install liblzo2 devel" 2583 fi 2584 lzo="no" 2585 fi 2586fi 2587 2588########################################## 2589# snappy check 2590 2591if test "$snappy" != "no" ; then 2592 cat > $TMPC << EOF 2593#include <snappy-c.h> 2594int main(void) { snappy_max_compressed_length(4096); return 0; } 2595EOF 2596 if compile_prog "" "-lsnappy" ; then 2597 snappy_libs='-lsnappy' 2598 snappy="yes" 2599 else 2600 if test "$snappy" = "yes"; then 2601 feature_not_found "libsnappy" "Install libsnappy devel" 2602 fi 2603 snappy="no" 2604 fi 2605fi 2606 2607########################################## 2608# bzip2 check 2609 2610if test "$bzip2" != "no" ; then 2611 cat > $TMPC << EOF 2612#include <bzlib.h> 2613int main(void) { BZ2_bzlibVersion(); return 0; } 2614EOF 2615 if compile_prog "" "-lbz2" ; then 2616 bzip2="yes" 2617 else 2618 if test "$bzip2" = "yes"; then 2619 feature_not_found "libbzip2" "Install libbzip2 devel" 2620 fi 2621 bzip2="no" 2622 fi 2623fi 2624 2625########################################## 2626# lzfse check 2627 2628if test "$lzfse" != "no" ; then 2629 cat > $TMPC << EOF 2630#include <lzfse.h> 2631int main(void) { lzfse_decode_scratch_size(); return 0; } 2632EOF 2633 if compile_prog "" "-llzfse" ; then 2634 lzfse="yes" 2635 else 2636 if test "$lzfse" = "yes"; then 2637 feature_not_found "lzfse" "Install lzfse devel" 2638 fi 2639 lzfse="no" 2640 fi 2641fi 2642 2643########################################## 2644# zstd check 2645 2646if test "$zstd" != "no" ; then 2647 libzstd_minver="1.4.0" 2648 if $pkg_config --atleast-version=$libzstd_minver libzstd ; then 2649 zstd_cflags="$($pkg_config --cflags libzstd)" 2650 zstd_libs="$($pkg_config --libs libzstd)" 2651 zstd="yes" 2652 else 2653 if test "$zstd" = "yes" ; then 2654 feature_not_found "libzstd" "Install libzstd devel" 2655 fi 2656 zstd="no" 2657 fi 2658fi 2659 2660########################################## 2661# libseccomp check 2662 2663if test "$seccomp" != "no" ; then 2664 libseccomp_minver="2.3.0" 2665 if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2666 seccomp_cflags="$($pkg_config --cflags libseccomp)" 2667 seccomp_libs="$($pkg_config --libs libseccomp)" 2668 seccomp="yes" 2669 else 2670 if test "$seccomp" = "yes" ; then 2671 feature_not_found "libseccomp" \ 2672 "Install libseccomp devel >= $libseccomp_minver" 2673 fi 2674 seccomp="no" 2675 fi 2676fi 2677########################################## 2678# xen probe 2679 2680if test "$xen" != "no" ; then 2681 # Check whether Xen library path is specified via --extra-ldflags to avoid 2682 # overriding this setting with pkg-config output. If not, try pkg-config 2683 # to obtain all needed flags. 2684 2685 if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2686 $pkg_config --exists xencontrol ; then 2687 xen_ctrl_version="$(printf '%d%02d%02d' \ 2688 $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2689 xen=yes 2690 xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2691 xen_pc="$xen_pc xenevtchn xendevicemodel" 2692 if $pkg_config --exists xentoolcore; then 2693 xen_pc="$xen_pc xentoolcore" 2694 fi 2695 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" 2696 xen_cflags="$($pkg_config --cflags $xen_pc)" 2697 xen_libs="$($pkg_config --libs $xen_pc)" 2698 else 2699 2700 xen_libs="-lxenstore -lxenctrl -lxenguest" 2701 xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2702 2703 # First we test whether Xen headers and libraries are available. 2704 # If no, we are done and there is no Xen support. 2705 # If yes, more tests are run to detect the Xen version. 2706 2707 # Xen (any) 2708 cat > $TMPC <<EOF 2709#include <xenctrl.h> 2710int main(void) { 2711 return 0; 2712} 2713EOF 2714 if ! compile_prog "" "$xen_libs" ; then 2715 # Xen not found 2716 if test "$xen" = "yes" ; then 2717 feature_not_found "xen" "Install xen devel" 2718 fi 2719 xen=no 2720 2721 # Xen unstable 2722 elif 2723 cat > $TMPC <<EOF && 2724#undef XC_WANT_COMPAT_DEVICEMODEL_API 2725#define __XEN_TOOLS__ 2726#include <xendevicemodel.h> 2727#include <xenforeignmemory.h> 2728int main(void) { 2729 xendevicemodel_handle *xd; 2730 xenforeignmemory_handle *xfmem; 2731 2732 xd = xendevicemodel_open(0, 0); 2733 xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 2734 2735 xfmem = xenforeignmemory_open(0, 0); 2736 xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2737 2738 return 0; 2739} 2740EOF 2741 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 2742 then 2743 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 2744 xen_ctrl_version=41100 2745 xen=yes 2746 elif 2747 cat > $TMPC <<EOF && 2748#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2749#include <xenforeignmemory.h> 2750#include <xentoolcore.h> 2751int main(void) { 2752 xenforeignmemory_handle *xfmem; 2753 2754 xfmem = xenforeignmemory_open(0, 0); 2755 xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 2756 xentoolcore_restrict_all(0); 2757 2758 return 0; 2759} 2760EOF 2761 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 2762 then 2763 xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 2764 xen_ctrl_version=41000 2765 xen=yes 2766 elif 2767 cat > $TMPC <<EOF && 2768#undef XC_WANT_COMPAT_DEVICEMODEL_API 2769#define __XEN_TOOLS__ 2770#include <xendevicemodel.h> 2771int main(void) { 2772 xendevicemodel_handle *xd; 2773 2774 xd = xendevicemodel_open(0, 0); 2775 xendevicemodel_close(xd); 2776 2777 return 0; 2778} 2779EOF 2780 compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2781 then 2782 xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2783 xen_ctrl_version=40900 2784 xen=yes 2785 elif 2786 cat > $TMPC <<EOF && 2787/* 2788 * If we have stable libs the we don't want the libxc compat 2789 * layers, regardless of what CFLAGS we may have been given. 2790 * 2791 * Also, check if xengnttab_grant_copy_segment_t is defined and 2792 * grant copy operation is implemented. 2793 */ 2794#undef XC_WANT_COMPAT_EVTCHN_API 2795#undef XC_WANT_COMPAT_GNTTAB_API 2796#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2797#include <xenctrl.h> 2798#include <xenstore.h> 2799#include <xenevtchn.h> 2800#include <xengnttab.h> 2801#include <xenforeignmemory.h> 2802#include <stdint.h> 2803#include <xen/hvm/hvm_info_table.h> 2804#if !defined(HVM_MAX_VCPUS) 2805# error HVM_MAX_VCPUS not defined 2806#endif 2807int main(void) { 2808 xc_interface *xc = NULL; 2809 xenforeignmemory_handle *xfmem; 2810 xenevtchn_handle *xe; 2811 xengnttab_handle *xg; 2812 xengnttab_grant_copy_segment_t* seg = NULL; 2813 2814 xs_daemon_open(); 2815 2816 xc = xc_interface_open(0, 0, 0); 2817 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2818 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2819 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2820 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2821 2822 xfmem = xenforeignmemory_open(0, 0); 2823 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2824 2825 xe = xenevtchn_open(0, 0); 2826 xenevtchn_fd(xe); 2827 2828 xg = xengnttab_open(0, 0); 2829 xengnttab_grant_copy(xg, 0, seg); 2830 2831 return 0; 2832} 2833EOF 2834 compile_prog "" "$xen_libs $xen_stable_libs" 2835 then 2836 xen_ctrl_version=40800 2837 xen=yes 2838 elif 2839 cat > $TMPC <<EOF && 2840/* 2841 * If we have stable libs the we don't want the libxc compat 2842 * layers, regardless of what CFLAGS we may have been given. 2843 */ 2844#undef XC_WANT_COMPAT_EVTCHN_API 2845#undef XC_WANT_COMPAT_GNTTAB_API 2846#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2847#include <xenctrl.h> 2848#include <xenstore.h> 2849#include <xenevtchn.h> 2850#include <xengnttab.h> 2851#include <xenforeignmemory.h> 2852#include <stdint.h> 2853#include <xen/hvm/hvm_info_table.h> 2854#if !defined(HVM_MAX_VCPUS) 2855# error HVM_MAX_VCPUS not defined 2856#endif 2857int main(void) { 2858 xc_interface *xc = NULL; 2859 xenforeignmemory_handle *xfmem; 2860 xenevtchn_handle *xe; 2861 xengnttab_handle *xg; 2862 2863 xs_daemon_open(); 2864 2865 xc = xc_interface_open(0, 0, 0); 2866 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2867 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2868 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2869 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2870 2871 xfmem = xenforeignmemory_open(0, 0); 2872 xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2873 2874 xe = xenevtchn_open(0, 0); 2875 xenevtchn_fd(xe); 2876 2877 xg = xengnttab_open(0, 0); 2878 xengnttab_map_grant_ref(xg, 0, 0, 0); 2879 2880 return 0; 2881} 2882EOF 2883 compile_prog "" "$xen_libs $xen_stable_libs" 2884 then 2885 xen_ctrl_version=40701 2886 xen=yes 2887 2888 # Xen 4.6 2889 elif 2890 cat > $TMPC <<EOF && 2891#include <xenctrl.h> 2892#include <xenstore.h> 2893#include <stdint.h> 2894#include <xen/hvm/hvm_info_table.h> 2895#if !defined(HVM_MAX_VCPUS) 2896# error HVM_MAX_VCPUS not defined 2897#endif 2898int main(void) { 2899 xc_interface *xc; 2900 xs_daemon_open(); 2901 xc = xc_interface_open(0, 0, 0); 2902 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2903 xc_gnttab_open(NULL, 0); 2904 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2905 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2906 xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2907 xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2908 return 0; 2909} 2910EOF 2911 compile_prog "" "$xen_libs" 2912 then 2913 xen_ctrl_version=40600 2914 xen=yes 2915 2916 # Xen 4.5 2917 elif 2918 cat > $TMPC <<EOF && 2919#include <xenctrl.h> 2920#include <xenstore.h> 2921#include <stdint.h> 2922#include <xen/hvm/hvm_info_table.h> 2923#if !defined(HVM_MAX_VCPUS) 2924# error HVM_MAX_VCPUS not defined 2925#endif 2926int main(void) { 2927 xc_interface *xc; 2928 xs_daemon_open(); 2929 xc = xc_interface_open(0, 0, 0); 2930 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2931 xc_gnttab_open(NULL, 0); 2932 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2933 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2934 xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 2935 return 0; 2936} 2937EOF 2938 compile_prog "" "$xen_libs" 2939 then 2940 xen_ctrl_version=40500 2941 xen=yes 2942 2943 elif 2944 cat > $TMPC <<EOF && 2945#include <xenctrl.h> 2946#include <xenstore.h> 2947#include <stdint.h> 2948#include <xen/hvm/hvm_info_table.h> 2949#if !defined(HVM_MAX_VCPUS) 2950# error HVM_MAX_VCPUS not defined 2951#endif 2952int main(void) { 2953 xc_interface *xc; 2954 xs_daemon_open(); 2955 xc = xc_interface_open(0, 0, 0); 2956 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2957 xc_gnttab_open(NULL, 0); 2958 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2959 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2960 return 0; 2961} 2962EOF 2963 compile_prog "" "$xen_libs" 2964 then 2965 xen_ctrl_version=40200 2966 xen=yes 2967 2968 else 2969 if test "$xen" = "yes" ; then 2970 feature_not_found "xen (unsupported version)" \ 2971 "Install a supported xen (xen 4.2 or newer)" 2972 fi 2973 xen=no 2974 fi 2975 2976 if test "$xen" = yes; then 2977 if test $xen_ctrl_version -ge 40701 ; then 2978 xen_libs="$xen_libs $xen_stable_libs " 2979 fi 2980 fi 2981 fi 2982fi 2983 2984if test "$xen_pci_passthrough" != "no"; then 2985 if test "$xen" = "yes" && test "$linux" = "yes"; then 2986 xen_pci_passthrough=yes 2987 else 2988 if test "$xen_pci_passthrough" = "yes"; then 2989 error_exit "User requested feature Xen PCI Passthrough" \ 2990 " but this feature requires /sys from Linux" 2991 fi 2992 xen_pci_passthrough=no 2993 fi 2994fi 2995 2996########################################## 2997# Windows Hypervisor Platform accelerator (WHPX) check 2998if test "$whpx" != "no" ; then 2999 if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then 3000 whpx="yes" 3001 else 3002 if test "$whpx" = "yes"; then 3003 feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" 3004 fi 3005 whpx="no" 3006 fi 3007fi 3008 3009########################################## 3010# gettext probe 3011if test "$gettext" != "false" ; then 3012 if has xgettext; then 3013 gettext=true 3014 else 3015 if test "$gettext" = "true" ; then 3016 feature_not_found "gettext" "Install xgettext binary" 3017 fi 3018 gettext=false 3019 fi 3020fi 3021 3022########################################## 3023# Sparse probe 3024if test "$sparse" != "no" ; then 3025 if has sparse; then 3026 sparse=yes 3027 else 3028 if test "$sparse" = "yes" ; then 3029 feature_not_found "sparse" "Install sparse binary" 3030 fi 3031 sparse=no 3032 fi 3033fi 3034 3035########################################## 3036# X11 probe 3037if $pkg_config --exists "x11"; then 3038 have_x11=yes 3039 x11_cflags=$($pkg_config --cflags x11) 3040 x11_libs=$($pkg_config --libs x11) 3041fi 3042 3043########################################## 3044# GTK probe 3045 3046if test "$gtk" != "no"; then 3047 gtkpackage="gtk+-3.0" 3048 gtkx11package="gtk+-x11-3.0" 3049 gtkversion="3.22.0" 3050 if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 3051 gtk_cflags=$($pkg_config --cflags $gtkpackage) 3052 gtk_libs=$($pkg_config --libs $gtkpackage) 3053 gtk_version=$($pkg_config --modversion $gtkpackage) 3054 if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 3055 need_x11=yes 3056 gtk_cflags="$gtk_cflags $x11_cflags" 3057 gtk_libs="$gtk_libs $x11_libs" 3058 fi 3059 gtk="yes" 3060 elif test "$gtk" = "yes"; then 3061 feature_not_found "gtk" "Install gtk3-devel" 3062 else 3063 gtk="no" 3064 fi 3065fi 3066 3067 3068########################################## 3069# GNUTLS probe 3070 3071if test "$gnutls" != "no"; then 3072 pass="no" 3073 if $pkg_config --exists "gnutls >= 3.1.18"; then 3074 gnutls_cflags=$($pkg_config --cflags gnutls) 3075 gnutls_libs=$($pkg_config --libs gnutls) 3076 # Packaging for the static libraries is not always correct. 3077 # At least ubuntu 18.04 ships only shared libraries. 3078 write_c_skeleton 3079 if compile_prog "" "$gnutls_libs" ; then 3080 LIBS="$gnutls_libs $LIBS" 3081 QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 3082 pass="yes" 3083 fi 3084 fi 3085 if test "$pass" = "no" && test "$gnutls" = "yes"; then 3086 feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 3087 else 3088 gnutls="$pass" 3089 fi 3090fi 3091 3092 3093# If user didn't give a --disable/enable-gcrypt flag, 3094# then mark as disabled if user requested nettle 3095# explicitly 3096if test -z "$gcrypt" 3097then 3098 if test "$nettle" = "yes" 3099 then 3100 gcrypt="no" 3101 fi 3102fi 3103 3104# If user didn't give a --disable/enable-nettle flag, 3105# then mark as disabled if user requested gcrypt 3106# explicitly 3107if test -z "$nettle" 3108then 3109 if test "$gcrypt" = "yes" 3110 then 3111 nettle="no" 3112 fi 3113fi 3114 3115has_libgcrypt() { 3116 if ! has "libgcrypt-config" 3117 then 3118 return 1 3119 fi 3120 3121 if test -n "$cross_prefix" 3122 then 3123 host=$(libgcrypt-config --host) 3124 if test "$host-" != $cross_prefix 3125 then 3126 return 1 3127 fi 3128 fi 3129 3130 maj=`libgcrypt-config --version | awk -F . '{print $1}'` 3131 min=`libgcrypt-config --version | awk -F . '{print $2}'` 3132 3133 if test $maj != 1 || test $min -lt 5 3134 then 3135 return 1 3136 fi 3137 3138 return 0 3139} 3140 3141 3142if test "$nettle" != "no"; then 3143 pass="no" 3144 if $pkg_config --exists "nettle >= 2.7.1"; then 3145 nettle_cflags=$($pkg_config --cflags nettle) 3146 nettle_libs=$($pkg_config --libs nettle) 3147 nettle_version=$($pkg_config --modversion nettle) 3148 # Link test to make sure the given libraries work (e.g for static). 3149 write_c_skeleton 3150 if compile_prog "" "$nettle_libs" ; then 3151 LIBS="$nettle_libs $LIBS" 3152 QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 3153 if test -z "$gcrypt"; then 3154 gcrypt="no" 3155 fi 3156 pass="yes" 3157 fi 3158 fi 3159 if test "$pass" = "yes" 3160 then 3161 cat > $TMPC << EOF 3162#include <nettle/xts.h> 3163int main(void) { 3164 return 0; 3165} 3166EOF 3167 if compile_prog "$nettle_cflags" "$nettle_libs" ; then 3168 nettle_xts=yes 3169 qemu_private_xts=no 3170 fi 3171 fi 3172 if test "$pass" = "no" && test "$nettle" = "yes"; then 3173 feature_not_found "nettle" "Install nettle devel >= 2.7.1" 3174 else 3175 nettle="$pass" 3176 fi 3177fi 3178 3179if test "$gcrypt" != "no"; then 3180 pass="no" 3181 if has_libgcrypt; then 3182 gcrypt_cflags=$(libgcrypt-config --cflags) 3183 gcrypt_libs=$(libgcrypt-config --libs) 3184 # Debian has removed -lgpg-error from libgcrypt-config 3185 # as it "spreads unnecessary dependencies" which in 3186 # turn breaks static builds... 3187 if test "$static" = "yes" 3188 then 3189 gcrypt_libs="$gcrypt_libs -lgpg-error" 3190 fi 3191 3192 # Link test to make sure the given libraries work (e.g for static). 3193 write_c_skeleton 3194 if compile_prog "" "$gcrypt_libs" ; then 3195 LIBS="$gcrypt_libs $LIBS" 3196 QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 3197 pass="yes" 3198 fi 3199 fi 3200 if test "$pass" = "yes"; then 3201 gcrypt="yes" 3202 cat > $TMPC << EOF 3203#include <gcrypt.h> 3204int main(void) { 3205 gcry_mac_hd_t handle; 3206 gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 3207 GCRY_MAC_FLAG_SECURE, NULL); 3208 return 0; 3209} 3210EOF 3211 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3212 gcrypt_hmac=yes 3213 fi 3214 cat > $TMPC << EOF 3215#include <gcrypt.h> 3216int main(void) { 3217 gcry_cipher_hd_t handle; 3218 gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); 3219 return 0; 3220} 3221EOF 3222 if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3223 gcrypt_xts=yes 3224 qemu_private_xts=no 3225 fi 3226 elif test "$gcrypt" = "yes"; then 3227 feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 3228 else 3229 gcrypt="no" 3230 fi 3231fi 3232 3233 3234if test "$gcrypt" = "yes" && test "$nettle" = "yes" 3235then 3236 error_exit "Only one of gcrypt & nettle can be enabled" 3237fi 3238 3239########################################## 3240# libtasn1 - only for the TLS creds/session test suite 3241 3242tasn1=yes 3243tasn1_cflags="" 3244tasn1_libs="" 3245if $pkg_config --exists "libtasn1"; then 3246 tasn1_cflags=$($pkg_config --cflags libtasn1) 3247 tasn1_libs=$($pkg_config --libs libtasn1) 3248else 3249 tasn1=no 3250fi 3251 3252 3253########################################## 3254# PAM probe 3255 3256if test "$auth_pam" != "no"; then 3257 cat > $TMPC <<EOF 3258#include <security/pam_appl.h> 3259#include <stdio.h> 3260int main(void) { 3261 const char *service_name = "qemu"; 3262 const char *user = "frank"; 3263 const struct pam_conv pam_conv = { 0 }; 3264 pam_handle_t *pamh = NULL; 3265 pam_start(service_name, user, &pam_conv, &pamh); 3266 return 0; 3267} 3268EOF 3269 if compile_prog "" "-lpam" ; then 3270 auth_pam=yes 3271 else 3272 if test "$auth_pam" = "yes"; then 3273 feature_not_found "PAM" "Install PAM development package" 3274 else 3275 auth_pam=no 3276 fi 3277 fi 3278fi 3279 3280########################################## 3281# getifaddrs (for tests/test-io-channel-socket ) 3282 3283have_ifaddrs_h=yes 3284if ! check_include "ifaddrs.h" ; then 3285 have_ifaddrs_h=no 3286fi 3287 3288######################################### 3289# libdrm check 3290have_drm_h=no 3291if check_include "libdrm/drm.h" ; then 3292 have_drm_h=yes 3293fi 3294 3295######################################### 3296# sys/signal.h check 3297have_sys_signal_h=no 3298if check_include "sys/signal.h" ; then 3299 have_sys_signal_h=yes 3300fi 3301 3302########################################## 3303# VTE probe 3304 3305if test "$vte" != "no"; then 3306 vteminversion="0.32.0" 3307 if $pkg_config --exists "vte-2.91"; then 3308 vtepackage="vte-2.91" 3309 else 3310 vtepackage="vte-2.90" 3311 fi 3312 if $pkg_config --exists "$vtepackage >= $vteminversion"; then 3313 vte_cflags=$($pkg_config --cflags $vtepackage) 3314 vte_libs=$($pkg_config --libs $vtepackage) 3315 vteversion=$($pkg_config --modversion $vtepackage) 3316 vte="yes" 3317 elif test "$vte" = "yes"; then 3318 feature_not_found "vte" "Install libvte-2.90/2.91 devel" 3319 else 3320 vte="no" 3321 fi 3322fi 3323 3324########################################## 3325# RDMA needs OpenFabrics libraries 3326if test "$rdma" != "no" ; then 3327 cat > $TMPC <<EOF 3328#include <rdma/rdma_cma.h> 3329int main(void) { return 0; } 3330EOF 3331 rdma_libs="-lrdmacm -libverbs -libumad" 3332 if compile_prog "" "$rdma_libs" ; then 3333 rdma="yes" 3334 else 3335 if test "$rdma" = "yes" ; then 3336 error_exit \ 3337 " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 3338 " Your options:" \ 3339 " (1) Fast: Install infiniband packages (devel) from your distro." \ 3340 " (2) Cleanest: Install libraries from www.openfabrics.org" \ 3341 " (3) Also: Install softiwarp if you don't have RDMA hardware" 3342 fi 3343 rdma="no" 3344 fi 3345fi 3346 3347########################################## 3348# PVRDMA detection 3349 3350cat > $TMPC <<EOF && 3351#include <sys/mman.h> 3352 3353int 3354main(void) 3355{ 3356 char buf = 0; 3357 void *addr = &buf; 3358 addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 3359 3360 return 0; 3361} 3362EOF 3363 3364if test "$rdma" = "yes" ; then 3365 case "$pvrdma" in 3366 "") 3367 if compile_prog "" ""; then 3368 pvrdma="yes" 3369 else 3370 pvrdma="no" 3371 fi 3372 ;; 3373 "yes") 3374 if ! compile_prog "" ""; then 3375 error_exit "PVRDMA is not supported since mremap is not implemented" 3376 fi 3377 pvrdma="yes" 3378 ;; 3379 "no") 3380 pvrdma="no" 3381 ;; 3382 esac 3383else 3384 if test "$pvrdma" = "yes" ; then 3385 error_exit "PVRDMA requires rdma suppport" 3386 fi 3387 pvrdma="no" 3388fi 3389 3390# Let's see if enhanced reg_mr is supported 3391if test "$pvrdma" = "yes" ; then 3392 3393cat > $TMPC <<EOF && 3394#include <infiniband/verbs.h> 3395 3396int 3397main(void) 3398{ 3399 struct ibv_mr *mr; 3400 struct ibv_pd *pd = NULL; 3401 size_t length = 10; 3402 uint64_t iova = 0; 3403 int access = 0; 3404 void *addr = NULL; 3405 3406 mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 3407 3408 ibv_dereg_mr(mr); 3409 3410 return 0; 3411} 3412EOF 3413 if ! compile_prog "" "-libverbs"; then 3414 QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 3415 fi 3416fi 3417 3418########################################## 3419# xfsctl() probe, used for file-posix.c 3420if test "$xfs" != "no" ; then 3421 cat > $TMPC << EOF 3422#include <stddef.h> /* NULL */ 3423#include <xfs/xfs.h> 3424int main(void) 3425{ 3426 xfsctl(NULL, 0, 0, NULL); 3427 return 0; 3428} 3429EOF 3430 if compile_prog "" "" ; then 3431 xfs="yes" 3432 else 3433 if test "$xfs" = "yes" ; then 3434 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 3435 fi 3436 xfs=no 3437 fi 3438fi 3439 3440########################################## 3441# vde libraries probe 3442if test "$vde" != "no" ; then 3443 vde_libs="-lvdeplug" 3444 cat > $TMPC << EOF 3445#include <libvdeplug.h> 3446int main(void) 3447{ 3448 struct vde_open_args a = {0, 0, 0}; 3449 char s[] = ""; 3450 vde_open(s, s, &a); 3451 return 0; 3452} 3453EOF 3454 if compile_prog "" "$vde_libs" ; then 3455 vde=yes 3456 else 3457 if test "$vde" = "yes" ; then 3458 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3459 fi 3460 vde=no 3461 fi 3462fi 3463 3464########################################## 3465# netmap support probe 3466# Apart from looking for netmap headers, we make sure that the host API version 3467# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 3468# a minor/major version number. Minor new features will be marked with values up 3469# to 15, and if something happens that requires a change to the backend we will 3470# move above 15, submit the backend fixes and modify this two bounds. 3471if test "$netmap" != "no" ; then 3472 cat > $TMPC << EOF 3473#include <inttypes.h> 3474#include <net/if.h> 3475#include <net/netmap.h> 3476#include <net/netmap_user.h> 3477#if (NETMAP_API < 11) || (NETMAP_API > 15) 3478#error 3479#endif 3480int main(void) { return 0; } 3481EOF 3482 if compile_prog "" "" ; then 3483 netmap=yes 3484 else 3485 if test "$netmap" = "yes" ; then 3486 feature_not_found "netmap" 3487 fi 3488 netmap=no 3489 fi 3490fi 3491 3492########################################## 3493# libcap-ng library probe 3494if test "$cap_ng" != "no" ; then 3495 cap_libs="-lcap-ng" 3496 cat > $TMPC << EOF 3497#include <cap-ng.h> 3498int main(void) 3499{ 3500 capng_capability_to_name(CAPNG_EFFECTIVE); 3501 return 0; 3502} 3503EOF 3504 if compile_prog "" "$cap_libs" ; then 3505 cap_ng=yes 3506 else 3507 if test "$cap_ng" = "yes" ; then 3508 feature_not_found "cap_ng" "Install libcap-ng devel" 3509 fi 3510 cap_ng=no 3511 fi 3512fi 3513 3514########################################## 3515# Sound support libraries probe 3516 3517audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3518for drv in $audio_drv_list; do 3519 case $drv in 3520 alsa | try-alsa) 3521 if $pkg_config alsa --exists; then 3522 alsa_libs=$($pkg_config alsa --libs) 3523 alsa_cflags=$($pkg_config alsa --cflags) 3524 alsa=yes 3525 if test "$drv" = "try-alsa"; then 3526 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') 3527 fi 3528 else 3529 if test "$drv" = "try-alsa"; then 3530 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') 3531 else 3532 error_exit "$drv check failed" \ 3533 "Make sure to have the $drv libs and headers installed." 3534 fi 3535 fi 3536 ;; 3537 3538 pa | try-pa) 3539 if $pkg_config libpulse --exists; then 3540 libpulse=yes 3541 pulse_libs=$($pkg_config libpulse --libs) 3542 pulse_cflags=$($pkg_config libpulse --cflags) 3543 if test "$drv" = "try-pa"; then 3544 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') 3545 fi 3546 else 3547 if test "$drv" = "try-pa"; then 3548 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') 3549 else 3550 error_exit "$drv check failed" \ 3551 "Make sure to have the $drv libs and headers installed." 3552 fi 3553 fi 3554 ;; 3555 3556 sdl) 3557 if test "$sdl" = "no"; then 3558 error_exit "sdl not found or disabled, can not use sdl audio driver" 3559 fi 3560 ;; 3561 3562 try-sdl) 3563 if test "$sdl" = "no"; then 3564 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') 3565 else 3566 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') 3567 fi 3568 ;; 3569 3570 coreaudio) 3571 coreaudio_libs="-framework CoreAudio" 3572 ;; 3573 3574 dsound) 3575 dsound_libs="-lole32 -ldxguid" 3576 audio_win_int="yes" 3577 ;; 3578 3579 oss) 3580 oss_libs="$oss_lib" 3581 ;; 3582 3583 jack | try-jack) 3584 if $pkg_config jack --exists; then 3585 libjack=yes 3586 jack_libs=$($pkg_config jack --libs) 3587 if test "$drv" = "try-jack"; then 3588 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') 3589 fi 3590 else 3591 if test "$drv" = "try-jack"; then 3592 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') 3593 else 3594 error_exit "$drv check failed" \ 3595 "Make sure to have the $drv libs and headers installed." 3596 fi 3597 fi 3598 ;; 3599 3600 *) 3601 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 3602 error_exit "Unknown driver '$drv' selected" \ 3603 "Possible drivers are: $audio_possible_drivers" 3604 } 3605 ;; 3606 esac 3607done 3608 3609########################################## 3610# BrlAPI probe 3611 3612if test "$brlapi" != "no" ; then 3613 brlapi_libs="-lbrlapi" 3614 cat > $TMPC << EOF 3615#include <brlapi.h> 3616#include <stddef.h> 3617int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 3618EOF 3619 if compile_prog "" "$brlapi_libs" ; then 3620 brlapi=yes 3621 else 3622 if test "$brlapi" = "yes" ; then 3623 feature_not_found "brlapi" "Install brlapi devel" 3624 fi 3625 brlapi=no 3626 fi 3627fi 3628 3629########################################## 3630# iconv probe 3631if test "$iconv" != "no" ; then 3632 cat > $TMPC << EOF 3633#include <iconv.h> 3634int main(void) { 3635 iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); 3636 return conv != (iconv_t) -1; 3637} 3638EOF 3639 iconv_prefix_list="/usr/local:/usr" 3640 iconv_lib_list=":-liconv" 3641 IFS=: 3642 for iconv_prefix in $iconv_prefix_list; do 3643 IFS=: 3644 iconv_cflags="-I$iconv_prefix/include" 3645 iconv_ldflags="-L$iconv_prefix/lib" 3646 for iconv_link in $iconv_lib_list; do 3647 unset IFS 3648 iconv_lib="$iconv_ldflags $iconv_link" 3649 echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log 3650 if compile_prog "$iconv_cflags" "$iconv_lib" ; then 3651 iconv_found=yes 3652 break 3653 fi 3654 done 3655 if test "$iconv_found" = yes ; then 3656 break 3657 fi 3658 done 3659 if test "$iconv_found" = "yes" ; then 3660 iconv=yes 3661 else 3662 if test "$iconv" = "yes" ; then 3663 feature_not_found "iconv" "Install iconv devel" 3664 fi 3665 iconv=no 3666 fi 3667fi 3668 3669########################################## 3670# curses probe 3671if test "$iconv" = "no" ; then 3672 # curses will need iconv 3673 curses=no 3674fi 3675if test "$curses" != "no" ; then 3676 if test "$mingw32" = "yes" ; then 3677 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 3678 curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3679 else 3680 curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 3681 curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3682 fi 3683 curses_found=no 3684 cat > $TMPC << EOF 3685#include <locale.h> 3686#include <curses.h> 3687#include <wchar.h> 3688#include <langinfo.h> 3689int main(void) { 3690 const char *codeset; 3691 wchar_t wch = L'w'; 3692 setlocale(LC_ALL, ""); 3693 resize_term(0, 0); 3694 addwstr(L"wide chars\n"); 3695 addnwstr(&wch, 1); 3696 add_wch(WACS_DEGREE); 3697 codeset = nl_langinfo(CODESET); 3698 return codeset != 0; 3699} 3700EOF 3701 IFS=: 3702 for curses_inc in $curses_inc_list; do 3703 # Make sure we get the wide character prototypes 3704 curses_inc="-DNCURSES_WIDECHAR $curses_inc" 3705 IFS=: 3706 for curses_lib in $curses_lib_list; do 3707 unset IFS 3708 if compile_prog "$curses_inc" "$curses_lib" ; then 3709 curses_found=yes 3710 break 3711 fi 3712 done 3713 if test "$curses_found" = yes ; then 3714 break 3715 fi 3716 done 3717 unset IFS 3718 if test "$curses_found" = "yes" ; then 3719 curses=yes 3720 else 3721 if test "$curses" = "yes" ; then 3722 feature_not_found "curses" "Install ncurses devel" 3723 fi 3724 curses=no 3725 fi 3726fi 3727 3728########################################## 3729# curl probe 3730if test "$curl" != "no" ; then 3731 if $pkg_config libcurl --exists; then 3732 curlconfig="$pkg_config libcurl" 3733 else 3734 curlconfig=curl-config 3735 fi 3736 cat > $TMPC << EOF 3737#include <curl/curl.h> 3738int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3739EOF 3740 curl_cflags=$($curlconfig --cflags 2>/dev/null) 3741 curl_libs=$($curlconfig --libs 2>/dev/null) 3742 if compile_prog "$curl_cflags" "$curl_libs" ; then 3743 curl=yes 3744 else 3745 if test "$curl" = "yes" ; then 3746 feature_not_found "curl" "Install libcurl devel" 3747 fi 3748 curl=no 3749 fi 3750fi # test "$curl" 3751 3752########################################## 3753# glib support probe 3754 3755glib_req_ver=2.48 3756glib_modules=gthread-2.0 3757if test "$modules" = yes; then 3758 glib_modules="$glib_modules gmodule-export-2.0" 3759fi 3760if test "$plugins" = yes; then 3761 glib_modules="$glib_modules gmodule-2.0" 3762fi 3763 3764# This workaround is required due to a bug in pkg-config file for glib as it 3765# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 3766 3767if test "$static" = yes && test "$mingw32" = yes; then 3768 QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" 3769fi 3770 3771for i in $glib_modules; do 3772 if $pkg_config --atleast-version=$glib_req_ver $i; then 3773 glib_cflags=$($pkg_config --cflags $i) 3774 glib_libs=$($pkg_config --libs $i) 3775 QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" 3776 LIBS="$glib_libs $LIBS" 3777 else 3778 error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3779 fi 3780done 3781 3782if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 3783 gio=yes 3784 gio_cflags=$($pkg_config --cflags gio-2.0) 3785 gio_libs=$($pkg_config --libs gio-2.0) 3786 gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 3787 if [ ! -x "$gdbus_codegen" ]; then 3788 gdbus_codegen= 3789 fi 3790else 3791 gio=no 3792fi 3793 3794if $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 3795 gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 3796 gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 3797fi 3798 3799# Sanity check that the current size_t matches the 3800# size that glib thinks it should be. This catches 3801# problems on multi-arch where people try to build 3802# 32-bit QEMU while pointing at 64-bit glib headers 3803cat > $TMPC <<EOF 3804#include <glib.h> 3805#include <unistd.h> 3806 3807#define QEMU_BUILD_BUG_ON(x) \ 3808 typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3809 3810int main(void) { 3811 QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3812 return 0; 3813} 3814EOF 3815 3816if ! compile_prog "$CFLAGS" "$LIBS" ; then 3817 error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3818 "You probably need to set PKG_CONFIG_LIBDIR"\ 3819 "to point to the right pkg-config files for your"\ 3820 "build target" 3821fi 3822 3823# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3824cat > $TMPC << EOF 3825#include <glib.h> 3826int main(void) { return 0; } 3827EOF 3828if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3829 if cc_has_warning_flag "-Wno-unknown-attributes"; then 3830 glib_cflags="-Wno-unknown-attributes $glib_cflags" 3831 QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS" 3832 fi 3833fi 3834 3835# Silence clang warnings triggered by glib < 2.57.2 3836cat > $TMPC << EOF 3837#include <glib.h> 3838typedef struct Foo { 3839 int i; 3840} Foo; 3841static void foo_free(Foo *f) 3842{ 3843 g_free(f); 3844} 3845G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 3846int main(void) { return 0; } 3847EOF 3848if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3849 if cc_has_warning_flag "-Wno-unused-function"; then 3850 glib_cflags="$glib_cflags -Wno-unused-function" 3851 CFLAGS="$CFLAGS -Wno-unused-function" 3852 fi 3853fi 3854 3855########################################## 3856# SHA command probe for modules 3857if test "$modules" = yes; then 3858 shacmd_probe="sha1sum sha1 shasum" 3859 for c in $shacmd_probe; do 3860 if has $c; then 3861 shacmd="$c" 3862 break 3863 fi 3864 done 3865 if test "$shacmd" = ""; then 3866 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3867 fi 3868fi 3869 3870########################################## 3871# libmpathpersist probe 3872 3873if test "$mpath" != "no" ; then 3874 # probe for the new API 3875 cat > $TMPC <<EOF 3876#include <libudev.h> 3877#include <mpath_persist.h> 3878unsigned mpath_mx_alloc_len = 1024; 3879int logsink; 3880static struct config *multipath_conf; 3881extern struct udev *udev; 3882extern struct config *get_multipath_config(void); 3883extern void put_multipath_config(struct config *conf); 3884struct udev *udev; 3885struct config *get_multipath_config(void) { return multipath_conf; } 3886void put_multipath_config(struct config *conf) { } 3887 3888int main(void) { 3889 udev = udev_new(); 3890 multipath_conf = mpath_lib_init(); 3891 return 0; 3892} 3893EOF 3894 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 3895 mpathpersist=yes 3896 mpathpersist_new_api=yes 3897 else 3898 # probe for the old API 3899 cat > $TMPC <<EOF 3900#include <libudev.h> 3901#include <mpath_persist.h> 3902unsigned mpath_mx_alloc_len = 1024; 3903int logsink; 3904int main(void) { 3905 struct udev *udev = udev_new(); 3906 mpath_lib_init(udev); 3907 return 0; 3908} 3909EOF 3910 if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 3911 mpathpersist=yes 3912 mpathpersist_new_api=no 3913 else 3914 mpathpersist=no 3915 fi 3916 fi 3917else 3918 mpathpersist=no 3919fi 3920 3921########################################## 3922# pthread probe 3923PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 3924 3925pthread=no 3926cat > $TMPC << EOF 3927#include <pthread.h> 3928static void *f(void *p) { return NULL; } 3929int main(void) { 3930 pthread_t thread; 3931 pthread_create(&thread, 0, f, 0); 3932 return 0; 3933} 3934EOF 3935if compile_prog "" "" ; then 3936 pthread=yes 3937else 3938 for pthread_lib in $PTHREADLIBS_LIST; do 3939 if compile_prog "" "$pthread_lib" ; then 3940 pthread=yes 3941 found=no 3942 for lib_entry in $LIBS; do 3943 if test "$lib_entry" = "$pthread_lib"; then 3944 found=yes 3945 break 3946 fi 3947 done 3948 if test "$found" = "no"; then 3949 LIBS="$pthread_lib $LIBS" 3950 fi 3951 PTHREAD_LIB="$pthread_lib" 3952 break 3953 fi 3954 done 3955fi 3956 3957if test "$mingw32" != yes && test "$pthread" = no; then 3958 error_exit "pthread check failed" \ 3959 "Make sure to have the pthread libs and headers installed." 3960fi 3961 3962# check for pthread_setname_np with thread id 3963pthread_setname_np_w_tid=no 3964cat > $TMPC << EOF 3965#include <pthread.h> 3966 3967static void *f(void *p) { return NULL; } 3968int main(void) 3969{ 3970 pthread_t thread; 3971 pthread_create(&thread, 0, f, 0); 3972 pthread_setname_np(thread, "QEMU"); 3973 return 0; 3974} 3975EOF 3976if compile_prog "" "$pthread_lib" ; then 3977 pthread_setname_np_w_tid=yes 3978fi 3979 3980# check for pthread_setname_np without thread id 3981pthread_setname_np_wo_tid=no 3982cat > $TMPC << EOF 3983#include <pthread.h> 3984 3985static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } 3986int main(void) 3987{ 3988 pthread_t thread; 3989 pthread_create(&thread, 0, f, 0); 3990 return 0; 3991} 3992EOF 3993if compile_prog "" "$pthread_lib" ; then 3994 pthread_setname_np_wo_tid=yes 3995fi 3996 3997########################################## 3998# rbd probe 3999if test "$rbd" != "no" ; then 4000 cat > $TMPC <<EOF 4001#include <stdio.h> 4002#include <rbd/librbd.h> 4003int main(void) { 4004 rados_t cluster; 4005 rados_create(&cluster, NULL); 4006 return 0; 4007} 4008EOF 4009 rbd_libs="-lrbd -lrados" 4010 if compile_prog "" "$rbd_libs" ; then 4011 rbd=yes 4012 else 4013 if test "$rbd" = "yes" ; then 4014 feature_not_found "rados block device" "Install librbd/ceph devel" 4015 fi 4016 rbd=no 4017 fi 4018fi 4019 4020########################################## 4021# libssh probe 4022if test "$libssh" != "no" ; then 4023 if $pkg_config --exists libssh; then 4024 libssh_cflags=$($pkg_config libssh --cflags) 4025 libssh_libs=$($pkg_config libssh --libs) 4026 libssh=yes 4027 else 4028 if test "$libssh" = "yes" ; then 4029 error_exit "libssh required for --enable-libssh" 4030 fi 4031 libssh=no 4032 fi 4033fi 4034 4035########################################## 4036# Check for libssh 0.8 4037# This is done like this instead of using the LIBSSH_VERSION_* and 4038# SSH_VERSION_* macros because some distributions in the past shipped 4039# snapshots of the future 0.8 from Git, and those snapshots did not 4040# have updated version numbers (still referring to 0.7.0). 4041 4042if test "$libssh" = "yes"; then 4043 cat > $TMPC <<EOF 4044#include <libssh/libssh.h> 4045int main(void) { return ssh_get_server_publickey(NULL, NULL); } 4046EOF 4047 if compile_prog "$libssh_cflags" "$libssh_libs"; then 4048 libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" 4049 fi 4050fi 4051 4052########################################## 4053# linux-aio probe 4054 4055if test "$linux_aio" != "no" ; then 4056 cat > $TMPC <<EOF 4057#include <libaio.h> 4058#include <sys/eventfd.h> 4059#include <stddef.h> 4060int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 4061EOF 4062 if compile_prog "" "-laio" ; then 4063 linux_aio=yes 4064 else 4065 if test "$linux_aio" = "yes" ; then 4066 feature_not_found "linux AIO" "Install libaio devel" 4067 fi 4068 linux_aio=no 4069 fi 4070fi 4071########################################## 4072# linux-io-uring probe 4073 4074if test "$linux_io_uring" != "no" ; then 4075 if $pkg_config liburing; then 4076 linux_io_uring_cflags=$($pkg_config --cflags liburing) 4077 linux_io_uring_libs=$($pkg_config --libs liburing) 4078 linux_io_uring=yes 4079 4080 # io_uring is used in libqemuutil.a where per-file -libs variables are not 4081 # seen by programs linking the archive. It's not ideal, but just add the 4082 # library dependency globally. 4083 LIBS="$linux_io_uring_libs $LIBS" 4084 else 4085 if test "$linux_io_uring" = "yes" ; then 4086 feature_not_found "linux io_uring" "Install liburing devel" 4087 fi 4088 linux_io_uring=no 4089 fi 4090fi 4091 4092########################################## 4093# TPM emulation is only on POSIX 4094 4095if test "$tpm" = ""; then 4096 if test "$mingw32" = "yes"; then 4097 tpm=no 4098 else 4099 tpm=yes 4100 fi 4101elif test "$tpm" = "yes"; then 4102 if test "$mingw32" = "yes" ; then 4103 error_exit "TPM emulation only available on POSIX systems" 4104 fi 4105fi 4106 4107########################################## 4108# attr probe 4109 4110libattr_libs= 4111if test "$attr" != "no" ; then 4112 cat > $TMPC <<EOF 4113#include <stdio.h> 4114#include <sys/types.h> 4115#ifdef CONFIG_LIBATTR 4116#include <attr/xattr.h> 4117#else 4118#include <sys/xattr.h> 4119#endif 4120int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 4121EOF 4122 if compile_prog "" "" ; then 4123 attr=yes 4124 # Older distros have <attr/xattr.h>, and need -lattr: 4125 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 4126 attr=yes 4127 libattr_libs="-lattr" 4128 LIBS="$libattr_libs $LIBS" 4129 libattr=yes 4130 else 4131 if test "$attr" = "yes" ; then 4132 feature_not_found "ATTR" "Install libc6 or libattr devel" 4133 fi 4134 attr=no 4135 fi 4136fi 4137 4138########################################## 4139# iovec probe 4140cat > $TMPC <<EOF 4141#include <sys/types.h> 4142#include <sys/uio.h> 4143#include <unistd.h> 4144int main(void) { return sizeof(struct iovec); } 4145EOF 4146iovec=no 4147if compile_prog "" "" ; then 4148 iovec=yes 4149fi 4150 4151########################################## 4152# preadv probe 4153cat > $TMPC <<EOF 4154#include <sys/types.h> 4155#include <sys/uio.h> 4156#include <unistd.h> 4157int main(void) { return preadv(0, 0, 0, 0); } 4158EOF 4159preadv=no 4160if compile_prog "" "" ; then 4161 preadv=yes 4162fi 4163 4164########################################## 4165# fdt probe 4166# fdt support is mandatory for at least some target architectures, 4167# so insist on it if we're building those system emulators. 4168fdt_required=no 4169for target in $target_list; do 4170 case $target in 4171 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu) 4172 fdt_required=yes 4173 ;; 4174 esac 4175done 4176 4177if test "$fdt_required" = "yes"; then 4178 if test "$fdt" = "no"; then 4179 error_exit "fdt disabled but some requested targets require it." \ 4180 "You can turn off fdt only if you also disable all the system emulation" \ 4181 "targets which need it (by specifying a cut down --target-list)." 4182 fi 4183 fdt=yes 4184elif test "$fdt" != "yes" ; then 4185 fdt=no 4186fi 4187 4188# fdt is only required when building softmmu targets 4189if test -z "$fdt" -a "$softmmu" != "yes" ; then 4190 fdt="no" 4191fi 4192 4193if test "$fdt" != "no" ; then 4194 fdt_libs="-lfdt" 4195 # explicitly check for libfdt_env.h as it is missing in some stable installs 4196 # and test for required functions to make sure we are on a version >= 1.4.2 4197 cat > $TMPC << EOF 4198#include <libfdt.h> 4199#include <libfdt_env.h> 4200int main(void) { fdt_check_full(NULL, 0); return 0; } 4201EOF 4202 if compile_prog "" "$fdt_libs" ; then 4203 # system DTC is good - use it 4204 fdt=system 4205 else 4206 # have GIT checkout, so activate dtc submodule 4207 if test -e "${source_path}/.git" ; then 4208 git_submodules="${git_submodules} dtc" 4209 fi 4210 if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then 4211 fdt=git 4212 mkdir -p dtc 4213 symlink "$source_path/dtc/Makefile" "dtc/Makefile" 4214 fdt_cflags="-I${source_path}/dtc/libfdt" 4215 fdt_ldflags="-Ldtc/libfdt" 4216 fdt_libs="$fdt_libs" 4217 elif test "$fdt" = "yes" ; then 4218 # Not a git build & no libfdt found, prompt for system install 4219 error_exit "DTC (libfdt) version >= 1.4.2 not present." \ 4220 "Please install the DTC (libfdt) devel package" 4221 else 4222 # don't have and don't want 4223 fdt_libs= 4224 fdt=no 4225 fi 4226 fi 4227fi 4228 4229########################################## 4230# opengl probe (for sdl2, gtk, milkymist-tmu2) 4231 4232gbm="no" 4233if $pkg_config gbm; then 4234 gbm_cflags="$($pkg_config --cflags gbm)" 4235 gbm_libs="$($pkg_config --libs gbm)" 4236 gbm="yes" 4237fi 4238 4239if test "$opengl" != "no" ; then 4240 opengl_pkgs="epoxy gbm" 4241 if $pkg_config $opengl_pkgs; then 4242 opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 4243 opengl_libs="$($pkg_config --libs $opengl_pkgs)" 4244 opengl=yes 4245 if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 4246 gtk_gl="yes" 4247 fi 4248 QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" 4249 else 4250 if test "$opengl" = "yes" ; then 4251 feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 4252 fi 4253 opengl_cflags="" 4254 opengl_libs="" 4255 opengl=no 4256 fi 4257fi 4258 4259if test "$opengl" = "yes"; then 4260 cat > $TMPC << EOF 4261#include <epoxy/egl.h> 4262#ifndef EGL_MESA_image_dma_buf_export 4263# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 4264#endif 4265int main(void) { return 0; } 4266EOF 4267 if compile_prog "" "" ; then 4268 opengl_dmabuf=yes 4269 fi 4270fi 4271 4272if test "$opengl" = "yes" && test "$have_x11" = "yes"; then 4273 for target in $target_list; do 4274 case $target in 4275 lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL 4276 need_x11=yes 4277 ;; 4278 esac 4279 done 4280fi 4281 4282########################################## 4283# libxml2 probe 4284if test "$libxml2" != "no" ; then 4285 if $pkg_config --exists libxml-2.0; then 4286 libxml2="yes" 4287 libxml2_cflags=$($pkg_config --cflags libxml-2.0) 4288 libxml2_libs=$($pkg_config --libs libxml-2.0) 4289 else 4290 if test "$libxml2" = "yes"; then 4291 feature_not_found "libxml2" "Install libxml2 devel" 4292 fi 4293 libxml2="no" 4294 fi 4295fi 4296 4297########################################## 4298# glusterfs probe 4299if test "$glusterfs" != "no" ; then 4300 if $pkg_config --atleast-version=3 glusterfs-api; then 4301 glusterfs="yes" 4302 glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 4303 glusterfs_libs=$($pkg_config --libs glusterfs-api) 4304 if $pkg_config --atleast-version=4 glusterfs-api; then 4305 glusterfs_xlator_opt="yes" 4306 fi 4307 if $pkg_config --atleast-version=5 glusterfs-api; then 4308 glusterfs_discard="yes" 4309 fi 4310 if $pkg_config --atleast-version=6 glusterfs-api; then 4311 glusterfs_fallocate="yes" 4312 glusterfs_zerofill="yes" 4313 fi 4314 cat > $TMPC << EOF 4315#include <glusterfs/api/glfs.h> 4316 4317int 4318main(void) 4319{ 4320 /* new glfs_ftruncate() passes two additional args */ 4321 return glfs_ftruncate(NULL, 0, NULL, NULL); 4322} 4323EOF 4324 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 4325 glusterfs_ftruncate_has_stat="yes" 4326 fi 4327 cat > $TMPC << EOF 4328#include <glusterfs/api/glfs.h> 4329 4330/* new glfs_io_cbk() passes two additional glfs_stat structs */ 4331static void 4332glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) 4333{} 4334 4335int 4336main(void) 4337{ 4338 glfs_io_cbk iocb = &glusterfs_iocb; 4339 iocb(NULL, 0 , NULL, NULL, NULL); 4340 return 0; 4341} 4342EOF 4343 if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 4344 glusterfs_iocb_has_stat="yes" 4345 fi 4346 else 4347 if test "$glusterfs" = "yes" ; then 4348 feature_not_found "GlusterFS backend support" \ 4349 "Install glusterfs-api devel >= 3" 4350 fi 4351 glusterfs="no" 4352 fi 4353fi 4354 4355# Check for inotify functions when we are building linux-user 4356# emulator. This is done because older glibc versions don't 4357# have syscall stubs for these implemented. In that case we 4358# don't provide them even if kernel supports them. 4359# 4360inotify=no 4361cat > $TMPC << EOF 4362#include <sys/inotify.h> 4363 4364int 4365main(void) 4366{ 4367 /* try to start inotify */ 4368 return inotify_init(); 4369} 4370EOF 4371if compile_prog "" "" ; then 4372 inotify=yes 4373fi 4374 4375inotify1=no 4376cat > $TMPC << EOF 4377#include <sys/inotify.h> 4378 4379int 4380main(void) 4381{ 4382 /* try to start inotify */ 4383 return inotify_init1(0); 4384} 4385EOF 4386if compile_prog "" "" ; then 4387 inotify1=yes 4388fi 4389 4390# check if pipe2 is there 4391pipe2=no 4392cat > $TMPC << EOF 4393#include <unistd.h> 4394#include <fcntl.h> 4395 4396int main(void) 4397{ 4398 int pipefd[2]; 4399 return pipe2(pipefd, O_CLOEXEC); 4400} 4401EOF 4402if compile_prog "" "" ; then 4403 pipe2=yes 4404fi 4405 4406# check if accept4 is there 4407accept4=no 4408cat > $TMPC << EOF 4409#include <sys/socket.h> 4410#include <stddef.h> 4411 4412int main(void) 4413{ 4414 accept4(0, NULL, NULL, SOCK_CLOEXEC); 4415 return 0; 4416} 4417EOF 4418if compile_prog "" "" ; then 4419 accept4=yes 4420fi 4421 4422# check if tee/splice is there. vmsplice was added same time. 4423splice=no 4424cat > $TMPC << EOF 4425#include <unistd.h> 4426#include <fcntl.h> 4427#include <limits.h> 4428 4429int main(void) 4430{ 4431 int len, fd = 0; 4432 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 4433 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 4434 return 0; 4435} 4436EOF 4437if compile_prog "" "" ; then 4438 splice=yes 4439fi 4440 4441########################################## 4442# libnuma probe 4443 4444if test "$numa" != "no" ; then 4445 cat > $TMPC << EOF 4446#include <numa.h> 4447int main(void) { return numa_available(); } 4448EOF 4449 4450 if compile_prog "" "-lnuma" ; then 4451 numa=yes 4452 numa_libs="-lnuma" 4453 else 4454 if test "$numa" = "yes" ; then 4455 feature_not_found "numa" "install numactl devel" 4456 fi 4457 numa=no 4458 fi 4459fi 4460 4461if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 4462 echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 4463 exit 1 4464fi 4465 4466# Even if malloc_trim() is available, these non-libc memory allocators 4467# do not support it. 4468if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then 4469 if test "$malloc_trim" = "yes" ; then 4470 echo "Disabling malloc_trim with non-libc memory allocator" 4471 fi 4472 malloc_trim="no" 4473fi 4474 4475####################################### 4476# malloc_trim 4477 4478if test "$malloc_trim" != "no" ; then 4479 cat > $TMPC << EOF 4480#include <malloc.h> 4481int main(void) { malloc_trim(0); return 0; } 4482EOF 4483 if compile_prog "" "" ; then 4484 malloc_trim="yes" 4485 else 4486 malloc_trim="no" 4487 fi 4488fi 4489 4490########################################## 4491# tcmalloc probe 4492 4493if test "$tcmalloc" = "yes" ; then 4494 cat > $TMPC << EOF 4495#include <stdlib.h> 4496int main(void) { 4497 void *tmp = malloc(1); 4498 if (tmp != NULL) { 4499 return 0; 4500 } 4501 return 1; 4502} 4503EOF 4504 4505 if compile_prog "" "-ltcmalloc" ; then 4506 LIBS="-ltcmalloc $LIBS" 4507 else 4508 feature_not_found "tcmalloc" "install gperftools devel" 4509 fi 4510fi 4511 4512########################################## 4513# jemalloc probe 4514 4515if test "$jemalloc" = "yes" ; then 4516 cat > $TMPC << EOF 4517#include <stdlib.h> 4518int main(void) { 4519 void *tmp = malloc(1); 4520 if (tmp != NULL) { 4521 return 0; 4522 } 4523 return 1; 4524} 4525EOF 4526 4527 if compile_prog "" "-ljemalloc" ; then 4528 LIBS="-ljemalloc $LIBS" 4529 else 4530 feature_not_found "jemalloc" "install jemalloc devel" 4531 fi 4532fi 4533 4534########################################## 4535# signalfd probe 4536signalfd="no" 4537cat > $TMPC << EOF 4538#include <unistd.h> 4539#include <sys/syscall.h> 4540#include <signal.h> 4541int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4542EOF 4543 4544if compile_prog "" "" ; then 4545 signalfd=yes 4546fi 4547 4548# check if optreset global is declared by <getopt.h> 4549optreset="no" 4550cat > $TMPC << EOF 4551#include <getopt.h> 4552int main(void) { return optreset; } 4553EOF 4554 4555if compile_prog "" "" ; then 4556 optreset=yes 4557fi 4558 4559# check if eventfd is supported 4560eventfd=no 4561cat > $TMPC << EOF 4562#include <sys/eventfd.h> 4563 4564int main(void) 4565{ 4566 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4567} 4568EOF 4569if compile_prog "" "" ; then 4570 eventfd=yes 4571fi 4572 4573# check if memfd is supported 4574memfd=no 4575cat > $TMPC << EOF 4576#include <sys/mman.h> 4577 4578int main(void) 4579{ 4580 return memfd_create("foo", MFD_ALLOW_SEALING); 4581} 4582EOF 4583if compile_prog "" "" ; then 4584 memfd=yes 4585fi 4586 4587# check for usbfs 4588have_usbfs=no 4589if test "$linux_user" = "yes"; then 4590 cat > $TMPC << EOF 4591#include <linux/usbdevice_fs.h> 4592 4593#ifndef USBDEVFS_GET_CAPABILITIES 4594#error "USBDEVFS_GET_CAPABILITIES undefined" 4595#endif 4596 4597#ifndef USBDEVFS_DISCONNECT_CLAIM 4598#error "USBDEVFS_DISCONNECT_CLAIM undefined" 4599#endif 4600 4601int main(void) 4602{ 4603 return 0; 4604} 4605EOF 4606 if compile_prog "" ""; then 4607 have_usbfs=yes 4608 fi 4609fi 4610 4611# check for fallocate 4612fallocate=no 4613cat > $TMPC << EOF 4614#include <fcntl.h> 4615 4616int main(void) 4617{ 4618 fallocate(0, 0, 0, 0); 4619 return 0; 4620} 4621EOF 4622if compile_prog "" "" ; then 4623 fallocate=yes 4624fi 4625 4626# check for fallocate hole punching 4627fallocate_punch_hole=no 4628cat > $TMPC << EOF 4629#include <fcntl.h> 4630#include <linux/falloc.h> 4631 4632int main(void) 4633{ 4634 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 4635 return 0; 4636} 4637EOF 4638if compile_prog "" "" ; then 4639 fallocate_punch_hole=yes 4640fi 4641 4642# check that fallocate supports range zeroing inside the file 4643fallocate_zero_range=no 4644cat > $TMPC << EOF 4645#include <fcntl.h> 4646#include <linux/falloc.h> 4647 4648int main(void) 4649{ 4650 fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4651 return 0; 4652} 4653EOF 4654if compile_prog "" "" ; then 4655 fallocate_zero_range=yes 4656fi 4657 4658# check for posix_fallocate 4659posix_fallocate=no 4660cat > $TMPC << EOF 4661#include <fcntl.h> 4662 4663int main(void) 4664{ 4665 posix_fallocate(0, 0, 0); 4666 return 0; 4667} 4668EOF 4669if compile_prog "" "" ; then 4670 posix_fallocate=yes 4671fi 4672 4673# check for sync_file_range 4674sync_file_range=no 4675cat > $TMPC << EOF 4676#include <fcntl.h> 4677 4678int main(void) 4679{ 4680 sync_file_range(0, 0, 0, 0); 4681 return 0; 4682} 4683EOF 4684if compile_prog "" "" ; then 4685 sync_file_range=yes 4686fi 4687 4688# check for linux/fiemap.h and FS_IOC_FIEMAP 4689fiemap=no 4690cat > $TMPC << EOF 4691#include <sys/ioctl.h> 4692#include <linux/fs.h> 4693#include <linux/fiemap.h> 4694 4695int main(void) 4696{ 4697 ioctl(0, FS_IOC_FIEMAP, 0); 4698 return 0; 4699} 4700EOF 4701if compile_prog "" "" ; then 4702 fiemap=yes 4703fi 4704 4705# check for dup3 4706dup3=no 4707cat > $TMPC << EOF 4708#include <unistd.h> 4709 4710int main(void) 4711{ 4712 dup3(0, 0, 0); 4713 return 0; 4714} 4715EOF 4716if compile_prog "" "" ; then 4717 dup3=yes 4718fi 4719 4720# check for ppoll support 4721ppoll=no 4722cat > $TMPC << EOF 4723#include <poll.h> 4724 4725int main(void) 4726{ 4727 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 4728 ppoll(&pfd, 1, 0, 0); 4729 return 0; 4730} 4731EOF 4732if compile_prog "" "" ; then 4733 ppoll=yes 4734fi 4735 4736# check for prctl(PR_SET_TIMERSLACK , ... ) support 4737prctl_pr_set_timerslack=no 4738cat > $TMPC << EOF 4739#include <sys/prctl.h> 4740 4741int main(void) 4742{ 4743 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4744 return 0; 4745} 4746EOF 4747if compile_prog "" "" ; then 4748 prctl_pr_set_timerslack=yes 4749fi 4750 4751# check for epoll support 4752epoll=no 4753cat > $TMPC << EOF 4754#include <sys/epoll.h> 4755 4756int main(void) 4757{ 4758 epoll_create(0); 4759 return 0; 4760} 4761EOF 4762if compile_prog "" "" ; then 4763 epoll=yes 4764fi 4765 4766# epoll_create1 is a later addition 4767# so we must check separately for its presence 4768epoll_create1=no 4769cat > $TMPC << EOF 4770#include <sys/epoll.h> 4771 4772int main(void) 4773{ 4774 /* Note that we use epoll_create1 as a value, not as 4775 * a function being called. This is necessary so that on 4776 * old SPARC glibc versions where the function was present in 4777 * the library but not declared in the header file we will 4778 * fail the configure check. (Otherwise we will get a compiler 4779 * warning but not an error, and will proceed to fail the 4780 * qemu compile where we compile with -Werror.) 4781 */ 4782 return (int)(uintptr_t)&epoll_create1; 4783} 4784EOF 4785if compile_prog "" "" ; then 4786 epoll_create1=yes 4787fi 4788 4789# check for sendfile support 4790sendfile=no 4791cat > $TMPC << EOF 4792#include <sys/sendfile.h> 4793 4794int main(void) 4795{ 4796 return sendfile(0, 0, 0, 0); 4797} 4798EOF 4799if compile_prog "" "" ; then 4800 sendfile=yes 4801fi 4802 4803# check for timerfd support (glibc 2.8 and newer) 4804timerfd=no 4805cat > $TMPC << EOF 4806#include <sys/timerfd.h> 4807 4808int main(void) 4809{ 4810 return(timerfd_create(CLOCK_REALTIME, 0)); 4811} 4812EOF 4813if compile_prog "" "" ; then 4814 timerfd=yes 4815fi 4816 4817# check for setns and unshare support 4818setns=no 4819cat > $TMPC << EOF 4820#include <sched.h> 4821 4822int main(void) 4823{ 4824 int ret; 4825 ret = setns(0, 0); 4826 ret = unshare(0); 4827 return ret; 4828} 4829EOF 4830if compile_prog "" "" ; then 4831 setns=yes 4832fi 4833 4834# clock_adjtime probe 4835clock_adjtime=no 4836cat > $TMPC <<EOF 4837#include <time.h> 4838 4839int main(void) 4840{ 4841 return clock_adjtime(0, 0); 4842} 4843EOF 4844clock_adjtime=no 4845if compile_prog "" "" ; then 4846 clock_adjtime=yes 4847fi 4848 4849# syncfs probe 4850syncfs=no 4851cat > $TMPC <<EOF 4852#include <unistd.h> 4853 4854int main(void) 4855{ 4856 return syncfs(0); 4857} 4858EOF 4859syncfs=no 4860if compile_prog "" "" ; then 4861 syncfs=yes 4862fi 4863 4864# check for kcov support (kernel must be 4.4+, compiled with certain options) 4865kcov=no 4866if check_include sys/kcov.h ; then 4867 kcov=yes 4868fi 4869 4870# check for btrfs filesystem support (kernel must be 3.9+) 4871btrfs=no 4872if check_include linux/btrfs.h ; then 4873 btrfs=yes 4874fi 4875 4876# If we're making warnings fatal, apply this to Sphinx runs as well 4877sphinx_werror="" 4878if test "$werror" = "yes"; then 4879 sphinx_werror="-W" 4880fi 4881 4882# Check we have a new enough version of sphinx-build 4883has_sphinx_build() { 4884 # This is a bit awkward but works: create a trivial document and 4885 # try to run it with our configuration file (which enforces a 4886 # version requirement). This will fail if either 4887 # sphinx-build doesn't exist at all or if it is too old. 4888 mkdir -p "$TMPDIR1/sphinx" 4889 touch "$TMPDIR1/sphinx/index.rst" 4890 "$sphinx_build" $sphinx_werror -c "$source_path/docs" \ 4891 -b html "$TMPDIR1/sphinx" \ 4892 "$TMPDIR1/sphinx/out" >> config.log 2>&1 4893} 4894 4895# Check if tools are available to build documentation. 4896if test "$docs" != "no" ; then 4897 if has_sphinx_build; then 4898 sphinx_ok=yes 4899 else 4900 sphinx_ok=no 4901 fi 4902 if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then 4903 docs=yes 4904 else 4905 if test "$docs" = "yes" ; then 4906 if has $sphinx_build && test "$sphinx_ok" != "yes"; then 4907 echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 4908 fi 4909 feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a Python 3 version of python-sphinx" 4910 fi 4911 docs=no 4912 fi 4913fi 4914 4915# Search for bswap_32 function 4916byteswap_h=no 4917cat > $TMPC << EOF 4918#include <byteswap.h> 4919int main(void) { return bswap_32(0); } 4920EOF 4921if compile_prog "" "" ; then 4922 byteswap_h=yes 4923fi 4924 4925# Search for bswap32 function 4926bswap_h=no 4927cat > $TMPC << EOF 4928#include <sys/endian.h> 4929#include <sys/types.h> 4930#include <machine/bswap.h> 4931int main(void) { return bswap32(0); } 4932EOF 4933if compile_prog "" "" ; then 4934 bswap_h=yes 4935fi 4936 4937########################################## 4938# Do we have libiscsi >= 1.9.0 4939if test "$libiscsi" != "no" ; then 4940 if $pkg_config --atleast-version=1.9.0 libiscsi; then 4941 libiscsi="yes" 4942 libiscsi_cflags=$($pkg_config --cflags libiscsi) 4943 libiscsi_libs=$($pkg_config --libs libiscsi) 4944 else 4945 if test "$libiscsi" = "yes" ; then 4946 feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 4947 fi 4948 libiscsi="no" 4949 fi 4950fi 4951 4952########################################## 4953# Do we need librt 4954# uClibc provides 2 versions of clock_gettime(), one with realtime 4955# support and one without. This means that the clock_gettime() don't 4956# need -lrt. We still need it for timer_create() so we check for this 4957# function in addition. 4958cat > $TMPC <<EOF 4959#include <signal.h> 4960#include <time.h> 4961int main(void) { 4962 timer_create(CLOCK_REALTIME, NULL, NULL); 4963 return clock_gettime(CLOCK_REALTIME, NULL); 4964} 4965EOF 4966 4967if compile_prog "" "" ; then 4968 : 4969# we need pthread for static linking. use previous pthread test result 4970elif compile_prog "" "$pthread_lib -lrt" ; then 4971 LIBS="$LIBS -lrt" 4972fi 4973 4974# Check whether we need to link libutil for openpty() 4975cat > $TMPC << EOF 4976extern int openpty(int *am, int *as, char *name, void *termp, void *winp); 4977int main(void) { return openpty(0, 0, 0, 0, 0); } 4978EOF 4979 4980have_openpty="no" 4981if compile_prog "" "" ; then 4982 have_openpty="yes" 4983else 4984 if compile_prog "" "-lutil" ; then 4985 libs_tools="-lutil $libs_tools" 4986 have_openpty="yes" 4987 fi 4988fi 4989 4990########################################## 4991# spice probe 4992if test "$spice" != "no" ; then 4993 cat > $TMPC << EOF 4994#include <spice.h> 4995int main(void) { spice_server_new(); return 0; } 4996EOF 4997 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 4998 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 4999 if $pkg_config --atleast-version=0.12.5 spice-server && \ 5000 $pkg_config --atleast-version=0.12.3 spice-protocol && \ 5001 compile_prog "$spice_cflags" "$spice_libs" ; then 5002 spice="yes" 5003 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 5004 else 5005 if test "$spice" = "yes" ; then 5006 feature_not_found "spice" \ 5007 "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" 5008 fi 5009 spice="no" 5010 fi 5011fi 5012 5013# check for smartcard support 5014if test "$smartcard" != "no"; then 5015 if $pkg_config --atleast-version=2.5.1 libcacard; then 5016 libcacard_cflags=$($pkg_config --cflags libcacard) 5017 libcacard_libs=$($pkg_config --libs libcacard) 5018 smartcard="yes" 5019 else 5020 if test "$smartcard" = "yes"; then 5021 feature_not_found "smartcard" "Install libcacard devel" 5022 fi 5023 smartcard="no" 5024 fi 5025fi 5026 5027# check for libusb 5028if test "$libusb" != "no" ; then 5029 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 5030 libusb="yes" 5031 libusb_cflags=$($pkg_config --cflags libusb-1.0) 5032 libusb_libs=$($pkg_config --libs libusb-1.0) 5033 else 5034 if test "$libusb" = "yes"; then 5035 feature_not_found "libusb" "Install libusb devel >= 1.0.13" 5036 fi 5037 libusb="no" 5038 fi 5039fi 5040 5041# check for usbredirparser for usb network redirection support 5042if test "$usb_redir" != "no" ; then 5043 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 5044 usb_redir="yes" 5045 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 5046 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 5047 else 5048 if test "$usb_redir" = "yes"; then 5049 feature_not_found "usb-redir" "Install usbredir devel" 5050 fi 5051 usb_redir="no" 5052 fi 5053fi 5054 5055########################################## 5056# check if we have VSS SDK headers for win 5057 5058if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 5059 test "$vss_win32_sdk" != "no" ; then 5060 case "$vss_win32_sdk" in 5061 "") vss_win32_include="-isystem $source_path" ;; 5062 *\ *) # The SDK is installed in "Program Files" by default, but we cannot 5063 # handle path with spaces. So we symlink the headers into ".sdk/vss". 5064 vss_win32_include="-isystem $source_path/.sdk/vss" 5065 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 5066 ;; 5067 *) vss_win32_include="-isystem $vss_win32_sdk" 5068 esac 5069 cat > $TMPC << EOF 5070#define __MIDL_user_allocate_free_DEFINED__ 5071#include <inc/win2003/vss.h> 5072int main(void) { return VSS_CTX_BACKUP; } 5073EOF 5074 if compile_prog "$vss_win32_include" "" ; then 5075 guest_agent_with_vss="yes" 5076 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 5077 libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 5078 qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 5079 else 5080 if test "$vss_win32_sdk" != "" ; then 5081 echo "ERROR: Please download and install Microsoft VSS SDK:" 5082 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 5083 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 5084 echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 5085 echo "ERROR: The headers are extracted in the directory \`inc'." 5086 feature_not_found "VSS support" 5087 fi 5088 guest_agent_with_vss="no" 5089 fi 5090fi 5091 5092########################################## 5093# lookup Windows platform SDK (if not specified) 5094# The SDK is needed only to build .tlb (type library) file of guest agent 5095# VSS provider from the source. It is usually unnecessary because the 5096# pre-compiled .tlb file is included. 5097 5098if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 5099 test "$guest_agent_with_vss" = "yes" ; then 5100 if test -z "$win_sdk"; then 5101 programfiles="$PROGRAMFILES" 5102 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 5103 if test -n "$programfiles"; then 5104 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 5105 else 5106 feature_not_found "Windows SDK" 5107 fi 5108 elif test "$win_sdk" = "no"; then 5109 win_sdk="" 5110 fi 5111fi 5112 5113########################################## 5114# check if mingw environment provides a recent ntddscsi.h 5115if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 5116 cat > $TMPC << EOF 5117#include <windows.h> 5118#include <ntddscsi.h> 5119int main(void) { 5120#if !defined(IOCTL_SCSI_GET_ADDRESS) 5121#error Missing required ioctl definitions 5122#endif 5123 SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 5124 return addr.Lun; 5125} 5126EOF 5127 if compile_prog "" "" ; then 5128 guest_agent_ntddscsi=yes 5129 libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 5130 fi 5131fi 5132 5133########################################## 5134# virgl renderer probe 5135 5136if test "$virglrenderer" != "no" ; then 5137 cat > $TMPC << EOF 5138#include <virglrenderer.h> 5139int main(void) { virgl_renderer_poll(); return 0; } 5140EOF 5141 virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 5142 virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 5143 virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 5144 if $pkg_config virglrenderer >/dev/null 2>&1 && \ 5145 compile_prog "$virgl_cflags" "$virgl_libs" ; then 5146 virglrenderer="yes" 5147 else 5148 if test "$virglrenderer" = "yes" ; then 5149 feature_not_found "virglrenderer" 5150 fi 5151 virglrenderer="no" 5152 fi 5153fi 5154 5155########################################## 5156# capstone 5157 5158case "$capstone" in 5159 "" | yes) 5160 if $pkg_config capstone; then 5161 capstone=system 5162 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 5163 capstone=git 5164 elif test -e "${source_path}/capstone/Makefile" ; then 5165 capstone=internal 5166 elif test -z "$capstone" ; then 5167 capstone=no 5168 else 5169 feature_not_found "capstone" "Install capstone devel or git submodule" 5170 fi 5171 ;; 5172 5173 system) 5174 if ! $pkg_config capstone; then 5175 feature_not_found "capstone" "Install capstone devel" 5176 fi 5177 ;; 5178esac 5179 5180case "$capstone" in 5181 git | internal) 5182 if test "$capstone" = git; then 5183 git_submodules="${git_submodules} capstone" 5184 fi 5185 mkdir -p capstone 5186 QEMU_CFLAGS="$QEMU_CFLAGS -I${source_path}/capstone/include" 5187 if test "$mingw32" = "yes"; then 5188 LIBCAPSTONE=capstone.lib 5189 else 5190 LIBCAPSTONE=libcapstone.a 5191 fi 5192 capstone_libs="-Lcapstone -lcapstone" 5193 capstone_cflags="-I${source_path}/capstone/include" 5194 ;; 5195 5196 system) 5197 capstone_libs="$($pkg_config --libs capstone)" 5198 capstone_cflags="$($pkg_config --cflags capstone)" 5199 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" 5200 ;; 5201 5202 no) 5203 ;; 5204 *) 5205 error_exit "Unknown state for capstone: $capstone" 5206 ;; 5207esac 5208 5209########################################## 5210# check if we have fdatasync 5211 5212fdatasync=no 5213cat > $TMPC << EOF 5214#include <unistd.h> 5215int main(void) { 5216#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 5217return fdatasync(0); 5218#else 5219#error Not supported 5220#endif 5221} 5222EOF 5223if compile_prog "" "" ; then 5224 fdatasync=yes 5225fi 5226 5227########################################## 5228# check if we have madvise 5229 5230madvise=no 5231cat > $TMPC << EOF 5232#include <sys/types.h> 5233#include <sys/mman.h> 5234#include <stddef.h> 5235int main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 5236EOF 5237if compile_prog "" "" ; then 5238 madvise=yes 5239fi 5240 5241########################################## 5242# check if we have posix_madvise 5243 5244posix_madvise=no 5245cat > $TMPC << EOF 5246#include <sys/mman.h> 5247#include <stddef.h> 5248int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 5249EOF 5250if compile_prog "" "" ; then 5251 posix_madvise=yes 5252fi 5253 5254########################################## 5255# check if we have posix_memalign() 5256 5257posix_memalign=no 5258cat > $TMPC << EOF 5259#include <stdlib.h> 5260int main(void) { 5261 void *p; 5262 return posix_memalign(&p, 8, 8); 5263} 5264EOF 5265if compile_prog "" "" ; then 5266 posix_memalign=yes 5267fi 5268 5269########################################## 5270# check if we have posix_syslog 5271 5272posix_syslog=no 5273cat > $TMPC << EOF 5274#include <syslog.h> 5275int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 5276EOF 5277if compile_prog "" "" ; then 5278 posix_syslog=yes 5279fi 5280 5281########################################## 5282# check if we have sem_timedwait 5283 5284sem_timedwait=no 5285cat > $TMPC << EOF 5286#include <semaphore.h> 5287int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } 5288EOF 5289if compile_prog "" "" ; then 5290 sem_timedwait=yes 5291fi 5292 5293########################################## 5294# check if we have strchrnul 5295 5296strchrnul=no 5297cat > $TMPC << EOF 5298#include <string.h> 5299int main(void); 5300// Use a haystack that the compiler shouldn't be able to constant fold 5301char *haystack = (char*)&main; 5302int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 5303EOF 5304if compile_prog "" "" ; then 5305 strchrnul=yes 5306fi 5307 5308######################################### 5309# check if we have st_atim 5310 5311st_atim=no 5312cat > $TMPC << EOF 5313#include <sys/stat.h> 5314#include <stddef.h> 5315int main(void) { return offsetof(struct stat, st_atim); } 5316EOF 5317if compile_prog "" "" ; then 5318 st_atim=yes 5319fi 5320 5321########################################## 5322# check if trace backend exists 5323 5324$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 5325if test "$?" -ne 0 ; then 5326 error_exit "invalid trace backends" \ 5327 "Please choose supported trace backends." 5328fi 5329 5330########################################## 5331# For 'ust' backend, test if ust headers are present 5332if have_backend "ust"; then 5333 cat > $TMPC << EOF 5334#include <lttng/tracepoint.h> 5335int main(void) { return 0; } 5336EOF 5337 if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 5338 if $pkg_config lttng-ust --exists; then 5339 lttng_ust_libs=$($pkg_config --libs lttng-ust) 5340 else 5341 lttng_ust_libs="-llttng-ust -ldl" 5342 fi 5343 if $pkg_config liburcu-bp --exists; then 5344 urcu_bp_libs=$($pkg_config --libs liburcu-bp) 5345 else 5346 urcu_bp_libs="-lurcu-bp" 5347 fi 5348 5349 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 5350 else 5351 error_exit "Trace backend 'ust' missing lttng-ust header files" 5352 fi 5353fi 5354 5355########################################## 5356# For 'dtrace' backend, test if 'dtrace' command is present 5357if have_backend "dtrace"; then 5358 if ! has 'dtrace' ; then 5359 error_exit "dtrace command is not found in PATH $PATH" 5360 fi 5361 trace_backend_stap="no" 5362 if has 'stap' ; then 5363 trace_backend_stap="yes" 5364 fi 5365fi 5366 5367########################################## 5368# check and set a backend for coroutine 5369 5370# We prefer ucontext, but it's not always possible. The fallback 5371# is sigcontext. On Windows the only valid backend is the Windows 5372# specific one. 5373 5374ucontext_works=no 5375if test "$darwin" != "yes"; then 5376 cat > $TMPC << EOF 5377#include <ucontext.h> 5378#ifdef __stub_makecontext 5379#error Ignoring glibc stub makecontext which will always fail 5380#endif 5381int main(void) { makecontext(0, 0, 0); return 0; } 5382EOF 5383 if compile_prog "" "" ; then 5384 ucontext_works=yes 5385 fi 5386fi 5387 5388if test "$coroutine" = ""; then 5389 if test "$mingw32" = "yes"; then 5390 coroutine=win32 5391 elif test "$ucontext_works" = "yes"; then 5392 coroutine=ucontext 5393 else 5394 coroutine=sigaltstack 5395 fi 5396else 5397 case $coroutine in 5398 windows) 5399 if test "$mingw32" != "yes"; then 5400 error_exit "'windows' coroutine backend only valid for Windows" 5401 fi 5402 # Unfortunately the user visible backend name doesn't match the 5403 # coroutine-*.c filename for this case, so we have to adjust it here. 5404 coroutine=win32 5405 ;; 5406 ucontext) 5407 if test "$ucontext_works" != "yes"; then 5408 feature_not_found "ucontext" 5409 fi 5410 ;; 5411 sigaltstack) 5412 if test "$mingw32" = "yes"; then 5413 error_exit "only the 'windows' coroutine backend is valid for Windows" 5414 fi 5415 ;; 5416 *) 5417 error_exit "unknown coroutine backend $coroutine" 5418 ;; 5419 esac 5420fi 5421 5422if test "$coroutine_pool" = ""; then 5423 coroutine_pool=yes 5424fi 5425 5426if test "$debug_stack_usage" = "yes"; then 5427 if test "$coroutine_pool" = "yes"; then 5428 echo "WARN: disabling coroutine pool for stack usage debugging" 5429 coroutine_pool=no 5430 fi 5431fi 5432 5433################################################## 5434# SafeStack 5435 5436 5437if test "$safe_stack" = "yes"; then 5438cat > $TMPC << EOF 5439int main(int argc, char *argv[]) 5440{ 5441#if ! __has_feature(safe_stack) 5442#error SafeStack Disabled 5443#endif 5444 return 0; 5445} 5446EOF 5447 flag="-fsanitize=safe-stack" 5448 # Check that safe-stack is supported and enabled. 5449 if compile_prog "-Werror $flag" "$flag"; then 5450 # Flag needed both at compilation and at linking 5451 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 5452 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 5453 else 5454 error_exit "SafeStack not supported by your compiler" 5455 fi 5456 if test "$coroutine" != "ucontext"; then 5457 error_exit "SafeStack is only supported by the coroutine backend ucontext" 5458 fi 5459else 5460cat > $TMPC << EOF 5461int main(int argc, char *argv[]) 5462{ 5463#if defined(__has_feature) 5464#if __has_feature(safe_stack) 5465#error SafeStack Enabled 5466#endif 5467#endif 5468 return 0; 5469} 5470EOF 5471if test "$safe_stack" = "no"; then 5472 # Make sure that safe-stack is disabled 5473 if ! compile_prog "-Werror" ""; then 5474 # SafeStack was already enabled, try to explicitly remove the feature 5475 flag="-fno-sanitize=safe-stack" 5476 if ! compile_prog "-Werror $flag" "$flag"; then 5477 error_exit "Configure cannot disable SafeStack" 5478 fi 5479 QEMU_CFLAGS="$QEMU_CFLAGS $flag" 5480 QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 5481 fi 5482else # "$safe_stack" = "" 5483 # Set safe_stack to yes or no based on pre-existing flags 5484 if compile_prog "-Werror" ""; then 5485 safe_stack="no" 5486 else 5487 safe_stack="yes" 5488 if test "$coroutine" != "ucontext"; then 5489 error_exit "SafeStack is only supported by the coroutine backend ucontext" 5490 fi 5491 fi 5492fi 5493fi 5494 5495########################################## 5496# check if we have open_by_handle_at 5497 5498open_by_handle_at=no 5499cat > $TMPC << EOF 5500#include <fcntl.h> 5501#if !defined(AT_EMPTY_PATH) 5502# error missing definition 5503#else 5504int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 5505#endif 5506EOF 5507if compile_prog "" "" ; then 5508 open_by_handle_at=yes 5509fi 5510 5511######################################## 5512# check if we have linux/magic.h 5513 5514linux_magic_h=no 5515cat > $TMPC << EOF 5516#include <linux/magic.h> 5517int main(void) { 5518 return 0; 5519} 5520EOF 5521if compile_prog "" "" ; then 5522 linux_magic_h=yes 5523fi 5524 5525######################################## 5526# check if we have valgrind/valgrind.h 5527 5528valgrind_h=no 5529cat > $TMPC << EOF 5530#include <valgrind/valgrind.h> 5531int main(void) { 5532 return 0; 5533} 5534EOF 5535if compile_prog "" "" ; then 5536 valgrind_h=yes 5537fi 5538 5539######################################## 5540# check if environ is declared 5541 5542has_environ=no 5543cat > $TMPC << EOF 5544#include <unistd.h> 5545int main(void) { 5546 environ = 0; 5547 return 0; 5548} 5549EOF 5550if compile_prog "" "" ; then 5551 has_environ=yes 5552fi 5553 5554######################################## 5555# check if cpuid.h is usable. 5556 5557cat > $TMPC << EOF 5558#include <cpuid.h> 5559int main(void) { 5560 unsigned a, b, c, d; 5561 int max = __get_cpuid_max(0, 0); 5562 5563 if (max >= 1) { 5564 __cpuid(1, a, b, c, d); 5565 } 5566 5567 if (max >= 7) { 5568 __cpuid_count(7, 0, a, b, c, d); 5569 } 5570 5571 return 0; 5572} 5573EOF 5574if compile_prog "" "" ; then 5575 cpuid_h=yes 5576fi 5577 5578########################################## 5579# avx2 optimization requirement check 5580# 5581# There is no point enabling this if cpuid.h is not usable, 5582# since we won't be able to select the new routines. 5583 5584if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 5585 cat > $TMPC << EOF 5586#pragma GCC push_options 5587#pragma GCC target("avx2") 5588#include <cpuid.h> 5589#include <immintrin.h> 5590static int bar(void *a) { 5591 __m256i x = *(__m256i *)a; 5592 return _mm256_testz_si256(x, x); 5593} 5594int main(int argc, char *argv[]) { return bar(argv[0]); } 5595EOF 5596 if compile_object "" ; then 5597 avx2_opt="yes" 5598 else 5599 avx2_opt="no" 5600 fi 5601fi 5602 5603########################################## 5604# avx512f optimization requirement check 5605# 5606# There is no point enabling this if cpuid.h is not usable, 5607# since we won't be able to select the new routines. 5608# by default, it is turned off. 5609# if user explicitly want to enable it, check environment 5610 5611if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 5612 cat > $TMPC << EOF 5613#pragma GCC push_options 5614#pragma GCC target("avx512f") 5615#include <cpuid.h> 5616#include <immintrin.h> 5617static int bar(void *a) { 5618 __m512i x = *(__m512i *)a; 5619 return _mm512_test_epi64_mask(x, x); 5620} 5621int main(int argc, char *argv[]) 5622{ 5623 return bar(argv[0]); 5624} 5625EOF 5626 if ! compile_object "" ; then 5627 avx512f_opt="no" 5628 fi 5629else 5630 avx512f_opt="no" 5631fi 5632 5633######################################## 5634# check if __[u]int128_t is usable. 5635 5636int128=no 5637cat > $TMPC << EOF 5638__int128_t a; 5639__uint128_t b; 5640int main (void) { 5641 a = a + b; 5642 b = a * b; 5643 a = a * a; 5644 return 0; 5645} 5646EOF 5647if compile_prog "" "" ; then 5648 int128=yes 5649fi 5650 5651######################################### 5652# See if 128-bit atomic operations are supported. 5653 5654atomic128=no 5655if test "$int128" = "yes"; then 5656 cat > $TMPC << EOF 5657int main(void) 5658{ 5659 unsigned __int128 x = 0, y = 0; 5660 y = __atomic_load_16(&x, 0); 5661 __atomic_store_16(&x, y, 0); 5662 __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 5663 return 0; 5664} 5665EOF 5666 if compile_prog "" "" ; then 5667 atomic128=yes 5668 fi 5669fi 5670 5671cmpxchg128=no 5672if test "$int128" = yes && test "$atomic128" = no; then 5673 cat > $TMPC << EOF 5674int main(void) 5675{ 5676 unsigned __int128 x = 0, y = 0; 5677 __sync_val_compare_and_swap_16(&x, y, x); 5678 return 0; 5679} 5680EOF 5681 if compile_prog "" "" ; then 5682 cmpxchg128=yes 5683 fi 5684fi 5685 5686######################################### 5687# See if 64-bit atomic operations are supported. 5688# Note that without __atomic builtins, we can only 5689# assume atomic loads/stores max at pointer size. 5690 5691cat > $TMPC << EOF 5692#include <stdint.h> 5693int main(void) 5694{ 5695 uint64_t x = 0, y = 0; 5696#ifdef __ATOMIC_RELAXED 5697 y = __atomic_load_n(&x, __ATOMIC_RELAXED); 5698 __atomic_store_n(&x, y, __ATOMIC_RELAXED); 5699 __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); 5700 __atomic_exchange_n(&x, y, __ATOMIC_RELAXED); 5701 __atomic_fetch_add(&x, y, __ATOMIC_RELAXED); 5702#else 5703 typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5704 __sync_lock_test_and_set(&x, y); 5705 __sync_val_compare_and_swap(&x, y, 0); 5706 __sync_fetch_and_add(&x, y); 5707#endif 5708 return 0; 5709} 5710EOF 5711if compile_prog "" "" ; then 5712 atomic64=yes 5713fi 5714 5715######################################### 5716# See if --dynamic-list is supported by the linker 5717ld_dynamic_list="no" 5718if test "$static" = "no" ; then 5719 cat > $TMPTXT <<EOF 5720{ 5721 foo; 5722}; 5723EOF 5724 5725 cat > $TMPC <<EOF 5726#include <stdio.h> 5727void foo(void); 5728 5729void foo(void) 5730{ 5731 printf("foo\n"); 5732} 5733 5734int main(void) 5735{ 5736 foo(); 5737 return 0; 5738} 5739EOF 5740 5741 if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 5742 ld_dynamic_list="yes" 5743 fi 5744fi 5745 5746######################################### 5747# See if -exported_symbols_list is supported by the linker 5748 5749ld_exported_symbols_list="no" 5750if test "$static" = "no" ; then 5751 cat > $TMPTXT <<EOF 5752 _foo 5753EOF 5754 5755 if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 5756 ld_exported_symbols_list="yes" 5757 fi 5758fi 5759 5760if test "$plugins" = "yes" && 5761 test "$ld_dynamic_list" = "no" && 5762 test "$ld_exported_symbols_list" = "no" ; then 5763 error_exit \ 5764 "Plugin support requires dynamic linking and specifying a set of symbols " \ 5765 "that are exported to plugins. Unfortunately your linker doesn't " \ 5766 "support the flag (--dynamic-list or -exported_symbols_list) used " \ 5767 "for this purpose. You can't build with --static." 5768fi 5769 5770######################################## 5771# See if __attribute__((alias)) is supported. 5772# This false for Xcode 9, but has been remedied for Xcode 10. 5773# Unfortunately, travis uses Xcode 9 by default. 5774 5775attralias=no 5776cat > $TMPC << EOF 5777int x = 1; 5778extern const int y __attribute__((alias("x"))); 5779int main(void) { return 0; } 5780EOF 5781if compile_prog "" "" ; then 5782 attralias=yes 5783fi 5784 5785######################################## 5786# check if getauxval is available. 5787 5788getauxval=no 5789cat > $TMPC << EOF 5790#include <sys/auxv.h> 5791int main(void) { 5792 return getauxval(AT_HWCAP) == 0; 5793} 5794EOF 5795if compile_prog "" "" ; then 5796 getauxval=yes 5797fi 5798 5799######################################## 5800# check if ccache is interfering with 5801# semantic analysis of macros 5802 5803unset CCACHE_CPP2 5804ccache_cpp2=no 5805cat > $TMPC << EOF 5806static const int Z = 1; 5807#define fn() ({ Z; }) 5808#define TAUT(X) ((X) == Z) 5809#define PAREN(X, Y) (X == Y) 5810#define ID(X) (X) 5811int main(int argc, char *argv[]) 5812{ 5813 int x = 0, y = 0; 5814 x = ID(x); 5815 x = fn(); 5816 fn(); 5817 if (PAREN(x, y)) return 0; 5818 if (TAUT(Z)) return 0; 5819 return 0; 5820} 5821EOF 5822 5823if ! compile_object "-Werror"; then 5824 ccache_cpp2=yes 5825fi 5826 5827################################################# 5828# clang does not support glibc + FORTIFY_SOURCE. 5829 5830if test "$fortify_source" != "no"; then 5831 if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5832 fortify_source="no"; 5833 elif test -n "$cxx" && has $cxx && 5834 echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5835 fortify_source="no"; 5836 else 5837 fortify_source="yes" 5838 fi 5839fi 5840 5841############################################### 5842# Check if copy_file_range is provided by glibc 5843have_copy_file_range=no 5844cat > $TMPC << EOF 5845#include <unistd.h> 5846int main(void) { 5847 copy_file_range(0, NULL, 0, NULL, 0, 0); 5848 return 0; 5849} 5850EOF 5851if compile_prog "" "" ; then 5852 have_copy_file_range=yes 5853fi 5854 5855########################################## 5856# check if struct fsxattr is available via linux/fs.h 5857 5858have_fsxattr=no 5859cat > $TMPC << EOF 5860#include <linux/fs.h> 5861struct fsxattr foo; 5862int main(void) { 5863 return 0; 5864} 5865EOF 5866if compile_prog "" "" ; then 5867 have_fsxattr=yes 5868fi 5869 5870########################################## 5871# check for usable membarrier system call 5872if test "$membarrier" = "yes"; then 5873 have_membarrier=no 5874 if test "$mingw32" = "yes" ; then 5875 have_membarrier=yes 5876 elif test "$linux" = "yes" ; then 5877 cat > $TMPC << EOF 5878 #include <linux/membarrier.h> 5879 #include <sys/syscall.h> 5880 #include <unistd.h> 5881 #include <stdlib.h> 5882 int main(void) { 5883 syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5884 syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5885 exit(0); 5886 } 5887EOF 5888 if compile_prog "" "" ; then 5889 have_membarrier=yes 5890 fi 5891 fi 5892 if test "$have_membarrier" = "no"; then 5893 feature_not_found "membarrier" "membarrier system call not available" 5894 fi 5895else 5896 # Do not enable it by default even for Mingw32, because it doesn't 5897 # work on Wine. 5898 membarrier=no 5899fi 5900 5901########################################## 5902# check if rtnetlink.h exists and is useful 5903have_rtnetlink=no 5904cat > $TMPC << EOF 5905#include <linux/rtnetlink.h> 5906int main(void) { 5907 return IFLA_PROTO_DOWN; 5908} 5909EOF 5910if compile_prog "" "" ; then 5911 have_rtnetlink=yes 5912fi 5913 5914########################################## 5915# check for usable AF_VSOCK environment 5916have_af_vsock=no 5917cat > $TMPC << EOF 5918#include <errno.h> 5919#include <sys/types.h> 5920#include <sys/socket.h> 5921#if !defined(AF_VSOCK) 5922# error missing AF_VSOCK flag 5923#endif 5924#include <linux/vm_sockets.h> 5925int main(void) { 5926 int sock, ret; 5927 struct sockaddr_vm svm; 5928 socklen_t len = sizeof(svm); 5929 sock = socket(AF_VSOCK, SOCK_STREAM, 0); 5930 ret = getpeername(sock, (struct sockaddr *)&svm, &len); 5931 if ((ret == -1) && (errno == ENOTCONN)) { 5932 return 0; 5933 } 5934 return -1; 5935} 5936EOF 5937if compile_prog "" "" ; then 5938 have_af_vsock=yes 5939fi 5940 5941########################################## 5942# check for usable AF_ALG environment 5943have_afalg=no 5944cat > $TMPC << EOF 5945#include <errno.h> 5946#include <sys/types.h> 5947#include <sys/socket.h> 5948#include <linux/if_alg.h> 5949int main(void) { 5950 int sock; 5951 sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 5952 return sock; 5953} 5954EOF 5955if compile_prog "" "" ; then 5956 have_afalg=yes 5957fi 5958if test "$crypto_afalg" = "yes" 5959then 5960 if test "$have_afalg" != "yes" 5961 then 5962 error_exit "AF_ALG requested but could not be detected" 5963 fi 5964fi 5965 5966 5967################################################# 5968# Check to see if we have the Hypervisor framework 5969if [ "$darwin" = "yes" ] ; then 5970 cat > $TMPC << EOF 5971#include <Hypervisor/hv.h> 5972int main() { return 0;} 5973EOF 5974 if ! compile_object ""; then 5975 hvf='no' 5976 else 5977 hvf='yes' 5978 QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS" 5979 fi 5980fi 5981 5982########################################## 5983# check for sysmacros.h 5984 5985have_sysmacros=no 5986cat > $TMPC << EOF 5987#include <sys/sysmacros.h> 5988int main(void) { 5989 return makedev(0, 0); 5990} 5991EOF 5992if compile_prog "" "" ; then 5993 have_sysmacros=yes 5994fi 5995 5996########################################## 5997# check for _Static_assert() 5998 5999have_static_assert=no 6000cat > $TMPC << EOF 6001_Static_assert(1, "success"); 6002int main(void) { 6003 return 0; 6004} 6005EOF 6006if compile_prog "" "" ; then 6007 have_static_assert=yes 6008fi 6009 6010########################################## 6011# check for utmpx.h, it is missing e.g. on OpenBSD 6012 6013have_utmpx=no 6014cat > $TMPC << EOF 6015#include <utmpx.h> 6016struct utmpx user_info; 6017int main(void) { 6018 return 0; 6019} 6020EOF 6021if compile_prog "" "" ; then 6022 have_utmpx=yes 6023fi 6024 6025########################################## 6026# check for getrandom() 6027 6028have_getrandom=no 6029cat > $TMPC << EOF 6030#include <sys/random.h> 6031int main(void) { 6032 return getrandom(0, 0, GRND_NONBLOCK); 6033} 6034EOF 6035if compile_prog "" "" ; then 6036 have_getrandom=yes 6037fi 6038 6039########################################## 6040# checks for sanitizers 6041 6042have_asan=no 6043have_ubsan=no 6044have_asan_iface_h=no 6045have_asan_iface_fiber=no 6046 6047if test "$sanitizers" = "yes" ; then 6048 write_c_skeleton 6049 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 6050 have_asan=yes 6051 fi 6052 6053 # we could use a simple skeleton for flags checks, but this also 6054 # detect the static linking issue of ubsan, see also: 6055 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 6056 cat > $TMPC << EOF 6057#include <stdlib.h> 6058int main(void) { 6059 void *tmp = malloc(10); 6060 if (tmp != NULL) { 6061 return *(int *)(tmp + 2); 6062 } 6063 return 1; 6064} 6065EOF 6066 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 6067 have_ubsan=yes 6068 fi 6069 6070 if check_include "sanitizer/asan_interface.h" ; then 6071 have_asan_iface_h=yes 6072 fi 6073 6074 cat > $TMPC << EOF 6075#include <sanitizer/asan_interface.h> 6076int main(void) { 6077 __sanitizer_start_switch_fiber(0, 0, 0); 6078 return 0; 6079} 6080EOF 6081 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 6082 have_asan_iface_fiber=yes 6083 fi 6084fi 6085 6086########################################## 6087# checks for fuzzer 6088if test "$fuzzing" = "yes" ; then 6089 write_c_fuzzer_skeleton 6090 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=fuzzer" ""; then 6091 have_fuzzer=yes 6092 else 6093 error_exit "Your compiler doesn't support -fsanitize=fuzzer" 6094 exit 1 6095 fi 6096fi 6097 6098# Thread sanitizer is, for now, much noisier than the other sanitizers; 6099# keep it separate until that is not the case. 6100if test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 6101 error_exit "TSAN is not supported with other sanitiziers." 6102fi 6103have_tsan=no 6104have_tsan_iface_fiber=no 6105if test "$tsan" = "yes" ; then 6106 write_c_skeleton 6107 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 6108 have_tsan=yes 6109 fi 6110 cat > $TMPC << EOF 6111#include <sanitizer/tsan_interface.h> 6112int main(void) { 6113 __tsan_create_fiber(0); 6114 return 0; 6115} 6116EOF 6117 if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 6118 have_tsan_iface_fiber=yes 6119 fi 6120fi 6121 6122########################################## 6123# check for libpmem 6124 6125if test "$libpmem" != "no"; then 6126 if $pkg_config --exists "libpmem"; then 6127 libpmem="yes" 6128 libpmem_libs=$($pkg_config --libs libpmem) 6129 libpmem_cflags=$($pkg_config --cflags libpmem) 6130 QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" 6131 else 6132 if test "$libpmem" = "yes" ; then 6133 feature_not_found "libpmem" "Install nvml or pmdk" 6134 fi 6135 libpmem="no" 6136 fi 6137fi 6138 6139########################################## 6140# check for libdaxctl 6141 6142if test "$libdaxctl" != "no"; then 6143 if $pkg_config --atleast-version=57 "libdaxctl"; then 6144 libdaxctl="yes" 6145 libdaxctl_libs=$($pkg_config --libs libdaxctl) 6146 libdaxctl_cflags=$($pkg_config --cflags libdaxctl) 6147 QEMU_CFLAGS="$QEMU_CFLAGS $libdaxctl_cflags" 6148 else 6149 if test "$libdaxctl" = "yes" ; then 6150 feature_not_found "libdaxctl" "Install libdaxctl" 6151 fi 6152 libdaxctl="no" 6153 fi 6154fi 6155 6156########################################## 6157# check for slirp 6158 6159# slirp is only required when building softmmu targets 6160if test -z "$slirp" -a "$softmmu" != "yes" ; then 6161 slirp="no" 6162fi 6163 6164case "$slirp" in 6165 "" | yes) 6166 if $pkg_config slirp; then 6167 slirp=system 6168 elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 6169 slirp=git 6170 elif test -e "${source_path}/slirp/Makefile" ; then 6171 slirp=internal 6172 elif test -z "$slirp" ; then 6173 slirp=no 6174 else 6175 feature_not_found "slirp" "Install slirp devel or git submodule" 6176 fi 6177 ;; 6178 6179 system) 6180 if ! $pkg_config slirp; then 6181 feature_not_found "slirp" "Install slirp devel" 6182 fi 6183 ;; 6184esac 6185 6186case "$slirp" in 6187 git | internal) 6188 if test "$slirp" = git; then 6189 git_submodules="${git_submodules} slirp" 6190 fi 6191 mkdir -p slirp 6192 slirp_cflags="-I${source_path}/slirp/src -Islirp/src" 6193 slirp_libs="-Lslirp -lslirp" 6194 if test "$mingw32" = "yes" ; then 6195 slirp_libs="$slirp_libs -lws2_32 -liphlpapi" 6196 fi 6197 ;; 6198 6199 system) 6200 slirp_version=$($pkg_config --modversion slirp 2>/dev/null) 6201 slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null) 6202 slirp_libs=$($pkg_config --libs slirp 2>/dev/null) 6203 ;; 6204 6205 no) 6206 ;; 6207 *) 6208 error_exit "Unknown state for slirp: $slirp" 6209 ;; 6210esac 6211 6212########################################## 6213# check for usable __NR_keyctl syscall 6214 6215if test "$linux" = "yes" ; then 6216 6217 have_keyring=no 6218 cat > $TMPC << EOF 6219#include <errno.h> 6220#include <asm/unistd.h> 6221#include <linux/keyctl.h> 6222#include <unistd.h> 6223int main(void) { 6224 return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 6225} 6226EOF 6227 if compile_prog "" "" ; then 6228 have_keyring=yes 6229 fi 6230fi 6231if test "$secret_keyring" != "no" 6232then 6233 if test "$have_keyring" = "yes" 6234 then 6235 secret_keyring=yes 6236 else 6237 if test "$secret_keyring" = "yes" 6238 then 6239 error_exit "syscall __NR_keyctl requested, \ 6240but not implemented on your system" 6241 else 6242 secret_keyring=no 6243 fi 6244 fi 6245fi 6246 6247########################################## 6248# End of CC checks 6249# After here, no more $cc or $ld runs 6250 6251write_c_skeleton 6252 6253if test "$gcov" = "yes" ; then 6254 : 6255elif test "$fortify_source" = "yes" ; then 6256 QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 6257 debug=no 6258fi 6259if test "$debug_info" = "yes"; then 6260 CFLAGS="-g $CFLAGS" 6261 LDFLAGS="-g $LDFLAGS" 6262fi 6263if test "$debug" = "no"; then 6264 CFLAGS="-O2 $CFLAGS" 6265fi 6266 6267case "$ARCH" in 6268alpha) 6269 # Ensure there's only a single GP 6270 QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 6271;; 6272esac 6273 6274if test "$gprof" = "yes" ; then 6275 QEMU_CFLAGS="-p $QEMU_CFLAGS" 6276 QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 6277fi 6278 6279if test "$have_asan" = "yes"; then 6280 QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 6281 QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 6282 if test "$have_asan_iface_h" = "no" ; then 6283 echo "ASAN build enabled, but ASAN header missing." \ 6284 "Without code annotation, the report may be inferior." 6285 elif test "$have_asan_iface_fiber" = "no" ; then 6286 echo "ASAN build enabled, but ASAN header is too old." \ 6287 "Without code annotation, the report may be inferior." 6288 fi 6289fi 6290if test "$have_tsan" = "yes" ; then 6291 if test "$have_tsan_iface_fiber" = "yes" ; then 6292 QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 6293 QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 6294 else 6295 error_exit "Cannot enable TSAN due to missing fiber annotation interface." 6296 fi 6297elif test "$tsan" = "yes" ; then 6298 error_exit "Cannot enable TSAN due to missing sanitize thread interface." 6299fi 6300if test "$have_ubsan" = "yes"; then 6301 QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 6302 QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 6303fi 6304 6305########################################## 6306# Do we have libnfs 6307if test "$libnfs" != "no" ; then 6308 if $pkg_config --atleast-version=1.9.3 libnfs; then 6309 libnfs="yes" 6310 libnfs_libs=$($pkg_config --libs libnfs) 6311 else 6312 if test "$libnfs" = "yes" ; then 6313 feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 6314 fi 6315 libnfs="no" 6316 fi 6317fi 6318 6319########################################## 6320# Do we have libudev 6321if test "$libudev" != "no" ; then 6322 if $pkg_config libudev && test "$static" != "yes"; then 6323 libudev="yes" 6324 libudev_libs=$($pkg_config --libs libudev) 6325 else 6326 libudev="no" 6327 fi 6328fi 6329 6330# Now we've finished running tests it's OK to add -Werror to the compiler flags 6331if test "$werror" = "yes"; then 6332 QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 6333fi 6334 6335# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 6336if test "$solaris" = "no" && test "$tsan" = "no"; then 6337 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 6338 QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 6339 fi 6340fi 6341 6342# test if pod2man has --utf8 option 6343if pod2man --help | grep -q utf8; then 6344 POD2MAN="pod2man --utf8" 6345else 6346 POD2MAN="pod2man" 6347fi 6348 6349# Use ASLR, no-SEH and DEP if available 6350if test "$mingw32" = "yes" ; then 6351 for flag in --dynamicbase --no-seh --nxcompat; do 6352 if ld_has $flag ; then 6353 QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 6354 fi 6355 done 6356fi 6357 6358# Disable OpenBSD W^X if available 6359if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then 6360 cat > $TMPC <<EOF 6361 int main(void) { return 0; } 6362EOF 6363 wx_ldflags="-Wl,-z,wxneeded" 6364 if compile_prog "" "$wx_ldflags"; then 6365 QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags" 6366 fi 6367fi 6368 6369qemu_confdir="$sysconfdir/$qemu_suffix" 6370qemu_moddir="$libdir/$qemu_suffix" 6371qemu_datadir="$datadir/$qemu_suffix" 6372qemu_docdir="$docdir/$qemu_suffix" 6373qemu_localedir="$datadir/locale" 6374qemu_icondir="$datadir/icons" 6375qemu_desktopdir="$datadir/applications" 6376 6377# We can only support ivshmem if we have eventfd 6378if [ "$eventfd" = "yes" ]; then 6379 ivshmem=yes 6380fi 6381 6382if test "$softmmu" = yes ; then 6383 if test "$linux" = yes; then 6384 if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then 6385 virtfs=yes 6386 else 6387 if test "$virtfs" = yes; then 6388 error_exit "VirtFS requires libcap-ng devel and libattr devel" 6389 fi 6390 virtfs=no 6391 fi 6392 if test "$mpath" != no && test "$mpathpersist" = yes ; then 6393 mpath=yes 6394 else 6395 if test "$mpath" = yes; then 6396 error_exit "Multipath requires libmpathpersist devel" 6397 fi 6398 mpath=no 6399 fi 6400 else 6401 if test "$virtfs" = yes; then 6402 error_exit "VirtFS is supported only on Linux" 6403 fi 6404 virtfs=no 6405 if test "$mpath" = yes; then 6406 error_exit "Multipath is supported only on Linux" 6407 fi 6408 mpath=no 6409 fi 6410fi 6411 6412# Probe for guest agent support/options 6413 6414if [ "$guest_agent" != "no" ]; then 6415 if [ "$softmmu" = no -a "$want_tools" = no ] ; then 6416 guest_agent=no 6417 elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 6418 guest_agent=yes 6419 elif [ "$guest_agent" != yes ]; then 6420 guest_agent=no 6421 else 6422 error_exit "Guest agent is not supported on this platform" 6423 fi 6424fi 6425 6426# Guest agent Window MSI package 6427 6428if test "$guest_agent" != yes; then 6429 if test "$guest_agent_msi" = yes; then 6430 error_exit "MSI guest agent package requires guest agent enabled" 6431 fi 6432 guest_agent_msi=no 6433elif test "$mingw32" != "yes"; then 6434 if test "$guest_agent_msi" = "yes"; then 6435 error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 6436 fi 6437 guest_agent_msi=no 6438elif ! has wixl; then 6439 if test "$guest_agent_msi" = "yes"; then 6440 error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 6441 fi 6442 guest_agent_msi=no 6443else 6444 # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 6445 # disabled explicitly 6446 if test "$guest_agent_msi" != "no"; then 6447 guest_agent_msi=yes 6448 fi 6449fi 6450 6451if test "$guest_agent_msi" = "yes"; then 6452 if test "$guest_agent_with_vss" = "yes"; then 6453 QEMU_GA_MSI_WITH_VSS="-D InstallVss" 6454 fi 6455 6456 if test "$QEMU_GA_MANUFACTURER" = ""; then 6457 QEMU_GA_MANUFACTURER=QEMU 6458 fi 6459 6460 if test "$QEMU_GA_DISTRO" = ""; then 6461 QEMU_GA_DISTRO=Linux 6462 fi 6463 6464 if test "$QEMU_GA_VERSION" = ""; then 6465 QEMU_GA_VERSION=$(cat $source_path/VERSION) 6466 fi 6467 6468 QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 6469 6470 case "$cpu" in 6471 x86_64) 6472 QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 6473 ;; 6474 i386) 6475 QEMU_GA_MSI_ARCH="-D Arch=32" 6476 ;; 6477 *) 6478 error_exit "CPU $cpu not supported for building installation package" 6479 ;; 6480 esac 6481fi 6482 6483# Mac OS X ships with a broken assembler 6484roms= 6485if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 6486 test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 6487 test "$softmmu" = yes ; then 6488 # Different host OS linkers have different ideas about the name of the ELF 6489 # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 6490 # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 6491 for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 6492 if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 6493 ld_i386_emulation="$emu" 6494 roms="optionrom" 6495 break 6496 fi 6497 done 6498fi 6499 6500# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 6501if test "$cpu" = "s390x" ; then 6502 write_c_skeleton 6503 if compile_prog "-march=z900" ""; then 6504 roms="$roms s390-ccw" 6505 # SLOF is required for building the s390-ccw firmware on s390x, 6506 # since it is using the libnet code from SLOF for network booting. 6507 if test -e "${source_path}/.git" ; then 6508 git_submodules="${git_submodules} roms/SLOF" 6509 fi 6510 fi 6511fi 6512 6513# Check that the C++ compiler exists and works with the C compiler. 6514# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. 6515if has $cxx; then 6516 cat > $TMPC <<EOF 6517int c_function(void); 6518int main(void) { return c_function(); } 6519EOF 6520 6521 compile_object 6522 6523 cat > $TMPCXX <<EOF 6524extern "C" { 6525 int c_function(void); 6526} 6527int c_function(void) { return 42; } 6528EOF 6529 6530 update_cxxflags 6531 6532 if do_cxx $CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 6533 # C++ compiler $cxx works ok with C compiler $cc 6534 : 6535 else 6536 echo "C++ compiler $cxx does not work with C compiler $cc" 6537 echo "Disabling C++ specific optional code" 6538 cxx= 6539 fi 6540else 6541 echo "No C++ compiler available; disabling C++ specific optional code" 6542 cxx= 6543fi 6544 6545echo_version() { 6546 if test "$1" = "yes" ; then 6547 echo "($2)" 6548 fi 6549} 6550 6551# prepend ftd flags after all config tests are done 6552QEMU_CFLAGS="$fdt_cflags $QEMU_CFLAGS" 6553QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" 6554 6555config_host_mak="config-host.mak" 6556 6557echo "# Automatically generated by configure - do not modify" > $config_host_mak 6558echo >> $config_host_mak 6559 6560echo all: >> $config_host_mak 6561echo "prefix=$prefix" >> $config_host_mak 6562echo "bindir=$bindir" >> $config_host_mak 6563echo "libdir=$libdir" >> $config_host_mak 6564echo "libexecdir=$libexecdir" >> $config_host_mak 6565echo "includedir=$includedir" >> $config_host_mak 6566echo "sysconfdir=$sysconfdir" >> $config_host_mak 6567echo "qemu_confdir=$qemu_confdir" >> $config_host_mak 6568echo "qemu_datadir=$qemu_datadir" >> $config_host_mak 6569echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 6570echo "qemu_moddir=$qemu_moddir" >> $config_host_mak 6571if test "$mingw32" = "no" ; then 6572 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 6573fi 6574echo "qemu_helperdir=$libexecdir" >> $config_host_mak 6575echo "qemu_localedir=$qemu_localedir" >> $config_host_mak 6576echo "qemu_icondir=$qemu_icondir" >> $config_host_mak 6577echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak 6578echo "GIT=$git" >> $config_host_mak 6579echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6580echo "GIT_UPDATE=$git_update" >> $config_host_mak 6581 6582echo "ARCH=$ARCH" >> $config_host_mak 6583 6584if test "$default_devices" = "yes" ; then 6585 echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak 6586else 6587 echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak 6588fi 6589if test "$debug_tcg" = "yes" ; then 6590 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6591fi 6592if test "$strip_opt" = "yes" ; then 6593 echo "STRIP=${strip}" >> $config_host_mak 6594fi 6595if test "$bigendian" = "yes" ; then 6596 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 6597fi 6598if test "$mingw32" = "yes" ; then 6599 echo "CONFIG_WIN32=y" >> $config_host_mak 6600 rc_version=$(cat $source_path/VERSION) 6601 version_major=${rc_version%%.*} 6602 rc_version=${rc_version#*.} 6603 version_minor=${rc_version%%.*} 6604 rc_version=${rc_version#*.} 6605 version_subminor=${rc_version%%.*} 6606 version_micro=0 6607 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6608 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6609 if test "$guest_agent_with_vss" = "yes" ; then 6610 echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6611 echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6612 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6613 fi 6614 if test "$guest_agent_ntddscsi" = "yes" ; then 6615 echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 6616 fi 6617 if test "$guest_agent_msi" = "yes"; then 6618 echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 6619 echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 6620 echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 6621 echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 6622 echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 6623 echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 6624 echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 6625 fi 6626else 6627 echo "CONFIG_POSIX=y" >> $config_host_mak 6628fi 6629 6630if test "$linux" = "yes" ; then 6631 echo "CONFIG_LINUX=y" >> $config_host_mak 6632fi 6633 6634if test "$darwin" = "yes" ; then 6635 echo "CONFIG_DARWIN=y" >> $config_host_mak 6636fi 6637 6638if test "$solaris" = "yes" ; then 6639 echo "CONFIG_SOLARIS=y" >> $config_host_mak 6640fi 6641if test "$haiku" = "yes" ; then 6642 echo "CONFIG_HAIKU=y" >> $config_host_mak 6643fi 6644if test "$static" = "yes" ; then 6645 echo "CONFIG_STATIC=y" >> $config_host_mak 6646fi 6647if test "$profiler" = "yes" ; then 6648 echo "CONFIG_PROFILER=y" >> $config_host_mak 6649fi 6650if test "$want_tools" = "yes" ; then 6651 echo "CONFIG_TOOLS=y" >> $config_host_mak 6652fi 6653if test "$guest_agent" = "yes" ; then 6654 echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 6655fi 6656if test "$slirp" != "no"; then 6657 echo "CONFIG_SLIRP=y" >> $config_host_mak 6658 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 6659 echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak 6660 echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak 6661fi 6662subdirs= 6663if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then 6664 subdirs="$subdirs slirp" 6665fi 6666if test "$vde" = "yes" ; then 6667 echo "CONFIG_VDE=y" >> $config_host_mak 6668 echo "VDE_LIBS=$vde_libs" >> $config_host_mak 6669fi 6670if test "$netmap" = "yes" ; then 6671 echo "CONFIG_NETMAP=y" >> $config_host_mak 6672fi 6673if test "$l2tpv3" = "yes" ; then 6674 echo "CONFIG_L2TPV3=y" >> $config_host_mak 6675fi 6676if test "$gprof" = "yes" ; then 6677 echo "CONFIG_GPROF=y" >> $config_host_mak 6678fi 6679if test "$cap_ng" = "yes" ; then 6680 echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak 6681 echo "LIBCAP_NG_LIBS=$cap_libs" >> $config_host_mak 6682fi 6683echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 6684for drv in $audio_drv_list; do 6685 def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 6686 echo "$def=y" >> $config_host_mak 6687done 6688if test "$alsa" = "yes" ; then 6689 echo "CONFIG_ALSA=y" >> $config_host_mak 6690fi 6691echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak 6692echo "ALSA_CFLAGS=$alsa_cflags" >> $config_host_mak 6693if test "$libpulse" = "yes" ; then 6694 echo "CONFIG_LIBPULSE=y" >> $config_host_mak 6695fi 6696echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak 6697echo "PULSE_CFLAGS=$pulse_cflags" >> $config_host_mak 6698echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 6699echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 6700echo "OSS_LIBS=$oss_libs" >> $config_host_mak 6701if test "$libjack" = "yes" ; then 6702 echo "CONFIG_LIBJACK=y" >> $config_host_mak 6703fi 6704echo "JACK_LIBS=$jack_libs" >> $config_host_mak 6705if test "$audio_win_int" = "yes" ; then 6706 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 6707fi 6708echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 6709echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 6710if test "$xfs" = "yes" ; then 6711 echo "CONFIG_XFS=y" >> $config_host_mak 6712fi 6713qemu_version=$(head $source_path/VERSION) 6714echo "PKGVERSION=$pkgversion" >>$config_host_mak 6715echo "SRC_PATH=$source_path" >> $config_host_mak 6716echo "TARGET_DIRS=$target_list" >> $config_host_mak 6717if [ "$docs" = "yes" ] ; then 6718 echo "BUILD_DOCS=yes" >> $config_host_mak 6719fi 6720if test "$modules" = "yes"; then 6721 # $shacmd can generate a hash started with digit, which the compiler doesn't 6722 # like as an symbol. So prefix it with an underscore 6723 echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 6724 echo "CONFIG_MODULES=y" >> $config_host_mak 6725fi 6726if test "$module_upgrades" = "yes"; then 6727 echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 6728fi 6729if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then 6730 echo "CONFIG_X11=y" >> $config_host_mak 6731 echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 6732 echo "X11_LIBS=$x11_libs" >> $config_host_mak 6733fi 6734if test "$cocoa" = "yes" ; then 6735 echo "CONFIG_COCOA=y" >> $config_host_mak 6736fi 6737if test "$iconv" = "yes" ; then 6738 echo "CONFIG_ICONV=y" >> $config_host_mak 6739 echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak 6740 echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak 6741fi 6742if test "$curses" = "yes" ; then 6743 echo "CONFIG_CURSES=y" >> $config_host_mak 6744 echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 6745 echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 6746fi 6747if test "$pipe2" = "yes" ; then 6748 echo "CONFIG_PIPE2=y" >> $config_host_mak 6749fi 6750if test "$accept4" = "yes" ; then 6751 echo "CONFIG_ACCEPT4=y" >> $config_host_mak 6752fi 6753if test "$splice" = "yes" ; then 6754 echo "CONFIG_SPLICE=y" >> $config_host_mak 6755fi 6756if test "$eventfd" = "yes" ; then 6757 echo "CONFIG_EVENTFD=y" >> $config_host_mak 6758fi 6759if test "$memfd" = "yes" ; then 6760 echo "CONFIG_MEMFD=y" >> $config_host_mak 6761fi 6762if test "$have_usbfs" = "yes" ; then 6763 echo "CONFIG_USBFS=y" >> $config_host_mak 6764fi 6765if test "$fallocate" = "yes" ; then 6766 echo "CONFIG_FALLOCATE=y" >> $config_host_mak 6767fi 6768if test "$fallocate_punch_hole" = "yes" ; then 6769 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 6770fi 6771if test "$fallocate_zero_range" = "yes" ; then 6772 echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 6773fi 6774if test "$posix_fallocate" = "yes" ; then 6775 echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 6776fi 6777if test "$sync_file_range" = "yes" ; then 6778 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 6779fi 6780if test "$fiemap" = "yes" ; then 6781 echo "CONFIG_FIEMAP=y" >> $config_host_mak 6782fi 6783if test "$dup3" = "yes" ; then 6784 echo "CONFIG_DUP3=y" >> $config_host_mak 6785fi 6786if test "$ppoll" = "yes" ; then 6787 echo "CONFIG_PPOLL=y" >> $config_host_mak 6788fi 6789if test "$prctl_pr_set_timerslack" = "yes" ; then 6790 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 6791fi 6792if test "$epoll" = "yes" ; then 6793 echo "CONFIG_EPOLL=y" >> $config_host_mak 6794fi 6795if test "$epoll_create1" = "yes" ; then 6796 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 6797fi 6798if test "$sendfile" = "yes" ; then 6799 echo "CONFIG_SENDFILE=y" >> $config_host_mak 6800fi 6801if test "$timerfd" = "yes" ; then 6802 echo "CONFIG_TIMERFD=y" >> $config_host_mak 6803fi 6804if test "$setns" = "yes" ; then 6805 echo "CONFIG_SETNS=y" >> $config_host_mak 6806fi 6807if test "$clock_adjtime" = "yes" ; then 6808 echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 6809fi 6810if test "$syncfs" = "yes" ; then 6811 echo "CONFIG_SYNCFS=y" >> $config_host_mak 6812fi 6813if test "$kcov" = "yes" ; then 6814 echo "CONFIG_KCOV=y" >> $config_host_mak 6815fi 6816if test "$btrfs" = "yes" ; then 6817 echo "CONFIG_BTRFS=y" >> $config_host_mak 6818fi 6819if test "$inotify" = "yes" ; then 6820 echo "CONFIG_INOTIFY=y" >> $config_host_mak 6821fi 6822if test "$inotify1" = "yes" ; then 6823 echo "CONFIG_INOTIFY1=y" >> $config_host_mak 6824fi 6825if test "$sem_timedwait" = "yes" ; then 6826 echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 6827fi 6828if test "$strchrnul" = "yes" ; then 6829 echo "HAVE_STRCHRNUL=y" >> $config_host_mak 6830fi 6831if test "$st_atim" = "yes" ; then 6832 echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak 6833fi 6834if test "$byteswap_h" = "yes" ; then 6835 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 6836fi 6837if test "$bswap_h" = "yes" ; then 6838 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 6839fi 6840if test "$curl" = "yes" ; then 6841 echo "CONFIG_CURL=y" >> $config_host_mak 6842 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 6843 echo "CURL_LIBS=$curl_libs" >> $config_host_mak 6844fi 6845if test "$brlapi" = "yes" ; then 6846 echo "CONFIG_BRLAPI=y" >> $config_host_mak 6847 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 6848fi 6849if test "$gtk" = "yes" ; then 6850 echo "CONFIG_GTK=y" >> $config_host_mak 6851 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 6852 echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 6853 if test "$gtk_gl" = "yes" ; then 6854 echo "CONFIG_GTK_GL=y" >> $config_host_mak 6855 fi 6856fi 6857if test "$gio" = "yes" ; then 6858 echo "CONFIG_GIO=y" >> $config_host_mak 6859 echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 6860 echo "GIO_LIBS=$gio_libs" >> $config_host_mak 6861 echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 6862fi 6863echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 6864if test "$gnutls" = "yes" ; then 6865 echo "CONFIG_GNUTLS=y" >> $config_host_mak 6866 echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak 6867 echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak 6868fi 6869if test "$gcrypt" = "yes" ; then 6870 echo "CONFIG_GCRYPT=y" >> $config_host_mak 6871 if test "$gcrypt_hmac" = "yes" ; then 6872 echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 6873 fi 6874 echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak 6875 echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak 6876fi 6877if test "$nettle" = "yes" ; then 6878 echo "CONFIG_NETTLE=y" >> $config_host_mak 6879 echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 6880 echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak 6881 echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak 6882fi 6883if test "$qemu_private_xts" = "yes" ; then 6884 echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak 6885fi 6886if test "$tasn1" = "yes" ; then 6887 echo "CONFIG_TASN1=y" >> $config_host_mak 6888fi 6889if test "$auth_pam" = "yes" ; then 6890 echo "CONFIG_AUTH_PAM=y" >> $config_host_mak 6891fi 6892if test "$have_ifaddrs_h" = "yes" ; then 6893 echo "HAVE_IFADDRS_H=y" >> $config_host_mak 6894fi 6895if test "$have_drm_h" = "yes" ; then 6896 echo "HAVE_DRM_H=y" >> $config_host_mak 6897fi 6898if test "$have_broken_size_max" = "yes" ; then 6899 echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 6900fi 6901if test "$have_openpty" = "yes" ; then 6902 echo "HAVE_OPENPTY=y" >> $config_host_mak 6903fi 6904if test "$have_sys_signal_h" = "yes" ; then 6905 echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak 6906fi 6907 6908# Work around a system header bug with some kernel/XFS header 6909# versions where they both try to define 'struct fsxattr': 6910# xfs headers will not try to redefine structs from linux headers 6911# if this macro is set. 6912if test "$have_fsxattr" = "yes" ; then 6913 echo "HAVE_FSXATTR=y" >> $config_host_mak 6914fi 6915if test "$have_copy_file_range" = "yes" ; then 6916 echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 6917fi 6918if test "$vte" = "yes" ; then 6919 echo "CONFIG_VTE=y" >> $config_host_mak 6920 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 6921 echo "VTE_LIBS=$vte_libs" >> $config_host_mak 6922fi 6923if test "$virglrenderer" = "yes" ; then 6924 echo "CONFIG_VIRGL=y" >> $config_host_mak 6925 echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 6926 echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 6927fi 6928if test "$xen" = "yes" ; then 6929 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 6930 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 6931 echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 6932 echo "XEN_LIBS=$xen_libs" >> $config_host_mak 6933fi 6934if test "$linux_aio" = "yes" ; then 6935 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 6936fi 6937if test "$linux_io_uring" = "yes" ; then 6938 echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak 6939 echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak 6940 echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak 6941fi 6942if test "$attr" = "yes" ; then 6943 echo "CONFIG_ATTR=y" >> $config_host_mak 6944 echo "LIBATTR_LIBS=$libattr_libs" >> $config_host_mak 6945fi 6946if test "$libattr" = "yes" ; then 6947 echo "CONFIG_LIBATTR=y" >> $config_host_mak 6948fi 6949if test "$virtfs" = "yes" ; then 6950 echo "CONFIG_VIRTFS=y" >> $config_host_mak 6951fi 6952if test "$mpath" = "yes" ; then 6953 echo "CONFIG_MPATH=y" >> $config_host_mak 6954 if test "$mpathpersist_new_api" = "yes"; then 6955 echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak 6956 fi 6957fi 6958if test "$vhost_scsi" = "yes" ; then 6959 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 6960fi 6961if test "$vhost_net" = "yes" ; then 6962 echo "CONFIG_VHOST_NET=y" >> $config_host_mak 6963fi 6964if test "$vhost_net_user" = "yes" ; then 6965 echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 6966fi 6967if test "$vhost_net_vdpa" = "yes" ; then 6968 echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 6969fi 6970if test "$vhost_crypto" = "yes" ; then 6971 echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 6972fi 6973if test "$vhost_vsock" = "yes" ; then 6974 echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 6975 if test "$vhost_user" = "yes" ; then 6976 echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 6977 fi 6978fi 6979if test "$vhost_kernel" = "yes" ; then 6980 echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 6981fi 6982if test "$vhost_user" = "yes" ; then 6983 echo "CONFIG_VHOST_USER=y" >> $config_host_mak 6984fi 6985if test "$vhost_vdpa" = "yes" ; then 6986 echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 6987fi 6988if test "$vhost_user_fs" = "yes" ; then 6989 echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 6990fi 6991if test "$blobs" = "yes" ; then 6992 echo "INSTALL_BLOBS=yes" >> $config_host_mak 6993fi 6994if test "$iovec" = "yes" ; then 6995 echo "CONFIG_IOVEC=y" >> $config_host_mak 6996fi 6997if test "$preadv" = "yes" ; then 6998 echo "CONFIG_PREADV=y" >> $config_host_mak 6999fi 7000if test "$fdt" != "no" ; then 7001 echo "CONFIG_FDT=y" >> $config_host_mak 7002 echo "FDT_CFLAGS=$fdt_cflags" >> $config_host_mak 7003 echo "FDT_LIBS=$fdt_ldflags $fdt_libs" >> $config_host_mak 7004fi 7005if test "$membarrier" = "yes" ; then 7006 echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 7007fi 7008if test "$signalfd" = "yes" ; then 7009 echo "CONFIG_SIGNALFD=y" >> $config_host_mak 7010fi 7011if test "$optreset" = "yes" ; then 7012 echo "HAVE_OPTRESET=y" >> $config_host_mak 7013fi 7014if test "$tcg" = "yes"; then 7015 echo "CONFIG_TCG=y" >> $config_host_mak 7016 if test "$tcg_interpreter" = "yes" ; then 7017 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 7018 fi 7019fi 7020if test "$fdatasync" = "yes" ; then 7021 echo "CONFIG_FDATASYNC=y" >> $config_host_mak 7022fi 7023if test "$madvise" = "yes" ; then 7024 echo "CONFIG_MADVISE=y" >> $config_host_mak 7025fi 7026if test "$posix_madvise" = "yes" ; then 7027 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 7028fi 7029if test "$posix_memalign" = "yes" ; then 7030 echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 7031fi 7032if test "$spice" = "yes" ; then 7033 echo "CONFIG_SPICE=y" >> $config_host_mak 7034 echo "SPICE_CFLAGS=$spice_cflags" >> $config_host_mak 7035 echo "SPICE_LIBS=$spice_libs" >> $config_host_mak 7036fi 7037 7038if test "$smartcard" = "yes" ; then 7039 echo "CONFIG_SMARTCARD=y" >> $config_host_mak 7040 echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 7041 echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 7042fi 7043 7044if test "$libusb" = "yes" ; then 7045 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 7046 echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 7047 echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 7048fi 7049 7050if test "$usb_redir" = "yes" ; then 7051 echo "CONFIG_USB_REDIR=y" >> $config_host_mak 7052 echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 7053 echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 7054fi 7055 7056if test "$opengl" = "yes" ; then 7057 echo "CONFIG_OPENGL=y" >> $config_host_mak 7058 echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 7059 if test "$opengl_dmabuf" = "yes" ; then 7060 echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 7061 fi 7062fi 7063 7064if test "$gbm" = "yes" ; then 7065 echo "CONFIG_GBM=y" >> $config_host_mak 7066 echo "GBM_LIBS=$gbm_libs" >> $config_host_mak 7067 echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak 7068fi 7069 7070 7071if test "$malloc_trim" = "yes" ; then 7072 echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak 7073fi 7074 7075if test "$avx2_opt" = "yes" ; then 7076 echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 7077fi 7078 7079if test "$avx512f_opt" = "yes" ; then 7080 echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 7081fi 7082 7083if test "$lzo" = "yes" ; then 7084 echo "CONFIG_LZO=y" >> $config_host_mak 7085 echo "LZO_LIBS=$lzo_libs" >> $config_host_mak 7086fi 7087 7088if test "$snappy" = "yes" ; then 7089 echo "CONFIG_SNAPPY=y" >> $config_host_mak 7090 echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak 7091fi 7092 7093if test "$bzip2" = "yes" ; then 7094 echo "CONFIG_BZIP2=y" >> $config_host_mak 7095 echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 7096fi 7097 7098if test "$lzfse" = "yes" ; then 7099 echo "CONFIG_LZFSE=y" >> $config_host_mak 7100 echo "LZFSE_LIBS=-llzfse" >> $config_host_mak 7101fi 7102 7103if test "$zstd" = "yes" ; then 7104 echo "CONFIG_ZSTD=y" >> $config_host_mak 7105 echo "ZSTD_CFLAGS=$zstd_cflags" >> $config_host_mak 7106 echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak 7107fi 7108 7109if test "$libiscsi" = "yes" ; then 7110 echo "CONFIG_LIBISCSI=y" >> $config_host_mak 7111 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 7112 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 7113fi 7114 7115if test "$libnfs" = "yes" ; then 7116 echo "CONFIG_LIBNFS=y" >> $config_host_mak 7117 echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 7118fi 7119 7120if test "$seccomp" = "yes"; then 7121 echo "CONFIG_SECCOMP=y" >> $config_host_mak 7122 echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 7123 echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 7124fi 7125 7126# XXX: suppress that 7127if [ "$bsd" = "yes" ] ; then 7128 echo "CONFIG_BSD=y" >> $config_host_mak 7129fi 7130 7131if test "$localtime_r" = "yes" ; then 7132 echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 7133fi 7134if test "$qom_cast_debug" = "yes" ; then 7135 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 7136fi 7137if test "$rbd" = "yes" ; then 7138 echo "CONFIG_RBD=y" >> $config_host_mak 7139 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 7140fi 7141 7142echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 7143if test "$coroutine_pool" = "yes" ; then 7144 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 7145else 7146 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 7147fi 7148 7149if test "$debug_stack_usage" = "yes" ; then 7150 echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 7151fi 7152 7153if test "$crypto_afalg" = "yes" ; then 7154 echo "CONFIG_AF_ALG=y" >> $config_host_mak 7155fi 7156 7157if test "$open_by_handle_at" = "yes" ; then 7158 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 7159fi 7160 7161if test "$linux_magic_h" = "yes" ; then 7162 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 7163fi 7164 7165if test "$valgrind_h" = "yes" ; then 7166 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 7167fi 7168 7169if test "$have_asan_iface_fiber" = "yes" ; then 7170 echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 7171fi 7172 7173if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 7174 echo "CONFIG_TSAN=y" >> $config_host_mak 7175fi 7176 7177if test "$has_environ" = "yes" ; then 7178 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 7179fi 7180 7181if test "$cpuid_h" = "yes" ; then 7182 echo "CONFIG_CPUID_H=y" >> $config_host_mak 7183fi 7184 7185if test "$int128" = "yes" ; then 7186 echo "CONFIG_INT128=y" >> $config_host_mak 7187fi 7188 7189if test "$atomic128" = "yes" ; then 7190 echo "CONFIG_ATOMIC128=y" >> $config_host_mak 7191fi 7192 7193if test "$cmpxchg128" = "yes" ; then 7194 echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 7195fi 7196 7197if test "$atomic64" = "yes" ; then 7198 echo "CONFIG_ATOMIC64=y" >> $config_host_mak 7199fi 7200 7201if test "$attralias" = "yes" ; then 7202 echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak 7203fi 7204 7205if test "$getauxval" = "yes" ; then 7206 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 7207fi 7208 7209if test "$glusterfs" = "yes" ; then 7210 echo "CONFIG_GLUSTERFS=y" >> $config_host_mak 7211 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 7212 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 7213fi 7214 7215if test "$glusterfs_xlator_opt" = "yes" ; then 7216 echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 7217fi 7218 7219if test "$glusterfs_discard" = "yes" ; then 7220 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 7221fi 7222 7223if test "$glusterfs_fallocate" = "yes" ; then 7224 echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 7225fi 7226 7227if test "$glusterfs_zerofill" = "yes" ; then 7228 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 7229fi 7230 7231if test "$glusterfs_ftruncate_has_stat" = "yes" ; then 7232 echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak 7233fi 7234 7235if test "$glusterfs_iocb_has_stat" = "yes" ; then 7236 echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak 7237fi 7238 7239if test "$libssh" = "yes" ; then 7240 echo "CONFIG_LIBSSH=y" >> $config_host_mak 7241 echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 7242 echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 7243fi 7244 7245if test "$live_block_migration" = "yes" ; then 7246 echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 7247fi 7248 7249if test "$tpm" = "yes"; then 7250 echo 'CONFIG_TPM=y' >> $config_host_mak 7251fi 7252 7253echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 7254if have_backend "nop"; then 7255 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 7256fi 7257if have_backend "simple"; then 7258 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 7259 # Set the appropriate trace file. 7260 trace_file="\"$trace_file-\" FMT_pid" 7261fi 7262if have_backend "log"; then 7263 echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 7264fi 7265if have_backend "ust"; then 7266 echo "CONFIG_TRACE_UST=y" >> $config_host_mak 7267 echo "LTTNG_UST_LIBS=$lttng_ust_libs" >> $config_host_mak 7268 echo "URCU_BP_LIBS=$urcu_bp_libs" >> $config_host_mak 7269fi 7270if have_backend "dtrace"; then 7271 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 7272 if test "$trace_backend_stap" = "yes" ; then 7273 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 7274 fi 7275fi 7276if have_backend "ftrace"; then 7277 if test "$linux" = "yes" ; then 7278 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 7279 else 7280 feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 7281 fi 7282fi 7283if have_backend "syslog"; then 7284 if test "$posix_syslog" = "yes" ; then 7285 echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 7286 else 7287 feature_not_found "syslog(trace backend)" "syslog not available" 7288 fi 7289fi 7290echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 7291 7292if test "$rdma" = "yes" ; then 7293 echo "CONFIG_RDMA=y" >> $config_host_mak 7294 echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 7295fi 7296 7297if test "$pvrdma" = "yes" ; then 7298 echo "CONFIG_PVRDMA=y" >> $config_host_mak 7299fi 7300 7301if test "$have_rtnetlink" = "yes" ; then 7302 echo "CONFIG_RTNETLINK=y" >> $config_host_mak 7303fi 7304 7305if test "$libxml2" = "yes" ; then 7306 echo "CONFIG_LIBXML2=y" >> $config_host_mak 7307 echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 7308 echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 7309fi 7310 7311if test "$replication" = "yes" ; then 7312 echo "CONFIG_REPLICATION=y" >> $config_host_mak 7313fi 7314 7315if test "$have_af_vsock" = "yes" ; then 7316 echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 7317fi 7318 7319if test "$have_sysmacros" = "yes" ; then 7320 echo "CONFIG_SYSMACROS=y" >> $config_host_mak 7321fi 7322 7323if test "$have_static_assert" = "yes" ; then 7324 echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 7325fi 7326 7327if test "$have_utmpx" = "yes" ; then 7328 echo "HAVE_UTMPX=y" >> $config_host_mak 7329fi 7330if test "$have_getrandom" = "yes" ; then 7331 echo "CONFIG_GETRANDOM=y" >> $config_host_mak 7332fi 7333if test "$ivshmem" = "yes" ; then 7334 echo "CONFIG_IVSHMEM=y" >> $config_host_mak 7335fi 7336if test "$capstone" != "no" ; then 7337 echo "CONFIG_CAPSTONE=y" >> $config_host_mak 7338 echo "CAPSTONE_CFLAGS=$capstone_cflags" >> $config_host_mak 7339 echo "CAPSTONE_LIBS=$capstone_libs" >> $config_host_mak 7340fi 7341if test "$debug_mutex" = "yes" ; then 7342 echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 7343fi 7344 7345# Hold two types of flag: 7346# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 7347# a thread we have a handle to 7348# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular 7349# platform 7350if test "$pthread_setname_np_w_tid" = "yes" ; then 7351 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 7352 echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak 7353elif test "$pthread_setname_np_wo_tid" = "yes" ; then 7354 echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 7355 echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak 7356fi 7357 7358if test "$libpmem" = "yes" ; then 7359 echo "CONFIG_LIBPMEM=y" >> $config_host_mak 7360 echo "LIBPMEM_LIBS=$libpmem_libs" >> $config_host_mak 7361 echo "LIBPMEM_CFLAGS=$libpmem_cflags" >> $config_host_mak 7362fi 7363 7364if test "$libdaxctl" = "yes" ; then 7365 echo "CONFIG_LIBDAXCTL=y" >> $config_host_mak 7366 echo "LIBDAXCTL_LIBS=$libdaxctl_libs" >> $config_host_mak 7367fi 7368 7369if test "$bochs" = "yes" ; then 7370 echo "CONFIG_BOCHS=y" >> $config_host_mak 7371fi 7372if test "$cloop" = "yes" ; then 7373 echo "CONFIG_CLOOP=y" >> $config_host_mak 7374fi 7375if test "$dmg" = "yes" ; then 7376 echo "CONFIG_DMG=y" >> $config_host_mak 7377fi 7378if test "$qcow1" = "yes" ; then 7379 echo "CONFIG_QCOW1=y" >> $config_host_mak 7380fi 7381if test "$vdi" = "yes" ; then 7382 echo "CONFIG_VDI=y" >> $config_host_mak 7383fi 7384if test "$vvfat" = "yes" ; then 7385 echo "CONFIG_VVFAT=y" >> $config_host_mak 7386fi 7387if test "$qed" = "yes" ; then 7388 echo "CONFIG_QED=y" >> $config_host_mak 7389fi 7390if test "$parallels" = "yes" ; then 7391 echo "CONFIG_PARALLELS=y" >> $config_host_mak 7392fi 7393if test "$sheepdog" = "yes" ; then 7394 echo "CONFIG_SHEEPDOG=y" >> $config_host_mak 7395fi 7396if test "$pty_h" = "yes" ; then 7397 echo "HAVE_PTY_H=y" >> $config_host_mak 7398fi 7399if test "$have_mlockall" = "yes" ; then 7400 echo "HAVE_MLOCKALL=y" >> $config_host_mak 7401fi 7402if test "$fuzzing" = "yes" ; then 7403 QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" 7404fi 7405 7406if test "$plugins" = "yes" ; then 7407 echo "CONFIG_PLUGIN=y" >> $config_host_mak 7408 # Copy the export object list to the build dir 7409 if test "$ld_dynamic_list" = "yes" ; then 7410 echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 7411 ld_symbols=qemu-plugins-ld.symbols 7412 cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 7413 elif test "$ld_exported_symbols_list" = "yes" ; then 7414 echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 7415 ld64_symbols=qemu-plugins-ld64.symbols 7416 echo "# Automatically generated by configure - do not modify" > $ld64_symbols 7417 grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 7418 sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 7419 else 7420 error_exit \ 7421 "If \$plugins=yes, either \$ld_dynamic_list or " \ 7422 "\$ld_exported_symbols_list should have been set to 'yes'." 7423 fi 7424fi 7425 7426if test -n "$gdb_bin" ; then 7427 echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 7428fi 7429 7430if test "$secret_keyring" = "yes" ; then 7431 echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 7432fi 7433 7434if test "$tcg_interpreter" = "yes"; then 7435 QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES" 7436elif test "$ARCH" = "sparc64" ; then 7437 QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES" 7438elif test "$ARCH" = "s390x" ; then 7439 QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES" 7440elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then 7441 QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES" 7442elif test "$ARCH" = "ppc64" ; then 7443 QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES" 7444elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then 7445 QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES" 7446else 7447 QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES" 7448fi 7449 7450echo "ROMS=$roms" >> $config_host_mak 7451echo "MAKE=$make" >> $config_host_mak 7452echo "PYTHON=$python" >> $config_host_mak 7453echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak 7454echo "GENISOIMAGE=$genisoimage" >> $config_host_mak 7455echo "MESON=$meson" >> $config_host_mak 7456echo "CC=$cc" >> $config_host_mak 7457if $iasl -h > /dev/null 2>&1; then 7458 echo "CONFIG_IASL=$iasl" >> $config_host_mak 7459fi 7460echo "CXX=$cxx" >> $config_host_mak 7461echo "OBJCC=$objcc" >> $config_host_mak 7462echo "AR=$ar" >> $config_host_mak 7463echo "ARFLAGS=$ARFLAGS" >> $config_host_mak 7464echo "AS=$as" >> $config_host_mak 7465echo "CCAS=$ccas" >> $config_host_mak 7466echo "CPP=$cpp" >> $config_host_mak 7467echo "OBJCOPY=$objcopy" >> $config_host_mak 7468echo "LD=$ld" >> $config_host_mak 7469echo "RANLIB=$ranlib" >> $config_host_mak 7470echo "NM=$nm" >> $config_host_mak 7471echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak 7472echo "WINDRES=$windres" >> $config_host_mak 7473echo "CFLAGS=$CFLAGS" >> $config_host_mak 7474echo "CXXFLAGS=$CXXFLAGS" >> $config_host_mak 7475echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 7476echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 7477echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 7478echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 7479echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 7480echo "GLIB_LIBS=$glib_libs" >> $config_host_mak 7481if test "$sparse" = "yes" ; then 7482 echo "SPARSE_CFLAGS = -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 7483fi 7484echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 7485echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 7486echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak 7487echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 7488echo "LIBS+=$LIBS" >> $config_host_mak 7489echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 7490echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 7491echo "EXESUF=$EXESUF" >> $config_host_mak 7492echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak 7493echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 7494echo "LIBS_QGA=$libs_qga" >> $config_host_mak 7495echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 7496echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 7497echo "POD2MAN=$POD2MAN" >> $config_host_mak 7498if test "$gcov" = "yes" ; then 7499 echo "CONFIG_GCOV=y" >> $config_host_mak 7500fi 7501 7502if test "$libudev" != "no"; then 7503 echo "CONFIG_LIBUDEV=y" >> $config_host_mak 7504 echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak 7505fi 7506if test "$fuzzing" != "no"; then 7507 echo "CONFIG_FUZZ=y" >> $config_host_mak 7508fi 7509 7510if test "$edk2_blobs" = "yes" ; then 7511 echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak 7512fi 7513 7514if test "$rng_none" = "yes"; then 7515 echo "CONFIG_RNG_NONE=y" >> $config_host_mak 7516fi 7517 7518# use included Linux headers 7519if test "$linux" = "yes" ; then 7520 mkdir -p linux-headers 7521 case "$cpu" in 7522 i386|x86_64|x32) 7523 linux_arch=x86 7524 ;; 7525 ppc|ppc64|ppc64le) 7526 linux_arch=powerpc 7527 ;; 7528 s390x) 7529 linux_arch=s390 7530 ;; 7531 aarch64) 7532 linux_arch=arm64 7533 ;; 7534 mips64) 7535 linux_arch=mips 7536 ;; 7537 *) 7538 # For most CPUs the kernel architecture name and QEMU CPU name match. 7539 linux_arch="$cpu" 7540 ;; 7541 esac 7542 # For non-KVM architectures we will not have asm headers 7543 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 7544 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 7545 fi 7546fi 7547 7548for target in $target_list; do 7549target_dir="$target" 7550config_target_mak=$target_dir/config-target.mak 7551target_name=$(echo $target | cut -d '-' -f 1) 7552target_aligned_only="no" 7553case "$target_name" in 7554 alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) 7555 target_aligned_only="yes" 7556 ;; 7557esac 7558target_bigendian="no" 7559case "$target_name" in 7560 armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 7561 target_bigendian="yes" 7562 ;; 7563esac 7564target_softmmu="no" 7565target_user_only="no" 7566target_linux_user="no" 7567target_bsd_user="no" 7568case "$target" in 7569 ${target_name}-softmmu) 7570 target_softmmu="yes" 7571 ;; 7572 ${target_name}-linux-user) 7573 target_user_only="yes" 7574 target_linux_user="yes" 7575 ;; 7576 ${target_name}-bsd-user) 7577 target_user_only="yes" 7578 target_bsd_user="yes" 7579 ;; 7580 *) 7581 error_exit "Target '$target' not recognised" 7582 exit 1 7583 ;; 7584esac 7585 7586mkdir -p $target_dir 7587echo "# Automatically generated by configure - do not modify" > $config_target_mak 7588 7589bflt="no" 7590mttcg="no" 7591interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") 7592gdb_xml_files="" 7593 7594TARGET_ARCH="$target_name" 7595TARGET_BASE_ARCH="" 7596TARGET_ABI_DIR="" 7597TARGET_SYSTBL_ABI="" 7598TARGET_SYSTBL="" 7599 7600case "$target_name" in 7601 i386) 7602 mttcg="yes" 7603 gdb_xml_files="i386-32bit.xml" 7604 TARGET_SYSTBL_ABI=i386 7605 TARGET_SYSTBL=syscall_32.tbl 7606 ;; 7607 x86_64) 7608 TARGET_BASE_ARCH=i386 7609 TARGET_SYSTBL_ABI=common,64 7610 TARGET_SYSTBL=syscall_64.tbl 7611 mttcg="yes" 7612 gdb_xml_files="i386-64bit.xml" 7613 ;; 7614 alpha) 7615 mttcg="yes" 7616 TARGET_SYSTBL_ABI=common 7617 ;; 7618 arm|armeb) 7619 TARGET_ARCH=arm 7620 TARGET_SYSTBL_ABI=common,oabi 7621 bflt="yes" 7622 mttcg="yes" 7623 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" 7624 ;; 7625 aarch64|aarch64_be) 7626 TARGET_ARCH=aarch64 7627 TARGET_BASE_ARCH=arm 7628 bflt="yes" 7629 mttcg="yes" 7630 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" 7631 ;; 7632 avr) 7633 gdb_xml_files="avr-cpu.xml" 7634 target_compiler=$cross_cc_avr 7635 ;; 7636 cris) 7637 ;; 7638 hppa) 7639 mttcg="yes" 7640 TARGET_SYSTBL_ABI=common,32 7641 ;; 7642 lm32) 7643 ;; 7644 m68k) 7645 bflt="yes" 7646 gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" 7647 TARGET_SYSTBL_ABI=common 7648 ;; 7649 microblaze|microblazeel) 7650 TARGET_ARCH=microblaze 7651 TARGET_SYSTBL_ABI=common 7652 mttcg="yes" 7653 bflt="yes" 7654 echo "TARGET_ABI32=y" >> $config_target_mak 7655 ;; 7656 mips|mipsel) 7657 mttcg="yes" 7658 TARGET_ARCH=mips 7659 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 7660 TARGET_SYSTBL_ABI=o32 7661 TARGET_SYSTBL=syscall_o32.tbl 7662 ;; 7663 mipsn32|mipsn32el) 7664 mttcg="yes" 7665 TARGET_ARCH=mips64 7666 TARGET_BASE_ARCH=mips 7667 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 7668 echo "TARGET_ABI32=y" >> $config_target_mak 7669 TARGET_SYSTBL_ABI=n32 7670 TARGET_SYSTBL=syscall_n32.tbl 7671 ;; 7672 mips64|mips64el) 7673 mttcg="no" 7674 TARGET_ARCH=mips64 7675 TARGET_BASE_ARCH=mips 7676 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 7677 TARGET_SYSTBL_ABI=n64 7678 TARGET_SYSTBL=syscall_n64.tbl 7679 ;; 7680 moxie) 7681 ;; 7682 nios2) 7683 ;; 7684 or1k) 7685 TARGET_ARCH=openrisc 7686 TARGET_BASE_ARCH=openrisc 7687 ;; 7688 ppc) 7689 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 7690 TARGET_SYSTBL_ABI=common,nospu,32 7691 ;; 7692 ppc64) 7693 TARGET_BASE_ARCH=ppc 7694 TARGET_ABI_DIR=ppc 7695 TARGET_SYSTBL_ABI=common,nospu,64 7696 mttcg=yes 7697 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7698 ;; 7699 ppc64le) 7700 TARGET_ARCH=ppc64 7701 TARGET_BASE_ARCH=ppc 7702 TARGET_ABI_DIR=ppc 7703 TARGET_SYSTBL_ABI=common,nospu,64 7704 mttcg=yes 7705 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7706 ;; 7707 ppc64abi32) 7708 TARGET_ARCH=ppc64 7709 TARGET_BASE_ARCH=ppc 7710 TARGET_ABI_DIR=ppc 7711 TARGET_SYSTBL_ABI=common,nospu,32 7712 echo "TARGET_ABI32=y" >> $config_target_mak 7713 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7714 ;; 7715 riscv32) 7716 TARGET_BASE_ARCH=riscv 7717 TARGET_ABI_DIR=riscv 7718 mttcg=yes 7719 gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-32bit-csr.xml riscv-32bit-virtual.xml" 7720 ;; 7721 riscv64) 7722 TARGET_BASE_ARCH=riscv 7723 TARGET_ABI_DIR=riscv 7724 mttcg=yes 7725 gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml" 7726 ;; 7727 rx) 7728 TARGET_ARCH=rx 7729 bflt="yes" 7730 target_compiler=$cross_cc_rx 7731 gdb_xml_files="rx-core.xml" 7732 ;; 7733 sh4|sh4eb) 7734 TARGET_ARCH=sh4 7735 TARGET_SYSTBL_ABI=common 7736 bflt="yes" 7737 ;; 7738 sparc) 7739 TARGET_SYSTBL_ABI=common,32 7740 ;; 7741 sparc64) 7742 TARGET_BASE_ARCH=sparc 7743 TARGET_SYSTBL_ABI=common,64 7744 ;; 7745 sparc32plus) 7746 TARGET_ARCH=sparc64 7747 TARGET_BASE_ARCH=sparc 7748 TARGET_ABI_DIR=sparc 7749 TARGET_SYSTBL_ABI=common,32 7750 echo "TARGET_ABI32=y" >> $config_target_mak 7751 ;; 7752 s390x) 7753 TARGET_SYSTBL_ABI=common,64 7754 mttcg=yes 7755 gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" 7756 ;; 7757 tilegx) 7758 ;; 7759 tricore) 7760 ;; 7761 unicore32) 7762 ;; 7763 xtensa|xtensaeb) 7764 TARGET_ARCH=xtensa 7765 TARGET_SYSTBL_ABI=common 7766 bflt="yes" 7767 mttcg="yes" 7768 ;; 7769 *) 7770 error_exit "Unsupported target CPU" 7771 ;; 7772esac 7773# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 7774if [ "$TARGET_BASE_ARCH" = "" ]; then 7775 TARGET_BASE_ARCH=$TARGET_ARCH 7776fi 7777if [ "$TARGET_SYSTBL_ABI" != "" ] && [ "$TARGET_SYSTBL" = "" ]; then 7778 TARGET_SYSTBL=syscall.tbl 7779fi 7780 7781upper() { 7782 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 7783} 7784 7785target_arch_name="$(upper $TARGET_ARCH)" 7786echo "TARGET_$target_arch_name=y" >> $config_target_mak 7787echo "TARGET_NAME=$target_name" >> $config_target_mak 7788echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 7789if [ "$TARGET_ABI_DIR" = "" ]; then 7790 TARGET_ABI_DIR=$TARGET_ARCH 7791fi 7792echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 7793if [ "$HOST_VARIANT_DIR" != "" ]; then 7794 echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 7795fi 7796if [ "$TARGET_SYSTBL_ABI" != "" ]; then 7797 echo "TARGET_SYSTBL_ABI=$TARGET_SYSTBL_ABI" >> $config_target_mak 7798 echo "TARGET_SYSTBL=$TARGET_SYSTBL" >> $config_target_mak 7799fi 7800 7801if supported_xen_target $target; then 7802 echo "CONFIG_XEN=y" >> $config_target_mak 7803 if test "$xen_pci_passthrough" = yes; then 7804 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 7805 fi 7806fi 7807if supported_kvm_target $target; then 7808 echo "CONFIG_KVM=y" >> $config_target_mak 7809fi 7810if supported_hax_target $target; then 7811 echo "CONFIG_HAX=y" >> $config_target_mak 7812fi 7813if supported_hvf_target $target; then 7814 echo "CONFIG_HVF=y" >> $config_target_mak 7815fi 7816if supported_whpx_target $target; then 7817 echo "CONFIG_WHPX=y" >> $config_target_mak 7818fi 7819if test "$target_aligned_only" = "yes" ; then 7820 echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak 7821fi 7822if test "$target_bigendian" = "yes" ; then 7823 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 7824fi 7825if test "$target_softmmu" = "yes" ; then 7826 echo "CONFIG_SOFTMMU=y" >> $config_target_mak 7827 if test "$mttcg" = "yes" ; then 7828 echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak 7829 fi 7830fi 7831if test "$target_user_only" = "yes" ; then 7832 echo "CONFIG_USER_ONLY=y" >> $config_target_mak 7833 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 7834 symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" 7835else 7836 symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" 7837fi 7838if test "$target_linux_user" = "yes" ; then 7839 echo "CONFIG_LINUX_USER=y" >> $config_target_mak 7840fi 7841list="" 7842if test ! -z "$gdb_xml_files" ; then 7843 for x in $gdb_xml_files; do 7844 list="$list gdb-xml/$x" 7845 done 7846 echo "TARGET_XML_FILES=$list" >> $config_target_mak 7847fi 7848 7849if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then 7850 echo "TARGET_HAS_BFLT=y" >> $config_target_mak 7851fi 7852if test "$target_bsd_user" = "yes" ; then 7853 echo "CONFIG_BSD_USER=y" >> $config_target_mak 7854fi 7855 7856done # for target in $targets 7857 7858if [ "$fdt" = "git" ]; then 7859 subdirs="$subdirs dtc" 7860fi 7861if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then 7862 subdirs="$subdirs capstone" 7863fi 7864echo "SUBDIRS=$subdirs" >> $config_host_mak 7865if test -n "$LIBCAPSTONE"; then 7866 echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak 7867fi 7868 7869if test "$numa" = "yes"; then 7870 echo "CONFIG_NUMA=y" >> $config_host_mak 7871 echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 7872fi 7873 7874if test "$ccache_cpp2" = "yes"; then 7875 echo "export CCACHE_CPP2=y" >> $config_host_mak 7876fi 7877 7878if test "$safe_stack" = "yes"; then 7879 echo "CONFIG_SAFESTACK=y" >> $config_host_mak 7880fi 7881 7882# If we're using a separate build tree, set it up now. 7883# DIRS are directories which we simply mkdir in the build tree; 7884# LINKS are things to symlink back into the source tree 7885# (these can be both files and directories). 7886# Caution: do not add files or directories here using wildcards. This 7887# will result in problems later if a new file matching the wildcard is 7888# added to the source tree -- nothing will cause configure to be rerun 7889# so the build tree will be missing the link back to the new file, and 7890# tests might fail. Prefer to keep the relevant files in their own 7891# directory and symlink the directory instead. 7892# UNLINK is used to remove symlinks from older development versions 7893# that might get into the way when doing "git update" without doing 7894# a "make distclean" in between. 7895DIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" 7896DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 7897DIRS="$DIRS docs docs/interop fsdev scsi" 7898DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 7899DIRS="$DIRS roms/seabios" 7900LINKS="Makefile" 7901LINKS="$LINKS tests/tcg/lm32/Makefile" 7902LINKS="$LINKS tests/tcg/Makefile.target" 7903LINKS="$LINKS pc-bios/optionrom/Makefile" 7904LINKS="$LINKS pc-bios/s390-ccw/Makefile" 7905LINKS="$LINKS roms/seabios/Makefile" 7906LINKS="$LINKS pc-bios/qemu-icon.bmp" 7907LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 7908LINKS="$LINKS tests/acceptance tests/data" 7909LINKS="$LINKS tests/qemu-iotests/check" 7910LINKS="$LINKS python" 7911UNLINK="pc-bios/keymaps" 7912for bios_file in \ 7913 $source_path/pc-bios/*.bin \ 7914 $source_path/pc-bios/*.elf \ 7915 $source_path/pc-bios/*.lid \ 7916 $source_path/pc-bios/*.rom \ 7917 $source_path/pc-bios/*.dtb \ 7918 $source_path/pc-bios/*.img \ 7919 $source_path/pc-bios/openbios-* \ 7920 $source_path/pc-bios/u-boot.* \ 7921 $source_path/pc-bios/edk2-*.fd.bz2 \ 7922 $source_path/pc-bios/palcode-* 7923do 7924 LINKS="$LINKS pc-bios/$(basename $bios_file)" 7925done 7926mkdir -p $DIRS 7927for f in $LINKS ; do 7928 if [ -e "$source_path/$f" ]; then 7929 symlink "$source_path/$f" "$f" 7930 fi 7931done 7932for f in $UNLINK ; do 7933 if [ -L "$f" ]; then 7934 rm -f "$f" 7935 fi 7936done 7937 7938(for i in $cross_cc_vars; do 7939 export $i 7940done 7941export target_list source_path use_containers 7942$source_path/tests/tcg/configure.sh) 7943 7944# temporary config to build submodules 7945for rom in seabios; do 7946 config_mak=roms/$rom/config.mak 7947 echo "# Automatically generated by configure - do not modify" > $config_mak 7948 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 7949 echo "AS=$as" >> $config_mak 7950 echo "CCAS=$ccas" >> $config_mak 7951 echo "CC=$cc" >> $config_mak 7952 echo "BCC=bcc" >> $config_mak 7953 echo "CPP=$cpp" >> $config_mak 7954 echo "OBJCOPY=objcopy" >> $config_mak 7955 echo "IASL=$iasl" >> $config_mak 7956 echo "LD=$ld" >> $config_mak 7957 echo "RANLIB=$ranlib" >> $config_mak 7958done 7959 7960# set up qemu-iotests in this build directory 7961iotests_common_env="tests/qemu-iotests/common.env" 7962 7963echo "# Automatically generated by configure - do not modify" > "$iotests_common_env" 7964echo >> "$iotests_common_env" 7965echo "export PYTHON='$python'" >> "$iotests_common_env" 7966 7967if test "$skip_meson" = no; then 7968cross="config-meson.cross.new" 7969meson_quote() { 7970 echo "['$(echo $* | sed "s/ /','/g")']" 7971} 7972 7973echo "# Automatically generated by configure - do not modify" > $cross 7974echo "[properties]" >> $cross 7975test -z "$cxx" && echo "link_language = 'c'" >> $cross 7976echo "[binaries]" >> $cross 7977echo "c = $(meson_quote $cc)" >> $cross 7978test -n "$cxx" && echo "cpp = $(meson_quote $cxx)" >> $cross 7979echo "ar = $(meson_quote $ar)" >> $cross 7980echo "nm = $(meson_quote $nm)" >> $cross 7981echo "pkgconfig = $(meson_quote $pkg_config_exe)" >> $cross 7982echo "ranlib = $(meson_quote $ranlib)" >> $cross 7983if has $sdl2_config; then 7984 echo "sdl2-config = $(meson_quote $sdl2_config)" >> $cross 7985fi 7986echo "strip = $(meson_quote $strip)" >> $cross 7987echo "windres = $(meson_quote $windres)" >> $cross 7988if test -n "$cross_prefix"; then 7989 cross_arg="--cross-file config-meson.cross" 7990 # Hack: Meson expects an absolute path for the *build* machine 7991 # for the prefix, so add a slash in front of a Windows path that 7992 # includes a drive letter. 7993 # 7994 # See https://github.com/mesonbuild/meson/issues/7577. 7995 echo "[host_machine]" >> $cross 7996 if test "$mingw32" = "yes" ; then 7997 echo "system = 'windows'" >> $cross 7998 case $prefix in 7999 ?:*) pre_prefix=/ ;; 8000 esac 8001 fi 8002 if test "$linux" = "yes" ; then 8003 echo "system = 'linux'" >> $cross 8004 fi 8005 case "$ARCH" in 8006 i386|x86_64) 8007 echo "cpu_family = 'x86'" >> $cross 8008 ;; 8009 ppc64le) 8010 echo "cpu_family = 'ppc64'" >> $cross 8011 ;; 8012 *) 8013 echo "cpu_family = '$ARCH'" >> $cross 8014 ;; 8015 esac 8016 echo "cpu = '$cpu'" >> $cross 8017 if test "$bigendian" = "yes" ; then 8018 echo "endian = 'big'" >> $cross 8019 else 8020 echo "endian = 'little'" >> $cross 8021 fi 8022else 8023 cross_arg="--native-file config-meson.cross" 8024fi 8025mv $cross config-meson.cross 8026 8027rm -rf meson-private meson-info meson-logs 8028NINJA=${ninja:-$PWD/ninjatool} $meson setup \ 8029 --prefix "${pre_prefix}$prefix" \ 8030 --libdir "${pre_prefix}$libdir" \ 8031 --libexecdir "${pre_prefix}$libexecdir" \ 8032 --bindir "${pre_prefix}$bindir" \ 8033 --includedir "${pre_prefix}$includedir" \ 8034 --datadir "${pre_prefix}$datadir" \ 8035 --mandir "${pre_prefix}$mandir" \ 8036 --sysconfdir "${pre_prefix}$sysconfdir" \ 8037 --localstatedir "${pre_prefix}$local_statedir" \ 8038 -Ddocdir="${pre_prefix}$docdir" \ 8039 -Dqemu_suffix="$qemu_suffix" \ 8040 -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 8041 -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 8042 -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 8043 -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 8044 -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 8045 -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 8046 -Dsdl=$sdl -Dsdl_image=$sdl_image \ 8047 -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ 8048 -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\ 8049 $cross_arg \ 8050 "$PWD" "$source_path" 8051 8052if test "$?" -ne 0 ; then 8053 error_exit "meson setup failed" 8054fi 8055touch ninjatool.stamp 8056fi 8057 8058# Save the configure command line for later reuse. 8059cat <<EOD >config.status 8060#!/bin/sh 8061# Generated by configure. 8062# Run this file to recreate the current configuration. 8063# Compiler output produced by configure, useful for debugging 8064# configure, is in config.log if it exists. 8065EOD 8066 8067preserve_env() { 8068 envname=$1 8069 8070 eval envval=\$$envname 8071 8072 if test -n "$envval" 8073 then 8074 echo "$envname='$envval'" >> config.status 8075 echo "export $envname" >> config.status 8076 else 8077 echo "unset $envname" >> config.status 8078 fi 8079} 8080 8081# Preserve various env variables that influence what 8082# features/build target configure will detect 8083preserve_env AR 8084preserve_env AS 8085preserve_env CC 8086preserve_env CPP 8087preserve_env CXX 8088preserve_env INSTALL 8089preserve_env LD 8090preserve_env LD_LIBRARY_PATH 8091preserve_env LIBTOOL 8092preserve_env MAKE 8093preserve_env NM 8094preserve_env OBJCOPY 8095preserve_env PATH 8096preserve_env PKG_CONFIG 8097preserve_env PKG_CONFIG_LIBDIR 8098preserve_env PKG_CONFIG_PATH 8099preserve_env PYTHON 8100preserve_env SDL2_CONFIG 8101preserve_env SMBD 8102preserve_env STRIP 8103preserve_env WINDRES 8104 8105printf "exec" >>config.status 8106for i in "$0" "$@"; do 8107 test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status 8108done 8109echo ' "$@"' >>config.status 8110chmod +x config.status 8111 8112rm -r "$TMPDIR1" 8113