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 289c87ea116SAlex Bennéexen_ctrl_version="$default_feature" 290c87ea116SAlex Bennéexfs="$default_feature" 291c87ea116SAlex Bennéemembarrier="$default_feature" 2920848f8acSThomas Huthvhost_kernel="$default_feature" 293c87ea116SAlex Bennéevhost_net="$default_feature" 294c87ea116SAlex Bennéevhost_crypto="$default_feature" 295c87ea116SAlex Bennéevhost_scsi="$default_feature" 296c87ea116SAlex Bennéevhost_vsock="$default_feature" 297d88618f7SStefan Hajnoczivhost_user="no" 298c87ea116SAlex Bennéevhost_user_fs="$default_feature" 2990848f8acSThomas Huthvhost_vdpa="$default_feature" 300c87ea116SAlex Bennéerdma="$default_feature" 301c87ea116SAlex Bennéepvrdma="$default_feature" 302377529c0SPaolo Bonzinigprof="no" 303377529c0SPaolo Bonzinidebug_tcg="no" 304377529c0SPaolo Bonzinidebug="no" 305247724cbSMarc-André Lureausanitizers="no" 3060aebab04SLingfeng Yangtsan="no" 307c87ea116SAlex Bennéefortify_source="$default_feature" 308377529c0SPaolo Bonzinistrip_opt="yes" 309377529c0SPaolo Bonzinimingw32="no" 3101d728c39SBlue Swirlgcov="no" 311c7328271SMiroslav RezaninaEXESUF="" 31217969268SFam Zhengmodules="no" 313bd83c861SChristian Ehrhardtmodule_upgrades="no" 314377529c0SPaolo Bonziniprefix="/usr/local" 31510ff82d1SMarc-André Lureauqemu_suffix="qemu" 316377529c0SPaolo Bonzinibsd="no" 317377529c0SPaolo Bonzinilinux="no" 318377529c0SPaolo Bonzinisolaris="no" 319377529c0SPaolo Bonziniprofiler="no" 320377529c0SPaolo Bonzinisoftmmu="yes" 321377529c0SPaolo Bonzinilinux_user="no" 322377529c0SPaolo Bonzinibsd_user="no" 323377529c0SPaolo Bonzinipkgversion="" 32440d6444eSAvi Kivitypie="" 3253556c233SPaolo Bonziniqom_cast_debug="yes" 326baf86d6bSPaolo Bonzinitrace_backends="log" 327377529c0SPaolo Bonzinitrace_file="trace" 328c87ea116SAlex Bennéeopengl="$default_feature" 3295dd89908SRichard Hendersoncpuid_h="no" 330c87ea116SAlex Bennéeavx2_opt="$default_feature" 331c87ea116SAlex Bennéeguest_agent="$default_feature" 332d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 33350cbebb9SMichael Rothguest_agent_ntddscsi="no" 334c87ea116SAlex Bennéevss_win32_sdk="$default_feature" 335d9840e25STomoki Sekiyamawin_sdk="no" 336c87ea116SAlex Bennéewant_tools="$default_feature" 337519175a2SAlex Barcelocoroutine="" 338c87ea116SAlex Bennéecoroutine_pool="$default_feature" 3397d992e4dSPeter Lievendebug_stack_usage="no" 340f0d92b56SLongpeng(Mike)crypto_afalg="no" 341a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 342c87ea116SAlex Bennéetpm="$default_feature" 343c87ea116SAlex Bennéelibssh="$default_feature" 344c87ea116SAlex Bennéelive_block_migration=${default_feature:-yes} 345c87ea116SAlex Bennéenuma="$default_feature" 346c87ea116SAlex Bennéereplication=${default_feature:-yes} 347c87ea116SAlex Bennéebochs=${default_feature:-yes} 348c87ea116SAlex Bennéecloop=${default_feature:-yes} 349c87ea116SAlex Bennéedmg=${default_feature:-yes} 350c87ea116SAlex Bennéeqcow1=${default_feature:-yes} 351c87ea116SAlex Bennéevdi=${default_feature:-yes} 352c87ea116SAlex Bennéevvfat=${default_feature:-yes} 353c87ea116SAlex Bennéeqed=${default_feature:-yes} 354c87ea116SAlex Bennéeparallels=${default_feature:-yes} 355ba59fb77SPaolo Bonzinidebug_mutex="no" 356ba4dd2aaSAlex Bennéeplugins="$default_feature" 357b767d257SMarek Marczykowski-Góreckirng_none="no" 358c87ea116SAlex Bennéesecret_keyring="$default_feature" 359a5665051SPaolo Bonzinimeson="" 360*3b4da132SPaolo Bonzinimeson_args="" 36148328880SPaolo Bonzinininja="" 362*3b4da132SPaolo Bonzinigio="$default_feature" 363a5665051SPaolo Bonziniskip_meson=no 364b8e0c493SJoelle van Dyneslirp_smbd="$default_feature" 365377529c0SPaolo Bonzini 366*3b4da132SPaolo Bonzini# The following Meson options are handled manually (still they 367*3b4da132SPaolo Bonzini# are included in the automatically generated help message) 368*3b4da132SPaolo Bonzini 369*3b4da132SPaolo Bonzini# 1. Track which submodules are needed 370*3b4da132SPaolo Bonzinicapstone="auto" 371*3b4da132SPaolo Bonzinifdt="auto" 372*3b4da132SPaolo Bonzinislirp="auto" 373*3b4da132SPaolo Bonzini 374*3b4da132SPaolo Bonzini# 2. Support --with/--without option 375*3b4da132SPaolo Bonzinidefault_devices="true" 376*3b4da132SPaolo Bonzini 377*3b4da132SPaolo Bonzini# 3. Automatically enable/disable other options 378*3b4da132SPaolo Bonzinitcg="enabled" 379*3b4da132SPaolo Bonzinicfi="false" 380*3b4da132SPaolo Bonzini 381*3b4da132SPaolo Bonzini# 4. Detection partly done in configure 382*3b4da132SPaolo Bonzinixen=${default_feature:+disabled} 383898be3e0SPeter Maydell 384c87ea116SAlex Bennée# parse CC options second 385ac0df51dSaliguorifor opt do 38689138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 387ac0df51dSaliguori case "$opt" in 388ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 3893812c0c4SJoelle van Dyne cross_compile="yes" 390ac0df51dSaliguori ;; 3913d8df640SPaolo Bonzini --cc=*) CC="$optarg" 392ac0df51dSaliguori ;; 39383f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 39483f73fceSTomoki Sekiyama ;; 3952ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 3962ff6b91eSJuan Quintela ;; 397de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 398db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 399e2a2ed06SJuan Quintela ;; 40011cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 40111cde1c8SBruno Dominguez ;; 402db5adeaaSPaolo Bonzini --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 403f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 404e2a2ed06SJuan Quintela ;; 4055bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 4065bc62e01SGerd Hoffmann ;; 4075bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 4085bc62e01SGerd Hoffmann ;; 409d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 410d75402b5SAlex Bennée ;; 411d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 412d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 4132038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 414d422b2bcSAlex Bennée ;; 415d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 4162038f8c8SPaolo Bonzini cc_archs="$cc_archs $cc_arch" 417d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 4182038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 419d75402b5SAlex Bennée ;; 420ac0df51dSaliguori esac 421ac0df51dSaliguoridone 422ac0df51dSaliguori# OS specific 423ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 42493148aa5SStefan Weil# we can eliminate its usage altogether. 425ac0df51dSaliguori 426e49d021eSPeter Maydell# Preferred compiler: 427e49d021eSPeter Maydell# ${CC} (if set) 428e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 429e49d021eSPeter Maydell# system compiler 430e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 431e49d021eSPeter Maydell cc="$host_cc" 432e49d021eSPeter Maydellelse 433b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 434e49d021eSPeter Maydellfi 435e49d021eSPeter Maydell 43683f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 43783f73fceSTomoki Sekiyama cxx="c++" 43883f73fceSTomoki Sekiyamaelse 43983f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 44083f73fceSTomoki Sekiyamafi 44183f73fceSTomoki Sekiyama 442b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 443cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 4445f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 4453dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 446b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 447b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 4489f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 4494852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 450b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 451b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 45217884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 45317884d7bSSergei Trofimovichquery_pkg_config() { 45417884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 45517884d7bSSergei Trofimovich} 45617884d7bSSergei Trofimovichpkg_config=query_pkg_config 45747c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 458ac0df51dSaliguori 459be17dc90SMichael S. Tsirkin# default flags for all hosts 4602d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 4612d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 4622d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 4632d31515bSPeter Maydell# provides these semantics.) 464086d5f75SPaolo BonziniQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 465086d5f75SPaolo BonziniQEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 466c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 467be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 4685770e8afSPaolo Bonzini 4695770e8afSPaolo Bonzini# Flags that are needed during configure but later taken care of by Meson 4708a9d3d56SRichard HendersonCONFIGURE_CFLAGS="-std=gnu11 -Wall" 4715770e8afSPaolo BonziniCONFIGURE_LDFLAGS= 472086d5f75SPaolo Bonzini 473be17dc90SMichael S. Tsirkin 474ac0df51dSaliguoricheck_define() { 475ac0df51dSaliguoricat > $TMPC <<EOF 476ac0df51dSaliguori#if !defined($1) 477fd786e1aSPeter Maydell#error $1 not defined 478ac0df51dSaliguori#endif 479ac0df51dSaliguoriint main(void) { return 0; } 480ac0df51dSaliguoriEOF 48152166aa0SJuan Quintela compile_object 482ac0df51dSaliguori} 483ac0df51dSaliguori 484307119e7SGerd Hoffmanncheck_include() { 485307119e7SGerd Hoffmanncat > $TMPC <<EOF 486307119e7SGerd Hoffmann#include <$1> 487307119e7SGerd Hoffmannint main(void) { return 0; } 488307119e7SGerd HoffmannEOF 489307119e7SGerd Hoffmann compile_object 490307119e7SGerd Hoffmann} 491307119e7SGerd Hoffmann 49293b25869SJohn Snowwrite_c_skeleton() { 49393b25869SJohn Snow cat > $TMPC <<EOF 49493b25869SJohn Snowint main(void) { return 0; } 49593b25869SJohn SnowEOF 49693b25869SJohn Snow} 49793b25869SJohn Snow 498bbea4050SPeter Maydellif check_define __linux__ ; then 499bbea4050SPeter Maydell targetos="Linux" 500bbea4050SPeter Maydellelif check_define _WIN32 ; then 501bbea4050SPeter Maydell targetos='MINGW32' 502bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 503bbea4050SPeter Maydell targetos='OpenBSD' 504bbea4050SPeter Maydellelif check_define __sun__ ; then 505bbea4050SPeter Maydell targetos='SunOS' 506bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 507bbea4050SPeter Maydell targetos='Haiku' 508951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 509951fedfcSPeter Maydell targetos='FreeBSD' 510951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 511951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 512951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 513951fedfcSPeter Maydell targetos='DragonFly' 514951fedfcSPeter Maydellelif check_define __NetBSD__; then 515951fedfcSPeter Maydell targetos='NetBSD' 516951fedfcSPeter Maydellelif check_define __APPLE__; then 517951fedfcSPeter Maydell targetos='Darwin' 518bbea4050SPeter Maydellelse 519951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 520951fedfcSPeter Maydell # might be going to just print the --help text, or it might 521951fedfcSPeter Maydell # be the result of a missing compiler. 522951fedfcSPeter Maydell targetos='bogus' 523bbea4050SPeter Maydellfi 524bbea4050SPeter Maydell 525bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 526bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 527bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 528bbea4050SPeter Maydell# the correct CPU with the --cpu option. 529bbea4050SPeter Maydellcase $targetos in 530bbea4050SPeter MaydellSunOS) 53189138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 532bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 533bbea4050SPeter Maydell cpu="x86_64" 534bbea4050SPeter Maydell fi 535bbea4050SPeter Maydellesac 536bbea4050SPeter Maydell 5372ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 5382ff6b91eSJuan Quintela # command line argument 5392ff6b91eSJuan Quintela : 5402ff6b91eSJuan Quintelaelif check_define __i386__ ; then 541ac0df51dSaliguori cpu="i386" 542ac0df51dSaliguorielif check_define __x86_64__ ; then 543c72b26ecSRichard Henderson if check_define __ILP32__ ; then 544c72b26ecSRichard Henderson cpu="x32" 545c72b26ecSRichard Henderson else 546ac0df51dSaliguori cpu="x86_64" 547c72b26ecSRichard Henderson fi 5483aa9bd6cSblueswir1elif check_define __sparc__ ; then 5493aa9bd6cSblueswir1 if check_define __arch64__ ; then 5503aa9bd6cSblueswir1 cpu="sparc64" 5513aa9bd6cSblueswir1 else 5523aa9bd6cSblueswir1 cpu="sparc" 5533aa9bd6cSblueswir1 fi 554fdf7ed96Smalcelif check_define _ARCH_PPC ; then 555fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 556f8378accSRichard Henderson if check_define _LITTLE_ENDIAN ; then 557f8378accSRichard Henderson cpu="ppc64le" 558f8378accSRichard Henderson else 559fdf7ed96Smalc cpu="ppc64" 560f8378accSRichard Henderson fi 561ac0df51dSaliguori else 562fdf7ed96Smalc cpu="ppc" 563fdf7ed96Smalc fi 564afa05235SAurelien Jarnoelif check_define __mips__ ; then 565afa05235SAurelien Jarno cpu="mips" 566d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 567d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 568d66ed0eaSAurelien Jarno cpu="s390x" 569d66ed0eaSAurelien Jarno else 570d66ed0eaSAurelien Jarno cpu="s390" 571d66ed0eaSAurelien Jarno fi 572c4f80543SAlistair Franciselif check_define __riscv ; then 573c4f80543SAlistair Francis if check_define _LP64 ; then 574c4f80543SAlistair Francis cpu="riscv64" 575c4f80543SAlistair Francis else 576c4f80543SAlistair Francis cpu="riscv32" 577c4f80543SAlistair Francis fi 57821d89f84SPeter Maydellelif check_define __arm__ ; then 57921d89f84SPeter Maydell cpu="arm" 5801f080313SClaudio Fontanaelif check_define __aarch64__ ; then 5811f080313SClaudio Fontana cpu="aarch64" 582fdf7ed96Smalcelse 58389138857SStefan Weil cpu=$(uname -m) 584ac0df51dSaliguorifi 585ac0df51dSaliguori 586359bc95dSPeter MaydellARCH= 587359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 588359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 5897d13299dSbellardcase "$cpu" in 590ee35e968SThomas Huth ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 591898be3e0SPeter Maydell ;; 592f8378accSRichard Henderson ppc64le) 593f8378accSRichard Henderson ARCH="ppc64" 594f8378accSRichard Henderson ;; 5957d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 59697a847bcSbellard cpu="i386" 5977d13299dSbellard ;; 598aaa5fa14Saurel32 x86_64|amd64) 599aaa5fa14Saurel32 cpu="x86_64" 600aaa5fa14Saurel32 ;; 60121d89f84SPeter Maydell armv*b|armv*l|arm) 60221d89f84SPeter Maydell cpu="arm" 6037d13299dSbellard ;; 6041f080313SClaudio Fontana aarch64) 6051f080313SClaudio Fontana cpu="aarch64" 6061f080313SClaudio Fontana ;; 607afa05235SAurelien Jarno mips*) 608afa05235SAurelien Jarno cpu="mips" 609afa05235SAurelien Jarno ;; 6103142255cSblueswir1 sparc|sun4[cdmuv]) 611ae228531Sbellard cpu="sparc" 612ae228531Sbellard ;; 6137d13299dSbellard *) 614359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 615359bc95dSPeter Maydell ARCH=unknown 6167d13299dSbellard ;; 6177d13299dSbellardesac 618359bc95dSPeter Maydellif test -z "$ARCH"; then 619359bc95dSPeter Maydell ARCH="$cpu" 620359bc95dSPeter Maydellfi 621e2d52ad3SJuan Quintela 6227d13299dSbellard# OS specific 6230dbfc675SJuan Quintela 6247d13299dSbellardcase $targetos in 62567b915a5SbellardMINGW32*) 62667b915a5Sbellard mingw32="yes" 627898be3e0SPeter Maydell supported_os="yes" 6289b8e4298SAlex Bennée plugins="no" 629fb648e9cSDaniel P. Berrangé pie="no" 63067b915a5Sbellard;; 6315c40d2bdSthsGNU/kFreeBSD) 632a167ba50SAurelien Jarno bsd="yes" 6335c40d2bdSths;; 6347d3505c5SbellardFreeBSD) 6357d3505c5Sbellard bsd="yes" 636e2a74729SWarner Losh bsd_user="yes" 6370db4a067SPaolo Bonzini make="${MAKE-gmake}" 638f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 6397d3505c5Sbellard;; 640c5e97233Sblueswir1DragonFly) 641c5e97233Sblueswir1 bsd="yes" 6420db4a067SPaolo Bonzini make="${MAKE-gmake}" 643c5e97233Sblueswir1;; 6447d3505c5SbellardNetBSD) 6457d3505c5Sbellard bsd="yes" 6460db4a067SPaolo Bonzini make="${MAKE-gmake}" 6477d3505c5Sbellard;; 6487d3505c5SbellardOpenBSD) 6497d3505c5Sbellard bsd="yes" 6500db4a067SPaolo Bonzini make="${MAKE-gmake}" 6517d3505c5Sbellard;; 65283fb7adfSbellardDarwin) 65383fb7adfSbellard bsd="yes" 65483fb7adfSbellard darwin="yes" 655a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 656a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 657a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 65883fb7adfSbellard;; 659ec530c81SbellardSunOS) 660ec530c81Sbellard solaris="yes" 6610db4a067SPaolo Bonzini make="${MAKE-gmake}" 662e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 663d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 664d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 665d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 666d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 667ec530c81Sbellard;; 668179cf400SAndreas FärberHaiku) 669179cf400SAndreas Färber haiku="yes" 670b8ee198dSRichard Zak pie="no" 671b8ee198dSRichard Zak QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" 672179cf400SAndreas Färber;; 673898be3e0SPeter MaydellLinux) 6745327cf48Sbellard linux="yes" 675831b7825Sths linux_user="yes" 676c87ea116SAlex Bennée vhost_user=${default_feature:-yes} 677898be3e0SPeter Maydell;; 6787d13299dSbellardesac 6797d13299dSbellard 6800db4a067SPaolo Bonzini: ${make=${MAKE-make}} 681b6daf4d3SPaolo Bonzini 682faf44142SDaniel P. Berrangé# We prefer python 3.x. A bare 'python' is traditionally 683faf44142SDaniel P. Berrangé# python 2.x, but some distros have it as python 3.x, so 684ddf90699SEduardo Habkost# we check that too 685faf44142SDaniel P. Berrangépython= 6860a01d76fSMarc-André Lureauexplicit_python=no 687ddf90699SEduardo Habkostfor binary in "${PYTHON-python3}" python 688faf44142SDaniel P. Berrangédo 689faf44142SDaniel P. Berrangé if has "$binary" 690faf44142SDaniel P. Berrangé then 69195c5f2deSPaolo Bonzini python=$(command -v "$binary") 692faf44142SDaniel P. Berrangé break 693faf44142SDaniel P. Berrangé fi 694faf44142SDaniel P. Berrangédone 695903458c8SMarkus Armbruster 696903458c8SMarkus Armbruster 69739d87c8cSAlex Bennée# Check for ancillary tools used in testing 69839d87c8cSAlex Bennéegenisoimage= 6993df437c7SAlex Bennéefor binary in genisoimage mkisofs 70039d87c8cSAlex Bennéedo 70139d87c8cSAlex Bennée if has $binary 70239d87c8cSAlex Bennée then 70339d87c8cSAlex Bennée genisoimage=$(command -v "$binary") 70439d87c8cSAlex Bennée break 70539d87c8cSAlex Bennée fi 70639d87c8cSAlex Bennéedone 70739d87c8cSAlex Bennée 7083c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 7093c4a4d0dSPeter Maydellif has clang; then 7103c4a4d0dSPeter Maydell objcc=clang 7113c4a4d0dSPeter Maydellelse 7123c4a4d0dSPeter Maydell objcc="$cc" 7133c4a4d0dSPeter Maydellfi 7143c4a4d0dSPeter Maydell 7153457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 7163457a3f8SJuan Quintela EXESUF=".exe" 71778e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 7185770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS" 71993b25869SJohn Snow write_c_skeleton; 720d17f305aSPaolo Bonzini prefix="/qemu" 72177433a5fSMarc-André Lureau qemu_suffix="" 722105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 7233457a3f8SJuan Quintelafi 7243457a3f8SJuan Quintela 725487fefdbSAnthony Liguoriwerror="" 72685aa5189Sbellard 72761d63097SPaolo Bonzini. $source_path/scripts/meson-buildoptions.sh 72861d63097SPaolo Bonzini 72961d63097SPaolo Bonzinimeson_options= 73061d63097SPaolo Bonzinimeson_option_parse() { 73161d63097SPaolo Bonzini meson_options="$meson_options $(_meson_option_parse "$@")" 73261d63097SPaolo Bonzini if test $? -eq 1; then 73361d63097SPaolo Bonzini echo "ERROR: unknown option $1" 73461d63097SPaolo Bonzini echo "Try '$0 --help' for more information" 73561d63097SPaolo Bonzini exit 1 73661d63097SPaolo Bonzini fi 73761d63097SPaolo Bonzini} 73861d63097SPaolo Bonzini 7397d13299dSbellardfor opt do 74089138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 7417d13299dSbellard case "$opt" in 7422efc3265Sbellard --help|-h) show_help=yes 7432efc3265Sbellard ;; 74499123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 74599123e13SMike Frysinger ;; 746b1a550a0Spbrook --prefix=*) prefix="$optarg" 7477d13299dSbellard ;; 748b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 74932ce6337Sbellard ;; 750ac0df51dSaliguori --cross-prefix=*) 7517d13299dSbellard ;; 752ac0df51dSaliguori --cc=*) 7537d13299dSbellard ;; 754b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 75583469015Sbellard ;; 75683f73fceSTomoki Sekiyama --cxx=*) 75783f73fceSTomoki Sekiyama ;; 758e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 759e007dbecSMichael S. Tsirkin ;; 7603c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 7613c4a4d0dSPeter Maydell ;; 762b1a550a0Spbrook --make=*) make="$optarg" 7637d13299dSbellard ;; 764b6daf4d3SPaolo Bonzini --install=*) 7656a882643Spbrook ;; 7660a01d76fSMarc-André Lureau --python=*) python="$optarg" ; explicit_python=yes 767c886edfbSBlue Swirl ;; 7682eb054c2SPeter Maydell --sphinx-build=*) sphinx_build="$optarg" 7692eb054c2SPeter Maydell ;; 770a5665051SPaolo Bonzini --skip-meson) skip_meson=yes 771a5665051SPaolo Bonzini ;; 772a5665051SPaolo Bonzini --meson=*) meson="$optarg" 773a5665051SPaolo Bonzini ;; 77448328880SPaolo Bonzini --ninja=*) ninja="$optarg" 77548328880SPaolo Bonzini ;; 776e2d8830eSBrad --smbd=*) smbd="$optarg" 777e2d8830eSBrad ;; 778e2a2ed06SJuan Quintela --extra-cflags=*) 7797d13299dSbellard ;; 78011cde1c8SBruno Dominguez --extra-cxxflags=*) 78111cde1c8SBruno Dominguez ;; 782e2a2ed06SJuan Quintela --extra-ldflags=*) 7837d13299dSbellard ;; 7845bc62e01SGerd Hoffmann --enable-debug-info) 7855bc62e01SGerd Hoffmann ;; 7865bc62e01SGerd Hoffmann --disable-debug-info) 7875bc62e01SGerd Hoffmann ;; 788d75402b5SAlex Bennée --cross-cc-*) 789d75402b5SAlex Bennée ;; 79017969268SFam Zheng --enable-modules) 79117969268SFam Zheng modules="yes" 79217969268SFam Zheng ;; 7933aa88b31SStefan Hajnoczi --disable-modules) 7943aa88b31SStefan Hajnoczi modules="no" 7953aa88b31SStefan Hajnoczi ;; 796bd83c861SChristian Ehrhardt --disable-module-upgrades) module_upgrades="no" 797bd83c861SChristian Ehrhardt ;; 798bd83c861SChristian Ehrhardt --enable-module-upgrades) module_upgrades="yes" 799bd83c861SChristian Ehrhardt ;; 8002ff6b91eSJuan Quintela --cpu=*) 8017d13299dSbellard ;; 802b1a550a0Spbrook --target-list=*) target_list="$optarg" 803447e133fSAlex Bennée if test "$target_list_exclude"; then 804447e133fSAlex Bennée error_exit "Can't mix --target-list with --target-list-exclude" 805447e133fSAlex Bennée fi 806447e133fSAlex Bennée ;; 807447e133fSAlex Bennée --target-list-exclude=*) target_list_exclude="$optarg" 808447e133fSAlex Bennée if test "$target_list"; then 809447e133fSAlex Bennée error_exit "Can't mix --target-list-exclude with --target-list" 810447e133fSAlex Bennée fi 811de83cd02Sbellard ;; 81274242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 8139410b56cSPrerna Saxena ;; 8147bc3ca7fSPaolo Bonzini --with-default-devices) default_devices="true" 815f3494749SPaolo Bonzini ;; 8167bc3ca7fSPaolo Bonzini --without-default-devices) default_devices="false" 817f3494749SPaolo Bonzini ;; 818d1d5e9eeSAlex Bennée --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option" 819d1d5e9eeSAlex Bennée ;; 820d1d5e9eeSAlex Bennée --with-devices-*) device_arch=${opt#--with-devices-}; 821d1d5e9eeSAlex Bennée device_arch=${device_arch%%=*} 822d1d5e9eeSAlex Bennée cf=$source_path/configs/devices/$device_arch-softmmu/$optarg.mak 823d1d5e9eeSAlex Bennée if test -f "$cf"; then 824d1d5e9eeSAlex Bennée device_archs="$device_archs $device_arch" 825d1d5e9eeSAlex Bennée eval "devices_${device_arch}=\$optarg" 826d1d5e9eeSAlex Bennée else 827d1d5e9eeSAlex Bennée error_exit "File $cf does not exist" 828d1d5e9eeSAlex Bennée fi 829d1d5e9eeSAlex Bennée ;; 830c87ea116SAlex Bennée --without-default-features) # processed above 831c87ea116SAlex Bennée ;; 8327d13299dSbellard --enable-gprof) gprof="yes" 8337d13299dSbellard ;; 8341d728c39SBlue Swirl --enable-gcov) gcov="yes" 8351d728c39SBlue Swirl ;; 83679427693SLoïc Minier --static) 83779427693SLoïc Minier static="yes" 83817884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 83943ce4dfeSbellard ;; 8400b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 8410b24e75fSPaolo Bonzini ;; 8420b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 8430b24e75fSPaolo Bonzini ;; 8443aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 8453aa5d2beSAlon Levy ;; 8468bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 8478bf188aaSMichael Tokarev ;; 8480f94d6daSAlon Levy --includedir=*) includedir="$optarg" 8490f94d6daSAlon Levy ;; 850528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 8510b24e75fSPaolo Bonzini ;; 85277433a5fSMarc-André Lureau --with-suffix=*) qemu_suffix="$optarg" 853023d3d67SEduardo Habkost ;; 854c6502638SBruce Rogers --docdir=*) docdir="$optarg" 8550b24e75fSPaolo Bonzini ;; 856fe0038beSPaolo Bonzini --localedir=*) localedir="$optarg" 857fe0038beSPaolo Bonzini ;; 858ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 85907381cc1SAnthony Liguori ;; 860785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 861785c23aeSLuiz Capitulino ;; 8623d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 8633d5eecabSGerd Hoffmann ;; 864181ce1d0SOlaf Hering --host=*|--build=*|\ 865181ce1d0SOlaf Hering --disable-dependency-tracking|\ 866785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 867fe0038beSPaolo Bonzini --oldincludedir=*|--datarootdir=*|--infodir=*|\ 868023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 869023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 870023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 871023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 872023ddd74SMax Filippov # lots of directory switches by default. 873023ddd74SMax Filippov ;; 8743556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 8753556c233SPaolo Bonzini ;; 8763556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 8773556c233SPaolo Bonzini ;; 8780c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 8790c58ac1cSmalc ;; 88089138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 881b64ec4e4SFam Zheng ;; 88289138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 883eb852011SMarkus Armbruster ;; 884e5f05f8cSKevin Wolf --enable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="yes" 885e5f05f8cSKevin Wolf ;; 886e5f05f8cSKevin Wolf --disable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="no" 887e5f05f8cSKevin Wolf ;; 888f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 889f8393946Saurel32 ;; 890f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 891f8393946Saurel32 ;; 892f3d08ee6SPaul Brook --enable-debug) 893f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 894f3d08ee6SPaul Brook debug_tcg="yes" 8951fcc6d42SPeter Xu debug_mutex="yes" 896f3d08ee6SPaul Brook debug="yes" 897f3d08ee6SPaul Brook strip_opt="no" 898b553a042SJohn Snow fortify_source="no" 899f3d08ee6SPaul Brook ;; 900247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 901247724cbSMarc-André Lureau ;; 902247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 903247724cbSMarc-André Lureau ;; 9040aebab04SLingfeng Yang --enable-tsan) tsan="yes" 9050aebab04SLingfeng Yang ;; 9060aebab04SLingfeng Yang --disable-tsan) tsan="no" 9070aebab04SLingfeng Yang ;; 9081625af87Saliguori --disable-strip) strip_opt="no" 9091625af87Saliguori ;; 9104d34a86bSPaolo Bonzini --disable-slirp) slirp="disabled" 911c20709aaSbellard ;; 912fd6fc214SPaolo Bonzini --enable-slirp) slirp="enabled" 913fd6fc214SPaolo Bonzini ;; 9144d34a86bSPaolo Bonzini --enable-slirp=git) slirp="internal" 9157c57bdd8SMarc-André Lureau ;; 91603a3c0b3SPaolo Bonzini --enable-slirp=*) slirp="$optarg" 917675b9b53SMarc-André Lureau ;; 9181badb709SPaolo Bonzini --disable-xen) xen="disabled" 919e37630caSaliguori ;; 9201badb709SPaolo Bonzini --enable-xen) xen="enabled" 921fc321b4bSJuan Quintela ;; 9221badb709SPaolo Bonzini --disable-tcg) tcg="disabled" 923d1a14257SAlex Bennée plugins="no" 924b3f6ea7eSPaolo Bonzini ;; 9251badb709SPaolo Bonzini --enable-tcg) tcg="enabled" 926b3f6ea7eSPaolo Bonzini ;; 92705c2a3e7Sbellard --enable-profiler) profiler="yes" 92805c2a3e7Sbellard ;; 929cad25d69Spbrook --disable-system) softmmu="no" 9300a8e90f4Spbrook ;; 931cad25d69Spbrook --enable-system) softmmu="yes" 9320a8e90f4Spbrook ;; 9330953a80fSZachary Amsden --disable-user) 9340953a80fSZachary Amsden linux_user="no" ; 9350953a80fSZachary Amsden bsd_user="no" ; 9360953a80fSZachary Amsden ;; 9370953a80fSZachary Amsden --enable-user) ;; 938831b7825Sths --disable-linux-user) linux_user="no" 9390a8e90f4Spbrook ;; 940831b7825Sths --enable-linux-user) linux_user="yes" 941831b7825Sths ;; 94284778508Sblueswir1 --disable-bsd-user) bsd_user="no" 94384778508Sblueswir1 ;; 94484778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 94584778508Sblueswir1 ;; 94640d6444eSAvi Kivity --enable-pie) pie="yes" 94734005a00SKirill A. Shutemov ;; 94840d6444eSAvi Kivity --disable-pie) pie="no" 94934005a00SKirill A. Shutemov ;; 95085aa5189Sbellard --enable-werror) werror="yes" 95185aa5189Sbellard ;; 95285aa5189Sbellard --disable-werror) werror="no" 95385aa5189Sbellard ;; 954cdad781dSDaniele Buono --enable-lto) lto="true" 955cdad781dSDaniele Buono ;; 956cdad781dSDaniele Buono --disable-lto) lto="false" 957cdad781dSDaniele Buono ;; 95863678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 95963678e17SSteven Noonan ;; 96063678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 96163678e17SSteven Noonan ;; 9621e4f6065SDaniele Buono --enable-safe-stack) safe_stack="yes" 9631e4f6065SDaniele Buono ;; 9641e4f6065SDaniele Buono --disable-safe-stack) safe_stack="no" 9651e4f6065SDaniele Buono ;; 9669e62ba48SDaniele Buono --enable-cfi) 9679e62ba48SDaniele Buono cfi="true"; 9689e62ba48SDaniele Buono lto="true"; 9699e62ba48SDaniele Buono ;; 9709e62ba48SDaniele Buono --disable-cfi) cfi="false" 9719e62ba48SDaniele Buono ;; 972fbb4121dSPaolo Bonzini --disable-fdt) fdt="disabled" 9732df87df7SJuan Quintela ;; 974fbb4121dSPaolo Bonzini --enable-fdt) fdt="enabled" 975fbb4121dSPaolo Bonzini ;; 976fbb4121dSPaolo Bonzini --enable-fdt=git) fdt="internal" 977fbb4121dSPaolo Bonzini ;; 97803a3c0b3SPaolo Bonzini --enable-fdt=*) fdt="$optarg" 9792df87df7SJuan Quintela ;; 980a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 981a40161cbSPaolo Bonzini ;; 982a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 983a40161cbSPaolo Bonzini ;; 9847e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 9854a19f1ecSpbrook ;; 986519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 987519175a2SAlex Barcelo ;; 98870c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 98970c60c08SStefan Hajnoczi ;; 99070c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 99170c60c08SStefan Hajnoczi ;; 9927d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 9937d992e4dSPeter Lieven ;; 994f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 995f0d92b56SLongpeng(Mike) ;; 996f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 997f0d92b56SLongpeng(Mike) ;; 998d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 999d5970055SMichael S. Tsirkin ;; 1000d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1001d5970055SMichael S. Tsirkin ;; 1002042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1003042cea27SGonglei ;; 1004299e6f19SPaolo Bonzini --enable-vhost-crypto) vhost_crypto="yes" 1005042cea27SGonglei ;; 10065e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 10075e9be92dSNicholas Bellinger ;; 10085e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 10095e9be92dSNicholas Bellinger ;; 1010fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1011fc0b9b0eSStefan Hajnoczi ;; 1012fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1013fc0b9b0eSStefan Hajnoczi ;; 101498fc1adaSDr. David Alan Gilbert --disable-vhost-user-fs) vhost_user_fs="no" 101598fc1adaSDr. David Alan Gilbert ;; 101698fc1adaSDr. David Alan Gilbert --enable-vhost-user-fs) vhost_user_fs="yes" 101798fc1adaSDr. David Alan Gilbert ;; 1018da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 101920ff075bSMichael Walle ;; 1020da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 102120ff075bSMichael Walle ;; 10228c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 10238c84cf11SSergei Trofimovich ;; 10248c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 10258c84cf11SSergei Trofimovich ;; 10261ffb3bbbSPaolo Bonzini --disable-zlib-test) 10271ece9905SAlon Levy ;; 1028d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1029d138cee9SMichael Roth ;; 1030d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1031d138cee9SMichael Roth ;; 1032d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1033d9840e25STomoki Sekiyama ;; 1034d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1035d9840e25STomoki Sekiyama ;; 1036d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1037d9840e25STomoki Sekiyama ;; 1038d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1039d9840e25STomoki Sekiyama ;; 1040d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1041d9840e25STomoki Sekiyama ;; 1042d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1043d9840e25STomoki Sekiyama ;; 10444b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 10454b1c11fdSDaniel P. Berrange ;; 10464b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 10474b1c11fdSDaniel P. Berrange ;; 104886583a07SLiam Merwick --disable-avx2) avx2_opt="no" 104986583a07SLiam Merwick ;; 105086583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 105186583a07SLiam Merwick ;; 10526b8cd447SRobert Hoo --disable-avx512f) avx512f_opt="no" 10536b8cd447SRobert Hoo ;; 10546b8cd447SRobert Hoo --enable-avx512f) avx512f_opt="yes" 10556b8cd447SRobert Hoo ;; 105652b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 105752b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1058583f6e7bSStefan Hajnoczi ;; 1059cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1060cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1061cb6414dfSFam Zheng ;; 1062315d3184SFam Zheng --enable-uuid|--disable-uuid) 1063315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1064315d3184SFam Zheng ;; 1065a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1066a1c5e949SDaniel P. Berrange ;; 10672da776dbSMichael R. Hines --enable-rdma) rdma="yes" 10682da776dbSMichael R. Hines ;; 10692da776dbSMichael R. Hines --disable-rdma) rdma="no" 10702da776dbSMichael R. Hines ;; 107121ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 107221ab34c9SMarcel Apfelbaum ;; 107321ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 107421ab34c9SMarcel Apfelbaum ;; 1075e91c793cSCole Robinson --disable-tpm) tpm="no" 1076e91c793cSCole Robinson ;; 1077ab214c29SStefan Berger --enable-tpm) tpm="yes" 1078ab214c29SStefan Berger ;; 1079b10d49d7SPino Toscano --disable-libssh) libssh="no" 10800a12ec87SRichard W.M. Jones ;; 1081b10d49d7SPino Toscano --enable-libssh) libssh="yes" 10820a12ec87SRichard W.M. Jones ;; 1083ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1084ed1701c6SDr. David Alan Gilbert ;; 1085ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1086ed1701c6SDr. David Alan Gilbert ;; 1087a99d57bbSWanlong Gao --disable-numa) numa="no" 1088a99d57bbSWanlong Gao ;; 1089a99d57bbSWanlong Gao --enable-numa) numa="yes" 1090a99d57bbSWanlong Gao ;; 1091a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1092a6b1d4c0SChanglong Xie ;; 1093a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1094a6b1d4c0SChanglong Xie ;; 10952f740136SJeff Cody --disable-bochs) bochs="no" 10962f740136SJeff Cody ;; 10972f740136SJeff Cody --enable-bochs) bochs="yes" 10982f740136SJeff Cody ;; 10992f740136SJeff Cody --disable-cloop) cloop="no" 11002f740136SJeff Cody ;; 11012f740136SJeff Cody --enable-cloop) cloop="yes" 11022f740136SJeff Cody ;; 11032f740136SJeff Cody --disable-dmg) dmg="no" 11042f740136SJeff Cody ;; 11052f740136SJeff Cody --enable-dmg) dmg="yes" 11062f740136SJeff Cody ;; 11072f740136SJeff Cody --disable-qcow1) qcow1="no" 11082f740136SJeff Cody ;; 11092f740136SJeff Cody --enable-qcow1) qcow1="yes" 11102f740136SJeff Cody ;; 11112f740136SJeff Cody --disable-vdi) vdi="no" 11122f740136SJeff Cody ;; 11132f740136SJeff Cody --enable-vdi) vdi="yes" 11142f740136SJeff Cody ;; 11152f740136SJeff Cody --disable-vvfat) vvfat="no" 11162f740136SJeff Cody ;; 11172f740136SJeff Cody --enable-vvfat) vvfat="yes" 11182f740136SJeff Cody ;; 11192f740136SJeff Cody --disable-qed) qed="no" 11202f740136SJeff Cody ;; 11212f740136SJeff Cody --enable-qed) qed="yes" 11222f740136SJeff Cody ;; 11232f740136SJeff Cody --disable-parallels) parallels="no" 11242f740136SJeff Cody ;; 11252f740136SJeff Cody --enable-parallels) parallels="yes" 11262f740136SJeff Cody ;; 1127e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1128e6a74868SMarc-André Lureau ;; 1129299e6f19SPaolo Bonzini --enable-vhost-user) vhost_user="yes" 1130299e6f19SPaolo Bonzini ;; 1131108a6481SCindy Lu --disable-vhost-vdpa) vhost_vdpa="no" 1132108a6481SCindy Lu ;; 1133108a6481SCindy Lu --enable-vhost-vdpa) vhost_vdpa="yes" 1134108a6481SCindy Lu ;; 1135299e6f19SPaolo Bonzini --disable-vhost-kernel) vhost_kernel="no" 1136299e6f19SPaolo Bonzini ;; 1137299e6f19SPaolo Bonzini --enable-vhost-kernel) vhost_kernel="yes" 1138e6a74868SMarc-André Lureau ;; 11398b18cdbfSRichard Henderson --disable-capstone) capstone="disabled" 11408ca80760SRichard Henderson ;; 11418b18cdbfSRichard Henderson --enable-capstone) capstone="enabled" 11428ca80760SRichard Henderson ;; 11438b18cdbfSRichard Henderson --enable-capstone=git) capstone="internal" 1144e219c499SRichard Henderson ;; 114503a3c0b3SPaolo Bonzini --enable-capstone=*) capstone="$optarg" 1146e219c499SRichard Henderson ;; 1147cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1148cc84d63aSDaniel P. Berrange ;; 11497d7dbf9dSDan Streetman --with-git-submodules=*) 11507d7dbf9dSDan Streetman git_submodules_action="$optarg" 1151f62bbee5SDaniel P. Berrange ;; 1152ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1153ba59fb77SPaolo Bonzini ;; 1154ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1155ba59fb77SPaolo Bonzini ;; 11569b8e4298SAlex Bennée --enable-plugins) if test "$mingw32" = "yes"; then 11579b8e4298SAlex Bennée error_exit "TCG plugins not currently supported on Windows platforms" 11589b8e4298SAlex Bennée else 11599b8e4298SAlex Bennée plugins="yes" 11609b8e4298SAlex Bennée fi 116140e8c6f4SAlex Bennée ;; 116240e8c6f4SAlex Bennée --disable-plugins) plugins="no" 116340e8c6f4SAlex Bennée ;; 1164afc3a8f9SAlex Bennée --enable-containers) use_containers="yes" 1165afc3a8f9SAlex Bennée ;; 1166afc3a8f9SAlex Bennée --disable-containers) use_containers="no" 1167afc3a8f9SAlex Bennée ;; 1168f48e590aSAlex Bennée --gdb=*) gdb_bin="$optarg" 1169f48e590aSAlex Bennée ;; 1170b767d257SMarek Marczykowski-Górecki --enable-rng-none) rng_none=yes 1171b767d257SMarek Marczykowski-Górecki ;; 1172b767d257SMarek Marczykowski-Górecki --disable-rng-none) rng_none=no 1173b767d257SMarek Marczykowski-Górecki ;; 117454e7aac0SAlexey Krasikov --enable-keyring) secret_keyring="yes" 117554e7aac0SAlexey Krasikov ;; 117654e7aac0SAlexey Krasikov --disable-keyring) secret_keyring="no" 117754e7aac0SAlexey Krasikov ;; 117820cf7b8eSDenis Plotnikov --enable-gio) gio=yes 117920cf7b8eSDenis Plotnikov ;; 118020cf7b8eSDenis Plotnikov --disable-gio) gio=no 118120cf7b8eSDenis Plotnikov ;; 1182b8e0c493SJoelle van Dyne --enable-slirp-smbd) slirp_smbd=yes 1183b8e0c493SJoelle van Dyne ;; 1184b8e0c493SJoelle van Dyne --disable-slirp-smbd) slirp_smbd=no 1185b8e0c493SJoelle van Dyne ;; 1186*3b4da132SPaolo Bonzini # backwards compatibility options 1187*3b4da132SPaolo Bonzini --enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg" 1188*3b4da132SPaolo Bonzini ;; 1189*3b4da132SPaolo Bonzini --disable-blobs) meson_option_parse --disable-install-blobs "" 1190*3b4da132SPaolo Bonzini ;; 1191*3b4da132SPaolo Bonzini --enable-tcmalloc) meson_option_parse --enable-malloc=tcmalloc tcmalloc 1192*3b4da132SPaolo Bonzini ;; 1193*3b4da132SPaolo Bonzini --enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc 1194*3b4da132SPaolo Bonzini ;; 1195*3b4da132SPaolo Bonzini # everything else has the same name in configure and meson 119661d63097SPaolo Bonzini --enable-* | --disable-*) meson_option_parse "$opt" "$optarg" 119761d63097SPaolo Bonzini ;; 11982d2ad6d0SFam Zheng *) 11992d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 12002d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 12012d2ad6d0SFam Zheng exit 1 12027f1559c6Sbalrog ;; 12037d13299dSbellard esac 12047d13299dSbellarddone 12057d13299dSbellard 1206d1a14257SAlex Bennée# test for any invalid configuration combinations 1207d1a14257SAlex Bennéeif test "$plugins" = "yes" -a "$tcg" = "disabled"; then 1208d1a14257SAlex Bennée error_exit "Can't enable plugins on non-TCG builds" 1209d1a14257SAlex Bennéefi 1210d1a14257SAlex Bennée 12117d7dbf9dSDan Streetmancase $git_submodules_action in 12127d7dbf9dSDan Streetman update|validate) 12137d7dbf9dSDan Streetman if test ! -e "$source_path/.git"; then 12147d7dbf9dSDan Streetman echo "ERROR: cannot $git_submodules_action git submodules without .git" 12157d7dbf9dSDan Streetman exit 1 12167d7dbf9dSDan Streetman fi 12177d7dbf9dSDan Streetman ;; 12187d7dbf9dSDan Streetman ignore) 1219b80fd281SPaolo Bonzini if ! test -f "$source_path/ui/keycodemapdb/README" 1220b80fd281SPaolo Bonzini then 1221b80fd281SPaolo Bonzini echo 1222b80fd281SPaolo Bonzini echo "ERROR: missing GIT submodules" 1223b80fd281SPaolo Bonzini echo 1224b80fd281SPaolo Bonzini if test -e "$source_path/.git"; then 1225b80fd281SPaolo Bonzini echo "--with-git-submodules=ignore specified but submodules were not" 1226b80fd281SPaolo Bonzini echo "checked out. Please initialize and update submodules." 1227b80fd281SPaolo Bonzini else 1228b80fd281SPaolo Bonzini echo "This is not a GIT checkout but module content appears to" 1229b80fd281SPaolo Bonzini echo "be missing. Do not use 'git archive' or GitHub download links" 1230b80fd281SPaolo Bonzini echo "to acquire QEMU source archives. Non-GIT builds are only" 1231b80fd281SPaolo Bonzini echo "supported with source archives linked from:" 1232b80fd281SPaolo Bonzini echo 1233b80fd281SPaolo Bonzini echo " https://www.qemu.org/download/#source" 1234b80fd281SPaolo Bonzini echo 1235b80fd281SPaolo Bonzini echo "Developers working with GIT can use scripts/archive-source.sh" 1236b80fd281SPaolo Bonzini echo "if they need to create valid source archives." 1237b80fd281SPaolo Bonzini fi 1238b80fd281SPaolo Bonzini echo 1239b80fd281SPaolo Bonzini exit 1 1240b80fd281SPaolo Bonzini fi 12417d7dbf9dSDan Streetman ;; 12427d7dbf9dSDan Streetman *) 12437d7dbf9dSDan Streetman echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'" 12447d7dbf9dSDan Streetman exit 1 12457d7dbf9dSDan Streetman ;; 12467d7dbf9dSDan Streetmanesac 12477d7dbf9dSDan Streetman 124822a87800SMarc-André Lureaulibdir="${libdir:-$prefix/lib}" 124922a87800SMarc-André Lureaulibexecdir="${libexecdir:-$prefix/libexec}" 125022a87800SMarc-André Lureauincludedir="${includedir:-$prefix/include}" 125122a87800SMarc-André Lureau 125222a87800SMarc-André Lureauif test "$mingw32" = "yes" ; then 125315588a62SJoshua Watt bindir="${bindir:-$prefix}" 125422a87800SMarc-André Lureauelse 125515588a62SJoshua Watt bindir="${bindir:-$prefix/bin}" 125615588a62SJoshua Wattfi 125722a87800SMarc-André Lureaumandir="${mandir:-$prefix/share/man}" 125822a87800SMarc-André Lureaudatadir="${datadir:-$prefix/share}" 1259ca8c0909SMarc-André Lureaudocdir="${docdir:-$prefix/share/doc}" 126022a87800SMarc-André Lureausysconfdir="${sysconfdir:-$prefix/etc}" 126122a87800SMarc-André Lureaulocal_statedir="${local_statedir:-$prefix/var}" 126216bf7a33SPaolo Bonzinifirmwarepath="${firmwarepath:-$datadir/qemu-firmware}" 126316bf7a33SPaolo Bonzinilocaledir="${localedir:-$datadir/locale}" 126422a87800SMarc-André Lureau 126540293e58Sbellardcase "$cpu" in 1266e3608d66SRichard Henderson ppc) 1267e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1268db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1269e3608d66SRichard Henderson ;; 1270e3608d66SRichard Henderson ppc64) 1271e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1272db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1273e3608d66SRichard Henderson ;; 12749b9c37c3SRichard Henderson sparc) 1275f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1276db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 12773142255cSblueswir1 ;; 1278ed968ff1SJuan Quintela sparc64) 127979f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1280db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 12813142255cSblueswir1 ;; 128276d83bdeSths s390) 1283061cdd81SRichard Henderson CPU_CFLAGS="-m31" 1284db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 128528d7cc49SRichard Henderson ;; 128628d7cc49SRichard Henderson s390x) 1287061cdd81SRichard Henderson CPU_CFLAGS="-m64" 1288db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 128976d83bdeSths ;; 129040293e58Sbellard i386) 129179f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 1292db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 129340293e58Sbellard ;; 129440293e58Sbellard x86_64) 12957ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 12967ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 12977ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 12987ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 1299db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1300379f6698SPaul Brook ;; 1301c72b26ecSRichard Henderson x32) 1302c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1303db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1304c72b26ecSRichard Henderson ;; 130530163d89SPeter Maydell # No special flags required for other host CPUs 13063142255cSblueswir1esac 13073142255cSblueswir1 13089557af9cSAlex Bennéeif eval test -z "\${cross_cc_$cpu}"; then 1309b1aa4de1SAlex Bennée eval "cross_cc_${cpu}=\$cc" 13102038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 13119557af9cSAlex Bennéefi 131279f3b12fSPeter Crosthwaite 1313affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1314affc88ccSPeter Maydell# support, even if we're using TCI. 1315affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1316affc88ccSPeter Maydell bsd_user="no" 1317affc88ccSPeter Maydell linux_user="no" 1318affc88ccSPeter Maydellfi 1319affc88ccSPeter Maydell 132060e0df25SPeter Maydelldefault_target_list="" 132143692239SMarkus Armbrusterdeprecated_targets_list=ppc64abi32-linux-user 1322fdb75aefSPaolo Bonzinideprecated_features="" 13236e92f823SPeter Maydellmak_wilds="" 13246e92f823SPeter Maydell 132560e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 1326812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak" 132760e0df25SPeter Maydellfi 132860e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 1329812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-linux-user.mak" 133060e0df25SPeter Maydellfi 133160e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 1332812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak" 133360e0df25SPeter Maydellfi 133460e0df25SPeter Maydell 13353a5ae4a9SAlex Bennée# If the user doesn't explicitly specify a deprecated target we will 13363a5ae4a9SAlex Bennée# skip it. 13373a5ae4a9SAlex Bennéeif test -z "$target_list"; then 13383a5ae4a9SAlex Bennée if test -z "$target_list_exclude"; then 13393a5ae4a9SAlex Bennée target_list_exclude="$deprecated_targets_list" 13403a5ae4a9SAlex Bennée else 13413a5ae4a9SAlex Bennée target_list_exclude="$target_list_exclude,$deprecated_targets_list" 13423a5ae4a9SAlex Bennée fi 13432d838d9bSAlex Bennéefi 13442d838d9bSAlex Bennée 1345447e133fSAlex Bennéefor config in $mak_wilds; do 1346447e133fSAlex Bennée target="$(basename "$config" .mak)" 134798db9a06SAlex Bennée if echo "$target_list_exclude" | grep -vq "$target"; then 1348447e133fSAlex Bennée default_target_list="${default_target_list} $target" 1349447e133fSAlex Bennée fi 1350447e133fSAlex Bennéedone 13516e92f823SPeter Maydell 1352af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1353af5db58eSpbrookcat << EOF 1354af5db58eSpbrook 1355af5db58eSpbrookUsage: configure [options] 1356af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1357af5db58eSpbrook 135808fb77edSStefan WeilStandard options: 135908fb77edSStefan Weil --help print this message 136008fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 136108fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 136208fb77edSStefan Weil use %M for cpu name [$interp_prefix] 13632deca810SAlex Bennée --target-list=LIST set target list (default: build all non-deprecated) 136408fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 136508fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 13662deca810SAlex Bennée$(echo Deprecated targets: $deprecated_targets_list | \ 13672deca810SAlex Bennée fold -s -w 53 | sed -e 's/^/ /') 1368447e133fSAlex Bennée --target-list-exclude=LIST exclude a set of targets from the default target-list 136908fb77edSStefan Weil 137008fb77edSStefan WeilAdvanced options (experts only): 13713812c0c4SJoelle van Dyne --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] 137208fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 137308fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 137408fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 137508fb77edSStefan Weil build time 137608fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 137708fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 137808fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 137911cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 138008fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1381d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1382d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 138308fb77edSStefan Weil --make=MAKE use specified make [$make] 138408fb77edSStefan Weil --python=PYTHON use specified python [$python] 13852eb054c2SPeter Maydell --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1386a5665051SPaolo Bonzini --meson=MESON use specified meson [$meson] 138748328880SPaolo Bonzini --ninja=NINJA use specified ninja [$ninja] 138808fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1389db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 13907d7dbf9dSDan Streetman --with-git-submodules=update update git submodules (default if .git dir exists) 13917d7dbf9dSDan Streetman --with-git-submodules=validate fail if git submodules are not up to date 13927d7dbf9dSDan Streetman --with-git-submodules=ignore do not update or check git submodules (default if no .git dir) 139308fb77edSStefan Weil --static enable static build [$static] 139408fb77edSStefan Weil --mandir=PATH install man pages in PATH 139510ff82d1SMarc-André Lureau --datadir=PATH install firmware in PATH/$qemu_suffix 1396fe0038beSPaolo Bonzini --localedir=PATH install translation in PATH/$qemu_suffix 139710ff82d1SMarc-André Lureau --docdir=PATH install documentation in PATH/$qemu_suffix 139808fb77edSStefan Weil --bindir=PATH install binaries in PATH 139908fb77edSStefan Weil --libdir=PATH install libraries in PATH 1400db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 140110ff82d1SMarc-André Lureau --sysconfdir=PATH install config in PATH/$qemu_suffix 140208fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 14033d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 140413336606SRobert Foley --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1405ca8c0909SMarc-André Lureau --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1406db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 1407c035c8d6SPaolo Bonzini --without-default-features default all --enable-* options to "disabled" 1408c035c8d6SPaolo Bonzini --without-default-devices do not include any device that is not needed to 1409c035c8d6SPaolo Bonzini start the emulator (only use if you are including 1410d1d5e9eeSAlex Bennée desired devices in configs/devices/) 1411d1d5e9eeSAlex Bennée --with-devices-ARCH=NAME override default configs/devices 141208fb77edSStefan Weil --enable-debug enable common debug build options 1413247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 14140aebab04SLingfeng Yang --enable-tsan enable thread sanitizer 141508fb77edSStefan Weil --disable-strip disable stripping binaries 141608fb77edSStefan Weil --disable-werror disable compilation abort on warning 141763678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 141887430d5bSPaolo Bonzini --audio-drv-list=LIST set audio drivers list 141908fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 142008fb77edSStefan Weil --block-drv-rw-whitelist=L 142108fb77edSStefan Weil set block driver read-write whitelist 1422e5f05f8cSKevin Wolf (by default affects only QEMU, not tools like qemu-img) 142308fb77edSStefan Weil --block-drv-ro-whitelist=L 142408fb77edSStefan Weil set block driver read-only whitelist 1425e5f05f8cSKevin Wolf (by default affects only QEMU, not tools like qemu-img) 1426e5f05f8cSKevin Wolf --enable-block-drv-whitelist-in-tools 1427e5f05f8cSKevin Wolf use block whitelist also in tools instead of only QEMU 142808fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 142908fb77edSStefan Weil Default:trace-<pid> 1430c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 143108fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 143233c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 143308fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 1434c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1435c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1436a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1437c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1438c12d66aaSLin Ma --enable-profiler profiler support 1439c12d66aaSLin Ma --enable-debug-stack-usage 1440c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 144140e8c6f4SAlex Bennée --enable-plugins 144240e8c6f4SAlex Bennée enable plugins via shared library loading 1443afc3a8f9SAlex Bennée --disable-containers don't use containers for cross-building 1444f48e590aSAlex Bennée --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 144561d63097SPaolo BonziniEOF 144661d63097SPaolo Bonzini meson_options_help 144761d63097SPaolo Bonzinicat << EOF 1448c23f23b9SMichael Tokarev system all system emulation targets 1449c23f23b9SMichael Tokarev user supported user emulation targets 1450c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1451c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1452c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1453c23f23b9SMichael Tokarev pie Position Independent Executables 145421e709aaSMarc-André Lureau modules modules support (non-Windows) 1455bd83c861SChristian Ehrhardt module-upgrades try to load modules from alternate paths for upgrades 1456c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1457c23f23b9SMichael Tokarev debug-info debugging information 1458cdad781dSDaniele Buono lto Enable Link-Time Optimization. 14591e4f6065SDaniele Buono safe-stack SafeStack Stack Smash Protection. Depends on 14601e4f6065SDaniele Buono clang/llvm >= 3.7 and requires coroutine backend ucontext. 1461a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 146221ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 146321ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1464299e6f19SPaolo Bonzini vhost-net vhost-net kernel acceleration support 1465299e6f19SPaolo Bonzini vhost-vsock virtio sockets device support 1466299e6f19SPaolo Bonzini vhost-scsi vhost-scsi kernel target support 1467299e6f19SPaolo Bonzini vhost-crypto vhost-user-crypto backend support 1468299e6f19SPaolo Bonzini vhost-kernel vhost kernel backend support 1469299e6f19SPaolo Bonzini vhost-user vhost-user backend support 1470108a6481SCindy Lu vhost-vdpa vhost-vdpa kernel backend support 1471ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1472c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1473c23f23b9SMichael Tokarev tpm TPM support 1474b10d49d7SPino Toscano libssh ssh block device support 1475c23f23b9SMichael Tokarev numa libnuma support 147686583a07SLiam Merwick avx2 AVX2 optimization support 14776b8cd447SRobert Hoo avx512f AVX512F optimization support 1478a6b1d4c0SChanglong Xie replication replication support 1479c12d66aaSLin Ma opengl opengl support 1480c12d66aaSLin Ma xfsctl xfsctl support 1481c12d66aaSLin Ma qom-cast-debug cast debugging support 14828de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 14832f740136SJeff Cody bochs bochs image format support 14842f740136SJeff Cody cloop cloop image format support 14852f740136SJeff Cody dmg dmg image format support 14862f740136SJeff Cody qcow1 qcow v1 image format support 14872f740136SJeff Cody vdi vdi image format support 14882f740136SJeff Cody vvfat vvfat image format support 14892f740136SJeff Cody qed qed image format support 14902f740136SJeff Cody parallels parallels image format support 1491f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 1492ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 1493b767d257SMarek Marczykowski-Górecki rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 149420cf7b8eSDenis Plotnikov gio libgio support 1495b8e0c493SJoelle van Dyne slirp-smbd use smbd (at path --smbd=*) in slirp networking 149608fb77edSStefan Weil 149708fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1498af5db58eSpbrookEOF 14992d2ad6d0SFam Zhengexit 0 1500af5db58eSpbrookfi 1501af5db58eSpbrook 15029c790242SThomas Huth# Remove old dependency files to make sure that they get properly regenerated 1503bb768f71SThomas Huthrm -f */config-devices.mak.d 15049c790242SThomas Huth 1505faf44142SDaniel P. Berrangéif test -z "$python" 1506faf44142SDaniel P. Berrangéthen 1507c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1508c53eeaf7SStefan Hajnoczifi 15098e2c76bdSRoman Bolshakovif ! has "$make" 15108e2c76bdSRoman Bolshakovthen 15118e2c76bdSRoman Bolshakov error_exit "GNU make ($make) not found" 15128e2c76bdSRoman Bolshakovfi 1513c53eeaf7SStefan Hajnoczi 1514c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1515c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 15161b11f28dSThomas Huthif ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then 15171b11f28dSThomas Huth error_exit "Cannot use '$python', Python >= 3.6 is required." \ 1518c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1519c53eeaf7SStefan Hajnoczifi 1520c53eeaf7SStefan Hajnoczi 1521755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 1522406ab2f3SCleber 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) 1523755ee70fSCleber Rosa 1524c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1525c53eeaf7SStefan Hajnoczipython="$python -B" 1526c53eeaf7SStefan Hajnoczi 15270a01d76fSMarc-André Lureauif test -z "$meson"; then 1528654d6b04SPaolo Bonzini if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.2; then 15290a01d76fSMarc-André Lureau meson=meson 15307d7dbf9dSDan Streetman elif test $git_submodules_action != 'ignore' ; then 15310a01d76fSMarc-André Lureau meson=git 15320a01d76fSMarc-André Lureau elif test -e "${source_path}/meson/meson.py" ; then 15330a01d76fSMarc-André Lureau meson=internal 15340a01d76fSMarc-André Lureau else 15350a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 15360a01d76fSMarc-André Lureau error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 15370a01d76fSMarc-André Lureau else 1538a5665051SPaolo Bonzini error_exit "Meson not found. Use --meson=/path/to/meson" 1539a5665051SPaolo Bonzini fi 15400a01d76fSMarc-André Lureau fi 15410a01d76fSMarc-André Lureauelse 15420a01d76fSMarc-André Lureau # Meson uses its own Python interpreter to invoke other Python scripts, 15430a01d76fSMarc-André Lureau # but the user wants to use the one they specified with --python. 15440a01d76fSMarc-André Lureau # 15450a01d76fSMarc-André Lureau # We do not want to override the distro Python interpreter (and sometimes 15460a01d76fSMarc-André Lureau # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 15470a01d76fSMarc-André Lureau # just require --meson=git|internal together with --python. 15480a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 15490a01d76fSMarc-André Lureau case "$meson" in 15500a01d76fSMarc-André Lureau git | internal) ;; 15510a01d76fSMarc-André Lureau *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 15520a01d76fSMarc-André Lureau esac 15530a01d76fSMarc-André Lureau fi 15540a01d76fSMarc-André Lureaufi 1555a5665051SPaolo Bonzini 15560a01d76fSMarc-André Lureauif test "$meson" = git; then 15570a01d76fSMarc-André Lureau git_submodules="${git_submodules} meson" 15580a01d76fSMarc-André Lureaufi 15590a01d76fSMarc-André Lureau 15600a01d76fSMarc-André Lureaucase "$meson" in 15610a01d76fSMarc-André Lureau git | internal) 15620a01d76fSMarc-André Lureau meson="$python ${source_path}/meson/meson.py" 15630a01d76fSMarc-André Lureau ;; 156484ec0c24SPaolo Bonzini *) meson=$(command -v "$meson") ;; 15650a01d76fSMarc-André Lureauesac 15660a01d76fSMarc-André Lureau 156709e93326SPaolo Bonzini# Probe for ninja 156848328880SPaolo Bonzini 156948328880SPaolo Bonziniif test -z "$ninja"; then 157048328880SPaolo Bonzini for c in ninja ninja-build samu; do 157148328880SPaolo Bonzini if has $c; then 157248328880SPaolo Bonzini ninja=$(command -v "$c") 157348328880SPaolo Bonzini break 157448328880SPaolo Bonzini fi 157548328880SPaolo Bonzini done 157609e93326SPaolo Bonzini if test -z "$ninja"; then 157709e93326SPaolo Bonzini error_exit "Cannot find Ninja" 157809e93326SPaolo Bonzini fi 157948328880SPaolo Bonzinifi 1580a5665051SPaolo Bonzini 15819aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 15829aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 15839aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 15849aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 15859aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 15869aae6e54SDaniel Henrique Barbozaif compile_object ; then 15879aae6e54SDaniel Henrique Barboza : C compiler works ok 15889aae6e54SDaniel Henrique Barbozaelse 15899aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 15909aae6e54SDaniel Henrique Barbozafi 15919aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 15929aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 15939aae6e54SDaniel Henrique Barbozafi 15949aae6e54SDaniel Henrique Barboza 15959c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 15969c83ffd8SPeter Maydell# by default. Only enable by default for git builds 15979c83ffd8SPeter Maydellif test -z "$werror" ; then 15987d7dbf9dSDan Streetman if test "$git_submodules_action" != "ignore" && \ 1599e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 16009c83ffd8SPeter Maydell werror="yes" 16019c83ffd8SPeter Maydell else 16029c83ffd8SPeter Maydell werror="no" 16039c83ffd8SPeter Maydell fi 16049c83ffd8SPeter Maydellfi 16059c83ffd8SPeter Maydell 1606975ff037SPaolo Bonziniif test "$targetos" = "bogus"; then 1607fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1608fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1609fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1610fb59dabdSPeter Maydell # host OS we should stop now. 1611951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1612fb59dabdSPeter Maydellfi 1613fb59dabdSPeter Maydell 1614efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 1615efc6c070SThomas Huthcat > $TMPC << EOF 1616efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 1617efc6c070SThomas Huth# ifdef __apple_build_version__ 16182a85a08cSDaniel P. Berrangé# if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0) 16192a85a08cSDaniel P. Berrangé# error You need at least XCode Clang v10.0 to compile QEMU 1620efc6c070SThomas Huth# endif 1621efc6c070SThomas Huth# else 16222a85a08cSDaniel P. Berrangé# if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0) 16232a85a08cSDaniel P. Berrangé# error You need at least Clang v6.0 to compile QEMU 1624efc6c070SThomas Huth# endif 1625efc6c070SThomas Huth# endif 1626efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 16273830df5fSnia# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) 16283830df5fSnia# error You need at least GCC v7.4.0 to compile QEMU 1629efc6c070SThomas Huth# endif 1630efc6c070SThomas Huth#else 1631efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 1632efc6c070SThomas Huth#endif 1633efc6c070SThomas Huthint main (void) { return 0; } 1634efc6c070SThomas HuthEOF 1635efc6c070SThomas Huthif ! compile_prog "" "" ; then 16363830df5fSnia error_exit "You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)" 1637efc6c070SThomas Huthfi 1638efc6c070SThomas Huth 163900849b92SRichard Henderson# Accumulate -Wfoo and -Wno-bar separately. 164000849b92SRichard Henderson# We will list all of the enable flags first, and the disable flags second. 164100849b92SRichard Henderson# Note that we do not add -Werror, because that would enable it for all 164200849b92SRichard Henderson# configure tests. If a configure test failed due to -Werror this would 164300849b92SRichard Henderson# just silently disable some features, so it's too error prone. 164400849b92SRichard Henderson 164500849b92SRichard Hendersonwarn_flags= 164600849b92SRichard Hendersonadd_to warn_flags -Wold-style-declaration 164700849b92SRichard Hendersonadd_to warn_flags -Wold-style-definition 164800849b92SRichard Hendersonadd_to warn_flags -Wtype-limits 164900849b92SRichard Hendersonadd_to warn_flags -Wformat-security 165000849b92SRichard Hendersonadd_to warn_flags -Wformat-y2k 165100849b92SRichard Hendersonadd_to warn_flags -Winit-self 165200849b92SRichard Hendersonadd_to warn_flags -Wignored-qualifiers 165300849b92SRichard Hendersonadd_to warn_flags -Wempty-body 165400849b92SRichard Hendersonadd_to warn_flags -Wnested-externs 165500849b92SRichard Hendersonadd_to warn_flags -Wendif-labels 165600849b92SRichard Hendersonadd_to warn_flags -Wexpansion-to-defined 16570a2ebce9SThomas Huthadd_to warn_flags -Wimplicit-fallthrough=2 165800849b92SRichard Henderson 165900849b92SRichard Hendersonnowarn_flags= 166000849b92SRichard Hendersonadd_to nowarn_flags -Wno-initializer-overrides 166100849b92SRichard Hendersonadd_to nowarn_flags -Wno-missing-include-dirs 166200849b92SRichard Hendersonadd_to nowarn_flags -Wno-shift-negative-value 166300849b92SRichard Hendersonadd_to nowarn_flags -Wno-string-plus-int 166400849b92SRichard Hendersonadd_to nowarn_flags -Wno-typedef-redefinition 1665aabab967SRichard Hendersonadd_to nowarn_flags -Wno-tautological-type-limit-compare 1666bac8d222SRichard Hendersonadd_to nowarn_flags -Wno-psabi 166700849b92SRichard Henderson 166800849b92SRichard Hendersongcc_flags="$warn_flags $nowarn_flags" 166993b25869SJohn Snow 167093b25869SJohn Snowcc_has_warning_flag() { 167193b25869SJohn Snow write_c_skeleton; 167293b25869SJohn Snow 1673a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1674a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1675a1d29d6cSPeter Maydell # warning options). 167693b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 167793b25869SJohn Snow compile_prog "-Werror $optflag" "" 167893b25869SJohn Snow} 167993b25869SJohn Snow 168093b25869SJohn Snowfor flag in $gcc_flags; do 168193b25869SJohn Snow if cc_has_warning_flag $flag ; then 16828d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 16838d05095cSPaolo Bonzini fi 16848d05095cSPaolo Bonzinidone 16858d05095cSPaolo Bonzini 168663678e17SSteven Noonanif test "$stack_protector" != "no"; then 1687fccd35a0SRodrigo Rebello cat > $TMPC << EOF 1688fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 1689fccd35a0SRodrigo Rebello{ 1690fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 1691fccd35a0SRodrigo Rebello while (*c) { 1692fccd35a0SRodrigo Rebello *p++ = *c++; 1693fccd35a0SRodrigo Rebello } 1694fccd35a0SRodrigo Rebello return 0; 1695fccd35a0SRodrigo Rebello} 1696fccd35a0SRodrigo RebelloEOF 169763678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 16983b463a3fSMiroslav Rezanina sp_on=0 169963678e17SSteven Noonan for flag in $gcc_flags; do 1700590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 1701590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 1702086d5f75SPaolo Bonzini if compile_object "-Werror $flag" && 1703590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 170463678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 1705db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 17063b463a3fSMiroslav Rezanina sp_on=1 170763678e17SSteven Noonan break 170863678e17SSteven Noonan fi 170963678e17SSteven Noonan done 17103b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 17113b463a3fSMiroslav Rezanina if test $sp_on = 0; then 17123b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 17133b463a3fSMiroslav Rezanina fi 17143b463a3fSMiroslav Rezanina fi 171537746c5eSMarc-André Lureaufi 171637746c5eSMarc-André Lureau 171720bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 171820bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 171920bc94a2SPaolo Bonzinicat > $TMPC << EOF 172020bc94a2SPaolo Bonzinistruct { 172120bc94a2SPaolo Bonzini int a[2]; 172220bc94a2SPaolo Bonzini} x = {0}; 172320bc94a2SPaolo BonziniEOF 172420bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 172520bc94a2SPaolo Bonzini : 172620bc94a2SPaolo Bonzinielse 172720bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 172820bc94a2SPaolo Bonzinifi 172920bc94a2SPaolo Bonzini 173021e709aaSMarc-André Lureau# Our module code doesn't support Windows 173121e709aaSMarc-André Lureauif test "$modules" = "yes" && test "$mingw32" = "yes" ; then 173221e709aaSMarc-André Lureau error_exit "Modules are not available for Windows" 173321e709aaSMarc-André Lureaufi 173421e709aaSMarc-André Lureau 1735bd83c861SChristian Ehrhardt# module_upgrades is only reasonable if modules are enabled 1736bd83c861SChristian Ehrhardtif test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 1737bd83c861SChristian Ehrhardt error_exit "Can't enable module-upgrades as Modules are not enabled" 1738bd83c861SChristian Ehrhardtfi 1739bd83c861SChristian Ehrhardt 17405f2453acSAlex Bennée# Static linking is not possible with plugins, modules or PIE 174140d6444eSAvi Kivityif test "$static" = "yes" ; then 1742aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1743aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1744aa0d1f44SPaolo Bonzini fi 17455f2453acSAlex Bennée if test "$plugins" = "yes"; then 17465f2453acSAlex Bennée error_exit "static and plugins are mutually incompatible" 1747ba4dd2aaSAlex Bennée else 1748ba4dd2aaSAlex Bennée plugins="no" 17495f2453acSAlex Bennée fi 175040d6444eSAvi Kivityfi 175140d6444eSAvi Kivity 1752768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 1753768b7855SEmilio G. Cota cat > $TMPC << EOF 1754768b7855SEmilio G. Cotastatic __thread int tls_var; 1755768b7855SEmilio G. Cotaint main(void) { return tls_var; } 1756768b7855SEmilio G. CotaEOF 1757768b7855SEmilio G. Cota 1758768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 1759768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 1760768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 1761768b7855SEmilio G. Cotafi 1762768b7855SEmilio G. Cota 176340d6444eSAvi Kivitycat > $TMPC << EOF 176421d4a791SAvi Kivity 176521d4a791SAvi Kivity#ifdef __linux__ 176621d4a791SAvi Kivity# define THREAD __thread 176721d4a791SAvi Kivity#else 176821d4a791SAvi Kivity# define THREAD 176921d4a791SAvi Kivity#endif 177021d4a791SAvi Kivitystatic THREAD int tls_var; 177121d4a791SAvi Kivityint main(void) { return tls_var; } 177240d6444eSAvi KivityEOF 1773b2634124SRichard Henderson 1774b2634124SRichard Henderson# Check we support --no-pie first; we will need this for building ROMs. 1775412aeacdSAlex Bennéeif compile_prog "-Werror -fno-pie" "-no-pie"; then 1776412aeacdSAlex Bennée CFLAGS_NOPIE="-fno-pie" 1777412aeacdSAlex Bennéefi 1778412aeacdSAlex Bennée 177912781462SRichard Hendersonif test "$static" = "yes"; then 1780eca7a8e6SRichard Henderson if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 17815770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 178212781462SRichard Henderson QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 178312781462SRichard Henderson pie="yes" 178412781462SRichard Henderson elif test "$pie" = "yes"; then 178512781462SRichard Henderson error_exit "-static-pie not available due to missing toolchain support" 178612781462SRichard Henderson else 178712781462SRichard Henderson QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 178812781462SRichard Henderson pie="no" 178912781462SRichard Henderson fi 179012781462SRichard Hendersonelif test "$pie" = "no"; then 17915770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" 1792eca7a8e6SRichard Hendersonelif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 17935770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 17945770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" 179540d6444eSAvi Kivity pie="yes" 17962c674109SRichard Hendersonelif test "$pie" = "yes"; then 179776ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 179840d6444eSAvi Kivityelse 179940d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 180040d6444eSAvi Kivity pie="no" 180140d6444eSAvi Kivityfi 180240d6444eSAvi Kivity 1803e6cbd751SRichard Henderson# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 1804e6cbd751SRichard Henderson# The combination is known as "full relro", because .got.plt is read-only too. 1805e6cbd751SRichard Hendersonif compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 1806e6cbd751SRichard Henderson QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 1807e6cbd751SRichard Hendersonfi 1808e6cbd751SRichard Henderson 180909dada40SPaolo Bonzini########################################## 181009dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 181109dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 181209dada40SPaolo Bonzini# specification is necessary 181309dada40SPaolo Bonzini 181409dada40SPaolo Bonziniif test "$cpu" = "i386"; then 181509dada40SPaolo Bonzini cat > $TMPC << EOF 181609dada40SPaolo Bonzinistatic int sfaa(int *ptr) 181709dada40SPaolo Bonzini{ 181809dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 181909dada40SPaolo Bonzini} 182009dada40SPaolo Bonzini 182109dada40SPaolo Bonziniint main(void) 182209dada40SPaolo Bonzini{ 182309dada40SPaolo Bonzini int val = 42; 18241405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 182509dada40SPaolo Bonzini sfaa(&val); 182609dada40SPaolo Bonzini return val; 182709dada40SPaolo Bonzini} 182809dada40SPaolo BonziniEOF 182909dada40SPaolo Bonzini if ! compile_prog "" "" ; then 183009dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 183109dada40SPaolo Bonzini fi 183209dada40SPaolo Bonzinifi 183309dada40SPaolo Bonzini 183456267b62SPhilippe Mathieu-Daudéif test "$tcg" = "enabled"; then 183556267b62SPhilippe Mathieu-Daudé git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 183656267b62SPhilippe Mathieu-Daudé git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 183756267b62SPhilippe Mathieu-Daudéfi 183856267b62SPhilippe Mathieu-Daudé 1839afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1840fdb75aefSPaolo Bonzini default_targets=yes 1841d880a3baSPaolo Bonzini for target in $default_target_list; do 1842d880a3baSPaolo Bonzini target_list="$target_list $target" 1843d880a3baSPaolo Bonzini done 1844d880a3baSPaolo Bonzini target_list="${target_list# }" 1845121afa9eSAnthony Liguorielse 1846fdb75aefSPaolo Bonzini default_targets=no 184789138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 1848d880a3baSPaolo Bonzini for target in $target_list; do 184925b48338SPeter Maydell # Check that we recognised the target name; this allows a more 185025b48338SPeter Maydell # friendly error message than if we let it fall through. 185125b48338SPeter Maydell case " $default_target_list " in 185225b48338SPeter Maydell *" $target "*) 185325b48338SPeter Maydell ;; 185425b48338SPeter Maydell *) 185525b48338SPeter Maydell error_exit "Unknown target name '$target'" 185625b48338SPeter Maydell ;; 185725b48338SPeter Maydell esac 185825b48338SPeter Maydell done 1859d880a3baSPaolo Bonzinifi 186025b48338SPeter Maydell 1861fdb75aefSPaolo Bonzinifor target in $target_list; do 1862fdb75aefSPaolo Bonzini # if a deprecated target is enabled we note it here 1863fdb75aefSPaolo Bonzini if echo "$deprecated_targets_list" | grep -q "$target"; then 1864fdb75aefSPaolo Bonzini add_to deprecated_features $target 1865fdb75aefSPaolo Bonzini fi 1866fdb75aefSPaolo Bonzinidone 1867fdb75aefSPaolo Bonzini 1868f55fe278SPaolo Bonzini# see if system emulation was really requested 1869f55fe278SPaolo Bonzinicase " $target_list " in 1870f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1871f55fe278SPaolo Bonzini ;; 1872f55fe278SPaolo Bonzini *) softmmu=no 1873f55fe278SPaolo Bonzini ;; 1874f55fe278SPaolo Bonziniesac 18755327cf48Sbellard 1876249247c9SJuan Quintelafeature_not_found() { 1877249247c9SJuan Quintela feature=$1 187821684af0SStewart Smith remedy=$2 1879249247c9SJuan Quintela 188076ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 188121684af0SStewart Smith "configure was not able to find it." \ 188221684af0SStewart Smith "$remedy" 1883249247c9SJuan Quintela} 1884249247c9SJuan Quintela 18857d13299dSbellard# --- 18867d13299dSbellard# big/little endian test 18877d13299dSbellardcat > $TMPC << EOF 1888659eb157SThomas Huth#include <stdio.h> 188961cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 189061cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 1891659eb157SThomas Huthint main(int argc, char *argv[]) 1892659eb157SThomas Huth{ 1893659eb157SThomas Huth return printf("%s %s\n", (char *)big_endian, (char *)little_endian); 18947d13299dSbellard} 18957d13299dSbellardEOF 18967d13299dSbellard 1897659eb157SThomas Huthif compile_prog ; then 1898659eb157SThomas Huth if strings -a $TMPE | grep -q BiGeNdIaN ; then 189961cc919fSMike Frysinger bigendian="yes" 1900659eb157SThomas Huth elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then 190161cc919fSMike Frysinger bigendian="no" 19027d13299dSbellard else 19037d13299dSbellard echo big/little test failed 1904659eb157SThomas Huth exit 1 19057d13299dSbellard fi 19067d13299dSbellardelse 190761cc919fSMike Frysinger echo big/little test failed 1908659eb157SThomas Huth exit 1 19097d13299dSbellardfi 19107d13299dSbellard 1911b0a47e79SJuan Quintela########################################## 1912e10ee3f5SPhilippe Mathieu-Daudé# system tools 1913e10ee3f5SPhilippe Mathieu-Daudéif test -z "$want_tools"; then 1914e10ee3f5SPhilippe Mathieu-Daudé if test "$softmmu" = "no"; then 1915e10ee3f5SPhilippe Mathieu-Daudé want_tools=no 1916e10ee3f5SPhilippe Mathieu-Daudé else 1917e10ee3f5SPhilippe Mathieu-Daudé want_tools=yes 1918e10ee3f5SPhilippe Mathieu-Daudé fi 1919e10ee3f5SPhilippe Mathieu-Daudéfi 1920e10ee3f5SPhilippe Mathieu-Daudé 1921e10ee3f5SPhilippe Mathieu-Daudé########################################## 1922015a33bdSGonglei# L2TPV3 probe 1923015a33bdSGonglei 1924015a33bdSGongleicat > $TMPC <<EOF 1925015a33bdSGonglei#include <sys/socket.h> 1926bff6cb72SMichael Tokarev#include <linux/ip.h> 1927015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 1928015a33bdSGongleiEOF 1929015a33bdSGongleiif compile_prog "" "" ; then 1930015a33bdSGonglei l2tpv3=yes 1931015a33bdSGongleielse 1932015a33bdSGonglei l2tpv3=no 1933015a33bdSGongleifi 1934015a33bdSGonglei 1935299e6f19SPaolo Bonzini######################################### 1936299e6f19SPaolo Bonzini# vhost interdependencies and host support 1937299e6f19SPaolo Bonzini 1938299e6f19SPaolo Bonzini# vhost backends 1939d88618f7SStefan Hajnocziif test "$vhost_user" = "yes" && test "$linux" != "yes"; then 1940d88618f7SStefan Hajnoczi error_exit "vhost-user is only available on Linux" 1941299e6f19SPaolo Bonzinifi 1942108a6481SCindy Lutest "$vhost_vdpa" = "" && vhost_vdpa=$linux 1943108a6481SCindy Luif test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 1944108a6481SCindy Lu error_exit "vhost-vdpa is only available on Linux" 1945108a6481SCindy Lufi 1946299e6f19SPaolo Bonzinitest "$vhost_kernel" = "" && vhost_kernel=$linux 1947299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 1948299e6f19SPaolo Bonzini error_exit "vhost-kernel is only available on Linux" 1949299e6f19SPaolo Bonzinifi 1950299e6f19SPaolo Bonzini 1951299e6f19SPaolo Bonzini# vhost-kernel devices 1952299e6f19SPaolo Bonzinitest "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 1953299e6f19SPaolo Bonziniif test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 1954299e6f19SPaolo Bonzini error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 1955299e6f19SPaolo Bonzinifi 1956299e6f19SPaolo Bonzinitest "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 1957299e6f19SPaolo Bonziniif test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 1958299e6f19SPaolo Bonzini error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 1959299e6f19SPaolo Bonzinifi 1960299e6f19SPaolo Bonzini 1961299e6f19SPaolo Bonzini# vhost-user backends 1962299e6f19SPaolo Bonzinitest "$vhost_net_user" = "" && vhost_net_user=$vhost_user 1963299e6f19SPaolo Bonziniif test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 1964299e6f19SPaolo Bonzini error_exit "--enable-vhost-net-user requires --enable-vhost-user" 1965299e6f19SPaolo Bonzinifi 1966299e6f19SPaolo Bonzinitest "$vhost_crypto" = "" && vhost_crypto=$vhost_user 1967299e6f19SPaolo Bonziniif test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 1968299e6f19SPaolo Bonzini error_exit "--enable-vhost-crypto requires --enable-vhost-user" 1969299e6f19SPaolo Bonzinifi 197098fc1adaSDr. David Alan Gilberttest "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 197198fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 197298fc1adaSDr. David Alan Gilbert error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 197398fc1adaSDr. David Alan Gilbertfi 1974108a6481SCindy Lu#vhost-vdpa backends 1975108a6481SCindy Lutest "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 1976108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 1977108a6481SCindy Lu error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 1978108a6481SCindy Lufi 1979299e6f19SPaolo Bonzini 198040bc0ca9SLaurent Vivier# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity 1981299e6f19SPaolo Bonziniif test "$vhost_net" = ""; then 1982299e6f19SPaolo Bonzini test "$vhost_net_user" = "yes" && vhost_net=yes 198340bc0ca9SLaurent Vivier test "$vhost_net_vdpa" = "yes" && vhost_net=yes 1984299e6f19SPaolo Bonzini test "$vhost_kernel" = "yes" && vhost_net=yes 1985299e6f19SPaolo Bonzinifi 1986299e6f19SPaolo Bonzini 1987015a33bdSGonglei########################################## 1988779ab5e3SStefan Weil# pkg-config probe 1989779ab5e3SStefan Weil 1990779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 199176ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 1992779ab5e3SStefan Weilfi 1993779ab5e3SStefan Weil 1994779ab5e3SStefan Weil########################################## 1995b0a47e79SJuan Quintela# NPTL probe 1996b0a47e79SJuan Quintela 199724cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 1998bd0c5661Spbrook cat > $TMPC <<EOF 1999bd0c5661Spbrook#include <sched.h> 200030813ceaSpbrook#include <linux/futex.h> 2001182eacc0SStefan Weilint main(void) { 2002bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2003bd0c5661Spbrook#error bork 2004bd0c5661Spbrook#endif 2005182eacc0SStefan Weil return 0; 2006bd0c5661Spbrook} 2007bd0c5661SpbrookEOF 200824cb36a6SPeter Maydell if ! compile_object ; then 200921684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2010b0a47e79SJuan Quintela fi 2011bd0c5661Spbrookfi 2012bd0c5661Spbrook 2013ac62922eSbalrog########################################## 2014e37630caSaliguori# xen probe 2015e37630caSaliguori 20161badb709SPaolo Bonziniif test "$xen" != "disabled" ; then 2017c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2018c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2019c1cdd9d5SJuergen Gross # to obtain all needed flags. 2020c1cdd9d5SJuergen Gross 2021c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2022c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2023c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2024c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 20251badb709SPaolo Bonzini xen=enabled 20265b6a8f43SMichael Tokarev xen_pc="xencontrol xenstore xenforeignmemory xengnttab" 2027c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 202858ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 202958ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 203058ea9a7aSAnthony PERARD fi 2031582ea95fSMarc-André Lureau xen_cflags="$($pkg_config --cflags $xen_pc)" 2032582ea95fSMarc-André Lureau xen_libs="$($pkg_config --libs $xen_pc)" 2033c1cdd9d5SJuergen Gross else 2034c1cdd9d5SJuergen Gross 20355b6a8f43SMichael Tokarev xen_libs="-lxenstore -lxenctrl" 2036d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2037d5b93ddfSAnthony PERARD 203850ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 203950ced5b3SStefan Weil # If no, we are done and there is no Xen support. 204050ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 204150ced5b3SStefan Weil 204250ced5b3SStefan Weil # Xen (any) 204350ced5b3SStefan Weil cat > $TMPC <<EOF 204450ced5b3SStefan Weil#include <xenctrl.h> 204550ced5b3SStefan Weilint main(void) { 204650ced5b3SStefan Weil return 0; 204750ced5b3SStefan Weil} 204850ced5b3SStefan WeilEOF 204950ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 205050ced5b3SStefan Weil # Xen not found 20511badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 205221684af0SStewart Smith feature_not_found "xen" "Install xen devel" 205350ced5b3SStefan Weil fi 20541badb709SPaolo Bonzini xen=disabled 205550ced5b3SStefan Weil 2056d5b93ddfSAnthony PERARD # Xen unstable 205769deef08SPeter Maydell elif 205869deef08SPeter Maydell cat > $TMPC <<EOF && 20592cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 20602cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 20612cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2062d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 20632cbf8903SRoss Lagerwallint main(void) { 20642cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2065d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 20662cbf8903SRoss Lagerwall 20672cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 20682cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 20692cbf8903SRoss Lagerwall 2070d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2071d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2072d3c49ebbSPaul Durrant 20732cbf8903SRoss Lagerwall return 0; 20742cbf8903SRoss Lagerwall} 20752cbf8903SRoss LagerwallEOF 20762cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 20772cbf8903SRoss Lagerwall then 20782cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 20792cbf8903SRoss Lagerwall xen_ctrl_version=41100 20801badb709SPaolo Bonzini xen=enabled 20812cbf8903SRoss Lagerwall elif 20822cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 20835ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 20845ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 208558ea9a7aSAnthony PERARD#include <xentoolcore.h> 20865ba3d756SIgor Druzhininint main(void) { 20875ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 20885ba3d756SIgor Druzhinin 20895ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 20905ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 209158ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 20925ba3d756SIgor Druzhinin 20935ba3d756SIgor Druzhinin return 0; 20945ba3d756SIgor Druzhinin} 20955ba3d756SIgor DruzhininEOF 209658ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 20975ba3d756SIgor Druzhinin then 209858ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 20995ba3d756SIgor Druzhinin xen_ctrl_version=41000 21001badb709SPaolo Bonzini xen=enabled 21015ba3d756SIgor Druzhinin elif 21025ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2103da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2104da8090ccSPaul Durrant#define __XEN_TOOLS__ 2105da8090ccSPaul Durrant#include <xendevicemodel.h> 2106da8090ccSPaul Durrantint main(void) { 2107da8090ccSPaul Durrant xendevicemodel_handle *xd; 2108da8090ccSPaul Durrant 2109da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2110da8090ccSPaul Durrant xendevicemodel_close(xd); 2111da8090ccSPaul Durrant 2112da8090ccSPaul Durrant return 0; 2113da8090ccSPaul Durrant} 2114da8090ccSPaul DurrantEOF 2115da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2116da8090ccSPaul Durrant then 2117da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2118f1167ee6SJuergen Gross xen_ctrl_version=40900 21191badb709SPaolo Bonzini xen=enabled 2120da8090ccSPaul Durrant elif 2121da8090ccSPaul Durrant cat > $TMPC <<EOF && 21225eeb39c2SIan Campbell/* 21235eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 21245eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2125b6eb9b45SPaulina Szubarczyk * 2126b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2127b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2128b6eb9b45SPaulina Szubarczyk */ 2129b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2130b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2131b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2132b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2133b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2134b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2135b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2136b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2137b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2138b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2139b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2140b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2141b6eb9b45SPaulina Szubarczyk#endif 2142b6eb9b45SPaulina Szubarczykint main(void) { 2143b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2144b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2145b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2146b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2147b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2148b6eb9b45SPaulina Szubarczyk 2149b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2150b6eb9b45SPaulina Szubarczyk 2151b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2152b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2153b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2154b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2155b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2156b6eb9b45SPaulina Szubarczyk 2157b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2158b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2159b6eb9b45SPaulina Szubarczyk 2160b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2161b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2162b6eb9b45SPaulina Szubarczyk 2163b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2164b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2165b6eb9b45SPaulina Szubarczyk 2166b6eb9b45SPaulina Szubarczyk return 0; 2167b6eb9b45SPaulina Szubarczyk} 2168b6eb9b45SPaulina SzubarczykEOF 2169b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2170b6eb9b45SPaulina Szubarczyk then 2171f1167ee6SJuergen Gross xen_ctrl_version=40800 21721badb709SPaolo Bonzini xen=enabled 2173b6eb9b45SPaulina Szubarczyk elif 2174b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2175b6eb9b45SPaulina Szubarczyk/* 2176b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2177b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 21785eeb39c2SIan Campbell */ 21795eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 21805eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 21815eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 21825eeb39c2SIan Campbell#include <xenctrl.h> 21835eeb39c2SIan Campbell#include <xenstore.h> 21845eeb39c2SIan Campbell#include <xenevtchn.h> 21855eeb39c2SIan Campbell#include <xengnttab.h> 21865eeb39c2SIan Campbell#include <xenforeignmemory.h> 21875eeb39c2SIan Campbell#include <stdint.h> 21885eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 21895eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 21905eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 21915eeb39c2SIan Campbell#endif 21925eeb39c2SIan Campbellint main(void) { 21935eeb39c2SIan Campbell xc_interface *xc = NULL; 21945eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 21955eeb39c2SIan Campbell xenevtchn_handle *xe; 21965eeb39c2SIan Campbell xengnttab_handle *xg; 21975eeb39c2SIan Campbell 21985eeb39c2SIan Campbell xs_daemon_open(); 21995eeb39c2SIan Campbell 22005eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 22015eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 22025eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 22035eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 22045eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 22055eeb39c2SIan Campbell 22065eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 22075eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 22085eeb39c2SIan Campbell 22095eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 22105eeb39c2SIan Campbell xenevtchn_fd(xe); 22115eeb39c2SIan Campbell 22125eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 22135eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 22145eeb39c2SIan Campbell 22155eeb39c2SIan Campbell return 0; 22165eeb39c2SIan Campbell} 22175eeb39c2SIan CampbellEOF 22185eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 22195eeb39c2SIan Campbell then 2220f1167ee6SJuergen Gross xen_ctrl_version=40701 22211badb709SPaolo Bonzini xen=enabled 2222cdadde39SRoger Pau Monne 2223cdadde39SRoger Pau Monne # Xen 4.6 2224cdadde39SRoger Pau Monne elif 2225cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2226cdadde39SRoger Pau Monne#include <xenctrl.h> 2227e108a3c1SAnthony PERARD#include <xenstore.h> 2228d5b93ddfSAnthony PERARD#include <stdint.h> 2229d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2230d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2231d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2232d5b93ddfSAnthony PERARD#endif 2233d5b93ddfSAnthony PERARDint main(void) { 2234d5b93ddfSAnthony PERARD xc_interface *xc; 2235d5b93ddfSAnthony PERARD xs_daemon_open(); 2236d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2237d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2238d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2239b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 22408688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2241d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 224220a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2243d8b441a3SJan Beulich return 0; 2244d8b441a3SJan Beulich} 2245d8b441a3SJan BeulichEOF 2246d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2247d8b441a3SJan Beulich then 2248f1167ee6SJuergen Gross xen_ctrl_version=40600 22491badb709SPaolo Bonzini xen=enabled 2250d8b441a3SJan Beulich 2251d8b441a3SJan Beulich # Xen 4.5 2252d8b441a3SJan Beulich elif 2253d8b441a3SJan Beulich cat > $TMPC <<EOF && 2254d8b441a3SJan Beulich#include <xenctrl.h> 2255d8b441a3SJan Beulich#include <xenstore.h> 2256d8b441a3SJan Beulich#include <stdint.h> 2257d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2258d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2259d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2260d8b441a3SJan Beulich#endif 2261d8b441a3SJan Beulichint main(void) { 2262d8b441a3SJan Beulich xc_interface *xc; 2263d8b441a3SJan Beulich xs_daemon_open(); 2264d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2265d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2266d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2267d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2268d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 22693996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 22703996e85cSPaul Durrant return 0; 22713996e85cSPaul Durrant} 22723996e85cSPaul DurrantEOF 22733996e85cSPaul Durrant compile_prog "" "$xen_libs" 22743996e85cSPaul Durrant then 2275f1167ee6SJuergen Gross xen_ctrl_version=40500 22761badb709SPaolo Bonzini xen=enabled 22773996e85cSPaul Durrant 22783996e85cSPaul Durrant elif 22793996e85cSPaul Durrant cat > $TMPC <<EOF && 22803996e85cSPaul Durrant#include <xenctrl.h> 22813996e85cSPaul Durrant#include <xenstore.h> 22823996e85cSPaul Durrant#include <stdint.h> 22833996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 22843996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 22853996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 22863996e85cSPaul Durrant#endif 22873996e85cSPaul Durrantint main(void) { 22883996e85cSPaul Durrant xc_interface *xc; 22893996e85cSPaul Durrant xs_daemon_open(); 22903996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 22913996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 22923996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 22933996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 22943996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 22958688e065SStefano Stabellini return 0; 22968688e065SStefano Stabellini} 22978688e065SStefano StabelliniEOF 22988688e065SStefano Stabellini compile_prog "" "$xen_libs" 229969deef08SPeter Maydell then 2300f1167ee6SJuergen Gross xen_ctrl_version=40200 23011badb709SPaolo Bonzini xen=enabled 23028688e065SStefano Stabellini 2303e37630caSaliguori else 23041badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 2305edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2306edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2307fc321b4bSJuan Quintela fi 23081badb709SPaolo Bonzini xen=disabled 2309e37630caSaliguori fi 2310d5b93ddfSAnthony PERARD 23111badb709SPaolo Bonzini if test "$xen" = enabled; then 2312f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 2313582ea95fSMarc-André Lureau xen_libs="$xen_libs $xen_stable_libs " 23145eeb39c2SIan Campbell fi 2315d5b93ddfSAnthony PERARD fi 2316e37630caSaliguori fi 2317c1cdd9d5SJuergen Grossfi 2318e37630caSaliguori 2319d661d9a4SJustin Terry (VM)########################################## 23202da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 23212da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 23222da776dbSMichael R. Hines cat > $TMPC <<EOF 23232da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 23242da776dbSMichael R. Hinesint main(void) { return 0; } 23252da776dbSMichael R. HinesEOF 2326ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 23272da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 23282da776dbSMichael R. Hines rdma="yes" 23292da776dbSMichael R. Hines else 23302da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 23312da776dbSMichael R. Hines error_exit \ 2332ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 23332da776dbSMichael R. Hines " Your options:" \ 2334ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 23352da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 23362da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 23372da776dbSMichael R. Hines fi 23382da776dbSMichael R. Hines rdma="no" 23392da776dbSMichael R. Hines fi 23402da776dbSMichael R. Hinesfi 23412da776dbSMichael R. Hines 234221ab34c9SMarcel Apfelbaum########################################## 234321ab34c9SMarcel Apfelbaum# PVRDMA detection 234421ab34c9SMarcel Apfelbaum 234521ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 234621ab34c9SMarcel Apfelbaum#include <sys/mman.h> 234721ab34c9SMarcel Apfelbaum 234821ab34c9SMarcel Apfelbaumint 234921ab34c9SMarcel Apfelbaummain(void) 235021ab34c9SMarcel Apfelbaum{ 235121ab34c9SMarcel Apfelbaum char buf = 0; 235221ab34c9SMarcel Apfelbaum void *addr = &buf; 235321ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 235421ab34c9SMarcel Apfelbaum 235521ab34c9SMarcel Apfelbaum return 0; 235621ab34c9SMarcel Apfelbaum} 235721ab34c9SMarcel ApfelbaumEOF 235821ab34c9SMarcel Apfelbaum 235921ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 236021ab34c9SMarcel Apfelbaum case "$pvrdma" in 236121ab34c9SMarcel Apfelbaum "") 236221ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 236321ab34c9SMarcel Apfelbaum pvrdma="yes" 236421ab34c9SMarcel Apfelbaum else 236521ab34c9SMarcel Apfelbaum pvrdma="no" 236621ab34c9SMarcel Apfelbaum fi 236721ab34c9SMarcel Apfelbaum ;; 236821ab34c9SMarcel Apfelbaum "yes") 236921ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 237021ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 237121ab34c9SMarcel Apfelbaum fi 237221ab34c9SMarcel Apfelbaum pvrdma="yes" 237321ab34c9SMarcel Apfelbaum ;; 237421ab34c9SMarcel Apfelbaum "no") 237521ab34c9SMarcel Apfelbaum pvrdma="no" 237621ab34c9SMarcel Apfelbaum ;; 237721ab34c9SMarcel Apfelbaum esac 237821ab34c9SMarcel Apfelbaumelse 237921ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 238021ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 238121ab34c9SMarcel Apfelbaum fi 238221ab34c9SMarcel Apfelbaum pvrdma="no" 238321ab34c9SMarcel Apfelbaumfi 238495c6bff3SBenoît Canet 2385ee108585SYuval Shaia# Let's see if enhanced reg_mr is supported 2386ee108585SYuval Shaiaif test "$pvrdma" = "yes" ; then 2387ee108585SYuval Shaia 2388ee108585SYuval Shaiacat > $TMPC <<EOF && 2389ee108585SYuval Shaia#include <infiniband/verbs.h> 2390ee108585SYuval Shaia 2391ee108585SYuval Shaiaint 2392ee108585SYuval Shaiamain(void) 2393ee108585SYuval Shaia{ 2394ee108585SYuval Shaia struct ibv_mr *mr; 2395ee108585SYuval Shaia struct ibv_pd *pd = NULL; 2396ee108585SYuval Shaia size_t length = 10; 2397ee108585SYuval Shaia uint64_t iova = 0; 2398ee108585SYuval Shaia int access = 0; 2399ee108585SYuval Shaia void *addr = NULL; 2400ee108585SYuval Shaia 2401ee108585SYuval Shaia mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 2402ee108585SYuval Shaia 2403ee108585SYuval Shaia ibv_dereg_mr(mr); 2404ee108585SYuval Shaia 2405ee108585SYuval Shaia return 0; 2406ee108585SYuval Shaia} 2407ee108585SYuval ShaiaEOF 2408ee108585SYuval Shaia if ! compile_prog "" "-libverbs"; then 2409ee108585SYuval Shaia QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 2410ee108585SYuval Shaia fi 2411ee108585SYuval Shaiafi 2412ee108585SYuval Shaia 241395c6bff3SBenoît Canet########################################## 2414c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 2415dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 2416dce512deSChristoph Hellwig cat > $TMPC << EOF 2417ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 2418dce512deSChristoph Hellwig#include <xfs/xfs.h> 2419dce512deSChristoph Hellwigint main(void) 2420dce512deSChristoph Hellwig{ 2421dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 2422dce512deSChristoph Hellwig return 0; 2423dce512deSChristoph Hellwig} 2424dce512deSChristoph HellwigEOF 2425dce512deSChristoph Hellwig if compile_prog "" "" ; then 2426dce512deSChristoph Hellwig xfs="yes" 2427dce512deSChristoph Hellwig else 2428dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 2429e3a6e0daSzhaolichang feature_not_found "xfs" "Install xfsprogs/xfslibs devel" 2430dce512deSChristoph Hellwig fi 2431dce512deSChristoph Hellwig xfs=no 2432dce512deSChristoph Hellwig fi 2433dce512deSChristoph Hellwigfi 2434dce512deSChristoph Hellwig 2435dce512deSChristoph Hellwig########################################## 2436ba4dd2aaSAlex Bennée# plugin linker support probe 2437ba4dd2aaSAlex Bennée 2438ba4dd2aaSAlex Bennéeif test "$plugins" != "no"; then 2439ba4dd2aaSAlex Bennée 2440ba4dd2aaSAlex Bennée ######################################### 2441ba4dd2aaSAlex Bennée # See if --dynamic-list is supported by the linker 2442ba4dd2aaSAlex Bennée 2443ba4dd2aaSAlex Bennée ld_dynamic_list="no" 2444ba4dd2aaSAlex Bennée cat > $TMPTXT <<EOF 2445ba4dd2aaSAlex Bennée{ 2446ba4dd2aaSAlex Bennée foo; 2447ba4dd2aaSAlex Bennée}; 2448ba4dd2aaSAlex BennéeEOF 2449ba4dd2aaSAlex Bennée 2450ba4dd2aaSAlex Bennée cat > $TMPC <<EOF 2451ba4dd2aaSAlex Bennée#include <stdio.h> 2452ba4dd2aaSAlex Bennéevoid foo(void); 2453ba4dd2aaSAlex Bennée 2454ba4dd2aaSAlex Bennéevoid foo(void) 2455ba4dd2aaSAlex Bennée{ 2456ba4dd2aaSAlex Bennée printf("foo\n"); 2457ba4dd2aaSAlex Bennée} 2458ba4dd2aaSAlex Bennée 2459ba4dd2aaSAlex Bennéeint main(void) 2460ba4dd2aaSAlex Bennée{ 2461ba4dd2aaSAlex Bennée foo(); 2462ba4dd2aaSAlex Bennée return 0; 2463ba4dd2aaSAlex Bennée} 2464ba4dd2aaSAlex BennéeEOF 2465ba4dd2aaSAlex Bennée 2466ba4dd2aaSAlex Bennée if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 2467ba4dd2aaSAlex Bennée ld_dynamic_list="yes" 2468ba4dd2aaSAlex Bennée fi 2469ba4dd2aaSAlex Bennée 2470ba4dd2aaSAlex Bennée ######################################### 2471ba4dd2aaSAlex Bennée # See if -exported_symbols_list is supported by the linker 2472ba4dd2aaSAlex Bennée 2473ba4dd2aaSAlex Bennée ld_exported_symbols_list="no" 2474ba4dd2aaSAlex Bennée cat > $TMPTXT <<EOF 2475ba4dd2aaSAlex Bennée _foo 2476ba4dd2aaSAlex BennéeEOF 2477ba4dd2aaSAlex Bennée 2478ba4dd2aaSAlex Bennée if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 2479ba4dd2aaSAlex Bennée ld_exported_symbols_list="yes" 2480ba4dd2aaSAlex Bennée fi 2481ba4dd2aaSAlex Bennée 2482ba4dd2aaSAlex Bennée if test "$ld_dynamic_list" = "no" && 2483ba4dd2aaSAlex Bennée test "$ld_exported_symbols_list" = "no" ; then 2484ba4dd2aaSAlex Bennée if test "$plugins" = "yes"; then 2485ba4dd2aaSAlex Bennée error_exit \ 2486ba4dd2aaSAlex Bennée "Plugin support requires dynamic linking and specifying a set of symbols " \ 2487ba4dd2aaSAlex Bennée "that are exported to plugins. Unfortunately your linker doesn't " \ 2488ba4dd2aaSAlex Bennée "support the flag (--dynamic-list or -exported_symbols_list) used " \ 2489ba4dd2aaSAlex Bennée "for this purpose." 2490ba4dd2aaSAlex Bennée else 2491ba4dd2aaSAlex Bennée plugins="no" 2492ba4dd2aaSAlex Bennée fi 2493ba4dd2aaSAlex Bennée else 2494ba4dd2aaSAlex Bennée plugins="yes" 2495ba4dd2aaSAlex Bennée fi 2496ba4dd2aaSAlex Bennéefi 2497ba4dd2aaSAlex Bennée 2498ba4dd2aaSAlex Bennée########################################## 2499e18df141SAnthony Liguori# glib support probe 2500a52d28afSPaolo Bonzini 2501b4c6036fSDaniel P. Berrangéglib_req_ver=2.56 2502aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 2503aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 2504a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 2505b906acacSPaolo Bonzinielif test "$plugins" = "yes"; then 2506b906acacSPaolo Bonzini glib_modules="$glib_modules gmodule-no-export-2.0" 250754cb65d8SEmilio G. Cotafi 2508e26110cfSFam Zheng 2509aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 2510e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 251189138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 251289138857SStefan Weil glib_libs=$($pkg_config --libs $i) 2513e18df141SAnthony Liguori else 2514e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 2515e26110cfSFam Zheng fi 2516e26110cfSFam Zhengdone 2517e26110cfSFam Zheng 2518215b0c2fSPaolo Bonzini# This workaround is required due to a bug in pkg-config file for glib as it 2519215b0c2fSPaolo Bonzini# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 2520215b0c2fSPaolo Bonzini 2521215b0c2fSPaolo Bonziniif test "$static" = yes && test "$mingw32" = yes; then 2522215b0c2fSPaolo Bonzini glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags" 2523215b0c2fSPaolo Bonzinifi 2524215b0c2fSPaolo Bonzini 252520cf7b8eSDenis Plotnikovif ! test "$gio" = "no"; then 252620cf7b8eSDenis Plotnikov pass=no 2527f876b765SMarc-André Lureau if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 2528f876b765SMarc-André Lureau gio_cflags=$($pkg_config --cflags gio-2.0) 2529f876b765SMarc-André Lureau gio_libs=$($pkg_config --libs gio-2.0) 253025a97a56SMarc-André Lureau gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 25315ecfb76cSPaolo Bonzini if ! has "$gdbus_codegen"; then 25320dba4897SMarc-André Lureau gdbus_codegen= 25330dba4897SMarc-André Lureau fi 253476346b62SPeter Maydell # Check that the libraries actually work -- Ubuntu 18.04 ships 253576346b62SPeter Maydell # with pkg-config --static --libs data for gio-2.0 that is missing 253676346b62SPeter Maydell # -lblkid and will give a link error. 253713ceae66SPeter Maydell cat > $TMPC <<EOF 253813ceae66SPeter Maydell#include <gio/gio.h> 253913ceae66SPeter Maydellint main(void) 254013ceae66SPeter Maydell{ 254113ceae66SPeter Maydell g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); 254213ceae66SPeter Maydell return 0; 254313ceae66SPeter Maydell} 254413ceae66SPeter MaydellEOF 254513ceae66SPeter Maydell if compile_prog "$gio_cflags" "$gio_libs" ; then 254620cf7b8eSDenis Plotnikov pass=yes 254776346b62SPeter Maydell else 254820cf7b8eSDenis Plotnikov pass=no 2549f876b765SMarc-André Lureau fi 2550f876b765SMarc-André Lureau 255120cf7b8eSDenis Plotnikov if test "$pass" = "yes" && 255220cf7b8eSDenis Plotnikov $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 255325a97a56SMarc-André Lureau gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 255425a97a56SMarc-André Lureau gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 255525a97a56SMarc-André Lureau fi 255620cf7b8eSDenis Plotnikov fi 255720cf7b8eSDenis Plotnikov 255820cf7b8eSDenis Plotnikov if test "$pass" = "no"; then 255920cf7b8eSDenis Plotnikov if test "$gio" = "yes"; then 256020cf7b8eSDenis Plotnikov feature_not_found "gio" "Install libgio >= 2.0" 256120cf7b8eSDenis Plotnikov else 256220cf7b8eSDenis Plotnikov gio=no 256320cf7b8eSDenis Plotnikov fi 256420cf7b8eSDenis Plotnikov else 256520cf7b8eSDenis Plotnikov gio=yes 256620cf7b8eSDenis Plotnikov fi 256720cf7b8eSDenis Plotnikovfi 256825a97a56SMarc-André Lureau 2569977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 2570977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 2571977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 2572977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 2573977a82abSDaniel P. Berrangecat > $TMPC <<EOF 2574977a82abSDaniel P. Berrange#include <glib.h> 2575977a82abSDaniel P. Berrange#include <unistd.h> 2576977a82abSDaniel P. Berrange 2577977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 2578977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 2579977a82abSDaniel P. Berrange 2580977a82abSDaniel P. Berrangeint main(void) { 2581977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 2582977a82abSDaniel P. Berrange return 0; 2583977a82abSDaniel P. Berrange} 2584977a82abSDaniel P. BerrangeEOF 2585977a82abSDaniel P. Berrange 2586215b0c2fSPaolo Bonziniif ! compile_prog "$glib_cflags" "$glib_libs" ; then 2587977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 2588977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 2589977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 2590977a82abSDaniel P. Berrange "build target" 2591977a82abSDaniel P. Berrangefi 2592977a82abSDaniel P. Berrange 25939bda600bSEric Blake# Silence clang warnings triggered by glib < 2.57.2 25949bda600bSEric Blakecat > $TMPC << EOF 25959bda600bSEric Blake#include <glib.h> 25969bda600bSEric Blaketypedef struct Foo { 25979bda600bSEric Blake int i; 25989bda600bSEric Blake} Foo; 25999bda600bSEric Blakestatic void foo_free(Foo *f) 26009bda600bSEric Blake{ 26019bda600bSEric Blake g_free(f); 26029bda600bSEric Blake} 26039bda600bSEric BlakeG_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 26049bda600bSEric Blakeint main(void) { return 0; } 26059bda600bSEric BlakeEOF 26069bda600bSEric Blakeif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 26079bda600bSEric Blake if cc_has_warning_flag "-Wno-unused-function"; then 26089bda600bSEric Blake glib_cflags="$glib_cflags -Wno-unused-function" 26095770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function" 26109bda600bSEric Blake fi 26119bda600bSEric Blakefi 26129bda600bSEric Blake 2613e26110cfSFam Zheng########################################## 2614e26110cfSFam Zheng# SHA command probe for modules 2615e26110cfSFam Zhengif test "$modules" = yes; then 2616e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 2617e26110cfSFam Zheng for c in $shacmd_probe; do 26188ccefb91SFam Zheng if has $c; then 2619e26110cfSFam Zheng shacmd="$c" 2620e26110cfSFam Zheng break 2621e26110cfSFam Zheng fi 2622e26110cfSFam Zheng done 2623e26110cfSFam Zheng if test "$shacmd" = ""; then 2624e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 2625e26110cfSFam Zheng fi 2626e18df141SAnthony Liguorifi 2627e18df141SAnthony Liguori 2628e18df141SAnthony Liguori########################################## 2629b10d49d7SPino Toscano# libssh probe 2630b10d49d7SPino Toscanoif test "$libssh" != "no" ; then 2631b4c10fc6SThomas Huth if $pkg_config --exists "libssh >= 0.8.7"; then 2632b10d49d7SPino Toscano libssh_cflags=$($pkg_config libssh --cflags) 2633b10d49d7SPino Toscano libssh_libs=$($pkg_config libssh --libs) 2634b10d49d7SPino Toscano libssh=yes 26350a12ec87SRichard W.M. Jones else 2636b10d49d7SPino Toscano if test "$libssh" = "yes" ; then 2637b10d49d7SPino Toscano error_exit "libssh required for --enable-libssh" 26380a12ec87SRichard W.M. Jones fi 2639b10d49d7SPino Toscano libssh=no 26400a12ec87SRichard W.M. Jones fi 26410a12ec87SRichard W.M. Jonesfi 26420a12ec87SRichard W.M. Jones 26430a12ec87SRichard W.M. Jones########################################## 26447aaa6a16SPaolo Bonzini# TPM emulation is only on POSIX 26453b8acc11SPaolo Bonzini 26467aaa6a16SPaolo Bonziniif test "$tpm" = ""; then 26477aaa6a16SPaolo Bonzini if test "$mingw32" = "yes"; then 26487aaa6a16SPaolo Bonzini tpm=no 26493b8acc11SPaolo Bonzini else 26507aaa6a16SPaolo Bonzini tpm=yes 26517aaa6a16SPaolo Bonzini fi 26527aaa6a16SPaolo Bonzinielif test "$tpm" = "yes"; then 26537aaa6a16SPaolo Bonzini if test "$mingw32" = "yes" ; then 26547aaa6a16SPaolo Bonzini error_exit "TPM emulation only available on POSIX systems" 26557aaa6a16SPaolo Bonzini fi 26563b8acc11SPaolo Bonzinifi 26573b8acc11SPaolo Bonzini 26583b8acc11SPaolo Bonzini########################################## 2659f652e6afSaurel32# fdt probe 2660e169e1e1SPeter Maydell 2661fbb4121dSPaolo Bonzinicase "$fdt" in 2662fbb4121dSPaolo Bonzini auto | enabled | internal) 2663fbb4121dSPaolo Bonzini # Simpler to always update submodule, even if not needed. 2664aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 2665fbb4121dSPaolo Bonzini ;; 2666fbb4121dSPaolo Bonziniesac 2667f652e6afSaurel32 266820ff075bSMichael Walle########################################## 26699d49bcf6SMarkus Armbruster# opengl probe (for sdl2, gtk) 2670b1546f32SGerd Hoffmann 2671da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 2672bc6a3565SAkihiko Odaki epoxy=no 2673bc6a3565SAkihiko Odaki if $pkg_config epoxy; then 2674bc6a3565SAkihiko Odaki cat > $TMPC << EOF 2675bc6a3565SAkihiko Odaki#include <epoxy/egl.h> 2676bc6a3565SAkihiko Odakiint main(void) { return 0; } 2677bc6a3565SAkihiko OdakiEOF 2678bc6a3565SAkihiko Odaki if compile_prog "" "" ; then 2679bc6a3565SAkihiko Odaki epoxy=yes 2680bc6a3565SAkihiko Odaki fi 2681bc6a3565SAkihiko Odaki fi 2682bc6a3565SAkihiko Odaki 2683bc6a3565SAkihiko Odaki if test "$epoxy" = "yes" ; then 2684bc6a3565SAkihiko Odaki opengl_cflags="$($pkg_config --cflags epoxy)" 2685bc6a3565SAkihiko Odaki opengl_libs="$($pkg_config --libs epoxy)" 2686da076ffeSGerd Hoffmann opengl=yes 268720ff075bSMichael Walle else 2688da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 2689bc6a3565SAkihiko Odaki feature_not_found "opengl" "Please install epoxy with EGL" 269020ff075bSMichael Walle fi 2691f676c67eSJeremy White opengl_cflags="" 2692da076ffeSGerd Hoffmann opengl_libs="" 2693da076ffeSGerd Hoffmann opengl=no 269420ff075bSMichael Walle fi 269520ff075bSMichael Wallefi 269620ff075bSMichael Walle 2697dcc38d1cSMarcelo Tosatti########################################## 2698a99d57bbSWanlong Gao# libnuma probe 2699a99d57bbSWanlong Gao 2700a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 2701a99d57bbSWanlong Gao cat > $TMPC << EOF 2702a99d57bbSWanlong Gao#include <numa.h> 2703a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 2704a99d57bbSWanlong GaoEOF 2705a99d57bbSWanlong Gao 2706a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 2707a99d57bbSWanlong Gao numa=yes 2708ab318051SMarc-André Lureau numa_libs="-lnuma" 2709a99d57bbSWanlong Gao else 2710a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 2711a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 2712a99d57bbSWanlong Gao fi 2713a99d57bbSWanlong Gao numa=no 2714a99d57bbSWanlong Gao fi 2715a99d57bbSWanlong Gaofi 2716a99d57bbSWanlong Gao 2717955727d2SCortland Tölva# check for usbfs 2718955727d2SCortland Tölvahave_usbfs=no 2719955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 272096566d09SThomas Petazzoni cat > $TMPC << EOF 272196566d09SThomas Petazzoni#include <linux/usbdevice_fs.h> 272296566d09SThomas Petazzoni 272396566d09SThomas Petazzoni#ifndef USBDEVFS_GET_CAPABILITIES 272496566d09SThomas Petazzoni#error "USBDEVFS_GET_CAPABILITIES undefined" 272596566d09SThomas Petazzoni#endif 272696566d09SThomas Petazzoni 272796566d09SThomas Petazzoni#ifndef USBDEVFS_DISCONNECT_CLAIM 272896566d09SThomas Petazzoni#error "USBDEVFS_DISCONNECT_CLAIM undefined" 272996566d09SThomas Petazzoni#endif 273096566d09SThomas Petazzoni 273196566d09SThomas Petazzoniint main(void) 273296566d09SThomas Petazzoni{ 273396566d09SThomas Petazzoni return 0; 273496566d09SThomas Petazzoni} 273596566d09SThomas PetazzoniEOF 273696566d09SThomas Petazzoni if compile_prog "" ""; then 2737955727d2SCortland Tölva have_usbfs=yes 2738955727d2SCortland Tölva fi 2739955727d2SCortland Tölvafi 2740751bcc39SMarc-André Lureau 2741de5071c5SBlue Swirl########################################## 2742d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 2743d9840e25STomoki Sekiyama 2744e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 2745e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 2746d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 2747690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 2748d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 2749d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 2750690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 2751d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 2752d9840e25STomoki Sekiyama ;; 2753690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 2754d9840e25STomoki Sekiyama esac 2755d9840e25STomoki Sekiyama cat > $TMPC << EOF 2756d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 2757d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 2758d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 2759d9840e25STomoki SekiyamaEOF 2760d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 2761d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 2762d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 2763315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 2764f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 2765d9840e25STomoki Sekiyama else 2766d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 2767d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 2768d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 2769d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 2770d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 2771d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 2772d9840e25STomoki Sekiyama feature_not_found "VSS support" 2773d9840e25STomoki Sekiyama fi 2774d9840e25STomoki Sekiyama guest_agent_with_vss="no" 2775d9840e25STomoki Sekiyama fi 2776d9840e25STomoki Sekiyamafi 2777d9840e25STomoki Sekiyama 2778d9840e25STomoki Sekiyama########################################## 2779d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 2780d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 2781d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 2782d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 2783d9840e25STomoki Sekiyama 2784e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 2785e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 2786d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 2787d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 2788d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 2789d9840e25STomoki Sekiyama if test -n "$programfiles"; then 2790d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 2791d9840e25STomoki Sekiyama else 2792d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 2793d9840e25STomoki Sekiyama fi 2794d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 2795d9840e25STomoki Sekiyama win_sdk="" 2796d9840e25STomoki Sekiyama fi 2797d9840e25STomoki Sekiyamafi 2798d9840e25STomoki Sekiyama 2799d9840e25STomoki Sekiyama########################################## 280050cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 2801e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 280250cbebb9SMichael Roth cat > $TMPC << EOF 280350cbebb9SMichael Roth#include <windows.h> 280450cbebb9SMichael Roth#include <ntddscsi.h> 280550cbebb9SMichael Rothint main(void) { 280650cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 280750cbebb9SMichael Roth#error Missing required ioctl definitions 280850cbebb9SMichael Roth#endif 280950cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 281050cbebb9SMichael Roth return addr.Lun; 281150cbebb9SMichael Roth} 281250cbebb9SMichael RothEOF 281350cbebb9SMichael Roth if compile_prog "" "" ; then 281450cbebb9SMichael Roth guest_agent_ntddscsi=yes 2815996b9cdcSMatt Hines libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 281650cbebb9SMichael Roth fi 281750cbebb9SMichael Rothfi 281850cbebb9SMichael Roth 281950cbebb9SMichael Roth########################################## 28208ca80760SRichard Henderson# capstone 28218ca80760SRichard Henderson 2822e219c499SRichard Hendersoncase "$capstone" in 28238b18cdbfSRichard Henderson auto | enabled | internal) 28248b18cdbfSRichard Henderson # Simpler to always update submodule, even if not needed. 2825e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 2826e219c499SRichard Henderson ;; 2827e219c499SRichard Hendersonesac 28288ca80760SRichard Henderson 28298ca80760SRichard Henderson########################################## 2830519175a2SAlex Barcelo# check and set a backend for coroutine 2831d0e2fce5SAneesh Kumar K.V 28327c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 283333c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 283433c53c54SDaniel P. Berrange# specific one. 28357c2acc70SPeter Maydell 28367c2acc70SPeter Maydellucontext_works=no 2837d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 2838d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2839d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 2840cdf84806SPeter Maydell#ifdef __stub_makecontext 2841cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 2842cdf84806SPeter Maydell#endif 284375cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2844d0e2fce5SAneesh Kumar K.VEOF 2845d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 28467c2acc70SPeter Maydell ucontext_works=yes 2847d0e2fce5SAneesh Kumar K.V fi 2848519175a2SAlex Barcelofi 28497c2acc70SPeter Maydell 28507c2acc70SPeter Maydellif test "$coroutine" = ""; then 28517c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 28527c2acc70SPeter Maydell coroutine=win32 28537c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 28547c2acc70SPeter Maydell coroutine=ucontext 2855519175a2SAlex Barcelo else 28567c2acc70SPeter Maydell coroutine=sigaltstack 28577c2acc70SPeter Maydell fi 28587c2acc70SPeter Maydellelse 28597c2acc70SPeter Maydell case $coroutine in 28607c2acc70SPeter Maydell windows) 28617c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 28627c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 28637c2acc70SPeter Maydell fi 28647c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 28657c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 28667c2acc70SPeter Maydell coroutine=win32 28677c2acc70SPeter Maydell ;; 28687c2acc70SPeter Maydell ucontext) 28697c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 28707c2acc70SPeter Maydell feature_not_found "ucontext" 28717c2acc70SPeter Maydell fi 28727c2acc70SPeter Maydell ;; 287333c53c54SDaniel P. Berrange sigaltstack) 28747c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 28757c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 28767c2acc70SPeter Maydell fi 28777c2acc70SPeter Maydell ;; 28787c2acc70SPeter Maydell *) 287976ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 28807c2acc70SPeter Maydell ;; 28817c2acc70SPeter Maydell esac 2882d0e2fce5SAneesh Kumar K.Vfi 2883d0e2fce5SAneesh Kumar K.V 288470c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 288570c60c08SStefan Hajnoczi coroutine_pool=yes 288670c60c08SStefan Hajnoczifi 288770c60c08SStefan Hajnoczi 28887d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 28897d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 28907d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 28917d992e4dSPeter Lieven coroutine_pool=no 28927d992e4dSPeter Lieven fi 28937d992e4dSPeter Lievenfi 28947d992e4dSPeter Lieven 28951e4f6065SDaniele Buono################################################## 28961e4f6065SDaniele Buono# SafeStack 28971e4f6065SDaniele Buono 28981e4f6065SDaniele Buono 28991e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 29001e4f6065SDaniele Buonocat > $TMPC << EOF 29011e4f6065SDaniele Buonoint main(int argc, char *argv[]) 29021e4f6065SDaniele Buono{ 29031e4f6065SDaniele Buono#if ! __has_feature(safe_stack) 29041e4f6065SDaniele Buono#error SafeStack Disabled 29051e4f6065SDaniele Buono#endif 29061e4f6065SDaniele Buono return 0; 29071e4f6065SDaniele Buono} 29081e4f6065SDaniele BuonoEOF 29091e4f6065SDaniele Buono flag="-fsanitize=safe-stack" 29101e4f6065SDaniele Buono # Check that safe-stack is supported and enabled. 29111e4f6065SDaniele Buono if compile_prog "-Werror $flag" "$flag"; then 29121e4f6065SDaniele Buono # Flag needed both at compilation and at linking 29131e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 29141e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 29151e4f6065SDaniele Buono else 29161e4f6065SDaniele Buono error_exit "SafeStack not supported by your compiler" 29171e4f6065SDaniele Buono fi 29181e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 29191e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 29201e4f6065SDaniele Buono fi 29211e4f6065SDaniele Buonoelse 29221e4f6065SDaniele Buonocat > $TMPC << EOF 29231e4f6065SDaniele Buonoint main(int argc, char *argv[]) 29241e4f6065SDaniele Buono{ 29251e4f6065SDaniele Buono#if defined(__has_feature) 29261e4f6065SDaniele Buono#if __has_feature(safe_stack) 29271e4f6065SDaniele Buono#error SafeStack Enabled 29281e4f6065SDaniele Buono#endif 29291e4f6065SDaniele Buono#endif 29301e4f6065SDaniele Buono return 0; 29311e4f6065SDaniele Buono} 29321e4f6065SDaniele BuonoEOF 29331e4f6065SDaniele Buonoif test "$safe_stack" = "no"; then 29341e4f6065SDaniele Buono # Make sure that safe-stack is disabled 29351e4f6065SDaniele Buono if ! compile_prog "-Werror" ""; then 29361e4f6065SDaniele Buono # SafeStack was already enabled, try to explicitly remove the feature 29371e4f6065SDaniele Buono flag="-fno-sanitize=safe-stack" 29381e4f6065SDaniele Buono if ! compile_prog "-Werror $flag" "$flag"; then 29391e4f6065SDaniele Buono error_exit "Configure cannot disable SafeStack" 29401e4f6065SDaniele Buono fi 29411e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 29421e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 29431e4f6065SDaniele Buono fi 29441e4f6065SDaniele Buonoelse # "$safe_stack" = "" 29451e4f6065SDaniele Buono # Set safe_stack to yes or no based on pre-existing flags 29461e4f6065SDaniele Buono if compile_prog "-Werror" ""; then 29471e4f6065SDaniele Buono safe_stack="no" 29481e4f6065SDaniele Buono else 29491e4f6065SDaniele Buono safe_stack="yes" 29501e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 29511e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 29521e4f6065SDaniele Buono fi 29531e4f6065SDaniele Buono fi 29541e4f6065SDaniele Buonofi 29551e4f6065SDaniele Buonofi 29567d992e4dSPeter Lieven 295776a347e1SRichard Henderson######################################## 295876a347e1SRichard Henderson# check if cpuid.h is usable. 295976a347e1SRichard Henderson 296076a347e1SRichard Hendersoncat > $TMPC << EOF 296176a347e1SRichard Henderson#include <cpuid.h> 296276a347e1SRichard Hendersonint main(void) { 2963774d566cSPeter Maydell unsigned a, b, c, d; 2964774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 2965774d566cSPeter Maydell 2966774d566cSPeter Maydell if (max >= 1) { 2967774d566cSPeter Maydell __cpuid(1, a, b, c, d); 2968774d566cSPeter Maydell } 2969774d566cSPeter Maydell 2970774d566cSPeter Maydell if (max >= 7) { 2971774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 2972774d566cSPeter Maydell } 2973774d566cSPeter Maydell 297476a347e1SRichard Henderson return 0; 297576a347e1SRichard Henderson} 297676a347e1SRichard HendersonEOF 297776a347e1SRichard Hendersonif compile_prog "" "" ; then 297876a347e1SRichard Henderson cpuid_h=yes 297976a347e1SRichard Hendersonfi 298076a347e1SRichard Henderson 29815dd89908SRichard Henderson########################################## 29825dd89908SRichard Henderson# avx2 optimization requirement check 29835dd89908SRichard Henderson# 29845dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 29855dd89908SRichard Henderson# since we won't be able to select the new routines. 29865dd89908SRichard Henderson 2987e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 29885dd89908SRichard Henderson cat > $TMPC << EOF 29895dd89908SRichard Henderson#pragma GCC push_options 29905dd89908SRichard Henderson#pragma GCC target("avx2") 29915dd89908SRichard Henderson#include <cpuid.h> 29925dd89908SRichard Henderson#include <immintrin.h> 29935dd89908SRichard Hendersonstatic int bar(void *a) { 29945dd89908SRichard Henderson __m256i x = *(__m256i *)a; 29955dd89908SRichard Henderson return _mm256_testz_si256(x, x); 29965dd89908SRichard Henderson} 29975dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 29985dd89908SRichard HendersonEOF 29995b945f23SRichard Henderson if compile_object "-Werror" ; then 30005dd89908SRichard Henderson avx2_opt="yes" 300186583a07SLiam Merwick else 300286583a07SLiam Merwick avx2_opt="no" 30035dd89908SRichard Henderson fi 30045dd89908SRichard Hendersonfi 30055dd89908SRichard Henderson 30066b8cd447SRobert Hoo########################################## 30076b8cd447SRobert Hoo# avx512f optimization requirement check 30086b8cd447SRobert Hoo# 30096b8cd447SRobert Hoo# There is no point enabling this if cpuid.h is not usable, 30106b8cd447SRobert Hoo# since we won't be able to select the new routines. 30116b8cd447SRobert Hoo# by default, it is turned off. 30126b8cd447SRobert Hoo# if user explicitly want to enable it, check environment 30136b8cd447SRobert Hoo 30146b8cd447SRobert Hooif test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 30156b8cd447SRobert Hoo cat > $TMPC << EOF 30166b8cd447SRobert Hoo#pragma GCC push_options 30176b8cd447SRobert Hoo#pragma GCC target("avx512f") 30186b8cd447SRobert Hoo#include <cpuid.h> 30196b8cd447SRobert Hoo#include <immintrin.h> 30206b8cd447SRobert Hoostatic int bar(void *a) { 30216b8cd447SRobert Hoo __m512i x = *(__m512i *)a; 30226b8cd447SRobert Hoo return _mm512_test_epi64_mask(x, x); 30236b8cd447SRobert Hoo} 30246b8cd447SRobert Hooint main(int argc, char *argv[]) 30256b8cd447SRobert Hoo{ 30266b8cd447SRobert Hoo return bar(argv[0]); 30276b8cd447SRobert Hoo} 30286b8cd447SRobert HooEOF 30295b945f23SRichard Henderson if ! compile_object "-Werror" ; then 30306b8cd447SRobert Hoo avx512f_opt="no" 30316b8cd447SRobert Hoo fi 30326b8cd447SRobert Hooelse 30336b8cd447SRobert Hoo avx512f_opt="no" 30346b8cd447SRobert Hoofi 30356b8cd447SRobert Hoo 3036f540166bSRichard Henderson######################################## 3037f540166bSRichard Henderson# check if __[u]int128_t is usable. 3038f540166bSRichard Henderson 3039f540166bSRichard Hendersonint128=no 3040f540166bSRichard Hendersoncat > $TMPC << EOF 3041f540166bSRichard Henderson__int128_t a; 3042f540166bSRichard Henderson__uint128_t b; 3043f540166bSRichard Hendersonint main (void) { 3044f540166bSRichard Henderson a = a + b; 3045f540166bSRichard Henderson b = a * b; 3046464e3671SPeter Maydell a = a * a; 3047f540166bSRichard Henderson return 0; 3048f540166bSRichard Henderson} 3049f540166bSRichard HendersonEOF 3050f540166bSRichard Hendersonif compile_prog "" "" ; then 3051f540166bSRichard Henderson int128=yes 3052f540166bSRichard Hendersonfi 305376a347e1SRichard Henderson 30547ebee43eSRichard Henderson######################################### 30557ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 30567ebee43eSRichard Henderson 30577ebee43eSRichard Hendersonatomic128=no 30587ebee43eSRichard Hendersonif test "$int128" = "yes"; then 30597ebee43eSRichard Henderson cat > $TMPC << EOF 30607ebee43eSRichard Hendersonint main(void) 30617ebee43eSRichard Henderson{ 30627ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 3063bceac547SThomas Huth y = __atomic_load(&x, 0); 3064bceac547SThomas Huth __atomic_store(&x, y, 0); 3065bceac547SThomas Huth __atomic_compare_exchange(&x, &y, x, 0, 0, 0); 30667ebee43eSRichard Henderson return 0; 30677ebee43eSRichard Henderson} 30687ebee43eSRichard HendersonEOF 30697ebee43eSRichard Henderson if compile_prog "" "" ; then 30707ebee43eSRichard Henderson atomic128=yes 30717ebee43eSRichard Henderson fi 30727ebee43eSRichard Hendersonfi 30737ebee43eSRichard Henderson 3074e6cd4bb5SRichard Hendersoncmpxchg128=no 3075e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 3076e6cd4bb5SRichard Henderson cat > $TMPC << EOF 3077e6cd4bb5SRichard Hendersonint main(void) 3078e6cd4bb5SRichard Henderson{ 3079e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 3080e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 3081e6cd4bb5SRichard Henderson return 0; 3082e6cd4bb5SRichard Henderson} 3083e6cd4bb5SRichard HendersonEOF 3084e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 3085e6cd4bb5SRichard Henderson cmpxchg128=yes 3086e6cd4bb5SRichard Henderson fi 3087e6cd4bb5SRichard Hendersonfi 3088e6cd4bb5SRichard Henderson 3089fd0e6053SJohn Snow######################################## 3090fd0e6053SJohn Snow# check if ccache is interfering with 3091fd0e6053SJohn Snow# semantic analysis of macros 3092fd0e6053SJohn Snow 30935e4dfd3dSJohn Snowunset CCACHE_CPP2 3094fd0e6053SJohn Snowccache_cpp2=no 3095fd0e6053SJohn Snowcat > $TMPC << EOF 3096fd0e6053SJohn Snowstatic const int Z = 1; 3097fd0e6053SJohn Snow#define fn() ({ Z; }) 3098fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 3099fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 3100fd0e6053SJohn Snow#define ID(X) (X) 3101fd0e6053SJohn Snowint main(int argc, char *argv[]) 3102fd0e6053SJohn Snow{ 3103fd0e6053SJohn Snow int x = 0, y = 0; 3104fd0e6053SJohn Snow x = ID(x); 3105fd0e6053SJohn Snow x = fn(); 3106fd0e6053SJohn Snow fn(); 3107fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 3108fd0e6053SJohn Snow if (TAUT(Z)) return 0; 3109fd0e6053SJohn Snow return 0; 3110fd0e6053SJohn Snow} 3111fd0e6053SJohn SnowEOF 3112fd0e6053SJohn Snow 3113fd0e6053SJohn Snowif ! compile_object "-Werror"; then 3114fd0e6053SJohn Snow ccache_cpp2=yes 3115fd0e6053SJohn Snowfi 3116fd0e6053SJohn Snow 3117b553a042SJohn Snow################################################# 3118b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 3119b553a042SJohn Snow 3120b553a042SJohn Snowif test "$fortify_source" != "no"; then 3121b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 3122b553a042SJohn Snow fortify_source="no"; 3123e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 3124cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 3125b553a042SJohn Snow fortify_source="no"; 3126b553a042SJohn Snow else 3127b553a042SJohn Snow fortify_source="yes" 3128b553a042SJohn Snow fi 3129b553a042SJohn Snowfi 3130b553a042SJohn Snow 3131d2042378SAneesh Kumar K.V########################################## 3132a40161cbSPaolo Bonzini# check for usable membarrier system call 3133a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 3134a40161cbSPaolo Bonzini have_membarrier=no 3135a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 3136a40161cbSPaolo Bonzini have_membarrier=yes 3137a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 3138a40161cbSPaolo Bonzini cat > $TMPC << EOF 3139a40161cbSPaolo Bonzini #include <linux/membarrier.h> 3140a40161cbSPaolo Bonzini #include <sys/syscall.h> 3141a40161cbSPaolo Bonzini #include <unistd.h> 3142a40161cbSPaolo Bonzini #include <stdlib.h> 3143a40161cbSPaolo Bonzini int main(void) { 3144a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 3145a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 3146a40161cbSPaolo Bonzini exit(0); 3147a40161cbSPaolo Bonzini } 3148a40161cbSPaolo BonziniEOF 3149a40161cbSPaolo Bonzini if compile_prog "" "" ; then 3150a40161cbSPaolo Bonzini have_membarrier=yes 3151a40161cbSPaolo Bonzini fi 3152a40161cbSPaolo Bonzini fi 3153a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 3154a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 3155a40161cbSPaolo Bonzini fi 3156a40161cbSPaolo Bonzinielse 3157a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 3158a40161cbSPaolo Bonzini # work on Wine. 3159a40161cbSPaolo Bonzini membarrier=no 3160a40161cbSPaolo Bonzinifi 3161a40161cbSPaolo Bonzini 3162a40161cbSPaolo Bonzini########################################## 3163f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 31644f67366eSThomas Huthhave_afalg=no 3165f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 3166f0d92b56SLongpeng(Mike)#include <errno.h> 3167f0d92b56SLongpeng(Mike)#include <sys/types.h> 3168f0d92b56SLongpeng(Mike)#include <sys/socket.h> 3169f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 3170f0d92b56SLongpeng(Mike)int main(void) { 3171f0d92b56SLongpeng(Mike) int sock; 3172f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 3173f0d92b56SLongpeng(Mike) return sock; 3174f0d92b56SLongpeng(Mike)} 3175f0d92b56SLongpeng(Mike)EOF 3176f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 3177f0d92b56SLongpeng(Mike) have_afalg=yes 3178f0d92b56SLongpeng(Mike)fi 3179f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 3180f0d92b56SLongpeng(Mike)then 3181f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 3182f0d92b56SLongpeng(Mike) then 3183f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 3184f0d92b56SLongpeng(Mike) fi 3185f0d92b56SLongpeng(Mike)fi 3186f0d92b56SLongpeng(Mike) 3187f0d92b56SLongpeng(Mike) 3188db1ed1abSRichard Henderson########################################## 3189247724cbSMarc-André Lureau# checks for sanitizers 3190247724cbSMarc-André Lureau 3191247724cbSMarc-André Lureauhave_asan=no 3192247724cbSMarc-André Lureauhave_ubsan=no 3193d83414e1SMarc-André Lureauhave_asan_iface_h=no 3194d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 3195247724cbSMarc-André Lureau 3196247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 3197b9f44da2SMarc-André Lureau write_c_skeleton 3198247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 3199247724cbSMarc-André Lureau have_asan=yes 3200247724cbSMarc-André Lureau fi 3201b9f44da2SMarc-André Lureau 3202b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 3203b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 3204b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 3205b9f44da2SMarc-André Lureau cat > $TMPC << EOF 3206b9f44da2SMarc-André Lureau#include <stdlib.h> 3207b9f44da2SMarc-André Lureauint main(void) { 3208b9f44da2SMarc-André Lureau void *tmp = malloc(10); 3209f2dfe54cSLeonid Bloch if (tmp != NULL) { 3210b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 3211b9f44da2SMarc-André Lureau } 3212d1abf3fcSOlaf Hering return 1; 3213f2dfe54cSLeonid Bloch} 3214b9f44da2SMarc-André LureauEOF 3215247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 3216247724cbSMarc-André Lureau have_ubsan=yes 3217247724cbSMarc-André Lureau fi 3218d83414e1SMarc-André Lureau 3219d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 3220d83414e1SMarc-André Lureau have_asan_iface_h=yes 3221d83414e1SMarc-André Lureau fi 3222d83414e1SMarc-André Lureau 3223d83414e1SMarc-André Lureau cat > $TMPC << EOF 3224d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 3225d83414e1SMarc-André Lureauint main(void) { 3226d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 3227d83414e1SMarc-André Lureau return 0; 3228d83414e1SMarc-André Lureau} 3229d83414e1SMarc-André LureauEOF 3230d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 3231d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 3232d83414e1SMarc-André Lureau fi 3233247724cbSMarc-André Lureaufi 3234247724cbSMarc-André Lureau 32350aebab04SLingfeng Yang# Thread sanitizer is, for now, much noisier than the other sanitizers; 32360aebab04SLingfeng Yang# keep it separate until that is not the case. 32370aebab04SLingfeng Yangif test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 32380aebab04SLingfeng Yang error_exit "TSAN is not supported with other sanitiziers." 32390aebab04SLingfeng Yangfi 32400aebab04SLingfeng Yanghave_tsan=no 32410aebab04SLingfeng Yanghave_tsan_iface_fiber=no 32420aebab04SLingfeng Yangif test "$tsan" = "yes" ; then 32430aebab04SLingfeng Yang write_c_skeleton 32440aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 32450aebab04SLingfeng Yang have_tsan=yes 32460aebab04SLingfeng Yang fi 32470aebab04SLingfeng Yang cat > $TMPC << EOF 32480aebab04SLingfeng Yang#include <sanitizer/tsan_interface.h> 32490aebab04SLingfeng Yangint main(void) { 32500aebab04SLingfeng Yang __tsan_create_fiber(0); 32510aebab04SLingfeng Yang return 0; 32520aebab04SLingfeng Yang} 32530aebab04SLingfeng YangEOF 32540aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 32550aebab04SLingfeng Yang have_tsan_iface_fiber=yes 32560aebab04SLingfeng Yang fi 32570aebab04SLingfeng Yangfi 32580aebab04SLingfeng Yang 3259adc28027SAlexander Bulekov########################################## 3260675b9b53SMarc-André Lureau# check for slirp 3261675b9b53SMarc-André Lureau 3262675b9b53SMarc-André Lureaucase "$slirp" in 32634d34a86bSPaolo Bonzini auto | enabled | internal) 32644d34a86bSPaolo Bonzini # Simpler to always update submodule, even if not needed. 32657c57bdd8SMarc-André Lureau git_submodules="${git_submodules} slirp" 3266675b9b53SMarc-André Lureau ;; 3267675b9b53SMarc-André Lureauesac 3268675b9b53SMarc-André Lureau 3269b8e0c493SJoelle van Dyne# Check for slirp smbd dupport 3270b8e0c493SJoelle van Dyne: ${smbd=${SMBD-/usr/sbin/smbd}} 3271b8e0c493SJoelle van Dyneif test "$slirp_smbd" != "no" ; then 3272b8e0c493SJoelle van Dyne if test "$mingw32" = "yes" ; then 3273b8e0c493SJoelle van Dyne if test "$slirp_smbd" = "yes" ; then 3274b8e0c493SJoelle van Dyne error_exit "Host smbd not supported on this platform." 3275b8e0c493SJoelle van Dyne fi 3276b8e0c493SJoelle van Dyne slirp_smbd=no 3277b8e0c493SJoelle van Dyne else 3278b8e0c493SJoelle van Dyne slirp_smbd=yes 3279b8e0c493SJoelle van Dyne fi 3280b8e0c493SJoelle van Dynefi 3281b8e0c493SJoelle van Dyne 328254e7aac0SAlexey Krasikov########################################## 328354e7aac0SAlexey Krasikov# check for usable __NR_keyctl syscall 328454e7aac0SAlexey Krasikov 328554e7aac0SAlexey Krasikovif test "$linux" = "yes" ; then 328654e7aac0SAlexey Krasikov 328754e7aac0SAlexey Krasikov have_keyring=no 328854e7aac0SAlexey Krasikov cat > $TMPC << EOF 328954e7aac0SAlexey Krasikov#include <errno.h> 329054e7aac0SAlexey Krasikov#include <asm/unistd.h> 329154e7aac0SAlexey Krasikov#include <linux/keyctl.h> 329254e7aac0SAlexey Krasikov#include <unistd.h> 329354e7aac0SAlexey Krasikovint main(void) { 329454e7aac0SAlexey Krasikov return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 329554e7aac0SAlexey Krasikov} 329654e7aac0SAlexey KrasikovEOF 329754e7aac0SAlexey Krasikov if compile_prog "" "" ; then 329854e7aac0SAlexey Krasikov have_keyring=yes 329954e7aac0SAlexey Krasikov fi 330054e7aac0SAlexey Krasikovfi 330154e7aac0SAlexey Krasikovif test "$secret_keyring" != "no" 330254e7aac0SAlexey Krasikovthen 3303b418d265SDavid Edmondson if test "$have_keyring" = "yes" 330454e7aac0SAlexey Krasikov then 330554e7aac0SAlexey Krasikov secret_keyring=yes 330654e7aac0SAlexey Krasikov else 330754e7aac0SAlexey Krasikov if test "$secret_keyring" = "yes" 330854e7aac0SAlexey Krasikov then 330954e7aac0SAlexey Krasikov error_exit "syscall __NR_keyctl requested, \ 331054e7aac0SAlexey Krasikovbut not implemented on your system" 331154e7aac0SAlexey Krasikov else 331254e7aac0SAlexey Krasikov secret_keyring=no 331354e7aac0SAlexey Krasikov fi 331454e7aac0SAlexey Krasikov fi 331554e7aac0SAlexey Krasikovfi 331654e7aac0SAlexey Krasikov 331792500362SAlexey Krasikov########################################## 3318e86ecd4bSJuan Quintela# End of CC checks 3319e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3320e86ecd4bSJuan Quintela 3321d83414e1SMarc-André Lureauwrite_c_skeleton 3322d83414e1SMarc-André Lureau 33231d728c39SBlue Swirlif test "$gcov" = "yes" ; then 3324bf0e56a3SMarc-André Lureau : 3325b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 3326086d5f75SPaolo Bonzini QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 3327086d5f75SPaolo Bonzini debug=no 3328086d5f75SPaolo Bonzinifi 3329086d5f75SPaolo Bonzini 3330086d5f75SPaolo Bonzinicase "$ARCH" in 3331086d5f75SPaolo Bonzinialpha) 3332086d5f75SPaolo Bonzini # Ensure there's only a single GP 3333086d5f75SPaolo Bonzini QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 3334086d5f75SPaolo Bonzini;; 3335086d5f75SPaolo Bonziniesac 3336086d5f75SPaolo Bonzini 3337086d5f75SPaolo Bonziniif test "$gprof" = "yes" ; then 3338086d5f75SPaolo Bonzini QEMU_CFLAGS="-p $QEMU_CFLAGS" 3339086d5f75SPaolo Bonzini QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 3340086d5f75SPaolo Bonzinifi 3341a316e378SJuan Quintela 3342247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 3343db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 3344db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 3345d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 3346d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 3347d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 3348d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 3349d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 3350d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 3351d83414e1SMarc-André Lureau fi 3352247724cbSMarc-André Lureaufi 33530aebab04SLingfeng Yangif test "$have_tsan" = "yes" ; then 33540aebab04SLingfeng Yang if test "$have_tsan_iface_fiber" = "yes" ; then 33550aebab04SLingfeng Yang QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 33560aebab04SLingfeng Yang QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 33570aebab04SLingfeng Yang else 33580aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing fiber annotation interface." 33590aebab04SLingfeng Yang fi 33600aebab04SLingfeng Yangelif test "$tsan" = "yes" ; then 33610aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing sanitize thread interface." 33620aebab04SLingfeng Yangfi 3363247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 3364db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 3365db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 3366247724cbSMarc-André Lureaufi 3367247724cbSMarc-André Lureau 33686542aa9cSPeter Lieven########################################## 33693efac6ebSTomáš Golembiovský 33700aebab04SLingfeng Yang# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 33710aebab04SLingfeng Yangif test "$solaris" = "no" && test "$tsan" = "no"; then 3372e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 3373db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 3374e86ecd4bSJuan Quintela fi 3375e86ecd4bSJuan Quintelafi 3376e86ecd4bSJuan Quintela 3377952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3378952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3379cb8baa77SMark Cave-Ayland flags="--no-seh --nxcompat" 3380cb8baa77SMark Cave-Ayland 3381cb8baa77SMark Cave-Ayland # Disable ASLR for debug builds to allow debugging with gdb 3382cb8baa77SMark Cave-Ayland if test "$debug" = "no" ; then 3383cb8baa77SMark Cave-Ayland flags="--dynamicbase $flags" 3384cb8baa77SMark Cave-Ayland fi 3385cb8baa77SMark Cave-Ayland 3386cb8baa77SMark Cave-Ayland for flag in $flags; do 3387e9a3591fSChristian Borntraeger if ld_has $flag ; then 3388db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 3389952afb71SBlue Swirl fi 3390952afb71SBlue Swirl done 3391952afb71SBlue Swirlfi 3392952afb71SBlue Swirl 33939d6bc27bSMichael Roth# Probe for guest agent support/options 33949d6bc27bSMichael Roth 3395e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 3396a5125905SLaurent Vivier if [ "$softmmu" = no -a "$want_tools" = no ] ; then 3397a5125905SLaurent Vivier guest_agent=no 3398a5125905SLaurent Vivier elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 3399e8ef31a3SMichael Tokarev guest_agent=yes 3400e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 3401e8ef31a3SMichael Tokarev guest_agent=no 3402e8ef31a3SMichael Tokarev else 3403e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 3404ca35f780SPaolo Bonzini fi 34054b1c11fdSDaniel P. Berrangefi 3406ca35f780SPaolo Bonzini 3407b846ab7cSPaolo Bonzini# Guest agent Windows MSI package 34089d6bc27bSMichael Roth 34099d6bc27bSMichael Rothif test "$QEMU_GA_MANUFACTURER" = ""; then 34109d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 34119d6bc27bSMichael Rothfi 34129d6bc27bSMichael Rothif test "$QEMU_GA_DISTRO" = ""; then 34139d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 34149d6bc27bSMichael Rothfi 34159d6bc27bSMichael Rothif test "$QEMU_GA_VERSION" = ""; then 341689138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 34179d6bc27bSMichael Rothfi 34189d6bc27bSMichael Roth 3419b846ab7cSPaolo BonziniQEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin" 34209d6bc27bSMichael Roth 3421ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3422ca35f780SPaolo Bonziniroms= 3423e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 3424e633a5c6SEric Blake test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 34257000a12eSThomas Huth test "$targetos" != "Haiku" && test "$softmmu" = yes ; then 3426e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 3427c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 3428c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 3429c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 3430e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 3431e57218b6SPeter Maydell ld_i386_emulation="$emu" 3432ca35f780SPaolo Bonzini roms="optionrom" 3433e57218b6SPeter Maydell break 3434e57218b6SPeter Maydell fi 3435e57218b6SPeter Maydell done 3436ca35f780SPaolo Bonzinifi 3437ca35f780SPaolo Bonzini 34382e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 3439a5b2afd5SThomas Huth# or -march=z10 (which is the lowest architecture level that Clang supports) 34409933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 34412e33c3f8SThomas Huth write_c_skeleton 3442a5b2afd5SThomas Huth compile_prog "-march=z900" "" 3443a5b2afd5SThomas Huth has_z900=$? 34443af448b3SThomas Huth if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then 3445a5b2afd5SThomas Huth if [ $has_z900 != 0 ]; then 3446a5b2afd5SThomas Huth echo "WARNING: Your compiler does not support the z900!" 3447a5b2afd5SThomas Huth echo " The s390-ccw bios will only work with guest CPUs >= z10." 3448a5b2afd5SThomas Huth fi 34499933c305SChristian Borntraeger roms="$roms s390-ccw" 34501ef6bfc2SPhilippe Mathieu-Daudé # SLOF is required for building the s390-ccw firmware on s390x, 34511ef6bfc2SPhilippe Mathieu-Daudé # since it is using the libnet code from SLOF for network booting. 34521ef6bfc2SPhilippe Mathieu-Daudé git_submodules="${git_submodules} roms/SLOF" 34531ef6bfc2SPhilippe Mathieu-Daudé fi 34549933c305SChristian Borntraegerfi 34559933c305SChristian Borntraeger 345611cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 345711cde1c8SBruno 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. 345811cde1c8SBruno Dominguezif has $cxx; then 345911cde1c8SBruno Dominguez cat > $TMPC <<EOF 346011cde1c8SBruno Dominguezint c_function(void); 346111cde1c8SBruno Dominguezint main(void) { return c_function(); } 346211cde1c8SBruno DominguezEOF 346311cde1c8SBruno Dominguez 346411cde1c8SBruno Dominguez compile_object 346511cde1c8SBruno Dominguez 346611cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 346711cde1c8SBruno Dominguezextern "C" { 346811cde1c8SBruno Dominguez int c_function(void); 346911cde1c8SBruno Dominguez} 347011cde1c8SBruno Dominguezint c_function(void) { return 42; } 347111cde1c8SBruno DominguezEOF 347211cde1c8SBruno Dominguez 347311cde1c8SBruno Dominguez update_cxxflags 347411cde1c8SBruno Dominguez 34755770e8afSPaolo Bonzini if do_cxx $CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 347611cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 347711cde1c8SBruno Dominguez : 347811cde1c8SBruno Dominguez else 347911cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 348011cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 348111cde1c8SBruno Dominguez cxx= 348211cde1c8SBruno Dominguez fi 348311cde1c8SBruno Dominguezelse 348411cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 348511cde1c8SBruno Dominguez cxx= 348611cde1c8SBruno Dominguezfi 348711cde1c8SBruno Dominguez 34887d7dbf9dSDan Streetmanif !(GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then 34897d7dbf9dSDan Streetman exit 1 34905d91a2edSYonggang Luofi 34915d91a2edSYonggang Luo 349298ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 349397a847bcSbellard 349498ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 349598ec69acSJuan Quintelaecho >> $config_host_mak 349698ec69acSJuan Quintela 3497e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 3498cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 3499aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 35007d7dbf9dSDan Streetmanecho "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak 3501804edf29SJuan Quintela 350298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 3503727e5283SPaolo Bonzini 3504f8393946Saurel32if test "$debug_tcg" = "yes" ; then 35052358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 3506f8393946Saurel32fi 35071625af87Saliguoriif test "$strip_opt" = "yes" ; then 350852ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 35091625af87Saliguorifi 351067b915a5Sbellardif test "$mingw32" = "yes" ; then 351198ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 3512d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 3513d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 3514f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 3515d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 3516d9840e25STomoki Sekiyama fi 351750cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 351876dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 351950cbebb9SMichael Roth fi 35209dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 35219dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 35229dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 35239dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 3524210fa556Spbrookelse 352535f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 3526210fa556Spbrookfi 3527128ab2ffSblueswir1 3528dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 3529dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 3530dffcb71cSMark McLoughlinfi 3531dffcb71cSMark McLoughlin 353283fb7adfSbellardif test "$darwin" = "yes" ; then 353398ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 353483fb7adfSbellardfi 3535b29fe3edSmalc 3536ec530c81Sbellardif test "$solaris" = "yes" ; then 353798ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 3538ec530c81Sbellardfi 3539179cf400SAndreas Färberif test "$haiku" = "yes" ; then 3540179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 3541179cf400SAndreas Färberfi 354297a847bcSbellardif test "$static" = "yes" ; then 354398ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 354497a847bcSbellardfi 35451ba16968SStefan Weilif test "$profiler" = "yes" ; then 35462358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 354705c2a3e7Sbellardfi 3548c932ce31SPaolo Bonziniif test "$want_tools" = "yes" ; then 3549c932ce31SPaolo Bonzini echo "CONFIG_TOOLS=y" >> $config_host_mak 3550c932ce31SPaolo Bonzinifi 3551f15bff25SPaolo Bonziniif test "$guest_agent" = "yes" ; then 3552f15bff25SPaolo Bonzini echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 3553f15bff25SPaolo Bonzinifi 3554b8e0c493SJoelle van Dyneif test "$slirp_smbd" = "yes" ; then 3555b8e0c493SJoelle van Dyne echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak 3556e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3557b8e0c493SJoelle van Dynefi 3558015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 3559015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 3560015a33bdSGongleifi 35614cc600d2SPaolo Bonziniif test "$gprof" = "yes" ; then 35624cc600d2SPaolo Bonzini echo "CONFIG_GPROF=y" >> $config_host_mak 35634cc600d2SPaolo Bonzinifi 3564b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 3565b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 3566e5f05f8cSKevin Wolfif test "$block_drv_whitelist_tools" = "yes" ; then 3567e5f05f8cSKevin Wolf echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak 3568e5f05f8cSKevin Wolffi 3569dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3570dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3571dce512deSChristoph Hellwigfi 357289138857SStefan Weilqemu_version=$(head $source_path/VERSION) 35732358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 357498ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 35752b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 357617969268SFam Zhengif test "$modules" = "yes"; then 3577e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 3578e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 357989138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 358017969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 358117969268SFam Zhengfi 3582bd83c861SChristian Ehrhardtif test "$module_upgrades" = "yes"; then 3583bd83c861SChristian Ehrhardt echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 3584bd83c861SChristian Ehrhardtfi 3585955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 3586955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 3587955727d2SCortland Tölvafi 3588f876b765SMarc-André Lureauif test "$gio" = "yes" ; then 3589f876b765SMarc-André Lureau echo "CONFIG_GIO=y" >> $config_host_mak 3590f876b765SMarc-André Lureau echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 3591f876b765SMarc-André Lureau echo "GIO_LIBS=$gio_libs" >> $config_host_mak 35925ecfb76cSPaolo Bonzinifi 35935ecfb76cSPaolo Bonziniif test "$gdbus_codegen" != "" ; then 359425a97a56SMarc-André Lureau echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 3595f876b765SMarc-André Lureaufi 3596a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 3597277abf15SJan Vesely 35981badb709SPaolo Bonziniif test "$xen" = "enabled" ; then 35996dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3600d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3601582ea95fSMarc-André Lureau echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 3602582ea95fSMarc-André Lureau echo "XEN_LIBS=$xen_libs" >> $config_host_mak 3603e37630caSaliguorifi 36045e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 36055e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 36065e9be92dSNicholas Bellingerfi 3607af3bba76SPaolo Bonziniif test "$vhost_net" = "yes" ; then 3608af3bba76SPaolo Bonzini echo "CONFIG_VHOST_NET=y" >> $config_host_mak 3609af3bba76SPaolo Bonzinifi 3610af3bba76SPaolo Bonziniif test "$vhost_net_user" = "yes" ; then 361156f41de7SPaolo Bonzini echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 361203ce5744SNikolay Nikolaevfi 3613108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" ; then 3614108a6481SCindy Lu echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 3615108a6481SCindy Lufi 3616042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 3617042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 3618042cea27SGongleifi 3619fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 3620fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 36215fe97d88SStefano Garzarella if test "$vhost_user" = "yes" ; then 36225fe97d88SStefano Garzarella echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 36235fe97d88SStefano Garzarella fi 3624fc0b9b0eSStefan Hajnoczifi 3625299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" ; then 3626299e6f19SPaolo Bonzini echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 3627299e6f19SPaolo Bonzinifi 3628e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 3629e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 3630e6a74868SMarc-André Lureaufi 3631108a6481SCindy Luif test "$vhost_vdpa" = "yes" ; then 3632108a6481SCindy Lu echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 3633108a6481SCindy Lufi 363498fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" ; then 363598fc1adaSDr. David Alan Gilbert echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 363698fc1adaSDr. David Alan Gilbertfi 3637a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 3638a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 3639a40161cbSPaolo Bonzinifi 3640e5b46549SRichard Hendersonif test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then 3641e5b46549SRichard Henderson echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 3642e5b46549SRichard Hendersonfi 364358d3f3ffSGerd Hoffmann 3644da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 3645da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 3646de2d3005SPaolo Bonzini echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 3647da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 364820ff075bSMichael Wallefi 364920ff075bSMichael Walle 365099f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 365199f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 365299f2dbd3SLiang Lifi 365399f2dbd3SLiang Li 36546b8cd447SRobert Hooif test "$avx512f_opt" = "yes" ; then 36556b8cd447SRobert Hoo echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 36566b8cd447SRobert Hoofi 36576b8cd447SRobert Hoo 365883fb7adfSbellard# XXX: suppress that 36597d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 36602358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 36617d3505c5Sbellardfi 36627d3505c5Sbellard 36633556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 36643556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 36653556c233SPaolo Bonzinifi 366620ff6c80SAnthony Liguori 36677c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 366870c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 366970c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 367070c60c08SStefan Hajnoczielse 367170c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 367270c60c08SStefan Hajnoczifi 3673d0e2fce5SAneesh Kumar K.V 36747d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 36757d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 36767d992e4dSPeter Lievenfi 36777d992e4dSPeter Lieven 3678f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 3679f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 3680f0d92b56SLongpeng(Mike)fi 3681f0d92b56SLongpeng(Mike) 3682d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 3683d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 3684d83414e1SMarc-André Lureaufi 3685d83414e1SMarc-André Lureau 36860aebab04SLingfeng Yangif test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 36870aebab04SLingfeng Yang echo "CONFIG_TSAN=y" >> $config_host_mak 36880aebab04SLingfeng Yangfi 36890aebab04SLingfeng Yang 369076a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 369176a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 369276a347e1SRichard Hendersonfi 369376a347e1SRichard Henderson 3694f540166bSRichard Hendersonif test "$int128" = "yes" ; then 3695f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 3696f540166bSRichard Hendersonfi 3697f540166bSRichard Henderson 36987ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 36997ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 37007ebee43eSRichard Hendersonfi 37017ebee43eSRichard Henderson 3702e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 3703e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 3704e6cd4bb5SRichard Hendersonfi 3705e6cd4bb5SRichard Henderson 3706b10d49d7SPino Toscanoif test "$libssh" = "yes" ; then 3707484e2cc7SPaolo Bonzini echo "CONFIG_LIBSSH=y" >> $config_host_mak 3708b10d49d7SPino Toscano echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 3709b10d49d7SPino Toscano echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 37100a12ec87SRichard W.M. Jonesfi 37110a12ec87SRichard W.M. Jones 3712ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 3713ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 3714ed1701c6SDr. David Alan Gilbertfi 3715ed1701c6SDr. David Alan Gilbert 37163b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 37173cae16dbSPaolo Bonzini echo 'CONFIG_TPM=y' >> $config_host_mak 37183b8acc11SPaolo Bonzinifi 37193b8acc11SPaolo Bonzini 37202da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 37212da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 3722392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 37232da776dbSMichael R. Hinesfi 37242da776dbSMichael R. Hines 372521ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 372621ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 372721ab34c9SMarcel Apfelbaumfi 372821ab34c9SMarcel Apfelbaum 3729a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 3730a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 3731a6b1d4c0SChanglong Xiefi 3732a6b1d4c0SChanglong Xie 3733ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 3734ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 3735ba59fb77SPaolo Bonzinifi 3736e0580342SKamil Rytarowski 37372f740136SJeff Codyif test "$bochs" = "yes" ; then 37382f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 37392f740136SJeff Codyfi 37402f740136SJeff Codyif test "$cloop" = "yes" ; then 37412f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 37422f740136SJeff Codyfi 37432f740136SJeff Codyif test "$dmg" = "yes" ; then 37442f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 37452f740136SJeff Codyfi 37462f740136SJeff Codyif test "$qcow1" = "yes" ; then 37472f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 37482f740136SJeff Codyfi 37492f740136SJeff Codyif test "$vdi" = "yes" ; then 37502f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 37512f740136SJeff Codyfi 37522f740136SJeff Codyif test "$vvfat" = "yes" ; then 37532f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 37542f740136SJeff Codyfi 37552f740136SJeff Codyif test "$qed" = "yes" ; then 37562f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 37572f740136SJeff Codyfi 37582f740136SJeff Codyif test "$parallels" = "yes" ; then 37592f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 37602f740136SJeff Codyfi 37612f740136SJeff Cody 376240e8c6f4SAlex Bennéeif test "$plugins" = "yes" ; then 376340e8c6f4SAlex Bennée echo "CONFIG_PLUGIN=y" >> $config_host_mak 376426fffe29SEmilio G. Cota # Copy the export object list to the build dir 376526fffe29SEmilio G. Cota if test "$ld_dynamic_list" = "yes" ; then 376626fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 376726fffe29SEmilio G. Cota ld_symbols=qemu-plugins-ld.symbols 376826fffe29SEmilio G. Cota cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 376926fffe29SEmilio G. Cota elif test "$ld_exported_symbols_list" = "yes" ; then 377026fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 377126fffe29SEmilio G. Cota ld64_symbols=qemu-plugins-ld64.symbols 377226fffe29SEmilio G. Cota echo "# Automatically generated by configure - do not modify" > $ld64_symbols 377326fffe29SEmilio G. Cota grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 377426fffe29SEmilio G. Cota sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 377526fffe29SEmilio G. Cota else 377626fffe29SEmilio G. Cota error_exit \ 377726fffe29SEmilio G. Cota "If \$plugins=yes, either \$ld_dynamic_list or " \ 377826fffe29SEmilio G. Cota "\$ld_exported_symbols_list should have been set to 'yes'." 377926fffe29SEmilio G. Cota fi 378040e8c6f4SAlex Bennéefi 378140e8c6f4SAlex Bennée 3782f48e590aSAlex Bennéeif test -n "$gdb_bin"; then 3783b1863cccSAlex Bennée gdb_version=$($gdb_bin --version | head -n 1) 3784d6a66c81SAlex Bennée if version_ge ${gdb_version##* } 9.1; then 3785f48e590aSAlex Bennée echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 3786f48e590aSAlex Bennée fi 3787b1863cccSAlex Bennéefi 3788f48e590aSAlex Bennée 378954e7aac0SAlexey Krasikovif test "$secret_keyring" = "yes" ; then 379054e7aac0SAlexey Krasikov echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 379154e7aac0SAlexey Krasikovfi 379254e7aac0SAlexey Krasikov 379398ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3794804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3795c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 379639d87c8cSAlex Bennéeecho "GENISOIMAGE=$genisoimage" >> $config_host_mak 3797a5665051SPaolo Bonziniecho "MESON=$meson" >> $config_host_mak 379809e93326SPaolo Bonziniecho "NINJA=$ninja" >> $config_host_mak 3799804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 3800433de74cSBastian Koppelmannecho "HOST_CC=$host_cc" >> $config_host_mak 3801a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 3802859aef02SPaolo Bonzini echo "CONFIG_IASL=$iasl" >> $config_host_mak 3803a31a8642SMichael S. Tsirkinfi 3804804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3805cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 38065f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 38073dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 3808804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3809804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 381046eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 3811a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 381211cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 3813a81df1b6SPaolo Bonziniecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3814a81df1b6SPaolo Bonziniecho "GLIB_LIBS=$glib_libs" >> $config_host_mak 38158a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 3816e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 3817804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3818f15bff25SPaolo Bonziniecho "LIBS_QGA=$libs_qga" >> $config_host_mak 3819804edf29SJuan Quintela 3820b767d257SMarek Marczykowski-Góreckiif test "$rng_none" = "yes"; then 3821b767d257SMarek Marczykowski-Górecki echo "CONFIG_RNG_NONE=y" >> $config_host_mak 3822b767d257SMarek Marczykowski-Góreckifi 3823b767d257SMarek Marczykowski-Górecki 38246efd7517SPeter Maydell# use included Linux headers 38256efd7517SPeter Maydellif test "$linux" = "yes" ; then 3826a307beb6SAndreas Färber mkdir -p linux-headers 38276efd7517SPeter Maydell case "$cpu" in 3828c72b26ecSRichard Henderson i386|x86_64|x32) 382908312a63SPeter Maydell linux_arch=x86 38306efd7517SPeter Maydell ;; 3831f8378accSRichard Henderson ppc|ppc64|ppc64le) 383208312a63SPeter Maydell linux_arch=powerpc 38336efd7517SPeter Maydell ;; 38346efd7517SPeter Maydell s390x) 383508312a63SPeter Maydell linux_arch=s390 383608312a63SPeter Maydell ;; 38371f080313SClaudio Fontana aarch64) 38381f080313SClaudio Fontana linux_arch=arm64 38391f080313SClaudio Fontana ;; 3840222e7d11SSanjay Lal mips64) 3841222e7d11SSanjay Lal linux_arch=mips 3842222e7d11SSanjay Lal ;; 384308312a63SPeter Maydell *) 384408312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 384508312a63SPeter Maydell linux_arch="$cpu" 38466efd7517SPeter Maydell ;; 38476efd7517SPeter Maydell esac 384808312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 384908312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 385008312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 385108312a63SPeter Maydell fi 38526efd7517SPeter Maydellfi 38536efd7517SPeter Maydell 385497a847bcSbellardfor target in $target_list; do 385597a847bcSbellard target_dir="$target" 385689138857SStefan Weil target_name=$(echo $target | cut -d '-' -f 1) 385797a847bcSbellard mkdir -p $target_dir 3858fdb75aefSPaolo Bonzini case $target in 3859fdb75aefSPaolo Bonzini *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; 3860fdb75aefSPaolo Bonzini *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; 38612408a527Saurel32 esac 386256aebc89Spbrookdone 38637d13299dSbellard 3864765686d6SPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak 3865fdb75aefSPaolo Bonziniif test "$default_targets" = "yes"; then 3866fdb75aefSPaolo Bonzini echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 3867fdb75aefSPaolo Bonzinifi 3868a540f158SPeter Crosthwaite 3869a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 3870a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 3871ab318051SMarc-André Lureau echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 3872a99d57bbSWanlong Gaofi 3873a99d57bbSWanlong Gao 3874fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 3875fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 3876fd0e6053SJohn Snowfi 3877fd0e6053SJohn Snow 38781e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 38791e4f6065SDaniele Buono echo "CONFIG_SAFESTACK=y" >> $config_host_mak 38801e4f6065SDaniele Buonofi 38811e4f6065SDaniele Buono 3882e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 3883e29e5c6eSPeter Maydell# DIRS are directories which we simply mkdir in the build tree; 3884e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 3885e29e5c6eSPeter Maydell# (these can be both files and directories). 3886e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 3887e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 3888e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 3889e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 3890e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 3891e29e5c6eSPeter Maydell# directory and symlink the directory instead. 389209db9b9dSGerd Hoffmann# UNLINK is used to remove symlinks from older development versions 389309db9b9dSGerd Hoffmann# that might get into the way when doing "git update" without doing 389409db9b9dSGerd Hoffmann# a "make distclean" in between. 38959d49bcf6SMarkus ArmbrusterDIRS="tests tests/tcg tests/qapi-schema tests/qtest/libqos" 38961cf4323eSThomas HuthDIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 3897b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 3898744a928cSAlexey KardashevskiyDIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 38998db2a4fdSGerd HoffmannDIRS="$DIRS roms/seabios" 3900c17a386bSAlex BennéeDIRS="$DIRS contrib/plugins/" 39012038f8c8SPaolo BonziniLINKS="Makefile" 39023941996bSPaolo BonziniLINKS="$LINKS tests/tcg/Makefile.target" 3903ddcf607fSGerd HoffmannLINKS="$LINKS pc-bios/optionrom/Makefile" 3904e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 39058db2a4fdSGerd HoffmannLINKS="$LINKS roms/seabios/Makefile" 3906e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 3907e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 390839950353SPeter MaydellLINKS="$LINKS tests/acceptance tests/data" 390939950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 39108f8fd9edSCleber RosaLINKS="$LINKS python" 3911c17a386bSAlex BennéeLINKS="$LINKS contrib/plugins/Makefile " 391209db9b9dSGerd HoffmannUNLINK="pc-bios/keymaps" 3913753d11f2SRichard Hendersonfor bios_file in \ 3914753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 39153a631b8eSBin Meng $source_path/pc-bios/*.elf \ 3916225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 3917753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 3918753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 3919e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 3920753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 39214e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 392226ce90fdSLaszlo Ersek $source_path/pc-bios/edk2-*.fd.bz2 \ 3923cd946e5cSJohn Arbuckle $source_path/pc-bios/palcode-* \ 3924cd946e5cSJohn Arbuckle $source_path/pc-bios/qemu_vga.ndrv 3925cd946e5cSJohn Arbuckle 3926753d11f2SRichard Hendersondo 3927e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 39287ea78b74SJan Kiszkadone 3929d1807a4fSPaolo Bonzinimkdir -p $DIRS 3930e29e5c6eSPeter Maydellfor f in $LINKS ; do 39310f4d8894SPaolo Bonzini if [ -e "$source_path/$f" ]; then 3932f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 3933f9245e10SPeter Maydell fi 39347d13299dSbellarddone 393509db9b9dSGerd Hoffmannfor f in $UNLINK ; do 393609db9b9dSGerd Hoffmann if [ -L "$f" ]; then 393709db9b9dSGerd Hoffmann rm -f "$f" 393809db9b9dSGerd Hoffmann fi 393909db9b9dSGerd Hoffmanndone 39401ad2134fSPaul Brook 39412038f8c8SPaolo Bonzini(for i in $cross_cc_vars; do 39422038f8c8SPaolo Bonzini export $i 39432038f8c8SPaolo Bonzinidone 3944de6d7e6bSAlex Bennéeexport target_list source_path use_containers ARCH 39452038f8c8SPaolo Bonzini$source_path/tests/tcg/configure.sh) 39462038f8c8SPaolo Bonzini 3947c34ebfdcSAnthony Liguori# temporary config to build submodules 39488db2a4fdSGerd Hoffmannfor rom in seabios; do 3949c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 395037116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3951c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3952cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 39535f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 3954c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3955c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 39563dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 3957c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3958a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 3959c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 39609f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 3961c34ebfdcSAnthony Liguoridone 3962c34ebfdcSAnthony Liguori 3963a5665051SPaolo Bonziniif test "$skip_meson" = no; then 3964fc929892SMarc-André Lureau cross="config-meson.cross.new" 3965fc929892SMarc-André Lureau meson_quote() { 396647b30835SPaolo Bonzini echo "'$(echo $* | sed "s/ /','/g")'" 3967fc929892SMarc-André Lureau } 3968fc929892SMarc-André Lureau 3969fc929892SMarc-André Lureau echo "# Automatically generated by configure - do not modify" > $cross 3970fc929892SMarc-André Lureau echo "[properties]" >> $cross 3971d1d5e9eeSAlex Bennée 3972d1d5e9eeSAlex Bennée # unroll any custom device configs 3973d1d5e9eeSAlex Bennée for a in $device_archs; do 3974d1d5e9eeSAlex Bennée eval "c=\$devices_${a}" 3975d1d5e9eeSAlex Bennée echo "${a}-softmmu = '$c'" >> $cross 3976d1d5e9eeSAlex Bennée done 3977d1d5e9eeSAlex Bennée 3978fc929892SMarc-André Lureau test -z "$cxx" && echo "link_language = 'c'" >> $cross 397947b30835SPaolo Bonzini echo "[built-in options]" >> $cross 398047b30835SPaolo Bonzini echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross 398147b30835SPaolo Bonzini echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross 398247b30835SPaolo Bonzini echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 398347b30835SPaolo Bonzini echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 3984fc929892SMarc-André Lureau echo "[binaries]" >> $cross 39854dba2789SPaolo Bonzini echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross 39864dba2789SPaolo Bonzini test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross 39874dba2789SPaolo Bonzini test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross 398847b30835SPaolo Bonzini echo "ar = [$(meson_quote $ar)]" >> $cross 398947b30835SPaolo Bonzini echo "nm = [$(meson_quote $nm)]" >> $cross 399047b30835SPaolo Bonzini echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross 399147b30835SPaolo Bonzini echo "ranlib = [$(meson_quote $ranlib)]" >> $cross 3992e8178514SPaolo Bonzini if has $sdl2_config; then 399347b30835SPaolo Bonzini echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 3994e8178514SPaolo Bonzini fi 399547b30835SPaolo Bonzini echo "strip = [$(meson_quote $strip)]" >> $cross 399647b30835SPaolo Bonzini echo "windres = [$(meson_quote $windres)]" >> $cross 39973812c0c4SJoelle van Dyne if test "$cross_compile" = "yes"; then 3998fc929892SMarc-André Lureau cross_arg="--cross-file config-meson.cross" 3999fc929892SMarc-André Lureau echo "[host_machine]" >> $cross 4000fc929892SMarc-André Lureau if test "$mingw32" = "yes" ; then 4001fc929892SMarc-André Lureau echo "system = 'windows'" >> $cross 4002fc929892SMarc-André Lureau fi 4003853b4bafSThomas Huth if test "$linux" = "yes" ; then 4004853b4bafSThomas Huth echo "system = 'linux'" >> $cross 4005853b4bafSThomas Huth fi 40060ca321eaSJoelle van Dyne if test "$darwin" = "yes" ; then 40070ca321eaSJoelle van Dyne echo "system = 'darwin'" >> $cross 40080ca321eaSJoelle van Dyne fi 4009fc929892SMarc-André Lureau case "$ARCH" in 4010f6bca9dfSJoelle van Dyne i386) 4011fc929892SMarc-André Lureau echo "cpu_family = 'x86'" >> $cross 4012fc929892SMarc-André Lureau ;; 4013f8bb7e1cSDavid Michael x86_64|x32) 4014f6bca9dfSJoelle van Dyne echo "cpu_family = 'x86_64'" >> $cross 4015f6bca9dfSJoelle van Dyne ;; 4016fc929892SMarc-André Lureau ppc64le) 4017fc929892SMarc-André Lureau echo "cpu_family = 'ppc64'" >> $cross 4018fc929892SMarc-André Lureau ;; 4019fc929892SMarc-André Lureau *) 4020fc929892SMarc-André Lureau echo "cpu_family = '$ARCH'" >> $cross 4021fc929892SMarc-André Lureau ;; 4022fc929892SMarc-André Lureau esac 4023fc929892SMarc-André Lureau echo "cpu = '$cpu'" >> $cross 4024fc929892SMarc-André Lureau if test "$bigendian" = "yes" ; then 4025fc929892SMarc-André Lureau echo "endian = 'big'" >> $cross 4026fc929892SMarc-André Lureau else 4027fc929892SMarc-André Lureau echo "endian = 'little'" >> $cross 4028fc929892SMarc-André Lureau fi 4029fc929892SMarc-André Lureau else 4030fc929892SMarc-André Lureau cross_arg="--native-file config-meson.cross" 4031fc929892SMarc-André Lureau fi 4032fc929892SMarc-André Lureau mv $cross config-meson.cross 4033fc929892SMarc-André Lureau 4034a5665051SPaolo Bonzini rm -rf meson-private meson-info meson-logs 403561d63097SPaolo Bonzini run_meson() { 403609e93326SPaolo Bonzini NINJA=$ninja $meson setup \ 4037d17f305aSPaolo Bonzini --prefix "$prefix" \ 4038d17f305aSPaolo Bonzini --libdir "$libdir" \ 4039d17f305aSPaolo Bonzini --libexecdir "$libexecdir" \ 4040d17f305aSPaolo Bonzini --bindir "$bindir" \ 4041d17f305aSPaolo Bonzini --includedir "$includedir" \ 4042d17f305aSPaolo Bonzini --datadir "$datadir" \ 4043d17f305aSPaolo Bonzini --mandir "$mandir" \ 4044d17f305aSPaolo Bonzini --sysconfdir "$sysconfdir" \ 404516bf7a33SPaolo Bonzini --localedir "$localedir" \ 4046d17f305aSPaolo Bonzini --localstatedir "$local_statedir" \ 4047*3b4da132SPaolo Bonzini -Daudio_drv_list=$audio_drv_list \ 4048*3b4da132SPaolo Bonzini -Ddefault_devices=$default_devices \ 4049d17f305aSPaolo Bonzini -Ddocdir="$docdir" \ 405016bf7a33SPaolo Bonzini -Dqemu_firmwarepath="$firmwarepath" \ 405173f3aa37SMarc-André Lureau -Dqemu_suffix="$qemu_suffix" \ 4052*3b4da132SPaolo Bonzini -Dsphinx_build="$sphinx_build" \ 4053*3b4da132SPaolo Bonzini -Dtrace_file="$trace_file" \ 4054a5665051SPaolo Bonzini -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 4055a5665051SPaolo Bonzini -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 4056a5665051SPaolo Bonzini -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 4057a5665051SPaolo Bonzini -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 4058da6d48b9SMarc-André Lureau -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 4059bf0e56a3SMarc-André Lureau -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 4060*3b4da132SPaolo Bonzini -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \ 4061*3b4da132SPaolo Bonzini -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \ 4062537b7248SPaolo Bonzini $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \ 4063332008e0SThomas Huth $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \ 406461d63097SPaolo Bonzini "$@" $cross_arg "$PWD" "$source_path" 406561d63097SPaolo Bonzini } 406661d63097SPaolo Bonzini eval run_meson $meson_options 4067a5665051SPaolo Bonzini if test "$?" -ne 0 ; then 4068a5665051SPaolo Bonzini error_exit "meson setup failed" 4069a5665051SPaolo Bonzini fi 4070699d3884SPaolo Bonzinielse 4071699d3884SPaolo Bonzini if test -f meson-private/cmd_line.txt; then 4072699d3884SPaolo Bonzini # Adjust old command line options whose type was changed 4073699d3884SPaolo Bonzini # Avoids having to use "setup --wipe" when Meson is upgraded 4074699d3884SPaolo Bonzini perl -i -ne ' 4075699d3884SPaolo Bonzini s/^gettext = true$/gettext = auto/; 4076699d3884SPaolo Bonzini s/^gettext = false$/gettext = disabled/; 4077654d6b04SPaolo Bonzini /^b_staticpic/ && next; 4078699d3884SPaolo Bonzini print;' meson-private/cmd_line.txt 4079699d3884SPaolo Bonzini fi 4080a5665051SPaolo Bonzinifi 4081a5665051SPaolo Bonzini 40822d838d9bSAlex Bennéeif test -n "${deprecated_features}"; then 40832d838d9bSAlex Bennée echo "Warning, deprecated features enabled." 4084a476b216SMao Zhongyi echo "Please see docs/about/deprecated.rst" 40852d838d9bSAlex Bennée echo " features: ${deprecated_features}" 40862d838d9bSAlex Bennéefi 40872d838d9bSAlex Bennée 4088e0447a83SThomas Huth# Create list of config switches that should be poisoned in common code... 4089e0447a83SThomas Huth# but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special. 409054b0306eSThomas Huthtarget_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null) 409154b0306eSThomas Huthif test -n "$target_configs_h" ; then 4092e0447a83SThomas Huth sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \ 4093e0447a83SThomas Huth -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \ 409454b0306eSThomas Huth $target_configs_h | sort -u > config-poison.h 409554b0306eSThomas Huthelse 409654b0306eSThomas Huth :> config-poison.h 409754b0306eSThomas Huthfi 4098e0447a83SThomas Huth 4099dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 4100dc655404SMichael S. Tsirkincat <<EOD >config.status 4101dc655404SMichael S. Tsirkin#!/bin/sh 4102dc655404SMichael S. Tsirkin# Generated by configure. 4103dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 4104dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 4105dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 4106dc655404SMichael S. TsirkinEOD 4107e811da7fSDaniel P. Berrangé 4108e811da7fSDaniel P. Berrangépreserve_env() { 4109e811da7fSDaniel P. Berrangé envname=$1 4110e811da7fSDaniel P. Berrangé 4111e811da7fSDaniel P. Berrangé eval envval=\$$envname 4112e811da7fSDaniel P. Berrangé 4113e811da7fSDaniel P. Berrangé if test -n "$envval" 4114e811da7fSDaniel P. Berrangé then 4115e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 4116e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 4117e811da7fSDaniel P. Berrangé else 4118e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 4119e811da7fSDaniel P. Berrangé fi 4120e811da7fSDaniel P. Berrangé} 4121e811da7fSDaniel P. Berrangé 4122e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 4123e811da7fSDaniel P. Berrangé# features/build target configure will detect 4124e811da7fSDaniel P. Berrangépreserve_env AR 4125e811da7fSDaniel P. Berrangépreserve_env AS 4126e811da7fSDaniel P. Berrangépreserve_env CC 4127e811da7fSDaniel P. Berrangépreserve_env CPP 4128e811da7fSDaniel P. Berrangépreserve_env CXX 4129e811da7fSDaniel P. Berrangépreserve_env INSTALL 4130e811da7fSDaniel P. Berrangépreserve_env LD 4131e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 4132e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 4133e811da7fSDaniel P. Berrangépreserve_env MAKE 4134e811da7fSDaniel P. Berrangépreserve_env NM 4135e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 4136e811da7fSDaniel P. Berrangépreserve_env PATH 4137e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 4138e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 4139e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 4140e811da7fSDaniel P. Berrangépreserve_env PYTHON 4141e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 4142e811da7fSDaniel P. Berrangépreserve_env SMBD 4143e811da7fSDaniel P. Berrangépreserve_env STRIP 4144e811da7fSDaniel P. Berrangépreserve_env WINDRES 4145e811da7fSDaniel P. Berrangé 4146dc655404SMichael S. Tsirkinprintf "exec" >>config.status 4147a5665051SPaolo Bonzinifor i in "$0" "$@"; do 4148835af899SPaolo Bonzini test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status 4149a5665051SPaolo Bonzinidone 4150cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 4151dc655404SMichael S. Tsirkinchmod +x config.status 4152dc655404SMichael S. Tsirkin 41538cd05ab6SPeter Maydellrm -r "$TMPDIR1" 4154