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" 817d13299dSbellard 82da1d85e3SGerd Hoffmannrm -f config.log 839ac81bbbSmalc 84b48e3611SPeter Maydell# Print a helpful header at the top of config.log 85b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 86979ae168SPeter Maydellprintf "# Configured with:" >> config.log 87979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 88979ae168SPeter Maydellecho >> config.log 89b48e3611SPeter Maydellecho "#" >> config.log 90b48e3611SPeter Maydell 91835af899SPaolo Bonziniquote_sh() { 92835af899SPaolo Bonzini printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," 93835af899SPaolo Bonzini} 94835af899SPaolo Bonzini 95d880a3baSPaolo Bonziniprint_error() { 96d880a3baSPaolo Bonzini (echo 9776ad07a4SPeter Maydell echo "ERROR: $1" 9876ad07a4SPeter Maydell while test -n "$2"; do 9976ad07a4SPeter Maydell echo " $2" 10076ad07a4SPeter Maydell shift 10176ad07a4SPeter Maydell done 102d880a3baSPaolo Bonzini echo) >&2 103d880a3baSPaolo Bonzini} 104d880a3baSPaolo Bonzini 105d880a3baSPaolo Bonzinierror_exit() { 106d880a3baSPaolo Bonzini print_error "$@" 10776ad07a4SPeter Maydell exit 1 10876ad07a4SPeter Maydell} 10976ad07a4SPeter Maydell 1109c83ffd8SPeter Maydelldo_compiler() { 1119c83ffd8SPeter Maydell # Run the compiler, capturing its output to the log. First argument 1129c83ffd8SPeter Maydell # is compiler binary to execute. 113630d86b7SDavid CARLIER compiler="$1" 1149c83ffd8SPeter Maydell shift 1158bbe05d7SIan Jackson if test -n "$BASH_VERSION"; then eval ' 1168bbe05d7SIan Jackson echo >>config.log " 1178bbe05d7SIan Jacksonfuncs: ${FUNCNAME[*]} 1188bbe05d7SIan Jacksonlines: ${BASH_LINENO[*]}" 1198bbe05d7SIan Jackson '; fi 1209c83ffd8SPeter Maydell echo $compiler "$@" >> config.log 1219c83ffd8SPeter Maydell $compiler "$@" >> config.log 2>&1 || return $? 1228dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 1238dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 1248dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 1258dc38a78SPeter Maydell # obvious to developers. 1268dc38a78SPeter Maydell if test "$werror" != "yes"; then 1278dc38a78SPeter Maydell return 0 1288dc38a78SPeter Maydell fi 1298dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 1308dc38a78SPeter Maydell case "$*" in 1318dc38a78SPeter Maydell *-Werror*) 1328dc38a78SPeter Maydell return 0 1338dc38a78SPeter Maydell ;; 1348dc38a78SPeter Maydell esac 1359c83ffd8SPeter Maydell echo $compiler -Werror "$@" >> config.log 1369c83ffd8SPeter Maydell $compiler -Werror "$@" >> config.log 2>&1 && return $? 13776ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 13876ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 13976ad07a4SPeter Maydell "will be at the bottom of config.log." \ 14076ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 1418dc38a78SPeter Maydell} 1428dc38a78SPeter Maydell 1439c83ffd8SPeter Maydelldo_cc() { 1444dba2789SPaolo Bonzini do_compiler "$cc" $CPU_CFLAGS "$@" 1459c83ffd8SPeter Maydell} 1469c83ffd8SPeter Maydell 1479c83ffd8SPeter Maydelldo_cxx() { 1484dba2789SPaolo Bonzini do_compiler "$cxx" $CPU_CFLAGS "$@" 1499c83ffd8SPeter Maydell} 1509c83ffd8SPeter Maydell 15100849b92SRichard Henderson# Append $2 to the variable named $1, with space separation 15200849b92SRichard Hendersonadd_to() { 15300849b92SRichard Henderson eval $1=\${$1:+\"\$$1 \"}\$2 15400849b92SRichard Henderson} 15500849b92SRichard Henderson 1569c83ffd8SPeter Maydellupdate_cxxflags() { 1579c83ffd8SPeter Maydell # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 1589c83ffd8SPeter Maydell # options which some versions of GCC's C++ compiler complain about 1599c83ffd8SPeter Maydell # because they only make sense for C programs. 160de38c0ccSPaolo Bonzini QEMU_CXXFLAGS="-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 1618a9d3d56SRichard Henderson CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu11/-std=gnu++11/) 1629c83ffd8SPeter Maydell for arg in $QEMU_CFLAGS; do 1639c83ffd8SPeter Maydell case $arg in 1649c83ffd8SPeter Maydell -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 1659c83ffd8SPeter Maydell -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 1669c83ffd8SPeter Maydell ;; 1679c83ffd8SPeter Maydell *) 1689c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1699c83ffd8SPeter Maydell ;; 1709c83ffd8SPeter Maydell esac 1719c83ffd8SPeter Maydell done 1729c83ffd8SPeter Maydell} 1739c83ffd8SPeter Maydell 17452166aa0SJuan Quintelacompile_object() { 175fd0e6053SJohn Snow local_cflags="$1" 176a2866660SPaolo Bonzini do_cc $CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 17752166aa0SJuan Quintela} 17852166aa0SJuan Quintela 17952166aa0SJuan Quintelacompile_prog() { 18052166aa0SJuan Quintela local_cflags="$1" 18152166aa0SJuan Quintela local_ldflags="$2" 182a2866660SPaolo Bonzini do_cc $CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \ 183a2866660SPaolo Bonzini $LDFLAGS $EXTRA_LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags 18452166aa0SJuan Quintela} 18552166aa0SJuan Quintela 18611568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 18711568d6dSPaolo Bonzinisymlink() { 18872b8b5a1SStefan Weil rm -rf "$2" 189ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 19072b8b5a1SStefan Weil ln -s "$1" "$2" 19111568d6dSPaolo Bonzini} 19211568d6dSPaolo Bonzini 1930dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1940dba6195SLoïc Minier# executable or a builtin) 1950dba6195SLoïc Minierhas() { 1960dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1970dba6195SLoïc Minier} 1980dba6195SLoïc Minier 1990a01d76fSMarc-André Lureauversion_ge () { 2002df52b9bSAlex Bennée local_ver1=$(expr "$1" : '\([0-9.]*\)' | tr . ' ') 2012df52b9bSAlex Bennée local_ver2=$(echo "$2" | tr . ' ') 2020a01d76fSMarc-André Lureau while true; do 2030a01d76fSMarc-André Lureau set x $local_ver1 2040a01d76fSMarc-André Lureau local_first=${2-0} 205c44a33e2SStefano Garzarella # 'shift 2' if $2 is set, or 'shift' if $2 is not set 206c44a33e2SStefano Garzarella shift ${2:+2} 2070a01d76fSMarc-André Lureau local_ver1=$* 2080a01d76fSMarc-André Lureau set x $local_ver2 2090a01d76fSMarc-André Lureau # the second argument finished, the first must be greater or equal 2100a01d76fSMarc-André Lureau test $# = 1 && return 0 2110a01d76fSMarc-André Lureau test $local_first -lt $2 && return 1 2120a01d76fSMarc-André Lureau test $local_first -gt $2 && return 0 213c44a33e2SStefano Garzarella shift ${2:+2} 2140a01d76fSMarc-André Lureau local_ver2=$* 2150a01d76fSMarc-André Lureau done 2160a01d76fSMarc-André Lureau} 2170a01d76fSMarc-André Lureau 2183b6b7550SPaolo Bonziniglob() { 2193b6b7550SPaolo Bonzini eval test -z '"${1#'"$2"'}"' 2203b6b7550SPaolo Bonzini} 2213b6b7550SPaolo Bonzini 222e9a3591fSChristian Borntraegerld_has() { 223e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 224e9a3591fSChristian Borntraeger} 225e9a3591fSChristian Borntraeger 2264ace32e2SAntonio Ospiteif printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 2274ace32e2SAntonio Ospitethen 2284ace32e2SAntonio Ospite error_exit "main directory cannot contain spaces nor colons" 2294ace32e2SAntonio Ospitefi 2304ace32e2SAntonio Ospite 23114211825SAntonio Ospite# default parameters 2322ff6b91eSJuan Quintelacpu="" 233a31a8642SMichael S. Tsirkiniasl="iasl" 2341e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 23543ce4dfeSbellardstatic="no" 2363812c0c4SJoelle van Dynecross_compile="no" 2377d13299dSbellardcross_prefix="" 23887430d5bSPaolo Bonziniaudio_drv_list="default" 239b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 240b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 241e5f05f8cSKevin Wolfblock_drv_whitelist_tools="no" 242e49d021eSPeter Maydellhost_cc="cc" 243957f1f99SMichael Rothlibs_qga="" 2445bc62e01SGerd Hoffmanndebug_info="yes" 245cdad781dSDaniele Buonolto="false" 24663678e17SSteven Noonanstack_protector="" 2471e4f6065SDaniele Buonosafe_stack="" 248afc3a8f9SAlex Bennéeuse_containers="yes" 249f2385398SAlex Bennéegdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 250ac0df51dSaliguori 25192712822SDaniel P. Berrangeif test -e "$source_path/.git" 25292712822SDaniel P. Berrangethen 2537d7dbf9dSDan Streetman git_submodules_action="update" 25492712822SDaniel P. Berrangeelse 2557d7dbf9dSDan Streetman git_submodules_action="ignore" 25692712822SDaniel P. Berrangefi 2572d652f24SPaolo Bonzini 2582d652f24SPaolo Bonzinigit_submodules="ui/keycodemapdb" 259cc84d63aSDaniel P. Berrangegit="git" 260ac0df51dSaliguori 261afb63ebdSStefan Weil# Don't accept a target_list environment variable. 262afb63ebdSStefan Weilunset target_list 263447e133fSAlex Bennéeunset target_list_exclude 264377529c0SPaolo Bonzini 265377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 266377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 267377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 268377529c0SPaolo Bonzini# unless --disable-foo is given 269377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 270377529c0SPaolo Bonzini# feature will searched for, 271377529c0SPaolo Bonzini# if not found, configure exits with error 272377529c0SPaolo Bonzini# 273377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 274377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 275377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 276377529c0SPaolo Bonzini 277c87ea116SAlex Bennéedefault_feature="" 278c87ea116SAlex Bennée# parse CC options second 279c87ea116SAlex Bennéefor opt do 280c87ea116SAlex Bennée optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 281c87ea116SAlex Bennée case "$opt" in 282c87ea116SAlex Bennée --without-default-features) 283c87ea116SAlex Bennée default_feature="no" 284c87ea116SAlex Bennée ;; 285c87ea116SAlex Bennée esac 286c87ea116SAlex Bennéedone 287c87ea116SAlex Bennée 288a2866660SPaolo BonziniEXTRA_CFLAGS="" 289a2866660SPaolo BonziniEXTRA_CXXFLAGS="" 290a2866660SPaolo BonziniEXTRA_LDFLAGS="" 291a2866660SPaolo Bonzini 292c87ea116SAlex Bennéexen_ctrl_version="$default_feature" 293c87ea116SAlex Bennéemembarrier="$default_feature" 2940848f8acSThomas Huthvhost_kernel="$default_feature" 295c87ea116SAlex Bennéevhost_net="$default_feature" 296c87ea116SAlex Bennéevhost_crypto="$default_feature" 297c87ea116SAlex Bennéevhost_scsi="$default_feature" 298c87ea116SAlex Bennéevhost_vsock="$default_feature" 299d88618f7SStefan Hajnoczivhost_user="no" 300c87ea116SAlex Bennéevhost_user_fs="$default_feature" 3010848f8acSThomas Huthvhost_vdpa="$default_feature" 302c87ea116SAlex Bennéerdma="$default_feature" 303c87ea116SAlex Bennéepvrdma="$default_feature" 304377529c0SPaolo Bonzinigprof="no" 305377529c0SPaolo Bonzinidebug_tcg="no" 306377529c0SPaolo Bonzinidebug="no" 307247724cbSMarc-André Lureausanitizers="no" 3080aebab04SLingfeng Yangtsan="no" 309c87ea116SAlex Bennéefortify_source="$default_feature" 310377529c0SPaolo Bonzinistrip_opt="yes" 311377529c0SPaolo Bonzinimingw32="no" 3121d728c39SBlue Swirlgcov="no" 313c7328271SMiroslav RezaninaEXESUF="" 31417969268SFam Zhengmodules="no" 315bd83c861SChristian Ehrhardtmodule_upgrades="no" 316377529c0SPaolo Bonziniprefix="/usr/local" 31710ff82d1SMarc-André Lureauqemu_suffix="qemu" 318377529c0SPaolo Bonzinibsd="no" 319377529c0SPaolo Bonzinilinux="no" 320377529c0SPaolo Bonzinisolaris="no" 321377529c0SPaolo Bonziniprofiler="no" 322377529c0SPaolo Bonzinisoftmmu="yes" 323377529c0SPaolo Bonzinilinux_user="no" 324377529c0SPaolo Bonzinibsd_user="no" 325377529c0SPaolo Bonzinipkgversion="" 32640d6444eSAvi Kivitypie="" 3273556c233SPaolo Bonziniqom_cast_debug="yes" 328baf86d6bSPaolo Bonzinitrace_backends="log" 329377529c0SPaolo Bonzinitrace_file="trace" 330c87ea116SAlex Bennéeopengl="$default_feature" 3315dd89908SRichard Hendersoncpuid_h="no" 332c87ea116SAlex Bennéeavx2_opt="$default_feature" 333c87ea116SAlex Bennéeguest_agent="$default_feature" 334d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 33550cbebb9SMichael Rothguest_agent_ntddscsi="no" 336c87ea116SAlex Bennéevss_win32_sdk="$default_feature" 337d9840e25STomoki Sekiyamawin_sdk="no" 338c87ea116SAlex Bennéewant_tools="$default_feature" 339519175a2SAlex Barcelocoroutine="" 340c87ea116SAlex Bennéecoroutine_pool="$default_feature" 3417d992e4dSPeter Lievendebug_stack_usage="no" 342f0d92b56SLongpeng(Mike)crypto_afalg="no" 343a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 344c87ea116SAlex Bennéetpm="$default_feature" 345c87ea116SAlex Bennéelive_block_migration=${default_feature:-yes} 346c87ea116SAlex Bennéenuma="$default_feature" 347c87ea116SAlex Bennéereplication=${default_feature:-yes} 348c87ea116SAlex Bennéebochs=${default_feature:-yes} 349c87ea116SAlex Bennéecloop=${default_feature:-yes} 350c87ea116SAlex Bennéedmg=${default_feature:-yes} 351c87ea116SAlex Bennéeqcow1=${default_feature:-yes} 352c87ea116SAlex Bennéevdi=${default_feature:-yes} 353c87ea116SAlex Bennéevvfat=${default_feature:-yes} 354c87ea116SAlex Bennéeqed=${default_feature:-yes} 355c87ea116SAlex Bennéeparallels=${default_feature:-yes} 356ba59fb77SPaolo Bonzinidebug_mutex="no" 357ba4dd2aaSAlex Bennéeplugins="$default_feature" 358b767d257SMarek Marczykowski-Góreckirng_none="no" 359c87ea116SAlex Bennéesecret_keyring="$default_feature" 360a5665051SPaolo Bonzinimeson="" 3613b4da132SPaolo Bonzinimeson_args="" 36248328880SPaolo Bonzinininja="" 3633b4da132SPaolo Bonzinigio="$default_feature" 364a5665051SPaolo Bonziniskip_meson=no 365b8e0c493SJoelle van Dyneslirp_smbd="$default_feature" 366377529c0SPaolo Bonzini 3673b4da132SPaolo Bonzini# The following Meson options are handled manually (still they 3683b4da132SPaolo Bonzini# are included in the automatically generated help message) 3693b4da132SPaolo Bonzini 3703b4da132SPaolo Bonzini# 1. Track which submodules are needed 3713b4da132SPaolo Bonzinicapstone="auto" 3723b4da132SPaolo Bonzinifdt="auto" 3733b4da132SPaolo Bonzinislirp="auto" 3743b4da132SPaolo Bonzini 3753b4da132SPaolo Bonzini# 2. Support --with/--without option 3763b4da132SPaolo Bonzinidefault_devices="true" 3773b4da132SPaolo Bonzini 3783b4da132SPaolo Bonzini# 3. Automatically enable/disable other options 3793b4da132SPaolo Bonzinitcg="enabled" 3803b4da132SPaolo Bonzinicfi="false" 3813b4da132SPaolo Bonzini 3823b4da132SPaolo Bonzini# 4. Detection partly done in configure 3833b4da132SPaolo Bonzinixen=${default_feature:+disabled} 384898be3e0SPeter Maydell 385c87ea116SAlex Bennée# parse CC options second 386ac0df51dSaliguorifor opt do 38789138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 388ac0df51dSaliguori case "$opt" in 389ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 3903812c0c4SJoelle van Dyne cross_compile="yes" 391ac0df51dSaliguori ;; 3923d8df640SPaolo Bonzini --cc=*) CC="$optarg" 393ac0df51dSaliguori ;; 39483f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 39583f73fceSTomoki Sekiyama ;; 3962ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 3972ff6b91eSJuan Quintela ;; 398a2866660SPaolo Bonzini --extra-cflags=*) 399a2866660SPaolo Bonzini EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg" 400a2866660SPaolo Bonzini EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg" 401e2a2ed06SJuan Quintela ;; 402a2866660SPaolo Bonzini --extra-cxxflags=*) EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg" 40311cde1c8SBruno Dominguez ;; 404a2866660SPaolo Bonzini --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg" 405e2a2ed06SJuan Quintela ;; 4065bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 4075bc62e01SGerd Hoffmann ;; 4085bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 4095bc62e01SGerd Hoffmann ;; 410d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 411d75402b5SAlex Bennée ;; 412d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 413d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 4142038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 415d422b2bcSAlex Bennée ;; 416d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 4172038f8c8SPaolo Bonzini cc_archs="$cc_archs $cc_arch" 418d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 4192038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 420d75402b5SAlex Bennée ;; 421ac0df51dSaliguori esac 422ac0df51dSaliguoridone 423ac0df51dSaliguori# OS specific 424ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 42593148aa5SStefan Weil# we can eliminate its usage altogether. 426ac0df51dSaliguori 427e49d021eSPeter Maydell# Preferred compiler: 428e49d021eSPeter Maydell# ${CC} (if set) 429e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 430e49d021eSPeter Maydell# system compiler 431e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 432e49d021eSPeter Maydell cc="$host_cc" 433e49d021eSPeter Maydellelse 434b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 435e49d021eSPeter Maydellfi 436e49d021eSPeter Maydell 43783f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 43883f73fceSTomoki Sekiyama cxx="c++" 43983f73fceSTomoki Sekiyamaelse 44083f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 44183f73fceSTomoki Sekiyamafi 44283f73fceSTomoki Sekiyama 443b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 444cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 4455f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 4463dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 447b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 448b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 4499f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 4504852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 451b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 452b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 45317884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 45417884d7bSSergei Trofimovichquery_pkg_config() { 45517884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 45617884d7bSSergei Trofimovich} 45717884d7bSSergei Trofimovichpkg_config=query_pkg_config 45847c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 459ac0df51dSaliguori 460be17dc90SMichael S. Tsirkin# default flags for all hosts 4612d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 4622d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 4632d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 4642d31515bSPeter Maydell# provides these semantics.) 465de38c0ccSPaolo BonziniQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv" 466086d5f75SPaolo BonziniQEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 467c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 468be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 4695770e8afSPaolo Bonzini 470de38c0ccSPaolo BonziniQEMU_LDFLAGS= 471de38c0ccSPaolo Bonzini 4725770e8afSPaolo Bonzini# Flags that are needed during configure but later taken care of by Meson 4738a9d3d56SRichard HendersonCONFIGURE_CFLAGS="-std=gnu11 -Wall" 4745770e8afSPaolo BonziniCONFIGURE_LDFLAGS= 475086d5f75SPaolo Bonzini 476be17dc90SMichael S. Tsirkin 477ac0df51dSaliguoricheck_define() { 478ac0df51dSaliguoricat > $TMPC <<EOF 479ac0df51dSaliguori#if !defined($1) 480fd786e1aSPeter Maydell#error $1 not defined 481ac0df51dSaliguori#endif 482ac0df51dSaliguoriint main(void) { return 0; } 483ac0df51dSaliguoriEOF 48452166aa0SJuan Quintela compile_object 485ac0df51dSaliguori} 486ac0df51dSaliguori 487307119e7SGerd Hoffmanncheck_include() { 488307119e7SGerd Hoffmanncat > $TMPC <<EOF 489307119e7SGerd Hoffmann#include <$1> 490307119e7SGerd Hoffmannint main(void) { return 0; } 491307119e7SGerd HoffmannEOF 492307119e7SGerd Hoffmann compile_object 493307119e7SGerd Hoffmann} 494307119e7SGerd Hoffmann 49593b25869SJohn Snowwrite_c_skeleton() { 49693b25869SJohn Snow cat > $TMPC <<EOF 49793b25869SJohn Snowint main(void) { return 0; } 49893b25869SJohn SnowEOF 49993b25869SJohn Snow} 50093b25869SJohn Snow 501bbea4050SPeter Maydellif check_define __linux__ ; then 502ba7c60c2SPaolo Bonzini targetos=linux 503bbea4050SPeter Maydellelif check_define _WIN32 ; then 504ba7c60c2SPaolo Bonzini targetos=windows 505bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 506ba7c60c2SPaolo Bonzini targetos=openbsd 507bbea4050SPeter Maydellelif check_define __sun__ ; then 508ba7c60c2SPaolo Bonzini targetos=sunos 509bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 510ba7c60c2SPaolo Bonzini targetos=haiku 511951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 512ba7c60c2SPaolo Bonzini targetos=freebsd 513951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 514ba7c60c2SPaolo Bonzini targetos=gnu/kfreebsd 515951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 516ba7c60c2SPaolo Bonzini targetos=dragonfly 517951fedfcSPeter Maydellelif check_define __NetBSD__; then 518ba7c60c2SPaolo Bonzini targetos=netbsd 519951fedfcSPeter Maydellelif check_define __APPLE__; then 520ba7c60c2SPaolo Bonzini targetos=darwin 521bbea4050SPeter Maydellelse 522951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 523951fedfcSPeter Maydell # might be going to just print the --help text, or it might 524951fedfcSPeter Maydell # be the result of a missing compiler. 525ba7c60c2SPaolo Bonzini targetos=bogus 526bbea4050SPeter Maydellfi 527bbea4050SPeter Maydell 52865eff01bSPaolo Bonzini# OS specific 52965eff01bSPaolo Bonzini 53065eff01bSPaolo Bonzinicase $targetos in 53165eff01bSPaolo Bonziniwindows) 53265eff01bSPaolo Bonzini mingw32="yes" 53365eff01bSPaolo Bonzini plugins="no" 53465eff01bSPaolo Bonzini pie="no" 53565eff01bSPaolo Bonzini;; 53665eff01bSPaolo Bonzinignu/kfreebsd) 53765eff01bSPaolo Bonzini bsd="yes" 53865eff01bSPaolo Bonzini;; 53965eff01bSPaolo Bonzinifreebsd) 54065eff01bSPaolo Bonzini bsd="yes" 54165eff01bSPaolo Bonzini bsd_user="yes" 54265eff01bSPaolo Bonzini make="${MAKE-gmake}" 54365eff01bSPaolo Bonzini # needed for kinfo_getvmmap(3) in libutil.h 54465eff01bSPaolo Bonzini;; 54565eff01bSPaolo Bonzinidragonfly) 54665eff01bSPaolo Bonzini bsd="yes" 54765eff01bSPaolo Bonzini make="${MAKE-gmake}" 54865eff01bSPaolo Bonzini;; 54965eff01bSPaolo Bonzininetbsd) 55065eff01bSPaolo Bonzini bsd="yes" 55165eff01bSPaolo Bonzini make="${MAKE-gmake}" 55265eff01bSPaolo Bonzini;; 55365eff01bSPaolo Bonziniopenbsd) 55465eff01bSPaolo Bonzini bsd="yes" 55565eff01bSPaolo Bonzini make="${MAKE-gmake}" 55665eff01bSPaolo Bonzini;; 55765eff01bSPaolo Bonzinidarwin) 55865eff01bSPaolo Bonzini bsd="yes" 55965eff01bSPaolo Bonzini darwin="yes" 56065eff01bSPaolo Bonzini # Disable attempts to use ObjectiveC features in os/object.h since they 56165eff01bSPaolo Bonzini # won't work when we're compiling with gcc as a C compiler. 56265eff01bSPaolo Bonzini QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 56365eff01bSPaolo Bonzini;; 56465eff01bSPaolo Bonzinisunos) 56565eff01bSPaolo Bonzini solaris="yes" 56665eff01bSPaolo Bonzini make="${MAKE-gmake}" 56765eff01bSPaolo Bonzini smbd="${SMBD-/usr/sfw/sbin/smbd}" 56865eff01bSPaolo Bonzini# needed for CMSG_ macros in sys/socket.h 56965eff01bSPaolo Bonzini QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 57065eff01bSPaolo Bonzini# needed for TIOCWIN* defines in termios.h 57165eff01bSPaolo Bonzini QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 57265eff01bSPaolo Bonzini # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 57365eff01bSPaolo Bonzini # Note that this check is broken for cross-compilation: if you're 574bbea4050SPeter Maydell # cross-compiling to one of these OSes then you'll need to specify 575bbea4050SPeter Maydell # the correct CPU with the --cpu option. 576bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 577bbea4050SPeter Maydell cpu="x86_64" 578bbea4050SPeter Maydell fi 57965eff01bSPaolo Bonzini;; 58065eff01bSPaolo Bonzinihaiku) 58165eff01bSPaolo Bonzini pie="no" 58265eff01bSPaolo Bonzini QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" 58365eff01bSPaolo Bonzini;; 58465eff01bSPaolo Bonzinilinux) 58565eff01bSPaolo Bonzini linux="yes" 58665eff01bSPaolo Bonzini linux_user="yes" 58765eff01bSPaolo Bonzini vhost_user=${default_feature:-yes} 58865eff01bSPaolo Bonzini;; 589bbea4050SPeter Maydellesac 590bbea4050SPeter Maydell 5912ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 5922ff6b91eSJuan Quintela # command line argument 5932ff6b91eSJuan Quintela : 5942ff6b91eSJuan Quintelaelif check_define __i386__ ; then 595ac0df51dSaliguori cpu="i386" 596ac0df51dSaliguorielif check_define __x86_64__ ; then 597c72b26ecSRichard Henderson if check_define __ILP32__ ; then 598c72b26ecSRichard Henderson cpu="x32" 599c72b26ecSRichard Henderson else 600ac0df51dSaliguori cpu="x86_64" 601c72b26ecSRichard Henderson fi 6023aa9bd6cSblueswir1elif check_define __sparc__ ; then 6033aa9bd6cSblueswir1 if check_define __arch64__ ; then 6043aa9bd6cSblueswir1 cpu="sparc64" 6053aa9bd6cSblueswir1 else 6063aa9bd6cSblueswir1 cpu="sparc" 6073aa9bd6cSblueswir1 fi 608fdf7ed96Smalcelif check_define _ARCH_PPC ; then 609fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 610f8378accSRichard Henderson if check_define _LITTLE_ENDIAN ; then 611f8378accSRichard Henderson cpu="ppc64le" 612f8378accSRichard Henderson else 613fdf7ed96Smalc cpu="ppc64" 614f8378accSRichard Henderson fi 615ac0df51dSaliguori else 616fdf7ed96Smalc cpu="ppc" 617fdf7ed96Smalc fi 618afa05235SAurelien Jarnoelif check_define __mips__ ; then 619afa05235SAurelien Jarno cpu="mips" 620d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 621d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 622d66ed0eaSAurelien Jarno cpu="s390x" 623d66ed0eaSAurelien Jarno else 624d66ed0eaSAurelien Jarno cpu="s390" 625d66ed0eaSAurelien Jarno fi 626c4f80543SAlistair Franciselif check_define __riscv ; then 627ba0e7333SRichard Henderson cpu="riscv" 62821d89f84SPeter Maydellelif check_define __arm__ ; then 62921d89f84SPeter Maydell cpu="arm" 6301f080313SClaudio Fontanaelif check_define __aarch64__ ; then 6311f080313SClaudio Fontana cpu="aarch64" 632dfcf900bSWANG Xueruielif check_define __loongarch64 ; then 633dfcf900bSWANG Xuerui cpu="loongarch64" 634fdf7ed96Smalcelse 63589138857SStefan Weil cpu=$(uname -m) 636ac0df51dSaliguorifi 637ac0df51dSaliguori 638823eb013SPaolo Bonzini# Normalise host CPU name, set multilib cflags 639359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 6407d13299dSbellardcase "$cpu" in 641e4da0e39SPaolo Bonzini armv*b|armv*l|arm) 642e4da0e39SPaolo Bonzini cpu="arm" ;; 643e4da0e39SPaolo Bonzini 6447d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 64597a847bcSbellard cpu="i386" 646e4da0e39SPaolo Bonzini CPU_CFLAGS="-m32" ;; 647e4da0e39SPaolo Bonzini x32) 6484da270beSPaolo Bonzini cpu="x86_64" 649e4da0e39SPaolo Bonzini CPU_CFLAGS="-mx32" ;; 650aaa5fa14Saurel32 x86_64|amd64) 651aaa5fa14Saurel32 cpu="x86_64" 652e4da0e39SPaolo Bonzini # ??? Only extremely old AMD cpus do not have cmpxchg16b. 653e4da0e39SPaolo Bonzini # If we truly care, we should simply detect this case at 654e4da0e39SPaolo Bonzini # runtime and generate the fallback to serial emulation. 655e4da0e39SPaolo Bonzini CPU_CFLAGS="-m64 -mcx16" ;; 656e4da0e39SPaolo Bonzini 657afa05235SAurelien Jarno mips*) 658e4da0e39SPaolo Bonzini cpu="mips" ;; 659e4da0e39SPaolo Bonzini 660e4da0e39SPaolo Bonzini ppc) 661e4da0e39SPaolo Bonzini CPU_CFLAGS="-m32" ;; 662e4da0e39SPaolo Bonzini ppc64) 663d8ff892dSPaolo Bonzini CPU_CFLAGS="-m64 -mbig" ;; 664e4da0e39SPaolo Bonzini ppc64le) 665d8ff892dSPaolo Bonzini cpu="ppc64" 666d8ff892dSPaolo Bonzini CPU_CFLAGS="-m64 -mlittle" ;; 667e4da0e39SPaolo Bonzini 668e4da0e39SPaolo Bonzini s390) 669823eb013SPaolo Bonzini CPU_CFLAGS="-m31" ;; 670e4da0e39SPaolo Bonzini s390x) 671e4da0e39SPaolo Bonzini CPU_CFLAGS="-m64" ;; 672e4da0e39SPaolo Bonzini 6733142255cSblueswir1 sparc|sun4[cdmuv]) 674ae228531Sbellard cpu="sparc" 675e4da0e39SPaolo Bonzini CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;; 676e4da0e39SPaolo Bonzini sparc64) 677e4da0e39SPaolo Bonzini CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;; 6787d13299dSbellardesac 679e2d52ad3SJuan Quintela 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 ;; 10221ffb3bbbSPaolo Bonzini --disable-zlib-test) 10231ece9905SAlon Levy ;; 1024d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1025d138cee9SMichael Roth ;; 1026d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1027d138cee9SMichael Roth ;; 1028d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1029d9840e25STomoki Sekiyama ;; 1030d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1031d9840e25STomoki Sekiyama ;; 1032d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1033d9840e25STomoki Sekiyama ;; 1034d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1035d9840e25STomoki Sekiyama ;; 1036d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1037d9840e25STomoki Sekiyama ;; 1038d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1039d9840e25STomoki Sekiyama ;; 10404b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 10414b1c11fdSDaniel P. Berrange ;; 10424b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 10434b1c11fdSDaniel P. Berrange ;; 104486583a07SLiam Merwick --disable-avx2) avx2_opt="no" 104586583a07SLiam Merwick ;; 104686583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 104786583a07SLiam Merwick ;; 10486b8cd447SRobert Hoo --disable-avx512f) avx512f_opt="no" 10496b8cd447SRobert Hoo ;; 10506b8cd447SRobert Hoo --enable-avx512f) avx512f_opt="yes" 10516b8cd447SRobert Hoo ;; 105252b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 105352b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1054583f6e7bSStefan Hajnoczi ;; 1055cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1056cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1057cb6414dfSFam Zheng ;; 1058315d3184SFam Zheng --enable-uuid|--disable-uuid) 1059315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1060315d3184SFam Zheng ;; 1061a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1062a1c5e949SDaniel P. Berrange ;; 10632da776dbSMichael R. Hines --enable-rdma) rdma="yes" 10642da776dbSMichael R. Hines ;; 10652da776dbSMichael R. Hines --disable-rdma) rdma="no" 10662da776dbSMichael R. Hines ;; 106721ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 106821ab34c9SMarcel Apfelbaum ;; 106921ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 107021ab34c9SMarcel Apfelbaum ;; 1071e91c793cSCole Robinson --disable-tpm) tpm="no" 1072e91c793cSCole Robinson ;; 1073ab214c29SStefan Berger --enable-tpm) tpm="yes" 1074ab214c29SStefan Berger ;; 1075ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1076ed1701c6SDr. David Alan Gilbert ;; 1077ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1078ed1701c6SDr. David Alan Gilbert ;; 1079a99d57bbSWanlong Gao --disable-numa) numa="no" 1080a99d57bbSWanlong Gao ;; 1081a99d57bbSWanlong Gao --enable-numa) numa="yes" 1082a99d57bbSWanlong Gao ;; 1083a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1084a6b1d4c0SChanglong Xie ;; 1085a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1086a6b1d4c0SChanglong Xie ;; 10872f740136SJeff Cody --disable-bochs) bochs="no" 10882f740136SJeff Cody ;; 10892f740136SJeff Cody --enable-bochs) bochs="yes" 10902f740136SJeff Cody ;; 10912f740136SJeff Cody --disable-cloop) cloop="no" 10922f740136SJeff Cody ;; 10932f740136SJeff Cody --enable-cloop) cloop="yes" 10942f740136SJeff Cody ;; 10952f740136SJeff Cody --disable-dmg) dmg="no" 10962f740136SJeff Cody ;; 10972f740136SJeff Cody --enable-dmg) dmg="yes" 10982f740136SJeff Cody ;; 10992f740136SJeff Cody --disable-qcow1) qcow1="no" 11002f740136SJeff Cody ;; 11012f740136SJeff Cody --enable-qcow1) qcow1="yes" 11022f740136SJeff Cody ;; 11032f740136SJeff Cody --disable-vdi) vdi="no" 11042f740136SJeff Cody ;; 11052f740136SJeff Cody --enable-vdi) vdi="yes" 11062f740136SJeff Cody ;; 11072f740136SJeff Cody --disable-vvfat) vvfat="no" 11082f740136SJeff Cody ;; 11092f740136SJeff Cody --enable-vvfat) vvfat="yes" 11102f740136SJeff Cody ;; 11112f740136SJeff Cody --disable-qed) qed="no" 11122f740136SJeff Cody ;; 11132f740136SJeff Cody --enable-qed) qed="yes" 11142f740136SJeff Cody ;; 11152f740136SJeff Cody --disable-parallels) parallels="no" 11162f740136SJeff Cody ;; 11172f740136SJeff Cody --enable-parallels) parallels="yes" 11182f740136SJeff Cody ;; 1119e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1120e6a74868SMarc-André Lureau ;; 1121299e6f19SPaolo Bonzini --enable-vhost-user) vhost_user="yes" 1122299e6f19SPaolo Bonzini ;; 1123108a6481SCindy Lu --disable-vhost-vdpa) vhost_vdpa="no" 1124108a6481SCindy Lu ;; 1125108a6481SCindy Lu --enable-vhost-vdpa) vhost_vdpa="yes" 1126108a6481SCindy Lu ;; 1127299e6f19SPaolo Bonzini --disable-vhost-kernel) vhost_kernel="no" 1128299e6f19SPaolo Bonzini ;; 1129299e6f19SPaolo Bonzini --enable-vhost-kernel) vhost_kernel="yes" 1130e6a74868SMarc-André Lureau ;; 11318b18cdbfSRichard Henderson --disable-capstone) capstone="disabled" 11328ca80760SRichard Henderson ;; 11338b18cdbfSRichard Henderson --enable-capstone) capstone="enabled" 11348ca80760SRichard Henderson ;; 11358b18cdbfSRichard Henderson --enable-capstone=git) capstone="internal" 1136e219c499SRichard Henderson ;; 113703a3c0b3SPaolo Bonzini --enable-capstone=*) capstone="$optarg" 1138e219c499SRichard Henderson ;; 1139cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1140cc84d63aSDaniel P. Berrange ;; 11417d7dbf9dSDan Streetman --with-git-submodules=*) 11427d7dbf9dSDan Streetman git_submodules_action="$optarg" 1143f62bbee5SDaniel P. Berrange ;; 1144ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1145ba59fb77SPaolo Bonzini ;; 1146ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1147ba59fb77SPaolo Bonzini ;; 11489b8e4298SAlex Bennée --enable-plugins) if test "$mingw32" = "yes"; then 11499b8e4298SAlex Bennée error_exit "TCG plugins not currently supported on Windows platforms" 11509b8e4298SAlex Bennée else 11519b8e4298SAlex Bennée plugins="yes" 11529b8e4298SAlex Bennée fi 115340e8c6f4SAlex Bennée ;; 115440e8c6f4SAlex Bennée --disable-plugins) plugins="no" 115540e8c6f4SAlex Bennée ;; 1156afc3a8f9SAlex Bennée --enable-containers) use_containers="yes" 1157afc3a8f9SAlex Bennée ;; 1158afc3a8f9SAlex Bennée --disable-containers) use_containers="no" 1159afc3a8f9SAlex Bennée ;; 1160f48e590aSAlex Bennée --gdb=*) gdb_bin="$optarg" 1161f48e590aSAlex Bennée ;; 1162b767d257SMarek Marczykowski-Górecki --enable-rng-none) rng_none=yes 1163b767d257SMarek Marczykowski-Górecki ;; 1164b767d257SMarek Marczykowski-Górecki --disable-rng-none) rng_none=no 1165b767d257SMarek Marczykowski-Górecki ;; 116654e7aac0SAlexey Krasikov --enable-keyring) secret_keyring="yes" 116754e7aac0SAlexey Krasikov ;; 116854e7aac0SAlexey Krasikov --disable-keyring) secret_keyring="no" 116954e7aac0SAlexey Krasikov ;; 117020cf7b8eSDenis Plotnikov --enable-gio) gio=yes 117120cf7b8eSDenis Plotnikov ;; 117220cf7b8eSDenis Plotnikov --disable-gio) gio=no 117320cf7b8eSDenis Plotnikov ;; 1174b8e0c493SJoelle van Dyne --enable-slirp-smbd) slirp_smbd=yes 1175b8e0c493SJoelle van Dyne ;; 1176b8e0c493SJoelle van Dyne --disable-slirp-smbd) slirp_smbd=no 1177b8e0c493SJoelle van Dyne ;; 11783b4da132SPaolo Bonzini # backwards compatibility options 11793b4da132SPaolo Bonzini --enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg" 11803b4da132SPaolo Bonzini ;; 11813b4da132SPaolo Bonzini --disable-blobs) meson_option_parse --disable-install-blobs "" 11823b4da132SPaolo Bonzini ;; 11833b4da132SPaolo Bonzini --enable-tcmalloc) meson_option_parse --enable-malloc=tcmalloc tcmalloc 11843b4da132SPaolo Bonzini ;; 11853b4da132SPaolo Bonzini --enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc 11863b4da132SPaolo Bonzini ;; 11873b4da132SPaolo Bonzini # everything else has the same name in configure and meson 118861d63097SPaolo Bonzini --enable-* | --disable-*) meson_option_parse "$opt" "$optarg" 118961d63097SPaolo Bonzini ;; 11902d2ad6d0SFam Zheng *) 11912d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 11922d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 11932d2ad6d0SFam Zheng exit 1 11947f1559c6Sbalrog ;; 11957d13299dSbellard esac 11967d13299dSbellarddone 11977d13299dSbellard 1198d1a14257SAlex Bennée# test for any invalid configuration combinations 1199d1a14257SAlex Bennéeif test "$plugins" = "yes" -a "$tcg" = "disabled"; then 1200d1a14257SAlex Bennée error_exit "Can't enable plugins on non-TCG builds" 1201d1a14257SAlex Bennéefi 1202d1a14257SAlex Bennée 12037d7dbf9dSDan Streetmancase $git_submodules_action in 12047d7dbf9dSDan Streetman update|validate) 12057d7dbf9dSDan Streetman if test ! -e "$source_path/.git"; then 12067d7dbf9dSDan Streetman echo "ERROR: cannot $git_submodules_action git submodules without .git" 12077d7dbf9dSDan Streetman exit 1 12087d7dbf9dSDan Streetman fi 12097d7dbf9dSDan Streetman ;; 12107d7dbf9dSDan Streetman ignore) 1211b80fd281SPaolo Bonzini if ! test -f "$source_path/ui/keycodemapdb/README" 1212b80fd281SPaolo Bonzini then 1213b80fd281SPaolo Bonzini echo 1214b80fd281SPaolo Bonzini echo "ERROR: missing GIT submodules" 1215b80fd281SPaolo Bonzini echo 1216b80fd281SPaolo Bonzini if test -e "$source_path/.git"; then 1217b80fd281SPaolo Bonzini echo "--with-git-submodules=ignore specified but submodules were not" 1218b80fd281SPaolo Bonzini echo "checked out. Please initialize and update submodules." 1219b80fd281SPaolo Bonzini else 1220b80fd281SPaolo Bonzini echo "This is not a GIT checkout but module content appears to" 1221b80fd281SPaolo Bonzini echo "be missing. Do not use 'git archive' or GitHub download links" 1222b80fd281SPaolo Bonzini echo "to acquire QEMU source archives. Non-GIT builds are only" 1223b80fd281SPaolo Bonzini echo "supported with source archives linked from:" 1224b80fd281SPaolo Bonzini echo 1225b80fd281SPaolo Bonzini echo " https://www.qemu.org/download/#source" 1226b80fd281SPaolo Bonzini echo 1227b80fd281SPaolo Bonzini echo "Developers working with GIT can use scripts/archive-source.sh" 1228b80fd281SPaolo Bonzini echo "if they need to create valid source archives." 1229b80fd281SPaolo Bonzini fi 1230b80fd281SPaolo Bonzini echo 1231b80fd281SPaolo Bonzini exit 1 1232b80fd281SPaolo Bonzini fi 12337d7dbf9dSDan Streetman ;; 12347d7dbf9dSDan Streetman *) 12357d7dbf9dSDan Streetman echo "ERROR: invalid --with-git-submodules= value '$git_submodules_action'" 12367d7dbf9dSDan Streetman exit 1 12377d7dbf9dSDan Streetman ;; 12387d7dbf9dSDan Streetmanesac 12397d7dbf9dSDan Streetman 124022a87800SMarc-André Lureaulibdir="${libdir:-$prefix/lib}" 124122a87800SMarc-André Lureaulibexecdir="${libexecdir:-$prefix/libexec}" 124222a87800SMarc-André Lureauincludedir="${includedir:-$prefix/include}" 124322a87800SMarc-André Lureau 124422a87800SMarc-André Lureauif test "$mingw32" = "yes" ; then 124515588a62SJoshua Watt bindir="${bindir:-$prefix}" 124622a87800SMarc-André Lureauelse 124715588a62SJoshua Watt bindir="${bindir:-$prefix/bin}" 124815588a62SJoshua Wattfi 124922a87800SMarc-André Lureaumandir="${mandir:-$prefix/share/man}" 125022a87800SMarc-André Lureaudatadir="${datadir:-$prefix/share}" 1251ca8c0909SMarc-André Lureaudocdir="${docdir:-$prefix/share/doc}" 125222a87800SMarc-André Lureausysconfdir="${sysconfdir:-$prefix/etc}" 125322a87800SMarc-André Lureaulocal_statedir="${local_statedir:-$prefix/var}" 125416bf7a33SPaolo Bonzinifirmwarepath="${firmwarepath:-$datadir/qemu-firmware}" 125516bf7a33SPaolo Bonzinilocaledir="${localedir:-$datadir/locale}" 125622a87800SMarc-André Lureau 12579557af9cSAlex Bennéeif eval test -z "\${cross_cc_$cpu}"; then 1258b1aa4de1SAlex Bennée eval "cross_cc_${cpu}=\$cc" 12592038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 12609557af9cSAlex Bennéefi 126179f3b12fSPeter Crosthwaite 1262affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1263affc88ccSPeter Maydell# support, even if we're using TCI. 1264affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1265affc88ccSPeter Maydell bsd_user="no" 1266affc88ccSPeter Maydell linux_user="no" 1267affc88ccSPeter Maydellfi 1268affc88ccSPeter Maydell 126960e0df25SPeter Maydelldefault_target_list="" 127043692239SMarkus Armbrusterdeprecated_targets_list=ppc64abi32-linux-user 1271fdb75aefSPaolo Bonzinideprecated_features="" 12726e92f823SPeter Maydellmak_wilds="" 12736e92f823SPeter Maydell 127460e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 1275812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak" 127660e0df25SPeter Maydellfi 127760e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 1278812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-linux-user.mak" 127960e0df25SPeter Maydellfi 128060e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 1281812b31d3SAlex Bennée mak_wilds="${mak_wilds} $source_path/configs/targets/*-bsd-user.mak" 128260e0df25SPeter Maydellfi 128360e0df25SPeter Maydell 12843a5ae4a9SAlex Bennée# If the user doesn't explicitly specify a deprecated target we will 12853a5ae4a9SAlex Bennée# skip it. 12863a5ae4a9SAlex Bennéeif test -z "$target_list"; then 12873a5ae4a9SAlex Bennée if test -z "$target_list_exclude"; then 12883a5ae4a9SAlex Bennée target_list_exclude="$deprecated_targets_list" 12893a5ae4a9SAlex Bennée else 12903a5ae4a9SAlex Bennée target_list_exclude="$target_list_exclude,$deprecated_targets_list" 12913a5ae4a9SAlex Bennée fi 12922d838d9bSAlex Bennéefi 12932d838d9bSAlex Bennée 1294447e133fSAlex Bennéefor config in $mak_wilds; do 1295447e133fSAlex Bennée target="$(basename "$config" .mak)" 129698db9a06SAlex Bennée if echo "$target_list_exclude" | grep -vq "$target"; then 1297447e133fSAlex Bennée default_target_list="${default_target_list} $target" 1298447e133fSAlex Bennée fi 1299447e133fSAlex Bennéedone 13006e92f823SPeter Maydell 1301af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1302af5db58eSpbrookcat << EOF 1303af5db58eSpbrook 1304af5db58eSpbrookUsage: configure [options] 1305af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1306af5db58eSpbrook 130708fb77edSStefan WeilStandard options: 130808fb77edSStefan Weil --help print this message 130908fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 131008fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 131108fb77edSStefan Weil use %M for cpu name [$interp_prefix] 13122deca810SAlex Bennée --target-list=LIST set target list (default: build all non-deprecated) 131308fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 131408fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 13152deca810SAlex Bennée$(echo Deprecated targets: $deprecated_targets_list | \ 13162deca810SAlex Bennée fold -s -w 53 | sed -e 's/^/ /') 1317447e133fSAlex Bennée --target-list-exclude=LIST exclude a set of targets from the default target-list 131808fb77edSStefan Weil 131908fb77edSStefan WeilAdvanced options (experts only): 13203812c0c4SJoelle van Dyne --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] 132108fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 132208fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 132308fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 132408fb77edSStefan Weil build time 132508fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 132608fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 1327a2866660SPaolo Bonzini --extra-cflags=CFLAGS append extra C compiler flags CFLAGS 1328a2866660SPaolo Bonzini --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS 132908fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1330d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1331d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 133208fb77edSStefan Weil --make=MAKE use specified make [$make] 133308fb77edSStefan Weil --python=PYTHON use specified python [$python] 13342eb054c2SPeter Maydell --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1335a5665051SPaolo Bonzini --meson=MESON use specified meson [$meson] 133648328880SPaolo Bonzini --ninja=NINJA use specified ninja [$ninja] 133708fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1338db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 13397d7dbf9dSDan Streetman --with-git-submodules=update update git submodules (default if .git dir exists) 13407d7dbf9dSDan Streetman --with-git-submodules=validate fail if git submodules are not up to date 13417d7dbf9dSDan Streetman --with-git-submodules=ignore do not update or check git submodules (default if no .git dir) 134208fb77edSStefan Weil --static enable static build [$static] 134308fb77edSStefan Weil --mandir=PATH install man pages in PATH 134410ff82d1SMarc-André Lureau --datadir=PATH install firmware in PATH/$qemu_suffix 1345fe0038beSPaolo Bonzini --localedir=PATH install translation in PATH/$qemu_suffix 134610ff82d1SMarc-André Lureau --docdir=PATH install documentation in PATH/$qemu_suffix 134708fb77edSStefan Weil --bindir=PATH install binaries in PATH 134808fb77edSStefan Weil --libdir=PATH install libraries in PATH 1349db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 135010ff82d1SMarc-André Lureau --sysconfdir=PATH install config in PATH/$qemu_suffix 135108fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 13523d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 135313336606SRobert Foley --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1354ca8c0909SMarc-André Lureau --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1355db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 1356c035c8d6SPaolo Bonzini --without-default-features default all --enable-* options to "disabled" 1357c035c8d6SPaolo Bonzini --without-default-devices do not include any device that is not needed to 1358c035c8d6SPaolo Bonzini start the emulator (only use if you are including 1359d1d5e9eeSAlex Bennée desired devices in configs/devices/) 1360d1d5e9eeSAlex Bennée --with-devices-ARCH=NAME override default configs/devices 136108fb77edSStefan Weil --enable-debug enable common debug build options 1362247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 13630aebab04SLingfeng Yang --enable-tsan enable thread sanitizer 136408fb77edSStefan Weil --disable-strip disable stripping binaries 136508fb77edSStefan Weil --disable-werror disable compilation abort on warning 136663678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 136716bfbc70SPaolo Bonzini --audio-drv-list=LIST set audio drivers to try if -audiodev is not used 136808fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 136908fb77edSStefan Weil --block-drv-rw-whitelist=L 137008fb77edSStefan Weil set block driver read-write whitelist 1371e5f05f8cSKevin Wolf (by default affects only QEMU, not tools like qemu-img) 137208fb77edSStefan Weil --block-drv-ro-whitelist=L 137308fb77edSStefan Weil set block driver read-only whitelist 1374e5f05f8cSKevin Wolf (by default affects only QEMU, not tools like qemu-img) 1375e5f05f8cSKevin Wolf --enable-block-drv-whitelist-in-tools 1376e5f05f8cSKevin Wolf use block whitelist also in tools instead of only QEMU 137708fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 137808fb77edSStefan Weil Default:trace-<pid> 1379c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 138008fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 138133c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 138208fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 1383c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1384c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1385a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1386c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1387c12d66aaSLin Ma --enable-profiler profiler support 1388c12d66aaSLin Ma --enable-debug-stack-usage 1389c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 139040e8c6f4SAlex Bennée --enable-plugins 139140e8c6f4SAlex Bennée enable plugins via shared library loading 1392afc3a8f9SAlex Bennée --disable-containers don't use containers for cross-building 1393f48e590aSAlex Bennée --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 139461d63097SPaolo BonziniEOF 139561d63097SPaolo Bonzini meson_options_help 139661d63097SPaolo Bonzinicat << EOF 1397c23f23b9SMichael Tokarev system all system emulation targets 1398c23f23b9SMichael Tokarev user supported user emulation targets 1399c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1400c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1401c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1402c23f23b9SMichael Tokarev pie Position Independent Executables 140321e709aaSMarc-André Lureau modules modules support (non-Windows) 1404bd83c861SChristian Ehrhardt module-upgrades try to load modules from alternate paths for upgrades 1405c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1406c23f23b9SMichael Tokarev debug-info debugging information 1407cdad781dSDaniele Buono lto Enable Link-Time Optimization. 14081e4f6065SDaniele Buono safe-stack SafeStack Stack Smash Protection. Depends on 14091e4f6065SDaniele Buono clang/llvm >= 3.7 and requires coroutine backend ucontext. 1410a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 141121ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 141221ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1413299e6f19SPaolo Bonzini vhost-net vhost-net kernel acceleration support 1414299e6f19SPaolo Bonzini vhost-vsock virtio sockets device support 1415299e6f19SPaolo Bonzini vhost-scsi vhost-scsi kernel target support 1416299e6f19SPaolo Bonzini vhost-crypto vhost-user-crypto backend support 1417299e6f19SPaolo Bonzini vhost-kernel vhost kernel backend support 1418299e6f19SPaolo Bonzini vhost-user vhost-user backend support 1419108a6481SCindy Lu vhost-vdpa vhost-vdpa kernel backend support 1420ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1421c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1422c23f23b9SMichael Tokarev tpm TPM support 1423c23f23b9SMichael Tokarev numa libnuma support 142486583a07SLiam Merwick avx2 AVX2 optimization support 14256b8cd447SRobert Hoo avx512f AVX512F optimization support 1426a6b1d4c0SChanglong Xie replication replication support 1427c12d66aaSLin Ma opengl opengl support 1428c12d66aaSLin Ma qom-cast-debug cast debugging support 14298de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 14302f740136SJeff Cody bochs bochs image format support 14312f740136SJeff Cody cloop cloop image format support 14322f740136SJeff Cody dmg dmg image format support 14332f740136SJeff Cody qcow1 qcow v1 image format support 14342f740136SJeff Cody vdi vdi image format support 14352f740136SJeff Cody vvfat vvfat image format support 14362f740136SJeff Cody qed qed image format support 14372f740136SJeff Cody parallels parallels image format support 1438f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 1439ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 1440b767d257SMarek Marczykowski-Górecki rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 144120cf7b8eSDenis Plotnikov gio libgio support 1442b8e0c493SJoelle van Dyne slirp-smbd use smbd (at path --smbd=*) in slirp networking 144308fb77edSStefan Weil 144408fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1445af5db58eSpbrookEOF 14462d2ad6d0SFam Zhengexit 0 1447af5db58eSpbrookfi 1448af5db58eSpbrook 14499c790242SThomas Huth# Remove old dependency files to make sure that they get properly regenerated 1450bb768f71SThomas Huthrm -f */config-devices.mak.d 14519c790242SThomas Huth 1452faf44142SDaniel P. Berrangéif test -z "$python" 1453faf44142SDaniel P. Berrangéthen 1454c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1455c53eeaf7SStefan Hajnoczifi 14568e2c76bdSRoman Bolshakovif ! has "$make" 14578e2c76bdSRoman Bolshakovthen 14588e2c76bdSRoman Bolshakov error_exit "GNU make ($make) not found" 14598e2c76bdSRoman Bolshakovfi 1460c53eeaf7SStefan Hajnoczi 1461c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1462c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 14631b11f28dSThomas Huthif ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then 14641b11f28dSThomas Huth error_exit "Cannot use '$python', Python >= 3.6 is required." \ 1465c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1466c53eeaf7SStefan Hajnoczifi 1467c53eeaf7SStefan Hajnoczi 1468755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 1469406ab2f3SCleber 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) 1470755ee70fSCleber Rosa 1471c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1472c53eeaf7SStefan Hajnoczipython="$python -B" 1473c53eeaf7SStefan Hajnoczi 14740a01d76fSMarc-André Lureauif test -z "$meson"; then 14756638cae5SPaolo Bonzini if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.3; then 14760a01d76fSMarc-André Lureau meson=meson 14777d7dbf9dSDan Streetman elif test $git_submodules_action != 'ignore' ; then 14780a01d76fSMarc-André Lureau meson=git 14790a01d76fSMarc-André Lureau elif test -e "${source_path}/meson/meson.py" ; then 14800a01d76fSMarc-André Lureau meson=internal 14810a01d76fSMarc-André Lureau else 14820a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 14830a01d76fSMarc-André Lureau error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 14840a01d76fSMarc-André Lureau else 1485a5665051SPaolo Bonzini error_exit "Meson not found. Use --meson=/path/to/meson" 1486a5665051SPaolo Bonzini fi 14870a01d76fSMarc-André Lureau fi 14880a01d76fSMarc-André Lureauelse 14890a01d76fSMarc-André Lureau # Meson uses its own Python interpreter to invoke other Python scripts, 14900a01d76fSMarc-André Lureau # but the user wants to use the one they specified with --python. 14910a01d76fSMarc-André Lureau # 14920a01d76fSMarc-André Lureau # We do not want to override the distro Python interpreter (and sometimes 14930a01d76fSMarc-André Lureau # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 14940a01d76fSMarc-André Lureau # just require --meson=git|internal together with --python. 14950a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 14960a01d76fSMarc-André Lureau case "$meson" in 14970a01d76fSMarc-André Lureau git | internal) ;; 14980a01d76fSMarc-André Lureau *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 14990a01d76fSMarc-André Lureau esac 15000a01d76fSMarc-André Lureau fi 15010a01d76fSMarc-André Lureaufi 1502a5665051SPaolo Bonzini 15030a01d76fSMarc-André Lureauif test "$meson" = git; then 15040a01d76fSMarc-André Lureau git_submodules="${git_submodules} meson" 15050a01d76fSMarc-André Lureaufi 15060a01d76fSMarc-André Lureau 15070a01d76fSMarc-André Lureaucase "$meson" in 15080a01d76fSMarc-André Lureau git | internal) 15090a01d76fSMarc-André Lureau meson="$python ${source_path}/meson/meson.py" 15100a01d76fSMarc-André Lureau ;; 151184ec0c24SPaolo Bonzini *) meson=$(command -v "$meson") ;; 15120a01d76fSMarc-André Lureauesac 15130a01d76fSMarc-André Lureau 151409e93326SPaolo Bonzini# Probe for ninja 151548328880SPaolo Bonzini 151648328880SPaolo Bonziniif test -z "$ninja"; then 151748328880SPaolo Bonzini for c in ninja ninja-build samu; do 151848328880SPaolo Bonzini if has $c; then 151948328880SPaolo Bonzini ninja=$(command -v "$c") 152048328880SPaolo Bonzini break 152148328880SPaolo Bonzini fi 152248328880SPaolo Bonzini done 152309e93326SPaolo Bonzini if test -z "$ninja"; then 152409e93326SPaolo Bonzini error_exit "Cannot find Ninja" 152509e93326SPaolo Bonzini fi 152648328880SPaolo Bonzinifi 1527a5665051SPaolo Bonzini 15289aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 15299aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 15309aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 15319aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 15329aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 15339aae6e54SDaniel Henrique Barbozaif compile_object ; then 15349aae6e54SDaniel Henrique Barboza : C compiler works ok 15359aae6e54SDaniel Henrique Barbozaelse 15369aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 15379aae6e54SDaniel Henrique Barbozafi 15389aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 15399aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 15409aae6e54SDaniel Henrique Barbozafi 15419aae6e54SDaniel Henrique Barboza 15429c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 15439c83ffd8SPeter Maydell# by default. Only enable by default for git builds 15449c83ffd8SPeter Maydellif test -z "$werror" ; then 15457d7dbf9dSDan Streetman if test "$git_submodules_action" != "ignore" && \ 1546e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 15479c83ffd8SPeter Maydell werror="yes" 15489c83ffd8SPeter Maydell else 15499c83ffd8SPeter Maydell werror="no" 15509c83ffd8SPeter Maydell fi 15519c83ffd8SPeter Maydellfi 15529c83ffd8SPeter Maydell 1553975ff037SPaolo Bonziniif test "$targetos" = "bogus"; then 1554fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1555fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1556fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1557fb59dabdSPeter Maydell # host OS we should stop now. 1558951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1559fb59dabdSPeter Maydellfi 1560fb59dabdSPeter Maydell 1561efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 1562efc6c070SThomas Huthcat > $TMPC << EOF 1563efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 1564efc6c070SThomas Huth# ifdef __apple_build_version__ 15652a85a08cSDaniel P. Berrangé# if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0) 15662a85a08cSDaniel P. Berrangé# error You need at least XCode Clang v10.0 to compile QEMU 1567efc6c070SThomas Huth# endif 1568efc6c070SThomas Huth# else 15692a85a08cSDaniel P. Berrangé# if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0) 15702a85a08cSDaniel P. Berrangé# error You need at least Clang v6.0 to compile QEMU 1571efc6c070SThomas Huth# endif 1572efc6c070SThomas Huth# endif 1573efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 15743830df5fSnia# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) 15753830df5fSnia# error You need at least GCC v7.4.0 to compile QEMU 1576efc6c070SThomas Huth# endif 1577efc6c070SThomas Huth#else 1578efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 1579efc6c070SThomas Huth#endif 1580efc6c070SThomas Huthint main (void) { return 0; } 1581efc6c070SThomas HuthEOF 1582efc6c070SThomas Huthif ! compile_prog "" "" ; then 15833830df5fSnia error_exit "You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)" 1584efc6c070SThomas Huthfi 1585efc6c070SThomas Huth 158600849b92SRichard Henderson# Accumulate -Wfoo and -Wno-bar separately. 158700849b92SRichard Henderson# We will list all of the enable flags first, and the disable flags second. 158800849b92SRichard Henderson# Note that we do not add -Werror, because that would enable it for all 158900849b92SRichard Henderson# configure tests. If a configure test failed due to -Werror this would 159000849b92SRichard Henderson# just silently disable some features, so it's too error prone. 159100849b92SRichard Henderson 159200849b92SRichard Hendersonwarn_flags= 159300849b92SRichard Hendersonadd_to warn_flags -Wold-style-declaration 159400849b92SRichard Hendersonadd_to warn_flags -Wold-style-definition 159500849b92SRichard Hendersonadd_to warn_flags -Wtype-limits 159600849b92SRichard Hendersonadd_to warn_flags -Wformat-security 159700849b92SRichard Hendersonadd_to warn_flags -Wformat-y2k 159800849b92SRichard Hendersonadd_to warn_flags -Winit-self 159900849b92SRichard Hendersonadd_to warn_flags -Wignored-qualifiers 160000849b92SRichard Hendersonadd_to warn_flags -Wempty-body 160100849b92SRichard Hendersonadd_to warn_flags -Wnested-externs 160200849b92SRichard Hendersonadd_to warn_flags -Wendif-labels 160300849b92SRichard Hendersonadd_to warn_flags -Wexpansion-to-defined 16040a2ebce9SThomas Huthadd_to warn_flags -Wimplicit-fallthrough=2 160500849b92SRichard Henderson 160600849b92SRichard Hendersonnowarn_flags= 160700849b92SRichard Hendersonadd_to nowarn_flags -Wno-initializer-overrides 160800849b92SRichard Hendersonadd_to nowarn_flags -Wno-missing-include-dirs 160900849b92SRichard Hendersonadd_to nowarn_flags -Wno-shift-negative-value 161000849b92SRichard Hendersonadd_to nowarn_flags -Wno-string-plus-int 161100849b92SRichard Hendersonadd_to nowarn_flags -Wno-typedef-redefinition 1612aabab967SRichard Hendersonadd_to nowarn_flags -Wno-tautological-type-limit-compare 1613bac8d222SRichard Hendersonadd_to nowarn_flags -Wno-psabi 161400849b92SRichard Henderson 161500849b92SRichard Hendersongcc_flags="$warn_flags $nowarn_flags" 161693b25869SJohn Snow 161793b25869SJohn Snowcc_has_warning_flag() { 161893b25869SJohn Snow write_c_skeleton; 161993b25869SJohn Snow 1620a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1621a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1622a1d29d6cSPeter Maydell # warning options). 162393b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 162493b25869SJohn Snow compile_prog "-Werror $optflag" "" 162593b25869SJohn Snow} 162693b25869SJohn Snow 162793b25869SJohn Snowfor flag in $gcc_flags; do 162893b25869SJohn Snow if cc_has_warning_flag $flag ; then 16298d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 16308d05095cSPaolo Bonzini fi 16318d05095cSPaolo Bonzinidone 16328d05095cSPaolo Bonzini 163363678e17SSteven Noonanif test "$stack_protector" != "no"; then 1634fccd35a0SRodrigo Rebello cat > $TMPC << EOF 1635fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 1636fccd35a0SRodrigo Rebello{ 1637fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 1638fccd35a0SRodrigo Rebello while (*c) { 1639fccd35a0SRodrigo Rebello *p++ = *c++; 1640fccd35a0SRodrigo Rebello } 1641fccd35a0SRodrigo Rebello return 0; 1642fccd35a0SRodrigo Rebello} 1643fccd35a0SRodrigo RebelloEOF 164463678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 16453b463a3fSMiroslav Rezanina sp_on=0 164663678e17SSteven Noonan for flag in $gcc_flags; do 1647590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 1648590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 1649086d5f75SPaolo Bonzini if compile_object "-Werror $flag" && 1650590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 165163678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 1652db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 16533b463a3fSMiroslav Rezanina sp_on=1 165463678e17SSteven Noonan break 165563678e17SSteven Noonan fi 165663678e17SSteven Noonan done 16573b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 16583b463a3fSMiroslav Rezanina if test $sp_on = 0; then 16593b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 16603b463a3fSMiroslav Rezanina fi 16613b463a3fSMiroslav Rezanina fi 166237746c5eSMarc-André Lureaufi 166337746c5eSMarc-André Lureau 166420bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 166520bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 166620bc94a2SPaolo Bonzinicat > $TMPC << EOF 166720bc94a2SPaolo Bonzinistruct { 166820bc94a2SPaolo Bonzini int a[2]; 166920bc94a2SPaolo Bonzini} x = {0}; 167020bc94a2SPaolo BonziniEOF 167120bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 167220bc94a2SPaolo Bonzini : 167320bc94a2SPaolo Bonzinielse 167420bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 167520bc94a2SPaolo Bonzinifi 167620bc94a2SPaolo Bonzini 167721e709aaSMarc-André Lureau# Our module code doesn't support Windows 167821e709aaSMarc-André Lureauif test "$modules" = "yes" && test "$mingw32" = "yes" ; then 167921e709aaSMarc-André Lureau error_exit "Modules are not available for Windows" 168021e709aaSMarc-André Lureaufi 168121e709aaSMarc-André Lureau 1682bd83c861SChristian Ehrhardt# module_upgrades is only reasonable if modules are enabled 1683bd83c861SChristian Ehrhardtif test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 1684bd83c861SChristian Ehrhardt error_exit "Can't enable module-upgrades as Modules are not enabled" 1685bd83c861SChristian Ehrhardtfi 1686bd83c861SChristian Ehrhardt 16875f2453acSAlex Bennée# Static linking is not possible with plugins, modules or PIE 168840d6444eSAvi Kivityif test "$static" = "yes" ; then 1689aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1690aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1691aa0d1f44SPaolo Bonzini fi 16925f2453acSAlex Bennée if test "$plugins" = "yes"; then 16935f2453acSAlex Bennée error_exit "static and plugins are mutually incompatible" 1694ba4dd2aaSAlex Bennée else 1695ba4dd2aaSAlex Bennée plugins="no" 16965f2453acSAlex Bennée fi 169740d6444eSAvi Kivityfi 1698*37650689SPaolo Bonzinitest "$plugins" = "" && plugins=yes 169940d6444eSAvi Kivity 170040d6444eSAvi Kivitycat > $TMPC << EOF 170121d4a791SAvi Kivity 170221d4a791SAvi Kivity#ifdef __linux__ 170321d4a791SAvi Kivity# define THREAD __thread 170421d4a791SAvi Kivity#else 170521d4a791SAvi Kivity# define THREAD 170621d4a791SAvi Kivity#endif 170721d4a791SAvi Kivitystatic THREAD int tls_var; 170821d4a791SAvi Kivityint main(void) { return tls_var; } 170940d6444eSAvi KivityEOF 1710b2634124SRichard Henderson 1711ffd205efSJessica Clarke# Check we support -fno-pie and -no-pie first; we will need the former for 1712ffd205efSJessica Clarke# building ROMs, and both for everything if --disable-pie is passed. 1713412aeacdSAlex Bennéeif compile_prog "-Werror -fno-pie" "-no-pie"; then 1714412aeacdSAlex Bennée CFLAGS_NOPIE="-fno-pie" 1715ffd205efSJessica Clarke LDFLAGS_NOPIE="-no-pie" 1716412aeacdSAlex Bennéefi 1717412aeacdSAlex Bennée 171812781462SRichard Hendersonif test "$static" = "yes"; then 1719eca7a8e6SRichard Henderson if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 17205770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 172112781462SRichard Henderson QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 172212781462SRichard Henderson pie="yes" 172312781462SRichard Henderson elif test "$pie" = "yes"; then 172412781462SRichard Henderson error_exit "-static-pie not available due to missing toolchain support" 172512781462SRichard Henderson else 172612781462SRichard Henderson QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 172712781462SRichard Henderson pie="no" 172812781462SRichard Henderson fi 172912781462SRichard Hendersonelif test "$pie" = "no"; then 17305770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" 1731ffd205efSJessica Clarke CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS" 1732eca7a8e6SRichard Hendersonelif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 17335770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 17345770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" 173540d6444eSAvi Kivity pie="yes" 17362c674109SRichard Hendersonelif test "$pie" = "yes"; then 173776ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 173840d6444eSAvi Kivityelse 173940d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 174040d6444eSAvi Kivity pie="no" 174140d6444eSAvi Kivityfi 174240d6444eSAvi Kivity 1743e6cbd751SRichard Henderson# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 1744e6cbd751SRichard Henderson# The combination is known as "full relro", because .got.plt is read-only too. 1745e6cbd751SRichard Hendersonif compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 1746e6cbd751SRichard Henderson QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 1747e6cbd751SRichard Hendersonfi 1748e6cbd751SRichard Henderson 174909dada40SPaolo Bonzini########################################## 175009dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 175109dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 175209dada40SPaolo Bonzini# specification is necessary 175309dada40SPaolo Bonzini 175409dada40SPaolo Bonziniif test "$cpu" = "i386"; then 175509dada40SPaolo Bonzini cat > $TMPC << EOF 175609dada40SPaolo Bonzinistatic int sfaa(int *ptr) 175709dada40SPaolo Bonzini{ 175809dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 175909dada40SPaolo Bonzini} 176009dada40SPaolo Bonzini 176109dada40SPaolo Bonziniint main(void) 176209dada40SPaolo Bonzini{ 176309dada40SPaolo Bonzini int val = 42; 17641405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 176509dada40SPaolo Bonzini sfaa(&val); 176609dada40SPaolo Bonzini return val; 176709dada40SPaolo Bonzini} 176809dada40SPaolo BonziniEOF 176909dada40SPaolo Bonzini if ! compile_prog "" "" ; then 177009dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 177109dada40SPaolo Bonzini fi 177209dada40SPaolo Bonzinifi 177309dada40SPaolo Bonzini 177456267b62SPhilippe Mathieu-Daudéif test "$tcg" = "enabled"; then 177556267b62SPhilippe Mathieu-Daudé git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 177656267b62SPhilippe Mathieu-Daudé git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 177756267b62SPhilippe Mathieu-Daudéfi 177856267b62SPhilippe Mathieu-Daudé 1779afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1780fdb75aefSPaolo Bonzini default_targets=yes 1781d880a3baSPaolo Bonzini for target in $default_target_list; do 1782d880a3baSPaolo Bonzini target_list="$target_list $target" 1783d880a3baSPaolo Bonzini done 1784d880a3baSPaolo Bonzini target_list="${target_list# }" 1785121afa9eSAnthony Liguorielse 1786fdb75aefSPaolo Bonzini default_targets=no 178789138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 1788d880a3baSPaolo Bonzini for target in $target_list; do 178925b48338SPeter Maydell # Check that we recognised the target name; this allows a more 179025b48338SPeter Maydell # friendly error message than if we let it fall through. 179125b48338SPeter Maydell case " $default_target_list " in 179225b48338SPeter Maydell *" $target "*) 179325b48338SPeter Maydell ;; 179425b48338SPeter Maydell *) 179525b48338SPeter Maydell error_exit "Unknown target name '$target'" 179625b48338SPeter Maydell ;; 179725b48338SPeter Maydell esac 179825b48338SPeter Maydell done 1799d880a3baSPaolo Bonzinifi 180025b48338SPeter Maydell 1801fdb75aefSPaolo Bonzinifor target in $target_list; do 1802fdb75aefSPaolo Bonzini # if a deprecated target is enabled we note it here 1803fdb75aefSPaolo Bonzini if echo "$deprecated_targets_list" | grep -q "$target"; then 1804fdb75aefSPaolo Bonzini add_to deprecated_features $target 1805fdb75aefSPaolo Bonzini fi 1806fdb75aefSPaolo Bonzinidone 1807fdb75aefSPaolo Bonzini 1808f55fe278SPaolo Bonzini# see if system emulation was really requested 1809f55fe278SPaolo Bonzinicase " $target_list " in 1810f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1811f55fe278SPaolo Bonzini ;; 1812f55fe278SPaolo Bonzini *) softmmu=no 1813f55fe278SPaolo Bonzini ;; 1814f55fe278SPaolo Bonziniesac 18155327cf48Sbellard 1816249247c9SJuan Quintelafeature_not_found() { 1817249247c9SJuan Quintela feature=$1 181821684af0SStewart Smith remedy=$2 1819249247c9SJuan Quintela 182076ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 182121684af0SStewart Smith "configure was not able to find it." \ 182221684af0SStewart Smith "$remedy" 1823249247c9SJuan Quintela} 1824249247c9SJuan Quintela 18257d13299dSbellard# --- 18267d13299dSbellard# big/little endian test 18277d13299dSbellardcat > $TMPC << EOF 1828659eb157SThomas Huth#include <stdio.h> 182961cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 183061cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 1831659eb157SThomas Huthint main(int argc, char *argv[]) 1832659eb157SThomas Huth{ 1833659eb157SThomas Huth return printf("%s %s\n", (char *)big_endian, (char *)little_endian); 18347d13299dSbellard} 18357d13299dSbellardEOF 18367d13299dSbellard 1837659eb157SThomas Huthif compile_prog ; then 1838659eb157SThomas Huth if strings -a $TMPE | grep -q BiGeNdIaN ; then 183961cc919fSMike Frysinger bigendian="yes" 1840659eb157SThomas Huth elif strings -a $TMPE | grep -q LiTtLeEnDiAn ; then 184161cc919fSMike Frysinger bigendian="no" 18427d13299dSbellard else 18437d13299dSbellard echo big/little test failed 1844659eb157SThomas Huth exit 1 18457d13299dSbellard fi 18467d13299dSbellardelse 184761cc919fSMike Frysinger echo big/little test failed 1848659eb157SThomas Huth exit 1 18497d13299dSbellardfi 18507d13299dSbellard 1851b0a47e79SJuan Quintela########################################## 1852e10ee3f5SPhilippe Mathieu-Daudé# system tools 1853e10ee3f5SPhilippe Mathieu-Daudéif test -z "$want_tools"; then 1854e10ee3f5SPhilippe Mathieu-Daudé if test "$softmmu" = "no"; then 1855e10ee3f5SPhilippe Mathieu-Daudé want_tools=no 1856e10ee3f5SPhilippe Mathieu-Daudé else 1857e10ee3f5SPhilippe Mathieu-Daudé want_tools=yes 1858e10ee3f5SPhilippe Mathieu-Daudé fi 1859e10ee3f5SPhilippe Mathieu-Daudéfi 1860e10ee3f5SPhilippe Mathieu-Daudé 1861299e6f19SPaolo Bonzini######################################### 1862299e6f19SPaolo Bonzini# vhost interdependencies and host support 1863299e6f19SPaolo Bonzini 1864299e6f19SPaolo Bonzini# vhost backends 1865d88618f7SStefan Hajnocziif test "$vhost_user" = "yes" && test "$linux" != "yes"; then 1866d88618f7SStefan Hajnoczi error_exit "vhost-user is only available on Linux" 1867299e6f19SPaolo Bonzinifi 1868108a6481SCindy Lutest "$vhost_vdpa" = "" && vhost_vdpa=$linux 1869108a6481SCindy Luif test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 1870108a6481SCindy Lu error_exit "vhost-vdpa is only available on Linux" 1871108a6481SCindy Lufi 1872299e6f19SPaolo Bonzinitest "$vhost_kernel" = "" && vhost_kernel=$linux 1873299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 1874299e6f19SPaolo Bonzini error_exit "vhost-kernel is only available on Linux" 1875299e6f19SPaolo Bonzinifi 1876299e6f19SPaolo Bonzini 1877299e6f19SPaolo Bonzini# vhost-kernel devices 1878299e6f19SPaolo Bonzinitest "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 1879299e6f19SPaolo Bonziniif test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 1880299e6f19SPaolo Bonzini error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 1881299e6f19SPaolo Bonzinifi 1882299e6f19SPaolo Bonzinitest "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 1883299e6f19SPaolo Bonziniif test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 1884299e6f19SPaolo Bonzini error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 1885299e6f19SPaolo Bonzinifi 1886299e6f19SPaolo Bonzini 1887299e6f19SPaolo Bonzini# vhost-user backends 1888299e6f19SPaolo Bonzinitest "$vhost_net_user" = "" && vhost_net_user=$vhost_user 1889299e6f19SPaolo Bonziniif test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 1890299e6f19SPaolo Bonzini error_exit "--enable-vhost-net-user requires --enable-vhost-user" 1891299e6f19SPaolo Bonzinifi 1892299e6f19SPaolo Bonzinitest "$vhost_crypto" = "" && vhost_crypto=$vhost_user 1893299e6f19SPaolo Bonziniif test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 1894299e6f19SPaolo Bonzini error_exit "--enable-vhost-crypto requires --enable-vhost-user" 1895299e6f19SPaolo Bonzinifi 189698fc1adaSDr. David Alan Gilberttest "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 189798fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 189898fc1adaSDr. David Alan Gilbert error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 189998fc1adaSDr. David Alan Gilbertfi 1900108a6481SCindy Lu#vhost-vdpa backends 1901108a6481SCindy Lutest "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 1902108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 1903108a6481SCindy Lu error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 1904108a6481SCindy Lufi 1905299e6f19SPaolo Bonzini 190640bc0ca9SLaurent Vivier# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity 1907299e6f19SPaolo Bonziniif test "$vhost_net" = ""; then 1908299e6f19SPaolo Bonzini test "$vhost_net_user" = "yes" && vhost_net=yes 190940bc0ca9SLaurent Vivier test "$vhost_net_vdpa" = "yes" && vhost_net=yes 1910299e6f19SPaolo Bonzini test "$vhost_kernel" = "yes" && vhost_net=yes 1911299e6f19SPaolo Bonzinifi 1912299e6f19SPaolo Bonzini 1913015a33bdSGonglei########################################## 1914779ab5e3SStefan Weil# pkg-config probe 1915779ab5e3SStefan Weil 1916779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 191776ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 1918779ab5e3SStefan Weilfi 1919779ab5e3SStefan Weil 1920779ab5e3SStefan Weil########################################## 1921e37630caSaliguori# xen probe 1922e37630caSaliguori 19231badb709SPaolo Bonziniif test "$xen" != "disabled" ; then 1924c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 1925c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 1926c1cdd9d5SJuergen Gross # to obtain all needed flags. 1927c1cdd9d5SJuergen Gross 1928c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 1929c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 1930c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 1931c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 19321badb709SPaolo Bonzini xen=enabled 19335b6a8f43SMichael Tokarev xen_pc="xencontrol xenstore xenforeignmemory xengnttab" 1934c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 193558ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 193658ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 193758ea9a7aSAnthony PERARD fi 1938582ea95fSMarc-André Lureau xen_cflags="$($pkg_config --cflags $xen_pc)" 1939582ea95fSMarc-André Lureau xen_libs="$($pkg_config --libs $xen_pc)" 1940c1cdd9d5SJuergen Gross else 1941c1cdd9d5SJuergen Gross 19425b6a8f43SMichael Tokarev xen_libs="-lxenstore -lxenctrl" 1943d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 1944d5b93ddfSAnthony PERARD 194550ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 194650ced5b3SStefan Weil # If no, we are done and there is no Xen support. 194750ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 194850ced5b3SStefan Weil 194950ced5b3SStefan Weil # Xen (any) 195050ced5b3SStefan Weil cat > $TMPC <<EOF 195150ced5b3SStefan Weil#include <xenctrl.h> 195250ced5b3SStefan Weilint main(void) { 195350ced5b3SStefan Weil return 0; 195450ced5b3SStefan Weil} 195550ced5b3SStefan WeilEOF 195650ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 195750ced5b3SStefan Weil # Xen not found 19581badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 195921684af0SStewart Smith feature_not_found "xen" "Install xen devel" 196050ced5b3SStefan Weil fi 19611badb709SPaolo Bonzini xen=disabled 196250ced5b3SStefan Weil 1963d5b93ddfSAnthony PERARD # Xen unstable 196469deef08SPeter Maydell elif 196569deef08SPeter Maydell cat > $TMPC <<EOF && 19662cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 19672cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 19682cbf8903SRoss Lagerwall#include <xendevicemodel.h> 1969d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 19702cbf8903SRoss Lagerwallint main(void) { 19712cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 1972d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 19732cbf8903SRoss Lagerwall 19742cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 19752cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 19762cbf8903SRoss Lagerwall 1977d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 1978d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 1979d3c49ebbSPaul Durrant 19802cbf8903SRoss Lagerwall return 0; 19812cbf8903SRoss Lagerwall} 19822cbf8903SRoss LagerwallEOF 19832cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 19842cbf8903SRoss Lagerwall then 19852cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 19862cbf8903SRoss Lagerwall xen_ctrl_version=41100 19871badb709SPaolo Bonzini xen=enabled 19882cbf8903SRoss Lagerwall elif 19892cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 19905ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 19915ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 199258ea9a7aSAnthony PERARD#include <xentoolcore.h> 19935ba3d756SIgor Druzhininint main(void) { 19945ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 19955ba3d756SIgor Druzhinin 19965ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 19975ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 199858ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 19995ba3d756SIgor Druzhinin 20005ba3d756SIgor Druzhinin return 0; 20015ba3d756SIgor Druzhinin} 20025ba3d756SIgor DruzhininEOF 200358ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 20045ba3d756SIgor Druzhinin then 200558ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 20065ba3d756SIgor Druzhinin xen_ctrl_version=41000 20071badb709SPaolo Bonzini xen=enabled 20085ba3d756SIgor Druzhinin elif 20095ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2010da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2011da8090ccSPaul Durrant#define __XEN_TOOLS__ 2012da8090ccSPaul Durrant#include <xendevicemodel.h> 2013da8090ccSPaul Durrantint main(void) { 2014da8090ccSPaul Durrant xendevicemodel_handle *xd; 2015da8090ccSPaul Durrant 2016da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2017da8090ccSPaul Durrant xendevicemodel_close(xd); 2018da8090ccSPaul Durrant 2019da8090ccSPaul Durrant return 0; 2020da8090ccSPaul Durrant} 2021da8090ccSPaul DurrantEOF 2022da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2023da8090ccSPaul Durrant then 2024da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2025f1167ee6SJuergen Gross xen_ctrl_version=40900 20261badb709SPaolo Bonzini xen=enabled 2027da8090ccSPaul Durrant elif 2028da8090ccSPaul Durrant cat > $TMPC <<EOF && 20295eeb39c2SIan Campbell/* 20305eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 20315eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2032b6eb9b45SPaulina Szubarczyk * 2033b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2034b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2035b6eb9b45SPaulina Szubarczyk */ 2036b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2037b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2038b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2039b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2040b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2041b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2042b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2043b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2044b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2045b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2046b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2047b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2048b6eb9b45SPaulina Szubarczyk#endif 2049b6eb9b45SPaulina Szubarczykint main(void) { 2050b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2051b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2052b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2053b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2054b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2055b6eb9b45SPaulina Szubarczyk 2056b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2057b6eb9b45SPaulina Szubarczyk 2058b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2059b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2060b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2061b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2062b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2063b6eb9b45SPaulina Szubarczyk 2064b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2065b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2066b6eb9b45SPaulina Szubarczyk 2067b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2068b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2069b6eb9b45SPaulina Szubarczyk 2070b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2071b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2072b6eb9b45SPaulina Szubarczyk 2073b6eb9b45SPaulina Szubarczyk return 0; 2074b6eb9b45SPaulina Szubarczyk} 2075b6eb9b45SPaulina SzubarczykEOF 2076b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2077b6eb9b45SPaulina Szubarczyk then 2078f1167ee6SJuergen Gross xen_ctrl_version=40800 20791badb709SPaolo Bonzini xen=enabled 2080b6eb9b45SPaulina Szubarczyk elif 2081b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2082b6eb9b45SPaulina Szubarczyk/* 2083b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2084b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 20855eeb39c2SIan Campbell */ 20865eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 20875eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 20885eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 20895eeb39c2SIan Campbell#include <xenctrl.h> 20905eeb39c2SIan Campbell#include <xenstore.h> 20915eeb39c2SIan Campbell#include <xenevtchn.h> 20925eeb39c2SIan Campbell#include <xengnttab.h> 20935eeb39c2SIan Campbell#include <xenforeignmemory.h> 20945eeb39c2SIan Campbell#include <stdint.h> 20955eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 20965eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 20975eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 20985eeb39c2SIan Campbell#endif 20995eeb39c2SIan Campbellint main(void) { 21005eeb39c2SIan Campbell xc_interface *xc = NULL; 21015eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 21025eeb39c2SIan Campbell xenevtchn_handle *xe; 21035eeb39c2SIan Campbell xengnttab_handle *xg; 21045eeb39c2SIan Campbell 21055eeb39c2SIan Campbell xs_daemon_open(); 21065eeb39c2SIan Campbell 21075eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 21085eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 21095eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 21105eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 21115eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 21125eeb39c2SIan Campbell 21135eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 21145eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 21155eeb39c2SIan Campbell 21165eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 21175eeb39c2SIan Campbell xenevtchn_fd(xe); 21185eeb39c2SIan Campbell 21195eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 21205eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 21215eeb39c2SIan Campbell 21225eeb39c2SIan Campbell return 0; 21235eeb39c2SIan Campbell} 21245eeb39c2SIan CampbellEOF 21255eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 21265eeb39c2SIan Campbell then 2127f1167ee6SJuergen Gross xen_ctrl_version=40701 21281badb709SPaolo Bonzini xen=enabled 2129cdadde39SRoger Pau Monne 2130cdadde39SRoger Pau Monne # Xen 4.6 2131cdadde39SRoger Pau Monne elif 2132cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2133cdadde39SRoger Pau Monne#include <xenctrl.h> 2134e108a3c1SAnthony PERARD#include <xenstore.h> 2135d5b93ddfSAnthony PERARD#include <stdint.h> 2136d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2137d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2138d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2139d5b93ddfSAnthony PERARD#endif 2140d5b93ddfSAnthony PERARDint main(void) { 2141d5b93ddfSAnthony PERARD xc_interface *xc; 2142d5b93ddfSAnthony PERARD xs_daemon_open(); 2143d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2144d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2145d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2146b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 21478688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2148d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 214920a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2150d8b441a3SJan Beulich return 0; 2151d8b441a3SJan Beulich} 2152d8b441a3SJan BeulichEOF 2153d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2154d8b441a3SJan Beulich then 2155f1167ee6SJuergen Gross xen_ctrl_version=40600 21561badb709SPaolo Bonzini xen=enabled 2157d8b441a3SJan Beulich 2158d8b441a3SJan Beulich # Xen 4.5 2159d8b441a3SJan Beulich elif 2160d8b441a3SJan Beulich cat > $TMPC <<EOF && 2161d8b441a3SJan Beulich#include <xenctrl.h> 2162d8b441a3SJan Beulich#include <xenstore.h> 2163d8b441a3SJan Beulich#include <stdint.h> 2164d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2165d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2166d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2167d8b441a3SJan Beulich#endif 2168d8b441a3SJan Beulichint main(void) { 2169d8b441a3SJan Beulich xc_interface *xc; 2170d8b441a3SJan Beulich xs_daemon_open(); 2171d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2172d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2173d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2174d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2175d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 21763996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 21773996e85cSPaul Durrant return 0; 21783996e85cSPaul Durrant} 21793996e85cSPaul DurrantEOF 21803996e85cSPaul Durrant compile_prog "" "$xen_libs" 21813996e85cSPaul Durrant then 2182f1167ee6SJuergen Gross xen_ctrl_version=40500 21831badb709SPaolo Bonzini xen=enabled 21843996e85cSPaul Durrant 21853996e85cSPaul Durrant elif 21863996e85cSPaul Durrant cat > $TMPC <<EOF && 21873996e85cSPaul Durrant#include <xenctrl.h> 21883996e85cSPaul Durrant#include <xenstore.h> 21893996e85cSPaul Durrant#include <stdint.h> 21903996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 21913996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 21923996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 21933996e85cSPaul Durrant#endif 21943996e85cSPaul Durrantint main(void) { 21953996e85cSPaul Durrant xc_interface *xc; 21963996e85cSPaul Durrant xs_daemon_open(); 21973996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 21983996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 21993996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 22003996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 22013996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 22028688e065SStefano Stabellini return 0; 22038688e065SStefano Stabellini} 22048688e065SStefano StabelliniEOF 22058688e065SStefano Stabellini compile_prog "" "$xen_libs" 220669deef08SPeter Maydell then 2207f1167ee6SJuergen Gross xen_ctrl_version=40200 22081badb709SPaolo Bonzini xen=enabled 22098688e065SStefano Stabellini 2210e37630caSaliguori else 22111badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 2212edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2213edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2214fc321b4bSJuan Quintela fi 22151badb709SPaolo Bonzini xen=disabled 2216e37630caSaliguori fi 2217d5b93ddfSAnthony PERARD 22181badb709SPaolo Bonzini if test "$xen" = enabled; then 2219f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 2220582ea95fSMarc-André Lureau xen_libs="$xen_libs $xen_stable_libs " 22215eeb39c2SIan Campbell fi 2222d5b93ddfSAnthony PERARD fi 2223e37630caSaliguori fi 2224c1cdd9d5SJuergen Grossfi 2225e37630caSaliguori 2226d661d9a4SJustin Terry (VM)########################################## 22272da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 22282da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 22292da776dbSMichael R. Hines cat > $TMPC <<EOF 22302da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 22312da776dbSMichael R. Hinesint main(void) { return 0; } 22322da776dbSMichael R. HinesEOF 2233ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 22342da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 22352da776dbSMichael R. Hines rdma="yes" 22362da776dbSMichael R. Hines else 22372da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 22382da776dbSMichael R. Hines error_exit \ 2239ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 22402da776dbSMichael R. Hines " Your options:" \ 2241ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 22422da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 22432da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 22442da776dbSMichael R. Hines fi 22452da776dbSMichael R. Hines rdma="no" 22462da776dbSMichael R. Hines fi 22472da776dbSMichael R. Hinesfi 22482da776dbSMichael R. Hines 224921ab34c9SMarcel Apfelbaum########################################## 225021ab34c9SMarcel Apfelbaum# PVRDMA detection 225121ab34c9SMarcel Apfelbaum 225221ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 225321ab34c9SMarcel Apfelbaum#include <sys/mman.h> 225421ab34c9SMarcel Apfelbaum 225521ab34c9SMarcel Apfelbaumint 225621ab34c9SMarcel Apfelbaummain(void) 225721ab34c9SMarcel Apfelbaum{ 225821ab34c9SMarcel Apfelbaum char buf = 0; 225921ab34c9SMarcel Apfelbaum void *addr = &buf; 226021ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 226121ab34c9SMarcel Apfelbaum 226221ab34c9SMarcel Apfelbaum return 0; 226321ab34c9SMarcel Apfelbaum} 226421ab34c9SMarcel ApfelbaumEOF 226521ab34c9SMarcel Apfelbaum 226621ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 226721ab34c9SMarcel Apfelbaum case "$pvrdma" in 226821ab34c9SMarcel Apfelbaum "") 226921ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 227021ab34c9SMarcel Apfelbaum pvrdma="yes" 227121ab34c9SMarcel Apfelbaum else 227221ab34c9SMarcel Apfelbaum pvrdma="no" 227321ab34c9SMarcel Apfelbaum fi 227421ab34c9SMarcel Apfelbaum ;; 227521ab34c9SMarcel Apfelbaum "yes") 227621ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 227721ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 227821ab34c9SMarcel Apfelbaum fi 227921ab34c9SMarcel Apfelbaum pvrdma="yes" 228021ab34c9SMarcel Apfelbaum ;; 228121ab34c9SMarcel Apfelbaum "no") 228221ab34c9SMarcel Apfelbaum pvrdma="no" 228321ab34c9SMarcel Apfelbaum ;; 228421ab34c9SMarcel Apfelbaum esac 228521ab34c9SMarcel Apfelbaumelse 228621ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 228721ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 228821ab34c9SMarcel Apfelbaum fi 228921ab34c9SMarcel Apfelbaum pvrdma="no" 229021ab34c9SMarcel Apfelbaumfi 229195c6bff3SBenoît Canet 2292ee108585SYuval Shaia# Let's see if enhanced reg_mr is supported 2293ee108585SYuval Shaiaif test "$pvrdma" = "yes" ; then 2294ee108585SYuval Shaia 2295ee108585SYuval Shaiacat > $TMPC <<EOF && 2296ee108585SYuval Shaia#include <infiniband/verbs.h> 2297ee108585SYuval Shaia 2298ee108585SYuval Shaiaint 2299ee108585SYuval Shaiamain(void) 2300ee108585SYuval Shaia{ 2301ee108585SYuval Shaia struct ibv_mr *mr; 2302ee108585SYuval Shaia struct ibv_pd *pd = NULL; 2303ee108585SYuval Shaia size_t length = 10; 2304ee108585SYuval Shaia uint64_t iova = 0; 2305ee108585SYuval Shaia int access = 0; 2306ee108585SYuval Shaia void *addr = NULL; 2307ee108585SYuval Shaia 2308ee108585SYuval Shaia mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 2309ee108585SYuval Shaia 2310ee108585SYuval Shaia ibv_dereg_mr(mr); 2311ee108585SYuval Shaia 2312ee108585SYuval Shaia return 0; 2313ee108585SYuval Shaia} 2314ee108585SYuval ShaiaEOF 2315ee108585SYuval Shaia if ! compile_prog "" "-libverbs"; then 2316ee108585SYuval Shaia QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 2317ee108585SYuval Shaia fi 2318ee108585SYuval Shaiafi 2319ee108585SYuval Shaia 232095c6bff3SBenoît Canet########################################## 2321e18df141SAnthony Liguori# glib support probe 2322a52d28afSPaolo Bonzini 2323b4c6036fSDaniel P. Berrangéglib_req_ver=2.56 2324aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 2325aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 2326a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 2327b906acacSPaolo Bonzinielif test "$plugins" = "yes"; then 2328b906acacSPaolo Bonzini glib_modules="$glib_modules gmodule-no-export-2.0" 232954cb65d8SEmilio G. Cotafi 2330e26110cfSFam Zheng 2331aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 2332e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 233389138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 233489138857SStefan Weil glib_libs=$($pkg_config --libs $i) 2335e18df141SAnthony Liguori else 2336e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 2337e26110cfSFam Zheng fi 2338e26110cfSFam Zhengdone 2339e26110cfSFam Zheng 2340215b0c2fSPaolo Bonzini# This workaround is required due to a bug in pkg-config file for glib as it 2341215b0c2fSPaolo Bonzini# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 2342215b0c2fSPaolo Bonzini 2343215b0c2fSPaolo Bonziniif test "$static" = yes && test "$mingw32" = yes; then 2344215b0c2fSPaolo Bonzini glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags" 2345215b0c2fSPaolo Bonzinifi 2346215b0c2fSPaolo Bonzini 234720cf7b8eSDenis Plotnikovif ! test "$gio" = "no"; then 234820cf7b8eSDenis Plotnikov pass=no 2349f876b765SMarc-André Lureau if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 2350f876b765SMarc-André Lureau gio_cflags=$($pkg_config --cflags gio-2.0) 2351f876b765SMarc-André Lureau gio_libs=$($pkg_config --libs gio-2.0) 235225a97a56SMarc-André Lureau gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 23535ecfb76cSPaolo Bonzini if ! has "$gdbus_codegen"; then 23540dba4897SMarc-André Lureau gdbus_codegen= 23550dba4897SMarc-André Lureau fi 235676346b62SPeter Maydell # Check that the libraries actually work -- Ubuntu 18.04 ships 235776346b62SPeter Maydell # with pkg-config --static --libs data for gio-2.0 that is missing 235876346b62SPeter Maydell # -lblkid and will give a link error. 235913ceae66SPeter Maydell cat > $TMPC <<EOF 236013ceae66SPeter Maydell#include <gio/gio.h> 236113ceae66SPeter Maydellint main(void) 236213ceae66SPeter Maydell{ 236313ceae66SPeter Maydell g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); 236413ceae66SPeter Maydell return 0; 236513ceae66SPeter Maydell} 236613ceae66SPeter MaydellEOF 236713ceae66SPeter Maydell if compile_prog "$gio_cflags" "$gio_libs" ; then 236820cf7b8eSDenis Plotnikov pass=yes 236976346b62SPeter Maydell else 237020cf7b8eSDenis Plotnikov pass=no 2371f876b765SMarc-André Lureau fi 2372f876b765SMarc-André Lureau 237320cf7b8eSDenis Plotnikov if test "$pass" = "yes" && 237420cf7b8eSDenis Plotnikov $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 237525a97a56SMarc-André Lureau gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 237625a97a56SMarc-André Lureau gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 237725a97a56SMarc-André Lureau fi 237820cf7b8eSDenis Plotnikov fi 237920cf7b8eSDenis Plotnikov 238020cf7b8eSDenis Plotnikov if test "$pass" = "no"; then 238120cf7b8eSDenis Plotnikov if test "$gio" = "yes"; then 238220cf7b8eSDenis Plotnikov feature_not_found "gio" "Install libgio >= 2.0" 238320cf7b8eSDenis Plotnikov else 238420cf7b8eSDenis Plotnikov gio=no 238520cf7b8eSDenis Plotnikov fi 238620cf7b8eSDenis Plotnikov else 238720cf7b8eSDenis Plotnikov gio=yes 238820cf7b8eSDenis Plotnikov fi 238920cf7b8eSDenis Plotnikovfi 239025a97a56SMarc-André Lureau 2391977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 2392977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 2393977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 2394977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 2395977a82abSDaniel P. Berrangecat > $TMPC <<EOF 2396977a82abSDaniel P. Berrange#include <glib.h> 2397977a82abSDaniel P. Berrange#include <unistd.h> 2398977a82abSDaniel P. Berrange 2399977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 2400977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 2401977a82abSDaniel P. Berrange 2402977a82abSDaniel P. Berrangeint main(void) { 2403977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 2404977a82abSDaniel P. Berrange return 0; 2405977a82abSDaniel P. Berrange} 2406977a82abSDaniel P. BerrangeEOF 2407977a82abSDaniel P. Berrange 2408215b0c2fSPaolo Bonziniif ! compile_prog "$glib_cflags" "$glib_libs" ; then 2409977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 2410977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 2411977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 2412977a82abSDaniel P. Berrange "build target" 2413977a82abSDaniel P. Berrangefi 2414977a82abSDaniel P. Berrange 24159bda600bSEric Blake# Silence clang warnings triggered by glib < 2.57.2 24169bda600bSEric Blakecat > $TMPC << EOF 24179bda600bSEric Blake#include <glib.h> 24189bda600bSEric Blaketypedef struct Foo { 24199bda600bSEric Blake int i; 24209bda600bSEric Blake} Foo; 24219bda600bSEric Blakestatic void foo_free(Foo *f) 24229bda600bSEric Blake{ 24239bda600bSEric Blake g_free(f); 24249bda600bSEric Blake} 24259bda600bSEric BlakeG_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 24269bda600bSEric Blakeint main(void) { return 0; } 24279bda600bSEric BlakeEOF 24289bda600bSEric Blakeif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 24299bda600bSEric Blake if cc_has_warning_flag "-Wno-unused-function"; then 24309bda600bSEric Blake glib_cflags="$glib_cflags -Wno-unused-function" 24315770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function" 24329bda600bSEric Blake fi 24339bda600bSEric Blakefi 24349bda600bSEric Blake 2435e26110cfSFam Zheng########################################## 2436e26110cfSFam Zheng# SHA command probe for modules 2437e26110cfSFam Zhengif test "$modules" = yes; then 2438e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 2439e26110cfSFam Zheng for c in $shacmd_probe; do 24408ccefb91SFam Zheng if has $c; then 2441e26110cfSFam Zheng shacmd="$c" 2442e26110cfSFam Zheng break 2443e26110cfSFam Zheng fi 2444e26110cfSFam Zheng done 2445e26110cfSFam Zheng if test "$shacmd" = ""; then 2446e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 2447e26110cfSFam Zheng fi 2448e18df141SAnthony Liguorifi 2449e18df141SAnthony Liguori 2450e18df141SAnthony Liguori########################################## 24517aaa6a16SPaolo Bonzini# TPM emulation is only on POSIX 24523b8acc11SPaolo Bonzini 24537aaa6a16SPaolo Bonziniif test "$tpm" = ""; then 24547aaa6a16SPaolo Bonzini if test "$mingw32" = "yes"; then 24557aaa6a16SPaolo Bonzini tpm=no 24563b8acc11SPaolo Bonzini else 24577aaa6a16SPaolo Bonzini tpm=yes 24587aaa6a16SPaolo Bonzini fi 24597aaa6a16SPaolo Bonzinielif test "$tpm" = "yes"; then 24607aaa6a16SPaolo Bonzini if test "$mingw32" = "yes" ; then 24617aaa6a16SPaolo Bonzini error_exit "TPM emulation only available on POSIX systems" 24627aaa6a16SPaolo Bonzini fi 24633b8acc11SPaolo Bonzinifi 24643b8acc11SPaolo Bonzini 24653b8acc11SPaolo Bonzini########################################## 2466f652e6afSaurel32# fdt probe 2467e169e1e1SPeter Maydell 2468fbb4121dSPaolo Bonzinicase "$fdt" in 2469fbb4121dSPaolo Bonzini auto | enabled | internal) 2470fbb4121dSPaolo Bonzini # Simpler to always update submodule, even if not needed. 2471aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 2472fbb4121dSPaolo Bonzini ;; 2473fbb4121dSPaolo Bonziniesac 2474f652e6afSaurel32 247520ff075bSMichael Walle########################################## 24769d49bcf6SMarkus Armbruster# opengl probe (for sdl2, gtk) 2477b1546f32SGerd Hoffmann 2478da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 2479bc6a3565SAkihiko Odaki epoxy=no 2480bc6a3565SAkihiko Odaki if $pkg_config epoxy; then 2481bc6a3565SAkihiko Odaki cat > $TMPC << EOF 2482bc6a3565SAkihiko Odaki#include <epoxy/egl.h> 2483bc6a3565SAkihiko Odakiint main(void) { return 0; } 2484bc6a3565SAkihiko OdakiEOF 2485bc6a3565SAkihiko Odaki if compile_prog "" "" ; then 2486bc6a3565SAkihiko Odaki epoxy=yes 2487bc6a3565SAkihiko Odaki fi 2488bc6a3565SAkihiko Odaki fi 2489bc6a3565SAkihiko Odaki 2490bc6a3565SAkihiko Odaki if test "$epoxy" = "yes" ; then 2491bc6a3565SAkihiko Odaki opengl_cflags="$($pkg_config --cflags epoxy)" 2492bc6a3565SAkihiko Odaki opengl_libs="$($pkg_config --libs epoxy)" 2493da076ffeSGerd Hoffmann opengl=yes 249420ff075bSMichael Walle else 2495da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 2496bc6a3565SAkihiko Odaki feature_not_found "opengl" "Please install epoxy with EGL" 249720ff075bSMichael Walle fi 2498f676c67eSJeremy White opengl_cflags="" 2499da076ffeSGerd Hoffmann opengl_libs="" 2500da076ffeSGerd Hoffmann opengl=no 250120ff075bSMichael Walle fi 250220ff075bSMichael Wallefi 250320ff075bSMichael Walle 2504dcc38d1cSMarcelo Tosatti########################################## 2505a99d57bbSWanlong Gao# libnuma probe 2506a99d57bbSWanlong Gao 2507a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 2508a99d57bbSWanlong Gao cat > $TMPC << EOF 2509a99d57bbSWanlong Gao#include <numa.h> 2510a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 2511a99d57bbSWanlong GaoEOF 2512a99d57bbSWanlong Gao 2513a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 2514a99d57bbSWanlong Gao numa=yes 2515ab318051SMarc-André Lureau numa_libs="-lnuma" 2516a99d57bbSWanlong Gao else 2517a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 2518a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 2519a99d57bbSWanlong Gao fi 2520a99d57bbSWanlong Gao numa=no 2521a99d57bbSWanlong Gao fi 2522a99d57bbSWanlong Gaofi 2523a99d57bbSWanlong Gao 2524955727d2SCortland Tölva# check for usbfs 2525955727d2SCortland Tölvahave_usbfs=no 2526955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 252796566d09SThomas Petazzoni cat > $TMPC << EOF 252896566d09SThomas Petazzoni#include <linux/usbdevice_fs.h> 252996566d09SThomas Petazzoni 253096566d09SThomas Petazzoni#ifndef USBDEVFS_GET_CAPABILITIES 253196566d09SThomas Petazzoni#error "USBDEVFS_GET_CAPABILITIES undefined" 253296566d09SThomas Petazzoni#endif 253396566d09SThomas Petazzoni 253496566d09SThomas Petazzoni#ifndef USBDEVFS_DISCONNECT_CLAIM 253596566d09SThomas Petazzoni#error "USBDEVFS_DISCONNECT_CLAIM undefined" 253696566d09SThomas Petazzoni#endif 253796566d09SThomas Petazzoni 253896566d09SThomas Petazzoniint main(void) 253996566d09SThomas Petazzoni{ 254096566d09SThomas Petazzoni return 0; 254196566d09SThomas Petazzoni} 254296566d09SThomas PetazzoniEOF 254396566d09SThomas Petazzoni if compile_prog "" ""; then 2544955727d2SCortland Tölva have_usbfs=yes 2545955727d2SCortland Tölva fi 2546955727d2SCortland Tölvafi 2547751bcc39SMarc-André Lureau 2548de5071c5SBlue Swirl########################################## 2549d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 2550d9840e25STomoki Sekiyama 2551e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 2552e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 2553d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 2554690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 2555d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 2556d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 2557690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 2558d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 2559d9840e25STomoki Sekiyama ;; 2560690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 2561d9840e25STomoki Sekiyama esac 2562d9840e25STomoki Sekiyama cat > $TMPC << EOF 2563d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 2564d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 2565d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 2566d9840e25STomoki SekiyamaEOF 2567d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 2568d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 2569d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 2570315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 2571f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 2572d9840e25STomoki Sekiyama else 2573d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 2574d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 2575d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 2576d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 2577d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 2578d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 2579d9840e25STomoki Sekiyama feature_not_found "VSS support" 2580d9840e25STomoki Sekiyama fi 2581d9840e25STomoki Sekiyama guest_agent_with_vss="no" 2582d9840e25STomoki Sekiyama fi 2583d9840e25STomoki Sekiyamafi 2584d9840e25STomoki Sekiyama 2585d9840e25STomoki Sekiyama########################################## 2586d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 2587d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 2588d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 2589d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 2590d9840e25STomoki Sekiyama 2591e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 2592e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 2593d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 2594d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 2595d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 2596d9840e25STomoki Sekiyama if test -n "$programfiles"; then 2597d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 2598d9840e25STomoki Sekiyama else 2599d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 2600d9840e25STomoki Sekiyama fi 2601d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 2602d9840e25STomoki Sekiyama win_sdk="" 2603d9840e25STomoki Sekiyama fi 2604d9840e25STomoki Sekiyamafi 2605d9840e25STomoki Sekiyama 2606d9840e25STomoki Sekiyama########################################## 260750cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 2608e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 260950cbebb9SMichael Roth cat > $TMPC << EOF 261050cbebb9SMichael Roth#include <windows.h> 261150cbebb9SMichael Roth#include <ntddscsi.h> 261250cbebb9SMichael Rothint main(void) { 261350cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 261450cbebb9SMichael Roth#error Missing required ioctl definitions 261550cbebb9SMichael Roth#endif 261650cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 261750cbebb9SMichael Roth return addr.Lun; 261850cbebb9SMichael Roth} 261950cbebb9SMichael RothEOF 262050cbebb9SMichael Roth if compile_prog "" "" ; then 262150cbebb9SMichael Roth guest_agent_ntddscsi=yes 2622996b9cdcSMatt Hines libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 262350cbebb9SMichael Roth fi 262450cbebb9SMichael Rothfi 262550cbebb9SMichael Roth 262650cbebb9SMichael Roth########################################## 26278ca80760SRichard Henderson# capstone 26288ca80760SRichard Henderson 2629e219c499SRichard Hendersoncase "$capstone" in 26308b18cdbfSRichard Henderson auto | enabled | internal) 26318b18cdbfSRichard Henderson # Simpler to always update submodule, even if not needed. 2632e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 2633e219c499SRichard Henderson ;; 2634e219c499SRichard Hendersonesac 26358ca80760SRichard Henderson 26368ca80760SRichard Henderson########################################## 2637519175a2SAlex Barcelo# check and set a backend for coroutine 2638d0e2fce5SAneesh Kumar K.V 26397c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 264033c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 264133c53c54SDaniel P. Berrange# specific one. 26427c2acc70SPeter Maydell 26437c2acc70SPeter Maydellucontext_works=no 2644d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 2645d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2646d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 2647cdf84806SPeter Maydell#ifdef __stub_makecontext 2648cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 2649cdf84806SPeter Maydell#endif 265075cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2651d0e2fce5SAneesh Kumar K.VEOF 2652d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 26537c2acc70SPeter Maydell ucontext_works=yes 2654d0e2fce5SAneesh Kumar K.V fi 2655519175a2SAlex Barcelofi 26567c2acc70SPeter Maydell 26577c2acc70SPeter Maydellif test "$coroutine" = ""; then 26587c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 26597c2acc70SPeter Maydell coroutine=win32 26607c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 26617c2acc70SPeter Maydell coroutine=ucontext 2662519175a2SAlex Barcelo else 26637c2acc70SPeter Maydell coroutine=sigaltstack 26647c2acc70SPeter Maydell fi 26657c2acc70SPeter Maydellelse 26667c2acc70SPeter Maydell case $coroutine in 26677c2acc70SPeter Maydell windows) 26687c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 26697c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 26707c2acc70SPeter Maydell fi 26717c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 26727c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 26737c2acc70SPeter Maydell coroutine=win32 26747c2acc70SPeter Maydell ;; 26757c2acc70SPeter Maydell ucontext) 26767c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 26777c2acc70SPeter Maydell feature_not_found "ucontext" 26787c2acc70SPeter Maydell fi 26797c2acc70SPeter Maydell ;; 268033c53c54SDaniel P. Berrange sigaltstack) 26817c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 26827c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 26837c2acc70SPeter Maydell fi 26847c2acc70SPeter Maydell ;; 26857c2acc70SPeter Maydell *) 268676ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 26877c2acc70SPeter Maydell ;; 26887c2acc70SPeter Maydell esac 2689d0e2fce5SAneesh Kumar K.Vfi 2690d0e2fce5SAneesh Kumar K.V 269170c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 269270c60c08SStefan Hajnoczi coroutine_pool=yes 269370c60c08SStefan Hajnoczifi 269470c60c08SStefan Hajnoczi 26957d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 26967d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 26977d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 26987d992e4dSPeter Lieven coroutine_pool=no 26997d992e4dSPeter Lieven fi 27007d992e4dSPeter Lievenfi 27017d992e4dSPeter Lieven 27021e4f6065SDaniele Buono################################################## 27031e4f6065SDaniele Buono# SafeStack 27041e4f6065SDaniele Buono 27051e4f6065SDaniele Buono 27061e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 27071e4f6065SDaniele Buonocat > $TMPC << EOF 27081e4f6065SDaniele Buonoint main(int argc, char *argv[]) 27091e4f6065SDaniele Buono{ 27101e4f6065SDaniele Buono#if ! __has_feature(safe_stack) 27111e4f6065SDaniele Buono#error SafeStack Disabled 27121e4f6065SDaniele Buono#endif 27131e4f6065SDaniele Buono return 0; 27141e4f6065SDaniele Buono} 27151e4f6065SDaniele BuonoEOF 27161e4f6065SDaniele Buono flag="-fsanitize=safe-stack" 27171e4f6065SDaniele Buono # Check that safe-stack is supported and enabled. 27181e4f6065SDaniele Buono if compile_prog "-Werror $flag" "$flag"; then 27191e4f6065SDaniele Buono # Flag needed both at compilation and at linking 27201e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 27211e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 27221e4f6065SDaniele Buono else 27231e4f6065SDaniele Buono error_exit "SafeStack not supported by your compiler" 27241e4f6065SDaniele Buono fi 27251e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 27261e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 27271e4f6065SDaniele Buono fi 27281e4f6065SDaniele Buonoelse 27291e4f6065SDaniele Buonocat > $TMPC << EOF 27301e4f6065SDaniele Buonoint main(int argc, char *argv[]) 27311e4f6065SDaniele Buono{ 27321e4f6065SDaniele Buono#if defined(__has_feature) 27331e4f6065SDaniele Buono#if __has_feature(safe_stack) 27341e4f6065SDaniele Buono#error SafeStack Enabled 27351e4f6065SDaniele Buono#endif 27361e4f6065SDaniele Buono#endif 27371e4f6065SDaniele Buono return 0; 27381e4f6065SDaniele Buono} 27391e4f6065SDaniele BuonoEOF 27401e4f6065SDaniele Buonoif test "$safe_stack" = "no"; then 27411e4f6065SDaniele Buono # Make sure that safe-stack is disabled 27421e4f6065SDaniele Buono if ! compile_prog "-Werror" ""; then 27431e4f6065SDaniele Buono # SafeStack was already enabled, try to explicitly remove the feature 27441e4f6065SDaniele Buono flag="-fno-sanitize=safe-stack" 27451e4f6065SDaniele Buono if ! compile_prog "-Werror $flag" "$flag"; then 27461e4f6065SDaniele Buono error_exit "Configure cannot disable SafeStack" 27471e4f6065SDaniele Buono fi 27481e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 27491e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 27501e4f6065SDaniele Buono fi 27511e4f6065SDaniele Buonoelse # "$safe_stack" = "" 27521e4f6065SDaniele Buono # Set safe_stack to yes or no based on pre-existing flags 27531e4f6065SDaniele Buono if compile_prog "-Werror" ""; then 27541e4f6065SDaniele Buono safe_stack="no" 27551e4f6065SDaniele Buono else 27561e4f6065SDaniele Buono safe_stack="yes" 27571e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 27581e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 27591e4f6065SDaniele Buono fi 27601e4f6065SDaniele Buono fi 27611e4f6065SDaniele Buonofi 27621e4f6065SDaniele Buonofi 27637d992e4dSPeter Lieven 276476a347e1SRichard Henderson######################################## 276576a347e1SRichard Henderson# check if cpuid.h is usable. 276676a347e1SRichard Henderson 276776a347e1SRichard Hendersoncat > $TMPC << EOF 276876a347e1SRichard Henderson#include <cpuid.h> 276976a347e1SRichard Hendersonint main(void) { 2770774d566cSPeter Maydell unsigned a, b, c, d; 2771774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 2772774d566cSPeter Maydell 2773774d566cSPeter Maydell if (max >= 1) { 2774774d566cSPeter Maydell __cpuid(1, a, b, c, d); 2775774d566cSPeter Maydell } 2776774d566cSPeter Maydell 2777774d566cSPeter Maydell if (max >= 7) { 2778774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 2779774d566cSPeter Maydell } 2780774d566cSPeter Maydell 278176a347e1SRichard Henderson return 0; 278276a347e1SRichard Henderson} 278376a347e1SRichard HendersonEOF 278476a347e1SRichard Hendersonif compile_prog "" "" ; then 278576a347e1SRichard Henderson cpuid_h=yes 278676a347e1SRichard Hendersonfi 278776a347e1SRichard Henderson 27885dd89908SRichard Henderson########################################## 27895dd89908SRichard Henderson# avx2 optimization requirement check 27905dd89908SRichard Henderson# 27915dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 27925dd89908SRichard Henderson# since we won't be able to select the new routines. 27935dd89908SRichard Henderson 2794e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 27955dd89908SRichard Henderson cat > $TMPC << EOF 27965dd89908SRichard Henderson#pragma GCC push_options 27975dd89908SRichard Henderson#pragma GCC target("avx2") 27985dd89908SRichard Henderson#include <cpuid.h> 27995dd89908SRichard Henderson#include <immintrin.h> 28005dd89908SRichard Hendersonstatic int bar(void *a) { 28015dd89908SRichard Henderson __m256i x = *(__m256i *)a; 28025dd89908SRichard Henderson return _mm256_testz_si256(x, x); 28035dd89908SRichard Henderson} 28045dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 28055dd89908SRichard HendersonEOF 28065b945f23SRichard Henderson if compile_object "-Werror" ; then 28075dd89908SRichard Henderson avx2_opt="yes" 280886583a07SLiam Merwick else 280986583a07SLiam Merwick avx2_opt="no" 28105dd89908SRichard Henderson fi 28115dd89908SRichard Hendersonfi 28125dd89908SRichard Henderson 28136b8cd447SRobert Hoo########################################## 28146b8cd447SRobert Hoo# avx512f optimization requirement check 28156b8cd447SRobert Hoo# 28166b8cd447SRobert Hoo# There is no point enabling this if cpuid.h is not usable, 28176b8cd447SRobert Hoo# since we won't be able to select the new routines. 28186b8cd447SRobert Hoo# by default, it is turned off. 28196b8cd447SRobert Hoo# if user explicitly want to enable it, check environment 28206b8cd447SRobert Hoo 28216b8cd447SRobert Hooif test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 28226b8cd447SRobert Hoo cat > $TMPC << EOF 28236b8cd447SRobert Hoo#pragma GCC push_options 28246b8cd447SRobert Hoo#pragma GCC target("avx512f") 28256b8cd447SRobert Hoo#include <cpuid.h> 28266b8cd447SRobert Hoo#include <immintrin.h> 28276b8cd447SRobert Hoostatic int bar(void *a) { 28286b8cd447SRobert Hoo __m512i x = *(__m512i *)a; 28296b8cd447SRobert Hoo return _mm512_test_epi64_mask(x, x); 28306b8cd447SRobert Hoo} 28316b8cd447SRobert Hooint main(int argc, char *argv[]) 28326b8cd447SRobert Hoo{ 28336b8cd447SRobert Hoo return bar(argv[0]); 28346b8cd447SRobert Hoo} 28356b8cd447SRobert HooEOF 28365b945f23SRichard Henderson if ! compile_object "-Werror" ; then 28376b8cd447SRobert Hoo avx512f_opt="no" 28386b8cd447SRobert Hoo fi 28396b8cd447SRobert Hooelse 28406b8cd447SRobert Hoo avx512f_opt="no" 28416b8cd447SRobert Hoofi 28426b8cd447SRobert Hoo 2843f540166bSRichard Henderson######################################## 2844f540166bSRichard Henderson# check if __[u]int128_t is usable. 2845f540166bSRichard Henderson 2846f540166bSRichard Hendersonint128=no 2847f540166bSRichard Hendersoncat > $TMPC << EOF 2848f540166bSRichard Henderson__int128_t a; 2849f540166bSRichard Henderson__uint128_t b; 2850f540166bSRichard Hendersonint main (void) { 2851f540166bSRichard Henderson a = a + b; 2852f540166bSRichard Henderson b = a * b; 2853464e3671SPeter Maydell a = a * a; 2854f540166bSRichard Henderson return 0; 2855f540166bSRichard Henderson} 2856f540166bSRichard HendersonEOF 2857f540166bSRichard Hendersonif compile_prog "" "" ; then 2858f540166bSRichard Henderson int128=yes 2859f540166bSRichard Hendersonfi 286076a347e1SRichard Henderson 28617ebee43eSRichard Henderson######################################### 28627ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 28637ebee43eSRichard Henderson 28647ebee43eSRichard Hendersonatomic128=no 28657ebee43eSRichard Hendersonif test "$int128" = "yes"; then 28667ebee43eSRichard Henderson cat > $TMPC << EOF 28677ebee43eSRichard Hendersonint main(void) 28687ebee43eSRichard Henderson{ 28697ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 2870bceac547SThomas Huth y = __atomic_load(&x, 0); 2871bceac547SThomas Huth __atomic_store(&x, y, 0); 2872bceac547SThomas Huth __atomic_compare_exchange(&x, &y, x, 0, 0, 0); 28737ebee43eSRichard Henderson return 0; 28747ebee43eSRichard Henderson} 28757ebee43eSRichard HendersonEOF 28767ebee43eSRichard Henderson if compile_prog "" "" ; then 28777ebee43eSRichard Henderson atomic128=yes 28787ebee43eSRichard Henderson fi 28797ebee43eSRichard Hendersonfi 28807ebee43eSRichard Henderson 2881e6cd4bb5SRichard Hendersoncmpxchg128=no 2882e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 2883e6cd4bb5SRichard Henderson cat > $TMPC << EOF 2884e6cd4bb5SRichard Hendersonint main(void) 2885e6cd4bb5SRichard Henderson{ 2886e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 2887e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 2888e6cd4bb5SRichard Henderson return 0; 2889e6cd4bb5SRichard Henderson} 2890e6cd4bb5SRichard HendersonEOF 2891e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 2892e6cd4bb5SRichard Henderson cmpxchg128=yes 2893e6cd4bb5SRichard Henderson fi 2894e6cd4bb5SRichard Hendersonfi 2895e6cd4bb5SRichard Henderson 2896fd0e6053SJohn Snow######################################## 2897fd0e6053SJohn Snow# check if ccache is interfering with 2898fd0e6053SJohn Snow# semantic analysis of macros 2899fd0e6053SJohn Snow 29005e4dfd3dSJohn Snowunset CCACHE_CPP2 2901fd0e6053SJohn Snowccache_cpp2=no 2902fd0e6053SJohn Snowcat > $TMPC << EOF 2903fd0e6053SJohn Snowstatic const int Z = 1; 2904fd0e6053SJohn Snow#define fn() ({ Z; }) 2905fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 2906fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 2907fd0e6053SJohn Snow#define ID(X) (X) 2908fd0e6053SJohn Snowint main(int argc, char *argv[]) 2909fd0e6053SJohn Snow{ 2910fd0e6053SJohn Snow int x = 0, y = 0; 2911fd0e6053SJohn Snow x = ID(x); 2912fd0e6053SJohn Snow x = fn(); 2913fd0e6053SJohn Snow fn(); 2914fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 2915fd0e6053SJohn Snow if (TAUT(Z)) return 0; 2916fd0e6053SJohn Snow return 0; 2917fd0e6053SJohn Snow} 2918fd0e6053SJohn SnowEOF 2919fd0e6053SJohn Snow 2920fd0e6053SJohn Snowif ! compile_object "-Werror"; then 2921fd0e6053SJohn Snow ccache_cpp2=yes 2922fd0e6053SJohn Snowfi 2923fd0e6053SJohn Snow 2924b553a042SJohn Snow################################################# 2925b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 2926b553a042SJohn Snow 2927b553a042SJohn Snowif test "$fortify_source" != "no"; then 2928b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 2929b553a042SJohn Snow fortify_source="no"; 2930e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 2931cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 2932b553a042SJohn Snow fortify_source="no"; 2933b553a042SJohn Snow else 2934b553a042SJohn Snow fortify_source="yes" 2935b553a042SJohn Snow fi 2936b553a042SJohn Snowfi 2937b553a042SJohn Snow 2938d2042378SAneesh Kumar K.V########################################## 2939a40161cbSPaolo Bonzini# check for usable membarrier system call 2940a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 2941a40161cbSPaolo Bonzini have_membarrier=no 2942a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 2943a40161cbSPaolo Bonzini have_membarrier=yes 2944a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 2945a40161cbSPaolo Bonzini cat > $TMPC << EOF 2946a40161cbSPaolo Bonzini #include <linux/membarrier.h> 2947a40161cbSPaolo Bonzini #include <sys/syscall.h> 2948a40161cbSPaolo Bonzini #include <unistd.h> 2949a40161cbSPaolo Bonzini #include <stdlib.h> 2950a40161cbSPaolo Bonzini int main(void) { 2951a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 2952a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 2953a40161cbSPaolo Bonzini exit(0); 2954a40161cbSPaolo Bonzini } 2955a40161cbSPaolo BonziniEOF 2956a40161cbSPaolo Bonzini if compile_prog "" "" ; then 2957a40161cbSPaolo Bonzini have_membarrier=yes 2958a40161cbSPaolo Bonzini fi 2959a40161cbSPaolo Bonzini fi 2960a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 2961a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 2962a40161cbSPaolo Bonzini fi 2963a40161cbSPaolo Bonzinielse 2964a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 2965a40161cbSPaolo Bonzini # work on Wine. 2966a40161cbSPaolo Bonzini membarrier=no 2967a40161cbSPaolo Bonzinifi 2968a40161cbSPaolo Bonzini 2969a40161cbSPaolo Bonzini########################################## 2970f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 29714f67366eSThomas Huthhave_afalg=no 2972f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 2973f0d92b56SLongpeng(Mike)#include <errno.h> 2974f0d92b56SLongpeng(Mike)#include <sys/types.h> 2975f0d92b56SLongpeng(Mike)#include <sys/socket.h> 2976f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 2977f0d92b56SLongpeng(Mike)int main(void) { 2978f0d92b56SLongpeng(Mike) int sock; 2979f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 2980f0d92b56SLongpeng(Mike) return sock; 2981f0d92b56SLongpeng(Mike)} 2982f0d92b56SLongpeng(Mike)EOF 2983f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 2984f0d92b56SLongpeng(Mike) have_afalg=yes 2985f0d92b56SLongpeng(Mike)fi 2986f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 2987f0d92b56SLongpeng(Mike)then 2988f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 2989f0d92b56SLongpeng(Mike) then 2990f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 2991f0d92b56SLongpeng(Mike) fi 2992f0d92b56SLongpeng(Mike)fi 2993f0d92b56SLongpeng(Mike) 2994f0d92b56SLongpeng(Mike) 2995db1ed1abSRichard Henderson########################################## 2996247724cbSMarc-André Lureau# checks for sanitizers 2997247724cbSMarc-André Lureau 2998247724cbSMarc-André Lureauhave_asan=no 2999247724cbSMarc-André Lureauhave_ubsan=no 3000d83414e1SMarc-André Lureauhave_asan_iface_h=no 3001d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 3002247724cbSMarc-André Lureau 3003247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 3004b9f44da2SMarc-André Lureau write_c_skeleton 3005247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 3006247724cbSMarc-André Lureau have_asan=yes 3007247724cbSMarc-André Lureau fi 3008b9f44da2SMarc-André Lureau 3009b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 3010b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 3011b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 3012b9f44da2SMarc-André Lureau cat > $TMPC << EOF 3013b9f44da2SMarc-André Lureau#include <stdlib.h> 3014b9f44da2SMarc-André Lureauint main(void) { 3015b9f44da2SMarc-André Lureau void *tmp = malloc(10); 3016f2dfe54cSLeonid Bloch if (tmp != NULL) { 3017b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 3018b9f44da2SMarc-André Lureau } 3019d1abf3fcSOlaf Hering return 1; 3020f2dfe54cSLeonid Bloch} 3021b9f44da2SMarc-André LureauEOF 3022247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 3023247724cbSMarc-André Lureau have_ubsan=yes 3024247724cbSMarc-André Lureau fi 3025d83414e1SMarc-André Lureau 3026d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 3027d83414e1SMarc-André Lureau have_asan_iface_h=yes 3028d83414e1SMarc-André Lureau fi 3029d83414e1SMarc-André Lureau 3030d83414e1SMarc-André Lureau cat > $TMPC << EOF 3031d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 3032d83414e1SMarc-André Lureauint main(void) { 3033d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 3034d83414e1SMarc-André Lureau return 0; 3035d83414e1SMarc-André Lureau} 3036d83414e1SMarc-André LureauEOF 3037d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 3038d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 3039d83414e1SMarc-André Lureau fi 3040247724cbSMarc-André Lureaufi 3041247724cbSMarc-André Lureau 30420aebab04SLingfeng Yang# Thread sanitizer is, for now, much noisier than the other sanitizers; 30430aebab04SLingfeng Yang# keep it separate until that is not the case. 30440aebab04SLingfeng Yangif test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 30450aebab04SLingfeng Yang error_exit "TSAN is not supported with other sanitiziers." 30460aebab04SLingfeng Yangfi 30470aebab04SLingfeng Yanghave_tsan=no 30480aebab04SLingfeng Yanghave_tsan_iface_fiber=no 30490aebab04SLingfeng Yangif test "$tsan" = "yes" ; then 30500aebab04SLingfeng Yang write_c_skeleton 30510aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 30520aebab04SLingfeng Yang have_tsan=yes 30530aebab04SLingfeng Yang fi 30540aebab04SLingfeng Yang cat > $TMPC << EOF 30550aebab04SLingfeng Yang#include <sanitizer/tsan_interface.h> 30560aebab04SLingfeng Yangint main(void) { 30570aebab04SLingfeng Yang __tsan_create_fiber(0); 30580aebab04SLingfeng Yang return 0; 30590aebab04SLingfeng Yang} 30600aebab04SLingfeng YangEOF 30610aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 30620aebab04SLingfeng Yang have_tsan_iface_fiber=yes 30630aebab04SLingfeng Yang fi 30640aebab04SLingfeng Yangfi 30650aebab04SLingfeng Yang 3066adc28027SAlexander Bulekov########################################## 3067675b9b53SMarc-André Lureau# check for slirp 3068675b9b53SMarc-André Lureau 3069675b9b53SMarc-André Lureaucase "$slirp" in 30704d34a86bSPaolo Bonzini auto | enabled | internal) 30714d34a86bSPaolo Bonzini # Simpler to always update submodule, even if not needed. 30727c57bdd8SMarc-André Lureau git_submodules="${git_submodules} slirp" 3073675b9b53SMarc-André Lureau ;; 3074675b9b53SMarc-André Lureauesac 3075675b9b53SMarc-André Lureau 3076b8e0c493SJoelle van Dyne# Check for slirp smbd dupport 3077b8e0c493SJoelle van Dyne: ${smbd=${SMBD-/usr/sbin/smbd}} 3078b8e0c493SJoelle van Dyneif test "$slirp_smbd" != "no" ; then 3079b8e0c493SJoelle van Dyne if test "$mingw32" = "yes" ; then 3080b8e0c493SJoelle van Dyne if test "$slirp_smbd" = "yes" ; then 3081b8e0c493SJoelle van Dyne error_exit "Host smbd not supported on this platform." 3082b8e0c493SJoelle van Dyne fi 3083b8e0c493SJoelle van Dyne slirp_smbd=no 3084b8e0c493SJoelle van Dyne else 3085b8e0c493SJoelle van Dyne slirp_smbd=yes 3086b8e0c493SJoelle van Dyne fi 3087b8e0c493SJoelle van Dynefi 3088b8e0c493SJoelle van Dyne 308954e7aac0SAlexey Krasikov########################################## 309054e7aac0SAlexey Krasikov# check for usable __NR_keyctl syscall 309154e7aac0SAlexey Krasikov 309254e7aac0SAlexey Krasikovif test "$linux" = "yes" ; then 309354e7aac0SAlexey Krasikov 309454e7aac0SAlexey Krasikov have_keyring=no 309554e7aac0SAlexey Krasikov cat > $TMPC << EOF 309654e7aac0SAlexey Krasikov#include <errno.h> 309754e7aac0SAlexey Krasikov#include <asm/unistd.h> 309854e7aac0SAlexey Krasikov#include <linux/keyctl.h> 309954e7aac0SAlexey Krasikov#include <unistd.h> 310054e7aac0SAlexey Krasikovint main(void) { 310154e7aac0SAlexey Krasikov return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 310254e7aac0SAlexey Krasikov} 310354e7aac0SAlexey KrasikovEOF 310454e7aac0SAlexey Krasikov if compile_prog "" "" ; then 310554e7aac0SAlexey Krasikov have_keyring=yes 310654e7aac0SAlexey Krasikov fi 310754e7aac0SAlexey Krasikovfi 310854e7aac0SAlexey Krasikovif test "$secret_keyring" != "no" 310954e7aac0SAlexey Krasikovthen 3110b418d265SDavid Edmondson if test "$have_keyring" = "yes" 311154e7aac0SAlexey Krasikov then 311254e7aac0SAlexey Krasikov secret_keyring=yes 311354e7aac0SAlexey Krasikov else 311454e7aac0SAlexey Krasikov if test "$secret_keyring" = "yes" 311554e7aac0SAlexey Krasikov then 311654e7aac0SAlexey Krasikov error_exit "syscall __NR_keyctl requested, \ 311754e7aac0SAlexey Krasikovbut not implemented on your system" 311854e7aac0SAlexey Krasikov else 311954e7aac0SAlexey Krasikov secret_keyring=no 312054e7aac0SAlexey Krasikov fi 312154e7aac0SAlexey Krasikov fi 312254e7aac0SAlexey Krasikovfi 312354e7aac0SAlexey Krasikov 312492500362SAlexey Krasikov########################################## 3125e86ecd4bSJuan Quintela# End of CC checks 3126e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3127e86ecd4bSJuan Quintela 3128d83414e1SMarc-André Lureauwrite_c_skeleton 3129d83414e1SMarc-André Lureau 31301d728c39SBlue Swirlif test "$gcov" = "yes" ; then 3131bf0e56a3SMarc-André Lureau : 3132b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 3133086d5f75SPaolo Bonzini QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 3134086d5f75SPaolo Bonzini debug=no 3135086d5f75SPaolo Bonzinifi 3136086d5f75SPaolo Bonzini 3137086d5f75SPaolo Bonzinicase "$ARCH" in 3138086d5f75SPaolo Bonzinialpha) 3139086d5f75SPaolo Bonzini # Ensure there's only a single GP 3140086d5f75SPaolo Bonzini QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 3141086d5f75SPaolo Bonzini;; 3142086d5f75SPaolo Bonziniesac 3143086d5f75SPaolo Bonzini 3144086d5f75SPaolo Bonziniif test "$gprof" = "yes" ; then 3145086d5f75SPaolo Bonzini QEMU_CFLAGS="-p $QEMU_CFLAGS" 3146086d5f75SPaolo Bonzini QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 3147086d5f75SPaolo Bonzinifi 3148a316e378SJuan Quintela 3149247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 3150db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 3151db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 3152d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 3153d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 3154d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 3155d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 3156d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 3157d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 3158d83414e1SMarc-André Lureau fi 3159247724cbSMarc-André Lureaufi 31600aebab04SLingfeng Yangif test "$have_tsan" = "yes" ; then 31610aebab04SLingfeng Yang if test "$have_tsan_iface_fiber" = "yes" ; then 31620aebab04SLingfeng Yang QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 31630aebab04SLingfeng Yang QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 31640aebab04SLingfeng Yang else 31650aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing fiber annotation interface." 31660aebab04SLingfeng Yang fi 31670aebab04SLingfeng Yangelif test "$tsan" = "yes" ; then 31680aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing sanitize thread interface." 31690aebab04SLingfeng Yangfi 3170247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 3171db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 3172db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 3173247724cbSMarc-André Lureaufi 3174247724cbSMarc-André Lureau 31756542aa9cSPeter Lieven########################################## 31763efac6ebSTomáš Golembiovský 31770aebab04SLingfeng Yang# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 31780aebab04SLingfeng Yangif test "$solaris" = "no" && test "$tsan" = "no"; then 3179e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 3180db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 3181e86ecd4bSJuan Quintela fi 3182e86ecd4bSJuan Quintelafi 3183e86ecd4bSJuan Quintela 3184952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3185952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3186cb8baa77SMark Cave-Ayland flags="--no-seh --nxcompat" 3187cb8baa77SMark Cave-Ayland 3188cb8baa77SMark Cave-Ayland # Disable ASLR for debug builds to allow debugging with gdb 3189cb8baa77SMark Cave-Ayland if test "$debug" = "no" ; then 3190cb8baa77SMark Cave-Ayland flags="--dynamicbase $flags" 3191cb8baa77SMark Cave-Ayland fi 3192cb8baa77SMark Cave-Ayland 3193cb8baa77SMark Cave-Ayland for flag in $flags; do 3194e9a3591fSChristian Borntraeger if ld_has $flag ; then 3195db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 3196952afb71SBlue Swirl fi 3197952afb71SBlue Swirl done 3198952afb71SBlue Swirlfi 3199952afb71SBlue Swirl 32009d6bc27bSMichael Roth# Probe for guest agent support/options 32019d6bc27bSMichael Roth 3202e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 3203a5125905SLaurent Vivier if [ "$softmmu" = no -a "$want_tools" = no ] ; then 3204a5125905SLaurent Vivier guest_agent=no 3205a5125905SLaurent Vivier elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 3206e8ef31a3SMichael Tokarev guest_agent=yes 3207e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 3208e8ef31a3SMichael Tokarev guest_agent=no 3209e8ef31a3SMichael Tokarev else 3210e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 3211ca35f780SPaolo Bonzini fi 32124b1c11fdSDaniel P. Berrangefi 3213ca35f780SPaolo Bonzini 3214b846ab7cSPaolo Bonzini# Guest agent Windows MSI package 32159d6bc27bSMichael Roth 32169d6bc27bSMichael Rothif test "$QEMU_GA_MANUFACTURER" = ""; then 32179d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 32189d6bc27bSMichael Rothfi 32199d6bc27bSMichael Rothif test "$QEMU_GA_DISTRO" = ""; then 32209d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 32219d6bc27bSMichael Rothfi 32229d6bc27bSMichael Rothif test "$QEMU_GA_VERSION" = ""; then 322389138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 32249d6bc27bSMichael Rothfi 32259d6bc27bSMichael Roth 3226b846ab7cSPaolo BonziniQEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin" 32279d6bc27bSMichael Roth 3228ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3229ca35f780SPaolo Bonziniroms= 3230e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 3231ba7c60c2SPaolo Bonzini test "$targetos" != "darwin" && test "$targetos" != "sunos" && \ 3232ba7c60c2SPaolo Bonzini test "$targetos" != "haiku" && test "$softmmu" = yes ; then 3233e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 3234c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 3235c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 3236c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 3237e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 3238e57218b6SPeter Maydell ld_i386_emulation="$emu" 3239ca35f780SPaolo Bonzini roms="optionrom" 3240e57218b6SPeter Maydell break 3241e57218b6SPeter Maydell fi 3242e57218b6SPeter Maydell done 3243ca35f780SPaolo Bonzinifi 3244ca35f780SPaolo Bonzini 32452e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 3246a5b2afd5SThomas Huth# or -march=z10 (which is the lowest architecture level that Clang supports) 32479933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 32482e33c3f8SThomas Huth write_c_skeleton 3249a5b2afd5SThomas Huth compile_prog "-march=z900" "" 3250a5b2afd5SThomas Huth has_z900=$? 32513af448b3SThomas Huth if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then 3252a5b2afd5SThomas Huth if [ $has_z900 != 0 ]; then 3253a5b2afd5SThomas Huth echo "WARNING: Your compiler does not support the z900!" 3254a5b2afd5SThomas Huth echo " The s390-ccw bios will only work with guest CPUs >= z10." 3255a5b2afd5SThomas Huth fi 32569933c305SChristian Borntraeger roms="$roms s390-ccw" 32571ef6bfc2SPhilippe Mathieu-Daudé # SLOF is required for building the s390-ccw firmware on s390x, 32581ef6bfc2SPhilippe Mathieu-Daudé # since it is using the libnet code from SLOF for network booting. 32591ef6bfc2SPhilippe Mathieu-Daudé git_submodules="${git_submodules} roms/SLOF" 32601ef6bfc2SPhilippe Mathieu-Daudé fi 32619933c305SChristian Borntraegerfi 32629933c305SChristian Borntraeger 326311cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 326411cde1c8SBruno 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. 326511cde1c8SBruno Dominguezif has $cxx; then 326611cde1c8SBruno Dominguez cat > $TMPC <<EOF 326711cde1c8SBruno Dominguezint c_function(void); 326811cde1c8SBruno Dominguezint main(void) { return c_function(); } 326911cde1c8SBruno DominguezEOF 327011cde1c8SBruno Dominguez 327111cde1c8SBruno Dominguez compile_object 327211cde1c8SBruno Dominguez 327311cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 327411cde1c8SBruno Dominguezextern "C" { 327511cde1c8SBruno Dominguez int c_function(void); 327611cde1c8SBruno Dominguez} 327711cde1c8SBruno Dominguezint c_function(void) { return 42; } 327811cde1c8SBruno DominguezEOF 327911cde1c8SBruno Dominguez 328011cde1c8SBruno Dominguez update_cxxflags 328111cde1c8SBruno Dominguez 3282a2866660SPaolo Bonzini if do_cxx $CXXFLAGS $EXTRA_CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 328311cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 328411cde1c8SBruno Dominguez : 328511cde1c8SBruno Dominguez else 328611cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 328711cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 328811cde1c8SBruno Dominguez cxx= 328911cde1c8SBruno Dominguez fi 329011cde1c8SBruno Dominguezelse 329111cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 329211cde1c8SBruno Dominguez cxx= 329311cde1c8SBruno Dominguezfi 329411cde1c8SBruno Dominguez 32957d7dbf9dSDan Streetmanif !(GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then 32967d7dbf9dSDan Streetman exit 1 32975d91a2edSYonggang Luofi 32985d91a2edSYonggang Luo 329998ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 330097a847bcSbellard 330198ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 330298ec69acSJuan Quintelaecho >> $config_host_mak 330398ec69acSJuan Quintela 3304e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 3305cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 3306aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 33077d7dbf9dSDan Streetmanecho "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak 3308804edf29SJuan Quintela 3309f8393946Saurel32if test "$debug_tcg" = "yes" ; then 33102358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 3311f8393946Saurel32fi 33121625af87Saliguoriif test "$strip_opt" = "yes" ; then 331352ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 33141625af87Saliguorifi 331567b915a5Sbellardif test "$mingw32" = "yes" ; then 331698ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 3317d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 3318d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 3319f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 3320d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 3321d9840e25STomoki Sekiyama fi 332250cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 332376dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 332450cbebb9SMichael Roth fi 33259dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 33269dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 33279dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 33289dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 3329210fa556Spbrookelse 333035f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 3331210fa556Spbrookfi 3332128ab2ffSblueswir1 3333dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 3334dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 3335dffcb71cSMark McLoughlinfi 3336dffcb71cSMark McLoughlin 333783fb7adfSbellardif test "$darwin" = "yes" ; then 333898ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 333983fb7adfSbellardfi 3340b29fe3edSmalc 3341ec530c81Sbellardif test "$solaris" = "yes" ; then 334298ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 3343ec530c81Sbellardfi 334497a847bcSbellardif test "$static" = "yes" ; then 334598ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 334697a847bcSbellardfi 33471ba16968SStefan Weilif test "$profiler" = "yes" ; then 33482358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 334905c2a3e7Sbellardfi 3350c932ce31SPaolo Bonziniif test "$want_tools" = "yes" ; then 3351c932ce31SPaolo Bonzini echo "CONFIG_TOOLS=y" >> $config_host_mak 3352c932ce31SPaolo Bonzinifi 3353f15bff25SPaolo Bonziniif test "$guest_agent" = "yes" ; then 3354f15bff25SPaolo Bonzini echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 3355f15bff25SPaolo Bonzinifi 3356b8e0c493SJoelle van Dyneif test "$slirp_smbd" = "yes" ; then 3357b8e0c493SJoelle van Dyne echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak 3358e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3359b8e0c493SJoelle van Dynefi 33604cc600d2SPaolo Bonziniif test "$gprof" = "yes" ; then 33614cc600d2SPaolo Bonzini echo "CONFIG_GPROF=y" >> $config_host_mak 33624cc600d2SPaolo Bonzinifi 3363b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 3364b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 3365e5f05f8cSKevin Wolfif test "$block_drv_whitelist_tools" = "yes" ; then 3366e5f05f8cSKevin Wolf echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak 3367e5f05f8cSKevin Wolffi 336889138857SStefan Weilqemu_version=$(head $source_path/VERSION) 33692358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 337098ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 33712b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 337217969268SFam Zhengif test "$modules" = "yes"; then 3373e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 3374e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 337589138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 337617969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 337717969268SFam Zhengfi 3378bd83c861SChristian Ehrhardtif test "$module_upgrades" = "yes"; then 3379bd83c861SChristian Ehrhardt echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 3380bd83c861SChristian Ehrhardtfi 3381955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 3382955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 3383955727d2SCortland Tölvafi 3384f876b765SMarc-André Lureauif test "$gio" = "yes" ; then 3385f876b765SMarc-André Lureau echo "CONFIG_GIO=y" >> $config_host_mak 3386f876b765SMarc-André Lureau echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 3387f876b765SMarc-André Lureau echo "GIO_LIBS=$gio_libs" >> $config_host_mak 33885ecfb76cSPaolo Bonzinifi 33895ecfb76cSPaolo Bonziniif test "$gdbus_codegen" != "" ; then 339025a97a56SMarc-André Lureau echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 3391f876b765SMarc-André Lureaufi 3392a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 3393277abf15SJan Vesely 33941badb709SPaolo Bonziniif test "$xen" = "enabled" ; then 33956dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3396d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3397582ea95fSMarc-André Lureau echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 3398582ea95fSMarc-André Lureau echo "XEN_LIBS=$xen_libs" >> $config_host_mak 3399e37630caSaliguorifi 34005e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 34015e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 34025e9be92dSNicholas Bellingerfi 3403af3bba76SPaolo Bonziniif test "$vhost_net" = "yes" ; then 3404af3bba76SPaolo Bonzini echo "CONFIG_VHOST_NET=y" >> $config_host_mak 3405af3bba76SPaolo Bonzinifi 3406af3bba76SPaolo Bonziniif test "$vhost_net_user" = "yes" ; then 340756f41de7SPaolo Bonzini echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 340803ce5744SNikolay Nikolaevfi 3409108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" ; then 3410108a6481SCindy Lu echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 3411108a6481SCindy Lufi 3412042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 3413042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 3414042cea27SGongleifi 3415fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 3416fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 34175fe97d88SStefano Garzarella if test "$vhost_user" = "yes" ; then 34185fe97d88SStefano Garzarella echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 34195fe97d88SStefano Garzarella fi 3420fc0b9b0eSStefan Hajnoczifi 3421299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" ; then 3422299e6f19SPaolo Bonzini echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 3423299e6f19SPaolo Bonzinifi 3424e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 3425e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 3426e6a74868SMarc-André Lureaufi 3427108a6481SCindy Luif test "$vhost_vdpa" = "yes" ; then 3428108a6481SCindy Lu echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 3429108a6481SCindy Lufi 343098fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" ; then 343198fc1adaSDr. David Alan Gilbert echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 343298fc1adaSDr. David Alan Gilbertfi 3433a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 3434a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 3435a40161cbSPaolo Bonzinifi 3436e5b46549SRichard Hendersonif test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then 3437e5b46549SRichard Henderson echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 3438e5b46549SRichard Hendersonfi 343958d3f3ffSGerd Hoffmann 3440da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 3441da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 3442de2d3005SPaolo Bonzini echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 3443da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 344420ff075bSMichael Wallefi 344520ff075bSMichael Walle 344699f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 344799f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 344899f2dbd3SLiang Lifi 344999f2dbd3SLiang Li 34506b8cd447SRobert Hooif test "$avx512f_opt" = "yes" ; then 34516b8cd447SRobert Hoo echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 34526b8cd447SRobert Hoofi 34536b8cd447SRobert Hoo 345483fb7adfSbellard# XXX: suppress that 34557d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 34562358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 34577d3505c5Sbellardfi 34587d3505c5Sbellard 34593556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 34603556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 34613556c233SPaolo Bonzinifi 346220ff6c80SAnthony Liguori 34637c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 346470c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 346570c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 346670c60c08SStefan Hajnoczielse 346770c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 346870c60c08SStefan Hajnoczifi 3469d0e2fce5SAneesh Kumar K.V 34707d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 34717d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 34727d992e4dSPeter Lievenfi 34737d992e4dSPeter Lieven 3474f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 3475f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 3476f0d92b56SLongpeng(Mike)fi 3477f0d92b56SLongpeng(Mike) 3478d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 3479d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 3480d83414e1SMarc-André Lureaufi 3481d83414e1SMarc-André Lureau 34820aebab04SLingfeng Yangif test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 34830aebab04SLingfeng Yang echo "CONFIG_TSAN=y" >> $config_host_mak 34840aebab04SLingfeng Yangfi 34850aebab04SLingfeng Yang 348676a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 348776a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 348876a347e1SRichard Hendersonfi 348976a347e1SRichard Henderson 3490f540166bSRichard Hendersonif test "$int128" = "yes" ; then 3491f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 3492f540166bSRichard Hendersonfi 3493f540166bSRichard Henderson 34947ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 34957ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 34967ebee43eSRichard Hendersonfi 34977ebee43eSRichard Henderson 3498e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 3499e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 3500e6cd4bb5SRichard Hendersonfi 3501e6cd4bb5SRichard Henderson 3502ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 3503ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 3504ed1701c6SDr. David Alan Gilbertfi 3505ed1701c6SDr. David Alan Gilbert 35063b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 35073cae16dbSPaolo Bonzini echo 'CONFIG_TPM=y' >> $config_host_mak 35083b8acc11SPaolo Bonzinifi 35093b8acc11SPaolo Bonzini 35102da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 35112da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 3512392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 35132da776dbSMichael R. Hinesfi 35142da776dbSMichael R. Hines 351521ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 351621ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 351721ab34c9SMarcel Apfelbaumfi 351821ab34c9SMarcel Apfelbaum 3519a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 3520a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 3521a6b1d4c0SChanglong Xiefi 3522a6b1d4c0SChanglong Xie 3523ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 3524ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 3525ba59fb77SPaolo Bonzinifi 3526e0580342SKamil Rytarowski 35272f740136SJeff Codyif test "$bochs" = "yes" ; then 35282f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 35292f740136SJeff Codyfi 35302f740136SJeff Codyif test "$cloop" = "yes" ; then 35312f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 35322f740136SJeff Codyfi 35332f740136SJeff Codyif test "$dmg" = "yes" ; then 35342f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 35352f740136SJeff Codyfi 35362f740136SJeff Codyif test "$qcow1" = "yes" ; then 35372f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 35382f740136SJeff Codyfi 35392f740136SJeff Codyif test "$vdi" = "yes" ; then 35402f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 35412f740136SJeff Codyfi 35422f740136SJeff Codyif test "$vvfat" = "yes" ; then 35432f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 35442f740136SJeff Codyfi 35452f740136SJeff Codyif test "$qed" = "yes" ; then 35462f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 35472f740136SJeff Codyfi 35482f740136SJeff Codyif test "$parallels" = "yes" ; then 35492f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 35502f740136SJeff Codyfi 35512f740136SJeff Cody 355240e8c6f4SAlex Bennéeif test "$plugins" = "yes" ; then 355340e8c6f4SAlex Bennée echo "CONFIG_PLUGIN=y" >> $config_host_mak 355440e8c6f4SAlex Bennéefi 355540e8c6f4SAlex Bennée 3556f48e590aSAlex Bennéeif test -n "$gdb_bin"; then 3557b1863cccSAlex Bennée gdb_version=$($gdb_bin --version | head -n 1) 3558d6a66c81SAlex Bennée if version_ge ${gdb_version##* } 9.1; then 3559f48e590aSAlex Bennée echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 3560f48e590aSAlex Bennée fi 3561b1863cccSAlex Bennéefi 3562f48e590aSAlex Bennée 356354e7aac0SAlexey Krasikovif test "$secret_keyring" = "yes" ; then 356454e7aac0SAlexey Krasikov echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 356554e7aac0SAlexey Krasikovfi 356654e7aac0SAlexey Krasikov 356798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3568804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3569c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 357039d87c8cSAlex Bennéeecho "GENISOIMAGE=$genisoimage" >> $config_host_mak 3571a5665051SPaolo Bonziniecho "MESON=$meson" >> $config_host_mak 357209e93326SPaolo Bonziniecho "NINJA=$ninja" >> $config_host_mak 3573804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 3574433de74cSBastian Koppelmannecho "HOST_CC=$host_cc" >> $config_host_mak 3575a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 3576859aef02SPaolo Bonzini echo "CONFIG_IASL=$iasl" >> $config_host_mak 3577a31a8642SMichael S. Tsirkinfi 3578804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3579cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 35805f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 35813dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 3582804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3583804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 358446eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 3585a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 358611cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 3587a81df1b6SPaolo Bonziniecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3588a81df1b6SPaolo Bonziniecho "GLIB_LIBS=$glib_libs" >> $config_host_mak 3589d83acfd0SMarc-André Lureauecho "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak 35908a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 3591e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 3592804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3593f15bff25SPaolo Bonziniecho "LIBS_QGA=$libs_qga" >> $config_host_mak 3594804edf29SJuan Quintela 3595b767d257SMarek Marczykowski-Góreckiif test "$rng_none" = "yes"; then 3596b767d257SMarek Marczykowski-Górecki echo "CONFIG_RNG_NONE=y" >> $config_host_mak 3597b767d257SMarek Marczykowski-Góreckifi 3598b767d257SMarek Marczykowski-Górecki 35996efd7517SPeter Maydell# use included Linux headers 36006efd7517SPeter Maydellif test "$linux" = "yes" ; then 3601a307beb6SAndreas Färber mkdir -p linux-headers 36026efd7517SPeter Maydell case "$cpu" in 36034da270beSPaolo Bonzini i386|x86_64) 360408312a63SPeter Maydell linux_arch=x86 36056efd7517SPeter Maydell ;; 3606d8ff892dSPaolo Bonzini ppc|ppc64) 360708312a63SPeter Maydell linux_arch=powerpc 36086efd7517SPeter Maydell ;; 36096efd7517SPeter Maydell s390x) 361008312a63SPeter Maydell linux_arch=s390 361108312a63SPeter Maydell ;; 36121f080313SClaudio Fontana aarch64) 36131f080313SClaudio Fontana linux_arch=arm64 36141f080313SClaudio Fontana ;; 3615dfcf900bSWANG Xuerui loongarch*) 3616dfcf900bSWANG Xuerui linux_arch=loongarch 3617dfcf900bSWANG Xuerui ;; 3618222e7d11SSanjay Lal mips64) 3619222e7d11SSanjay Lal linux_arch=mips 3620222e7d11SSanjay Lal ;; 362108312a63SPeter Maydell *) 362208312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 362308312a63SPeter Maydell linux_arch="$cpu" 36246efd7517SPeter Maydell ;; 36256efd7517SPeter Maydell esac 362608312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 362708312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 362808312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 362908312a63SPeter Maydell fi 36306efd7517SPeter Maydellfi 36316efd7517SPeter Maydell 363297a847bcSbellardfor target in $target_list; do 363397a847bcSbellard target_dir="$target" 363457a93f16SPhilippe Mathieu-Daudé target_name=$(echo $target | cut -d '-' -f 1)$EXESUF 363597a847bcSbellard mkdir -p $target_dir 3636fdb75aefSPaolo Bonzini case $target in 3637fdb75aefSPaolo Bonzini *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; 3638fdb75aefSPaolo Bonzini *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; 36392408a527Saurel32 esac 364056aebc89Spbrookdone 36417d13299dSbellard 3642765686d6SPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak 3643fdb75aefSPaolo Bonziniif test "$default_targets" = "yes"; then 3644fdb75aefSPaolo Bonzini echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 3645fdb75aefSPaolo Bonzinifi 3646a540f158SPeter Crosthwaite 3647a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 3648a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 3649ab318051SMarc-André Lureau echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 3650a99d57bbSWanlong Gaofi 3651a99d57bbSWanlong Gao 3652fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 3653fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 3654fd0e6053SJohn Snowfi 3655fd0e6053SJohn Snow 36561e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 36571e4f6065SDaniele Buono echo "CONFIG_SAFESTACK=y" >> $config_host_mak 36581e4f6065SDaniele Buonofi 36591e4f6065SDaniele Buono 3660e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 3661e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 3662e29e5c6eSPeter Maydell# (these can be both files and directories). 3663e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 3664e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 3665e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 3666e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 3667e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 3668e29e5c6eSPeter Maydell# directory and symlink the directory instead. 366909db9b9dSGerd Hoffmann# UNLINK is used to remove symlinks from older development versions 367009db9b9dSGerd Hoffmann# that might get into the way when doing "git update" without doing 367109db9b9dSGerd Hoffmann# a "make distclean" in between. 36722038f8c8SPaolo BonziniLINKS="Makefile" 36733941996bSPaolo BonziniLINKS="$LINKS tests/tcg/Makefile.target" 3674ddcf607fSGerd HoffmannLINKS="$LINKS pc-bios/optionrom/Makefile" 3675e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 36768db2a4fdSGerd HoffmannLINKS="$LINKS roms/seabios/Makefile" 3677e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 3678e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 3679bbbd9b6eSWillian RampazzoLINKS="$LINKS tests/avocado tests/data" 368039950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 36818f8fd9edSCleber RosaLINKS="$LINKS python" 3682c17a386bSAlex BennéeLINKS="$LINKS contrib/plugins/Makefile " 368309db9b9dSGerd HoffmannUNLINK="pc-bios/keymaps" 3684753d11f2SRichard Hendersonfor bios_file in \ 3685753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 36863a631b8eSBin Meng $source_path/pc-bios/*.elf \ 3687225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 3688753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 3689753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 3690e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 3691753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 36924e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 3693cd946e5cSJohn Arbuckle $source_path/pc-bios/palcode-* \ 3694cd946e5cSJohn Arbuckle $source_path/pc-bios/qemu_vga.ndrv 3695cd946e5cSJohn Arbuckle 3696753d11f2SRichard Hendersondo 3697e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 36987ea78b74SJan Kiszkadone 3699e29e5c6eSPeter Maydellfor f in $LINKS ; do 37000f4d8894SPaolo Bonzini if [ -e "$source_path/$f" ]; then 37015dce7b8dSPaolo Bonzini mkdir -p `dirname ./$f` 3702f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 3703f9245e10SPeter Maydell fi 37047d13299dSbellarddone 370509db9b9dSGerd Hoffmannfor f in $UNLINK ; do 370609db9b9dSGerd Hoffmann if [ -L "$f" ]; then 370709db9b9dSGerd Hoffmann rm -f "$f" 370809db9b9dSGerd Hoffmann fi 370909db9b9dSGerd Hoffmanndone 37101ad2134fSPaul Brook 37112038f8c8SPaolo Bonzini(for i in $cross_cc_vars; do 37122038f8c8SPaolo Bonzini export $i 37132038f8c8SPaolo Bonzinidone 3714fd0f79d7SRichard Hendersonexport target_list source_path use_containers cpu 37152038f8c8SPaolo Bonzini$source_path/tests/tcg/configure.sh) 37162038f8c8SPaolo Bonzini 3717c34ebfdcSAnthony Liguori# temporary config to build submodules 37188db2a4fdSGerd Hoffmannfor rom in seabios; do 3719c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 372037116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3721c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3722cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 37235f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 3724c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3725c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 37263dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 3727c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3728a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 3729c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 37309f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 3731c34ebfdcSAnthony Liguoridone 3732c34ebfdcSAnthony Liguori 373398409991SHelge Konetzkaconfig_mak=pc-bios/optionrom/config.mak 373498409991SHelge Konetzkaecho "# Automatically generated by configure - do not modify" > $config_mak 373598409991SHelge Konetzkaecho "TOPSRC_DIR=$source_path" >> $config_mak 373698409991SHelge Konetzka 3737a5665051SPaolo Bonziniif test "$skip_meson" = no; then 3738fc929892SMarc-André Lureau cross="config-meson.cross.new" 3739fc929892SMarc-André Lureau meson_quote() { 3740ac7ebcc5SPaolo Bonzini test $# = 0 && return 374147b30835SPaolo Bonzini echo "'$(echo $* | sed "s/ /','/g")'" 3742fc929892SMarc-André Lureau } 3743fc929892SMarc-André Lureau 3744fc929892SMarc-André Lureau echo "# Automatically generated by configure - do not modify" > $cross 3745fc929892SMarc-André Lureau echo "[properties]" >> $cross 3746d1d5e9eeSAlex Bennée 3747d1d5e9eeSAlex Bennée # unroll any custom device configs 3748d1d5e9eeSAlex Bennée for a in $device_archs; do 3749d1d5e9eeSAlex Bennée eval "c=\$devices_${a}" 3750d1d5e9eeSAlex Bennée echo "${a}-softmmu = '$c'" >> $cross 3751d1d5e9eeSAlex Bennée done 3752d1d5e9eeSAlex Bennée 3753fc929892SMarc-André Lureau test -z "$cxx" && echo "link_language = 'c'" >> $cross 375447b30835SPaolo Bonzini echo "[built-in options]" >> $cross 3755a2866660SPaolo Bonzini echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross 3756a2866660SPaolo Bonzini echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross 3757a2866660SPaolo Bonzini echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross 3758a2866660SPaolo Bonzini echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross 3759fc929892SMarc-André Lureau echo "[binaries]" >> $cross 37604dba2789SPaolo Bonzini echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross 37614dba2789SPaolo Bonzini test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross 37624dba2789SPaolo Bonzini test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross 376347b30835SPaolo Bonzini echo "ar = [$(meson_quote $ar)]" >> $cross 376447b30835SPaolo Bonzini echo "nm = [$(meson_quote $nm)]" >> $cross 376547b30835SPaolo Bonzini echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross 376647b30835SPaolo Bonzini echo "ranlib = [$(meson_quote $ranlib)]" >> $cross 3767e8178514SPaolo Bonzini if has $sdl2_config; then 376847b30835SPaolo Bonzini echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 3769e8178514SPaolo Bonzini fi 377047b30835SPaolo Bonzini echo "strip = [$(meson_quote $strip)]" >> $cross 377147b30835SPaolo Bonzini echo "windres = [$(meson_quote $windres)]" >> $cross 37723812c0c4SJoelle van Dyne if test "$cross_compile" = "yes"; then 3773fc929892SMarc-André Lureau cross_arg="--cross-file config-meson.cross" 3774fc929892SMarc-André Lureau echo "[host_machine]" >> $cross 3775ba7c60c2SPaolo Bonzini echo "system = '$targetos'" >> $cross 3776823eb013SPaolo Bonzini case "$cpu" in 3777f6bca9dfSJoelle van Dyne i386) 3778fc929892SMarc-André Lureau echo "cpu_family = 'x86'" >> $cross 3779fc929892SMarc-André Lureau ;; 3780fc929892SMarc-André Lureau *) 3781823eb013SPaolo Bonzini echo "cpu_family = '$cpu'" >> $cross 3782fc929892SMarc-André Lureau ;; 3783fc929892SMarc-André Lureau esac 3784fc929892SMarc-André Lureau echo "cpu = '$cpu'" >> $cross 3785fc929892SMarc-André Lureau if test "$bigendian" = "yes" ; then 3786fc929892SMarc-André Lureau echo "endian = 'big'" >> $cross 3787fc929892SMarc-André Lureau else 3788fc929892SMarc-André Lureau echo "endian = 'little'" >> $cross 3789fc929892SMarc-André Lureau fi 3790fc929892SMarc-André Lureau else 3791fc929892SMarc-André Lureau cross_arg="--native-file config-meson.cross" 3792fc929892SMarc-André Lureau fi 3793fc929892SMarc-André Lureau mv $cross config-meson.cross 3794fc929892SMarc-André Lureau 3795a5665051SPaolo Bonzini rm -rf meson-private meson-info meson-logs 379661d63097SPaolo Bonzini run_meson() { 379709e93326SPaolo Bonzini NINJA=$ninja $meson setup \ 3798d17f305aSPaolo Bonzini --prefix "$prefix" \ 3799d17f305aSPaolo Bonzini --libdir "$libdir" \ 3800d17f305aSPaolo Bonzini --libexecdir "$libexecdir" \ 3801d17f305aSPaolo Bonzini --bindir "$bindir" \ 3802d17f305aSPaolo Bonzini --includedir "$includedir" \ 3803d17f305aSPaolo Bonzini --datadir "$datadir" \ 3804d17f305aSPaolo Bonzini --mandir "$mandir" \ 3805d17f305aSPaolo Bonzini --sysconfdir "$sysconfdir" \ 380616bf7a33SPaolo Bonzini --localedir "$localedir" \ 3807d17f305aSPaolo Bonzini --localstatedir "$local_statedir" \ 38083b4da132SPaolo Bonzini -Daudio_drv_list=$audio_drv_list \ 38093b4da132SPaolo Bonzini -Ddefault_devices=$default_devices \ 3810d17f305aSPaolo Bonzini -Ddocdir="$docdir" \ 381116bf7a33SPaolo Bonzini -Dqemu_firmwarepath="$firmwarepath" \ 381273f3aa37SMarc-André Lureau -Dqemu_suffix="$qemu_suffix" \ 38133b4da132SPaolo Bonzini -Dsphinx_build="$sphinx_build" \ 38143b4da132SPaolo Bonzini -Dtrace_file="$trace_file" \ 3815a5665051SPaolo Bonzini -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 3816a5665051SPaolo Bonzini -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 3817a5665051SPaolo Bonzini -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 3818a5665051SPaolo Bonzini -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 3819da6d48b9SMarc-André Lureau -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 3820bf0e56a3SMarc-André Lureau -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 38213b4da132SPaolo Bonzini -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \ 38223b4da132SPaolo Bonzini -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \ 3823537b7248SPaolo Bonzini $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \ 3824332008e0SThomas Huth $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \ 382561d63097SPaolo Bonzini "$@" $cross_arg "$PWD" "$source_path" 382661d63097SPaolo Bonzini } 382761d63097SPaolo Bonzini eval run_meson $meson_options 3828a5665051SPaolo Bonzini if test "$?" -ne 0 ; then 3829a5665051SPaolo Bonzini error_exit "meson setup failed" 3830a5665051SPaolo Bonzini fi 3831699d3884SPaolo Bonzinielse 3832699d3884SPaolo Bonzini if test -f meson-private/cmd_line.txt; then 3833699d3884SPaolo Bonzini # Adjust old command line options whose type was changed 3834699d3884SPaolo Bonzini # Avoids having to use "setup --wipe" when Meson is upgraded 3835699d3884SPaolo Bonzini perl -i -ne ' 3836699d3884SPaolo Bonzini s/^gettext = true$/gettext = auto/; 3837699d3884SPaolo Bonzini s/^gettext = false$/gettext = disabled/; 3838654d6b04SPaolo Bonzini /^b_staticpic/ && next; 3839699d3884SPaolo Bonzini print;' meson-private/cmd_line.txt 3840699d3884SPaolo Bonzini fi 3841a5665051SPaolo Bonzinifi 3842a5665051SPaolo Bonzini 38432d838d9bSAlex Bennéeif test -n "${deprecated_features}"; then 38442d838d9bSAlex Bennée echo "Warning, deprecated features enabled." 3845a476b216SMao Zhongyi echo "Please see docs/about/deprecated.rst" 38462d838d9bSAlex Bennée echo " features: ${deprecated_features}" 38472d838d9bSAlex Bennéefi 38482d838d9bSAlex Bennée 3849e0447a83SThomas Huth# Create list of config switches that should be poisoned in common code... 3850e0447a83SThomas Huth# but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special. 385154b0306eSThomas Huthtarget_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null) 385254b0306eSThomas Huthif test -n "$target_configs_h" ; then 3853e0447a83SThomas Huth sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \ 3854e0447a83SThomas Huth -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \ 385554b0306eSThomas Huth $target_configs_h | sort -u > config-poison.h 385654b0306eSThomas Huthelse 385754b0306eSThomas Huth :> config-poison.h 385854b0306eSThomas Huthfi 3859e0447a83SThomas Huth 3860dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 3861dc655404SMichael S. Tsirkincat <<EOD >config.status 3862dc655404SMichael S. Tsirkin#!/bin/sh 3863dc655404SMichael S. Tsirkin# Generated by configure. 3864dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 3865dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 3866dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 3867dc655404SMichael S. TsirkinEOD 3868e811da7fSDaniel P. Berrangé 3869e811da7fSDaniel P. Berrangépreserve_env() { 3870e811da7fSDaniel P. Berrangé envname=$1 3871e811da7fSDaniel P. Berrangé 3872e811da7fSDaniel P. Berrangé eval envval=\$$envname 3873e811da7fSDaniel P. Berrangé 3874e811da7fSDaniel P. Berrangé if test -n "$envval" 3875e811da7fSDaniel P. Berrangé then 3876e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 3877e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 3878e811da7fSDaniel P. Berrangé else 3879e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 3880e811da7fSDaniel P. Berrangé fi 3881e811da7fSDaniel P. Berrangé} 3882e811da7fSDaniel P. Berrangé 3883e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 3884e811da7fSDaniel P. Berrangé# features/build target configure will detect 3885e811da7fSDaniel P. Berrangépreserve_env AR 3886e811da7fSDaniel P. Berrangépreserve_env AS 3887e811da7fSDaniel P. Berrangépreserve_env CC 3888e811da7fSDaniel P. Berrangépreserve_env CPP 38898009da03SPaolo Bonzinipreserve_env CFLAGS 3890e811da7fSDaniel P. Berrangépreserve_env CXX 38918009da03SPaolo Bonzinipreserve_env CXXFLAGS 3892e811da7fSDaniel P. Berrangépreserve_env INSTALL 3893e811da7fSDaniel P. Berrangépreserve_env LD 38948009da03SPaolo Bonzinipreserve_env LDFLAGS 3895e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 3896e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 3897e811da7fSDaniel P. Berrangépreserve_env MAKE 3898e811da7fSDaniel P. Berrangépreserve_env NM 3899e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 3900e811da7fSDaniel P. Berrangépreserve_env PATH 3901e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 3902e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 3903e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 3904e811da7fSDaniel P. Berrangépreserve_env PYTHON 3905e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 3906e811da7fSDaniel P. Berrangépreserve_env SMBD 3907e811da7fSDaniel P. Berrangépreserve_env STRIP 3908e811da7fSDaniel P. Berrangépreserve_env WINDRES 3909e811da7fSDaniel P. Berrangé 3910dc655404SMichael S. Tsirkinprintf "exec" >>config.status 3911a5665051SPaolo Bonzinifor i in "$0" "$@"; do 3912835af899SPaolo Bonzini test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status 3913a5665051SPaolo Bonzinidone 3914cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 3915dc655404SMichael S. Tsirkinchmod +x config.status 3916dc655404SMichael S. Tsirkin 39178cd05ab6SPeter Maydellrm -r "$TMPDIR1" 3918