17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 58cd05ab6SPeter Maydell 699519e67SCornelia Huck# Unset some variables known to interfere with behavior of common tools, 799519e67SCornelia Huck# just as autoconf does. 899519e67SCornelia HuckCLICOLOR_FORCE= GREP_OPTIONS= 999519e67SCornelia Huckunset CLICOLOR_FORCE GREP_OPTIONS 1099519e67SCornelia Huck 115e4dfd3dSJohn Snow# Don't allow CCACHE, if present, to use cached results of compile tests! 125e4dfd3dSJohn Snowexport CCACHE_RECACHE=yes 135e4dfd3dSJohn Snow 14dedad027SDaniel P. Berrangé# make source path absolute 15dedad027SDaniel P. Berrangésource_path=$(cd "$(dirname -- "$0")"; pwd) 16dedad027SDaniel P. Berrangé 17dedad027SDaniel P. Berrangéif test "$PWD" = "$source_path" 18dedad027SDaniel P. Berrangéthen 19dedad027SDaniel P. Berrangé echo "Using './build' as the directory for build output" 20dedad027SDaniel P. Berrangé 21dedad027SDaniel P. Berrangé MARKER=build/auto-created-by-configure 22dedad027SDaniel P. Berrangé 23dedad027SDaniel P. Berrangé if test -e build 24dedad027SDaniel P. Berrangé then 25dedad027SDaniel P. Berrangé if test -f $MARKER 26dedad027SDaniel P. Berrangé then 27dedad027SDaniel P. Berrangé rm -rf build 28dedad027SDaniel P. Berrangé else 29dedad027SDaniel P. Berrangé echo "ERROR: ./build dir already exists and was not previously created by configure" 30dedad027SDaniel P. Berrangé exit 1 31dedad027SDaniel P. Berrangé fi 32dedad027SDaniel P. Berrangé fi 33dedad027SDaniel P. Berrangé 34dedad027SDaniel P. Berrangé mkdir build 35dedad027SDaniel P. Berrangé touch $MARKER 36dedad027SDaniel P. Berrangé 37dedad027SDaniel P. Berrangé cat > GNUmakefile <<'EOF' 38dedad027SDaniel P. Berrangé# This file is auto-generated by configure to support in-source tree 39dedad027SDaniel P. Berrangé# 'make' command invocation 40dedad027SDaniel P. Berrangé 41dedad027SDaniel P. Berrangéifeq ($(MAKECMDGOALS),) 42dedad027SDaniel P. Berrangérecurse: all 43dedad027SDaniel P. Berrangéendif 44dedad027SDaniel P. Berrangé 45dedad027SDaniel P. Berrangé.NOTPARALLEL: % 46dedad027SDaniel P. Berrangé%: force 47dedad027SDaniel P. Berrangé @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...' 48dedad027SDaniel P. Berrangé @$(MAKE) -C build -f Makefile $(MAKECMDGOALS) 49dedad027SDaniel P. Berrangé @if test "$(MAKECMDGOALS)" = "distclean" && \ 50dedad027SDaniel P. Berrangé test -e build/auto-created-by-configure ; \ 51dedad027SDaniel P. Berrangé then \ 52dedad027SDaniel P. Berrangé rm -rf build GNUmakefile ; \ 53dedad027SDaniel P. Berrangé fi 54dedad027SDaniel P. Berrangéforce: ; 55dedad027SDaniel P. Berrangé.PHONY: force 56dedad027SDaniel P. BerrangéGNUmakefile: ; 57dedad027SDaniel P. Berrangé 58dedad027SDaniel P. BerrangéEOF 59dedad027SDaniel P. Berrangé cd build 60dedad027SDaniel P. Berrangé exec $source_path/configure "$@" 61dedad027SDaniel P. Berrangéfi 62dedad027SDaniel P. Berrangé 638cd05ab6SPeter Maydell# Temporary directory used for files created while 648cd05ab6SPeter Maydell# configure runs. Since it is in the build directory 658cd05ab6SPeter Maydell# we can safely blow away any previous version of it 668cd05ab6SPeter Maydell# (and we need not jump through hoops to try to delete 678cd05ab6SPeter Maydell# it when configure exits.) 688cd05ab6SPeter MaydellTMPDIR1="config-temp" 698cd05ab6SPeter Maydellrm -rf "${TMPDIR1}" 708cd05ab6SPeter Maydellmkdir -p "${TMPDIR1}" 718cd05ab6SPeter Maydellif [ $? -ne 0 ]; then 728cd05ab6SPeter Maydell echo "ERROR: failed to create temporary directory" 738cd05ab6SPeter Maydell exit 1 747d13299dSbellardfi 757d13299dSbellard 768cd05ab6SPeter MaydellTMPB="qemu-conf" 778cd05ab6SPeter MaydellTMPC="${TMPDIR1}/${TMPB}.c" 7866518bf6SDon SlutzTMPO="${TMPDIR1}/${TMPB}.o" 799c83ffd8SPeter MaydellTMPCXX="${TMPDIR1}/${TMPB}.cxx" 808cd05ab6SPeter MaydellTMPE="${TMPDIR1}/${TMPB}.exe" 8126fffe29SEmilio G. CotaTMPTXT="${TMPDIR1}/${TMPB}.txt" 827d13299dSbellard 83da1d85e3SGerd Hoffmannrm -f config.log 849ac81bbbSmalc 85b48e3611SPeter Maydell# Print a helpful header at the top of config.log 86b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 87979ae168SPeter Maydellprintf "# Configured with:" >> config.log 88979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 89979ae168SPeter Maydellecho >> config.log 90b48e3611SPeter Maydellecho "#" >> config.log 91b48e3611SPeter Maydell 92835af899SPaolo Bonziniquote_sh() { 93835af899SPaolo Bonzini printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," 94835af899SPaolo Bonzini} 95835af899SPaolo Bonzini 96d880a3baSPaolo Bonziniprint_error() { 97d880a3baSPaolo Bonzini (echo 9876ad07a4SPeter Maydell echo "ERROR: $1" 9976ad07a4SPeter Maydell while test -n "$2"; do 10076ad07a4SPeter Maydell echo " $2" 10176ad07a4SPeter Maydell shift 10276ad07a4SPeter Maydell done 103d880a3baSPaolo Bonzini echo) >&2 104d880a3baSPaolo Bonzini} 105d880a3baSPaolo Bonzini 106d880a3baSPaolo Bonzinierror_exit() { 107d880a3baSPaolo Bonzini print_error "$@" 10876ad07a4SPeter Maydell exit 1 10976ad07a4SPeter Maydell} 11076ad07a4SPeter Maydell 1119c83ffd8SPeter Maydelldo_compiler() { 1129c83ffd8SPeter Maydell # Run the compiler, capturing its output to the log. First argument 1139c83ffd8SPeter Maydell # is compiler binary to execute. 114630d86b7SDavid CARLIER compiler="$1" 1159c83ffd8SPeter Maydell shift 1168bbe05d7SIan Jackson if test -n "$BASH_VERSION"; then eval ' 1178bbe05d7SIan Jackson echo >>config.log " 1188bbe05d7SIan Jacksonfuncs: ${FUNCNAME[*]} 1198bbe05d7SIan Jacksonlines: ${BASH_LINENO[*]}" 1208bbe05d7SIan Jackson '; fi 1219c83ffd8SPeter Maydell echo $compiler "$@" >> config.log 1229c83ffd8SPeter Maydell $compiler "$@" >> config.log 2>&1 || return $? 1238dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 1248dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 1258dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 1268dc38a78SPeter Maydell # obvious to developers. 1278dc38a78SPeter Maydell if test "$werror" != "yes"; then 1288dc38a78SPeter Maydell return 0 1298dc38a78SPeter Maydell fi 1308dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 1318dc38a78SPeter Maydell case "$*" in 1328dc38a78SPeter Maydell *-Werror*) 1338dc38a78SPeter Maydell return 0 1348dc38a78SPeter Maydell ;; 1358dc38a78SPeter Maydell esac 1369c83ffd8SPeter Maydell echo $compiler -Werror "$@" >> config.log 1379c83ffd8SPeter Maydell $compiler -Werror "$@" >> config.log 2>&1 && return $? 13876ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 13976ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 14076ad07a4SPeter Maydell "will be at the bottom of config.log." \ 14176ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 1428dc38a78SPeter Maydell} 1438dc38a78SPeter Maydell 1449c83ffd8SPeter Maydelldo_cc() { 1454dba2789SPaolo Bonzini do_compiler "$cc" $CPU_CFLAGS "$@" 1469c83ffd8SPeter Maydell} 1479c83ffd8SPeter Maydell 1489c83ffd8SPeter Maydelldo_cxx() { 1494dba2789SPaolo Bonzini do_compiler "$cxx" $CPU_CFLAGS "$@" 1509c83ffd8SPeter Maydell} 1519c83ffd8SPeter Maydell 15200849b92SRichard Henderson# Append $2 to the variable named $1, with space separation 15300849b92SRichard Hendersonadd_to() { 15400849b92SRichard Henderson eval $1=\${$1:+\"\$$1 \"}\$2 15500849b92SRichard Henderson} 15600849b92SRichard Henderson 1579c83ffd8SPeter Maydellupdate_cxxflags() { 1589c83ffd8SPeter Maydell # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 1599c83ffd8SPeter Maydell # options which some versions of GCC's C++ compiler complain about 1609c83ffd8SPeter Maydell # because they only make sense for C programs. 16153422040SPaolo Bonzini QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 1628a9d3d56SRichard Henderson CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu11/-std=gnu++11/) 1639c83ffd8SPeter Maydell for arg in $QEMU_CFLAGS; do 1649c83ffd8SPeter Maydell case $arg in 1659c83ffd8SPeter Maydell -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 1669c83ffd8SPeter Maydell -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 1679c83ffd8SPeter Maydell ;; 1689c83ffd8SPeter Maydell *) 1699c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1709c83ffd8SPeter Maydell ;; 1719c83ffd8SPeter Maydell esac 1729c83ffd8SPeter Maydell done 1739c83ffd8SPeter Maydell} 1749c83ffd8SPeter Maydell 17552166aa0SJuan Quintelacompile_object() { 176fd0e6053SJohn Snow local_cflags="$1" 1775770e8afSPaolo Bonzini do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 17852166aa0SJuan Quintela} 17952166aa0SJuan Quintela 18052166aa0SJuan Quintelacompile_prog() { 18152166aa0SJuan Quintela local_cflags="$1" 18252166aa0SJuan Quintela local_ldflags="$2" 1835770e8afSPaolo Bonzini do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \ 1845770e8afSPaolo Bonzini $LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags 18552166aa0SJuan Quintela} 18652166aa0SJuan Quintela 18711568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 18811568d6dSPaolo Bonzinisymlink() { 18972b8b5a1SStefan Weil rm -rf "$2" 190ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 19172b8b5a1SStefan Weil ln -s "$1" "$2" 19211568d6dSPaolo Bonzini} 19311568d6dSPaolo Bonzini 1940dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1950dba6195SLoïc Minier# executable or a builtin) 1960dba6195SLoïc Minierhas() { 1970dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1980dba6195SLoïc Minier} 1990dba6195SLoïc Minier 2000a01d76fSMarc-André Lureauversion_ge () { 2012df52b9bSAlex Bennée local_ver1=$(expr "$1" : '\([0-9.]*\)' | tr . ' ') 2022df52b9bSAlex Bennée local_ver2=$(echo "$2" | tr . ' ') 2030a01d76fSMarc-André Lureau while true; do 2040a01d76fSMarc-André Lureau set x $local_ver1 2050a01d76fSMarc-André Lureau local_first=${2-0} 206c44a33e2SStefano Garzarella # 'shift 2' if $2 is set, or 'shift' if $2 is not set 207c44a33e2SStefano Garzarella shift ${2:+2} 2080a01d76fSMarc-André Lureau local_ver1=$* 2090a01d76fSMarc-André Lureau set x $local_ver2 2100a01d76fSMarc-André Lureau # the second argument finished, the first must be greater or equal 2110a01d76fSMarc-André Lureau test $# = 1 && return 0 2120a01d76fSMarc-André Lureau test $local_first -lt $2 && return 1 2130a01d76fSMarc-André Lureau test $local_first -gt $2 && return 0 214c44a33e2SStefano Garzarella shift ${2:+2} 2150a01d76fSMarc-André Lureau local_ver2=$* 2160a01d76fSMarc-André Lureau done 2170a01d76fSMarc-André Lureau} 2180a01d76fSMarc-André Lureau 2193b6b7550SPaolo Bonziniglob() { 2203b6b7550SPaolo Bonzini eval test -z '"${1#'"$2"'}"' 2213b6b7550SPaolo Bonzini} 2223b6b7550SPaolo Bonzini 223e9a3591fSChristian Borntraegerld_has() { 224e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 225e9a3591fSChristian Borntraeger} 226e9a3591fSChristian Borntraeger 2274ace32e2SAntonio Ospiteif printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 2284ace32e2SAntonio Ospitethen 2294ace32e2SAntonio Ospite error_exit "main directory cannot contain spaces nor colons" 2304ace32e2SAntonio Ospitefi 2314ace32e2SAntonio Ospite 23214211825SAntonio Ospite# default parameters 2332ff6b91eSJuan Quintelacpu="" 234a31a8642SMichael S. Tsirkiniasl="iasl" 2351e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 23643ce4dfeSbellardstatic="no" 2373812c0c4SJoelle van Dynecross_compile="no" 2387d13299dSbellardcross_prefix="" 23987430d5bSPaolo Bonziniaudio_drv_list="default" 240b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 241b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 242e5f05f8cSKevin Wolfblock_drv_whitelist_tools="no" 243e49d021eSPeter Maydellhost_cc="cc" 244957f1f99SMichael Rothlibs_qga="" 2455bc62e01SGerd Hoffmanndebug_info="yes" 246cdad781dSDaniele Buonolto="false" 24763678e17SSteven Noonanstack_protector="" 2481e4f6065SDaniele Buonosafe_stack="" 249afc3a8f9SAlex Bennéeuse_containers="yes" 250f2385398SAlex Bennéegdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 251ac0df51dSaliguori 25292712822SDaniel P. Berrangeif test -e "$source_path/.git" 25392712822SDaniel P. Berrangethen 2547d7dbf9dSDan Streetman git_submodules_action="update" 25592712822SDaniel P. Berrangeelse 2567d7dbf9dSDan Streetman git_submodules_action="ignore" 25792712822SDaniel P. Berrangefi 2582d652f24SPaolo Bonzini 2592d652f24SPaolo Bonzinigit_submodules="ui/keycodemapdb" 260cc84d63aSDaniel P. Berrangegit="git" 261ac0df51dSaliguori 262afb63ebdSStefan Weil# Don't accept a target_list environment variable. 263afb63ebdSStefan Weilunset target_list 264447e133fSAlex Bennéeunset target_list_exclude 265377529c0SPaolo Bonzini 266377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 267377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 268377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 269377529c0SPaolo Bonzini# unless --disable-foo is given 270377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 271377529c0SPaolo Bonzini# feature will searched for, 272377529c0SPaolo Bonzini# if not found, configure exits with error 273377529c0SPaolo Bonzini# 274377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 275377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 276377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 277377529c0SPaolo Bonzini 278c87ea116SAlex Bennéedefault_feature="" 279c87ea116SAlex Bennée# parse CC options second 280c87ea116SAlex Bennéefor opt do 281c87ea116SAlex Bennée optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 282c87ea116SAlex Bennée case "$opt" in 283c87ea116SAlex Bennée --without-default-features) 284c87ea116SAlex Bennée default_feature="no" 285c87ea116SAlex Bennée ;; 286c87ea116SAlex Bennée esac 287c87ea116SAlex Bennéedone 288c87ea116SAlex Bennée 2898c6d4ff4SPaolo Bonzinibrlapi="auto" 290f9cd86feSPaolo Bonzinicurl="auto" 2915285e593SYonggang Luoiconv="auto" 2925285e593SYonggang Luocurses="auto" 293e3667660SYonggang Luodocs="auto" 294fbb4121dSPaolo Bonzinifdt="auto" 295837b84b1SPaolo Bonzininetmap="auto" 29635be72baSPaolo Bonzinisdl="auto" 29735be72baSPaolo Bonzinisdl_image="auto" 298cece116cSMisono Tomohirovirtiofsd="auto" 29969202b40SPaolo Bonzinivirtfs="auto" 3005c53015aSPaolo Bonzinilibudev="auto" 3016ec0e15dSPaolo Bonzinimpath="auto" 3023a6a1256SThomas Huthvnc="auto" 303deb62371SPaolo Bonzinisparse="auto" 304e1723999SPaolo Bonzinivde="auto" 305a0b93237SPaolo Bonzinivnc_sasl="auto" 306a0b93237SPaolo Bonzinivnc_jpeg="auto" 307a0b93237SPaolo Bonzinivnc_png="auto" 3084113f4cfSLaurent Vivierxkbcommon="auto" 309ca50e523SPaolo Bonzinialsa="auto" 310ca50e523SPaolo Bonzinicoreaudio="auto" 311ca50e523SPaolo Bonzinidsound="auto" 312ca50e523SPaolo Bonzinijack="auto" 313ca50e523SPaolo Bonzinioss="auto" 314ca50e523SPaolo Bonzinipa="auto" 315bcf0a7daSThomas Huthxen=${default_feature:+disabled} 316c87ea116SAlex Bennéexen_ctrl_version="$default_feature" 3171badb709SPaolo Bonzinixen_pci_passthrough="auto" 318ff66f3e5SPaolo Bonzinilinux_aio="auto" 31953c22b68SPaolo Bonzinilinux_io_uring="auto" 320727c8bb8SPaolo Bonzinicap_ng="auto" 321f7f2d651SPaolo Bonziniattr="auto" 322c87ea116SAlex Bennéexfs="$default_feature" 3231badb709SPaolo Bonzinitcg="enabled" 324c87ea116SAlex Bennéemembarrier="$default_feature" 3250848f8acSThomas Huthvhost_kernel="$default_feature" 326c87ea116SAlex Bennéevhost_net="$default_feature" 327c87ea116SAlex Bennéevhost_crypto="$default_feature" 328c87ea116SAlex Bennéevhost_scsi="$default_feature" 329c87ea116SAlex Bennéevhost_vsock="$default_feature" 330d88618f7SStefan Hajnoczivhost_user="no" 331e5e856c1SStefan Hajnoczivhost_user_blk_server="auto" 332c87ea116SAlex Bennéevhost_user_fs="$default_feature" 3330848f8acSThomas Huthvhost_vdpa="$default_feature" 33446627f41SAndrew Melnychenkobpf="auto" 3353bd40ec7SPaolo Bonzinikvm="auto" 3363bd40ec7SPaolo Bonzinihax="auto" 3373bd40ec7SPaolo Bonzinihvf="auto" 3383bd40ec7SPaolo Bonziniwhpx="auto" 33974a414a1SReinoud Zandijknvmm="auto" 340c87ea116SAlex Bennéerdma="$default_feature" 341c87ea116SAlex Bennéepvrdma="$default_feature" 342377529c0SPaolo Bonzinigprof="no" 343377529c0SPaolo Bonzinidebug_tcg="no" 344377529c0SPaolo Bonzinidebug="no" 345247724cbSMarc-André Lureausanitizers="no" 3460aebab04SLingfeng Yangtsan="no" 347c87ea116SAlex Bennéefortify_source="$default_feature" 348377529c0SPaolo Bonzinistrip_opt="yes" 34923a77b2dSPaolo Bonzinitcg_interpreter="false" 350377529c0SPaolo Bonzinimingw32="no" 3511d728c39SBlue Swirlgcov="no" 352c7328271SMiroslav RezaninaEXESUF="" 35317969268SFam Zhengmodules="no" 354bd83c861SChristian Ehrhardtmodule_upgrades="no" 355377529c0SPaolo Bonziniprefix="/usr/local" 35610ff82d1SMarc-André Lureauqemu_suffix="qemu" 3574d34a86bSPaolo Bonzinislirp="auto" 358377529c0SPaolo Bonzinibsd="no" 359377529c0SPaolo Bonzinilinux="no" 360377529c0SPaolo Bonzinisolaris="no" 361377529c0SPaolo Bonziniprofiler="no" 362b4e312e9SPaolo Bonzinicocoa="auto" 363377529c0SPaolo Bonzinisoftmmu="yes" 364377529c0SPaolo Bonzinilinux_user="no" 365377529c0SPaolo Bonzinibsd_user="no" 366c8d5450bSPaolo Bonziniblobs="true" 367377529c0SPaolo Bonzinipkgversion="" 36840d6444eSAvi Kivitypie="" 3693556c233SPaolo Bonziniqom_cast_debug="yes" 370baf86d6bSPaolo Bonzinitrace_backends="log" 371377529c0SPaolo Bonzinitrace_file="trace" 3723f0a5d55SMarc-André Lureauspice="auto" 37358d3f3ffSGerd Hoffmannspice_protocol="auto" 374fabd1e93SPaolo Bonzinirbd="auto" 3755f364c57SPaolo Bonzinismartcard="auto" 3760a40bcb7SCésar Belleyu2f="auto" 37790540f32SPaolo Bonzinilibusb="auto" 37818f31e60SPaolo Bonziniusb_redir="auto" 379c87ea116SAlex Bennéeopengl="$default_feature" 3805dd89908SRichard Hendersoncpuid_h="no" 381c87ea116SAlex Bennéeavx2_opt="$default_feature" 3828b18cdbfSRichard Hendersoncapstone="auto" 3830c32a0aeSPaolo Bonzinilzo="auto" 384241611eaSPaolo Bonzinisnappy="auto" 38529ba6116SPaolo Bonzinibzip2="auto" 386ecea3696SPaolo Bonzinilzfse="auto" 387b1def33dSPaolo Bonzinizstd="auto" 388c87ea116SAlex Bennéeguest_agent="$default_feature" 389d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 39050cbebb9SMichael Rothguest_agent_ntddscsi="no" 391b846ab7cSPaolo Bonziniguest_agent_msi="auto" 392c87ea116SAlex Bennéevss_win32_sdk="$default_feature" 393d9840e25STomoki Sekiyamawin_sdk="no" 394c87ea116SAlex Bennéewant_tools="$default_feature" 3959db405a3SPaolo Bonzinilibiscsi="auto" 39630045c05SPaolo Bonzinilibnfs="auto" 397519175a2SAlex Barcelocoroutine="" 398c87ea116SAlex Bennéecoroutine_pool="$default_feature" 3997d992e4dSPeter Lievendebug_stack_usage="no" 400f0d92b56SLongpeng(Mike)crypto_afalg="no" 4019e62ba48SDaniele Buonocfi="false" 4029e62ba48SDaniele Buonocfi_debug="false" 40390835c2bSPaolo Bonziniseccomp="auto" 40408821ca2SPaolo Bonziniglusterfs="auto" 4051b695471SPaolo Bonzinigtk="auto" 406a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 40757612511SPaolo Bonzinignutls="auto" 40857612511SPaolo Bonzininettle="auto" 40957612511SPaolo Bonzinigcrypt="auto" 41005e391aeSPaolo Bonziniauth_pam="auto" 411c23d7b4eSPaolo Bonzinivte="auto" 412587d59d6SPaolo Bonzinivirglrenderer="auto" 413c87ea116SAlex Bennéetpm="$default_feature" 414c87ea116SAlex Bennéelibssh="$default_feature" 415c87ea116SAlex Bennéelive_block_migration=${default_feature:-yes} 416c87ea116SAlex Bennéenuma="$default_feature" 4172847b469SFam Zhengtcmalloc="no" 4187b01cb97SAlexandre Derumierjemalloc="no" 419c87ea116SAlex Bennéereplication=${default_feature:-yes} 420c87ea116SAlex Bennéebochs=${default_feature:-yes} 421c87ea116SAlex Bennéecloop=${default_feature:-yes} 422c87ea116SAlex Bennéedmg=${default_feature:-yes} 423c87ea116SAlex Bennéeqcow1=${default_feature:-yes} 424c87ea116SAlex Bennéevdi=${default_feature:-yes} 425c87ea116SAlex Bennéevvfat=${default_feature:-yes} 426c87ea116SAlex Bennéeqed=${default_feature:-yes} 427c87ea116SAlex Bennéeparallels=${default_feature:-yes} 428c5b36c25SPaolo Bonzinilibxml2="auto" 429ba59fb77SPaolo Bonzinidebug_mutex="no" 430e36e8c70SPaolo Bonzinilibpmem="auto" 4317bc3ca7fSPaolo Bonzinidefault_devices="true" 432ba4dd2aaSAlex Bennéeplugins="$default_feature" 433537b7248SPaolo Bonzinifuzzing="false" 434b767d257SMarek Marczykowski-Góreckirng_none="no" 435c87ea116SAlex Bennéesecret_keyring="$default_feature" 43683ef1682SPaolo Bonzinilibdaxctl="auto" 437a5665051SPaolo Bonzinimeson="" 43848328880SPaolo Bonzinininja="" 439a5665051SPaolo Bonziniskip_meson=no 4400e8e77d4SAlex Bennéegettext="auto" 441a484a719SMax Reitzfuse="auto" 442df4ea709SMax Reitzfuse_lseek="auto" 443106ad1f9SPaolo Bonzinimultiprocess="auto" 444b8e0c493SJoelle van Dyneslirp_smbd="$default_feature" 445377529c0SPaolo Bonzini 446aa087962SPaolo Bonzinimalloc_trim="auto" 44720cf7b8eSDenis Plotnikovgio="$default_feature" 448898be3e0SPeter Maydell 449c87ea116SAlex Bennée# parse CC options second 450ac0df51dSaliguorifor opt do 45189138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 452ac0df51dSaliguori case "$opt" in 453ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 4543812c0c4SJoelle van Dyne cross_compile="yes" 455ac0df51dSaliguori ;; 4563d8df640SPaolo Bonzini --cc=*) CC="$optarg" 457ac0df51dSaliguori ;; 45883f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 45983f73fceSTomoki Sekiyama ;; 4602ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 4612ff6b91eSJuan Quintela ;; 462de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 463db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 464e2a2ed06SJuan Quintela ;; 46511cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 46611cde1c8SBruno Dominguez ;; 467db5adeaaSPaolo Bonzini --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 468f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 469e2a2ed06SJuan Quintela ;; 4705bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 4715bc62e01SGerd Hoffmann ;; 4725bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 4735bc62e01SGerd Hoffmann ;; 474d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 475d75402b5SAlex Bennée ;; 476d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 477d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 4782038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 479d422b2bcSAlex Bennée ;; 480d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 4812038f8c8SPaolo Bonzini cc_archs="$cc_archs $cc_arch" 482d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 4832038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 484d75402b5SAlex Bennée ;; 485ac0df51dSaliguori esac 486ac0df51dSaliguoridone 487ac0df51dSaliguori# OS specific 488ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 48993148aa5SStefan Weil# we can eliminate its usage altogether. 490ac0df51dSaliguori 491e49d021eSPeter Maydell# Preferred compiler: 492e49d021eSPeter Maydell# ${CC} (if set) 493e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 494e49d021eSPeter Maydell# system compiler 495e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 496e49d021eSPeter Maydell cc="$host_cc" 497e49d021eSPeter Maydellelse 498b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 499e49d021eSPeter Maydellfi 500e49d021eSPeter Maydell 50183f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 50283f73fceSTomoki Sekiyama cxx="c++" 50383f73fceSTomoki Sekiyamaelse 50483f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 50583f73fceSTomoki Sekiyamafi 50683f73fceSTomoki Sekiyama 507b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 508cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 5095f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 5103dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 511b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 512b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 5139f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 5144852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 515b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 516b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 51717884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 51817884d7bSSergei Trofimovichquery_pkg_config() { 51917884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 52017884d7bSSergei Trofimovich} 52117884d7bSSergei Trofimovichpkg_config=query_pkg_config 52247c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 523ac0df51dSaliguori 524be17dc90SMichael S. Tsirkin# default flags for all hosts 5252d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 5262d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 5272d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 5282d31515bSPeter Maydell# provides these semantics.) 529086d5f75SPaolo BonziniQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 530086d5f75SPaolo BonziniQEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 531c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 532be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 5335770e8afSPaolo Bonzini 5345770e8afSPaolo Bonzini# Flags that are needed during configure but later taken care of by Meson 5358a9d3d56SRichard HendersonCONFIGURE_CFLAGS="-std=gnu11 -Wall" 5365770e8afSPaolo BonziniCONFIGURE_LDFLAGS= 537086d5f75SPaolo Bonzini 538be17dc90SMichael S. Tsirkin 539ac0df51dSaliguoricheck_define() { 540ac0df51dSaliguoricat > $TMPC <<EOF 541ac0df51dSaliguori#if !defined($1) 542fd786e1aSPeter Maydell#error $1 not defined 543ac0df51dSaliguori#endif 544ac0df51dSaliguoriint main(void) { return 0; } 545ac0df51dSaliguoriEOF 54652166aa0SJuan Quintela compile_object 547ac0df51dSaliguori} 548ac0df51dSaliguori 549307119e7SGerd Hoffmanncheck_include() { 550307119e7SGerd Hoffmanncat > $TMPC <<EOF 551307119e7SGerd Hoffmann#include <$1> 552307119e7SGerd Hoffmannint main(void) { return 0; } 553307119e7SGerd HoffmannEOF 554307119e7SGerd Hoffmann compile_object 555307119e7SGerd Hoffmann} 556307119e7SGerd Hoffmann 55793b25869SJohn Snowwrite_c_skeleton() { 55893b25869SJohn Snow cat > $TMPC <<EOF 55993b25869SJohn Snowint main(void) { return 0; } 56093b25869SJohn SnowEOF 56193b25869SJohn Snow} 56293b25869SJohn Snow 563bbea4050SPeter Maydellif check_define __linux__ ; then 564bbea4050SPeter Maydell targetos="Linux" 565bbea4050SPeter Maydellelif check_define _WIN32 ; then 566bbea4050SPeter Maydell targetos='MINGW32' 567bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 568bbea4050SPeter Maydell targetos='OpenBSD' 569bbea4050SPeter Maydellelif check_define __sun__ ; then 570bbea4050SPeter Maydell targetos='SunOS' 571bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 572bbea4050SPeter Maydell targetos='Haiku' 573951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 574951fedfcSPeter Maydell targetos='FreeBSD' 575951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 576951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 577951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 578951fedfcSPeter Maydell targetos='DragonFly' 579951fedfcSPeter Maydellelif check_define __NetBSD__; then 580951fedfcSPeter Maydell targetos='NetBSD' 581951fedfcSPeter Maydellelif check_define __APPLE__; then 582951fedfcSPeter Maydell targetos='Darwin' 583bbea4050SPeter Maydellelse 584951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 585951fedfcSPeter Maydell # might be going to just print the --help text, or it might 586951fedfcSPeter Maydell # be the result of a missing compiler. 587951fedfcSPeter Maydell targetos='bogus' 588bbea4050SPeter Maydellfi 589bbea4050SPeter Maydell 590bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 591bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 592bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 593bbea4050SPeter Maydell# the correct CPU with the --cpu option. 594bbea4050SPeter Maydellcase $targetos in 595bbea4050SPeter MaydellSunOS) 59689138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 597bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 598bbea4050SPeter Maydell cpu="x86_64" 599bbea4050SPeter Maydell fi 600bbea4050SPeter Maydellesac 601bbea4050SPeter Maydell 6022ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 6032ff6b91eSJuan Quintela # command line argument 6042ff6b91eSJuan Quintela : 6052ff6b91eSJuan Quintelaelif check_define __i386__ ; then 606ac0df51dSaliguori cpu="i386" 607ac0df51dSaliguorielif check_define __x86_64__ ; then 608c72b26ecSRichard Henderson if check_define __ILP32__ ; then 609c72b26ecSRichard Henderson cpu="x32" 610c72b26ecSRichard Henderson else 611ac0df51dSaliguori cpu="x86_64" 612c72b26ecSRichard Henderson fi 6133aa9bd6cSblueswir1elif check_define __sparc__ ; then 6143aa9bd6cSblueswir1 if check_define __arch64__ ; then 6153aa9bd6cSblueswir1 cpu="sparc64" 6163aa9bd6cSblueswir1 else 6173aa9bd6cSblueswir1 cpu="sparc" 6183aa9bd6cSblueswir1 fi 619fdf7ed96Smalcelif check_define _ARCH_PPC ; then 620fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 621f8378accSRichard Henderson if check_define _LITTLE_ENDIAN ; then 622f8378accSRichard Henderson cpu="ppc64le" 623f8378accSRichard Henderson else 624fdf7ed96Smalc cpu="ppc64" 625f8378accSRichard Henderson fi 626ac0df51dSaliguori else 627fdf7ed96Smalc cpu="ppc" 628fdf7ed96Smalc fi 629afa05235SAurelien Jarnoelif check_define __mips__ ; then 630afa05235SAurelien Jarno cpu="mips" 631d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 632d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 633d66ed0eaSAurelien Jarno cpu="s390x" 634d66ed0eaSAurelien Jarno else 635d66ed0eaSAurelien Jarno cpu="s390" 636d66ed0eaSAurelien Jarno fi 637c4f80543SAlistair Franciselif check_define __riscv ; then 638c4f80543SAlistair Francis if check_define _LP64 ; then 639c4f80543SAlistair Francis cpu="riscv64" 640c4f80543SAlistair Francis else 641c4f80543SAlistair Francis cpu="riscv32" 642c4f80543SAlistair Francis fi 64321d89f84SPeter Maydellelif check_define __arm__ ; then 64421d89f84SPeter Maydell cpu="arm" 6451f080313SClaudio Fontanaelif check_define __aarch64__ ; then 6461f080313SClaudio Fontana cpu="aarch64" 647fdf7ed96Smalcelse 64889138857SStefan Weil cpu=$(uname -m) 649ac0df51dSaliguorifi 650ac0df51dSaliguori 651359bc95dSPeter MaydellARCH= 652359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 653359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 6547d13299dSbellardcase "$cpu" in 655ee35e968SThomas Huth ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 656898be3e0SPeter Maydell ;; 657f8378accSRichard Henderson ppc64le) 658f8378accSRichard Henderson ARCH="ppc64" 659f8378accSRichard Henderson ;; 6607d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 66197a847bcSbellard cpu="i386" 6627d13299dSbellard ;; 663aaa5fa14Saurel32 x86_64|amd64) 664aaa5fa14Saurel32 cpu="x86_64" 665aaa5fa14Saurel32 ;; 66621d89f84SPeter Maydell armv*b|armv*l|arm) 66721d89f84SPeter Maydell cpu="arm" 6687d13299dSbellard ;; 6691f080313SClaudio Fontana aarch64) 6701f080313SClaudio Fontana cpu="aarch64" 6711f080313SClaudio Fontana ;; 672afa05235SAurelien Jarno mips*) 673afa05235SAurelien Jarno cpu="mips" 674afa05235SAurelien Jarno ;; 6753142255cSblueswir1 sparc|sun4[cdmuv]) 676ae228531Sbellard cpu="sparc" 677ae228531Sbellard ;; 6787d13299dSbellard *) 679359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 680359bc95dSPeter Maydell ARCH=unknown 6817d13299dSbellard ;; 6827d13299dSbellardesac 683359bc95dSPeter Maydellif test -z "$ARCH"; then 684359bc95dSPeter Maydell ARCH="$cpu" 685359bc95dSPeter Maydellfi 686e2d52ad3SJuan Quintela 6877d13299dSbellard# OS specific 6880dbfc675SJuan Quintela 6897d13299dSbellardcase $targetos in 69067b915a5SbellardMINGW32*) 69167b915a5Sbellard mingw32="yes" 692898be3e0SPeter Maydell supported_os="yes" 6939b8e4298SAlex Bennée plugins="no" 694fb648e9cSDaniel P. Berrangé pie="no" 69567b915a5Sbellard;; 6965c40d2bdSthsGNU/kFreeBSD) 697a167ba50SAurelien Jarno bsd="yes" 6985c40d2bdSths;; 6997d3505c5SbellardFreeBSD) 7007d3505c5Sbellard bsd="yes" 701e2a74729SWarner Losh bsd_user="yes" 7020db4a067SPaolo Bonzini make="${MAKE-gmake}" 703f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 7047d3505c5Sbellard;; 705c5e97233Sblueswir1DragonFly) 706c5e97233Sblueswir1 bsd="yes" 7070db4a067SPaolo Bonzini make="${MAKE-gmake}" 708c5e97233Sblueswir1;; 7097d3505c5SbellardNetBSD) 7107d3505c5Sbellard bsd="yes" 7110db4a067SPaolo Bonzini make="${MAKE-gmake}" 7127d3505c5Sbellard;; 7137d3505c5SbellardOpenBSD) 7147d3505c5Sbellard bsd="yes" 7150db4a067SPaolo Bonzini make="${MAKE-gmake}" 7167d3505c5Sbellard;; 71783fb7adfSbellardDarwin) 71883fb7adfSbellard bsd="yes" 71983fb7adfSbellard darwin="yes" 720a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 721a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 722a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 72383fb7adfSbellard;; 724ec530c81SbellardSunOS) 725ec530c81Sbellard solaris="yes" 7260db4a067SPaolo Bonzini make="${MAKE-gmake}" 727e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 728d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 729d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 730d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 731d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 732ec530c81Sbellard;; 733179cf400SAndreas FärberHaiku) 734179cf400SAndreas Färber haiku="yes" 735b8ee198dSRichard Zak pie="no" 736b8ee198dSRichard Zak QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" 737179cf400SAndreas Färber;; 738898be3e0SPeter MaydellLinux) 7395327cf48Sbellard linux="yes" 740831b7825Sths linux_user="yes" 741c87ea116SAlex Bennée vhost_user=${default_feature:-yes} 742898be3e0SPeter Maydell;; 7437d13299dSbellardesac 7447d13299dSbellard 7450db4a067SPaolo Bonzini: ${make=${MAKE-make}} 746b6daf4d3SPaolo Bonzini 747faf44142SDaniel P. Berrangé# We prefer python 3.x. A bare 'python' is traditionally 748faf44142SDaniel P. Berrangé# python 2.x, but some distros have it as python 3.x, so 749ddf90699SEduardo Habkost# we check that too 750faf44142SDaniel P. Berrangépython= 7510a01d76fSMarc-André Lureauexplicit_python=no 752ddf90699SEduardo Habkostfor binary in "${PYTHON-python3}" python 753faf44142SDaniel P. Berrangédo 754faf44142SDaniel P. Berrangé if has "$binary" 755faf44142SDaniel P. Berrangé then 75695c5f2deSPaolo Bonzini python=$(command -v "$binary") 757faf44142SDaniel P. Berrangé break 758faf44142SDaniel P. Berrangé fi 759faf44142SDaniel P. Berrangédone 760903458c8SMarkus Armbruster 761903458c8SMarkus Armbruster 76239d87c8cSAlex Bennée# Check for ancillary tools used in testing 76339d87c8cSAlex Bennéegenisoimage= 7643df437c7SAlex Bennéefor binary in genisoimage mkisofs 76539d87c8cSAlex Bennéedo 76639d87c8cSAlex Bennée if has $binary 76739d87c8cSAlex Bennée then 76839d87c8cSAlex Bennée genisoimage=$(command -v "$binary") 76939d87c8cSAlex Bennée break 77039d87c8cSAlex Bennée fi 77139d87c8cSAlex Bennéedone 77239d87c8cSAlex Bennée 7733c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 7743c4a4d0dSPeter Maydellif has clang; then 7753c4a4d0dSPeter Maydell objcc=clang 7763c4a4d0dSPeter Maydellelse 7773c4a4d0dSPeter Maydell objcc="$cc" 7783c4a4d0dSPeter Maydellfi 7793c4a4d0dSPeter Maydell 7803457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 7813457a3f8SJuan Quintela EXESUF=".exe" 78278e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 7835770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS" 78493b25869SJohn Snow write_c_skeleton; 785d17f305aSPaolo Bonzini prefix="/qemu" 78677433a5fSMarc-André Lureau qemu_suffix="" 787105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 7883457a3f8SJuan Quintelafi 7893457a3f8SJuan Quintela 790487fefdbSAnthony Liguoriwerror="" 79185aa5189Sbellard 792*61d63097SPaolo Bonzini. $source_path/scripts/meson-buildoptions.sh 793*61d63097SPaolo Bonzini 794*61d63097SPaolo Bonzinimeson_options= 795*61d63097SPaolo Bonzinimeson_option_parse() { 796*61d63097SPaolo Bonzini meson_options="$meson_options $(_meson_option_parse "$@")" 797*61d63097SPaolo Bonzini if test $? -eq 1; then 798*61d63097SPaolo Bonzini echo "ERROR: unknown option $1" 799*61d63097SPaolo Bonzini echo "Try '$0 --help' for more information" 800*61d63097SPaolo Bonzini exit 1 801*61d63097SPaolo Bonzini fi 802*61d63097SPaolo Bonzini} 803*61d63097SPaolo Bonzini 8047d13299dSbellardfor opt do 80589138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 8067d13299dSbellard case "$opt" in 8072efc3265Sbellard --help|-h) show_help=yes 8082efc3265Sbellard ;; 80999123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 81099123e13SMike Frysinger ;; 811b1a550a0Spbrook --prefix=*) prefix="$optarg" 8127d13299dSbellard ;; 813b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 81432ce6337Sbellard ;; 815ac0df51dSaliguori --cross-prefix=*) 8167d13299dSbellard ;; 817ac0df51dSaliguori --cc=*) 8187d13299dSbellard ;; 819b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 82083469015Sbellard ;; 82183f73fceSTomoki Sekiyama --cxx=*) 82283f73fceSTomoki Sekiyama ;; 823e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 824e007dbecSMichael S. Tsirkin ;; 8253c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 8263c4a4d0dSPeter Maydell ;; 827b1a550a0Spbrook --make=*) make="$optarg" 8287d13299dSbellard ;; 829b6daf4d3SPaolo Bonzini --install=*) 8306a882643Spbrook ;; 8310a01d76fSMarc-André Lureau --python=*) python="$optarg" ; explicit_python=yes 832c886edfbSBlue Swirl ;; 8332eb054c2SPeter Maydell --sphinx-build=*) sphinx_build="$optarg" 8342eb054c2SPeter Maydell ;; 835a5665051SPaolo Bonzini --skip-meson) skip_meson=yes 836a5665051SPaolo Bonzini ;; 837a5665051SPaolo Bonzini --meson=*) meson="$optarg" 838a5665051SPaolo Bonzini ;; 83948328880SPaolo Bonzini --ninja=*) ninja="$optarg" 84048328880SPaolo Bonzini ;; 841e2d8830eSBrad --smbd=*) smbd="$optarg" 842e2d8830eSBrad ;; 843e2a2ed06SJuan Quintela --extra-cflags=*) 8447d13299dSbellard ;; 84511cde1c8SBruno Dominguez --extra-cxxflags=*) 84611cde1c8SBruno Dominguez ;; 847e2a2ed06SJuan Quintela --extra-ldflags=*) 8487d13299dSbellard ;; 8495bc62e01SGerd Hoffmann --enable-debug-info) 8505bc62e01SGerd Hoffmann ;; 8515bc62e01SGerd Hoffmann --disable-debug-info) 8525bc62e01SGerd Hoffmann ;; 853d75402b5SAlex Bennée --cross-cc-*) 854d75402b5SAlex Bennée ;; 85517969268SFam Zheng --enable-modules) 85617969268SFam Zheng modules="yes" 85717969268SFam Zheng ;; 8583aa88b31SStefan Hajnoczi --disable-modules) 8593aa88b31SStefan Hajnoczi modules="no" 8603aa88b31SStefan Hajnoczi ;; 861bd83c861SChristian Ehrhardt --disable-module-upgrades) module_upgrades="no" 862bd83c861SChristian Ehrhardt ;; 863bd83c861SChristian Ehrhardt --enable-module-upgrades) module_upgrades="yes" 864bd83c861SChristian Ehrhardt ;; 8652ff6b91eSJuan Quintela --cpu=*) 8667d13299dSbellard ;; 867b1a550a0Spbrook --target-list=*) target_list="$optarg" 868447e133fSAlex Bennée if test "$target_list_exclude"; then 869447e133fSAlex Bennée error_exit "Can't mix --target-list with --target-list-exclude" 870447e133fSAlex Bennée fi 871447e133fSAlex Bennée ;; 872447e133fSAlex Bennée --target-list-exclude=*) target_list_exclude="$optarg" 873447e133fSAlex Bennée if test "$target_list"; then 874447e133fSAlex Bennée error_exit "Can't mix --target-list-exclude with --target-list" 875447e133fSAlex Bennée fi 876de83cd02Sbellard ;; 8775b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 8785b808275SLluís Vilanova ;; 8795b808275SLluís Vilanova # XXX: backwards compatibility 8805b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 88194a420b1SStefan Hajnoczi ;; 88274242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 8839410b56cSPrerna Saxena ;; 8847bc3ca7fSPaolo Bonzini --with-default-devices) default_devices="true" 885f3494749SPaolo Bonzini ;; 8867bc3ca7fSPaolo Bonzini --without-default-devices) default_devices="false" 887f3494749SPaolo Bonzini ;; 888d1d5e9eeSAlex Bennée --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option" 889d1d5e9eeSAlex Bennée ;; 890d1d5e9eeSAlex Bennée --with-devices-*) device_arch=${opt#--with-devices-}; 891d1d5e9eeSAlex Bennée device_arch=${device_arch%%=*} 892d1d5e9eeSAlex Bennée cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak 893d1d5e9eeSAlex Bennée if test -f "$cf"; then 894d1d5e9eeSAlex Bennée device_archs="$device_archs $device_arch" 895d1d5e9eeSAlex Bennée eval "devices_${device_arch}=\$optarg" 896d1d5e9eeSAlex Bennée else 897d1d5e9eeSAlex Bennée error_exit "File $cf does not exist" 898d1d5e9eeSAlex Bennée fi 899d1d5e9eeSAlex Bennée ;; 900c87ea116SAlex Bennée --without-default-features) # processed above 901c87ea116SAlex Bennée ;; 9027d13299dSbellard --enable-gprof) gprof="yes" 9037d13299dSbellard ;; 9041d728c39SBlue Swirl --enable-gcov) gcov="yes" 9051d728c39SBlue Swirl ;; 90679427693SLoïc Minier --static) 90779427693SLoïc Minier static="yes" 90817884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 90943ce4dfeSbellard ;; 9100b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 9110b24e75fSPaolo Bonzini ;; 9120b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 9130b24e75fSPaolo Bonzini ;; 9143aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 9153aa5d2beSAlon Levy ;; 9168bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 9178bf188aaSMichael Tokarev ;; 9180f94d6daSAlon Levy --includedir=*) includedir="$optarg" 9190f94d6daSAlon Levy ;; 920528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 9210b24e75fSPaolo Bonzini ;; 92277433a5fSMarc-André Lureau --with-suffix=*) qemu_suffix="$optarg" 923023d3d67SEduardo Habkost ;; 924c6502638SBruce Rogers --docdir=*) docdir="$optarg" 9250b24e75fSPaolo Bonzini ;; 926fe0038beSPaolo Bonzini --localedir=*) localedir="$optarg" 927fe0038beSPaolo Bonzini ;; 928ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 92907381cc1SAnthony Liguori ;; 930785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 931785c23aeSLuiz Capitulino ;; 9323d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 9333d5eecabSGerd Hoffmann ;; 934181ce1d0SOlaf Hering --host=*|--build=*|\ 935181ce1d0SOlaf Hering --disable-dependency-tracking|\ 936785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 937fe0038beSPaolo Bonzini --oldincludedir=*|--datarootdir=*|--infodir=*|\ 938023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 939023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 940023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 941023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 942023ddd74SMax Filippov # lots of directory switches by default. 943023ddd74SMax Filippov ;; 94435be72baSPaolo Bonzini --disable-sdl) sdl="disabled" 94597a847bcSbellard ;; 94635be72baSPaolo Bonzini --enable-sdl) sdl="enabled" 947c4198157SJuan Quintela ;; 94835be72baSPaolo Bonzini --disable-sdl-image) sdl_image="disabled" 949a442fe2fSDaniel P. Berrangé ;; 95035be72baSPaolo Bonzini --enable-sdl-image) sdl_image="enabled" 951a442fe2fSDaniel P. Berrangé ;; 9523556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 9533556c233SPaolo Bonzini ;; 9543556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 9553556c233SPaolo Bonzini ;; 95669202b40SPaolo Bonzini --disable-virtfs) virtfs="disabled" 957983eef5aSMeador Inge ;; 95869202b40SPaolo Bonzini --enable-virtfs) virtfs="enabled" 959983eef5aSMeador Inge ;; 9605c53015aSPaolo Bonzini --disable-libudev) libudev="disabled" 9615c53015aSPaolo Bonzini ;; 9625c53015aSPaolo Bonzini --enable-libudev) libudev="enabled" 9635c53015aSPaolo Bonzini ;; 964cece116cSMisono Tomohiro --disable-virtiofsd) virtiofsd="disabled" 965cece116cSMisono Tomohiro ;; 966cece116cSMisono Tomohiro --enable-virtiofsd) virtiofsd="enabled" 967cece116cSMisono Tomohiro ;; 9686ec0e15dSPaolo Bonzini --disable-mpath) mpath="disabled" 969fe8fc5aeSPaolo Bonzini ;; 9706ec0e15dSPaolo Bonzini --enable-mpath) mpath="enabled" 971fe8fc5aeSPaolo Bonzini ;; 972a0b93237SPaolo Bonzini --disable-vnc) vnc="disabled" 973821601eaSJes Sorensen ;; 974a0b93237SPaolo Bonzini --enable-vnc) vnc="enabled" 975821601eaSJes Sorensen ;; 9760e8e77d4SAlex Bennée --disable-gettext) gettext="disabled" 977e8f3bd71SMarc-André Lureau ;; 9780e8e77d4SAlex Bennée --enable-gettext) gettext="enabled" 979e8f3bd71SMarc-André Lureau ;; 9800c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 9810c58ac1cSmalc ;; 98289138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 983b64ec4e4SFam Zheng ;; 98489138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 985eb852011SMarkus Armbruster ;; 986e5f05f8cSKevin Wolf --enable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="yes" 987e5f05f8cSKevin Wolf ;; 988e5f05f8cSKevin Wolf --disable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="no" 989e5f05f8cSKevin Wolf ;; 990f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 991f8393946Saurel32 ;; 992f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 993f8393946Saurel32 ;; 994f3d08ee6SPaul Brook --enable-debug) 995f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 996f3d08ee6SPaul Brook debug_tcg="yes" 9971fcc6d42SPeter Xu debug_mutex="yes" 998f3d08ee6SPaul Brook debug="yes" 999f3d08ee6SPaul Brook strip_opt="no" 1000b553a042SJohn Snow fortify_source="no" 1001f3d08ee6SPaul Brook ;; 1002247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1003247724cbSMarc-André Lureau ;; 1004247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1005247724cbSMarc-André Lureau ;; 10060aebab04SLingfeng Yang --enable-tsan) tsan="yes" 10070aebab04SLingfeng Yang ;; 10080aebab04SLingfeng Yang --disable-tsan) tsan="no" 10090aebab04SLingfeng Yang ;; 1010deb62371SPaolo Bonzini --enable-sparse) sparse="enabled" 101103b4fe7dSaliguori ;; 1012deb62371SPaolo Bonzini --disable-sparse) sparse="disabled" 101303b4fe7dSaliguori ;; 10141625af87Saliguori --disable-strip) strip_opt="no" 10151625af87Saliguori ;; 1016a0b93237SPaolo Bonzini --disable-vnc-sasl) vnc_sasl="disabled" 10172f9606b3Saliguori ;; 1018a0b93237SPaolo Bonzini --enable-vnc-sasl) vnc_sasl="enabled" 1019ea784e3bSJuan Quintela ;; 1020a0b93237SPaolo Bonzini --disable-vnc-jpeg) vnc_jpeg="disabled" 10212f6f5c7aSCorentin Chary ;; 1022a0b93237SPaolo Bonzini --enable-vnc-jpeg) vnc_jpeg="enabled" 10232f6f5c7aSCorentin Chary ;; 1024a0b93237SPaolo Bonzini --disable-vnc-png) vnc_png="disabled" 1025efe556adSCorentin Chary ;; 1026a0b93237SPaolo Bonzini --enable-vnc-png) vnc_png="enabled" 1027efe556adSCorentin Chary ;; 10284d34a86bSPaolo Bonzini --disable-slirp) slirp="disabled" 1029c20709aaSbellard ;; 1030fd6fc214SPaolo Bonzini --enable-slirp) slirp="enabled" 1031fd6fc214SPaolo Bonzini ;; 10324d34a86bSPaolo Bonzini --enable-slirp=git) slirp="internal" 10337c57bdd8SMarc-André Lureau ;; 103403a3c0b3SPaolo Bonzini --enable-slirp=*) slirp="$optarg" 1035675b9b53SMarc-André Lureau ;; 1036e1723999SPaolo Bonzini --disable-vde) vde="disabled" 10378a16d273Sths ;; 1038e1723999SPaolo Bonzini --enable-vde) vde="enabled" 1039dfb278bdSJuan Quintela ;; 1040837b84b1SPaolo Bonzini --disable-netmap) netmap="disabled" 104158952137SVincenzo Maffione ;; 1042837b84b1SPaolo Bonzini --enable-netmap) netmap="enabled" 104358952137SVincenzo Maffione ;; 10441badb709SPaolo Bonzini --disable-xen) xen="disabled" 1045e37630caSaliguori ;; 10461badb709SPaolo Bonzini --enable-xen) xen="enabled" 1047fc321b4bSJuan Quintela ;; 10481badb709SPaolo Bonzini --disable-xen-pci-passthrough) xen_pci_passthrough="disabled" 1049eb6fda0fSAnthony PERARD ;; 10501badb709SPaolo Bonzini --enable-xen-pci-passthrough) xen_pci_passthrough="enabled" 1051eb6fda0fSAnthony PERARD ;; 1052ca50e523SPaolo Bonzini --disable-alsa) alsa="disabled" 1053ca50e523SPaolo Bonzini ;; 1054ca50e523SPaolo Bonzini --enable-alsa) alsa="enabled" 1055ca50e523SPaolo Bonzini ;; 1056ca50e523SPaolo Bonzini --disable-coreaudio) coreaudio="disabled" 1057ca50e523SPaolo Bonzini ;; 1058ca50e523SPaolo Bonzini --enable-coreaudio) coreaudio="enabled" 1059ca50e523SPaolo Bonzini ;; 1060ca50e523SPaolo Bonzini --disable-dsound) dsound="disabled" 1061ca50e523SPaolo Bonzini ;; 1062ca50e523SPaolo Bonzini --enable-dsound) dsound="enabled" 1063ca50e523SPaolo Bonzini ;; 1064ca50e523SPaolo Bonzini --disable-jack) jack="disabled" 1065ca50e523SPaolo Bonzini ;; 1066ca50e523SPaolo Bonzini --enable-jack) jack="enabled" 1067ca50e523SPaolo Bonzini ;; 1068ca50e523SPaolo Bonzini --disable-oss) oss="disabled" 1069ca50e523SPaolo Bonzini ;; 1070ca50e523SPaolo Bonzini --enable-oss) oss="enabled" 1071ca50e523SPaolo Bonzini ;; 1072ca50e523SPaolo Bonzini --disable-pa) pa="disabled" 1073ca50e523SPaolo Bonzini ;; 1074ca50e523SPaolo Bonzini --enable-pa) pa="enabled" 1075ca50e523SPaolo Bonzini ;; 10768c6d4ff4SPaolo Bonzini --disable-brlapi) brlapi="disabled" 10772e4d9fb1Saurel32 ;; 10788c6d4ff4SPaolo Bonzini --enable-brlapi) brlapi="enabled" 10794ffcedb6SJuan Quintela ;; 10801badb709SPaolo Bonzini --disable-kvm) kvm="disabled" 10817ba1e619Saliguori ;; 10821badb709SPaolo Bonzini --enable-kvm) kvm="enabled" 1083b31a0277SJuan Quintela ;; 10841badb709SPaolo Bonzini --disable-hax) hax="disabled" 1085180fb750Szhanghailiang ;; 10861badb709SPaolo Bonzini --enable-hax) hax="enabled" 1087180fb750Szhanghailiang ;; 10881badb709SPaolo Bonzini --disable-hvf) hvf="disabled" 1089c97d6d2cSSergio Andres Gomez Del Real ;; 10901badb709SPaolo Bonzini --enable-hvf) hvf="enabled" 1091c97d6d2cSSergio Andres Gomez Del Real ;; 109274a414a1SReinoud Zandijk --disable-nvmm) nvmm="disabled" 109374a414a1SReinoud Zandijk ;; 109474a414a1SReinoud Zandijk --enable-nvmm) nvmm="enabled" 109574a414a1SReinoud Zandijk ;; 10961badb709SPaolo Bonzini --disable-whpx) whpx="disabled" 1097d661d9a4SJustin Terry (VM) ;; 10981badb709SPaolo Bonzini --enable-whpx) whpx="enabled" 1099d661d9a4SJustin Terry (VM) ;; 1100c6fbea47SRichard Henderson --disable-tcg-interpreter) tcg_interpreter="false" 11019195b2c2SStefan Weil ;; 1102c6fbea47SRichard Henderson --enable-tcg-interpreter) tcg_interpreter="true" 11039195b2c2SStefan Weil ;; 1104727c8bb8SPaolo Bonzini --disable-cap-ng) cap_ng="disabled" 110547e98658SCorey Bryant ;; 1106727c8bb8SPaolo Bonzini --enable-cap-ng) cap_ng="enabled" 110747e98658SCorey Bryant ;; 11081badb709SPaolo Bonzini --disable-tcg) tcg="disabled" 1109d1a14257SAlex Bennée plugins="no" 1110b3f6ea7eSPaolo Bonzini ;; 11111badb709SPaolo Bonzini --enable-tcg) tcg="enabled" 1112b3f6ea7eSPaolo Bonzini ;; 1113aa087962SPaolo Bonzini --disable-malloc-trim) malloc_trim="disabled" 11145a22ab71SYang Zhong ;; 1115aa087962SPaolo Bonzini --enable-malloc-trim) malloc_trim="enabled" 11165a22ab71SYang Zhong ;; 1117cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1118cd4ec0b4SGerd Hoffmann ;; 111958d3f3ffSGerd Hoffmann --enable-spice) 112058d3f3ffSGerd Hoffmann spice_protocol="yes" 112158d3f3ffSGerd Hoffmann spice="yes" 112258d3f3ffSGerd Hoffmann ;; 112358d3f3ffSGerd Hoffmann --disable-spice-protocol) 112458d3f3ffSGerd Hoffmann spice_protocol="no" 112558d3f3ffSGerd Hoffmann spice="no" 112658d3f3ffSGerd Hoffmann ;; 112758d3f3ffSGerd Hoffmann --enable-spice-protocol) spice_protocol="yes" 1128cd4ec0b4SGerd Hoffmann ;; 11299db405a3SPaolo Bonzini --disable-libiscsi) libiscsi="disabled" 1130c589b249SRonnie Sahlberg ;; 11319db405a3SPaolo Bonzini --enable-libiscsi) libiscsi="enabled" 1132c589b249SRonnie Sahlberg ;; 113330045c05SPaolo Bonzini --disable-libnfs) libnfs="disabled" 11346542aa9cSPeter Lieven ;; 113530045c05SPaolo Bonzini --enable-libnfs) libnfs="enabled" 11366542aa9cSPeter Lieven ;; 113705c2a3e7Sbellard --enable-profiler) profiler="yes" 113805c2a3e7Sbellard ;; 1139b4e312e9SPaolo Bonzini --disable-cocoa) cocoa="disabled" 114014821030SPavel Borzenkov ;; 1141a23a6789SPaolo Bonzini --enable-cocoa) cocoa="enabled" 11425b0753e0Sbellard ;; 1143cad25d69Spbrook --disable-system) softmmu="no" 11440a8e90f4Spbrook ;; 1145cad25d69Spbrook --enable-system) softmmu="yes" 11460a8e90f4Spbrook ;; 11470953a80fSZachary Amsden --disable-user) 11480953a80fSZachary Amsden linux_user="no" ; 11490953a80fSZachary Amsden bsd_user="no" ; 11500953a80fSZachary Amsden ;; 11510953a80fSZachary Amsden --enable-user) ;; 1152831b7825Sths --disable-linux-user) linux_user="no" 11530a8e90f4Spbrook ;; 1154831b7825Sths --enable-linux-user) linux_user="yes" 1155831b7825Sths ;; 115684778508Sblueswir1 --disable-bsd-user) bsd_user="no" 115784778508Sblueswir1 ;; 115884778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 115984778508Sblueswir1 ;; 116040d6444eSAvi Kivity --enable-pie) pie="yes" 116134005a00SKirill A. Shutemov ;; 116240d6444eSAvi Kivity --disable-pie) pie="no" 116334005a00SKirill A. Shutemov ;; 116485aa5189Sbellard --enable-werror) werror="yes" 116585aa5189Sbellard ;; 116685aa5189Sbellard --disable-werror) werror="no" 116785aa5189Sbellard ;; 1168cdad781dSDaniele Buono --enable-lto) lto="true" 1169cdad781dSDaniele Buono ;; 1170cdad781dSDaniele Buono --disable-lto) lto="false" 1171cdad781dSDaniele Buono ;; 117263678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 117363678e17SSteven Noonan ;; 117463678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 117563678e17SSteven Noonan ;; 11761e4f6065SDaniele Buono --enable-safe-stack) safe_stack="yes" 11771e4f6065SDaniele Buono ;; 11781e4f6065SDaniele Buono --disable-safe-stack) safe_stack="no" 11791e4f6065SDaniele Buono ;; 11809e62ba48SDaniele Buono --enable-cfi) 11819e62ba48SDaniele Buono cfi="true"; 11829e62ba48SDaniele Buono lto="true"; 11839e62ba48SDaniele Buono ;; 11849e62ba48SDaniele Buono --disable-cfi) cfi="false" 11859e62ba48SDaniele Buono ;; 11869e62ba48SDaniele Buono --enable-cfi-debug) cfi_debug="true" 11879e62ba48SDaniele Buono ;; 11889e62ba48SDaniele Buono --disable-cfi-debug) cfi_debug="false" 11899e62ba48SDaniele Buono ;; 11905285e593SYonggang Luo --disable-curses) curses="disabled" 11914d3b6f6eSbalrog ;; 11925285e593SYonggang Luo --enable-curses) curses="enabled" 1193c584a6d0SJuan Quintela ;; 11945285e593SYonggang Luo --disable-iconv) iconv="disabled" 1195e08bb301SSamuel Thibault ;; 11965285e593SYonggang Luo --enable-iconv) iconv="enabled" 1197e08bb301SSamuel Thibault ;; 1198f9cd86feSPaolo Bonzini --disable-curl) curl="disabled" 1199769ce76dSAlexander Graf ;; 1200f9cd86feSPaolo Bonzini --enable-curl) curl="enabled" 1201788c8196SJuan Quintela ;; 1202fbb4121dSPaolo Bonzini --disable-fdt) fdt="disabled" 12032df87df7SJuan Quintela ;; 1204fbb4121dSPaolo Bonzini --enable-fdt) fdt="enabled" 1205fbb4121dSPaolo Bonzini ;; 1206fbb4121dSPaolo Bonzini --enable-fdt=git) fdt="internal" 1207fbb4121dSPaolo Bonzini ;; 120803a3c0b3SPaolo Bonzini --enable-fdt=*) fdt="$optarg" 12092df87df7SJuan Quintela ;; 1210ff66f3e5SPaolo Bonzini --disable-linux-aio) linux_aio="disabled" 12115c6c3a6cSChristoph Hellwig ;; 1212ff66f3e5SPaolo Bonzini --enable-linux-aio) linux_aio="enabled" 12135c6c3a6cSChristoph Hellwig ;; 121453c22b68SPaolo Bonzini --disable-linux-io-uring) linux_io_uring="disabled" 1215c10dd856SAarushi Mehta ;; 121653c22b68SPaolo Bonzini --enable-linux-io-uring) linux_io_uring="enabled" 1217c10dd856SAarushi Mehta ;; 1218f7f2d651SPaolo Bonzini --disable-attr) attr="disabled" 1219758e8e38SVenkateswararao Jujjuri (JV) ;; 1220f7f2d651SPaolo Bonzini --enable-attr) attr="enabled" 1221758e8e38SVenkateswararao Jujjuri (JV) ;; 1222a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1223a40161cbSPaolo Bonzini ;; 1224a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1225a40161cbSPaolo Bonzini ;; 122646627f41SAndrew Melnychenko --disable-bpf) bpf="disabled" 122746627f41SAndrew Melnychenko ;; 122846627f41SAndrew Melnychenko --enable-bpf) bpf="enabled" 122946627f41SAndrew Melnychenko ;; 1230c8d5450bSPaolo Bonzini --disable-blobs) blobs="false" 123177755340Sths ;; 12327e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 12334a19f1ecSpbrook ;; 1234519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1235519175a2SAlex Barcelo ;; 123670c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 123770c60c08SStefan Hajnoczi ;; 123870c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 123970c60c08SStefan Hajnoczi ;; 12407d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 12417d992e4dSPeter Lieven ;; 1242f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1243f0d92b56SLongpeng(Mike) ;; 1244f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1245f0d92b56SLongpeng(Mike) ;; 1246e3667660SYonggang Luo --disable-docs) docs="disabled" 124770ec5dc0SAnthony Liguori ;; 1248e3667660SYonggang Luo --enable-docs) docs="enabled" 124983a3ab8bSJuan Quintela ;; 1250d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1251d5970055SMichael S. Tsirkin ;; 1252d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1253d5970055SMichael S. Tsirkin ;; 1254042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1255042cea27SGonglei ;; 1256299e6f19SPaolo Bonzini --enable-vhost-crypto) vhost_crypto="yes" 1257042cea27SGonglei ;; 12585e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 12595e9be92dSNicholas Bellinger ;; 12605e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 12615e9be92dSNicholas Bellinger ;; 1262fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1263fc0b9b0eSStefan Hajnoczi ;; 1264fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1265fc0b9b0eSStefan Hajnoczi ;; 1266e5e856c1SStefan Hajnoczi --disable-vhost-user-blk-server) vhost_user_blk_server="disabled" 1267bc15e44cSStefan Hajnoczi ;; 1268e5e856c1SStefan Hajnoczi --enable-vhost-user-blk-server) vhost_user_blk_server="enabled" 1269bc15e44cSStefan Hajnoczi ;; 127098fc1adaSDr. David Alan Gilbert --disable-vhost-user-fs) vhost_user_fs="no" 127198fc1adaSDr. David Alan Gilbert ;; 127298fc1adaSDr. David Alan Gilbert --enable-vhost-user-fs) vhost_user_fs="yes" 127398fc1adaSDr. David Alan Gilbert ;; 1274da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 127520ff075bSMichael Walle ;; 1276da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 127720ff075bSMichael Walle ;; 1278fabd1e93SPaolo Bonzini --disable-rbd) rbd="disabled" 1279f27aaf4bSChristian Brunner ;; 1280fabd1e93SPaolo Bonzini --enable-rbd) rbd="enabled" 1281f27aaf4bSChristian Brunner ;; 12828c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 12838c84cf11SSergei Trofimovich ;; 12848c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 12858c84cf11SSergei Trofimovich ;; 12865f364c57SPaolo Bonzini --disable-smartcard) smartcard="disabled" 1287111a38b0SRobert Relyea ;; 12885f364c57SPaolo Bonzini --enable-smartcard) smartcard="enabled" 1289111a38b0SRobert Relyea ;; 12900a40bcb7SCésar Belley --disable-u2f) u2f="disabled" 12910a40bcb7SCésar Belley ;; 12920a40bcb7SCésar Belley --enable-u2f) u2f="enabled" 12930a40bcb7SCésar Belley ;; 129490540f32SPaolo Bonzini --disable-libusb) libusb="disabled" 12952b2325ffSGerd Hoffmann ;; 129690540f32SPaolo Bonzini --enable-libusb) libusb="enabled" 12972b2325ffSGerd Hoffmann ;; 129818f31e60SPaolo Bonzini --disable-usb-redir) usb_redir="disabled" 129969354a83SHans de Goede ;; 130018f31e60SPaolo Bonzini --enable-usb-redir) usb_redir="enabled" 130169354a83SHans de Goede ;; 13021ffb3bbbSPaolo Bonzini --disable-zlib-test) 13031ece9905SAlon Levy ;; 13040c32a0aeSPaolo Bonzini --disable-lzo) lzo="disabled" 1305b25c9dffSStefan Weil ;; 13060c32a0aeSPaolo Bonzini --enable-lzo) lzo="enabled" 1307607dacd0Sqiaonuohan ;; 1308241611eaSPaolo Bonzini --disable-snappy) snappy="disabled" 1309b25c9dffSStefan Weil ;; 1310241611eaSPaolo Bonzini --enable-snappy) snappy="enabled" 1311607dacd0Sqiaonuohan ;; 131229ba6116SPaolo Bonzini --disable-bzip2) bzip2="disabled" 13136b383c08SPeter Wu ;; 131429ba6116SPaolo Bonzini --enable-bzip2) bzip2="enabled" 13156b383c08SPeter Wu ;; 1316ecea3696SPaolo Bonzini --enable-lzfse) lzfse="enabled" 131783bc1f97SJulio Faracco ;; 1318ecea3696SPaolo Bonzini --disable-lzfse) lzfse="disabled" 131983bc1f97SJulio Faracco ;; 1320b1def33dSPaolo Bonzini --disable-zstd) zstd="disabled" 13213a678481SJuan Quintela ;; 1322b1def33dSPaolo Bonzini --enable-zstd) zstd="enabled" 13233a678481SJuan Quintela ;; 1324d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1325d138cee9SMichael Roth ;; 1326d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1327d138cee9SMichael Roth ;; 1328b846ab7cSPaolo Bonzini --enable-guest-agent-msi) guest_agent_msi="enabled" 13299dacf32dSYossi Hindin ;; 1330b846ab7cSPaolo Bonzini --disable-guest-agent-msi) guest_agent_msi="disabled" 13319dacf32dSYossi Hindin ;; 1332d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1333d9840e25STomoki Sekiyama ;; 1334d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1335d9840e25STomoki Sekiyama ;; 1336d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1337d9840e25STomoki Sekiyama ;; 1338d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1339d9840e25STomoki Sekiyama ;; 1340d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1341d9840e25STomoki Sekiyama ;; 1342d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1343d9840e25STomoki Sekiyama ;; 13444b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 13454b1c11fdSDaniel P. Berrange ;; 13464b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 13474b1c11fdSDaniel P. Berrange ;; 134890835c2bSPaolo Bonzini --enable-seccomp) seccomp="enabled" 1349f794573eSEduardo Otubo ;; 135090835c2bSPaolo Bonzini --disable-seccomp) seccomp="disabled" 1351f794573eSEduardo Otubo ;; 135208821ca2SPaolo Bonzini --disable-glusterfs) glusterfs="disabled" 1353eb100396SBharata B Rao ;; 135486583a07SLiam Merwick --disable-avx2) avx2_opt="no" 135586583a07SLiam Merwick ;; 135686583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 135786583a07SLiam Merwick ;; 13586b8cd447SRobert Hoo --disable-avx512f) avx512f_opt="no" 13596b8cd447SRobert Hoo ;; 13606b8cd447SRobert Hoo --enable-avx512f) avx512f_opt="yes" 13616b8cd447SRobert Hoo ;; 13626b8cd447SRobert Hoo 136308821ca2SPaolo Bonzini --enable-glusterfs) glusterfs="enabled" 1364eb100396SBharata B Rao ;; 136552b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 136652b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1367583f6e7bSStefan Hajnoczi ;; 1368cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1369cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1370cb6414dfSFam Zheng ;; 1371315d3184SFam Zheng --enable-uuid|--disable-uuid) 1372315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1373315d3184SFam Zheng ;; 13741b695471SPaolo Bonzini --disable-gtk) gtk="disabled" 1375a4ccabcfSAnthony Liguori ;; 13761b695471SPaolo Bonzini --enable-gtk) gtk="enabled" 1377a4ccabcfSAnthony Liguori ;; 1378a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1379a1c5e949SDaniel P. Berrange ;; 138057612511SPaolo Bonzini --disable-gnutls) gnutls="disabled" 1381ddbb0d09SDaniel P. Berrange ;; 138257612511SPaolo Bonzini --enable-gnutls) gnutls="enabled" 1383ddbb0d09SDaniel P. Berrange ;; 138457612511SPaolo Bonzini --disable-nettle) nettle="disabled" 138591bfcdb0SDaniel P. Berrange ;; 138657612511SPaolo Bonzini --enable-nettle) nettle="enabled" 138791bfcdb0SDaniel P. Berrange ;; 138857612511SPaolo Bonzini --disable-gcrypt) gcrypt="disabled" 138991bfcdb0SDaniel P. Berrange ;; 139057612511SPaolo Bonzini --enable-gcrypt) gcrypt="enabled" 139191bfcdb0SDaniel P. Berrange ;; 139205e391aeSPaolo Bonzini --disable-auth-pam) auth_pam="disabled" 13938953caf3SDaniel P. Berrange ;; 139405e391aeSPaolo Bonzini --enable-auth-pam) auth_pam="enabled" 13958953caf3SDaniel P. Berrange ;; 13962da776dbSMichael R. Hines --enable-rdma) rdma="yes" 13972da776dbSMichael R. Hines ;; 13982da776dbSMichael R. Hines --disable-rdma) rdma="no" 13992da776dbSMichael R. Hines ;; 140021ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 140121ab34c9SMarcel Apfelbaum ;; 140221ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 140321ab34c9SMarcel Apfelbaum ;; 1404c23d7b4eSPaolo Bonzini --disable-vte) vte="disabled" 1405bbbf9bfbSStefan Weil ;; 1406c23d7b4eSPaolo Bonzini --enable-vte) vte="enabled" 1407bbbf9bfbSStefan Weil ;; 1408587d59d6SPaolo Bonzini --disable-virglrenderer) virglrenderer="disabled" 14099d9e1521SGerd Hoffmann ;; 1410587d59d6SPaolo Bonzini --enable-virglrenderer) virglrenderer="enabled" 14119d9e1521SGerd Hoffmann ;; 1412e91c793cSCole Robinson --disable-tpm) tpm="no" 1413e91c793cSCole Robinson ;; 1414ab214c29SStefan Berger --enable-tpm) tpm="yes" 1415ab214c29SStefan Berger ;; 1416b10d49d7SPino Toscano --disable-libssh) libssh="no" 14170a12ec87SRichard W.M. Jones ;; 1418b10d49d7SPino Toscano --enable-libssh) libssh="yes" 14190a12ec87SRichard W.M. Jones ;; 1420ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1421ed1701c6SDr. David Alan Gilbert ;; 1422ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1423ed1701c6SDr. David Alan Gilbert ;; 1424a99d57bbSWanlong Gao --disable-numa) numa="no" 1425a99d57bbSWanlong Gao ;; 1426a99d57bbSWanlong Gao --enable-numa) numa="yes" 1427a99d57bbSWanlong Gao ;; 1428c5b36c25SPaolo Bonzini --disable-libxml2) libxml2="disabled" 1429ed279a06SKlim Kireev ;; 1430c5b36c25SPaolo Bonzini --enable-libxml2) libxml2="enabled" 1431ed279a06SKlim Kireev ;; 14322847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 14332847b469SFam Zheng ;; 14342847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 14352847b469SFam Zheng ;; 14367b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 14377b01cb97SAlexandre Derumier ;; 14387b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 14397b01cb97SAlexandre Derumier ;; 1440a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1441a6b1d4c0SChanglong Xie ;; 1442a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1443a6b1d4c0SChanglong Xie ;; 14442f740136SJeff Cody --disable-bochs) bochs="no" 14452f740136SJeff Cody ;; 14462f740136SJeff Cody --enable-bochs) bochs="yes" 14472f740136SJeff Cody ;; 14482f740136SJeff Cody --disable-cloop) cloop="no" 14492f740136SJeff Cody ;; 14502f740136SJeff Cody --enable-cloop) cloop="yes" 14512f740136SJeff Cody ;; 14522f740136SJeff Cody --disable-dmg) dmg="no" 14532f740136SJeff Cody ;; 14542f740136SJeff Cody --enable-dmg) dmg="yes" 14552f740136SJeff Cody ;; 14562f740136SJeff Cody --disable-qcow1) qcow1="no" 14572f740136SJeff Cody ;; 14582f740136SJeff Cody --enable-qcow1) qcow1="yes" 14592f740136SJeff Cody ;; 14602f740136SJeff Cody --disable-vdi) vdi="no" 14612f740136SJeff Cody ;; 14622f740136SJeff Cody --enable-vdi) vdi="yes" 14632f740136SJeff Cody ;; 14642f740136SJeff Cody --disable-vvfat) vvfat="no" 14652f740136SJeff Cody ;; 14662f740136SJeff Cody --enable-vvfat) vvfat="yes" 14672f740136SJeff Cody ;; 14682f740136SJeff Cody --disable-qed) qed="no" 14692f740136SJeff Cody ;; 14702f740136SJeff Cody --enable-qed) qed="yes" 14712f740136SJeff Cody ;; 14722f740136SJeff Cody --disable-parallels) parallels="no" 14732f740136SJeff Cody ;; 14742f740136SJeff Cody --enable-parallels) parallels="yes" 14752f740136SJeff Cody ;; 1476e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1477e6a74868SMarc-André Lureau ;; 1478299e6f19SPaolo Bonzini --enable-vhost-user) vhost_user="yes" 1479299e6f19SPaolo Bonzini ;; 1480108a6481SCindy Lu --disable-vhost-vdpa) vhost_vdpa="no" 1481108a6481SCindy Lu ;; 1482108a6481SCindy Lu --enable-vhost-vdpa) vhost_vdpa="yes" 1483108a6481SCindy Lu ;; 1484299e6f19SPaolo Bonzini --disable-vhost-kernel) vhost_kernel="no" 1485299e6f19SPaolo Bonzini ;; 1486299e6f19SPaolo Bonzini --enable-vhost-kernel) vhost_kernel="yes" 1487e6a74868SMarc-André Lureau ;; 14888b18cdbfSRichard Henderson --disable-capstone) capstone="disabled" 14898ca80760SRichard Henderson ;; 14908b18cdbfSRichard Henderson --enable-capstone) capstone="enabled" 14918ca80760SRichard Henderson ;; 14928b18cdbfSRichard Henderson --enable-capstone=git) capstone="internal" 1493e219c499SRichard Henderson ;; 149403a3c0b3SPaolo Bonzini --enable-capstone=*) capstone="$optarg" 1495e219c499SRichard Henderson ;; 1496cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1497cc84d63aSDaniel P. Berrange ;; 14987d7dbf9dSDan Streetman --with-git-submodules=*) 14997d7dbf9dSDan Streetman git_submodules_action="$optarg" 1500f62bbee5SDaniel P. Berrange ;; 1501ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1502ba59fb77SPaolo Bonzini ;; 1503ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1504ba59fb77SPaolo Bonzini ;; 15055cd5d8a7SMiroslav Rezanina --enable-libpmem) libpmem="enabled" 150617824406SJunyan He ;; 15075cd5d8a7SMiroslav Rezanina --disable-libpmem) libpmem="disabled" 150817824406SJunyan He ;; 15094113f4cfSLaurent Vivier --enable-xkbcommon) xkbcommon="enabled" 151075411919SJames Le Cuirot ;; 15114113f4cfSLaurent Vivier --disable-xkbcommon) xkbcommon="disabled" 151275411919SJames Le Cuirot ;; 15139b8e4298SAlex Bennée --enable-plugins) if test "$mingw32" = "yes"; then 15149b8e4298SAlex Bennée error_exit "TCG plugins not currently supported on Windows platforms" 15159b8e4298SAlex Bennée else 15169b8e4298SAlex Bennée plugins="yes" 15179b8e4298SAlex Bennée fi 151840e8c6f4SAlex Bennée ;; 151940e8c6f4SAlex Bennée --disable-plugins) plugins="no" 152040e8c6f4SAlex Bennée ;; 1521afc3a8f9SAlex Bennée --enable-containers) use_containers="yes" 1522afc3a8f9SAlex Bennée ;; 1523afc3a8f9SAlex Bennée --disable-containers) use_containers="no" 1524afc3a8f9SAlex Bennée ;; 1525537b7248SPaolo Bonzini --enable-fuzzing) fuzzing=true 1526adc28027SAlexander Bulekov ;; 1527537b7248SPaolo Bonzini --disable-fuzzing) fuzzing=false 1528adc28027SAlexander Bulekov ;; 1529f48e590aSAlex Bennée --gdb=*) gdb_bin="$optarg" 1530f48e590aSAlex Bennée ;; 1531b767d257SMarek Marczykowski-Górecki --enable-rng-none) rng_none=yes 1532b767d257SMarek Marczykowski-Górecki ;; 1533b767d257SMarek Marczykowski-Górecki --disable-rng-none) rng_none=no 1534b767d257SMarek Marczykowski-Górecki ;; 153554e7aac0SAlexey Krasikov --enable-keyring) secret_keyring="yes" 153654e7aac0SAlexey Krasikov ;; 153754e7aac0SAlexey Krasikov --disable-keyring) secret_keyring="no" 153854e7aac0SAlexey Krasikov ;; 153912033e16SMiroslav Rezanina --enable-libdaxctl) libdaxctl="enabled" 154021b2eca6SJingqi Liu ;; 154112033e16SMiroslav Rezanina --disable-libdaxctl) libdaxctl="disabled" 154221b2eca6SJingqi Liu ;; 1543a484a719SMax Reitz --enable-fuse) fuse="enabled" 1544a484a719SMax Reitz ;; 1545a484a719SMax Reitz --disable-fuse) fuse="disabled" 1546a484a719SMax Reitz ;; 1547df4ea709SMax Reitz --enable-fuse-lseek) fuse_lseek="enabled" 1548df4ea709SMax Reitz ;; 1549df4ea709SMax Reitz --disable-fuse-lseek) fuse_lseek="disabled" 1550df4ea709SMax Reitz ;; 1551106ad1f9SPaolo Bonzini --enable-multiprocess) multiprocess="enabled" 15523090de69SJagannathan Raman ;; 1553106ad1f9SPaolo Bonzini --disable-multiprocess) multiprocess="disabled" 15543090de69SJagannathan Raman ;; 155520cf7b8eSDenis Plotnikov --enable-gio) gio=yes 155620cf7b8eSDenis Plotnikov ;; 155720cf7b8eSDenis Plotnikov --disable-gio) gio=no 155820cf7b8eSDenis Plotnikov ;; 1559b8e0c493SJoelle van Dyne --enable-slirp-smbd) slirp_smbd=yes 1560b8e0c493SJoelle van Dyne ;; 1561b8e0c493SJoelle van Dyne --disable-slirp-smbd) slirp_smbd=no 1562b8e0c493SJoelle van Dyne ;; 1563*61d63097SPaolo Bonzini --enable-* | --disable-*) meson_option_parse "$opt" "$optarg" 1564*61d63097SPaolo Bonzini ;; 15652d2ad6d0SFam Zheng *) 15662d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 15672d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 15682d2ad6d0SFam Zheng exit 1 15697f1559c6Sbalrog ;; 15707d13299dSbellard esac 15717d13299dSbellarddone 15727d13299dSbellard 1573d1a14257SAlex Bennée# test for any invalid configuration combinations 1574d1a14257SAlex Bennéeif test "$plugins" = "yes" -a "$tcg" = "disabled"; then 1575d1a14257SAlex Bennée error_exit "Can't enable plugins on non-TCG builds" 1576d1a14257SAlex Bennéefi 1577d1a14257SAlex Bennée 15787d7dbf9dSDan Streetmancase $git_submodules_action in 15797d7dbf9dSDan Streetman update|validate) 15807d7dbf9dSDan Streetman if test ! -e "$source_path/.git"; then 15817d7dbf9dSDan Streetman echo "ERROR: cannot $git_submodules_action git submodules without .git" 15827d7dbf9dSDan Streetman exit 1 15837d7dbf9dSDan Streetman fi 15847d7dbf9dSDan Streetman ;; 15857d7dbf9dSDan Streetman ignore) 1586b80fd281SPaolo Bonzini if ! test -f "$source_path/ui/keycodemapdb/README" 1587b80fd281SPaolo Bonzini then 1588b80fd281SPaolo Bonzini echo 1589b80fd281SPaolo Bonzini echo "ERROR: missing GIT submodules" 1590b80fd281SPaolo Bonzini echo 1591b80fd281SPaolo Bonzini if test -e "$source_path/.git"; then 1592b80fd281SPaolo Bonzini echo "--with-git-submodules=ignore specified but submodules were not" 1593b80fd281SPaolo Bonzini echo "checked out. Please initialize and update submodules." 1594b80fd281SPaolo Bonzini else 1595b80fd281SPaolo Bonzini echo "This is not a GIT checkout but module content appears to" 1596b80fd281SPaolo Bonzini echo "be missing. Do not use 'git archive' or GitHub download links" 1597b80fd281SPaolo Bonzini echo "to acquire QEMU source archives. Non-GIT builds are only" 1598b80fd281SPaolo Bonzini echo "supported with source archives linked from:" 1599b80fd281SPaolo Bonzini echo 1600b80fd281SPaolo Bonzini echo " https://www.qemu.org/download/#source" 1601b80fd281SPaolo Bonzini echo 1602b80fd281SPaolo Bonzini echo "Developers working with GIT can use scripts/archive-source.sh" 1603b80fd281SPaolo Bonzini echo "if they need to create valid source archives." 1604b80fd281SPaolo Bonzini fi 1605b80fd281SPaolo Bonzini echo 1606b80fd281SPaolo Bonzini exit 1 1607b80fd281SPaolo Bonzini fi 16087d7dbf9dSDan Streetman ;; 16097d7dbf9dSDan Streetman *) 16107d7dbf9dSDan Streetman echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'" 16117d7dbf9dSDan Streetman exit 1 16127d7dbf9dSDan Streetman ;; 16137d7dbf9dSDan Streetmanesac 16147d7dbf9dSDan Streetman 161522a87800SMarc-André Lureaulibdir="${libdir:-$prefix/lib}" 161622a87800SMarc-André Lureaulibexecdir="${libexecdir:-$prefix/libexec}" 161722a87800SMarc-André Lureauincludedir="${includedir:-$prefix/include}" 161822a87800SMarc-André Lureau 161922a87800SMarc-André Lureauif test "$mingw32" = "yes" ; then 162015588a62SJoshua Watt bindir="${bindir:-$prefix}" 162122a87800SMarc-André Lureauelse 162215588a62SJoshua Watt bindir="${bindir:-$prefix/bin}" 162315588a62SJoshua Wattfi 162422a87800SMarc-André Lureaumandir="${mandir:-$prefix/share/man}" 162522a87800SMarc-André Lureaudatadir="${datadir:-$prefix/share}" 1626ca8c0909SMarc-André Lureaudocdir="${docdir:-$prefix/share/doc}" 162722a87800SMarc-André Lureausysconfdir="${sysconfdir:-$prefix/etc}" 162822a87800SMarc-André Lureaulocal_statedir="${local_statedir:-$prefix/var}" 162916bf7a33SPaolo Bonzinifirmwarepath="${firmwarepath:-$datadir/qemu-firmware}" 163016bf7a33SPaolo Bonzinilocaledir="${localedir:-$datadir/locale}" 163122a87800SMarc-André Lureau 163240293e58Sbellardcase "$cpu" in 1633e3608d66SRichard Henderson ppc) 1634e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1635db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1636e3608d66SRichard Henderson ;; 1637e3608d66SRichard Henderson ppc64) 1638e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1639db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1640e3608d66SRichard Henderson ;; 16419b9c37c3SRichard Henderson sparc) 1642f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1643db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 16443142255cSblueswir1 ;; 1645ed968ff1SJuan Quintela sparc64) 164679f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1647db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 16483142255cSblueswir1 ;; 164976d83bdeSths s390) 1650061cdd81SRichard Henderson CPU_CFLAGS="-m31" 1651db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 165228d7cc49SRichard Henderson ;; 165328d7cc49SRichard Henderson s390x) 1654061cdd81SRichard Henderson CPU_CFLAGS="-m64" 1655db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 165676d83bdeSths ;; 165740293e58Sbellard i386) 165879f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 1659db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 166040293e58Sbellard ;; 166140293e58Sbellard x86_64) 16627ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 16637ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 16647ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 16657ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 1666db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1667379f6698SPaul Brook ;; 1668c72b26ecSRichard Henderson x32) 1669c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1670db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1671c72b26ecSRichard Henderson ;; 167230163d89SPeter Maydell # No special flags required for other host CPUs 16733142255cSblueswir1esac 16743142255cSblueswir1 16759557af9cSAlex Bennéeif eval test -z "\${cross_cc_$cpu}"; then 1676b1aa4de1SAlex Bennée eval "cross_cc_${cpu}=\$cc" 16772038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 16789557af9cSAlex Bennéefi 167979f3b12fSPeter Crosthwaite 1680affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1681affc88ccSPeter Maydell# support, even if we're using TCI. 1682affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1683affc88ccSPeter Maydell bsd_user="no" 1684affc88ccSPeter Maydell linux_user="no" 1685affc88ccSPeter Maydellfi 1686affc88ccSPeter Maydell 168760e0df25SPeter Maydelldefault_target_list="" 168843692239SMarkus Armbrusterdeprecated_targets_list=ppc64abi32-linux-user 1689fdb75aefSPaolo Bonzinideprecated_features="" 16906e92f823SPeter Maydellmak_wilds="" 16916e92f823SPeter Maydell 169260e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 1693812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak" 169460e0df25SPeter Maydellfi 169560e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 1696812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-linux-user.mak" 169760e0df25SPeter Maydellfi 169860e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 1699812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak" 170060e0df25SPeter Maydellfi 170160e0df25SPeter Maydell 17023a5ae4a9SAlex Bennée# If the user doesn't explicitly specify a deprecated target we will 17033a5ae4a9SAlex Bennée# skip it. 17043a5ae4a9SAlex Bennéeif test -z "$target_list"; then 17053a5ae4a9SAlex Bennée if test -z "$target_list_exclude"; then 17063a5ae4a9SAlex Bennée target_list_exclude="$deprecated_targets_list" 17073a5ae4a9SAlex Bennée else 17083a5ae4a9SAlex Bennée target_list_exclude="$target_list_exclude,$deprecated_targets_list" 17093a5ae4a9SAlex Bennée fi 17102d838d9bSAlex Bennéefi 17112d838d9bSAlex Bennée 1712447e133fSAlex Bennéefor config in $mak_wilds; do 1713447e133fSAlex Bennée target="$(basename "$config" .mak)" 171498db9a06SAlex Bennée if echo "$target_list_exclude" | grep -vq "$target"; then 1715447e133fSAlex Bennée default_target_list="${default_target_list} $target" 1716447e133fSAlex Bennée fi 1717447e133fSAlex Bennéedone 17186e92f823SPeter Maydell 1719c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 172064a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1721c53eeaf7SStefan Hajnoczi 1722af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1723af5db58eSpbrookcat << EOF 1724af5db58eSpbrook 1725af5db58eSpbrookUsage: configure [options] 1726af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1727af5db58eSpbrook 172808fb77edSStefan WeilStandard options: 172908fb77edSStefan Weil --help print this message 173008fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 173108fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 173208fb77edSStefan Weil use %M for cpu name [$interp_prefix] 17332deca810SAlex Bennée --target-list=LIST set target list (default: build all non-deprecated) 173408fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 173508fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 17362deca810SAlex Bennée$(echo Deprecated targets: $deprecated_targets_list | \ 17372deca810SAlex Bennée fold -s -w 53 | sed -e 's/^/ /') 1738447e133fSAlex Bennée --target-list-exclude=LIST exclude a set of targets from the default target-list 173908fb77edSStefan Weil 174008fb77edSStefan WeilAdvanced options (experts only): 17413812c0c4SJoelle van Dyne --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] 174208fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 174308fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 174408fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 174508fb77edSStefan Weil build time 174608fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 174708fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 174808fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 174911cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 175008fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1751d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1752d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 175308fb77edSStefan Weil --make=MAKE use specified make [$make] 175408fb77edSStefan Weil --python=PYTHON use specified python [$python] 17552eb054c2SPeter Maydell --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1756a5665051SPaolo Bonzini --meson=MESON use specified meson [$meson] 175748328880SPaolo Bonzini --ninja=NINJA use specified ninja [$ninja] 175808fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1759db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 17607d7dbf9dSDan Streetman --with-git-submodules=update update git submodules (default if .git dir exists) 17617d7dbf9dSDan Streetman --with-git-submodules=validate fail if git submodules are not up to date 17627d7dbf9dSDan Streetman --with-git-submodules=ignore do not update or check git submodules (default if no .git dir) 176308fb77edSStefan Weil --static enable static build [$static] 176408fb77edSStefan Weil --mandir=PATH install man pages in PATH 176510ff82d1SMarc-André Lureau --datadir=PATH install firmware in PATH/$qemu_suffix 1766fe0038beSPaolo Bonzini --localedir=PATH install translation in PATH/$qemu_suffix 176710ff82d1SMarc-André Lureau --docdir=PATH install documentation in PATH/$qemu_suffix 176808fb77edSStefan Weil --bindir=PATH install binaries in PATH 176908fb77edSStefan Weil --libdir=PATH install libraries in PATH 1770db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 177110ff82d1SMarc-André Lureau --sysconfdir=PATH install config in PATH/$qemu_suffix 177208fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 17733d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 177413336606SRobert Foley --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1775ca8c0909SMarc-André Lureau --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1776db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 1777c035c8d6SPaolo Bonzini --without-default-features default all --enable-* options to "disabled" 1778c035c8d6SPaolo Bonzini --without-default-devices do not include any device that is not needed to 1779c035c8d6SPaolo Bonzini start the emulator (only use if you are including 1780d1d5e9eeSAlex Bennée desired devices in configs/devices/) 1781d1d5e9eeSAlex Bennée --with-devices-ARCH=NAME override default configs/devices 178208fb77edSStefan Weil --enable-debug enable common debug build options 1783247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 17840aebab04SLingfeng Yang --enable-tsan enable thread sanitizer 178508fb77edSStefan Weil --disable-strip disable stripping binaries 178608fb77edSStefan Weil --disable-werror disable compilation abort on warning 178763678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 178887430d5bSPaolo Bonzini --audio-drv-list=LIST set audio drivers list 178908fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 179008fb77edSStefan Weil --block-drv-rw-whitelist=L 179108fb77edSStefan Weil set block driver read-write whitelist 1792e5f05f8cSKevin Wolf (by default affects only QEMU, not tools like qemu-img) 179308fb77edSStefan Weil --block-drv-ro-whitelist=L 179408fb77edSStefan Weil set block driver read-only whitelist 1795e5f05f8cSKevin Wolf (by default affects only QEMU, not tools like qemu-img) 1796e5f05f8cSKevin Wolf --enable-block-drv-whitelist-in-tools 1797e5f05f8cSKevin Wolf use block whitelist also in tools instead of only QEMU 17985b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1799c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 180008fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 180108fb77edSStefan Weil Default:trace-<pid> 1802c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1803e9a16e38SPhilippe Mathieu-Daudé --enable-tcg-interpreter enable TCI (TCG with bytecode interpreter, experimental and slow) 18045a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1805c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 180608fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 180733c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 180808fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 1809c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1810c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1811c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1812a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1813c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1814c12d66aaSLin Ma --enable-profiler profiler support 1815c12d66aaSLin Ma --enable-debug-stack-usage 1816c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 181740e8c6f4SAlex Bennée --enable-plugins 181840e8c6f4SAlex Bennée enable plugins via shared library loading 1819afc3a8f9SAlex Bennée --disable-containers don't use containers for cross-building 1820f48e590aSAlex Bennée --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1821*61d63097SPaolo BonziniEOF 1822*61d63097SPaolo Bonzini meson_options_help 1823*61d63097SPaolo Bonzinicat << EOF 1824c23f23b9SMichael Tokarev system all system emulation targets 1825c23f23b9SMichael Tokarev user supported user emulation targets 1826c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1827c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1828c23f23b9SMichael Tokarev docs build documentation 1829c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1830c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1831c23f23b9SMichael Tokarev pie Position Independent Executables 183221e709aaSMarc-André Lureau modules modules support (non-Windows) 1833bd83c861SChristian Ehrhardt module-upgrades try to load modules from alternate paths for upgrades 1834c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1835c23f23b9SMichael Tokarev debug-info debugging information 1836cdad781dSDaniele Buono lto Enable Link-Time Optimization. 1837c23f23b9SMichael Tokarev sparse sparse checker 18381e4f6065SDaniele Buono safe-stack SafeStack Stack Smash Protection. Depends on 18391e4f6065SDaniele Buono clang/llvm >= 3.7 and requires coroutine backend ucontext. 18409e62ba48SDaniele Buono cfi Enable Control-Flow Integrity for indirect function calls. 18419e62ba48SDaniele Buono In case of a cfi violation, QEMU is terminated with SIGILL 18429e62ba48SDaniele Buono Depends on lto and is incompatible with modules 18439e62ba48SDaniele Buono Automatically enables Link-Time Optimization (lto) 18449e62ba48SDaniele Buono cfi-debug In case of a cfi violation, a message containing the line that 18459e62ba48SDaniele Buono triggered the error is written to stderr. After the error, 18469e62ba48SDaniele Buono QEMU is still terminated with SIGILL 1847ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 184891bfcdb0SDaniel P. Berrange nettle nettle cryptography support 184991bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 18508953caf3SDaniel P. Berrange auth-pam PAM access control 1851c23f23b9SMichael Tokarev sdl SDL UI 185204c6e16fSMarkus Armbruster sdl-image SDL Image support for icons 1853c23f23b9SMichael Tokarev gtk gtk UI 1854c23f23b9SMichael Tokarev vte vte support for the gtk UI 1855c23f23b9SMichael Tokarev curses curses UI 1856e08bb301SSamuel Thibault iconv font glyph conversion support 1857c23f23b9SMichael Tokarev vnc VNC UI support 1858c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1859c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1860c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1861c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1862c23f23b9SMichael Tokarev virtfs VirtFS 1863cece116cSMisono Tomohiro virtiofsd build virtiofs daemon (virtiofsd) 18645c53015aSPaolo Bonzini libudev Use libudev to enumerate host devices 1865fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1866c23f23b9SMichael Tokarev xen xen backend driver support 186770c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1868ca50e523SPaolo Bonzini alsa ALSA sound support 1869ca50e523SPaolo Bonzini coreaudio CoreAudio sound support 1870ca50e523SPaolo Bonzini dsound DirectSound sound support 1871ca50e523SPaolo Bonzini jack JACK sound support 1872ca50e523SPaolo Bonzini oss OSS sound support 1873ca50e523SPaolo Bonzini pa PulseAudio sound support 1874c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1875c23f23b9SMichael Tokarev curl curl connectivity 1876a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1877c23f23b9SMichael Tokarev fdt fdt device tree 1878c23f23b9SMichael Tokarev kvm KVM acceleration support 1879b0cb0a66SVincent Palatin hax HAX acceleration support 1880c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 188174a414a1SReinoud Zandijk nvmm NVMM acceleration support 1882d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 188321ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 188421ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1885c23f23b9SMichael Tokarev vde support for vde network 1886c23f23b9SMichael Tokarev netmap support for netmap network 1887c23f23b9SMichael Tokarev linux-aio Linux AIO support 1888c10dd856SAarushi Mehta linux-io-uring Linux io_uring support 1889c23f23b9SMichael Tokarev cap-ng libcap-ng support 1890c23f23b9SMichael Tokarev attr attr and xattr support 1891299e6f19SPaolo Bonzini vhost-net vhost-net kernel acceleration support 1892299e6f19SPaolo Bonzini vhost-vsock virtio sockets device support 1893299e6f19SPaolo Bonzini vhost-scsi vhost-scsi kernel target support 1894299e6f19SPaolo Bonzini vhost-crypto vhost-user-crypto backend support 1895299e6f19SPaolo Bonzini vhost-kernel vhost kernel backend support 1896299e6f19SPaolo Bonzini vhost-user vhost-user backend support 1897bc15e44cSStefan Hajnoczi vhost-user-blk-server vhost-user-blk server support 1898108a6481SCindy Lu vhost-vdpa vhost-vdpa kernel backend support 189946627f41SAndrew Melnychenko bpf BPF kernel support 1900c23f23b9SMichael Tokarev spice spice 190158d3f3ffSGerd Hoffmann spice-protocol spice-protocol 1902c23f23b9SMichael Tokarev rbd rados block device (rbd) 1903c23f23b9SMichael Tokarev libiscsi iscsi support 1904c23f23b9SMichael Tokarev libnfs nfs support 19057b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 19060a40bcb7SCésar Belley u2f U2F support (u2f-emu) 1907c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1908ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1909c23f23b9SMichael Tokarev usb-redir usb network redirection support 1910c23f23b9SMichael Tokarev lzo support of lzo compression library 1911c23f23b9SMichael Tokarev snappy support of snappy compression library 1912c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1913c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 191483bc1f97SJulio Faracco lzfse support of lzfse compression library 191583bc1f97SJulio Faracco (for reading lzfse-compressed dmg images) 19163a678481SJuan Quintela zstd support for zstd compression library 1917d298ac10SDenis Plotnikov (for migration compression and qcow2 cluster compression) 1918c23f23b9SMichael Tokarev seccomp seccomp support 1919c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1920c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1921c23f23b9SMichael Tokarev tpm TPM support 1922b10d49d7SPino Toscano libssh ssh block device support 1923c23f23b9SMichael Tokarev numa libnuma support 1924ed279a06SKlim Kireev libxml2 for Parallels image format 1925c23f23b9SMichael Tokarev tcmalloc tcmalloc support 19267b01cb97SAlexandre Derumier jemalloc jemalloc support 192786583a07SLiam Merwick avx2 AVX2 optimization support 19286b8cd447SRobert Hoo avx512f AVX512F optimization support 1929a6b1d4c0SChanglong Xie replication replication support 1930c12d66aaSLin Ma opengl opengl support 1931c12d66aaSLin Ma virglrenderer virgl rendering support 1932c12d66aaSLin Ma xfsctl xfsctl support 1933c12d66aaSLin Ma qom-cast-debug cast debugging support 19348de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 19352f740136SJeff Cody bochs bochs image format support 19362f740136SJeff Cody cloop cloop image format support 19372f740136SJeff Cody dmg dmg image format support 19382f740136SJeff Cody qcow1 qcow v1 image format support 19392f740136SJeff Cody vdi vdi image format support 19402f740136SJeff Cody vvfat vvfat image format support 19412f740136SJeff Cody qed qed image format support 19422f740136SJeff Cody parallels parallels image format support 1943f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 19448ca80760SRichard Henderson capstone capstone disassembler support 1945ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 194617824406SJunyan He libpmem libpmem support 194775411919SJames Le Cuirot xkbcommon xkbcommon support 1948b767d257SMarek Marczykowski-Górecki rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 194921b2eca6SJingqi Liu libdaxctl libdaxctl support 1950a484a719SMax Reitz fuse FUSE block device export 1951df4ea709SMax Reitz fuse-lseek SEEK_HOLE/SEEK_DATA support for FUSE exports 1952106ad1f9SPaolo Bonzini multiprocess Out of process device emulation support 195320cf7b8eSDenis Plotnikov gio libgio support 1954b8e0c493SJoelle van Dyne slirp-smbd use smbd (at path --smbd=*) in slirp networking 195508fb77edSStefan Weil 195608fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1957af5db58eSpbrookEOF 19582d2ad6d0SFam Zhengexit 0 1959af5db58eSpbrookfi 1960af5db58eSpbrook 19619c790242SThomas Huth# Remove old dependency files to make sure that they get properly regenerated 1962bb768f71SThomas Huthrm -f */config-devices.mak.d 19639c790242SThomas Huth 1964faf44142SDaniel P. Berrangéif test -z "$python" 1965faf44142SDaniel P. Berrangéthen 1966c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1967c53eeaf7SStefan Hajnoczifi 19688e2c76bdSRoman Bolshakovif ! has "$make" 19698e2c76bdSRoman Bolshakovthen 19708e2c76bdSRoman Bolshakov error_exit "GNU make ($make) not found" 19718e2c76bdSRoman Bolshakovfi 1972c53eeaf7SStefan Hajnoczi 1973c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1974c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 19751b11f28dSThomas Huthif ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then 19761b11f28dSThomas Huth error_exit "Cannot use '$python', Python >= 3.6 is required." \ 1977c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1978c53eeaf7SStefan Hajnoczifi 1979c53eeaf7SStefan Hajnoczi 1980755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 1981406ab2f3SCleber Rosapython_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) 1982755ee70fSCleber Rosa 1983c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1984c53eeaf7SStefan Hajnoczipython="$python -B" 1985c53eeaf7SStefan Hajnoczi 19860a01d76fSMarc-André Lureauif test -z "$meson"; then 1987654d6b04SPaolo Bonzini if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.2; then 19880a01d76fSMarc-André Lureau meson=meson 19897d7dbf9dSDan Streetman elif test $git_submodules_action != 'ignore' ; then 19900a01d76fSMarc-André Lureau meson=git 19910a01d76fSMarc-André Lureau elif test -e "${source_path}/meson/meson.py" ; then 19920a01d76fSMarc-André Lureau meson=internal 19930a01d76fSMarc-André Lureau else 19940a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 19950a01d76fSMarc-André Lureau error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 19960a01d76fSMarc-André Lureau else 1997a5665051SPaolo Bonzini error_exit "Meson not found. Use --meson=/path/to/meson" 1998a5665051SPaolo Bonzini fi 19990a01d76fSMarc-André Lureau fi 20000a01d76fSMarc-André Lureauelse 20010a01d76fSMarc-André Lureau # Meson uses its own Python interpreter to invoke other Python scripts, 20020a01d76fSMarc-André Lureau # but the user wants to use the one they specified with --python. 20030a01d76fSMarc-André Lureau # 20040a01d76fSMarc-André Lureau # We do not want to override the distro Python interpreter (and sometimes 20050a01d76fSMarc-André Lureau # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 20060a01d76fSMarc-André Lureau # just require --meson=git|internal together with --python. 20070a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 20080a01d76fSMarc-André Lureau case "$meson" in 20090a01d76fSMarc-André Lureau git | internal) ;; 20100a01d76fSMarc-André Lureau *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 20110a01d76fSMarc-André Lureau esac 20120a01d76fSMarc-André Lureau fi 20130a01d76fSMarc-André Lureaufi 2014a5665051SPaolo Bonzini 20150a01d76fSMarc-André Lureauif test "$meson" = git; then 20160a01d76fSMarc-André Lureau git_submodules="${git_submodules} meson" 20170a01d76fSMarc-André Lureaufi 20180a01d76fSMarc-André Lureau 20190a01d76fSMarc-André Lureaucase "$meson" in 20200a01d76fSMarc-André Lureau git | internal) 20210a01d76fSMarc-André Lureau meson="$python ${source_path}/meson/meson.py" 20220a01d76fSMarc-André Lureau ;; 202384ec0c24SPaolo Bonzini *) meson=$(command -v "$meson") ;; 20240a01d76fSMarc-André Lureauesac 20250a01d76fSMarc-André Lureau 202609e93326SPaolo Bonzini# Probe for ninja 202748328880SPaolo Bonzini 202848328880SPaolo Bonziniif test -z "$ninja"; then 202948328880SPaolo Bonzini for c in ninja ninja-build samu; do 203048328880SPaolo Bonzini if has $c; then 203148328880SPaolo Bonzini ninja=$(command -v "$c") 203248328880SPaolo Bonzini break 203348328880SPaolo Bonzini fi 203448328880SPaolo Bonzini done 203509e93326SPaolo Bonzini if test -z "$ninja"; then 203609e93326SPaolo Bonzini error_exit "Cannot find Ninja" 203709e93326SPaolo Bonzini fi 203848328880SPaolo Bonzinifi 2039a5665051SPaolo Bonzini 20409aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 20419aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 20429aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 20439aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 20449aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 20459aae6e54SDaniel Henrique Barbozaif compile_object ; then 20469aae6e54SDaniel Henrique Barboza : C compiler works ok 20479aae6e54SDaniel Henrique Barbozaelse 20489aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 20499aae6e54SDaniel Henrique Barbozafi 20509aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 20519aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 20529aae6e54SDaniel Henrique Barbozafi 20539aae6e54SDaniel Henrique Barboza 20549c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 20559c83ffd8SPeter Maydell# by default. Only enable by default for git builds 20569c83ffd8SPeter Maydellif test -z "$werror" ; then 20577d7dbf9dSDan Streetman if test "$git_submodules_action" != "ignore" && \ 2058e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 20599c83ffd8SPeter Maydell werror="yes" 20609c83ffd8SPeter Maydell else 20619c83ffd8SPeter Maydell werror="no" 20629c83ffd8SPeter Maydell fi 20639c83ffd8SPeter Maydellfi 20649c83ffd8SPeter Maydell 2065975ff037SPaolo Bonziniif test "$targetos" = "bogus"; then 2066fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 2067fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 2068fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 2069fb59dabdSPeter Maydell # host OS we should stop now. 2070951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 2071fb59dabdSPeter Maydellfi 2072fb59dabdSPeter Maydell 2073efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 2074efc6c070SThomas Huthcat > $TMPC << EOF 2075efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 2076efc6c070SThomas Huth# ifdef __apple_build_version__ 20772a85a08cSDaniel P. Berrangé# if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0) 20782a85a08cSDaniel P. Berrangé# error You need at least XCode Clang v10.0 to compile QEMU 2079efc6c070SThomas Huth# endif 2080efc6c070SThomas Huth# else 20812a85a08cSDaniel P. Berrangé# if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0) 20822a85a08cSDaniel P. Berrangé# error You need at least Clang v6.0 to compile QEMU 2083efc6c070SThomas Huth# endif 2084efc6c070SThomas Huth# endif 2085efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 20863830df5fSnia# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) 20873830df5fSnia# error You need at least GCC v7.4.0 to compile QEMU 2088efc6c070SThomas Huth# endif 2089efc6c070SThomas Huth#else 2090efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 2091efc6c070SThomas Huth#endif 2092efc6c070SThomas Huthint main (void) { return 0; } 2093efc6c070SThomas HuthEOF 2094efc6c070SThomas Huthif ! compile_prog "" "" ; then 20953830df5fSnia error_exit "You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)" 2096efc6c070SThomas Huthfi 2097efc6c070SThomas Huth 209800849b92SRichard Henderson# Accumulate -Wfoo and -Wno-bar separately. 209900849b92SRichard Henderson# We will list all of the enable flags first, and the disable flags second. 210000849b92SRichard Henderson# Note that we do not add -Werror, because that would enable it for all 210100849b92SRichard Henderson# configure tests. If a configure test failed due to -Werror this would 210200849b92SRichard Henderson# just silently disable some features, so it's too error prone. 210300849b92SRichard Henderson 210400849b92SRichard Hendersonwarn_flags= 210500849b92SRichard Hendersonadd_to warn_flags -Wold-style-declaration 210600849b92SRichard Hendersonadd_to warn_flags -Wold-style-definition 210700849b92SRichard Hendersonadd_to warn_flags -Wtype-limits 210800849b92SRichard Hendersonadd_to warn_flags -Wformat-security 210900849b92SRichard Hendersonadd_to warn_flags -Wformat-y2k 211000849b92SRichard Hendersonadd_to warn_flags -Winit-self 211100849b92SRichard Hendersonadd_to warn_flags -Wignored-qualifiers 211200849b92SRichard Hendersonadd_to warn_flags -Wempty-body 211300849b92SRichard Hendersonadd_to warn_flags -Wnested-externs 211400849b92SRichard Hendersonadd_to warn_flags -Wendif-labels 211500849b92SRichard Hendersonadd_to warn_flags -Wexpansion-to-defined 21160a2ebce9SThomas Huthadd_to warn_flags -Wimplicit-fallthrough=2 211700849b92SRichard Henderson 211800849b92SRichard Hendersonnowarn_flags= 211900849b92SRichard Hendersonadd_to nowarn_flags -Wno-initializer-overrides 212000849b92SRichard Hendersonadd_to nowarn_flags -Wno-missing-include-dirs 212100849b92SRichard Hendersonadd_to nowarn_flags -Wno-shift-negative-value 212200849b92SRichard Hendersonadd_to nowarn_flags -Wno-string-plus-int 212300849b92SRichard Hendersonadd_to nowarn_flags -Wno-typedef-redefinition 2124aabab967SRichard Hendersonadd_to nowarn_flags -Wno-tautological-type-limit-compare 2125bac8d222SRichard Hendersonadd_to nowarn_flags -Wno-psabi 212600849b92SRichard Henderson 212700849b92SRichard Hendersongcc_flags="$warn_flags $nowarn_flags" 212893b25869SJohn Snow 212993b25869SJohn Snowcc_has_warning_flag() { 213093b25869SJohn Snow write_c_skeleton; 213193b25869SJohn Snow 2132a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 2133a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 2134a1d29d6cSPeter Maydell # warning options). 213593b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 213693b25869SJohn Snow compile_prog "-Werror $optflag" "" 213793b25869SJohn Snow} 213893b25869SJohn Snow 213993b25869SJohn Snowfor flag in $gcc_flags; do 214093b25869SJohn Snow if cc_has_warning_flag $flag ; then 21418d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 21428d05095cSPaolo Bonzini fi 21438d05095cSPaolo Bonzinidone 21448d05095cSPaolo Bonzini 214563678e17SSteven Noonanif test "$stack_protector" != "no"; then 2146fccd35a0SRodrigo Rebello cat > $TMPC << EOF 2147fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 2148fccd35a0SRodrigo Rebello{ 2149fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 2150fccd35a0SRodrigo Rebello while (*c) { 2151fccd35a0SRodrigo Rebello *p++ = *c++; 2152fccd35a0SRodrigo Rebello } 2153fccd35a0SRodrigo Rebello return 0; 2154fccd35a0SRodrigo Rebello} 2155fccd35a0SRodrigo RebelloEOF 215663678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 21573b463a3fSMiroslav Rezanina sp_on=0 215863678e17SSteven Noonan for flag in $gcc_flags; do 2159590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 2160590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 2161086d5f75SPaolo Bonzini if compile_object "-Werror $flag" && 2162590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 216363678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2164db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 21653b463a3fSMiroslav Rezanina sp_on=1 216663678e17SSteven Noonan break 216763678e17SSteven Noonan fi 216863678e17SSteven Noonan done 21693b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 21703b463a3fSMiroslav Rezanina if test $sp_on = 0; then 21713b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 21723b463a3fSMiroslav Rezanina fi 21733b463a3fSMiroslav Rezanina fi 217437746c5eSMarc-André Lureaufi 217537746c5eSMarc-André Lureau 217620bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 217720bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 217820bc94a2SPaolo Bonzinicat > $TMPC << EOF 217920bc94a2SPaolo Bonzinistruct { 218020bc94a2SPaolo Bonzini int a[2]; 218120bc94a2SPaolo Bonzini} x = {0}; 218220bc94a2SPaolo BonziniEOF 218320bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 218420bc94a2SPaolo Bonzini : 218520bc94a2SPaolo Bonzinielse 218620bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 218720bc94a2SPaolo Bonzinifi 218820bc94a2SPaolo Bonzini 218921e709aaSMarc-André Lureau# Our module code doesn't support Windows 219021e709aaSMarc-André Lureauif test "$modules" = "yes" && test "$mingw32" = "yes" ; then 219121e709aaSMarc-André Lureau error_exit "Modules are not available for Windows" 219221e709aaSMarc-André Lureaufi 219321e709aaSMarc-André Lureau 2194bd83c861SChristian Ehrhardt# module_upgrades is only reasonable if modules are enabled 2195bd83c861SChristian Ehrhardtif test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2196bd83c861SChristian Ehrhardt error_exit "Can't enable module-upgrades as Modules are not enabled" 2197bd83c861SChristian Ehrhardtfi 2198bd83c861SChristian Ehrhardt 21995f2453acSAlex Bennée# Static linking is not possible with plugins, modules or PIE 220040d6444eSAvi Kivityif test "$static" = "yes" ; then 2201aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 2202aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 2203aa0d1f44SPaolo Bonzini fi 22045f2453acSAlex Bennée if test "$plugins" = "yes"; then 22055f2453acSAlex Bennée error_exit "static and plugins are mutually incompatible" 2206ba4dd2aaSAlex Bennée else 2207ba4dd2aaSAlex Bennée plugins="no" 22085f2453acSAlex Bennée fi 220940d6444eSAvi Kivityfi 221040d6444eSAvi Kivity 2211768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 2212768b7855SEmilio G. Cota cat > $TMPC << EOF 2213768b7855SEmilio G. Cotastatic __thread int tls_var; 2214768b7855SEmilio G. Cotaint main(void) { return tls_var; } 2215768b7855SEmilio G. CotaEOF 2216768b7855SEmilio G. Cota 2217768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 2218768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 2219768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 2220768b7855SEmilio G. Cotafi 2221768b7855SEmilio G. Cota 222240d6444eSAvi Kivitycat > $TMPC << EOF 222321d4a791SAvi Kivity 222421d4a791SAvi Kivity#ifdef __linux__ 222521d4a791SAvi Kivity# define THREAD __thread 222621d4a791SAvi Kivity#else 222721d4a791SAvi Kivity# define THREAD 222821d4a791SAvi Kivity#endif 222921d4a791SAvi Kivitystatic THREAD int tls_var; 223021d4a791SAvi Kivityint main(void) { return tls_var; } 223140d6444eSAvi KivityEOF 2232b2634124SRichard Henderson 2233b2634124SRichard Henderson# Check we support --no-pie first; we will need this for building ROMs. 2234412aeacdSAlex Bennéeif compile_prog "-Werror -fno-pie" "-no-pie"; then 2235412aeacdSAlex Bennée CFLAGS_NOPIE="-fno-pie" 2236412aeacdSAlex Bennéefi 2237412aeacdSAlex Bennée 223812781462SRichard Hendersonif test "$static" = "yes"; then 2239eca7a8e6SRichard Henderson if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 22405770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 224112781462SRichard Henderson QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 224212781462SRichard Henderson pie="yes" 224312781462SRichard Henderson elif test "$pie" = "yes"; then 224412781462SRichard Henderson error_exit "-static-pie not available due to missing toolchain support" 224512781462SRichard Henderson else 224612781462SRichard Henderson QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 224712781462SRichard Henderson pie="no" 224812781462SRichard Henderson fi 224912781462SRichard Hendersonelif test "$pie" = "no"; then 22505770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" 2251eca7a8e6SRichard Hendersonelif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 22525770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 22535770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" 225440d6444eSAvi Kivity pie="yes" 22552c674109SRichard Hendersonelif test "$pie" = "yes"; then 225676ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 225740d6444eSAvi Kivityelse 225840d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 225940d6444eSAvi Kivity pie="no" 226040d6444eSAvi Kivityfi 226140d6444eSAvi Kivity 2262e6cbd751SRichard Henderson# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2263e6cbd751SRichard Henderson# The combination is known as "full relro", because .got.plt is read-only too. 2264e6cbd751SRichard Hendersonif compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2265e6cbd751SRichard Henderson QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2266e6cbd751SRichard Hendersonfi 2267e6cbd751SRichard Henderson 226809dada40SPaolo Bonzini########################################## 226909dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 227009dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 227109dada40SPaolo Bonzini# specification is necessary 227209dada40SPaolo Bonzini 227309dada40SPaolo Bonziniif test "$cpu" = "i386"; then 227409dada40SPaolo Bonzini cat > $TMPC << EOF 227509dada40SPaolo Bonzinistatic int sfaa(int *ptr) 227609dada40SPaolo Bonzini{ 227709dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 227809dada40SPaolo Bonzini} 227909dada40SPaolo Bonzini 228009dada40SPaolo Bonziniint main(void) 228109dada40SPaolo Bonzini{ 228209dada40SPaolo Bonzini int val = 42; 22831405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 228409dada40SPaolo Bonzini sfaa(&val); 228509dada40SPaolo Bonzini return val; 228609dada40SPaolo Bonzini} 228709dada40SPaolo BonziniEOF 228809dada40SPaolo Bonzini if ! compile_prog "" "" ; then 228909dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 229009dada40SPaolo Bonzini fi 229109dada40SPaolo Bonzinifi 229209dada40SPaolo Bonzini 229356267b62SPhilippe Mathieu-Daudéif test "$tcg" = "enabled"; then 229456267b62SPhilippe Mathieu-Daudé git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 229556267b62SPhilippe Mathieu-Daudé git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 229656267b62SPhilippe Mathieu-Daudéfi 229756267b62SPhilippe Mathieu-Daudé 2298afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 2299fdb75aefSPaolo Bonzini default_targets=yes 2300d880a3baSPaolo Bonzini for target in $default_target_list; do 2301d880a3baSPaolo Bonzini target_list="$target_list $target" 2302d880a3baSPaolo Bonzini done 2303d880a3baSPaolo Bonzini target_list="${target_list# }" 2304121afa9eSAnthony Liguorielse 2305fdb75aefSPaolo Bonzini default_targets=no 230689138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2307d880a3baSPaolo Bonzini for target in $target_list; do 230825b48338SPeter Maydell # Check that we recognised the target name; this allows a more 230925b48338SPeter Maydell # friendly error message than if we let it fall through. 231025b48338SPeter Maydell case " $default_target_list " in 231125b48338SPeter Maydell *" $target "*) 231225b48338SPeter Maydell ;; 231325b48338SPeter Maydell *) 231425b48338SPeter Maydell error_exit "Unknown target name '$target'" 231525b48338SPeter Maydell ;; 231625b48338SPeter Maydell esac 231725b48338SPeter Maydell done 2318d880a3baSPaolo Bonzinifi 231925b48338SPeter Maydell 2320fdb75aefSPaolo Bonzinifor target in $target_list; do 2321fdb75aefSPaolo Bonzini # if a deprecated target is enabled we note it here 2322fdb75aefSPaolo Bonzini if echo "$deprecated_targets_list" | grep -q "$target"; then 2323fdb75aefSPaolo Bonzini add_to deprecated_features $target 2324fdb75aefSPaolo Bonzini fi 2325fdb75aefSPaolo Bonzinidone 2326fdb75aefSPaolo Bonzini 2327f55fe278SPaolo Bonzini# see if system emulation was really requested 2328f55fe278SPaolo Bonzinicase " $target_list " in 2329f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 2330f55fe278SPaolo Bonzini ;; 2331f55fe278SPaolo Bonzini *) softmmu=no 2332f55fe278SPaolo Bonzini ;; 2333f55fe278SPaolo Bonziniesac 23345327cf48Sbellard 2335249247c9SJuan Quintelafeature_not_found() { 2336249247c9SJuan Quintela feature=$1 233721684af0SStewart Smith remedy=$2 2338249247c9SJuan Quintela 233976ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 234021684af0SStewart Smith "configure was not able to find it." \ 234121684af0SStewart Smith "$remedy" 2342249247c9SJuan Quintela} 2343249247c9SJuan Quintela 23447d13299dSbellard# --- 23457d13299dSbellard# big/little endian test 23467d13299dSbellardcat > $TMPC << EOF 2347659eb157SThomas Huth#include <stdio.h> 234861cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 234961cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 2350659eb157SThomas Huthint main(int argc, char *argv[]) 2351659eb157SThomas Huth{ 2352659eb157SThomas Huth return printf("%s %s\n", (char *)big_endian, (char *)little_endian); 23537d13299dSbellard} 23547d13299dSbellardEOF 23557d13299dSbellard 2356659eb157SThomas Huthif compile_prog ; then 2357659eb157SThomas Huth if strings -a $TMPE | grep -q BiGeNdIaN ; then 235861cc919fSMike Frysinger bigendian="yes" 2359659eb157SThomas Huth elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then 236061cc919fSMike Frysinger bigendian="no" 23617d13299dSbellard else 23627d13299dSbellard echo big/little test failed 2363659eb157SThomas Huth exit 1 23647d13299dSbellard fi 23657d13299dSbellardelse 236661cc919fSMike Frysinger echo big/little test failed 2367659eb157SThomas Huth exit 1 23687d13299dSbellardfi 23697d13299dSbellard 2370b0a47e79SJuan Quintela########################################## 2371e10ee3f5SPhilippe Mathieu-Daudé# system tools 2372e10ee3f5SPhilippe Mathieu-Daudéif test -z "$want_tools"; then 2373e10ee3f5SPhilippe Mathieu-Daudé if test "$softmmu" = "no"; then 2374e10ee3f5SPhilippe Mathieu-Daudé want_tools=no 2375e10ee3f5SPhilippe Mathieu-Daudé else 2376e10ee3f5SPhilippe Mathieu-Daudé want_tools=yes 2377e10ee3f5SPhilippe Mathieu-Daudé fi 2378e10ee3f5SPhilippe Mathieu-Daudéfi 2379e10ee3f5SPhilippe Mathieu-Daudé 2380e10ee3f5SPhilippe Mathieu-Daudé########################################## 2381015a33bdSGonglei# L2TPV3 probe 2382015a33bdSGonglei 2383015a33bdSGongleicat > $TMPC <<EOF 2384015a33bdSGonglei#include <sys/socket.h> 2385bff6cb72SMichael Tokarev#include <linux/ip.h> 2386015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2387015a33bdSGongleiEOF 2388015a33bdSGongleiif compile_prog "" "" ; then 2389015a33bdSGonglei l2tpv3=yes 2390015a33bdSGongleielse 2391015a33bdSGonglei l2tpv3=no 2392015a33bdSGongleifi 2393015a33bdSGonglei 2394299e6f19SPaolo Bonzini######################################### 2395299e6f19SPaolo Bonzini# vhost interdependencies and host support 2396299e6f19SPaolo Bonzini 2397299e6f19SPaolo Bonzini# vhost backends 2398d88618f7SStefan Hajnocziif test "$vhost_user" = "yes" && test "$linux" != "yes"; then 2399d88618f7SStefan Hajnoczi error_exit "vhost-user is only available on Linux" 2400299e6f19SPaolo Bonzinifi 2401108a6481SCindy Lutest "$vhost_vdpa" = "" && vhost_vdpa=$linux 2402108a6481SCindy Luif test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 2403108a6481SCindy Lu error_exit "vhost-vdpa is only available on Linux" 2404108a6481SCindy Lufi 2405299e6f19SPaolo Bonzinitest "$vhost_kernel" = "" && vhost_kernel=$linux 2406299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2407299e6f19SPaolo Bonzini error_exit "vhost-kernel is only available on Linux" 2408299e6f19SPaolo Bonzinifi 2409299e6f19SPaolo Bonzini 2410299e6f19SPaolo Bonzini# vhost-kernel devices 2411299e6f19SPaolo Bonzinitest "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2412299e6f19SPaolo Bonziniif test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2413299e6f19SPaolo Bonzini error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2414299e6f19SPaolo Bonzinifi 2415299e6f19SPaolo Bonzinitest "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2416299e6f19SPaolo Bonziniif test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2417299e6f19SPaolo Bonzini error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2418299e6f19SPaolo Bonzinifi 2419299e6f19SPaolo Bonzini 2420299e6f19SPaolo Bonzini# vhost-user backends 2421299e6f19SPaolo Bonzinitest "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2422299e6f19SPaolo Bonziniif test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2423299e6f19SPaolo Bonzini error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2424299e6f19SPaolo Bonzinifi 2425299e6f19SPaolo Bonzinitest "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2426299e6f19SPaolo Bonziniif test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2427299e6f19SPaolo Bonzini error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2428299e6f19SPaolo Bonzinifi 242998fc1adaSDr. David Alan Gilberttest "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 243098fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 243198fc1adaSDr. David Alan Gilbert error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 243298fc1adaSDr. David Alan Gilbertfi 2433108a6481SCindy Lu#vhost-vdpa backends 2434108a6481SCindy Lutest "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 2435108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 2436108a6481SCindy Lu error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 2437108a6481SCindy Lufi 2438299e6f19SPaolo Bonzini 243940bc0ca9SLaurent Vivier# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity 2440299e6f19SPaolo Bonziniif test "$vhost_net" = ""; then 2441299e6f19SPaolo Bonzini test "$vhost_net_user" = "yes" && vhost_net=yes 244240bc0ca9SLaurent Vivier test "$vhost_net_vdpa" = "yes" && vhost_net=yes 2443299e6f19SPaolo Bonzini test "$vhost_kernel" = "yes" && vhost_net=yes 2444299e6f19SPaolo Bonzinifi 2445299e6f19SPaolo Bonzini 2446015a33bdSGonglei########################################## 2447779ab5e3SStefan Weil# pkg-config probe 2448779ab5e3SStefan Weil 2449779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 245076ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2451779ab5e3SStefan Weilfi 2452779ab5e3SStefan Weil 2453779ab5e3SStefan Weil########################################## 2454b0a47e79SJuan Quintela# NPTL probe 2455b0a47e79SJuan Quintela 245624cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2457bd0c5661Spbrook cat > $TMPC <<EOF 2458bd0c5661Spbrook#include <sched.h> 245930813ceaSpbrook#include <linux/futex.h> 2460182eacc0SStefan Weilint main(void) { 2461bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2462bd0c5661Spbrook#error bork 2463bd0c5661Spbrook#endif 2464182eacc0SStefan Weil return 0; 2465bd0c5661Spbrook} 2466bd0c5661SpbrookEOF 246724cb36a6SPeter Maydell if ! compile_object ; then 246821684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2469b0a47e79SJuan Quintela fi 2470bd0c5661Spbrookfi 2471bd0c5661Spbrook 2472ac62922eSbalrog########################################## 2473e37630caSaliguori# xen probe 2474e37630caSaliguori 24751badb709SPaolo Bonziniif test "$xen" != "disabled" ; then 2476c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2477c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2478c1cdd9d5SJuergen Gross # to obtain all needed flags. 2479c1cdd9d5SJuergen Gross 2480c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2481c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2482c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2483c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 24841badb709SPaolo Bonzini xen=enabled 24855b6a8f43SMichael Tokarev xen_pc="xencontrol xenstore xenforeignmemory xengnttab" 2486c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 248758ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 248858ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 248958ea9a7aSAnthony PERARD fi 2490582ea95fSMarc-André Lureau xen_cflags="$($pkg_config --cflags $xen_pc)" 2491582ea95fSMarc-André Lureau xen_libs="$($pkg_config --libs $xen_pc)" 2492c1cdd9d5SJuergen Gross else 2493c1cdd9d5SJuergen Gross 24945b6a8f43SMichael Tokarev xen_libs="-lxenstore -lxenctrl" 2495d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2496d5b93ddfSAnthony PERARD 249750ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 249850ced5b3SStefan Weil # If no, we are done and there is no Xen support. 249950ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 250050ced5b3SStefan Weil 250150ced5b3SStefan Weil # Xen (any) 250250ced5b3SStefan Weil cat > $TMPC <<EOF 250350ced5b3SStefan Weil#include <xenctrl.h> 250450ced5b3SStefan Weilint main(void) { 250550ced5b3SStefan Weil return 0; 250650ced5b3SStefan Weil} 250750ced5b3SStefan WeilEOF 250850ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 250950ced5b3SStefan Weil # Xen not found 25101badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 251121684af0SStewart Smith feature_not_found "xen" "Install xen devel" 251250ced5b3SStefan Weil fi 25131badb709SPaolo Bonzini xen=disabled 251450ced5b3SStefan Weil 2515d5b93ddfSAnthony PERARD # Xen unstable 251669deef08SPeter Maydell elif 251769deef08SPeter Maydell cat > $TMPC <<EOF && 25182cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 25192cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 25202cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2521d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 25222cbf8903SRoss Lagerwallint main(void) { 25232cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2524d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 25252cbf8903SRoss Lagerwall 25262cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 25272cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 25282cbf8903SRoss Lagerwall 2529d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2530d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2531d3c49ebbSPaul Durrant 25322cbf8903SRoss Lagerwall return 0; 25332cbf8903SRoss Lagerwall} 25342cbf8903SRoss LagerwallEOF 25352cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 25362cbf8903SRoss Lagerwall then 25372cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 25382cbf8903SRoss Lagerwall xen_ctrl_version=41100 25391badb709SPaolo Bonzini xen=enabled 25402cbf8903SRoss Lagerwall elif 25412cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 25425ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 25435ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 254458ea9a7aSAnthony PERARD#include <xentoolcore.h> 25455ba3d756SIgor Druzhininint main(void) { 25465ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 25475ba3d756SIgor Druzhinin 25485ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 25495ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 255058ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 25515ba3d756SIgor Druzhinin 25525ba3d756SIgor Druzhinin return 0; 25535ba3d756SIgor Druzhinin} 25545ba3d756SIgor DruzhininEOF 255558ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 25565ba3d756SIgor Druzhinin then 255758ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 25585ba3d756SIgor Druzhinin xen_ctrl_version=41000 25591badb709SPaolo Bonzini xen=enabled 25605ba3d756SIgor Druzhinin elif 25615ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2562da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2563da8090ccSPaul Durrant#define __XEN_TOOLS__ 2564da8090ccSPaul Durrant#include <xendevicemodel.h> 2565da8090ccSPaul Durrantint main(void) { 2566da8090ccSPaul Durrant xendevicemodel_handle *xd; 2567da8090ccSPaul Durrant 2568da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2569da8090ccSPaul Durrant xendevicemodel_close(xd); 2570da8090ccSPaul Durrant 2571da8090ccSPaul Durrant return 0; 2572da8090ccSPaul Durrant} 2573da8090ccSPaul DurrantEOF 2574da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2575da8090ccSPaul Durrant then 2576da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2577f1167ee6SJuergen Gross xen_ctrl_version=40900 25781badb709SPaolo Bonzini xen=enabled 2579da8090ccSPaul Durrant elif 2580da8090ccSPaul Durrant cat > $TMPC <<EOF && 25815eeb39c2SIan Campbell/* 25825eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 25835eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2584b6eb9b45SPaulina Szubarczyk * 2585b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2586b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2587b6eb9b45SPaulina Szubarczyk */ 2588b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2589b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2590b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2591b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2592b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2593b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2594b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2595b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2596b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2597b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2598b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2599b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2600b6eb9b45SPaulina Szubarczyk#endif 2601b6eb9b45SPaulina Szubarczykint main(void) { 2602b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2603b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2604b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2605b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2606b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2607b6eb9b45SPaulina Szubarczyk 2608b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2609b6eb9b45SPaulina Szubarczyk 2610b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2611b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2612b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2613b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2614b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2615b6eb9b45SPaulina Szubarczyk 2616b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2617b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2618b6eb9b45SPaulina Szubarczyk 2619b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2620b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2621b6eb9b45SPaulina Szubarczyk 2622b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2623b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2624b6eb9b45SPaulina Szubarczyk 2625b6eb9b45SPaulina Szubarczyk return 0; 2626b6eb9b45SPaulina Szubarczyk} 2627b6eb9b45SPaulina SzubarczykEOF 2628b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2629b6eb9b45SPaulina Szubarczyk then 2630f1167ee6SJuergen Gross xen_ctrl_version=40800 26311badb709SPaolo Bonzini xen=enabled 2632b6eb9b45SPaulina Szubarczyk elif 2633b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2634b6eb9b45SPaulina Szubarczyk/* 2635b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2636b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 26375eeb39c2SIan Campbell */ 26385eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 26395eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 26405eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 26415eeb39c2SIan Campbell#include <xenctrl.h> 26425eeb39c2SIan Campbell#include <xenstore.h> 26435eeb39c2SIan Campbell#include <xenevtchn.h> 26445eeb39c2SIan Campbell#include <xengnttab.h> 26455eeb39c2SIan Campbell#include <xenforeignmemory.h> 26465eeb39c2SIan Campbell#include <stdint.h> 26475eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 26485eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 26495eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 26505eeb39c2SIan Campbell#endif 26515eeb39c2SIan Campbellint main(void) { 26525eeb39c2SIan Campbell xc_interface *xc = NULL; 26535eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 26545eeb39c2SIan Campbell xenevtchn_handle *xe; 26555eeb39c2SIan Campbell xengnttab_handle *xg; 26565eeb39c2SIan Campbell 26575eeb39c2SIan Campbell xs_daemon_open(); 26585eeb39c2SIan Campbell 26595eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 26605eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 26615eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 26625eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 26635eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 26645eeb39c2SIan Campbell 26655eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 26665eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 26675eeb39c2SIan Campbell 26685eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 26695eeb39c2SIan Campbell xenevtchn_fd(xe); 26705eeb39c2SIan Campbell 26715eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 26725eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 26735eeb39c2SIan Campbell 26745eeb39c2SIan Campbell return 0; 26755eeb39c2SIan Campbell} 26765eeb39c2SIan CampbellEOF 26775eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 26785eeb39c2SIan Campbell then 2679f1167ee6SJuergen Gross xen_ctrl_version=40701 26801badb709SPaolo Bonzini xen=enabled 2681cdadde39SRoger Pau Monne 2682cdadde39SRoger Pau Monne # Xen 4.6 2683cdadde39SRoger Pau Monne elif 2684cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2685cdadde39SRoger Pau Monne#include <xenctrl.h> 2686e108a3c1SAnthony PERARD#include <xenstore.h> 2687d5b93ddfSAnthony PERARD#include <stdint.h> 2688d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2689d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2690d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2691d5b93ddfSAnthony PERARD#endif 2692d5b93ddfSAnthony PERARDint main(void) { 2693d5b93ddfSAnthony PERARD xc_interface *xc; 2694d5b93ddfSAnthony PERARD xs_daemon_open(); 2695d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2696d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2697d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2698b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 26998688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2700d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 270120a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2702d8b441a3SJan Beulich return 0; 2703d8b441a3SJan Beulich} 2704d8b441a3SJan BeulichEOF 2705d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2706d8b441a3SJan Beulich then 2707f1167ee6SJuergen Gross xen_ctrl_version=40600 27081badb709SPaolo Bonzini xen=enabled 2709d8b441a3SJan Beulich 2710d8b441a3SJan Beulich # Xen 4.5 2711d8b441a3SJan Beulich elif 2712d8b441a3SJan Beulich cat > $TMPC <<EOF && 2713d8b441a3SJan Beulich#include <xenctrl.h> 2714d8b441a3SJan Beulich#include <xenstore.h> 2715d8b441a3SJan Beulich#include <stdint.h> 2716d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2717d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2718d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2719d8b441a3SJan Beulich#endif 2720d8b441a3SJan Beulichint main(void) { 2721d8b441a3SJan Beulich xc_interface *xc; 2722d8b441a3SJan Beulich xs_daemon_open(); 2723d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2724d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2725d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2726d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2727d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 27283996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 27293996e85cSPaul Durrant return 0; 27303996e85cSPaul Durrant} 27313996e85cSPaul DurrantEOF 27323996e85cSPaul Durrant compile_prog "" "$xen_libs" 27333996e85cSPaul Durrant then 2734f1167ee6SJuergen Gross xen_ctrl_version=40500 27351badb709SPaolo Bonzini xen=enabled 27363996e85cSPaul Durrant 27373996e85cSPaul Durrant elif 27383996e85cSPaul Durrant cat > $TMPC <<EOF && 27393996e85cSPaul Durrant#include <xenctrl.h> 27403996e85cSPaul Durrant#include <xenstore.h> 27413996e85cSPaul Durrant#include <stdint.h> 27423996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 27433996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 27443996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 27453996e85cSPaul Durrant#endif 27463996e85cSPaul Durrantint main(void) { 27473996e85cSPaul Durrant xc_interface *xc; 27483996e85cSPaul Durrant xs_daemon_open(); 27493996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 27503996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 27513996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 27523996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 27533996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 27548688e065SStefano Stabellini return 0; 27558688e065SStefano Stabellini} 27568688e065SStefano StabelliniEOF 27578688e065SStefano Stabellini compile_prog "" "$xen_libs" 275869deef08SPeter Maydell then 2759f1167ee6SJuergen Gross xen_ctrl_version=40200 27601badb709SPaolo Bonzini xen=enabled 27618688e065SStefano Stabellini 2762e37630caSaliguori else 27631badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 2764edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2765edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2766fc321b4bSJuan Quintela fi 27671badb709SPaolo Bonzini xen=disabled 2768e37630caSaliguori fi 2769d5b93ddfSAnthony PERARD 27701badb709SPaolo Bonzini if test "$xen" = enabled; then 2771f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 2772582ea95fSMarc-André Lureau xen_libs="$xen_libs $xen_stable_libs " 27735eeb39c2SIan Campbell fi 2774d5b93ddfSAnthony PERARD fi 2775e37630caSaliguori fi 2776c1cdd9d5SJuergen Grossfi 2777e37630caSaliguori 2778d661d9a4SJustin Terry (VM)########################################## 27792da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 27802da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 27812da776dbSMichael R. Hines cat > $TMPC <<EOF 27822da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 27832da776dbSMichael R. Hinesint main(void) { return 0; } 27842da776dbSMichael R. HinesEOF 2785ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 27862da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 27872da776dbSMichael R. Hines rdma="yes" 27882da776dbSMichael R. Hines else 27892da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 27902da776dbSMichael R. Hines error_exit \ 2791ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 27922da776dbSMichael R. Hines " Your options:" \ 2793ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 27942da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 27952da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 27962da776dbSMichael R. Hines fi 27972da776dbSMichael R. Hines rdma="no" 27982da776dbSMichael R. Hines fi 27992da776dbSMichael R. Hinesfi 28002da776dbSMichael R. Hines 280121ab34c9SMarcel Apfelbaum########################################## 280221ab34c9SMarcel Apfelbaum# PVRDMA detection 280321ab34c9SMarcel Apfelbaum 280421ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 280521ab34c9SMarcel Apfelbaum#include <sys/mman.h> 280621ab34c9SMarcel Apfelbaum 280721ab34c9SMarcel Apfelbaumint 280821ab34c9SMarcel Apfelbaummain(void) 280921ab34c9SMarcel Apfelbaum{ 281021ab34c9SMarcel Apfelbaum char buf = 0; 281121ab34c9SMarcel Apfelbaum void *addr = &buf; 281221ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 281321ab34c9SMarcel Apfelbaum 281421ab34c9SMarcel Apfelbaum return 0; 281521ab34c9SMarcel Apfelbaum} 281621ab34c9SMarcel ApfelbaumEOF 281721ab34c9SMarcel Apfelbaum 281821ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 281921ab34c9SMarcel Apfelbaum case "$pvrdma" in 282021ab34c9SMarcel Apfelbaum "") 282121ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 282221ab34c9SMarcel Apfelbaum pvrdma="yes" 282321ab34c9SMarcel Apfelbaum else 282421ab34c9SMarcel Apfelbaum pvrdma="no" 282521ab34c9SMarcel Apfelbaum fi 282621ab34c9SMarcel Apfelbaum ;; 282721ab34c9SMarcel Apfelbaum "yes") 282821ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 282921ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 283021ab34c9SMarcel Apfelbaum fi 283121ab34c9SMarcel Apfelbaum pvrdma="yes" 283221ab34c9SMarcel Apfelbaum ;; 283321ab34c9SMarcel Apfelbaum "no") 283421ab34c9SMarcel Apfelbaum pvrdma="no" 283521ab34c9SMarcel Apfelbaum ;; 283621ab34c9SMarcel Apfelbaum esac 283721ab34c9SMarcel Apfelbaumelse 283821ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 283921ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 284021ab34c9SMarcel Apfelbaum fi 284121ab34c9SMarcel Apfelbaum pvrdma="no" 284221ab34c9SMarcel Apfelbaumfi 284395c6bff3SBenoît Canet 2844ee108585SYuval Shaia# Let's see if enhanced reg_mr is supported 2845ee108585SYuval Shaiaif test "$pvrdma" = "yes" ; then 2846ee108585SYuval Shaia 2847ee108585SYuval Shaiacat > $TMPC <<EOF && 2848ee108585SYuval Shaia#include <infiniband/verbs.h> 2849ee108585SYuval Shaia 2850ee108585SYuval Shaiaint 2851ee108585SYuval Shaiamain(void) 2852ee108585SYuval Shaia{ 2853ee108585SYuval Shaia struct ibv_mr *mr; 2854ee108585SYuval Shaia struct ibv_pd *pd = NULL; 2855ee108585SYuval Shaia size_t length = 10; 2856ee108585SYuval Shaia uint64_t iova = 0; 2857ee108585SYuval Shaia int access = 0; 2858ee108585SYuval Shaia void *addr = NULL; 2859ee108585SYuval Shaia 2860ee108585SYuval Shaia mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 2861ee108585SYuval Shaia 2862ee108585SYuval Shaia ibv_dereg_mr(mr); 2863ee108585SYuval Shaia 2864ee108585SYuval Shaia return 0; 2865ee108585SYuval Shaia} 2866ee108585SYuval ShaiaEOF 2867ee108585SYuval Shaia if ! compile_prog "" "-libverbs"; then 2868ee108585SYuval Shaia QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 2869ee108585SYuval Shaia fi 2870ee108585SYuval Shaiafi 2871ee108585SYuval Shaia 287295c6bff3SBenoît Canet########################################## 2873c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 2874dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 2875dce512deSChristoph Hellwig cat > $TMPC << EOF 2876ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 2877dce512deSChristoph Hellwig#include <xfs/xfs.h> 2878dce512deSChristoph Hellwigint main(void) 2879dce512deSChristoph Hellwig{ 2880dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 2881dce512deSChristoph Hellwig return 0; 2882dce512deSChristoph Hellwig} 2883dce512deSChristoph HellwigEOF 2884dce512deSChristoph Hellwig if compile_prog "" "" ; then 2885dce512deSChristoph Hellwig xfs="yes" 2886dce512deSChristoph Hellwig else 2887dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 2888e3a6e0daSzhaolichang feature_not_found "xfs" "Install xfsprogs/xfslibs devel" 2889dce512deSChristoph Hellwig fi 2890dce512deSChristoph Hellwig xfs=no 2891dce512deSChristoph Hellwig fi 2892dce512deSChristoph Hellwigfi 2893dce512deSChristoph Hellwig 2894dce512deSChristoph Hellwig########################################## 2895ba4dd2aaSAlex Bennée# plugin linker support probe 2896ba4dd2aaSAlex Bennée 2897ba4dd2aaSAlex Bennéeif test "$plugins" != "no"; then 2898ba4dd2aaSAlex Bennée 2899ba4dd2aaSAlex Bennée ######################################### 2900ba4dd2aaSAlex Bennée # See if --dynamic-list is supported by the linker 2901ba4dd2aaSAlex Bennée 2902ba4dd2aaSAlex Bennée ld_dynamic_list="no" 2903ba4dd2aaSAlex Bennée cat > $TMPTXT <<EOF 2904ba4dd2aaSAlex Bennée{ 2905ba4dd2aaSAlex Bennée foo; 2906ba4dd2aaSAlex Bennée}; 2907ba4dd2aaSAlex BennéeEOF 2908ba4dd2aaSAlex Bennée 2909ba4dd2aaSAlex Bennée cat > $TMPC <<EOF 2910ba4dd2aaSAlex Bennée#include <stdio.h> 2911ba4dd2aaSAlex Bennéevoid foo(void); 2912ba4dd2aaSAlex Bennée 2913ba4dd2aaSAlex Bennéevoid foo(void) 2914ba4dd2aaSAlex Bennée{ 2915ba4dd2aaSAlex Bennée printf("foo\n"); 2916ba4dd2aaSAlex Bennée} 2917ba4dd2aaSAlex Bennée 2918ba4dd2aaSAlex Bennéeint main(void) 2919ba4dd2aaSAlex Bennée{ 2920ba4dd2aaSAlex Bennée foo(); 2921ba4dd2aaSAlex Bennée return 0; 2922ba4dd2aaSAlex Bennée} 2923ba4dd2aaSAlex BennéeEOF 2924ba4dd2aaSAlex Bennée 2925ba4dd2aaSAlex Bennée if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 2926ba4dd2aaSAlex Bennée ld_dynamic_list="yes" 2927ba4dd2aaSAlex Bennée fi 2928ba4dd2aaSAlex Bennée 2929ba4dd2aaSAlex Bennée ######################################### 2930ba4dd2aaSAlex Bennée # See if -exported_symbols_list is supported by the linker 2931ba4dd2aaSAlex Bennée 2932ba4dd2aaSAlex Bennée ld_exported_symbols_list="no" 2933ba4dd2aaSAlex Bennée cat > $TMPTXT <<EOF 2934ba4dd2aaSAlex Bennée _foo 2935ba4dd2aaSAlex BennéeEOF 2936ba4dd2aaSAlex Bennée 2937ba4dd2aaSAlex Bennée if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 2938ba4dd2aaSAlex Bennée ld_exported_symbols_list="yes" 2939ba4dd2aaSAlex Bennée fi 2940ba4dd2aaSAlex Bennée 2941ba4dd2aaSAlex Bennée if test "$ld_dynamic_list" = "no" && 2942ba4dd2aaSAlex Bennée test "$ld_exported_symbols_list" = "no" ; then 2943ba4dd2aaSAlex Bennée if test "$plugins" = "yes"; then 2944ba4dd2aaSAlex Bennée error_exit \ 2945ba4dd2aaSAlex Bennée "Plugin support requires dynamic linking and specifying a set of symbols " \ 2946ba4dd2aaSAlex Bennée "that are exported to plugins. Unfortunately your linker doesn't " \ 2947ba4dd2aaSAlex Bennée "support the flag (--dynamic-list or -exported_symbols_list) used " \ 2948ba4dd2aaSAlex Bennée "for this purpose." 2949ba4dd2aaSAlex Bennée else 2950ba4dd2aaSAlex Bennée plugins="no" 2951ba4dd2aaSAlex Bennée fi 2952ba4dd2aaSAlex Bennée else 2953ba4dd2aaSAlex Bennée plugins="yes" 2954ba4dd2aaSAlex Bennée fi 2955ba4dd2aaSAlex Bennéefi 2956ba4dd2aaSAlex Bennée 2957ba4dd2aaSAlex Bennée########################################## 2958e18df141SAnthony Liguori# glib support probe 2959a52d28afSPaolo Bonzini 2960b4c6036fSDaniel P. Berrangéglib_req_ver=2.56 2961aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 2962aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 2963a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 2964b906acacSPaolo Bonzinielif test "$plugins" = "yes"; then 2965b906acacSPaolo Bonzini glib_modules="$glib_modules gmodule-no-export-2.0" 296654cb65d8SEmilio G. Cotafi 2967e26110cfSFam Zheng 2968aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 2969e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 297089138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 297189138857SStefan Weil glib_libs=$($pkg_config --libs $i) 2972e18df141SAnthony Liguori else 2973e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 2974e26110cfSFam Zheng fi 2975e26110cfSFam Zhengdone 2976e26110cfSFam Zheng 2977215b0c2fSPaolo Bonzini# This workaround is required due to a bug in pkg-config file for glib as it 2978215b0c2fSPaolo Bonzini# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 2979215b0c2fSPaolo Bonzini 2980215b0c2fSPaolo Bonziniif test "$static" = yes && test "$mingw32" = yes; then 2981215b0c2fSPaolo Bonzini glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags" 2982215b0c2fSPaolo Bonzinifi 2983215b0c2fSPaolo Bonzini 298420cf7b8eSDenis Plotnikovif ! test "$gio" = "no"; then 298520cf7b8eSDenis Plotnikov pass=no 2986f876b765SMarc-André Lureau if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 2987f876b765SMarc-André Lureau gio_cflags=$($pkg_config --cflags gio-2.0) 2988f876b765SMarc-André Lureau gio_libs=$($pkg_config --libs gio-2.0) 298925a97a56SMarc-André Lureau gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 29905ecfb76cSPaolo Bonzini if ! has "$gdbus_codegen"; then 29910dba4897SMarc-André Lureau gdbus_codegen= 29920dba4897SMarc-André Lureau fi 299376346b62SPeter Maydell # Check that the libraries actually work -- Ubuntu 18.04 ships 299476346b62SPeter Maydell # with pkg-config --static --libs data for gio-2.0 that is missing 299576346b62SPeter Maydell # -lblkid and will give a link error. 299613ceae66SPeter Maydell cat > $TMPC <<EOF 299713ceae66SPeter Maydell#include <gio/gio.h> 299813ceae66SPeter Maydellint main(void) 299913ceae66SPeter Maydell{ 300013ceae66SPeter Maydell g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); 300113ceae66SPeter Maydell return 0; 300213ceae66SPeter Maydell} 300313ceae66SPeter MaydellEOF 300413ceae66SPeter Maydell if compile_prog "$gio_cflags" "$gio_libs" ; then 300520cf7b8eSDenis Plotnikov pass=yes 300676346b62SPeter Maydell else 300720cf7b8eSDenis Plotnikov pass=no 3008f876b765SMarc-André Lureau fi 3009f876b765SMarc-André Lureau 301020cf7b8eSDenis Plotnikov if test "$pass" = "yes" && 301120cf7b8eSDenis Plotnikov $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 301225a97a56SMarc-André Lureau gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 301325a97a56SMarc-André Lureau gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 301425a97a56SMarc-André Lureau fi 301520cf7b8eSDenis Plotnikov fi 301620cf7b8eSDenis Plotnikov 301720cf7b8eSDenis Plotnikov if test "$pass" = "no"; then 301820cf7b8eSDenis Plotnikov if test "$gio" = "yes"; then 301920cf7b8eSDenis Plotnikov feature_not_found "gio" "Install libgio >= 2.0" 302020cf7b8eSDenis Plotnikov else 302120cf7b8eSDenis Plotnikov gio=no 302220cf7b8eSDenis Plotnikov fi 302320cf7b8eSDenis Plotnikov else 302420cf7b8eSDenis Plotnikov gio=yes 302520cf7b8eSDenis Plotnikov fi 302620cf7b8eSDenis Plotnikovfi 302725a97a56SMarc-André Lureau 3028977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 3029977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 3030977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 3031977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 3032977a82abSDaniel P. Berrangecat > $TMPC <<EOF 3033977a82abSDaniel P. Berrange#include <glib.h> 3034977a82abSDaniel P. Berrange#include <unistd.h> 3035977a82abSDaniel P. Berrange 3036977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 3037977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3038977a82abSDaniel P. Berrange 3039977a82abSDaniel P. Berrangeint main(void) { 3040977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3041977a82abSDaniel P. Berrange return 0; 3042977a82abSDaniel P. Berrange} 3043977a82abSDaniel P. BerrangeEOF 3044977a82abSDaniel P. Berrange 3045215b0c2fSPaolo Bonziniif ! compile_prog "$glib_cflags" "$glib_libs" ; then 3046977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3047977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 3048977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 3049977a82abSDaniel P. Berrange "build target" 3050977a82abSDaniel P. Berrangefi 3051977a82abSDaniel P. Berrange 30529bda600bSEric Blake# Silence clang warnings triggered by glib < 2.57.2 30539bda600bSEric Blakecat > $TMPC << EOF 30549bda600bSEric Blake#include <glib.h> 30559bda600bSEric Blaketypedef struct Foo { 30569bda600bSEric Blake int i; 30579bda600bSEric Blake} Foo; 30589bda600bSEric Blakestatic void foo_free(Foo *f) 30599bda600bSEric Blake{ 30609bda600bSEric Blake g_free(f); 30619bda600bSEric Blake} 30629bda600bSEric BlakeG_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 30639bda600bSEric Blakeint main(void) { return 0; } 30649bda600bSEric BlakeEOF 30659bda600bSEric Blakeif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 30669bda600bSEric Blake if cc_has_warning_flag "-Wno-unused-function"; then 30679bda600bSEric Blake glib_cflags="$glib_cflags -Wno-unused-function" 30685770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function" 30699bda600bSEric Blake fi 30709bda600bSEric Blakefi 30719bda600bSEric Blake 3072e26110cfSFam Zheng########################################## 3073e26110cfSFam Zheng# SHA command probe for modules 3074e26110cfSFam Zhengif test "$modules" = yes; then 3075e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 3076e26110cfSFam Zheng for c in $shacmd_probe; do 30778ccefb91SFam Zheng if has $c; then 3078e26110cfSFam Zheng shacmd="$c" 3079e26110cfSFam Zheng break 3080e26110cfSFam Zheng fi 3081e26110cfSFam Zheng done 3082e26110cfSFam Zheng if test "$shacmd" = ""; then 3083e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3084e26110cfSFam Zheng fi 3085e18df141SAnthony Liguorifi 3086e18df141SAnthony Liguori 3087e18df141SAnthony Liguori########################################## 3088b10d49d7SPino Toscano# libssh probe 3089b10d49d7SPino Toscanoif test "$libssh" != "no" ; then 3090b4c10fc6SThomas Huth if $pkg_config --exists "libssh >= 0.8.7"; then 3091b10d49d7SPino Toscano libssh_cflags=$($pkg_config libssh --cflags) 3092b10d49d7SPino Toscano libssh_libs=$($pkg_config libssh --libs) 3093b10d49d7SPino Toscano libssh=yes 30940a12ec87SRichard W.M. Jones else 3095b10d49d7SPino Toscano if test "$libssh" = "yes" ; then 3096b10d49d7SPino Toscano error_exit "libssh required for --enable-libssh" 30970a12ec87SRichard W.M. Jones fi 3098b10d49d7SPino Toscano libssh=no 30990a12ec87SRichard W.M. Jones fi 31000a12ec87SRichard W.M. Jonesfi 31010a12ec87SRichard W.M. Jones 31020a12ec87SRichard W.M. Jones########################################## 31037aaa6a16SPaolo Bonzini# TPM emulation is only on POSIX 31043b8acc11SPaolo Bonzini 31057aaa6a16SPaolo Bonziniif test "$tpm" = ""; then 31067aaa6a16SPaolo Bonzini if test "$mingw32" = "yes"; then 31077aaa6a16SPaolo Bonzini tpm=no 31083b8acc11SPaolo Bonzini else 31097aaa6a16SPaolo Bonzini tpm=yes 31107aaa6a16SPaolo Bonzini fi 31117aaa6a16SPaolo Bonzinielif test "$tpm" = "yes"; then 31127aaa6a16SPaolo Bonzini if test "$mingw32" = "yes" ; then 31137aaa6a16SPaolo Bonzini error_exit "TPM emulation only available on POSIX systems" 31147aaa6a16SPaolo Bonzini fi 31153b8acc11SPaolo Bonzinifi 31163b8acc11SPaolo Bonzini 31173b8acc11SPaolo Bonzini########################################## 3118f652e6afSaurel32# fdt probe 3119e169e1e1SPeter Maydell 3120fbb4121dSPaolo Bonzinicase "$fdt" in 3121fbb4121dSPaolo Bonzini auto | enabled | internal) 3122fbb4121dSPaolo Bonzini # Simpler to always update submodule, even if not needed. 3123aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 3124fbb4121dSPaolo Bonzini ;; 3125fbb4121dSPaolo Bonziniesac 3126f652e6afSaurel32 312720ff075bSMichael Walle########################################## 31289d49bcf6SMarkus Armbruster# opengl probe (for sdl2, gtk) 3129b1546f32SGerd Hoffmann 3130da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 3131bc6a3565SAkihiko Odaki epoxy=no 3132bc6a3565SAkihiko Odaki if $pkg_config epoxy; then 3133bc6a3565SAkihiko Odaki cat > $TMPC << EOF 3134bc6a3565SAkihiko Odaki#include <epoxy/egl.h> 3135bc6a3565SAkihiko Odakiint main(void) { return 0; } 3136bc6a3565SAkihiko OdakiEOF 3137bc6a3565SAkihiko Odaki if compile_prog "" "" ; then 3138bc6a3565SAkihiko Odaki epoxy=yes 3139bc6a3565SAkihiko Odaki fi 3140bc6a3565SAkihiko Odaki fi 3141bc6a3565SAkihiko Odaki 3142bc6a3565SAkihiko Odaki if test "$epoxy" = "yes" ; then 3143bc6a3565SAkihiko Odaki opengl_cflags="$($pkg_config --cflags epoxy)" 3144bc6a3565SAkihiko Odaki opengl_libs="$($pkg_config --libs epoxy)" 3145da076ffeSGerd Hoffmann opengl=yes 314620ff075bSMichael Walle else 3147da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3148bc6a3565SAkihiko Odaki feature_not_found "opengl" "Please install epoxy with EGL" 314920ff075bSMichael Walle fi 3150f676c67eSJeremy White opengl_cflags="" 3151da076ffeSGerd Hoffmann opengl_libs="" 3152da076ffeSGerd Hoffmann opengl=no 315320ff075bSMichael Walle fi 315420ff075bSMichael Wallefi 315520ff075bSMichael Walle 3156dcc38d1cSMarcelo Tosatti########################################## 3157a99d57bbSWanlong Gao# libnuma probe 3158a99d57bbSWanlong Gao 3159a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 3160a99d57bbSWanlong Gao cat > $TMPC << EOF 3161a99d57bbSWanlong Gao#include <numa.h> 3162a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 3163a99d57bbSWanlong GaoEOF 3164a99d57bbSWanlong Gao 3165a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 3166a99d57bbSWanlong Gao numa=yes 3167ab318051SMarc-André Lureau numa_libs="-lnuma" 3168a99d57bbSWanlong Gao else 3169a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 3170a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 3171a99d57bbSWanlong Gao fi 3172a99d57bbSWanlong Gao numa=no 3173a99d57bbSWanlong Gao fi 3174a99d57bbSWanlong Gaofi 3175a99d57bbSWanlong Gao 3176aa087962SPaolo Bonzinimalloc=system 31777b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 31787b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 31797b01cb97SAlexandre Derumier exit 1 3180aa087962SPaolo Bonzinielif test "$tcmalloc" = "yes" ; then 3181aa087962SPaolo Bonzini malloc=tcmalloc 3182aa087962SPaolo Bonzinielif test "$jemalloc" = "yes" ; then 3183aa087962SPaolo Bonzini malloc=jemalloc 31847b01cb97SAlexandre Derumierfi 31857b01cb97SAlexandre Derumier 3186955727d2SCortland Tölva# check for usbfs 3187955727d2SCortland Tölvahave_usbfs=no 3188955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 318996566d09SThomas Petazzoni cat > $TMPC << EOF 319096566d09SThomas Petazzoni#include <linux/usbdevice_fs.h> 319196566d09SThomas Petazzoni 319296566d09SThomas Petazzoni#ifndef USBDEVFS_GET_CAPABILITIES 319396566d09SThomas Petazzoni#error "USBDEVFS_GET_CAPABILITIES undefined" 319496566d09SThomas Petazzoni#endif 319596566d09SThomas Petazzoni 319696566d09SThomas Petazzoni#ifndef USBDEVFS_DISCONNECT_CLAIM 319796566d09SThomas Petazzoni#error "USBDEVFS_DISCONNECT_CLAIM undefined" 319896566d09SThomas Petazzoni#endif 319996566d09SThomas Petazzoni 320096566d09SThomas Petazzoniint main(void) 320196566d09SThomas Petazzoni{ 320296566d09SThomas Petazzoni return 0; 320396566d09SThomas Petazzoni} 320496566d09SThomas PetazzoniEOF 320596566d09SThomas Petazzoni if compile_prog "" ""; then 3206955727d2SCortland Tölva have_usbfs=yes 3207955727d2SCortland Tölva fi 3208955727d2SCortland Tölvafi 3209751bcc39SMarc-André Lureau 3210de5071c5SBlue Swirl########################################## 3211d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 3212d9840e25STomoki Sekiyama 3213e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 3214e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 3215d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 3216690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 3217d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 3218d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 3219690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 3220d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 3221d9840e25STomoki Sekiyama ;; 3222690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 3223d9840e25STomoki Sekiyama esac 3224d9840e25STomoki Sekiyama cat > $TMPC << EOF 3225d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 3226d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 3227d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 3228d9840e25STomoki SekiyamaEOF 3229d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 3230d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 3231d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 3232315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 3233f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 3234d9840e25STomoki Sekiyama else 3235d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 3236d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 3237d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 3238d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 3239d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 3240d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 3241d9840e25STomoki Sekiyama feature_not_found "VSS support" 3242d9840e25STomoki Sekiyama fi 3243d9840e25STomoki Sekiyama guest_agent_with_vss="no" 3244d9840e25STomoki Sekiyama fi 3245d9840e25STomoki Sekiyamafi 3246d9840e25STomoki Sekiyama 3247d9840e25STomoki Sekiyama########################################## 3248d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 3249d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 3250d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 3251d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 3252d9840e25STomoki Sekiyama 3253e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 3254e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 3255d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 3256d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 3257d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 3258d9840e25STomoki Sekiyama if test -n "$programfiles"; then 3259d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 3260d9840e25STomoki Sekiyama else 3261d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 3262d9840e25STomoki Sekiyama fi 3263d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 3264d9840e25STomoki Sekiyama win_sdk="" 3265d9840e25STomoki Sekiyama fi 3266d9840e25STomoki Sekiyamafi 3267d9840e25STomoki Sekiyama 3268d9840e25STomoki Sekiyama########################################## 326950cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 3270e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 327150cbebb9SMichael Roth cat > $TMPC << EOF 327250cbebb9SMichael Roth#include <windows.h> 327350cbebb9SMichael Roth#include <ntddscsi.h> 327450cbebb9SMichael Rothint main(void) { 327550cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 327650cbebb9SMichael Roth#error Missing required ioctl definitions 327750cbebb9SMichael Roth#endif 327850cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 327950cbebb9SMichael Roth return addr.Lun; 328050cbebb9SMichael Roth} 328150cbebb9SMichael RothEOF 328250cbebb9SMichael Roth if compile_prog "" "" ; then 328350cbebb9SMichael Roth guest_agent_ntddscsi=yes 3284996b9cdcSMatt Hines libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 328550cbebb9SMichael Roth fi 328650cbebb9SMichael Rothfi 328750cbebb9SMichael Roth 328850cbebb9SMichael Roth########################################## 32898ca80760SRichard Henderson# capstone 32908ca80760SRichard Henderson 3291e219c499SRichard Hendersoncase "$capstone" in 32928b18cdbfSRichard Henderson auto | enabled | internal) 32938b18cdbfSRichard Henderson # Simpler to always update submodule, even if not needed. 3294e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 3295e219c499SRichard Henderson ;; 3296e219c499SRichard Hendersonesac 32978ca80760SRichard Henderson 32988ca80760SRichard Henderson########################################## 3299519175a2SAlex Barcelo# check and set a backend for coroutine 3300d0e2fce5SAneesh Kumar K.V 33017c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 330233c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 330333c53c54SDaniel P. Berrange# specific one. 33047c2acc70SPeter Maydell 33057c2acc70SPeter Maydellucontext_works=no 3306d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 3307d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 3308d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 3309cdf84806SPeter Maydell#ifdef __stub_makecontext 3310cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 3311cdf84806SPeter Maydell#endif 331275cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 3313d0e2fce5SAneesh Kumar K.VEOF 3314d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 33157c2acc70SPeter Maydell ucontext_works=yes 3316d0e2fce5SAneesh Kumar K.V fi 3317519175a2SAlex Barcelofi 33187c2acc70SPeter Maydell 33197c2acc70SPeter Maydellif test "$coroutine" = ""; then 33207c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 33217c2acc70SPeter Maydell coroutine=win32 33227c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 33237c2acc70SPeter Maydell coroutine=ucontext 3324519175a2SAlex Barcelo else 33257c2acc70SPeter Maydell coroutine=sigaltstack 33267c2acc70SPeter Maydell fi 33277c2acc70SPeter Maydellelse 33287c2acc70SPeter Maydell case $coroutine in 33297c2acc70SPeter Maydell windows) 33307c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 33317c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 33327c2acc70SPeter Maydell fi 33337c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 33347c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 33357c2acc70SPeter Maydell coroutine=win32 33367c2acc70SPeter Maydell ;; 33377c2acc70SPeter Maydell ucontext) 33387c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 33397c2acc70SPeter Maydell feature_not_found "ucontext" 33407c2acc70SPeter Maydell fi 33417c2acc70SPeter Maydell ;; 334233c53c54SDaniel P. Berrange sigaltstack) 33437c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 33447c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 33457c2acc70SPeter Maydell fi 33467c2acc70SPeter Maydell ;; 33477c2acc70SPeter Maydell *) 334876ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 33497c2acc70SPeter Maydell ;; 33507c2acc70SPeter Maydell esac 3351d0e2fce5SAneesh Kumar K.Vfi 3352d0e2fce5SAneesh Kumar K.V 335370c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 335470c60c08SStefan Hajnoczi coroutine_pool=yes 335570c60c08SStefan Hajnoczifi 335670c60c08SStefan Hajnoczi 33577d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 33587d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 33597d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 33607d992e4dSPeter Lieven coroutine_pool=no 33617d992e4dSPeter Lieven fi 33627d992e4dSPeter Lievenfi 33637d992e4dSPeter Lieven 33641e4f6065SDaniele Buono################################################## 33651e4f6065SDaniele Buono# SafeStack 33661e4f6065SDaniele Buono 33671e4f6065SDaniele Buono 33681e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 33691e4f6065SDaniele Buonocat > $TMPC << EOF 33701e4f6065SDaniele Buonoint main(int argc, char *argv[]) 33711e4f6065SDaniele Buono{ 33721e4f6065SDaniele Buono#if ! __has_feature(safe_stack) 33731e4f6065SDaniele Buono#error SafeStack Disabled 33741e4f6065SDaniele Buono#endif 33751e4f6065SDaniele Buono return 0; 33761e4f6065SDaniele Buono} 33771e4f6065SDaniele BuonoEOF 33781e4f6065SDaniele Buono flag="-fsanitize=safe-stack" 33791e4f6065SDaniele Buono # Check that safe-stack is supported and enabled. 33801e4f6065SDaniele Buono if compile_prog "-Werror $flag" "$flag"; then 33811e4f6065SDaniele Buono # Flag needed both at compilation and at linking 33821e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 33831e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 33841e4f6065SDaniele Buono else 33851e4f6065SDaniele Buono error_exit "SafeStack not supported by your compiler" 33861e4f6065SDaniele Buono fi 33871e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 33881e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 33891e4f6065SDaniele Buono fi 33901e4f6065SDaniele Buonoelse 33911e4f6065SDaniele Buonocat > $TMPC << EOF 33921e4f6065SDaniele Buonoint main(int argc, char *argv[]) 33931e4f6065SDaniele Buono{ 33941e4f6065SDaniele Buono#if defined(__has_feature) 33951e4f6065SDaniele Buono#if __has_feature(safe_stack) 33961e4f6065SDaniele Buono#error SafeStack Enabled 33971e4f6065SDaniele Buono#endif 33981e4f6065SDaniele Buono#endif 33991e4f6065SDaniele Buono return 0; 34001e4f6065SDaniele Buono} 34011e4f6065SDaniele BuonoEOF 34021e4f6065SDaniele Buonoif test "$safe_stack" = "no"; then 34031e4f6065SDaniele Buono # Make sure that safe-stack is disabled 34041e4f6065SDaniele Buono if ! compile_prog "-Werror" ""; then 34051e4f6065SDaniele Buono # SafeStack was already enabled, try to explicitly remove the feature 34061e4f6065SDaniele Buono flag="-fno-sanitize=safe-stack" 34071e4f6065SDaniele Buono if ! compile_prog "-Werror $flag" "$flag"; then 34081e4f6065SDaniele Buono error_exit "Configure cannot disable SafeStack" 34091e4f6065SDaniele Buono fi 34101e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 34111e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 34121e4f6065SDaniele Buono fi 34131e4f6065SDaniele Buonoelse # "$safe_stack" = "" 34141e4f6065SDaniele Buono # Set safe_stack to yes or no based on pre-existing flags 34151e4f6065SDaniele Buono if compile_prog "-Werror" ""; then 34161e4f6065SDaniele Buono safe_stack="no" 34171e4f6065SDaniele Buono else 34181e4f6065SDaniele Buono safe_stack="yes" 34191e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 34201e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 34211e4f6065SDaniele Buono fi 34221e4f6065SDaniele Buono fi 34231e4f6065SDaniele Buonofi 34241e4f6065SDaniele Buonofi 34257d992e4dSPeter Lieven 342676a347e1SRichard Henderson######################################## 342776a347e1SRichard Henderson# check if cpuid.h is usable. 342876a347e1SRichard Henderson 342976a347e1SRichard Hendersoncat > $TMPC << EOF 343076a347e1SRichard Henderson#include <cpuid.h> 343176a347e1SRichard Hendersonint main(void) { 3432774d566cSPeter Maydell unsigned a, b, c, d; 3433774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 3434774d566cSPeter Maydell 3435774d566cSPeter Maydell if (max >= 1) { 3436774d566cSPeter Maydell __cpuid(1, a, b, c, d); 3437774d566cSPeter Maydell } 3438774d566cSPeter Maydell 3439774d566cSPeter Maydell if (max >= 7) { 3440774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 3441774d566cSPeter Maydell } 3442774d566cSPeter Maydell 344376a347e1SRichard Henderson return 0; 344476a347e1SRichard Henderson} 344576a347e1SRichard HendersonEOF 344676a347e1SRichard Hendersonif compile_prog "" "" ; then 344776a347e1SRichard Henderson cpuid_h=yes 344876a347e1SRichard Hendersonfi 344976a347e1SRichard Henderson 34505dd89908SRichard Henderson########################################## 34515dd89908SRichard Henderson# avx2 optimization requirement check 34525dd89908SRichard Henderson# 34535dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 34545dd89908SRichard Henderson# since we won't be able to select the new routines. 34555dd89908SRichard Henderson 3456e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 34575dd89908SRichard Henderson cat > $TMPC << EOF 34585dd89908SRichard Henderson#pragma GCC push_options 34595dd89908SRichard Henderson#pragma GCC target("avx2") 34605dd89908SRichard Henderson#include <cpuid.h> 34615dd89908SRichard Henderson#include <immintrin.h> 34625dd89908SRichard Hendersonstatic int bar(void *a) { 34635dd89908SRichard Henderson __m256i x = *(__m256i *)a; 34645dd89908SRichard Henderson return _mm256_testz_si256(x, x); 34655dd89908SRichard Henderson} 34665dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 34675dd89908SRichard HendersonEOF 34685b945f23SRichard Henderson if compile_object "-Werror" ; then 34695dd89908SRichard Henderson avx2_opt="yes" 347086583a07SLiam Merwick else 347186583a07SLiam Merwick avx2_opt="no" 34725dd89908SRichard Henderson fi 34735dd89908SRichard Hendersonfi 34745dd89908SRichard Henderson 34756b8cd447SRobert Hoo########################################## 34766b8cd447SRobert Hoo# avx512f optimization requirement check 34776b8cd447SRobert Hoo# 34786b8cd447SRobert Hoo# There is no point enabling this if cpuid.h is not usable, 34796b8cd447SRobert Hoo# since we won't be able to select the new routines. 34806b8cd447SRobert Hoo# by default, it is turned off. 34816b8cd447SRobert Hoo# if user explicitly want to enable it, check environment 34826b8cd447SRobert Hoo 34836b8cd447SRobert Hooif test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 34846b8cd447SRobert Hoo cat > $TMPC << EOF 34856b8cd447SRobert Hoo#pragma GCC push_options 34866b8cd447SRobert Hoo#pragma GCC target("avx512f") 34876b8cd447SRobert Hoo#include <cpuid.h> 34886b8cd447SRobert Hoo#include <immintrin.h> 34896b8cd447SRobert Hoostatic int bar(void *a) { 34906b8cd447SRobert Hoo __m512i x = *(__m512i *)a; 34916b8cd447SRobert Hoo return _mm512_test_epi64_mask(x, x); 34926b8cd447SRobert Hoo} 34936b8cd447SRobert Hooint main(int argc, char *argv[]) 34946b8cd447SRobert Hoo{ 34956b8cd447SRobert Hoo return bar(argv[0]); 34966b8cd447SRobert Hoo} 34976b8cd447SRobert HooEOF 34985b945f23SRichard Henderson if ! compile_object "-Werror" ; then 34996b8cd447SRobert Hoo avx512f_opt="no" 35006b8cd447SRobert Hoo fi 35016b8cd447SRobert Hooelse 35026b8cd447SRobert Hoo avx512f_opt="no" 35036b8cd447SRobert Hoofi 35046b8cd447SRobert Hoo 3505f540166bSRichard Henderson######################################## 3506f540166bSRichard Henderson# check if __[u]int128_t is usable. 3507f540166bSRichard Henderson 3508f540166bSRichard Hendersonint128=no 3509f540166bSRichard Hendersoncat > $TMPC << EOF 3510f540166bSRichard Henderson__int128_t a; 3511f540166bSRichard Henderson__uint128_t b; 3512f540166bSRichard Hendersonint main (void) { 3513f540166bSRichard Henderson a = a + b; 3514f540166bSRichard Henderson b = a * b; 3515464e3671SPeter Maydell a = a * a; 3516f540166bSRichard Henderson return 0; 3517f540166bSRichard Henderson} 3518f540166bSRichard HendersonEOF 3519f540166bSRichard Hendersonif compile_prog "" "" ; then 3520f540166bSRichard Henderson int128=yes 3521f540166bSRichard Hendersonfi 352276a347e1SRichard Henderson 35237ebee43eSRichard Henderson######################################### 35247ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 35257ebee43eSRichard Henderson 35267ebee43eSRichard Hendersonatomic128=no 35277ebee43eSRichard Hendersonif test "$int128" = "yes"; then 35287ebee43eSRichard Henderson cat > $TMPC << EOF 35297ebee43eSRichard Hendersonint main(void) 35307ebee43eSRichard Henderson{ 35317ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 3532bceac547SThomas Huth y = __atomic_load(&x, 0); 3533bceac547SThomas Huth __atomic_store(&x, y, 0); 3534bceac547SThomas Huth __atomic_compare_exchange(&x, &y, x, 0, 0, 0); 35357ebee43eSRichard Henderson return 0; 35367ebee43eSRichard Henderson} 35377ebee43eSRichard HendersonEOF 35387ebee43eSRichard Henderson if compile_prog "" "" ; then 35397ebee43eSRichard Henderson atomic128=yes 35407ebee43eSRichard Henderson fi 35417ebee43eSRichard Hendersonfi 35427ebee43eSRichard Henderson 3543e6cd4bb5SRichard Hendersoncmpxchg128=no 3544e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 3545e6cd4bb5SRichard Henderson cat > $TMPC << EOF 3546e6cd4bb5SRichard Hendersonint main(void) 3547e6cd4bb5SRichard Henderson{ 3548e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 3549e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 3550e6cd4bb5SRichard Henderson return 0; 3551e6cd4bb5SRichard Henderson} 3552e6cd4bb5SRichard HendersonEOF 3553e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 3554e6cd4bb5SRichard Henderson cmpxchg128=yes 3555e6cd4bb5SRichard Henderson fi 3556e6cd4bb5SRichard Hendersonfi 3557e6cd4bb5SRichard Henderson 3558fd0e6053SJohn Snow######################################## 3559fd0e6053SJohn Snow# check if ccache is interfering with 3560fd0e6053SJohn Snow# semantic analysis of macros 3561fd0e6053SJohn Snow 35625e4dfd3dSJohn Snowunset CCACHE_CPP2 3563fd0e6053SJohn Snowccache_cpp2=no 3564fd0e6053SJohn Snowcat > $TMPC << EOF 3565fd0e6053SJohn Snowstatic const int Z = 1; 3566fd0e6053SJohn Snow#define fn() ({ Z; }) 3567fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 3568fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 3569fd0e6053SJohn Snow#define ID(X) (X) 3570fd0e6053SJohn Snowint main(int argc, char *argv[]) 3571fd0e6053SJohn Snow{ 3572fd0e6053SJohn Snow int x = 0, y = 0; 3573fd0e6053SJohn Snow x = ID(x); 3574fd0e6053SJohn Snow x = fn(); 3575fd0e6053SJohn Snow fn(); 3576fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 3577fd0e6053SJohn Snow if (TAUT(Z)) return 0; 3578fd0e6053SJohn Snow return 0; 3579fd0e6053SJohn Snow} 3580fd0e6053SJohn SnowEOF 3581fd0e6053SJohn Snow 3582fd0e6053SJohn Snowif ! compile_object "-Werror"; then 3583fd0e6053SJohn Snow ccache_cpp2=yes 3584fd0e6053SJohn Snowfi 3585fd0e6053SJohn Snow 3586b553a042SJohn Snow################################################# 3587b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 3588b553a042SJohn Snow 3589b553a042SJohn Snowif test "$fortify_source" != "no"; then 3590b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 3591b553a042SJohn Snow fortify_source="no"; 3592e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 3593cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 3594b553a042SJohn Snow fortify_source="no"; 3595b553a042SJohn Snow else 3596b553a042SJohn Snow fortify_source="yes" 3597b553a042SJohn Snow fi 3598b553a042SJohn Snowfi 3599b553a042SJohn Snow 3600d2042378SAneesh Kumar K.V########################################## 3601a40161cbSPaolo Bonzini# check for usable membarrier system call 3602a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 3603a40161cbSPaolo Bonzini have_membarrier=no 3604a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 3605a40161cbSPaolo Bonzini have_membarrier=yes 3606a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 3607a40161cbSPaolo Bonzini cat > $TMPC << EOF 3608a40161cbSPaolo Bonzini #include <linux/membarrier.h> 3609a40161cbSPaolo Bonzini #include <sys/syscall.h> 3610a40161cbSPaolo Bonzini #include <unistd.h> 3611a40161cbSPaolo Bonzini #include <stdlib.h> 3612a40161cbSPaolo Bonzini int main(void) { 3613a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 3614a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 3615a40161cbSPaolo Bonzini exit(0); 3616a40161cbSPaolo Bonzini } 3617a40161cbSPaolo BonziniEOF 3618a40161cbSPaolo Bonzini if compile_prog "" "" ; then 3619a40161cbSPaolo Bonzini have_membarrier=yes 3620a40161cbSPaolo Bonzini fi 3621a40161cbSPaolo Bonzini fi 3622a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 3623a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 3624a40161cbSPaolo Bonzini fi 3625a40161cbSPaolo Bonzinielse 3626a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 3627a40161cbSPaolo Bonzini # work on Wine. 3628a40161cbSPaolo Bonzini membarrier=no 3629a40161cbSPaolo Bonzinifi 3630a40161cbSPaolo Bonzini 3631a40161cbSPaolo Bonzini########################################## 3632f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 36334f67366eSThomas Huthhave_afalg=no 3634f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 3635f0d92b56SLongpeng(Mike)#include <errno.h> 3636f0d92b56SLongpeng(Mike)#include <sys/types.h> 3637f0d92b56SLongpeng(Mike)#include <sys/socket.h> 3638f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 3639f0d92b56SLongpeng(Mike)int main(void) { 3640f0d92b56SLongpeng(Mike) int sock; 3641f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 3642f0d92b56SLongpeng(Mike) return sock; 3643f0d92b56SLongpeng(Mike)} 3644f0d92b56SLongpeng(Mike)EOF 3645f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 3646f0d92b56SLongpeng(Mike) have_afalg=yes 3647f0d92b56SLongpeng(Mike)fi 3648f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 3649f0d92b56SLongpeng(Mike)then 3650f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 3651f0d92b56SLongpeng(Mike) then 3652f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 3653f0d92b56SLongpeng(Mike) fi 3654f0d92b56SLongpeng(Mike)fi 3655f0d92b56SLongpeng(Mike) 3656f0d92b56SLongpeng(Mike) 3657db1ed1abSRichard Henderson########################################## 3658247724cbSMarc-André Lureau# checks for sanitizers 3659247724cbSMarc-André Lureau 3660247724cbSMarc-André Lureauhave_asan=no 3661247724cbSMarc-André Lureauhave_ubsan=no 3662d83414e1SMarc-André Lureauhave_asan_iface_h=no 3663d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 3664247724cbSMarc-André Lureau 3665247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 3666b9f44da2SMarc-André Lureau write_c_skeleton 3667247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 3668247724cbSMarc-André Lureau have_asan=yes 3669247724cbSMarc-André Lureau fi 3670b9f44da2SMarc-André Lureau 3671b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 3672b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 3673b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 3674b9f44da2SMarc-André Lureau cat > $TMPC << EOF 3675b9f44da2SMarc-André Lureau#include <stdlib.h> 3676b9f44da2SMarc-André Lureauint main(void) { 3677b9f44da2SMarc-André Lureau void *tmp = malloc(10); 3678f2dfe54cSLeonid Bloch if (tmp != NULL) { 3679b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 3680b9f44da2SMarc-André Lureau } 3681d1abf3fcSOlaf Hering return 1; 3682f2dfe54cSLeonid Bloch} 3683b9f44da2SMarc-André LureauEOF 3684247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 3685247724cbSMarc-André Lureau have_ubsan=yes 3686247724cbSMarc-André Lureau fi 3687d83414e1SMarc-André Lureau 3688d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 3689d83414e1SMarc-André Lureau have_asan_iface_h=yes 3690d83414e1SMarc-André Lureau fi 3691d83414e1SMarc-André Lureau 3692d83414e1SMarc-André Lureau cat > $TMPC << EOF 3693d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 3694d83414e1SMarc-André Lureauint main(void) { 3695d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 3696d83414e1SMarc-André Lureau return 0; 3697d83414e1SMarc-André Lureau} 3698d83414e1SMarc-André LureauEOF 3699d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 3700d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 3701d83414e1SMarc-André Lureau fi 3702247724cbSMarc-André Lureaufi 3703247724cbSMarc-André Lureau 37040aebab04SLingfeng Yang# Thread sanitizer is, for now, much noisier than the other sanitizers; 37050aebab04SLingfeng Yang# keep it separate until that is not the case. 37060aebab04SLingfeng Yangif test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 37070aebab04SLingfeng Yang error_exit "TSAN is not supported with other sanitiziers." 37080aebab04SLingfeng Yangfi 37090aebab04SLingfeng Yanghave_tsan=no 37100aebab04SLingfeng Yanghave_tsan_iface_fiber=no 37110aebab04SLingfeng Yangif test "$tsan" = "yes" ; then 37120aebab04SLingfeng Yang write_c_skeleton 37130aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 37140aebab04SLingfeng Yang have_tsan=yes 37150aebab04SLingfeng Yang fi 37160aebab04SLingfeng Yang cat > $TMPC << EOF 37170aebab04SLingfeng Yang#include <sanitizer/tsan_interface.h> 37180aebab04SLingfeng Yangint main(void) { 37190aebab04SLingfeng Yang __tsan_create_fiber(0); 37200aebab04SLingfeng Yang return 0; 37210aebab04SLingfeng Yang} 37220aebab04SLingfeng YangEOF 37230aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 37240aebab04SLingfeng Yang have_tsan_iface_fiber=yes 37250aebab04SLingfeng Yang fi 37260aebab04SLingfeng Yangfi 37270aebab04SLingfeng Yang 3728adc28027SAlexander Bulekov########################################## 3729675b9b53SMarc-André Lureau# check for slirp 3730675b9b53SMarc-André Lureau 3731675b9b53SMarc-André Lureaucase "$slirp" in 37324d34a86bSPaolo Bonzini auto | enabled | internal) 37334d34a86bSPaolo Bonzini # Simpler to always update submodule, even if not needed. 37347c57bdd8SMarc-André Lureau git_submodules="${git_submodules} slirp" 3735675b9b53SMarc-André Lureau ;; 3736675b9b53SMarc-André Lureauesac 3737675b9b53SMarc-André Lureau 3738b8e0c493SJoelle van Dyne# Check for slirp smbd dupport 3739b8e0c493SJoelle van Dyne: ${smbd=${SMBD-/usr/sbin/smbd}} 3740b8e0c493SJoelle van Dyneif test "$slirp_smbd" != "no" ; then 3741b8e0c493SJoelle van Dyne if test "$mingw32" = "yes" ; then 3742b8e0c493SJoelle van Dyne if test "$slirp_smbd" = "yes" ; then 3743b8e0c493SJoelle van Dyne error_exit "Host smbd not supported on this platform." 3744b8e0c493SJoelle van Dyne fi 3745b8e0c493SJoelle van Dyne slirp_smbd=no 3746b8e0c493SJoelle van Dyne else 3747b8e0c493SJoelle van Dyne slirp_smbd=yes 3748b8e0c493SJoelle van Dyne fi 3749b8e0c493SJoelle van Dynefi 3750b8e0c493SJoelle van Dyne 375154e7aac0SAlexey Krasikov########################################## 375254e7aac0SAlexey Krasikov# check for usable __NR_keyctl syscall 375354e7aac0SAlexey Krasikov 375454e7aac0SAlexey Krasikovif test "$linux" = "yes" ; then 375554e7aac0SAlexey Krasikov 375654e7aac0SAlexey Krasikov have_keyring=no 375754e7aac0SAlexey Krasikov cat > $TMPC << EOF 375854e7aac0SAlexey Krasikov#include <errno.h> 375954e7aac0SAlexey Krasikov#include <asm/unistd.h> 376054e7aac0SAlexey Krasikov#include <linux/keyctl.h> 376154e7aac0SAlexey Krasikov#include <unistd.h> 376254e7aac0SAlexey Krasikovint main(void) { 376354e7aac0SAlexey Krasikov return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 376454e7aac0SAlexey Krasikov} 376554e7aac0SAlexey KrasikovEOF 376654e7aac0SAlexey Krasikov if compile_prog "" "" ; then 376754e7aac0SAlexey Krasikov have_keyring=yes 376854e7aac0SAlexey Krasikov fi 376954e7aac0SAlexey Krasikovfi 377054e7aac0SAlexey Krasikovif test "$secret_keyring" != "no" 377154e7aac0SAlexey Krasikovthen 3772b418d265SDavid Edmondson if test "$have_keyring" = "yes" 377354e7aac0SAlexey Krasikov then 377454e7aac0SAlexey Krasikov secret_keyring=yes 377554e7aac0SAlexey Krasikov else 377654e7aac0SAlexey Krasikov if test "$secret_keyring" = "yes" 377754e7aac0SAlexey Krasikov then 377854e7aac0SAlexey Krasikov error_exit "syscall __NR_keyctl requested, \ 377954e7aac0SAlexey Krasikovbut not implemented on your system" 378054e7aac0SAlexey Krasikov else 378154e7aac0SAlexey Krasikov secret_keyring=no 378254e7aac0SAlexey Krasikov fi 378354e7aac0SAlexey Krasikov fi 378454e7aac0SAlexey Krasikovfi 378554e7aac0SAlexey Krasikov 378692500362SAlexey Krasikov########################################## 3787e86ecd4bSJuan Quintela# End of CC checks 3788e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3789e86ecd4bSJuan Quintela 3790d83414e1SMarc-André Lureauwrite_c_skeleton 3791d83414e1SMarc-André Lureau 37921d728c39SBlue Swirlif test "$gcov" = "yes" ; then 3793bf0e56a3SMarc-André Lureau : 3794b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 3795086d5f75SPaolo Bonzini QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 3796086d5f75SPaolo Bonzini debug=no 3797086d5f75SPaolo Bonzinifi 3798086d5f75SPaolo Bonzini 3799086d5f75SPaolo Bonzinicase "$ARCH" in 3800086d5f75SPaolo Bonzinialpha) 3801086d5f75SPaolo Bonzini # Ensure there's only a single GP 3802086d5f75SPaolo Bonzini QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 3803086d5f75SPaolo Bonzini;; 3804086d5f75SPaolo Bonziniesac 3805086d5f75SPaolo Bonzini 3806086d5f75SPaolo Bonziniif test "$gprof" = "yes" ; then 3807086d5f75SPaolo Bonzini QEMU_CFLAGS="-p $QEMU_CFLAGS" 3808086d5f75SPaolo Bonzini QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 3809086d5f75SPaolo Bonzinifi 3810a316e378SJuan Quintela 3811247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 3812db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 3813db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 3814d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 3815d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 3816d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 3817d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 3818d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 3819d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 3820d83414e1SMarc-André Lureau fi 3821247724cbSMarc-André Lureaufi 38220aebab04SLingfeng Yangif test "$have_tsan" = "yes" ; then 38230aebab04SLingfeng Yang if test "$have_tsan_iface_fiber" = "yes" ; then 38240aebab04SLingfeng Yang QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 38250aebab04SLingfeng Yang QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 38260aebab04SLingfeng Yang else 38270aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing fiber annotation interface." 38280aebab04SLingfeng Yang fi 38290aebab04SLingfeng Yangelif test "$tsan" = "yes" ; then 38300aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing sanitize thread interface." 38310aebab04SLingfeng Yangfi 3832247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 3833db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 3834db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 3835247724cbSMarc-André Lureaufi 3836247724cbSMarc-André Lureau 38376542aa9cSPeter Lieven########################################## 38383efac6ebSTomáš Golembiovský 38390aebab04SLingfeng Yang# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 38400aebab04SLingfeng Yangif test "$solaris" = "no" && test "$tsan" = "no"; then 3841e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 3842db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 3843e86ecd4bSJuan Quintela fi 3844e86ecd4bSJuan Quintelafi 3845e86ecd4bSJuan Quintela 3846952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3847952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3848cb8baa77SMark Cave-Ayland flags="--no-seh --nxcompat" 3849cb8baa77SMark Cave-Ayland 3850cb8baa77SMark Cave-Ayland # Disable ASLR for debug builds to allow debugging with gdb 3851cb8baa77SMark Cave-Ayland if test "$debug" = "no" ; then 3852cb8baa77SMark Cave-Ayland flags="--dynamicbase $flags" 3853cb8baa77SMark Cave-Ayland fi 3854cb8baa77SMark Cave-Ayland 3855cb8baa77SMark Cave-Ayland for flag in $flags; do 3856e9a3591fSChristian Borntraeger if ld_has $flag ; then 3857db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 3858952afb71SBlue Swirl fi 3859952afb71SBlue Swirl done 3860952afb71SBlue Swirlfi 3861952afb71SBlue Swirl 38629d6bc27bSMichael Roth# Probe for guest agent support/options 38639d6bc27bSMichael Roth 3864e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 3865a5125905SLaurent Vivier if [ "$softmmu" = no -a "$want_tools" = no ] ; then 3866a5125905SLaurent Vivier guest_agent=no 3867a5125905SLaurent Vivier elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 3868e8ef31a3SMichael Tokarev guest_agent=yes 3869e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 3870e8ef31a3SMichael Tokarev guest_agent=no 3871e8ef31a3SMichael Tokarev else 3872e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 3873ca35f780SPaolo Bonzini fi 38744b1c11fdSDaniel P. Berrangefi 3875ca35f780SPaolo Bonzini 3876b846ab7cSPaolo Bonzini# Guest agent Windows MSI package 38779d6bc27bSMichael Roth 38789d6bc27bSMichael Rothif test "$QEMU_GA_MANUFACTURER" = ""; then 38799d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 38809d6bc27bSMichael Rothfi 38819d6bc27bSMichael Rothif test "$QEMU_GA_DISTRO" = ""; then 38829d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 38839d6bc27bSMichael Rothfi 38849d6bc27bSMichael Rothif test "$QEMU_GA_VERSION" = ""; then 388589138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 38869d6bc27bSMichael Rothfi 38879d6bc27bSMichael Roth 3888b846ab7cSPaolo BonziniQEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin" 38899d6bc27bSMichael Roth 3890ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3891ca35f780SPaolo Bonziniroms= 3892e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 3893e633a5c6SEric Blake test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 38947000a12eSThomas Huth test "$targetos" != "Haiku" && test "$softmmu" = yes ; then 3895e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 3896c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 3897c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 3898c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 3899e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 3900e57218b6SPeter Maydell ld_i386_emulation="$emu" 3901ca35f780SPaolo Bonzini roms="optionrom" 3902e57218b6SPeter Maydell break 3903e57218b6SPeter Maydell fi 3904e57218b6SPeter Maydell done 3905ca35f780SPaolo Bonzinifi 3906ca35f780SPaolo Bonzini 39072e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 3908a5b2afd5SThomas Huth# or -march=z10 (which is the lowest architecture level that Clang supports) 39099933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 39102e33c3f8SThomas Huth write_c_skeleton 3911a5b2afd5SThomas Huth compile_prog "-march=z900" "" 3912a5b2afd5SThomas Huth has_z900=$? 39133af448b3SThomas Huth if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then 3914a5b2afd5SThomas Huth if [ $has_z900 != 0 ]; then 3915a5b2afd5SThomas Huth echo "WARNING: Your compiler does not support the z900!" 3916a5b2afd5SThomas Huth echo " The s390-ccw bios will only work with guest CPUs >= z10." 3917a5b2afd5SThomas Huth fi 39189933c305SChristian Borntraeger roms="$roms s390-ccw" 39191ef6bfc2SPhilippe Mathieu-Daudé # SLOF is required for building the s390-ccw firmware on s390x, 39201ef6bfc2SPhilippe Mathieu-Daudé # since it is using the libnet code from SLOF for network booting. 39211ef6bfc2SPhilippe Mathieu-Daudé git_submodules="${git_submodules} roms/SLOF" 39221ef6bfc2SPhilippe Mathieu-Daudé fi 39239933c305SChristian Borntraegerfi 39249933c305SChristian Borntraeger 392511cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 392611cde1c8SBruno Dominguez# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. 392711cde1c8SBruno Dominguezif has $cxx; then 392811cde1c8SBruno Dominguez cat > $TMPC <<EOF 392911cde1c8SBruno Dominguezint c_function(void); 393011cde1c8SBruno Dominguezint main(void) { return c_function(); } 393111cde1c8SBruno DominguezEOF 393211cde1c8SBruno Dominguez 393311cde1c8SBruno Dominguez compile_object 393411cde1c8SBruno Dominguez 393511cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 393611cde1c8SBruno Dominguezextern "C" { 393711cde1c8SBruno Dominguez int c_function(void); 393811cde1c8SBruno Dominguez} 393911cde1c8SBruno Dominguezint c_function(void) { return 42; } 394011cde1c8SBruno DominguezEOF 394111cde1c8SBruno Dominguez 394211cde1c8SBruno Dominguez update_cxxflags 394311cde1c8SBruno Dominguez 39445770e8afSPaolo Bonzini if do_cxx $CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 394511cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 394611cde1c8SBruno Dominguez : 394711cde1c8SBruno Dominguez else 394811cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 394911cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 395011cde1c8SBruno Dominguez cxx= 395111cde1c8SBruno Dominguez fi 395211cde1c8SBruno Dominguezelse 395311cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 395411cde1c8SBruno Dominguez cxx= 395511cde1c8SBruno Dominguezfi 395611cde1c8SBruno Dominguez 39577d7dbf9dSDan Streetmanif !(GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then 39587d7dbf9dSDan Streetman exit 1 39595d91a2edSYonggang Luofi 39605d91a2edSYonggang Luo 396198ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 396297a847bcSbellard 396398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 396498ec69acSJuan Quintelaecho >> $config_host_mak 396598ec69acSJuan Quintela 3966e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 3967cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 3968aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 39697d7dbf9dSDan Streetmanecho "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak 3970804edf29SJuan Quintela 397198ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 3972727e5283SPaolo Bonzini 3973f8393946Saurel32if test "$debug_tcg" = "yes" ; then 39742358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 3975f8393946Saurel32fi 39761625af87Saliguoriif test "$strip_opt" = "yes" ; then 397752ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 39781625af87Saliguorifi 397967b915a5Sbellardif test "$mingw32" = "yes" ; then 398098ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 3981d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 3982d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 3983f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 3984d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 3985d9840e25STomoki Sekiyama fi 398650cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 398776dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 398850cbebb9SMichael Roth fi 39899dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 39909dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 39919dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 39929dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 3993210fa556Spbrookelse 399435f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 3995210fa556Spbrookfi 3996128ab2ffSblueswir1 3997dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 3998dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 3999dffcb71cSMark McLoughlinfi 4000dffcb71cSMark McLoughlin 400183fb7adfSbellardif test "$darwin" = "yes" ; then 400298ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 400383fb7adfSbellardfi 4004b29fe3edSmalc 4005ec530c81Sbellardif test "$solaris" = "yes" ; then 400698ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 4007ec530c81Sbellardfi 4008179cf400SAndreas Färberif test "$haiku" = "yes" ; then 4009179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 4010179cf400SAndreas Färberfi 401197a847bcSbellardif test "$static" = "yes" ; then 401298ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 401397a847bcSbellardfi 40141ba16968SStefan Weilif test "$profiler" = "yes" ; then 40152358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 401605c2a3e7Sbellardfi 4017c932ce31SPaolo Bonziniif test "$want_tools" = "yes" ; then 4018c932ce31SPaolo Bonzini echo "CONFIG_TOOLS=y" >> $config_host_mak 4019c932ce31SPaolo Bonzinifi 4020f15bff25SPaolo Bonziniif test "$guest_agent" = "yes" ; then 4021f15bff25SPaolo Bonzini echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 4022f15bff25SPaolo Bonzinifi 4023b8e0c493SJoelle van Dyneif test "$slirp_smbd" = "yes" ; then 4024b8e0c493SJoelle van Dyne echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak 4025e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 4026b8e0c493SJoelle van Dynefi 4027015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 4028015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 4029015a33bdSGongleifi 40304cc600d2SPaolo Bonziniif test "$gprof" = "yes" ; then 40314cc600d2SPaolo Bonzini echo "CONFIG_GPROF=y" >> $config_host_mak 40324cc600d2SPaolo Bonzinifi 4033b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 4034b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 4035e5f05f8cSKevin Wolfif test "$block_drv_whitelist_tools" = "yes" ; then 4036e5f05f8cSKevin Wolf echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak 4037e5f05f8cSKevin Wolffi 4038dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 4039dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 4040dce512deSChristoph Hellwigfi 404189138857SStefan Weilqemu_version=$(head $source_path/VERSION) 40422358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 404398ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 40442b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 404517969268SFam Zhengif test "$modules" = "yes"; then 4046e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 4047e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 404889138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 404917969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 405017969268SFam Zhengfi 4051bd83c861SChristian Ehrhardtif test "$module_upgrades" = "yes"; then 4052bd83c861SChristian Ehrhardt echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 4053bd83c861SChristian Ehrhardtfi 4054955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 4055955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 4056955727d2SCortland Tölvafi 4057f876b765SMarc-André Lureauif test "$gio" = "yes" ; then 4058f876b765SMarc-André Lureau echo "CONFIG_GIO=y" >> $config_host_mak 4059f876b765SMarc-André Lureau echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 4060f876b765SMarc-André Lureau echo "GIO_LIBS=$gio_libs" >> $config_host_mak 40615ecfb76cSPaolo Bonzinifi 40625ecfb76cSPaolo Bonziniif test "$gdbus_codegen" != "" ; then 406325a97a56SMarc-André Lureau echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 4064f876b765SMarc-André Lureaufi 4065a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 4066277abf15SJan Vesely 40671badb709SPaolo Bonziniif test "$xen" = "enabled" ; then 40686dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 4069d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 4070582ea95fSMarc-André Lureau echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 4071582ea95fSMarc-André Lureau echo "XEN_LIBS=$xen_libs" >> $config_host_mak 4072e37630caSaliguorifi 40735e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 40745e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 40755e9be92dSNicholas Bellingerfi 4076af3bba76SPaolo Bonziniif test "$vhost_net" = "yes" ; then 4077af3bba76SPaolo Bonzini echo "CONFIG_VHOST_NET=y" >> $config_host_mak 4078af3bba76SPaolo Bonzinifi 4079af3bba76SPaolo Bonziniif test "$vhost_net_user" = "yes" ; then 408056f41de7SPaolo Bonzini echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 408103ce5744SNikolay Nikolaevfi 4082108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" ; then 4083108a6481SCindy Lu echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 4084108a6481SCindy Lufi 4085042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 4086042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 4087042cea27SGongleifi 4088fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 4089fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 40905fe97d88SStefano Garzarella if test "$vhost_user" = "yes" ; then 40915fe97d88SStefano Garzarella echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 40925fe97d88SStefano Garzarella fi 4093fc0b9b0eSStefan Hajnoczifi 4094299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" ; then 4095299e6f19SPaolo Bonzini echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 4096299e6f19SPaolo Bonzinifi 4097e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 4098e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 4099e6a74868SMarc-André Lureaufi 4100108a6481SCindy Luif test "$vhost_vdpa" = "yes" ; then 4101108a6481SCindy Lu echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 4102108a6481SCindy Lufi 410398fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" ; then 410498fc1adaSDr. David Alan Gilbert echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 410598fc1adaSDr. David Alan Gilbertfi 4106a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 4107a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 4108a40161cbSPaolo Bonzinifi 4109e5b46549SRichard Hendersonif test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then 4110e5b46549SRichard Henderson echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 4111e5b46549SRichard Hendersonfi 411258d3f3ffSGerd Hoffmann 4113da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 4114da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 4115de2d3005SPaolo Bonzini echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 4116da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 411720ff075bSMichael Wallefi 411820ff075bSMichael Walle 411999f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 412099f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 412199f2dbd3SLiang Lifi 412299f2dbd3SLiang Li 41236b8cd447SRobert Hooif test "$avx512f_opt" = "yes" ; then 41246b8cd447SRobert Hoo echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 41256b8cd447SRobert Hoofi 41266b8cd447SRobert Hoo 412783fb7adfSbellard# XXX: suppress that 41287d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 41292358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 41307d3505c5Sbellardfi 41317d3505c5Sbellard 41323556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 41333556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 41343556c233SPaolo Bonzinifi 413520ff6c80SAnthony Liguori 41367c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 413770c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 413870c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 413970c60c08SStefan Hajnoczielse 414070c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 414170c60c08SStefan Hajnoczifi 4142d0e2fce5SAneesh Kumar K.V 41437d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 41447d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 41457d992e4dSPeter Lievenfi 41467d992e4dSPeter Lieven 4147f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 4148f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 4149f0d92b56SLongpeng(Mike)fi 4150f0d92b56SLongpeng(Mike) 4151d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 4152d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 4153d83414e1SMarc-André Lureaufi 4154d83414e1SMarc-André Lureau 41550aebab04SLingfeng Yangif test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 41560aebab04SLingfeng Yang echo "CONFIG_TSAN=y" >> $config_host_mak 41570aebab04SLingfeng Yangfi 41580aebab04SLingfeng Yang 415976a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 416076a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 416176a347e1SRichard Hendersonfi 416276a347e1SRichard Henderson 4163f540166bSRichard Hendersonif test "$int128" = "yes" ; then 4164f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 4165f540166bSRichard Hendersonfi 4166f540166bSRichard Henderson 41677ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 41687ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 41697ebee43eSRichard Hendersonfi 41707ebee43eSRichard Henderson 4171e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 4172e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 4173e6cd4bb5SRichard Hendersonfi 4174e6cd4bb5SRichard Henderson 4175b10d49d7SPino Toscanoif test "$libssh" = "yes" ; then 4176484e2cc7SPaolo Bonzini echo "CONFIG_LIBSSH=y" >> $config_host_mak 4177b10d49d7SPino Toscano echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 4178b10d49d7SPino Toscano echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 41790a12ec87SRichard W.M. Jonesfi 41800a12ec87SRichard W.M. Jones 4181ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 4182ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 4183ed1701c6SDr. David Alan Gilbertfi 4184ed1701c6SDr. David Alan Gilbert 41853b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 41863cae16dbSPaolo Bonzini echo 'CONFIG_TPM=y' >> $config_host_mak 41873b8acc11SPaolo Bonzinifi 41883b8acc11SPaolo Bonzini 41892da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 41902da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 4191392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 41922da776dbSMichael R. Hinesfi 41932da776dbSMichael R. Hines 419421ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 419521ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 419621ab34c9SMarcel Apfelbaumfi 419721ab34c9SMarcel Apfelbaum 4198a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 4199a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 4200a6b1d4c0SChanglong Xiefi 4201a6b1d4c0SChanglong Xie 4202ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 4203ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 4204ba59fb77SPaolo Bonzinifi 4205e0580342SKamil Rytarowski 42062f740136SJeff Codyif test "$bochs" = "yes" ; then 42072f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 42082f740136SJeff Codyfi 42092f740136SJeff Codyif test "$cloop" = "yes" ; then 42102f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 42112f740136SJeff Codyfi 42122f740136SJeff Codyif test "$dmg" = "yes" ; then 42132f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 42142f740136SJeff Codyfi 42152f740136SJeff Codyif test "$qcow1" = "yes" ; then 42162f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 42172f740136SJeff Codyfi 42182f740136SJeff Codyif test "$vdi" = "yes" ; then 42192f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 42202f740136SJeff Codyfi 42212f740136SJeff Codyif test "$vvfat" = "yes" ; then 42222f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 42232f740136SJeff Codyfi 42242f740136SJeff Codyif test "$qed" = "yes" ; then 42252f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 42262f740136SJeff Codyfi 42272f740136SJeff Codyif test "$parallels" = "yes" ; then 42282f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 42292f740136SJeff Codyfi 42302f740136SJeff Cody 423140e8c6f4SAlex Bennéeif test "$plugins" = "yes" ; then 423240e8c6f4SAlex Bennée echo "CONFIG_PLUGIN=y" >> $config_host_mak 423326fffe29SEmilio G. Cota # Copy the export object list to the build dir 423426fffe29SEmilio G. Cota if test "$ld_dynamic_list" = "yes" ; then 423526fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 423626fffe29SEmilio G. Cota ld_symbols=qemu-plugins-ld.symbols 423726fffe29SEmilio G. Cota cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 423826fffe29SEmilio G. Cota elif test "$ld_exported_symbols_list" = "yes" ; then 423926fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 424026fffe29SEmilio G. Cota ld64_symbols=qemu-plugins-ld64.symbols 424126fffe29SEmilio G. Cota echo "# Automatically generated by configure - do not modify" > $ld64_symbols 424226fffe29SEmilio G. Cota grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 424326fffe29SEmilio G. Cota sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 424426fffe29SEmilio G. Cota else 424526fffe29SEmilio G. Cota error_exit \ 424626fffe29SEmilio G. Cota "If \$plugins=yes, either \$ld_dynamic_list or " \ 424726fffe29SEmilio G. Cota "\$ld_exported_symbols_list should have been set to 'yes'." 424826fffe29SEmilio G. Cota fi 424940e8c6f4SAlex Bennéefi 425040e8c6f4SAlex Bennée 4251f48e590aSAlex Bennéeif test -n "$gdb_bin"; then 4252b1863cccSAlex Bennée gdb_version=$($gdb_bin --version | head -n 1) 4253d6a66c81SAlex Bennée if version_ge ${gdb_version##* } 9.1; then 4254f48e590aSAlex Bennée echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 4255f48e590aSAlex Bennée fi 4256b1863cccSAlex Bennéefi 4257f48e590aSAlex Bennée 425854e7aac0SAlexey Krasikovif test "$secret_keyring" = "yes" ; then 425954e7aac0SAlexey Krasikov echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 426054e7aac0SAlexey Krasikovfi 426154e7aac0SAlexey Krasikov 426298ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 4263804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 4264c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 426539d87c8cSAlex Bennéeecho "GENISOIMAGE=$genisoimage" >> $config_host_mak 4266a5665051SPaolo Bonziniecho "MESON=$meson" >> $config_host_mak 426709e93326SPaolo Bonziniecho "NINJA=$ninja" >> $config_host_mak 4268804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 4269433de74cSBastian Koppelmannecho "HOST_CC=$host_cc" >> $config_host_mak 4270a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 4271859aef02SPaolo Bonzini echo "CONFIG_IASL=$iasl" >> $config_host_mak 4272a31a8642SMichael S. Tsirkinfi 4273804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 4274cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 42755f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 42763dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 4277804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 4278804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 427946eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 4280a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 428111cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 4282a81df1b6SPaolo Bonziniecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 4283a81df1b6SPaolo Bonziniecho "GLIB_LIBS=$glib_libs" >> $config_host_mak 42848a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 4285e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 4286804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 4287f15bff25SPaolo Bonziniecho "LIBS_QGA=$libs_qga" >> $config_host_mak 4288804edf29SJuan Quintela 4289b767d257SMarek Marczykowski-Góreckiif test "$rng_none" = "yes"; then 4290b767d257SMarek Marczykowski-Górecki echo "CONFIG_RNG_NONE=y" >> $config_host_mak 4291b767d257SMarek Marczykowski-Góreckifi 4292b767d257SMarek Marczykowski-Górecki 42936efd7517SPeter Maydell# use included Linux headers 42946efd7517SPeter Maydellif test "$linux" = "yes" ; then 4295a307beb6SAndreas Färber mkdir -p linux-headers 42966efd7517SPeter Maydell case "$cpu" in 4297c72b26ecSRichard Henderson i386|x86_64|x32) 429808312a63SPeter Maydell linux_arch=x86 42996efd7517SPeter Maydell ;; 4300f8378accSRichard Henderson ppc|ppc64|ppc64le) 430108312a63SPeter Maydell linux_arch=powerpc 43026efd7517SPeter Maydell ;; 43036efd7517SPeter Maydell s390x) 430408312a63SPeter Maydell linux_arch=s390 430508312a63SPeter Maydell ;; 43061f080313SClaudio Fontana aarch64) 43071f080313SClaudio Fontana linux_arch=arm64 43081f080313SClaudio Fontana ;; 4309222e7d11SSanjay Lal mips64) 4310222e7d11SSanjay Lal linux_arch=mips 4311222e7d11SSanjay Lal ;; 431208312a63SPeter Maydell *) 431308312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 431408312a63SPeter Maydell linux_arch="$cpu" 43156efd7517SPeter Maydell ;; 43166efd7517SPeter Maydell esac 431708312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 431808312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 431908312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 432008312a63SPeter Maydell fi 43216efd7517SPeter Maydellfi 43226efd7517SPeter Maydell 432397a847bcSbellardfor target in $target_list; do 432497a847bcSbellard target_dir="$target" 432589138857SStefan Weil target_name=$(echo $target | cut -d '-' -f 1) 432697a847bcSbellard mkdir -p $target_dir 4327fdb75aefSPaolo Bonzini case $target in 4328fdb75aefSPaolo Bonzini *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; 4329fdb75aefSPaolo Bonzini *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; 43302408a527Saurel32 esac 433156aebc89Spbrookdone 43327d13299dSbellard 4333765686d6SPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak 4334fdb75aefSPaolo Bonziniif test "$default_targets" = "yes"; then 4335fdb75aefSPaolo Bonzini echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 4336fdb75aefSPaolo Bonzinifi 4337a540f158SPeter Crosthwaite 4338a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 4339a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 4340ab318051SMarc-André Lureau echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 4341a99d57bbSWanlong Gaofi 4342a99d57bbSWanlong Gao 4343fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 4344fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 4345fd0e6053SJohn Snowfi 4346fd0e6053SJohn Snow 43471e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 43481e4f6065SDaniele Buono echo "CONFIG_SAFESTACK=y" >> $config_host_mak 43491e4f6065SDaniele Buonofi 43501e4f6065SDaniele Buono 4351e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 4352e29e5c6eSPeter Maydell# DIRS are directories which we simply mkdir in the build tree; 4353e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 4354e29e5c6eSPeter Maydell# (these can be both files and directories). 4355e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 4356e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 4357e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 4358e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 4359e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 4360e29e5c6eSPeter Maydell# directory and symlink the directory instead. 436109db9b9dSGerd Hoffmann# UNLINK is used to remove symlinks from older development versions 436209db9b9dSGerd Hoffmann# that might get into the way when doing "git update" without doing 436309db9b9dSGerd Hoffmann# a "make distclean" in between. 43649d49bcf6SMarkus ArmbrusterDIRS="tests tests/tcg tests/qapi-schema tests/qtest/libqos" 43651cf4323eSThomas HuthDIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 4366b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 4367744a928cSAlexey KardashevskiyDIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 43688db2a4fdSGerd HoffmannDIRS="$DIRS roms/seabios" 4369c17a386bSAlex BennéeDIRS="$DIRS contrib/plugins/" 43702038f8c8SPaolo BonziniLINKS="Makefile" 43713941996bSPaolo BonziniLINKS="$LINKS tests/tcg/Makefile.target" 4372ddcf607fSGerd HoffmannLINKS="$LINKS pc-bios/optionrom/Makefile" 4373e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 43748db2a4fdSGerd HoffmannLINKS="$LINKS roms/seabios/Makefile" 4375e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 4376e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 437739950353SPeter MaydellLINKS="$LINKS tests/acceptance tests/data" 437839950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 43798f8fd9edSCleber RosaLINKS="$LINKS python" 4380c17a386bSAlex BennéeLINKS="$LINKS contrib/plugins/Makefile " 438109db9b9dSGerd HoffmannUNLINK="pc-bios/keymaps" 4382753d11f2SRichard Hendersonfor bios_file in \ 4383753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 43843a631b8eSBin Meng $source_path/pc-bios/*.elf \ 4385225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 4386753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 4387753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 4388e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 4389753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 43904e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 439126ce90fdSLaszlo Ersek $source_path/pc-bios/edk2-*.fd.bz2 \ 4392cd946e5cSJohn Arbuckle $source_path/pc-bios/palcode-* \ 4393cd946e5cSJohn Arbuckle $source_path/pc-bios/qemu_vga.ndrv 4394cd946e5cSJohn Arbuckle 4395753d11f2SRichard Hendersondo 4396e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 43977ea78b74SJan Kiszkadone 4398d1807a4fSPaolo Bonzinimkdir -p $DIRS 4399e29e5c6eSPeter Maydellfor f in $LINKS ; do 44000f4d8894SPaolo Bonzini if [ -e "$source_path/$f" ]; then 4401f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 4402f9245e10SPeter Maydell fi 44037d13299dSbellarddone 440409db9b9dSGerd Hoffmannfor f in $UNLINK ; do 440509db9b9dSGerd Hoffmann if [ -L "$f" ]; then 440609db9b9dSGerd Hoffmann rm -f "$f" 440709db9b9dSGerd Hoffmann fi 440809db9b9dSGerd Hoffmanndone 44091ad2134fSPaul Brook 44102038f8c8SPaolo Bonzini(for i in $cross_cc_vars; do 44112038f8c8SPaolo Bonzini export $i 44122038f8c8SPaolo Bonzinidone 4413de6d7e6bSAlex Bennéeexport target_list source_path use_containers ARCH 44142038f8c8SPaolo Bonzini$source_path/tests/tcg/configure.sh) 44152038f8c8SPaolo Bonzini 4416c34ebfdcSAnthony Liguori# temporary config to build submodules 44178db2a4fdSGerd Hoffmannfor rom in seabios; do 4418c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 441937116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 4420c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 4421cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 44225f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 4423c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 4424c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 44253dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 4426c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 4427a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 4428c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 44299f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 4430c34ebfdcSAnthony Liguoridone 4431c34ebfdcSAnthony Liguori 4432a5665051SPaolo Bonziniif test "$skip_meson" = no; then 4433fc929892SMarc-André Lureau cross="config-meson.cross.new" 4434fc929892SMarc-André Lureau meson_quote() { 443547b30835SPaolo Bonzini echo "'$(echo $* | sed "s/ /','/g")'" 4436fc929892SMarc-André Lureau } 4437fc929892SMarc-André Lureau 4438fc929892SMarc-André Lureau echo "# Automatically generated by configure - do not modify" > $cross 4439fc929892SMarc-André Lureau echo "[properties]" >> $cross 4440d1d5e9eeSAlex Bennée 4441d1d5e9eeSAlex Bennée # unroll any custom device configs 4442d1d5e9eeSAlex Bennée for a in $device_archs; do 4443d1d5e9eeSAlex Bennée eval "c=\$devices_${a}" 4444d1d5e9eeSAlex Bennée echo "${a}-softmmu = '$c'" >> $cross 4445d1d5e9eeSAlex Bennée done 4446d1d5e9eeSAlex Bennée 4447fc929892SMarc-André Lureau test -z "$cxx" && echo "link_language = 'c'" >> $cross 444847b30835SPaolo Bonzini echo "[built-in options]" >> $cross 444947b30835SPaolo Bonzini echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross 445047b30835SPaolo Bonzini echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross 445147b30835SPaolo Bonzini echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 445247b30835SPaolo Bonzini echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 4453fc929892SMarc-André Lureau echo "[binaries]" >> $cross 44544dba2789SPaolo Bonzini echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross 44554dba2789SPaolo Bonzini test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross 44564dba2789SPaolo Bonzini test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross 445747b30835SPaolo Bonzini echo "ar = [$(meson_quote $ar)]" >> $cross 445847b30835SPaolo Bonzini echo "nm = [$(meson_quote $nm)]" >> $cross 445947b30835SPaolo Bonzini echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross 446047b30835SPaolo Bonzini echo "ranlib = [$(meson_quote $ranlib)]" >> $cross 4461e8178514SPaolo Bonzini if has $sdl2_config; then 446247b30835SPaolo Bonzini echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 4463e8178514SPaolo Bonzini fi 446447b30835SPaolo Bonzini echo "strip = [$(meson_quote $strip)]" >> $cross 446547b30835SPaolo Bonzini echo "windres = [$(meson_quote $windres)]" >> $cross 44663812c0c4SJoelle van Dyne if test "$cross_compile" = "yes"; then 4467fc929892SMarc-André Lureau cross_arg="--cross-file config-meson.cross" 4468fc929892SMarc-André Lureau echo "[host_machine]" >> $cross 4469fc929892SMarc-André Lureau if test "$mingw32" = "yes" ; then 4470fc929892SMarc-André Lureau echo "system = 'windows'" >> $cross 4471fc929892SMarc-André Lureau fi 4472853b4bafSThomas Huth if test "$linux" = "yes" ; then 4473853b4bafSThomas Huth echo "system = 'linux'" >> $cross 4474853b4bafSThomas Huth fi 44750ca321eaSJoelle van Dyne if test "$darwin" = "yes" ; then 44760ca321eaSJoelle van Dyne echo "system = 'darwin'" >> $cross 44770ca321eaSJoelle van Dyne fi 4478fc929892SMarc-André Lureau case "$ARCH" in 4479f6bca9dfSJoelle van Dyne i386) 4480fc929892SMarc-André Lureau echo "cpu_family = 'x86'" >> $cross 4481fc929892SMarc-André Lureau ;; 4482f8bb7e1cSDavid Michael x86_64|x32) 4483f6bca9dfSJoelle van Dyne echo "cpu_family = 'x86_64'" >> $cross 4484f6bca9dfSJoelle van Dyne ;; 4485fc929892SMarc-André Lureau ppc64le) 4486fc929892SMarc-André Lureau echo "cpu_family = 'ppc64'" >> $cross 4487fc929892SMarc-André Lureau ;; 4488fc929892SMarc-André Lureau *) 4489fc929892SMarc-André Lureau echo "cpu_family = '$ARCH'" >> $cross 4490fc929892SMarc-André Lureau ;; 4491fc929892SMarc-André Lureau esac 4492fc929892SMarc-André Lureau echo "cpu = '$cpu'" >> $cross 4493fc929892SMarc-André Lureau if test "$bigendian" = "yes" ; then 4494fc929892SMarc-André Lureau echo "endian = 'big'" >> $cross 4495fc929892SMarc-André Lureau else 4496fc929892SMarc-André Lureau echo "endian = 'little'" >> $cross 4497fc929892SMarc-André Lureau fi 4498fc929892SMarc-André Lureau else 4499fc929892SMarc-André Lureau cross_arg="--native-file config-meson.cross" 4500fc929892SMarc-André Lureau fi 4501fc929892SMarc-André Lureau mv $cross config-meson.cross 4502fc929892SMarc-André Lureau 4503a5665051SPaolo Bonzini rm -rf meson-private meson-info meson-logs 4504*61d63097SPaolo Bonzini run_meson() { 450509e93326SPaolo Bonzini NINJA=$ninja $meson setup \ 4506d17f305aSPaolo Bonzini --prefix "$prefix" \ 4507d17f305aSPaolo Bonzini --libdir "$libdir" \ 4508d17f305aSPaolo Bonzini --libexecdir "$libexecdir" \ 4509d17f305aSPaolo Bonzini --bindir "$bindir" \ 4510d17f305aSPaolo Bonzini --includedir "$includedir" \ 4511d17f305aSPaolo Bonzini --datadir "$datadir" \ 4512d17f305aSPaolo Bonzini --mandir "$mandir" \ 4513d17f305aSPaolo Bonzini --sysconfdir "$sysconfdir" \ 451416bf7a33SPaolo Bonzini --localedir "$localedir" \ 4515d17f305aSPaolo Bonzini --localstatedir "$local_statedir" \ 4516d17f305aSPaolo Bonzini -Ddocdir="$docdir" \ 451716bf7a33SPaolo Bonzini -Dqemu_firmwarepath="$firmwarepath" \ 451873f3aa37SMarc-André Lureau -Dqemu_suffix="$qemu_suffix" \ 4519a5665051SPaolo Bonzini -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 4520a5665051SPaolo Bonzini -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 4521a5665051SPaolo Bonzini -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 4522a5665051SPaolo Bonzini -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 4523da6d48b9SMarc-André Lureau -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 4524bf0e56a3SMarc-André Lureau -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 4525537b7248SPaolo Bonzini -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug -Dfuzzing=$fuzzing \ 4526537b7248SPaolo Bonzini $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \ 4527deb62371SPaolo Bonzini -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ 452874a414a1SReinoud Zandijk -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \ 45291badb709SPaolo Bonzini -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ 45301b695471SPaolo Bonzini -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ 4531c23d7b4eSPaolo Bonzini -Dlibusb=$libusb -Dsmartcard=$smartcard -Dusb_redir=$usb_redir -Dvte=$vte \ 4532a0b93237SPaolo Bonzini -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ 4533cece116cSMisono Tomohiro -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ 45348c6d4ff4SPaolo Bonzini -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ 45359db405a3SPaolo Bonzini -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \ 453630045c05SPaolo Bonzini -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ 4537c5b36c25SPaolo Bonzini -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse -Dlibxml2=$libxml2 \ 453853c22b68SPaolo Bonzini -Dlibdaxctl=$libdaxctl -Dlibpmem=$libpmem -Dlinux_io_uring=$linux_io_uring \ 453905e391aeSPaolo Bonzini -Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt -Dauth_pam=$auth_pam \ 4540727c8bb8SPaolo Bonzini -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \ 4541587d59d6SPaolo Bonzini -Dattr=$attr -Ddefault_devices=$default_devices -Dvirglrenderer=$virglrenderer \ 4542c8d5450bSPaolo Bonzini -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ 4543106ad1f9SPaolo Bonzini -Dvhost_user_blk_server=$vhost_user_blk_server -Dmultiprocess=$multiprocess \ 454446627f41SAndrew Melnychenko -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi -Dbpf=$bpf\ 4545332008e0SThomas Huth $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \ 4546ca50e523SPaolo Bonzini -Dalsa=$alsa -Dcoreaudio=$coreaudio -Ddsound=$dsound -Djack=$jack -Doss=$oss \ 4547ca50e523SPaolo Bonzini -Dpa=$pa -Daudio_drv_list=$audio_drv_list -Dtcg_interpreter=$tcg_interpreter \ 4548ff66f3e5SPaolo Bonzini -Dtrace_backends=$trace_backends -Dtrace_file=$trace_file -Dlinux_aio=$linux_aio \ 4549837b84b1SPaolo Bonzini -Dnetmap=$netmap -Dvde=$vde \ 4550*61d63097SPaolo Bonzini "$@" $cross_arg "$PWD" "$source_path" 4551*61d63097SPaolo Bonzini } 4552*61d63097SPaolo Bonzini eval run_meson $meson_options 4553a5665051SPaolo Bonzini if test "$?" -ne 0 ; then 4554a5665051SPaolo Bonzini error_exit "meson setup failed" 4555a5665051SPaolo Bonzini fi 4556699d3884SPaolo Bonzinielse 4557699d3884SPaolo Bonzini if test -f meson-private/cmd_line.txt; then 4558699d3884SPaolo Bonzini # Adjust old command line options whose type was changed 4559699d3884SPaolo Bonzini # Avoids having to use "setup --wipe" when Meson is upgraded 4560699d3884SPaolo Bonzini perl -i -ne ' 4561699d3884SPaolo Bonzini s/^gettext = true$/gettext = auto/; 4562699d3884SPaolo Bonzini s/^gettext = false$/gettext = disabled/; 4563654d6b04SPaolo Bonzini /^b_staticpic/ && next; 4564699d3884SPaolo Bonzini print;' meson-private/cmd_line.txt 4565699d3884SPaolo Bonzini fi 4566a5665051SPaolo Bonzinifi 4567a5665051SPaolo Bonzini 45682d838d9bSAlex Bennéeif test -n "${deprecated_features}"; then 45692d838d9bSAlex Bennée echo "Warning, deprecated features enabled." 4570a476b216SMao Zhongyi echo "Please see docs/about/deprecated.rst" 45712d838d9bSAlex Bennée echo " features: ${deprecated_features}" 45722d838d9bSAlex Bennéefi 45732d838d9bSAlex Bennée 4574e0447a83SThomas Huth# Create list of config switches that should be poisoned in common code... 4575e0447a83SThomas Huth# but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special. 457654b0306eSThomas Huthtarget_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null) 457754b0306eSThomas Huthif test -n "$target_configs_h" ; then 4578e0447a83SThomas Huth sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \ 4579e0447a83SThomas Huth -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \ 458054b0306eSThomas Huth $target_configs_h | sort -u > config-poison.h 458154b0306eSThomas Huthelse 458254b0306eSThomas Huth :> config-poison.h 458354b0306eSThomas Huthfi 4584e0447a83SThomas Huth 4585dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 4586dc655404SMichael S. Tsirkincat <<EOD >config.status 4587dc655404SMichael S. Tsirkin#!/bin/sh 4588dc655404SMichael S. Tsirkin# Generated by configure. 4589dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 4590dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 4591dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 4592dc655404SMichael S. TsirkinEOD 4593e811da7fSDaniel P. Berrangé 4594e811da7fSDaniel P. Berrangépreserve_env() { 4595e811da7fSDaniel P. Berrangé envname=$1 4596e811da7fSDaniel P. Berrangé 4597e811da7fSDaniel P. Berrangé eval envval=\$$envname 4598e811da7fSDaniel P. Berrangé 4599e811da7fSDaniel P. Berrangé if test -n "$envval" 4600e811da7fSDaniel P. Berrangé then 4601e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 4602e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 4603e811da7fSDaniel P. Berrangé else 4604e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 4605e811da7fSDaniel P. Berrangé fi 4606e811da7fSDaniel P. Berrangé} 4607e811da7fSDaniel P. Berrangé 4608e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 4609e811da7fSDaniel P. Berrangé# features/build target configure will detect 4610e811da7fSDaniel P. Berrangépreserve_env AR 4611e811da7fSDaniel P. Berrangépreserve_env AS 4612e811da7fSDaniel P. Berrangépreserve_env CC 4613e811da7fSDaniel P. Berrangépreserve_env CPP 4614e811da7fSDaniel P. Berrangépreserve_env CXX 4615e811da7fSDaniel P. Berrangépreserve_env INSTALL 4616e811da7fSDaniel P. Berrangépreserve_env LD 4617e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 4618e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 4619e811da7fSDaniel P. Berrangépreserve_env MAKE 4620e811da7fSDaniel P. Berrangépreserve_env NM 4621e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 4622e811da7fSDaniel P. Berrangépreserve_env PATH 4623e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 4624e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 4625e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 4626e811da7fSDaniel P. Berrangépreserve_env PYTHON 4627e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 4628e811da7fSDaniel P. Berrangépreserve_env SMBD 4629e811da7fSDaniel P. Berrangépreserve_env STRIP 4630e811da7fSDaniel P. Berrangépreserve_env WINDRES 4631e811da7fSDaniel P. Berrangé 4632dc655404SMichael S. Tsirkinprintf "exec" >>config.status 4633a5665051SPaolo Bonzinifor i in "$0" "$@"; do 4634835af899SPaolo Bonzini test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status 4635a5665051SPaolo Bonzinidone 4636cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 4637dc655404SMichael S. Tsirkinchmod +x config.status 4638dc655404SMichael S. Tsirkin 46398cd05ab6SPeter Maydellrm -r "$TMPDIR1" 4640