17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 58cd05ab6SPeter Maydell 699519e67SCornelia Huck# Unset some variables known to interfere with behavior of common tools, 799519e67SCornelia Huck# just as autoconf does. 899519e67SCornelia HuckCLICOLOR_FORCE= GREP_OPTIONS= 999519e67SCornelia Huckunset CLICOLOR_FORCE GREP_OPTIONS 1099519e67SCornelia Huck 115e4dfd3dSJohn Snow# Don't allow CCACHE, if present, to use cached results of compile tests! 125e4dfd3dSJohn Snowexport CCACHE_RECACHE=yes 135e4dfd3dSJohn Snow 14dedad027SDaniel P. Berrangé# make source path absolute 15dedad027SDaniel P. Berrangésource_path=$(cd "$(dirname -- "$0")"; pwd) 16dedad027SDaniel P. Berrangé 17dedad027SDaniel P. Berrangéif test "$PWD" = "$source_path" 18dedad027SDaniel P. Berrangéthen 19dedad027SDaniel P. Berrangé echo "Using './build' as the directory for build output" 20dedad027SDaniel P. Berrangé 21dedad027SDaniel P. Berrangé MARKER=build/auto-created-by-configure 22dedad027SDaniel P. Berrangé 23dedad027SDaniel P. Berrangé if test -e build 24dedad027SDaniel P. Berrangé then 25dedad027SDaniel P. Berrangé if test -f $MARKER 26dedad027SDaniel P. Berrangé then 27dedad027SDaniel P. Berrangé rm -rf build 28dedad027SDaniel P. Berrangé else 29dedad027SDaniel P. Berrangé echo "ERROR: ./build dir already exists and was not previously created by configure" 30dedad027SDaniel P. Berrangé exit 1 31dedad027SDaniel P. Berrangé fi 32dedad027SDaniel P. Berrangé fi 33dedad027SDaniel P. Berrangé 34dedad027SDaniel P. Berrangé mkdir build 35dedad027SDaniel P. Berrangé touch $MARKER 36dedad027SDaniel P. Berrangé 37dedad027SDaniel P. Berrangé cat > GNUmakefile <<'EOF' 38dedad027SDaniel P. Berrangé# This file is auto-generated by configure to support in-source tree 39dedad027SDaniel P. Berrangé# 'make' command invocation 40dedad027SDaniel P. Berrangé 41dedad027SDaniel P. Berrangéifeq ($(MAKECMDGOALS),) 42dedad027SDaniel P. Berrangérecurse: all 43dedad027SDaniel P. Berrangéendif 44dedad027SDaniel P. Berrangé 45dedad027SDaniel P. Berrangé.NOTPARALLEL: % 46dedad027SDaniel P. Berrangé%: force 47dedad027SDaniel P. Berrangé @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...' 48dedad027SDaniel P. Berrangé @$(MAKE) -C build -f Makefile $(MAKECMDGOALS) 49dedad027SDaniel P. Berrangé @if test "$(MAKECMDGOALS)" = "distclean" && \ 50dedad027SDaniel P. Berrangé test -e build/auto-created-by-configure ; \ 51dedad027SDaniel P. Berrangé then \ 52dedad027SDaniel P. Berrangé rm -rf build GNUmakefile ; \ 53dedad027SDaniel P. Berrangé fi 54dedad027SDaniel P. Berrangéforce: ; 55dedad027SDaniel P. Berrangé.PHONY: force 56dedad027SDaniel P. BerrangéGNUmakefile: ; 57dedad027SDaniel P. Berrangé 58dedad027SDaniel P. BerrangéEOF 59dedad027SDaniel P. Berrangé cd build 60dedad027SDaniel P. Berrangé exec $source_path/configure "$@" 61dedad027SDaniel P. Berrangéfi 62dedad027SDaniel P. Berrangé 638cd05ab6SPeter Maydell# Temporary directory used for files created while 648cd05ab6SPeter Maydell# configure runs. Since it is in the build directory 658cd05ab6SPeter Maydell# we can safely blow away any previous version of it 668cd05ab6SPeter Maydell# (and we need not jump through hoops to try to delete 678cd05ab6SPeter Maydell# it when configure exits.) 688cd05ab6SPeter MaydellTMPDIR1="config-temp" 698cd05ab6SPeter Maydellrm -rf "${TMPDIR1}" 708cd05ab6SPeter Maydellmkdir -p "${TMPDIR1}" 718cd05ab6SPeter Maydellif [ $? -ne 0 ]; then 728cd05ab6SPeter Maydell echo "ERROR: failed to create temporary directory" 738cd05ab6SPeter Maydell exit 1 747d13299dSbellardfi 757d13299dSbellard 768cd05ab6SPeter MaydellTMPB="qemu-conf" 778cd05ab6SPeter MaydellTMPC="${TMPDIR1}/${TMPB}.c" 7866518bf6SDon SlutzTMPO="${TMPDIR1}/${TMPB}.o" 799c83ffd8SPeter MaydellTMPCXX="${TMPDIR1}/${TMPB}.cxx" 808cd05ab6SPeter MaydellTMPE="${TMPDIR1}/${TMPB}.exe" 8126fffe29SEmilio G. CotaTMPTXT="${TMPDIR1}/${TMPB}.txt" 827d13299dSbellard 83da1d85e3SGerd Hoffmannrm -f config.log 849ac81bbbSmalc 85b48e3611SPeter Maydell# Print a helpful header at the top of config.log 86b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 87979ae168SPeter Maydellprintf "# Configured with:" >> config.log 88979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 89979ae168SPeter Maydellecho >> config.log 90b48e3611SPeter Maydellecho "#" >> config.log 91b48e3611SPeter Maydell 92d880a3baSPaolo Bonziniprint_error() { 93d880a3baSPaolo Bonzini (echo 9476ad07a4SPeter Maydell echo "ERROR: $1" 9576ad07a4SPeter Maydell while test -n "$2"; do 9676ad07a4SPeter Maydell echo " $2" 9776ad07a4SPeter Maydell shift 9876ad07a4SPeter Maydell done 99d880a3baSPaolo Bonzini echo) >&2 100d880a3baSPaolo Bonzini} 101d880a3baSPaolo Bonzini 102d880a3baSPaolo Bonzinierror_exit() { 103d880a3baSPaolo Bonzini print_error "$@" 10476ad07a4SPeter Maydell exit 1 10576ad07a4SPeter Maydell} 10676ad07a4SPeter Maydell 1079c83ffd8SPeter Maydelldo_compiler() { 1089c83ffd8SPeter Maydell # Run the compiler, capturing its output to the log. First argument 1099c83ffd8SPeter Maydell # is compiler binary to execute. 1109c83ffd8SPeter Maydell local compiler="$1" 1119c83ffd8SPeter Maydell shift 1128bbe05d7SIan Jackson if test -n "$BASH_VERSION"; then eval ' 1138bbe05d7SIan Jackson echo >>config.log " 1148bbe05d7SIan Jacksonfuncs: ${FUNCNAME[*]} 1158bbe05d7SIan Jacksonlines: ${BASH_LINENO[*]}" 1168bbe05d7SIan Jackson '; fi 1179c83ffd8SPeter Maydell echo $compiler "$@" >> config.log 1189c83ffd8SPeter Maydell $compiler "$@" >> config.log 2>&1 || return $? 1198dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 1208dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 1218dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 1228dc38a78SPeter Maydell # obvious to developers. 1238dc38a78SPeter Maydell if test "$werror" != "yes"; then 1248dc38a78SPeter Maydell return 0 1258dc38a78SPeter Maydell fi 1268dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 1278dc38a78SPeter Maydell case "$*" in 1288dc38a78SPeter Maydell *-Werror*) 1298dc38a78SPeter Maydell return 0 1308dc38a78SPeter Maydell ;; 1318dc38a78SPeter Maydell esac 1329c83ffd8SPeter Maydell echo $compiler -Werror "$@" >> config.log 1339c83ffd8SPeter Maydell $compiler -Werror "$@" >> config.log 2>&1 && return $? 13476ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 13576ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 13676ad07a4SPeter Maydell "will be at the bottom of config.log." \ 13776ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 1388dc38a78SPeter Maydell} 1398dc38a78SPeter Maydell 1409c83ffd8SPeter Maydelldo_cc() { 1419c83ffd8SPeter Maydell do_compiler "$cc" "$@" 1429c83ffd8SPeter Maydell} 1439c83ffd8SPeter Maydell 1449c83ffd8SPeter Maydelldo_cxx() { 1459c83ffd8SPeter Maydell do_compiler "$cxx" "$@" 1469c83ffd8SPeter Maydell} 1479c83ffd8SPeter Maydell 14800849b92SRichard Henderson# Append $2 to the variable named $1, with space separation 14900849b92SRichard Hendersonadd_to() { 15000849b92SRichard Henderson eval $1=\${$1:+\"\$$1 \"}\$2 15100849b92SRichard Henderson} 15200849b92SRichard Henderson 1539c83ffd8SPeter Maydellupdate_cxxflags() { 1549c83ffd8SPeter Maydell # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 1559c83ffd8SPeter Maydell # options which some versions of GCC's C++ compiler complain about 1569c83ffd8SPeter Maydell # because they only make sense for C programs. 15753422040SPaolo Bonzini QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 1585770e8afSPaolo Bonzini CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu99/-std=gnu++11/) 1599c83ffd8SPeter Maydell for arg in $QEMU_CFLAGS; do 1609c83ffd8SPeter Maydell case $arg in 1619c83ffd8SPeter Maydell -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 1629c83ffd8SPeter Maydell -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 1639c83ffd8SPeter Maydell ;; 1649c83ffd8SPeter Maydell *) 1659c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1669c83ffd8SPeter Maydell ;; 1679c83ffd8SPeter Maydell esac 1689c83ffd8SPeter Maydell done 1699c83ffd8SPeter Maydell} 1709c83ffd8SPeter Maydell 17152166aa0SJuan Quintelacompile_object() { 172fd0e6053SJohn Snow local_cflags="$1" 1735770e8afSPaolo Bonzini do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 17452166aa0SJuan Quintela} 17552166aa0SJuan Quintela 17652166aa0SJuan Quintelacompile_prog() { 17752166aa0SJuan Quintela local_cflags="$1" 17852166aa0SJuan Quintela local_ldflags="$2" 1795770e8afSPaolo Bonzini do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \ 1805770e8afSPaolo Bonzini $LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags 18152166aa0SJuan Quintela} 18252166aa0SJuan Quintela 18311568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 18411568d6dSPaolo Bonzinisymlink() { 18572b8b5a1SStefan Weil rm -rf "$2" 186ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 18772b8b5a1SStefan Weil ln -s "$1" "$2" 18811568d6dSPaolo Bonzini} 18911568d6dSPaolo Bonzini 1900dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1910dba6195SLoïc Minier# executable or a builtin) 1920dba6195SLoïc Minierhas() { 1930dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1940dba6195SLoïc Minier} 1950dba6195SLoïc Minier 1960a01d76fSMarc-André Lureauversion_ge () { 1970a01d76fSMarc-André Lureau local_ver1=`echo $1 | tr . ' '` 1980a01d76fSMarc-André Lureau local_ver2=`echo $2 | tr . ' '` 1990a01d76fSMarc-André Lureau while true; do 2000a01d76fSMarc-André Lureau set x $local_ver1 2010a01d76fSMarc-André Lureau local_first=${2-0} 202c44a33e2SStefano Garzarella # 'shift 2' if $2 is set, or 'shift' if $2 is not set 203c44a33e2SStefano Garzarella shift ${2:+2} 2040a01d76fSMarc-André Lureau local_ver1=$* 2050a01d76fSMarc-André Lureau set x $local_ver2 2060a01d76fSMarc-André Lureau # the second argument finished, the first must be greater or equal 2070a01d76fSMarc-André Lureau test $# = 1 && return 0 2080a01d76fSMarc-André Lureau test $local_first -lt $2 && return 1 2090a01d76fSMarc-André Lureau test $local_first -gt $2 && return 0 210c44a33e2SStefano Garzarella shift ${2:+2} 2110a01d76fSMarc-André Lureau local_ver2=$* 2120a01d76fSMarc-André Lureau done 2130a01d76fSMarc-André Lureau} 2140a01d76fSMarc-André Lureau 2155b808275SLluís Vilanovahave_backend () { 2165b808275SLluís Vilanova echo "$trace_backends" | grep "$1" >/dev/null 2175b808275SLluís Vilanova} 2185b808275SLluís Vilanova 2193b6b7550SPaolo Bonziniglob() { 2203b6b7550SPaolo Bonzini eval test -z '"${1#'"$2"'}"' 2213b6b7550SPaolo Bonzini} 2223b6b7550SPaolo Bonzini 223e9a3591fSChristian Borntraegerld_has() { 224e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 225e9a3591fSChristian Borntraeger} 226e9a3591fSChristian Borntraeger 2274ace32e2SAntonio Ospiteif printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 2284ace32e2SAntonio Ospitethen 2294ace32e2SAntonio Ospite error_exit "main directory cannot contain spaces nor colons" 2304ace32e2SAntonio Ospitefi 2314ace32e2SAntonio Ospite 23214211825SAntonio Ospite# default parameters 2332ff6b91eSJuan Quintelacpu="" 234a31a8642SMichael S. Tsirkiniasl="iasl" 2351e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 23643ce4dfeSbellardstatic="no" 2377d13299dSbellardcross_prefix="" 2380c58ac1cSmalcaudio_drv_list="" 239b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 240b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 241e49d021eSPeter Maydellhost_cc="cc" 242d5631638Smalcaudio_win_int="" 243957f1f99SMichael Rothlibs_qga="" 2445bc62e01SGerd Hoffmanndebug_info="yes" 24563678e17SSteven Noonanstack_protector="" 2461e4f6065SDaniele Buonosafe_stack="" 247afc3a8f9SAlex Bennéeuse_containers="yes" 248f2385398SAlex Bennéegdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 249ac0df51dSaliguori 25092712822SDaniel P. Berrangeif test -e "$source_path/.git" 25192712822SDaniel P. Berrangethen 252f62bbee5SDaniel P. Berrange git_update=yes 25392712822SDaniel P. Berrange git_submodules="ui/keycodemapdb" 2543ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 2553ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 25692712822SDaniel P. Berrangeelse 257f62bbee5SDaniel P. Berrange git_update=no 258aef45d51SDaniel P. Berrange git_submodules="" 2595c0ef67aSDaniel P. Berrangé 2605c0ef67aSDaniel P. Berrangé if ! test -f "$source_path/ui/keycodemapdb/README" 2615c0ef67aSDaniel P. Berrangé then 2625c0ef67aSDaniel P. Berrangé echo 2635c0ef67aSDaniel P. Berrangé echo "ERROR: missing file $source_path/ui/keycodemapdb/README" 2645c0ef67aSDaniel P. Berrangé echo 2655c0ef67aSDaniel P. Berrangé echo "This is not a GIT checkout but module content appears to" 2665c0ef67aSDaniel P. Berrangé echo "be missing. Do not use 'git archive' or GitHub download links" 2675c0ef67aSDaniel P. Berrangé echo "to acquire QEMU source archives. Non-GIT builds are only" 2685c0ef67aSDaniel P. Berrangé echo "supported with source archives linked from:" 2695c0ef67aSDaniel P. Berrangé echo 270a3e3b521SPeter Maydell echo " https://www.qemu.org/download/#source" 2715c0ef67aSDaniel P. Berrangé echo 2725c0ef67aSDaniel P. Berrangé echo "Developers working with GIT can use scripts/archive-source.sh" 2735c0ef67aSDaniel P. Berrangé echo "if they need to create valid source archives." 2745c0ef67aSDaniel P. Berrangé echo 2755c0ef67aSDaniel P. Berrangé exit 1 2765c0ef67aSDaniel P. Berrangé fi 27792712822SDaniel P. Berrangefi 278cc84d63aSDaniel P. Berrangegit="git" 279ac0df51dSaliguori 280afb63ebdSStefan Weil# Don't accept a target_list environment variable. 281afb63ebdSStefan Weilunset target_list 282447e133fSAlex Bennéeunset target_list_exclude 283377529c0SPaolo Bonzini 284377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 285377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 286377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 287377529c0SPaolo Bonzini# unless --disable-foo is given 288377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 289377529c0SPaolo Bonzini# feature will searched for, 290377529c0SPaolo Bonzini# if not found, configure exits with error 291377529c0SPaolo Bonzini# 292377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 293377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 294377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 295377529c0SPaolo Bonzini 296377529c0SPaolo Bonzinibrlapi="" 297377529c0SPaolo Bonzinicurl="" 2985285e593SYonggang Luoiconv="auto" 2995285e593SYonggang Luocurses="auto" 300e3667660SYonggang Luodocs="auto" 301fbb4121dSPaolo Bonzinifdt="auto" 30258952137SVincenzo Maffionenetmap="no" 30335be72baSPaolo Bonzinisdl="auto" 30435be72baSPaolo Bonzinisdl_image="auto" 305983eef5aSMeador Ingevirtfs="" 3065c53015aSPaolo Bonzinilibudev="auto" 3076ec0e15dSPaolo Bonzinimpath="auto" 308a0b93237SPaolo Bonzinivnc="enabled" 309deb62371SPaolo Bonzinisparse="auto" 310377529c0SPaolo Bonzinivde="" 311a0b93237SPaolo Bonzinivnc_sasl="auto" 312a0b93237SPaolo Bonzinivnc_jpeg="auto" 313a0b93237SPaolo Bonzinivnc_png="auto" 3144113f4cfSLaurent Vivierxkbcommon="auto" 315377529c0SPaolo Bonzinixen="" 316d5b93ddfSAnthony PERARDxen_ctrl_version="" 3171badb709SPaolo Bonzinixen_pci_passthrough="auto" 318377529c0SPaolo Bonzinilinux_aio="" 319c10dd856SAarushi Mehtalinux_io_uring="" 32047e98658SCorey Bryantcap_ng="" 321377529c0SPaolo Bonziniattr="" 3224f26f2b6SAvi Kivitylibattr="" 323377529c0SPaolo Bonzinixfs="" 3241badb709SPaolo Bonzinitcg="enabled" 325a40161cbSPaolo Bonzinimembarrier="" 326299e6f19SPaolo Bonzinivhost_net="" 327299e6f19SPaolo Bonzinivhost_crypto="" 328299e6f19SPaolo Bonzinivhost_scsi="" 329299e6f19SPaolo Bonzinivhost_vsock="" 330e6a74868SMarc-André Lureauvhost_user="" 33198fc1adaSDr. David Alan Gilbertvhost_user_fs="" 3323bd40ec7SPaolo Bonzinikvm="auto" 3333bd40ec7SPaolo Bonzinihax="auto" 3343bd40ec7SPaolo Bonzinihvf="auto" 3353bd40ec7SPaolo Bonziniwhpx="auto" 3362da776dbSMichael R. Hinesrdma="" 33721ab34c9SMarcel Apfelbaumpvrdma="" 338377529c0SPaolo Bonzinigprof="no" 339377529c0SPaolo Bonzinidebug_tcg="no" 340377529c0SPaolo Bonzinidebug="no" 341247724cbSMarc-André Lureausanitizers="no" 3420aebab04SLingfeng Yangtsan="no" 343b553a042SJohn Snowfortify_source="" 344377529c0SPaolo Bonzinistrip_opt="yes" 3459195b2c2SStefan Weiltcg_interpreter="no" 346377529c0SPaolo Bonzinibigendian="no" 347377529c0SPaolo Bonzinimingw32="no" 3481d728c39SBlue Swirlgcov="no" 349377529c0SPaolo BonziniEXESUF="" 350484e2cc7SPaolo BonziniHOST_DSOSUF=".so" 35117969268SFam Zhengmodules="no" 352bd83c861SChristian Ehrhardtmodule_upgrades="no" 353377529c0SPaolo Bonziniprefix="/usr/local" 35410ff82d1SMarc-André Lureauqemu_suffix="qemu" 3554d34a86bSPaolo Bonzinislirp="auto" 356377529c0SPaolo Bonzinioss_lib="" 357377529c0SPaolo Bonzinibsd="no" 358377529c0SPaolo Bonzinilinux="no" 359377529c0SPaolo Bonzinisolaris="no" 360377529c0SPaolo Bonziniprofiler="no" 361b4e312e9SPaolo Bonzinicocoa="auto" 362377529c0SPaolo Bonzinisoftmmu="yes" 363377529c0SPaolo Bonzinilinux_user="no" 364377529c0SPaolo Bonzinibsd_user="no" 365*c8d5450bSPaolo Bonziniblobs="true" 366377529c0SPaolo Bonzinipkgversion="" 36740d6444eSAvi Kivitypie="" 3683556c233SPaolo Bonziniqom_cast_debug="yes" 369baf86d6bSPaolo Bonzinitrace_backends="log" 370377529c0SPaolo Bonzinitrace_file="trace" 371377529c0SPaolo Bonzinispice="" 372377529c0SPaolo Bonzinirbd="" 3737b02f544SMarc-André Lureausmartcard="" 3740a40bcb7SCésar Belleyu2f="auto" 3752b2325ffSGerd Hoffmannlibusb="" 37669354a83SHans de Goedeusb_redir="" 377da076ffeSGerd Hoffmannopengl="" 378014cb152SGerd Hoffmannopengl_dmabuf="no" 3795dd89908SRichard Hendersoncpuid_h="no" 38086583a07SLiam Merwickavx2_opt="" 3818b18cdbfSRichard Hendersoncapstone="auto" 382b25c9dffSStefan Weillzo="" 383b25c9dffSStefan Weilsnappy="" 3846b383c08SPeter Wubzip2="" 38583bc1f97SJulio Faraccolzfse="" 3863a678481SJuan Quintelazstd="" 387e8ef31a3SMichael Tokarevguest_agent="" 388d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 38950cbebb9SMichael Rothguest_agent_ntddscsi="no" 3909dacf32dSYossi Hindinguest_agent_msi="" 391d9840e25STomoki Sekiyamavss_win32_sdk="" 392d9840e25STomoki Sekiyamawin_sdk="no" 393e10ee3f5SPhilippe Mathieu-Daudéwant_tools="" 394c589b249SRonnie Sahlberglibiscsi="" 3956542aa9cSPeter Lievenlibnfs="" 396519175a2SAlex Barcelocoroutine="" 39770c60c08SStefan Hajnoczicoroutine_pool="" 3987d992e4dSPeter Lievendebug_stack_usage="no" 399f0d92b56SLongpeng(Mike)crypto_afalg="no" 400f794573eSEduardo Otuboseccomp="" 401eb100396SBharata B Raoglusterfs="" 402d85fa9ebSJeff Codyglusterfs_xlator_opt="no" 4030c14fb47SBharata B Raoglusterfs_discard="no" 404df3a429aSNiels de Vosglusterfs_fallocate="no" 4057c815372SBharata B Raoglusterfs_zerofill="no" 406e014dbe7SPrasanna Kumar Kaleverglusterfs_ftruncate_has_stat="no" 4070e3b891fSNiels de Vosglusterfs_iocb_has_stat="no" 408a4ccabcfSAnthony Liguorigtk="" 409925a0400SGerd Hoffmanngtk_gl="no" 410a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 411ddbb0d09SDaniel P. Berrangegnutls="" 41291bfcdb0SDaniel P. Berrangenettle="" 413dc2207afSDaniel P. Berrangénettle_xts="no" 41491bfcdb0SDaniel P. Berrangegcrypt="" 4151f923c70SLongpeng(Mike)gcrypt_hmac="no" 416e0576942SDaniel P. Berrangégcrypt_xts="no" 417e0576942SDaniel P. Berrangéqemu_private_xts="yes" 4188953caf3SDaniel P. Berrangeauth_pam="" 419bbbf9bfbSStefan Weilvte="" 4209d9e1521SGerd Hoffmannvirglrenderer="" 4217aaa6a16SPaolo Bonzinitpm="" 422b10d49d7SPino Toscanolibssh="" 423ed1701c6SDr. David Alan Gilbertlive_block_migration="yes" 424a99d57bbSWanlong Gaonuma="" 4252847b469SFam Zhengtcmalloc="no" 4267b01cb97SAlexandre Derumierjemalloc="no" 427a6b1d4c0SChanglong Xiereplication="yes" 4282f740136SJeff Codybochs="yes" 4292f740136SJeff Codycloop="yes" 4302f740136SJeff Codydmg="yes" 4312f740136SJeff Codyqcow1="yes" 4322f740136SJeff Codyvdi="yes" 4332f740136SJeff Codyvvfat="yes" 4342f740136SJeff Codyqed="yes" 4352f740136SJeff Codyparallels="yes" 436e1c42697SDaniel P. Berrangésheepdog="no" 437ed279a06SKlim Kireevlibxml2="" 438ba59fb77SPaolo Bonzinidebug_mutex="no" 43917824406SJunyan Helibpmem="" 440f3494749SPaolo Bonzinidefault_devices="yes" 44140e8c6f4SAlex Bennéeplugins="no" 442adc28027SAlexander Bulekovfuzzing="no" 443b767d257SMarek Marczykowski-Góreckirng_none="no" 44454e7aac0SAlexey Krasikovsecret_keyring="" 44521b2eca6SJingqi Liulibdaxctl="" 446a5665051SPaolo Bonzinimeson="" 44748328880SPaolo Bonzinininja="" 448a5665051SPaolo Bonziniskip_meson=no 449e8f3bd71SMarc-André Lureaugettext="" 450377529c0SPaolo Bonzini 451fb59dabdSPeter Maydellbogus_os="no" 452aa087962SPaolo Bonzinimalloc_trim="auto" 453898be3e0SPeter Maydell 454ac0df51dSaliguori# parse CC options first 455ac0df51dSaliguorifor opt do 45689138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 457ac0df51dSaliguori case "$opt" in 458ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 459ac0df51dSaliguori ;; 4603d8df640SPaolo Bonzini --cc=*) CC="$optarg" 461ac0df51dSaliguori ;; 46283f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 46383f73fceSTomoki Sekiyama ;; 4642ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 4652ff6b91eSJuan Quintela ;; 466de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 467db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 468e2a2ed06SJuan Quintela ;; 46911cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 47011cde1c8SBruno Dominguez ;; 471db5adeaaSPaolo Bonzini --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 472f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 473e2a2ed06SJuan Quintela ;; 4745bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 4755bc62e01SGerd Hoffmann ;; 4765bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 4775bc62e01SGerd Hoffmann ;; 478d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 479d75402b5SAlex Bennée ;; 480d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 481d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 4822038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 483d422b2bcSAlex Bennée ;; 484d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 4852038f8c8SPaolo Bonzini cc_archs="$cc_archs $cc_arch" 486d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 4872038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 488d75402b5SAlex Bennée ;; 489ac0df51dSaliguori esac 490ac0df51dSaliguoridone 491ac0df51dSaliguori# OS specific 492ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 49393148aa5SStefan Weil# we can eliminate its usage altogether. 494ac0df51dSaliguori 495e49d021eSPeter Maydell# Preferred compiler: 496e49d021eSPeter Maydell# ${CC} (if set) 497e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 498e49d021eSPeter Maydell# system compiler 499e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 500e49d021eSPeter Maydell cc="$host_cc" 501e49d021eSPeter Maydellelse 502b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 503e49d021eSPeter Maydellfi 504e49d021eSPeter Maydell 50583f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 50683f73fceSTomoki Sekiyama cxx="c++" 50783f73fceSTomoki Sekiyamaelse 50883f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 50983f73fceSTomoki Sekiyamafi 51083f73fceSTomoki Sekiyama 511b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 512cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 5135f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 5143dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 515b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 516b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 5179f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 5184852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 519b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 520b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 52117884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 52217884d7bSSergei Trofimovichquery_pkg_config() { 52317884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 52417884d7bSSergei Trofimovich} 52517884d7bSSergei Trofimovichpkg_config=query_pkg_config 52647c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 527ac0df51dSaliguori 52845d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 52945d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 53045d285abSPeter Maydell 531be17dc90SMichael S. Tsirkin# default flags for all hosts 5322d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 5332d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 5342d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 5352d31515bSPeter Maydell# provides these semantics.) 536086d5f75SPaolo BonziniQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 537086d5f75SPaolo BonziniQEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 538c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 539be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 5405770e8afSPaolo Bonzini 5415770e8afSPaolo Bonzini# Flags that are needed during configure but later taken care of by Meson 5425770e8afSPaolo BonziniCONFIGURE_CFLAGS="-std=gnu99 -Wall" 5435770e8afSPaolo BonziniCONFIGURE_LDFLAGS= 544086d5f75SPaolo Bonzini 545be17dc90SMichael S. Tsirkin 546ac0df51dSaliguoricheck_define() { 547ac0df51dSaliguoricat > $TMPC <<EOF 548ac0df51dSaliguori#if !defined($1) 549fd786e1aSPeter Maydell#error $1 not defined 550ac0df51dSaliguori#endif 551ac0df51dSaliguoriint main(void) { return 0; } 552ac0df51dSaliguoriEOF 55352166aa0SJuan Quintela compile_object 554ac0df51dSaliguori} 555ac0df51dSaliguori 556307119e7SGerd Hoffmanncheck_include() { 557307119e7SGerd Hoffmanncat > $TMPC <<EOF 558307119e7SGerd Hoffmann#include <$1> 559307119e7SGerd Hoffmannint main(void) { return 0; } 560307119e7SGerd HoffmannEOF 561307119e7SGerd Hoffmann compile_object 562307119e7SGerd Hoffmann} 563307119e7SGerd Hoffmann 56493b25869SJohn Snowwrite_c_skeleton() { 56593b25869SJohn Snow cat > $TMPC <<EOF 56693b25869SJohn Snowint main(void) { return 0; } 56793b25869SJohn SnowEOF 56893b25869SJohn Snow} 56993b25869SJohn Snow 570adc28027SAlexander Bulekovwrite_c_fuzzer_skeleton() { 571adc28027SAlexander Bulekov cat > $TMPC <<EOF 572adc28027SAlexander Bulekov#include <stdint.h> 573adc28027SAlexander Bulekov#include <sys/types.h> 574adc28027SAlexander Bulekovint LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); 575adc28027SAlexander Bulekovint LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } 576adc28027SAlexander BulekovEOF 577adc28027SAlexander Bulekov} 578adc28027SAlexander Bulekov 579bbea4050SPeter Maydellif check_define __linux__ ; then 580bbea4050SPeter Maydell targetos="Linux" 581bbea4050SPeter Maydellelif check_define _WIN32 ; then 582bbea4050SPeter Maydell targetos='MINGW32' 583bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 584bbea4050SPeter Maydell targetos='OpenBSD' 585bbea4050SPeter Maydellelif check_define __sun__ ; then 586bbea4050SPeter Maydell targetos='SunOS' 587bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 588bbea4050SPeter Maydell targetos='Haiku' 589951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 590951fedfcSPeter Maydell targetos='FreeBSD' 591951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 592951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 593951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 594951fedfcSPeter Maydell targetos='DragonFly' 595951fedfcSPeter Maydellelif check_define __NetBSD__; then 596951fedfcSPeter Maydell targetos='NetBSD' 597951fedfcSPeter Maydellelif check_define __APPLE__; then 598951fedfcSPeter Maydell targetos='Darwin' 599bbea4050SPeter Maydellelse 600951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 601951fedfcSPeter Maydell # might be going to just print the --help text, or it might 602951fedfcSPeter Maydell # be the result of a missing compiler. 603951fedfcSPeter Maydell targetos='bogus' 604951fedfcSPeter Maydell bogus_os='yes' 605bbea4050SPeter Maydellfi 606bbea4050SPeter Maydell 607bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 608bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 609bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 610bbea4050SPeter Maydell# the correct CPU with the --cpu option. 611bbea4050SPeter Maydellcase $targetos in 612bbea4050SPeter MaydellDarwin) 613bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 614bbea4050SPeter Maydell # run 64-bit userspace code. 615bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 616bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 617bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 618bbea4050SPeter Maydell cpu="x86_64" 619bbea4050SPeter Maydell fi 620bbea4050SPeter Maydell ;; 621bbea4050SPeter MaydellSunOS) 62289138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 623bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 624bbea4050SPeter Maydell cpu="x86_64" 625bbea4050SPeter Maydell fi 626bbea4050SPeter Maydellesac 627bbea4050SPeter Maydell 6282ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 6292ff6b91eSJuan Quintela # command line argument 6302ff6b91eSJuan Quintela : 6312ff6b91eSJuan Quintelaelif check_define __i386__ ; then 632ac0df51dSaliguori cpu="i386" 633ac0df51dSaliguorielif check_define __x86_64__ ; then 634c72b26ecSRichard Henderson if check_define __ILP32__ ; then 635c72b26ecSRichard Henderson cpu="x32" 636c72b26ecSRichard Henderson else 637ac0df51dSaliguori cpu="x86_64" 638c72b26ecSRichard Henderson fi 6393aa9bd6cSblueswir1elif check_define __sparc__ ; then 6403aa9bd6cSblueswir1 if check_define __arch64__ ; then 6413aa9bd6cSblueswir1 cpu="sparc64" 6423aa9bd6cSblueswir1 else 6433aa9bd6cSblueswir1 cpu="sparc" 6443aa9bd6cSblueswir1 fi 645fdf7ed96Smalcelif check_define _ARCH_PPC ; then 646fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 647f8378accSRichard Henderson if check_define _LITTLE_ENDIAN ; then 648f8378accSRichard Henderson cpu="ppc64le" 649f8378accSRichard Henderson else 650fdf7ed96Smalc cpu="ppc64" 651f8378accSRichard Henderson fi 652ac0df51dSaliguori else 653fdf7ed96Smalc cpu="ppc" 654fdf7ed96Smalc fi 655afa05235SAurelien Jarnoelif check_define __mips__ ; then 656afa05235SAurelien Jarno cpu="mips" 657d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 658d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 659d66ed0eaSAurelien Jarno cpu="s390x" 660d66ed0eaSAurelien Jarno else 661d66ed0eaSAurelien Jarno cpu="s390" 662d66ed0eaSAurelien Jarno fi 663c4f80543SAlistair Franciselif check_define __riscv ; then 664c4f80543SAlistair Francis if check_define _LP64 ; then 665c4f80543SAlistair Francis cpu="riscv64" 666c4f80543SAlistair Francis else 667c4f80543SAlistair Francis cpu="riscv32" 668c4f80543SAlistair Francis fi 66921d89f84SPeter Maydellelif check_define __arm__ ; then 67021d89f84SPeter Maydell cpu="arm" 6711f080313SClaudio Fontanaelif check_define __aarch64__ ; then 6721f080313SClaudio Fontana cpu="aarch64" 673fdf7ed96Smalcelse 67489138857SStefan Weil cpu=$(uname -m) 675ac0df51dSaliguorifi 676ac0df51dSaliguori 677359bc95dSPeter MaydellARCH= 678359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 679359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 6807d13299dSbellardcase "$cpu" in 681ee35e968SThomas Huth ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 682898be3e0SPeter Maydell ;; 683f8378accSRichard Henderson ppc64le) 684f8378accSRichard Henderson ARCH="ppc64" 685f8378accSRichard Henderson ;; 6867d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 68797a847bcSbellard cpu="i386" 6887d13299dSbellard ;; 689aaa5fa14Saurel32 x86_64|amd64) 690aaa5fa14Saurel32 cpu="x86_64" 691aaa5fa14Saurel32 ;; 69221d89f84SPeter Maydell armv*b|armv*l|arm) 69321d89f84SPeter Maydell cpu="arm" 6947d13299dSbellard ;; 6951f080313SClaudio Fontana aarch64) 6961f080313SClaudio Fontana cpu="aarch64" 6971f080313SClaudio Fontana ;; 698afa05235SAurelien Jarno mips*) 699afa05235SAurelien Jarno cpu="mips" 700afa05235SAurelien Jarno ;; 7013142255cSblueswir1 sparc|sun4[cdmuv]) 702ae228531Sbellard cpu="sparc" 703ae228531Sbellard ;; 7047d13299dSbellard *) 705359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 706359bc95dSPeter Maydell ARCH=unknown 7077d13299dSbellard ;; 7087d13299dSbellardesac 709359bc95dSPeter Maydellif test -z "$ARCH"; then 710359bc95dSPeter Maydell ARCH="$cpu" 711359bc95dSPeter Maydellfi 712e2d52ad3SJuan Quintela 7137d13299dSbellard# OS specific 7140dbfc675SJuan Quintela 7157d13299dSbellardcase $targetos in 71667b915a5SbellardMINGW32*) 71767b915a5Sbellard mingw32="yes" 718299e6f19SPaolo Bonzini vhost_user="no" 7193cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 720307119e7SGerd Hoffmann if check_include dsound.h; then 7213cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 722307119e7SGerd Hoffmann else 723307119e7SGerd Hoffmann audio_drv_list="" 724307119e7SGerd Hoffmann fi 725898be3e0SPeter Maydell supported_os="yes" 726fb648e9cSDaniel P. Berrangé pie="no" 72767b915a5Sbellard;; 7285c40d2bdSthsGNU/kFreeBSD) 729a167ba50SAurelien Jarno bsd="yes" 7306a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7310bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 7325c40d2bdSths;; 7337d3505c5SbellardFreeBSD) 7347d3505c5Sbellard bsd="yes" 7350db4a067SPaolo Bonzini make="${MAKE-gmake}" 7366a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7370bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 738f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 73958952137SVincenzo Maffione netmap="" # enable netmap autodetect 7407d3505c5Sbellard;; 741c5e97233Sblueswir1DragonFly) 742c5e97233Sblueswir1 bsd="yes" 7430db4a067SPaolo Bonzini make="${MAKE-gmake}" 7446a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7450bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 746c5e97233Sblueswir1;; 7477d3505c5SbellardNetBSD) 7487d3505c5Sbellard bsd="yes" 7490db4a067SPaolo Bonzini make="${MAKE-gmake}" 7506a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7510bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 7528ef92a88Sblueswir1 oss_lib="-lossaudio" 7537d3505c5Sbellard;; 7547d3505c5SbellardOpenBSD) 7557d3505c5Sbellard bsd="yes" 7560db4a067SPaolo Bonzini make="${MAKE-gmake}" 757f92c7168SGerd Hoffmann audio_drv_list="try-sdl" 7580bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 7597d3505c5Sbellard;; 76083fb7adfSbellardDarwin) 76183fb7adfSbellard bsd="yes" 76283fb7adfSbellard darwin="yes" 7631b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 764a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 765db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" 7661b0f9cc2Saliguori fi 767b4e312e9SPaolo Bonzini cocoa="enabled" 7686a485418SGerd Hoffmann audio_drv_list="coreaudio try-sdl" 76914382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 770db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" 771a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 772a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 773a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 77483fb7adfSbellard;; 775ec530c81SbellardSunOS) 776ec530c81Sbellard solaris="yes" 7770db4a067SPaolo Bonzini make="${MAKE-gmake}" 778e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 7796b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 7806a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7816b4d2ba1Sths fi 782c2de5c91Smalc audio_possible_drivers="oss sdl" 783d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 784d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 785d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 786d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 787ec530c81Sbellard;; 788179cf400SAndreas FärberHaiku) 789179cf400SAndreas Färber haiku="yes" 790fc433430SDavid CARLIER QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" 791179cf400SAndreas Färber;; 792898be3e0SPeter MaydellLinux) 7937183834aSGerd Hoffmann audio_drv_list="try-pa oss" 7940bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 7955327cf48Sbellard linux="yes" 796831b7825Sths linux_user="yes" 797898be3e0SPeter Maydell;; 7987d13299dSbellardesac 7997d13299dSbellard 8007d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 801b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 80284778508Sblueswir1 bsd_user="yes" 8037d3505c5Sbellard fi 80408de3949SAndreas Färberfi 8057d3505c5Sbellard 8060db4a067SPaolo Bonzini: ${make=${MAKE-make}} 807b6daf4d3SPaolo Bonzini 808faf44142SDaniel P. Berrangé# We prefer python 3.x. A bare 'python' is traditionally 809faf44142SDaniel P. Berrangé# python 2.x, but some distros have it as python 3.x, so 810ddf90699SEduardo Habkost# we check that too 811faf44142SDaniel P. Berrangépython= 8120a01d76fSMarc-André Lureauexplicit_python=no 813ddf90699SEduardo Habkostfor binary in "${PYTHON-python3}" python 814faf44142SDaniel P. Berrangédo 815faf44142SDaniel P. Berrangé if has "$binary" 816faf44142SDaniel P. Berrangé then 81795c5f2deSPaolo Bonzini python=$(command -v "$binary") 818faf44142SDaniel P. Berrangé break 819faf44142SDaniel P. Berrangé fi 820faf44142SDaniel P. Berrangédone 821903458c8SMarkus Armbruster 822903458c8SMarkus Armbruster 82339d87c8cSAlex Bennée# Check for ancillary tools used in testing 82439d87c8cSAlex Bennéegenisoimage= 8253df437c7SAlex Bennéefor binary in genisoimage mkisofs 82639d87c8cSAlex Bennéedo 82739d87c8cSAlex Bennée if has $binary 82839d87c8cSAlex Bennée then 82939d87c8cSAlex Bennée genisoimage=$(command -v "$binary") 83039d87c8cSAlex Bennée break 83139d87c8cSAlex Bennée fi 83239d87c8cSAlex Bennéedone 83339d87c8cSAlex Bennée 834e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 8350db4a067SPaolo Bonzini 8363c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 8373c4a4d0dSPeter Maydellif has clang; then 8383c4a4d0dSPeter Maydell objcc=clang 8393c4a4d0dSPeter Maydellelse 8403c4a4d0dSPeter Maydell objcc="$cc" 8413c4a4d0dSPeter Maydellfi 8423c4a4d0dSPeter Maydell 8433457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 8443457a3f8SJuan Quintela EXESUF=".exe" 845484e2cc7SPaolo Bonzini HOST_DSOSUF=".dll" 84678e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 8475770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS" 84893b25869SJohn Snow write_c_skeleton; 849d17f305aSPaolo Bonzini prefix="/qemu" 85077433a5fSMarc-André Lureau qemu_suffix="" 851105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 8523457a3f8SJuan Quintelafi 8533457a3f8SJuan Quintela 854487fefdbSAnthony Liguoriwerror="" 85585aa5189Sbellard 8567d13299dSbellardfor opt do 85789138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 8587d13299dSbellard case "$opt" in 8592efc3265Sbellard --help|-h) show_help=yes 8602efc3265Sbellard ;; 86199123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 86299123e13SMike Frysinger ;; 863b1a550a0Spbrook --prefix=*) prefix="$optarg" 8647d13299dSbellard ;; 865b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 86632ce6337Sbellard ;; 867ac0df51dSaliguori --cross-prefix=*) 8687d13299dSbellard ;; 869ac0df51dSaliguori --cc=*) 8707d13299dSbellard ;; 871b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 87283469015Sbellard ;; 87383f73fceSTomoki Sekiyama --cxx=*) 87483f73fceSTomoki Sekiyama ;; 875e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 876e007dbecSMichael S. Tsirkin ;; 8773c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 8783c4a4d0dSPeter Maydell ;; 879b1a550a0Spbrook --make=*) make="$optarg" 8807d13299dSbellard ;; 881b6daf4d3SPaolo Bonzini --install=*) 8826a882643Spbrook ;; 8830a01d76fSMarc-André Lureau --python=*) python="$optarg" ; explicit_python=yes 884c886edfbSBlue Swirl ;; 8852eb054c2SPeter Maydell --sphinx-build=*) sphinx_build="$optarg" 8862eb054c2SPeter Maydell ;; 887a5665051SPaolo Bonzini --skip-meson) skip_meson=yes 888a5665051SPaolo Bonzini ;; 889a5665051SPaolo Bonzini --meson=*) meson="$optarg" 890a5665051SPaolo Bonzini ;; 89148328880SPaolo Bonzini --ninja=*) ninja="$optarg" 89248328880SPaolo Bonzini ;; 893e2d8830eSBrad --smbd=*) smbd="$optarg" 894e2d8830eSBrad ;; 895e2a2ed06SJuan Quintela --extra-cflags=*) 8967d13299dSbellard ;; 89711cde1c8SBruno Dominguez --extra-cxxflags=*) 89811cde1c8SBruno Dominguez ;; 899e2a2ed06SJuan Quintela --extra-ldflags=*) 9007d13299dSbellard ;; 9015bc62e01SGerd Hoffmann --enable-debug-info) 9025bc62e01SGerd Hoffmann ;; 9035bc62e01SGerd Hoffmann --disable-debug-info) 9045bc62e01SGerd Hoffmann ;; 905d75402b5SAlex Bennée --cross-cc-*) 906d75402b5SAlex Bennée ;; 90717969268SFam Zheng --enable-modules) 90817969268SFam Zheng modules="yes" 90917969268SFam Zheng ;; 9103aa88b31SStefan Hajnoczi --disable-modules) 9113aa88b31SStefan Hajnoczi modules="no" 9123aa88b31SStefan Hajnoczi ;; 913bd83c861SChristian Ehrhardt --disable-module-upgrades) module_upgrades="no" 914bd83c861SChristian Ehrhardt ;; 915bd83c861SChristian Ehrhardt --enable-module-upgrades) module_upgrades="yes" 916bd83c861SChristian Ehrhardt ;; 9172ff6b91eSJuan Quintela --cpu=*) 9187d13299dSbellard ;; 919b1a550a0Spbrook --target-list=*) target_list="$optarg" 920447e133fSAlex Bennée if test "$target_list_exclude"; then 921447e133fSAlex Bennée error_exit "Can't mix --target-list with --target-list-exclude" 922447e133fSAlex Bennée fi 923447e133fSAlex Bennée ;; 924447e133fSAlex Bennée --target-list-exclude=*) target_list_exclude="$optarg" 925447e133fSAlex Bennée if test "$target_list"; then 926447e133fSAlex Bennée error_exit "Can't mix --target-list-exclude with --target-list" 927447e133fSAlex Bennée fi 928de83cd02Sbellard ;; 9295b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 9305b808275SLluís Vilanova ;; 9315b808275SLluís Vilanova # XXX: backwards compatibility 9325b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 93394a420b1SStefan Hajnoczi ;; 93474242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 9359410b56cSPrerna Saxena ;; 936f3494749SPaolo Bonzini --with-default-devices) default_devices="yes" 937f3494749SPaolo Bonzini ;; 938f3494749SPaolo Bonzini --without-default-devices) default_devices="no" 939f3494749SPaolo Bonzini ;; 9407d13299dSbellard --enable-gprof) gprof="yes" 9417d13299dSbellard ;; 9421d728c39SBlue Swirl --enable-gcov) gcov="yes" 9431d728c39SBlue Swirl ;; 94479427693SLoïc Minier --static) 94579427693SLoïc Minier static="yes" 94617884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 94743ce4dfeSbellard ;; 9480b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 9490b24e75fSPaolo Bonzini ;; 9500b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 9510b24e75fSPaolo Bonzini ;; 9523aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 9533aa5d2beSAlon Levy ;; 9548bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 9558bf188aaSMichael Tokarev ;; 9560f94d6daSAlon Levy --includedir=*) includedir="$optarg" 9570f94d6daSAlon Levy ;; 958528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 9590b24e75fSPaolo Bonzini ;; 96077433a5fSMarc-André Lureau --with-suffix=*) qemu_suffix="$optarg" 961023d3d67SEduardo Habkost ;; 962c6502638SBruce Rogers --docdir=*) docdir="$optarg" 9630b24e75fSPaolo Bonzini ;; 964fe0038beSPaolo Bonzini --localedir=*) localedir="$optarg" 965fe0038beSPaolo Bonzini ;; 966ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 96707381cc1SAnthony Liguori ;; 968785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 969785c23aeSLuiz Capitulino ;; 9703d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 9713d5eecabSGerd Hoffmann ;; 972181ce1d0SOlaf Hering --host=*|--build=*|\ 973181ce1d0SOlaf Hering --disable-dependency-tracking|\ 974785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 975fe0038beSPaolo Bonzini --oldincludedir=*|--datarootdir=*|--infodir=*|\ 976023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 977023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 978023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 979023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 980023ddd74SMax Filippov # lots of directory switches by default. 981023ddd74SMax Filippov ;; 98235be72baSPaolo Bonzini --disable-sdl) sdl="disabled" 98397a847bcSbellard ;; 98435be72baSPaolo Bonzini --enable-sdl) sdl="enabled" 985c4198157SJuan Quintela ;; 98635be72baSPaolo Bonzini --disable-sdl-image) sdl_image="disabled" 987a442fe2fSDaniel P. Berrangé ;; 98835be72baSPaolo Bonzini --enable-sdl-image) sdl_image="enabled" 989a442fe2fSDaniel P. Berrangé ;; 9903556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 9913556c233SPaolo Bonzini ;; 9923556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 9933556c233SPaolo Bonzini ;; 994983eef5aSMeador Inge --disable-virtfs) virtfs="no" 995983eef5aSMeador Inge ;; 996983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 997983eef5aSMeador Inge ;; 9985c53015aSPaolo Bonzini --disable-libudev) libudev="disabled" 9995c53015aSPaolo Bonzini ;; 10005c53015aSPaolo Bonzini --enable-libudev) libudev="enabled" 10015c53015aSPaolo Bonzini ;; 10026ec0e15dSPaolo Bonzini --disable-mpath) mpath="disabled" 1003fe8fc5aeSPaolo Bonzini ;; 10046ec0e15dSPaolo Bonzini --enable-mpath) mpath="enabled" 1005fe8fc5aeSPaolo Bonzini ;; 1006a0b93237SPaolo Bonzini --disable-vnc) vnc="disabled" 1007821601eaSJes Sorensen ;; 1008a0b93237SPaolo Bonzini --enable-vnc) vnc="enabled" 1009821601eaSJes Sorensen ;; 1010e8f3bd71SMarc-André Lureau --disable-gettext) gettext="false" 1011e8f3bd71SMarc-André Lureau ;; 1012e8f3bd71SMarc-André Lureau --enable-gettext) gettext="true" 1013e8f3bd71SMarc-André Lureau ;; 10142f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 10152f6a1ab0Sblueswir1 ;; 10160c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 10170c58ac1cSmalc ;; 101889138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1019b64ec4e4SFam Zheng ;; 102089138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1021eb852011SMarkus Armbruster ;; 1022f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 1023f8393946Saurel32 ;; 1024f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 1025f8393946Saurel32 ;; 1026f3d08ee6SPaul Brook --enable-debug) 1027f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 1028f3d08ee6SPaul Brook debug_tcg="yes" 10291fcc6d42SPeter Xu debug_mutex="yes" 1030f3d08ee6SPaul Brook debug="yes" 1031f3d08ee6SPaul Brook strip_opt="no" 1032b553a042SJohn Snow fortify_source="no" 1033f3d08ee6SPaul Brook ;; 1034247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1035247724cbSMarc-André Lureau ;; 1036247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1037247724cbSMarc-André Lureau ;; 10380aebab04SLingfeng Yang --enable-tsan) tsan="yes" 10390aebab04SLingfeng Yang ;; 10400aebab04SLingfeng Yang --disable-tsan) tsan="no" 10410aebab04SLingfeng Yang ;; 1042deb62371SPaolo Bonzini --enable-sparse) sparse="enabled" 104303b4fe7dSaliguori ;; 1044deb62371SPaolo Bonzini --disable-sparse) sparse="disabled" 104503b4fe7dSaliguori ;; 10461625af87Saliguori --disable-strip) strip_opt="no" 10471625af87Saliguori ;; 1048a0b93237SPaolo Bonzini --disable-vnc-sasl) vnc_sasl="disabled" 10492f9606b3Saliguori ;; 1050a0b93237SPaolo Bonzini --enable-vnc-sasl) vnc_sasl="enabled" 1051ea784e3bSJuan Quintela ;; 1052a0b93237SPaolo Bonzini --disable-vnc-jpeg) vnc_jpeg="disabled" 10532f6f5c7aSCorentin Chary ;; 1054a0b93237SPaolo Bonzini --enable-vnc-jpeg) vnc_jpeg="enabled" 10552f6f5c7aSCorentin Chary ;; 1056a0b93237SPaolo Bonzini --disable-vnc-png) vnc_png="disabled" 1057efe556adSCorentin Chary ;; 1058a0b93237SPaolo Bonzini --enable-vnc-png) vnc_png="enabled" 1059efe556adSCorentin Chary ;; 10604d34a86bSPaolo Bonzini --disable-slirp) slirp="disabled" 1061c20709aaSbellard ;; 10624d34a86bSPaolo Bonzini --enable-slirp=git) slirp="internal" 10637c57bdd8SMarc-André Lureau ;; 1064675b9b53SMarc-André Lureau --enable-slirp=system) slirp="system" 1065675b9b53SMarc-André Lureau ;; 1066e0e6c8c0Saliguori --disable-vde) vde="no" 10678a16d273Sths ;; 1068dfb278bdSJuan Quintela --enable-vde) vde="yes" 1069dfb278bdSJuan Quintela ;; 107058952137SVincenzo Maffione --disable-netmap) netmap="no" 107158952137SVincenzo Maffione ;; 107258952137SVincenzo Maffione --enable-netmap) netmap="yes" 107358952137SVincenzo Maffione ;; 10741badb709SPaolo Bonzini --disable-xen) xen="disabled" 1075e37630caSaliguori ;; 10761badb709SPaolo Bonzini --enable-xen) xen="enabled" 1077fc321b4bSJuan Quintela ;; 10781badb709SPaolo Bonzini --disable-xen-pci-passthrough) xen_pci_passthrough="disabled" 1079eb6fda0fSAnthony PERARD ;; 10801badb709SPaolo Bonzini --enable-xen-pci-passthrough) xen_pci_passthrough="enabled" 1081eb6fda0fSAnthony PERARD ;; 10822e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 10832e4d9fb1Saurel32 ;; 10844ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 10854ffcedb6SJuan Quintela ;; 10861badb709SPaolo Bonzini --disable-kvm) kvm="disabled" 10877ba1e619Saliguori ;; 10881badb709SPaolo Bonzini --enable-kvm) kvm="enabled" 1089b31a0277SJuan Quintela ;; 10901badb709SPaolo Bonzini --disable-hax) hax="disabled" 1091180fb750Szhanghailiang ;; 10921badb709SPaolo Bonzini --enable-hax) hax="enabled" 1093180fb750Szhanghailiang ;; 10941badb709SPaolo Bonzini --disable-hvf) hvf="disabled" 1095c97d6d2cSSergio Andres Gomez Del Real ;; 10961badb709SPaolo Bonzini --enable-hvf) hvf="enabled" 1097c97d6d2cSSergio Andres Gomez Del Real ;; 10981badb709SPaolo Bonzini --disable-whpx) whpx="disabled" 1099d661d9a4SJustin Terry (VM) ;; 11001badb709SPaolo Bonzini --enable-whpx) whpx="enabled" 1101d661d9a4SJustin Terry (VM) ;; 11029195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 11039195b2c2SStefan Weil ;; 11049195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 11059195b2c2SStefan Weil ;; 110647e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 110747e98658SCorey Bryant ;; 110847e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 110947e98658SCorey Bryant ;; 11101badb709SPaolo Bonzini --disable-tcg) tcg="disabled" 1111b3f6ea7eSPaolo Bonzini ;; 11121badb709SPaolo Bonzini --enable-tcg) tcg="enabled" 1113b3f6ea7eSPaolo Bonzini ;; 1114aa087962SPaolo Bonzini --disable-malloc-trim) malloc_trim="disabled" 11155a22ab71SYang Zhong ;; 1116aa087962SPaolo Bonzini --enable-malloc-trim) malloc_trim="enabled" 11175a22ab71SYang Zhong ;; 1118cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1119cd4ec0b4SGerd Hoffmann ;; 1120cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 1121cd4ec0b4SGerd Hoffmann ;; 1122c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 1123c589b249SRonnie Sahlberg ;; 1124c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 1125c589b249SRonnie Sahlberg ;; 11266542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 11276542aa9cSPeter Lieven ;; 11286542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 11296542aa9cSPeter Lieven ;; 113005c2a3e7Sbellard --enable-profiler) profiler="yes" 113105c2a3e7Sbellard ;; 1132b4e312e9SPaolo Bonzini --disable-cocoa) cocoa="disabled" 113314821030SPavel Borzenkov ;; 1134c2de5c91Smalc --enable-cocoa) 1135b4e312e9SPaolo Bonzini cocoa="enabled" ; 113689138857SStefan Weil audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 11375b0753e0Sbellard ;; 1138cad25d69Spbrook --disable-system) softmmu="no" 11390a8e90f4Spbrook ;; 1140cad25d69Spbrook --enable-system) softmmu="yes" 11410a8e90f4Spbrook ;; 11420953a80fSZachary Amsden --disable-user) 11430953a80fSZachary Amsden linux_user="no" ; 11440953a80fSZachary Amsden bsd_user="no" ; 11450953a80fSZachary Amsden ;; 11460953a80fSZachary Amsden --enable-user) ;; 1147831b7825Sths --disable-linux-user) linux_user="no" 11480a8e90f4Spbrook ;; 1149831b7825Sths --enable-linux-user) linux_user="yes" 1150831b7825Sths ;; 115184778508Sblueswir1 --disable-bsd-user) bsd_user="no" 115284778508Sblueswir1 ;; 115384778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 115484778508Sblueswir1 ;; 115540d6444eSAvi Kivity --enable-pie) pie="yes" 115634005a00SKirill A. Shutemov ;; 115740d6444eSAvi Kivity --disable-pie) pie="no" 115834005a00SKirill A. Shutemov ;; 115985aa5189Sbellard --enable-werror) werror="yes" 116085aa5189Sbellard ;; 116185aa5189Sbellard --disable-werror) werror="no" 116285aa5189Sbellard ;; 116363678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 116463678e17SSteven Noonan ;; 116563678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 116663678e17SSteven Noonan ;; 11671e4f6065SDaniele Buono --enable-safe-stack) safe_stack="yes" 11681e4f6065SDaniele Buono ;; 11691e4f6065SDaniele Buono --disable-safe-stack) safe_stack="no" 11701e4f6065SDaniele Buono ;; 11715285e593SYonggang Luo --disable-curses) curses="disabled" 11724d3b6f6eSbalrog ;; 11735285e593SYonggang Luo --enable-curses) curses="enabled" 1174c584a6d0SJuan Quintela ;; 11755285e593SYonggang Luo --disable-iconv) iconv="disabled" 1176e08bb301SSamuel Thibault ;; 11775285e593SYonggang Luo --enable-iconv) iconv="enabled" 1178e08bb301SSamuel Thibault ;; 1179769ce76dSAlexander Graf --disable-curl) curl="no" 1180769ce76dSAlexander Graf ;; 1181788c8196SJuan Quintela --enable-curl) curl="yes" 1182788c8196SJuan Quintela ;; 1183fbb4121dSPaolo Bonzini --disable-fdt) fdt="disabled" 11842df87df7SJuan Quintela ;; 1185fbb4121dSPaolo Bonzini --enable-fdt) fdt="enabled" 1186fbb4121dSPaolo Bonzini ;; 1187fbb4121dSPaolo Bonzini --enable-fdt=git) fdt="internal" 1188fbb4121dSPaolo Bonzini ;; 1189fbb4121dSPaolo Bonzini --enable-fdt=system) fdt="system" 11902df87df7SJuan Quintela ;; 11915c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 11925c6c3a6cSChristoph Hellwig ;; 11935c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 11945c6c3a6cSChristoph Hellwig ;; 1195c10dd856SAarushi Mehta --disable-linux-io-uring) linux_io_uring="no" 1196c10dd856SAarushi Mehta ;; 1197c10dd856SAarushi Mehta --enable-linux-io-uring) linux_io_uring="yes" 1198c10dd856SAarushi Mehta ;; 1199758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 1200758e8e38SVenkateswararao Jujjuri (JV) ;; 1201758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 1202758e8e38SVenkateswararao Jujjuri (JV) ;; 1203a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1204a40161cbSPaolo Bonzini ;; 1205a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1206a40161cbSPaolo Bonzini ;; 1207*c8d5450bSPaolo Bonzini --disable-blobs) blobs="false" 120877755340Sths ;; 12097e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 12104a19f1ecSpbrook ;; 1211519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1212519175a2SAlex Barcelo ;; 121370c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 121470c60c08SStefan Hajnoczi ;; 121570c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 121670c60c08SStefan Hajnoczi ;; 12177d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 12187d992e4dSPeter Lieven ;; 1219f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1220f0d92b56SLongpeng(Mike) ;; 1221f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1222f0d92b56SLongpeng(Mike) ;; 1223e3667660SYonggang Luo --disable-docs) docs="disabled" 122470ec5dc0SAnthony Liguori ;; 1225e3667660SYonggang Luo --enable-docs) docs="enabled" 122683a3ab8bSJuan Quintela ;; 1227d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1228d5970055SMichael S. Tsirkin ;; 1229d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1230d5970055SMichael S. Tsirkin ;; 1231042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1232042cea27SGonglei ;; 1233299e6f19SPaolo Bonzini --enable-vhost-crypto) vhost_crypto="yes" 1234042cea27SGonglei ;; 12355e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 12365e9be92dSNicholas Bellinger ;; 12375e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 12385e9be92dSNicholas Bellinger ;; 1239fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1240fc0b9b0eSStefan Hajnoczi ;; 1241fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1242fc0b9b0eSStefan Hajnoczi ;; 124398fc1adaSDr. David Alan Gilbert --disable-vhost-user-fs) vhost_user_fs="no" 124498fc1adaSDr. David Alan Gilbert ;; 124598fc1adaSDr. David Alan Gilbert --enable-vhost-user-fs) vhost_user_fs="yes" 124698fc1adaSDr. David Alan Gilbert ;; 1247da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 124820ff075bSMichael Walle ;; 1249da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 125020ff075bSMichael Walle ;; 1251f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1252f27aaf4bSChristian Brunner ;; 1253f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1254f27aaf4bSChristian Brunner ;; 12558c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 12568c84cf11SSergei Trofimovich ;; 12578c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 12588c84cf11SSergei Trofimovich ;; 12597b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1260111a38b0SRobert Relyea ;; 12617b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1262111a38b0SRobert Relyea ;; 12630a40bcb7SCésar Belley --disable-u2f) u2f="disabled" 12640a40bcb7SCésar Belley ;; 12650a40bcb7SCésar Belley --enable-u2f) u2f="enabled" 12660a40bcb7SCésar Belley ;; 12672b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 12682b2325ffSGerd Hoffmann ;; 12692b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 12702b2325ffSGerd Hoffmann ;; 127169354a83SHans de Goede --disable-usb-redir) usb_redir="no" 127269354a83SHans de Goede ;; 127369354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 127469354a83SHans de Goede ;; 12751ffb3bbbSPaolo Bonzini --disable-zlib-test) 12761ece9905SAlon Levy ;; 1277b25c9dffSStefan Weil --disable-lzo) lzo="no" 1278b25c9dffSStefan Weil ;; 1279607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1280607dacd0Sqiaonuohan ;; 1281b25c9dffSStefan Weil --disable-snappy) snappy="no" 1282b25c9dffSStefan Weil ;; 1283607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1284607dacd0Sqiaonuohan ;; 12856b383c08SPeter Wu --disable-bzip2) bzip2="no" 12866b383c08SPeter Wu ;; 12876b383c08SPeter Wu --enable-bzip2) bzip2="yes" 12886b383c08SPeter Wu ;; 128983bc1f97SJulio Faracco --enable-lzfse) lzfse="yes" 129083bc1f97SJulio Faracco ;; 129183bc1f97SJulio Faracco --disable-lzfse) lzfse="no" 129283bc1f97SJulio Faracco ;; 12933a678481SJuan Quintela --disable-zstd) zstd="no" 12943a678481SJuan Quintela ;; 12953a678481SJuan Quintela --enable-zstd) zstd="yes" 12963a678481SJuan Quintela ;; 1297d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1298d138cee9SMichael Roth ;; 1299d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1300d138cee9SMichael Roth ;; 13019dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 13029dacf32dSYossi Hindin ;; 13039dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 13049dacf32dSYossi Hindin ;; 1305d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1306d9840e25STomoki Sekiyama ;; 1307d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1308d9840e25STomoki Sekiyama ;; 1309d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1310d9840e25STomoki Sekiyama ;; 1311d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1312d9840e25STomoki Sekiyama ;; 1313d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1314d9840e25STomoki Sekiyama ;; 1315d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1316d9840e25STomoki Sekiyama ;; 13174b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 13184b1c11fdSDaniel P. Berrange ;; 13194b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 13204b1c11fdSDaniel P. Berrange ;; 1321f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1322f794573eSEduardo Otubo ;; 1323f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1324f794573eSEduardo Otubo ;; 1325eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1326eb100396SBharata B Rao ;; 132786583a07SLiam Merwick --disable-avx2) avx2_opt="no" 132886583a07SLiam Merwick ;; 132986583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 133086583a07SLiam Merwick ;; 13316b8cd447SRobert Hoo --disable-avx512f) avx512f_opt="no" 13326b8cd447SRobert Hoo ;; 13336b8cd447SRobert Hoo --enable-avx512f) avx512f_opt="yes" 13346b8cd447SRobert Hoo ;; 13356b8cd447SRobert Hoo 1336eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1337eb100396SBharata B Rao ;; 133852b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 133952b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1340583f6e7bSStefan Hajnoczi ;; 1341cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1342cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1343cb6414dfSFam Zheng ;; 1344315d3184SFam Zheng --enable-uuid|--disable-uuid) 1345315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1346315d3184SFam Zheng ;; 1347a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1348a4ccabcfSAnthony Liguori ;; 1349a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1350a4ccabcfSAnthony Liguori ;; 1351a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1352a1c5e949SDaniel P. Berrange ;; 1353ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1354ddbb0d09SDaniel P. Berrange ;; 1355ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1356ddbb0d09SDaniel P. Berrange ;; 135791bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 135891bfcdb0SDaniel P. Berrange ;; 135991bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 136091bfcdb0SDaniel P. Berrange ;; 136191bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 136291bfcdb0SDaniel P. Berrange ;; 136391bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 136491bfcdb0SDaniel P. Berrange ;; 13658953caf3SDaniel P. Berrange --disable-auth-pam) auth_pam="no" 13668953caf3SDaniel P. Berrange ;; 13678953caf3SDaniel P. Berrange --enable-auth-pam) auth_pam="yes" 13688953caf3SDaniel P. Berrange ;; 13692da776dbSMichael R. Hines --enable-rdma) rdma="yes" 13702da776dbSMichael R. Hines ;; 13712da776dbSMichael R. Hines --disable-rdma) rdma="no" 13722da776dbSMichael R. Hines ;; 137321ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 137421ab34c9SMarcel Apfelbaum ;; 137521ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 137621ab34c9SMarcel Apfelbaum ;; 1377bbbf9bfbSStefan Weil --disable-vte) vte="no" 1378bbbf9bfbSStefan Weil ;; 1379bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1380bbbf9bfbSStefan Weil ;; 13819d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 13829d9e1521SGerd Hoffmann ;; 13839d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 13849d9e1521SGerd Hoffmann ;; 1385e91c793cSCole Robinson --disable-tpm) tpm="no" 1386e91c793cSCole Robinson ;; 1387ab214c29SStefan Berger --enable-tpm) tpm="yes" 1388ab214c29SStefan Berger ;; 1389b10d49d7SPino Toscano --disable-libssh) libssh="no" 13900a12ec87SRichard W.M. Jones ;; 1391b10d49d7SPino Toscano --enable-libssh) libssh="yes" 13920a12ec87SRichard W.M. Jones ;; 1393ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1394ed1701c6SDr. David Alan Gilbert ;; 1395ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1396ed1701c6SDr. David Alan Gilbert ;; 1397a99d57bbSWanlong Gao --disable-numa) numa="no" 1398a99d57bbSWanlong Gao ;; 1399a99d57bbSWanlong Gao --enable-numa) numa="yes" 1400a99d57bbSWanlong Gao ;; 1401ed279a06SKlim Kireev --disable-libxml2) libxml2="no" 1402ed279a06SKlim Kireev ;; 1403ed279a06SKlim Kireev --enable-libxml2) libxml2="yes" 1404ed279a06SKlim Kireev ;; 14052847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 14062847b469SFam Zheng ;; 14072847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 14082847b469SFam Zheng ;; 14097b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 14107b01cb97SAlexandre Derumier ;; 14117b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 14127b01cb97SAlexandre Derumier ;; 1413a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1414a6b1d4c0SChanglong Xie ;; 1415a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1416a6b1d4c0SChanglong Xie ;; 14172f740136SJeff Cody --disable-bochs) bochs="no" 14182f740136SJeff Cody ;; 14192f740136SJeff Cody --enable-bochs) bochs="yes" 14202f740136SJeff Cody ;; 14212f740136SJeff Cody --disable-cloop) cloop="no" 14222f740136SJeff Cody ;; 14232f740136SJeff Cody --enable-cloop) cloop="yes" 14242f740136SJeff Cody ;; 14252f740136SJeff Cody --disable-dmg) dmg="no" 14262f740136SJeff Cody ;; 14272f740136SJeff Cody --enable-dmg) dmg="yes" 14282f740136SJeff Cody ;; 14292f740136SJeff Cody --disable-qcow1) qcow1="no" 14302f740136SJeff Cody ;; 14312f740136SJeff Cody --enable-qcow1) qcow1="yes" 14322f740136SJeff Cody ;; 14332f740136SJeff Cody --disable-vdi) vdi="no" 14342f740136SJeff Cody ;; 14352f740136SJeff Cody --enable-vdi) vdi="yes" 14362f740136SJeff Cody ;; 14372f740136SJeff Cody --disable-vvfat) vvfat="no" 14382f740136SJeff Cody ;; 14392f740136SJeff Cody --enable-vvfat) vvfat="yes" 14402f740136SJeff Cody ;; 14412f740136SJeff Cody --disable-qed) qed="no" 14422f740136SJeff Cody ;; 14432f740136SJeff Cody --enable-qed) qed="yes" 14442f740136SJeff Cody ;; 14452f740136SJeff Cody --disable-parallels) parallels="no" 14462f740136SJeff Cody ;; 14472f740136SJeff Cody --enable-parallels) parallels="yes" 14482f740136SJeff Cody ;; 14492f740136SJeff Cody --disable-sheepdog) sheepdog="no" 14502f740136SJeff Cody ;; 14512f740136SJeff Cody --enable-sheepdog) sheepdog="yes" 14522f740136SJeff Cody ;; 1453e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1454e6a74868SMarc-André Lureau ;; 1455299e6f19SPaolo Bonzini --enable-vhost-user) vhost_user="yes" 1456299e6f19SPaolo Bonzini ;; 1457108a6481SCindy Lu --disable-vhost-vdpa) vhost_vdpa="no" 1458108a6481SCindy Lu ;; 1459108a6481SCindy Lu --enable-vhost-vdpa) vhost_vdpa="yes" 1460108a6481SCindy Lu ;; 1461299e6f19SPaolo Bonzini --disable-vhost-kernel) vhost_kernel="no" 1462299e6f19SPaolo Bonzini ;; 1463299e6f19SPaolo Bonzini --enable-vhost-kernel) vhost_kernel="yes" 1464e6a74868SMarc-André Lureau ;; 14658b18cdbfSRichard Henderson --disable-capstone) capstone="disabled" 14668ca80760SRichard Henderson ;; 14678b18cdbfSRichard Henderson --enable-capstone) capstone="enabled" 14688ca80760SRichard Henderson ;; 14698b18cdbfSRichard Henderson --enable-capstone=git) capstone="internal" 1470e219c499SRichard Henderson ;; 1471e219c499SRichard Henderson --enable-capstone=system) capstone="system" 1472e219c499SRichard Henderson ;; 1473cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1474cc84d63aSDaniel P. Berrange ;; 1475f62bbee5SDaniel P. Berrange --enable-git-update) git_update=yes 1476f62bbee5SDaniel P. Berrange ;; 1477f62bbee5SDaniel P. Berrange --disable-git-update) git_update=no 1478f62bbee5SDaniel P. Berrange ;; 1479ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1480ba59fb77SPaolo Bonzini ;; 1481ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1482ba59fb77SPaolo Bonzini ;; 148317824406SJunyan He --enable-libpmem) libpmem=yes 148417824406SJunyan He ;; 148517824406SJunyan He --disable-libpmem) libpmem=no 148617824406SJunyan He ;; 14874113f4cfSLaurent Vivier --enable-xkbcommon) xkbcommon="enabled" 148875411919SJames Le Cuirot ;; 14894113f4cfSLaurent Vivier --disable-xkbcommon) xkbcommon="disabled" 149075411919SJames Le Cuirot ;; 149140e8c6f4SAlex Bennée --enable-plugins) plugins="yes" 149240e8c6f4SAlex Bennée ;; 149340e8c6f4SAlex Bennée --disable-plugins) plugins="no" 149440e8c6f4SAlex Bennée ;; 1495afc3a8f9SAlex Bennée --enable-containers) use_containers="yes" 1496afc3a8f9SAlex Bennée ;; 1497afc3a8f9SAlex Bennée --disable-containers) use_containers="no" 1498afc3a8f9SAlex Bennée ;; 1499adc28027SAlexander Bulekov --enable-fuzzing) fuzzing=yes 1500adc28027SAlexander Bulekov ;; 1501adc28027SAlexander Bulekov --disable-fuzzing) fuzzing=no 1502adc28027SAlexander Bulekov ;; 1503f48e590aSAlex Bennée --gdb=*) gdb_bin="$optarg" 1504f48e590aSAlex Bennée ;; 1505b767d257SMarek Marczykowski-Górecki --enable-rng-none) rng_none=yes 1506b767d257SMarek Marczykowski-Górecki ;; 1507b767d257SMarek Marczykowski-Górecki --disable-rng-none) rng_none=no 1508b767d257SMarek Marczykowski-Górecki ;; 150954e7aac0SAlexey Krasikov --enable-keyring) secret_keyring="yes" 151054e7aac0SAlexey Krasikov ;; 151154e7aac0SAlexey Krasikov --disable-keyring) secret_keyring="no" 151254e7aac0SAlexey Krasikov ;; 151321b2eca6SJingqi Liu --enable-libdaxctl) libdaxctl=yes 151421b2eca6SJingqi Liu ;; 151521b2eca6SJingqi Liu --disable-libdaxctl) libdaxctl=no 151621b2eca6SJingqi Liu ;; 15172d2ad6d0SFam Zheng *) 15182d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 15192d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 15202d2ad6d0SFam Zheng exit 1 15217f1559c6Sbalrog ;; 15227d13299dSbellard esac 15237d13299dSbellarddone 15247d13299dSbellard 152522a87800SMarc-André Lureaulibdir="${libdir:-$prefix/lib}" 152622a87800SMarc-André Lureaulibexecdir="${libexecdir:-$prefix/libexec}" 152722a87800SMarc-André Lureauincludedir="${includedir:-$prefix/include}" 152822a87800SMarc-André Lureau 152922a87800SMarc-André Lureauif test "$mingw32" = "yes" ; then 153022a87800SMarc-André Lureau mandir="$prefix" 153122a87800SMarc-André Lureau datadir="$prefix" 1532ca8c0909SMarc-André Lureau docdir="$prefix" 153322a87800SMarc-André Lureau bindir="$prefix" 153422a87800SMarc-André Lureau sysconfdir="$prefix" 153516bf7a33SPaolo Bonzini local_statedir="$prefix" 153622a87800SMarc-André Lureauelse 153722a87800SMarc-André Lureau mandir="${mandir:-$prefix/share/man}" 153822a87800SMarc-André Lureau datadir="${datadir:-$prefix/share}" 1539ca8c0909SMarc-André Lureau docdir="${docdir:-$prefix/share/doc}" 154022a87800SMarc-André Lureau bindir="${bindir:-$prefix/bin}" 154122a87800SMarc-André Lureau sysconfdir="${sysconfdir:-$prefix/etc}" 154222a87800SMarc-André Lureau local_statedir="${local_statedir:-$prefix/var}" 154322a87800SMarc-André Lureaufi 154416bf7a33SPaolo Bonzinifirmwarepath="${firmwarepath:-$datadir/qemu-firmware}" 154516bf7a33SPaolo Bonzinilocaledir="${localedir:-$datadir/locale}" 154622a87800SMarc-André Lureau 154740293e58Sbellardcase "$cpu" in 1548e3608d66SRichard Henderson ppc) 1549e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1550db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1551e3608d66SRichard Henderson ;; 1552e3608d66SRichard Henderson ppc64) 1553e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1554db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1555e3608d66SRichard Henderson ;; 15569b9c37c3SRichard Henderson sparc) 1557f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1558db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 15593142255cSblueswir1 ;; 1560ed968ff1SJuan Quintela sparc64) 156179f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1562db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 15633142255cSblueswir1 ;; 156476d83bdeSths s390) 1565061cdd81SRichard Henderson CPU_CFLAGS="-m31" 1566db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 156728d7cc49SRichard Henderson ;; 156828d7cc49SRichard Henderson s390x) 1569061cdd81SRichard Henderson CPU_CFLAGS="-m64" 1570db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 157176d83bdeSths ;; 157240293e58Sbellard i386) 157379f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 1574db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 157540293e58Sbellard ;; 157640293e58Sbellard x86_64) 15777ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 15787ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 15797ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 15807ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 1581db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1582379f6698SPaul Brook ;; 1583c72b26ecSRichard Henderson x32) 1584c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1585db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1586c72b26ecSRichard Henderson ;; 158730163d89SPeter Maydell # No special flags required for other host CPUs 15883142255cSblueswir1esac 15893142255cSblueswir1 15902038f8c8SPaolo Bonzinieval "cross_cc_${cpu}=\$host_cc" 15912038f8c8SPaolo Bonzinicross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 159279f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 159379f3b12fSPeter Crosthwaite 1594affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1595affc88ccSPeter Maydell# support, even if we're using TCI. 1596affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1597affc88ccSPeter Maydell bsd_user="no" 1598affc88ccSPeter Maydell linux_user="no" 1599affc88ccSPeter Maydellfi 1600affc88ccSPeter Maydell 160160e0df25SPeter Maydelldefault_target_list="" 1602fdb75aefSPaolo Bonzinideprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user,lm32-softmmu,unicore32-softmmu 1603fdb75aefSPaolo Bonzinideprecated_features="" 16046e92f823SPeter Maydellmak_wilds="" 16056e92f823SPeter Maydell 160660e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 160773362fc0SPaolo Bonzini mak_wilds="${mak_wilds} $source_path/default-configs/targets/*-softmmu.mak" 160860e0df25SPeter Maydellfi 160960e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 161073362fc0SPaolo Bonzini mak_wilds="${mak_wilds} $source_path/default-configs/targets/*-linux-user.mak" 161160e0df25SPeter Maydellfi 161260e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 161373362fc0SPaolo Bonzini mak_wilds="${mak_wilds} $source_path/default-configs/targets/*-bsd-user.mak" 161460e0df25SPeter Maydellfi 161560e0df25SPeter Maydell 16163a5ae4a9SAlex Bennée# If the user doesn't explicitly specify a deprecated target we will 16173a5ae4a9SAlex Bennée# skip it. 16183a5ae4a9SAlex Bennéeif test -z "$target_list"; then 16193a5ae4a9SAlex Bennée if test -z "$target_list_exclude"; then 16203a5ae4a9SAlex Bennée target_list_exclude="$deprecated_targets_list" 16213a5ae4a9SAlex Bennée else 16223a5ae4a9SAlex Bennée target_list_exclude="$target_list_exclude,$deprecated_targets_list" 16233a5ae4a9SAlex Bennée fi 16242d838d9bSAlex Bennéefi 16252d838d9bSAlex Bennée 1626447e133fSAlex Bennéefor config in $mak_wilds; do 1627447e133fSAlex Bennée target="$(basename "$config" .mak)" 162898db9a06SAlex Bennée if echo "$target_list_exclude" | grep -vq "$target"; then 1629447e133fSAlex Bennée default_target_list="${default_target_list} $target" 1630447e133fSAlex Bennée fi 1631447e133fSAlex Bennéedone 16326e92f823SPeter Maydell 1633c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 163464a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1635c53eeaf7SStefan Hajnoczi 1636af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1637af5db58eSpbrookcat << EOF 1638af5db58eSpbrook 1639af5db58eSpbrookUsage: configure [options] 1640af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1641af5db58eSpbrook 164208fb77edSStefan WeilStandard options: 164308fb77edSStefan Weil --help print this message 164408fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 164508fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 164608fb77edSStefan Weil use %M for cpu name [$interp_prefix] 164708fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 164808fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 164908fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 1650447e133fSAlex Bennée --target-list-exclude=LIST exclude a set of targets from the default target-list 165108fb77edSStefan Weil 165208fb77edSStefan WeilAdvanced options (experts only): 165308fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 165408fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 165508fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 165608fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 165708fb77edSStefan Weil build time 165808fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 165908fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 166008fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 166111cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 166208fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1663d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1664d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 166508fb77edSStefan Weil --make=MAKE use specified make [$make] 166608fb77edSStefan Weil --python=PYTHON use specified python [$python] 16672eb054c2SPeter Maydell --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1668a5665051SPaolo Bonzini --meson=MESON use specified meson [$meson] 166948328880SPaolo Bonzini --ninja=NINJA use specified ninja [$ninja] 167008fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1671db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 167208fb77edSStefan Weil --static enable static build [$static] 167308fb77edSStefan Weil --mandir=PATH install man pages in PATH 167410ff82d1SMarc-André Lureau --datadir=PATH install firmware in PATH/$qemu_suffix 1675fe0038beSPaolo Bonzini --localedir=PATH install translation in PATH/$qemu_suffix 167610ff82d1SMarc-André Lureau --docdir=PATH install documentation in PATH/$qemu_suffix 167708fb77edSStefan Weil --bindir=PATH install binaries in PATH 167808fb77edSStefan Weil --libdir=PATH install libraries in PATH 1679db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 168010ff82d1SMarc-André Lureau --sysconfdir=PATH install config in PATH/$qemu_suffix 168108fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 16823d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 168313336606SRobert Foley --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1684ca8c0909SMarc-André Lureau --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1685db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 168608fb77edSStefan Weil --enable-debug enable common debug build options 1687247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 16880aebab04SLingfeng Yang --enable-tsan enable thread sanitizer 168908fb77edSStefan Weil --disable-strip disable stripping binaries 169008fb77edSStefan Weil --disable-werror disable compilation abort on warning 169163678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 169208fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 169308fb77edSStefan Weil Available drivers: $audio_possible_drivers 169408fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 169508fb77edSStefan Weil --block-drv-rw-whitelist=L 169608fb77edSStefan Weil set block driver read-write whitelist 169708fb77edSStefan Weil (affects only QEMU, not qemu-img) 169808fb77edSStefan Weil --block-drv-ro-whitelist=L 169908fb77edSStefan Weil set block driver read-only whitelist 170008fb77edSStefan Weil (affects only QEMU, not qemu-img) 17015b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1702c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 170308fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 170408fb77edSStefan Weil Default:trace-<pid> 1705c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1706c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 17075a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1708c23f23b9SMichael Tokarev --oss-lib path to OSS library 1709c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 171008fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 171133c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 171208fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 1713c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1714c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1715c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1716a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1717c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1718c12d66aaSLin Ma --enable-profiler profiler support 1719c12d66aaSLin Ma --enable-debug-stack-usage 1720c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 172140e8c6f4SAlex Bennée --enable-plugins 172240e8c6f4SAlex Bennée enable plugins via shared library loading 1723afc3a8f9SAlex Bennée --disable-containers don't use containers for cross-building 1724f48e590aSAlex Bennée --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1725c23f23b9SMichael Tokarev 1726c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1727c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1728c23f23b9SMichael Tokarev 1729c23f23b9SMichael Tokarev system all system emulation targets 1730c23f23b9SMichael Tokarev user supported user emulation targets 1731c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1732c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1733c23f23b9SMichael Tokarev docs build documentation 1734c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1735c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1736c23f23b9SMichael Tokarev pie Position Independent Executables 173721e709aaSMarc-André Lureau modules modules support (non-Windows) 1738bd83c861SChristian Ehrhardt module-upgrades try to load modules from alternate paths for upgrades 1739c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1740c23f23b9SMichael Tokarev debug-info debugging information 1741c23f23b9SMichael Tokarev sparse sparse checker 17421e4f6065SDaniele Buono safe-stack SafeStack Stack Smash Protection. Depends on 17431e4f6065SDaniele Buono clang/llvm >= 3.7 and requires coroutine backend ucontext. 1744c23f23b9SMichael Tokarev 1745ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 174691bfcdb0SDaniel P. Berrange nettle nettle cryptography support 174791bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 17488953caf3SDaniel P. Berrange auth-pam PAM access control 1749c23f23b9SMichael Tokarev sdl SDL UI 175004c6e16fSMarkus Armbruster sdl-image SDL Image support for icons 1751c23f23b9SMichael Tokarev gtk gtk UI 1752c23f23b9SMichael Tokarev vte vte support for the gtk UI 1753c23f23b9SMichael Tokarev curses curses UI 1754e08bb301SSamuel Thibault iconv font glyph conversion support 1755c23f23b9SMichael Tokarev vnc VNC UI support 1756c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1757c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1758c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1759c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1760c23f23b9SMichael Tokarev virtfs VirtFS 17615c53015aSPaolo Bonzini libudev Use libudev to enumerate host devices 1762fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1763c23f23b9SMichael Tokarev xen xen backend driver support 176470c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1765c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1766c23f23b9SMichael Tokarev curl curl connectivity 1767a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1768c23f23b9SMichael Tokarev fdt fdt device tree 1769c23f23b9SMichael Tokarev kvm KVM acceleration support 1770b0cb0a66SVincent Palatin hax HAX acceleration support 1771c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 1772d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 177321ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 177421ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1775c23f23b9SMichael Tokarev vde support for vde network 1776c23f23b9SMichael Tokarev netmap support for netmap network 1777c23f23b9SMichael Tokarev linux-aio Linux AIO support 1778c10dd856SAarushi Mehta linux-io-uring Linux io_uring support 1779c23f23b9SMichael Tokarev cap-ng libcap-ng support 1780c23f23b9SMichael Tokarev attr attr and xattr support 1781299e6f19SPaolo Bonzini vhost-net vhost-net kernel acceleration support 1782299e6f19SPaolo Bonzini vhost-vsock virtio sockets device support 1783299e6f19SPaolo Bonzini vhost-scsi vhost-scsi kernel target support 1784299e6f19SPaolo Bonzini vhost-crypto vhost-user-crypto backend support 1785299e6f19SPaolo Bonzini vhost-kernel vhost kernel backend support 1786299e6f19SPaolo Bonzini vhost-user vhost-user backend support 1787108a6481SCindy Lu vhost-vdpa vhost-vdpa kernel backend support 1788c23f23b9SMichael Tokarev spice spice 1789c23f23b9SMichael Tokarev rbd rados block device (rbd) 1790c23f23b9SMichael Tokarev libiscsi iscsi support 1791c23f23b9SMichael Tokarev libnfs nfs support 17927b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 17930a40bcb7SCésar Belley u2f U2F support (u2f-emu) 1794c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1795ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1796c23f23b9SMichael Tokarev usb-redir usb network redirection support 1797c23f23b9SMichael Tokarev lzo support of lzo compression library 1798c23f23b9SMichael Tokarev snappy support of snappy compression library 1799c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1800c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 180183bc1f97SJulio Faracco lzfse support of lzfse compression library 180283bc1f97SJulio Faracco (for reading lzfse-compressed dmg images) 18033a678481SJuan Quintela zstd support for zstd compression library 1804d298ac10SDenis Plotnikov (for migration compression and qcow2 cluster compression) 1805c23f23b9SMichael Tokarev seccomp seccomp support 1806c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1807c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1808c23f23b9SMichael Tokarev tpm TPM support 1809b10d49d7SPino Toscano libssh ssh block device support 1810c23f23b9SMichael Tokarev numa libnuma support 1811ed279a06SKlim Kireev libxml2 for Parallels image format 1812c23f23b9SMichael Tokarev tcmalloc tcmalloc support 18137b01cb97SAlexandre Derumier jemalloc jemalloc support 181486583a07SLiam Merwick avx2 AVX2 optimization support 18156b8cd447SRobert Hoo avx512f AVX512F optimization support 1816a6b1d4c0SChanglong Xie replication replication support 1817c12d66aaSLin Ma opengl opengl support 1818c12d66aaSLin Ma virglrenderer virgl rendering support 1819c12d66aaSLin Ma xfsctl xfsctl support 1820c12d66aaSLin Ma qom-cast-debug cast debugging support 18218de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 18222f740136SJeff Cody bochs bochs image format support 18232f740136SJeff Cody cloop cloop image format support 18242f740136SJeff Cody dmg dmg image format support 18252f740136SJeff Cody qcow1 qcow v1 image format support 18262f740136SJeff Cody vdi vdi image format support 18272f740136SJeff Cody vvfat vvfat image format support 18282f740136SJeff Cody qed qed image format support 18292f740136SJeff Cody parallels parallels image format support 1830e1c42697SDaniel P. Berrangé sheepdog sheepdog block driver support (deprecated) 1831f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 18328ca80760SRichard Henderson capstone capstone disassembler support 1833ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 183417824406SJunyan He libpmem libpmem support 183575411919SJames Le Cuirot xkbcommon xkbcommon support 1836b767d257SMarek Marczykowski-Górecki rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 183721b2eca6SJingqi Liu libdaxctl libdaxctl support 183808fb77edSStefan Weil 183908fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1840af5db58eSpbrookEOF 18412d2ad6d0SFam Zhengexit 0 1842af5db58eSpbrookfi 1843af5db58eSpbrook 18449c790242SThomas Huth# Remove old dependency files to make sure that they get properly regenerated 1845bb768f71SThomas Huthrm -f */config-devices.mak.d 18469c790242SThomas Huth 1847faf44142SDaniel P. Berrangéif test -z "$python" 1848faf44142SDaniel P. Berrangéthen 1849c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1850c53eeaf7SStefan Hajnoczifi 1851c53eeaf7SStefan Hajnoczi 1852c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1853c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 18541b11f28dSThomas Huthif ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then 18551b11f28dSThomas Huth error_exit "Cannot use '$python', Python >= 3.6 is required." \ 1856c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1857c53eeaf7SStefan Hajnoczifi 1858c53eeaf7SStefan Hajnoczi 1859755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 1860406ab2f3SCleber 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) 1861755ee70fSCleber Rosa 1862c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1863c53eeaf7SStefan Hajnoczipython="$python -B" 1864c53eeaf7SStefan Hajnoczi 18650a01d76fSMarc-André Lureauif test -z "$meson"; then 18666ebd89cfSPaolo Bonzini if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.3; then 18670a01d76fSMarc-André Lureau meson=meson 18680a01d76fSMarc-André Lureau elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 18690a01d76fSMarc-André Lureau meson=git 18700a01d76fSMarc-André Lureau elif test -e "${source_path}/meson/meson.py" ; then 18710a01d76fSMarc-André Lureau meson=internal 18720a01d76fSMarc-André Lureau else 18730a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 18740a01d76fSMarc-André Lureau error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 18750a01d76fSMarc-André Lureau else 1876a5665051SPaolo Bonzini error_exit "Meson not found. Use --meson=/path/to/meson" 1877a5665051SPaolo Bonzini fi 18780a01d76fSMarc-André Lureau fi 18790a01d76fSMarc-André Lureauelse 18800a01d76fSMarc-André Lureau # Meson uses its own Python interpreter to invoke other Python scripts, 18810a01d76fSMarc-André Lureau # but the user wants to use the one they specified with --python. 18820a01d76fSMarc-André Lureau # 18830a01d76fSMarc-André Lureau # We do not want to override the distro Python interpreter (and sometimes 18840a01d76fSMarc-André Lureau # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 18850a01d76fSMarc-André Lureau # just require --meson=git|internal together with --python. 18860a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 18870a01d76fSMarc-André Lureau case "$meson" in 18880a01d76fSMarc-André Lureau git | internal) ;; 18890a01d76fSMarc-André Lureau *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 18900a01d76fSMarc-André Lureau esac 18910a01d76fSMarc-André Lureau fi 18920a01d76fSMarc-André Lureaufi 1893a5665051SPaolo Bonzini 18940a01d76fSMarc-André Lureauif test "$meson" = git; then 18950a01d76fSMarc-André Lureau git_submodules="${git_submodules} meson" 18960a01d76fSMarc-André Lureaufi 18970a01d76fSMarc-André Lureau 18980a01d76fSMarc-André Lureaucase "$meson" in 18990a01d76fSMarc-André Lureau git | internal) 1900a5665051SPaolo Bonzini if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then 1901a5665051SPaolo Bonzini error_exit "Python setuptools not found" 1902a5665051SPaolo Bonzini fi 19030a01d76fSMarc-André Lureau meson="$python ${source_path}/meson/meson.py" 19040a01d76fSMarc-André Lureau ;; 190584ec0c24SPaolo Bonzini *) meson=$(command -v "$meson") ;; 19060a01d76fSMarc-André Lureauesac 19070a01d76fSMarc-André Lureau 190809e93326SPaolo Bonzini# Probe for ninja 190948328880SPaolo Bonzini 191048328880SPaolo Bonziniif test -z "$ninja"; then 191148328880SPaolo Bonzini for c in ninja ninja-build samu; do 191248328880SPaolo Bonzini if has $c; then 191348328880SPaolo Bonzini ninja=$(command -v "$c") 191448328880SPaolo Bonzini break 191548328880SPaolo Bonzini fi 191648328880SPaolo Bonzini done 191709e93326SPaolo Bonzini if test -z "$ninja"; then 191809e93326SPaolo Bonzini error_exit "Cannot find Ninja" 191909e93326SPaolo Bonzini fi 192048328880SPaolo Bonzinifi 1921a5665051SPaolo Bonzini 19229aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 19239aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 19249aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 19259aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 19269aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 19279aae6e54SDaniel Henrique Barbozaif compile_object ; then 19289aae6e54SDaniel Henrique Barboza : C compiler works ok 19299aae6e54SDaniel Henrique Barbozaelse 19309aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 19319aae6e54SDaniel Henrique Barbozafi 19329aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 19339aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 19349aae6e54SDaniel Henrique Barbozafi 19359aae6e54SDaniel Henrique Barboza 19369c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 19379c83ffd8SPeter Maydell# by default. Only enable by default for git builds 19389c83ffd8SPeter Maydellif test -z "$werror" ; then 1939fd73745dSAlexey Kardashevskiy if test -e "$source_path/.git" && \ 1940e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 19419c83ffd8SPeter Maydell werror="yes" 19429c83ffd8SPeter Maydell else 19439c83ffd8SPeter Maydell werror="no" 19449c83ffd8SPeter Maydell fi 19459c83ffd8SPeter Maydellfi 19469c83ffd8SPeter Maydell 1947fb59dabdSPeter Maydellif test "$bogus_os" = "yes"; then 1948fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1949fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1950fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1951fb59dabdSPeter Maydell # host OS we should stop now. 1952951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1953fb59dabdSPeter Maydellfi 1954fb59dabdSPeter Maydell 1955efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 1956efc6c070SThomas Huthcat > $TMPC << EOF 1957efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 1958efc6c070SThomas Huth# ifdef __apple_build_version__ 1959efc6c070SThomas Huth# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) 1960efc6c070SThomas Huth# error You need at least XCode Clang v5.1 to compile QEMU 1961efc6c070SThomas Huth# endif 1962efc6c070SThomas Huth# else 1963efc6c070SThomas Huth# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) 1964efc6c070SThomas Huth# error You need at least Clang v3.4 to compile QEMU 1965efc6c070SThomas Huth# endif 1966efc6c070SThomas Huth# endif 1967efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 1968efc6c070SThomas Huth# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 1969efc6c070SThomas Huth# error You need at least GCC v4.8 to compile QEMU 1970efc6c070SThomas Huth# endif 1971efc6c070SThomas Huth#else 1972efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 1973efc6c070SThomas Huth#endif 1974efc6c070SThomas Huthint main (void) { return 0; } 1975efc6c070SThomas HuthEOF 1976efc6c070SThomas Huthif ! compile_prog "" "" ; then 1977efc6c070SThomas Huth error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" 1978efc6c070SThomas Huthfi 1979efc6c070SThomas Huth 198000849b92SRichard Henderson# Accumulate -Wfoo and -Wno-bar separately. 198100849b92SRichard Henderson# We will list all of the enable flags first, and the disable flags second. 198200849b92SRichard Henderson# Note that we do not add -Werror, because that would enable it for all 198300849b92SRichard Henderson# configure tests. If a configure test failed due to -Werror this would 198400849b92SRichard Henderson# just silently disable some features, so it's too error prone. 198500849b92SRichard Henderson 198600849b92SRichard Hendersonwarn_flags= 198700849b92SRichard Hendersonadd_to warn_flags -Wold-style-declaration 198800849b92SRichard Hendersonadd_to warn_flags -Wold-style-definition 198900849b92SRichard Hendersonadd_to warn_flags -Wtype-limits 199000849b92SRichard Hendersonadd_to warn_flags -Wformat-security 199100849b92SRichard Hendersonadd_to warn_flags -Wformat-y2k 199200849b92SRichard Hendersonadd_to warn_flags -Winit-self 199300849b92SRichard Hendersonadd_to warn_flags -Wignored-qualifiers 199400849b92SRichard Hendersonadd_to warn_flags -Wempty-body 199500849b92SRichard Hendersonadd_to warn_flags -Wnested-externs 199600849b92SRichard Hendersonadd_to warn_flags -Wendif-labels 199700849b92SRichard Hendersonadd_to warn_flags -Wexpansion-to-defined 199800849b92SRichard Henderson 199900849b92SRichard Hendersonnowarn_flags= 200000849b92SRichard Hendersonadd_to nowarn_flags -Wno-initializer-overrides 200100849b92SRichard Hendersonadd_to nowarn_flags -Wno-missing-include-dirs 200200849b92SRichard Hendersonadd_to nowarn_flags -Wno-shift-negative-value 200300849b92SRichard Hendersonadd_to nowarn_flags -Wno-string-plus-int 200400849b92SRichard Hendersonadd_to nowarn_flags -Wno-typedef-redefinition 2005aabab967SRichard Hendersonadd_to nowarn_flags -Wno-tautological-type-limit-compare 2006bac8d222SRichard Hendersonadd_to nowarn_flags -Wno-psabi 200700849b92SRichard Henderson 200800849b92SRichard Hendersongcc_flags="$warn_flags $nowarn_flags" 200993b25869SJohn Snow 201093b25869SJohn Snowcc_has_warning_flag() { 201193b25869SJohn Snow write_c_skeleton; 201293b25869SJohn Snow 2013a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 2014a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 2015a1d29d6cSPeter Maydell # warning options). 201693b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 201793b25869SJohn Snow compile_prog "-Werror $optflag" "" 201893b25869SJohn Snow} 201993b25869SJohn Snow 202093b25869SJohn Snowfor flag in $gcc_flags; do 202193b25869SJohn Snow if cc_has_warning_flag $flag ; then 20228d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 20238d05095cSPaolo Bonzini fi 20248d05095cSPaolo Bonzinidone 20258d05095cSPaolo Bonzini 202663678e17SSteven Noonanif test "$stack_protector" != "no"; then 2027fccd35a0SRodrigo Rebello cat > $TMPC << EOF 2028fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 2029fccd35a0SRodrigo Rebello{ 2030fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 2031fccd35a0SRodrigo Rebello while (*c) { 2032fccd35a0SRodrigo Rebello *p++ = *c++; 2033fccd35a0SRodrigo Rebello } 2034fccd35a0SRodrigo Rebello return 0; 2035fccd35a0SRodrigo Rebello} 2036fccd35a0SRodrigo RebelloEOF 203763678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 20383b463a3fSMiroslav Rezanina sp_on=0 203963678e17SSteven Noonan for flag in $gcc_flags; do 2040590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 2041590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 2042086d5f75SPaolo Bonzini if compile_object "-Werror $flag" && 2043590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 204463678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2045db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 20463b463a3fSMiroslav Rezanina sp_on=1 204763678e17SSteven Noonan break 204863678e17SSteven Noonan fi 204963678e17SSteven Noonan done 20503b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 20513b463a3fSMiroslav Rezanina if test $sp_on = 0; then 20523b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 20533b463a3fSMiroslav Rezanina fi 20543b463a3fSMiroslav Rezanina fi 205537746c5eSMarc-André Lureaufi 205637746c5eSMarc-André Lureau 205720bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 205820bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 205920bc94a2SPaolo Bonzinicat > $TMPC << EOF 206020bc94a2SPaolo Bonzinistruct { 206120bc94a2SPaolo Bonzini int a[2]; 206220bc94a2SPaolo Bonzini} x = {0}; 206320bc94a2SPaolo BonziniEOF 206420bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 206520bc94a2SPaolo Bonzini : 206620bc94a2SPaolo Bonzinielse 206720bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 206820bc94a2SPaolo Bonzinifi 206920bc94a2SPaolo Bonzini 207021e709aaSMarc-André Lureau# Our module code doesn't support Windows 207121e709aaSMarc-André Lureauif test "$modules" = "yes" && test "$mingw32" = "yes" ; then 207221e709aaSMarc-André Lureau error_exit "Modules are not available for Windows" 207321e709aaSMarc-André Lureaufi 207421e709aaSMarc-André Lureau 2075bd83c861SChristian Ehrhardt# module_upgrades is only reasonable if modules are enabled 2076bd83c861SChristian Ehrhardtif test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2077bd83c861SChristian Ehrhardt error_exit "Can't enable module-upgrades as Modules are not enabled" 2078bd83c861SChristian Ehrhardtfi 2079bd83c861SChristian Ehrhardt 2080d376e9deSThomas Huth# Static linking is not possible with modules or PIE 208140d6444eSAvi Kivityif test "$static" = "yes" ; then 2082aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 2083aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 2084aa0d1f44SPaolo Bonzini fi 208540d6444eSAvi Kivityfi 208640d6444eSAvi Kivity 2087768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 2088768b7855SEmilio G. Cota cat > $TMPC << EOF 2089768b7855SEmilio G. Cotastatic __thread int tls_var; 2090768b7855SEmilio G. Cotaint main(void) { return tls_var; } 2091768b7855SEmilio G. CotaEOF 2092768b7855SEmilio G. Cota 2093768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 2094768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 2095768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 2096768b7855SEmilio G. Cotafi 2097768b7855SEmilio G. Cota 209840d6444eSAvi Kivitycat > $TMPC << EOF 209921d4a791SAvi Kivity 210021d4a791SAvi Kivity#ifdef __linux__ 210121d4a791SAvi Kivity# define THREAD __thread 210221d4a791SAvi Kivity#else 210321d4a791SAvi Kivity# define THREAD 210421d4a791SAvi Kivity#endif 210521d4a791SAvi Kivitystatic THREAD int tls_var; 210621d4a791SAvi Kivityint main(void) { return tls_var; } 210740d6444eSAvi KivityEOF 2108b2634124SRichard Henderson 2109b2634124SRichard Henderson# Check we support --no-pie first; we will need this for building ROMs. 2110412aeacdSAlex Bennéeif compile_prog "-Werror -fno-pie" "-no-pie"; then 2111412aeacdSAlex Bennée CFLAGS_NOPIE="-fno-pie" 2112b2634124SRichard Henderson LDFLAGS_NOPIE="-no-pie" 2113412aeacdSAlex Bennéefi 2114412aeacdSAlex Bennée 211512781462SRichard Hendersonif test "$static" = "yes"; then 2116eca7a8e6SRichard Henderson if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 21175770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 211812781462SRichard Henderson QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 211912781462SRichard Henderson pie="yes" 212012781462SRichard Henderson elif test "$pie" = "yes"; then 212112781462SRichard Henderson error_exit "-static-pie not available due to missing toolchain support" 212212781462SRichard Henderson else 212312781462SRichard Henderson QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 212412781462SRichard Henderson pie="no" 212512781462SRichard Henderson fi 212612781462SRichard Hendersonelif test "$pie" = "no"; then 21275770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" 21285770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS" 2129eca7a8e6SRichard Hendersonelif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 21305770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 21315770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" 213240d6444eSAvi Kivity pie="yes" 21332c674109SRichard Hendersonelif test "$pie" = "yes"; then 213476ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 213540d6444eSAvi Kivityelse 213640d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 213740d6444eSAvi Kivity pie="no" 213840d6444eSAvi Kivityfi 213940d6444eSAvi Kivity 2140e6cbd751SRichard Henderson# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2141e6cbd751SRichard Henderson# The combination is known as "full relro", because .got.plt is read-only too. 2142e6cbd751SRichard Hendersonif compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2143e6cbd751SRichard Henderson QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2144e6cbd751SRichard Hendersonfi 2145e6cbd751SRichard Henderson 214609dada40SPaolo Bonzini########################################## 214709dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 214809dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 214909dada40SPaolo Bonzini# specification is necessary 215009dada40SPaolo Bonzini 215109dada40SPaolo Bonziniif test "$cpu" = "i386"; then 215209dada40SPaolo Bonzini cat > $TMPC << EOF 215309dada40SPaolo Bonzinistatic int sfaa(int *ptr) 215409dada40SPaolo Bonzini{ 215509dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 215609dada40SPaolo Bonzini} 215709dada40SPaolo Bonzini 215809dada40SPaolo Bonziniint main(void) 215909dada40SPaolo Bonzini{ 216009dada40SPaolo Bonzini int val = 42; 21611405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 216209dada40SPaolo Bonzini sfaa(&val); 216309dada40SPaolo Bonzini return val; 216409dada40SPaolo Bonzini} 216509dada40SPaolo BonziniEOF 216609dada40SPaolo Bonzini if ! compile_prog "" "" ; then 216709dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 216809dada40SPaolo Bonzini fi 216909dada40SPaolo Bonzinifi 217009dada40SPaolo Bonzini 217109dada40SPaolo Bonzini######################################### 2172ec530c81Sbellard# Solaris specific configure tool chain decisions 217309dada40SPaolo Bonzini 2174ec530c81Sbellardif test "$solaris" = "yes" ; then 21756792aa11SLoïc Minier if has ar; then 21766792aa11SLoïc Minier : 21776792aa11SLoïc Minier else 2178ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 217976ad07a4SPeter Maydell error_exit "No path includes ar" \ 218076ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 2181ec530c81Sbellard fi 218276ad07a4SPeter Maydell error_exit "No path includes ar" 2183ec530c81Sbellard fi 2184ec530c81Sbellardfi 2185ec530c81Sbellard 2186afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 2187fdb75aefSPaolo Bonzini default_targets=yes 2188d880a3baSPaolo Bonzini for target in $default_target_list; do 2189d880a3baSPaolo Bonzini target_list="$target_list $target" 2190d880a3baSPaolo Bonzini done 2191d880a3baSPaolo Bonzini target_list="${target_list# }" 2192121afa9eSAnthony Liguorielse 2193fdb75aefSPaolo Bonzini default_targets=no 219489138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2195d880a3baSPaolo Bonzini for target in $target_list; do 219625b48338SPeter Maydell # Check that we recognised the target name; this allows a more 219725b48338SPeter Maydell # friendly error message than if we let it fall through. 219825b48338SPeter Maydell case " $default_target_list " in 219925b48338SPeter Maydell *" $target "*) 220025b48338SPeter Maydell ;; 220125b48338SPeter Maydell *) 220225b48338SPeter Maydell error_exit "Unknown target name '$target'" 220325b48338SPeter Maydell ;; 220425b48338SPeter Maydell esac 220525b48338SPeter Maydell done 2206d880a3baSPaolo Bonzinifi 220725b48338SPeter Maydell 2208fdb75aefSPaolo Bonzinifor target in $target_list; do 2209fdb75aefSPaolo Bonzini # if a deprecated target is enabled we note it here 2210fdb75aefSPaolo Bonzini if echo "$deprecated_targets_list" | grep -q "$target"; then 2211fdb75aefSPaolo Bonzini add_to deprecated_features $target 2212fdb75aefSPaolo Bonzini fi 2213fdb75aefSPaolo Bonzinidone 2214fdb75aefSPaolo Bonzini 2215f55fe278SPaolo Bonzini# see if system emulation was really requested 2216f55fe278SPaolo Bonzinicase " $target_list " in 2217f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 2218f55fe278SPaolo Bonzini ;; 2219f55fe278SPaolo Bonzini *) softmmu=no 2220f55fe278SPaolo Bonzini ;; 2221f55fe278SPaolo Bonziniesac 22225327cf48Sbellard 2223249247c9SJuan Quintelafeature_not_found() { 2224249247c9SJuan Quintela feature=$1 222521684af0SStewart Smith remedy=$2 2226249247c9SJuan Quintela 222776ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 222821684af0SStewart Smith "configure was not able to find it." \ 222921684af0SStewart Smith "$remedy" 2230249247c9SJuan Quintela} 2231249247c9SJuan Quintela 22327d13299dSbellard# --- 22337d13299dSbellard# big/little endian test 22347d13299dSbellardcat > $TMPC << EOF 223561cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 223661cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 223761cc919fSMike Frysingerextern int foo(short *, short *); 223861cc919fSMike Frysingerint main(int argc, char *argv[]) { 223961cc919fSMike Frysinger return foo(big_endian, little_endian); 22407d13299dSbellard} 22417d13299dSbellardEOF 22427d13299dSbellard 224361cc919fSMike Frysingerif compile_object ; then 224412f15c91SAlice Frosi if strings -a $TMPO | grep -q BiGeNdIaN ; then 224561cc919fSMike Frysinger bigendian="yes" 224612f15c91SAlice Frosi elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 224761cc919fSMike Frysinger bigendian="no" 22487d13299dSbellard else 22497d13299dSbellard echo big/little test failed 22507d13299dSbellard fi 22517d13299dSbellardelse 225261cc919fSMike Frysinger echo big/little test failed 22537d13299dSbellardfi 22547d13299dSbellard 2255b0a47e79SJuan Quintela########################################## 2256e10ee3f5SPhilippe Mathieu-Daudé# system tools 2257e10ee3f5SPhilippe Mathieu-Daudéif test -z "$want_tools"; then 2258e10ee3f5SPhilippe Mathieu-Daudé if test "$softmmu" = "no"; then 2259e10ee3f5SPhilippe Mathieu-Daudé want_tools=no 2260e10ee3f5SPhilippe Mathieu-Daudé else 2261e10ee3f5SPhilippe Mathieu-Daudé want_tools=yes 2262e10ee3f5SPhilippe Mathieu-Daudé fi 2263e10ee3f5SPhilippe Mathieu-Daudéfi 2264e10ee3f5SPhilippe Mathieu-Daudé 2265e10ee3f5SPhilippe Mathieu-Daudé########################################## 2266a30878e7SPeter Maydell# cocoa implies not SDL or GTK 2267a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 2268a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 2269b4e312e9SPaolo Bonziniif test "$cocoa" = "enabled"; then 2270b4e312e9SPaolo Bonzini if test "$sdl" = "enabled"; then 2271a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2272a30878e7SPeter Maydell fi 2273a30878e7SPeter Maydell if test "$gtk" = "yes"; then 2274a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2275a30878e7SPeter Maydell fi 2276a30878e7SPeter Maydell gtk=no 227735be72baSPaolo Bonzini sdl=disabled 2278a30878e7SPeter Maydellfi 2279a30878e7SPeter Maydell 22806b39b063SEric Blake# Some versions of Mac OS X incorrectly define SIZE_MAX 22816b39b063SEric Blakecat > $TMPC << EOF 22826b39b063SEric Blake#include <stdint.h> 22836b39b063SEric Blake#include <stdio.h> 22846b39b063SEric Blakeint main(int argc, char *argv[]) { 22856b39b063SEric Blake return printf("%zu", SIZE_MAX); 22866b39b063SEric Blake} 22876b39b063SEric BlakeEOF 22886b39b063SEric Blakehave_broken_size_max=no 22896b39b063SEric Blakeif ! compile_object -Werror ; then 22906b39b063SEric Blake have_broken_size_max=yes 22916b39b063SEric Blakefi 22926b39b063SEric Blake 2293a30878e7SPeter Maydell########################################## 2294015a33bdSGonglei# L2TPV3 probe 2295015a33bdSGonglei 2296015a33bdSGongleicat > $TMPC <<EOF 2297015a33bdSGonglei#include <sys/socket.h> 2298bff6cb72SMichael Tokarev#include <linux/ip.h> 2299015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2300015a33bdSGongleiEOF 2301015a33bdSGongleiif compile_prog "" "" ; then 2302015a33bdSGonglei l2tpv3=yes 2303015a33bdSGongleielse 2304015a33bdSGonglei l2tpv3=no 2305015a33bdSGongleifi 2306015a33bdSGonglei 2307c9c8b88fSDavid CARLIERif check_include "pty.h" ; then 2308c9c8b88fSDavid CARLIER pty_h=yes 2309c9c8b88fSDavid CARLIERelse 2310c9c8b88fSDavid CARLIER pty_h=no 2311c9c8b88fSDavid CARLIERfi 2312c9c8b88fSDavid CARLIER 2313195588ccSDavid CARLIERcat > $TMPC <<EOF 2314195588ccSDavid CARLIER#include <sys/mman.h> 2315195588ccSDavid CARLIERint main(int argc, char *argv[]) { 2316195588ccSDavid CARLIER return mlockall(MCL_FUTURE); 2317195588ccSDavid CARLIER} 2318195588ccSDavid CARLIEREOF 2319195588ccSDavid CARLIERif compile_prog "" "" ; then 2320195588ccSDavid CARLIER have_mlockall=yes 2321195588ccSDavid CARLIERelse 2322195588ccSDavid CARLIER have_mlockall=no 2323195588ccSDavid CARLIERfi 2324195588ccSDavid CARLIER 2325299e6f19SPaolo Bonzini######################################### 2326299e6f19SPaolo Bonzini# vhost interdependencies and host support 2327299e6f19SPaolo Bonzini 2328299e6f19SPaolo Bonzini# vhost backends 2329299e6f19SPaolo Bonzinitest "$vhost_user" = "" && vhost_user=yes 2330299e6f19SPaolo Bonziniif test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then 2331299e6f19SPaolo Bonzini error_exit "vhost-user isn't available on win32" 2332299e6f19SPaolo Bonzinifi 2333108a6481SCindy Lutest "$vhost_vdpa" = "" && vhost_vdpa=$linux 2334108a6481SCindy Luif test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 2335108a6481SCindy Lu error_exit "vhost-vdpa is only available on Linux" 2336108a6481SCindy Lufi 2337299e6f19SPaolo Bonzinitest "$vhost_kernel" = "" && vhost_kernel=$linux 2338299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2339299e6f19SPaolo Bonzini error_exit "vhost-kernel is only available on Linux" 2340299e6f19SPaolo Bonzinifi 2341299e6f19SPaolo Bonzini 2342299e6f19SPaolo Bonzini# vhost-kernel devices 2343299e6f19SPaolo Bonzinitest "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2344299e6f19SPaolo Bonziniif test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2345299e6f19SPaolo Bonzini error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2346299e6f19SPaolo Bonzinifi 2347299e6f19SPaolo Bonzinitest "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2348299e6f19SPaolo Bonziniif test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2349299e6f19SPaolo Bonzini error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2350299e6f19SPaolo Bonzinifi 2351299e6f19SPaolo Bonzini 2352299e6f19SPaolo Bonzini# vhost-user backends 2353299e6f19SPaolo Bonzinitest "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2354299e6f19SPaolo Bonziniif test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2355299e6f19SPaolo Bonzini error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2356299e6f19SPaolo Bonzinifi 2357299e6f19SPaolo Bonzinitest "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2358299e6f19SPaolo Bonziniif test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2359299e6f19SPaolo Bonzini error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2360299e6f19SPaolo Bonzinifi 236198fc1adaSDr. David Alan Gilberttest "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 236298fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 236398fc1adaSDr. David Alan Gilbert error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 236498fc1adaSDr. David Alan Gilbertfi 2365108a6481SCindy Lu#vhost-vdpa backends 2366108a6481SCindy Lutest "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 2367108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 2368108a6481SCindy Lu error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 2369108a6481SCindy Lufi 2370299e6f19SPaolo Bonzini 237140bc0ca9SLaurent Vivier# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity 2372299e6f19SPaolo Bonziniif test "$vhost_net" = ""; then 2373299e6f19SPaolo Bonzini test "$vhost_net_user" = "yes" && vhost_net=yes 237440bc0ca9SLaurent Vivier test "$vhost_net_vdpa" = "yes" && vhost_net=yes 2375299e6f19SPaolo Bonzini test "$vhost_kernel" = "yes" && vhost_net=yes 2376299e6f19SPaolo Bonzinifi 2377299e6f19SPaolo Bonzini 2378015a33bdSGonglei########################################## 2379779ab5e3SStefan Weil# pkg-config probe 2380779ab5e3SStefan Weil 2381779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 238276ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2383779ab5e3SStefan Weilfi 2384779ab5e3SStefan Weil 2385779ab5e3SStefan Weil########################################## 2386b0a47e79SJuan Quintela# NPTL probe 2387b0a47e79SJuan Quintela 238824cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2389bd0c5661Spbrook cat > $TMPC <<EOF 2390bd0c5661Spbrook#include <sched.h> 239130813ceaSpbrook#include <linux/futex.h> 2392182eacc0SStefan Weilint main(void) { 2393bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2394bd0c5661Spbrook#error bork 2395bd0c5661Spbrook#endif 2396182eacc0SStefan Weil return 0; 2397bd0c5661Spbrook} 2398bd0c5661SpbrookEOF 239924cb36a6SPeter Maydell if ! compile_object ; then 240021684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2401b0a47e79SJuan Quintela fi 2402bd0c5661Spbrookfi 2403bd0c5661Spbrook 2404ac62922eSbalrog########################################## 2405607dacd0Sqiaonuohan# lzo check 2406607dacd0Sqiaonuohan 2407607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 2408607dacd0Sqiaonuohan cat > $TMPC << EOF 2409607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 2410607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 2411607dacd0SqiaonuohanEOF 2412607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 2413708eab42SMarc-André Lureau lzo_libs="-llzo2" 2414b25c9dffSStefan Weil lzo="yes" 2415b25c9dffSStefan Weil else 2416b25c9dffSStefan Weil if test "$lzo" = "yes"; then 2417b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 2418b25c9dffSStefan Weil fi 2419b25c9dffSStefan Weil lzo="no" 2420b25c9dffSStefan Weil fi 2421607dacd0Sqiaonuohanfi 2422607dacd0Sqiaonuohan 2423607dacd0Sqiaonuohan########################################## 2424607dacd0Sqiaonuohan# snappy check 2425607dacd0Sqiaonuohan 2426607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 2427607dacd0Sqiaonuohan cat > $TMPC << EOF 2428607dacd0Sqiaonuohan#include <snappy-c.h> 2429607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 2430607dacd0SqiaonuohanEOF 2431607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 2432708eab42SMarc-André Lureau snappy_libs='-lsnappy' 2433b25c9dffSStefan Weil snappy="yes" 2434b25c9dffSStefan Weil else 2435b25c9dffSStefan Weil if test "$snappy" = "yes"; then 2436b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 2437b25c9dffSStefan Weil fi 2438b25c9dffSStefan Weil snappy="no" 2439b25c9dffSStefan Weil fi 2440607dacd0Sqiaonuohanfi 2441607dacd0Sqiaonuohan 2442607dacd0Sqiaonuohan########################################## 24436b383c08SPeter Wu# bzip2 check 24446b383c08SPeter Wu 24456b383c08SPeter Wuif test "$bzip2" != "no" ; then 24466b383c08SPeter Wu cat > $TMPC << EOF 24476b383c08SPeter Wu#include <bzlib.h> 24486b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 24496b383c08SPeter WuEOF 24506b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 24516b383c08SPeter Wu bzip2="yes" 24526b383c08SPeter Wu else 24536b383c08SPeter Wu if test "$bzip2" = "yes"; then 24546b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 24556b383c08SPeter Wu fi 24566b383c08SPeter Wu bzip2="no" 24576b383c08SPeter Wu fi 24586b383c08SPeter Wufi 24596b383c08SPeter Wu 24606b383c08SPeter Wu########################################## 246183bc1f97SJulio Faracco# lzfse check 246283bc1f97SJulio Faracco 246383bc1f97SJulio Faraccoif test "$lzfse" != "no" ; then 246483bc1f97SJulio Faracco cat > $TMPC << EOF 246583bc1f97SJulio Faracco#include <lzfse.h> 246683bc1f97SJulio Faraccoint main(void) { lzfse_decode_scratch_size(); return 0; } 246783bc1f97SJulio FaraccoEOF 246883bc1f97SJulio Faracco if compile_prog "" "-llzfse" ; then 246983bc1f97SJulio Faracco lzfse="yes" 247083bc1f97SJulio Faracco else 247183bc1f97SJulio Faracco if test "$lzfse" = "yes"; then 247283bc1f97SJulio Faracco feature_not_found "lzfse" "Install lzfse devel" 247383bc1f97SJulio Faracco fi 247483bc1f97SJulio Faracco lzfse="no" 247583bc1f97SJulio Faracco fi 247683bc1f97SJulio Faraccofi 247783bc1f97SJulio Faracco 247883bc1f97SJulio Faracco########################################## 24793a678481SJuan Quintela# zstd check 24803a678481SJuan Quintela 24813a678481SJuan Quintelaif test "$zstd" != "no" ; then 2482297254c7SJuan Quintela libzstd_minver="1.4.0" 2483297254c7SJuan Quintela if $pkg_config --atleast-version=$libzstd_minver libzstd ; then 24843a678481SJuan Quintela zstd_cflags="$($pkg_config --cflags libzstd)" 24853a678481SJuan Quintela zstd_libs="$($pkg_config --libs libzstd)" 24863a678481SJuan Quintela zstd="yes" 24873a678481SJuan Quintela else 24883a678481SJuan Quintela if test "$zstd" = "yes" ; then 24893a678481SJuan Quintela feature_not_found "libzstd" "Install libzstd devel" 24903a678481SJuan Quintela fi 24913a678481SJuan Quintela zstd="no" 24923a678481SJuan Quintela fi 24933a678481SJuan Quintelafi 24943a678481SJuan Quintela 24953a678481SJuan Quintela########################################## 2496f794573eSEduardo Otubo# libseccomp check 2497f794573eSEduardo Otubo 2498f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 24993e684455SMichael Strosaker libseccomp_minver="2.3.0" 250025ed0eccSHelge Deller if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2501c3883e1fSFam Zheng seccomp_cflags="$($pkg_config --cflags libseccomp)" 2502c3883e1fSFam Zheng seccomp_libs="$($pkg_config --libs libseccomp)" 2503f794573eSEduardo Otubo seccomp="yes" 2504f794573eSEduardo Otubo else 2505f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 2506693e5910SAndrew Jones feature_not_found "libseccomp" \ 2507693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 2508896848f0SEduardo Otubo fi 2509e84d5956SYann E. MORIN seccomp="no" 2510f794573eSEduardo Otubo fi 2511f794573eSEduardo Otubofi 25123bd40ec7SPaolo Bonzini 2513f794573eSEduardo Otubo########################################## 2514e37630caSaliguori# xen probe 2515e37630caSaliguori 25161badb709SPaolo Bonziniif test "$xen" != "disabled" ; then 2517c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2518c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2519c1cdd9d5SJuergen Gross # to obtain all needed flags. 2520c1cdd9d5SJuergen Gross 2521c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2522c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2523c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2524c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 25251badb709SPaolo Bonzini xen=enabled 25265b6a8f43SMichael Tokarev xen_pc="xencontrol xenstore xenforeignmemory xengnttab" 2527c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 252858ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 252958ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 253058ea9a7aSAnthony PERARD fi 2531582ea95fSMarc-André Lureau xen_cflags="$($pkg_config --cflags $xen_pc)" 2532582ea95fSMarc-André Lureau xen_libs="$($pkg_config --libs $xen_pc)" 2533c1cdd9d5SJuergen Gross else 2534c1cdd9d5SJuergen Gross 25355b6a8f43SMichael Tokarev xen_libs="-lxenstore -lxenctrl" 2536d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2537d5b93ddfSAnthony PERARD 253850ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 253950ced5b3SStefan Weil # If no, we are done and there is no Xen support. 254050ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 254150ced5b3SStefan Weil 254250ced5b3SStefan Weil # Xen (any) 254350ced5b3SStefan Weil cat > $TMPC <<EOF 254450ced5b3SStefan Weil#include <xenctrl.h> 254550ced5b3SStefan Weilint main(void) { 254650ced5b3SStefan Weil return 0; 254750ced5b3SStefan Weil} 254850ced5b3SStefan WeilEOF 254950ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 255050ced5b3SStefan Weil # Xen not found 25511badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 255221684af0SStewart Smith feature_not_found "xen" "Install xen devel" 255350ced5b3SStefan Weil fi 25541badb709SPaolo Bonzini xen=disabled 255550ced5b3SStefan Weil 2556d5b93ddfSAnthony PERARD # Xen unstable 255769deef08SPeter Maydell elif 255869deef08SPeter Maydell cat > $TMPC <<EOF && 25592cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 25602cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 25612cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2562d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 25632cbf8903SRoss Lagerwallint main(void) { 25642cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2565d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 25662cbf8903SRoss Lagerwall 25672cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 25682cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 25692cbf8903SRoss Lagerwall 2570d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2571d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2572d3c49ebbSPaul Durrant 25732cbf8903SRoss Lagerwall return 0; 25742cbf8903SRoss Lagerwall} 25752cbf8903SRoss LagerwallEOF 25762cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 25772cbf8903SRoss Lagerwall then 25782cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 25792cbf8903SRoss Lagerwall xen_ctrl_version=41100 25801badb709SPaolo Bonzini xen=enabled 25812cbf8903SRoss Lagerwall elif 25822cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 25835ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 25845ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 258558ea9a7aSAnthony PERARD#include <xentoolcore.h> 25865ba3d756SIgor Druzhininint main(void) { 25875ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 25885ba3d756SIgor Druzhinin 25895ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 25905ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 259158ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 25925ba3d756SIgor Druzhinin 25935ba3d756SIgor Druzhinin return 0; 25945ba3d756SIgor Druzhinin} 25955ba3d756SIgor DruzhininEOF 259658ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 25975ba3d756SIgor Druzhinin then 259858ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 25995ba3d756SIgor Druzhinin xen_ctrl_version=41000 26001badb709SPaolo Bonzini xen=enabled 26015ba3d756SIgor Druzhinin elif 26025ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2603da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2604da8090ccSPaul Durrant#define __XEN_TOOLS__ 2605da8090ccSPaul Durrant#include <xendevicemodel.h> 2606da8090ccSPaul Durrantint main(void) { 2607da8090ccSPaul Durrant xendevicemodel_handle *xd; 2608da8090ccSPaul Durrant 2609da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2610da8090ccSPaul Durrant xendevicemodel_close(xd); 2611da8090ccSPaul Durrant 2612da8090ccSPaul Durrant return 0; 2613da8090ccSPaul Durrant} 2614da8090ccSPaul DurrantEOF 2615da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2616da8090ccSPaul Durrant then 2617da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2618f1167ee6SJuergen Gross xen_ctrl_version=40900 26191badb709SPaolo Bonzini xen=enabled 2620da8090ccSPaul Durrant elif 2621da8090ccSPaul Durrant cat > $TMPC <<EOF && 26225eeb39c2SIan Campbell/* 26235eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 26245eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2625b6eb9b45SPaulina Szubarczyk * 2626b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2627b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2628b6eb9b45SPaulina Szubarczyk */ 2629b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2630b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2631b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2632b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2633b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2634b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2635b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2636b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2637b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2638b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2639b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2640b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2641b6eb9b45SPaulina Szubarczyk#endif 2642b6eb9b45SPaulina Szubarczykint main(void) { 2643b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2644b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2645b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2646b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2647b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2648b6eb9b45SPaulina Szubarczyk 2649b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2650b6eb9b45SPaulina Szubarczyk 2651b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2652b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2653b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2654b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2655b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2656b6eb9b45SPaulina Szubarczyk 2657b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2658b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2659b6eb9b45SPaulina Szubarczyk 2660b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2661b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2662b6eb9b45SPaulina Szubarczyk 2663b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2664b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2665b6eb9b45SPaulina Szubarczyk 2666b6eb9b45SPaulina Szubarczyk return 0; 2667b6eb9b45SPaulina Szubarczyk} 2668b6eb9b45SPaulina SzubarczykEOF 2669b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2670b6eb9b45SPaulina Szubarczyk then 2671f1167ee6SJuergen Gross xen_ctrl_version=40800 26721badb709SPaolo Bonzini xen=enabled 2673b6eb9b45SPaulina Szubarczyk elif 2674b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2675b6eb9b45SPaulina Szubarczyk/* 2676b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2677b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 26785eeb39c2SIan Campbell */ 26795eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 26805eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 26815eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 26825eeb39c2SIan Campbell#include <xenctrl.h> 26835eeb39c2SIan Campbell#include <xenstore.h> 26845eeb39c2SIan Campbell#include <xenevtchn.h> 26855eeb39c2SIan Campbell#include <xengnttab.h> 26865eeb39c2SIan Campbell#include <xenforeignmemory.h> 26875eeb39c2SIan Campbell#include <stdint.h> 26885eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 26895eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 26905eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 26915eeb39c2SIan Campbell#endif 26925eeb39c2SIan Campbellint main(void) { 26935eeb39c2SIan Campbell xc_interface *xc = NULL; 26945eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 26955eeb39c2SIan Campbell xenevtchn_handle *xe; 26965eeb39c2SIan Campbell xengnttab_handle *xg; 26975eeb39c2SIan Campbell 26985eeb39c2SIan Campbell xs_daemon_open(); 26995eeb39c2SIan Campbell 27005eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 27015eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 27025eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 27035eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 27045eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 27055eeb39c2SIan Campbell 27065eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 27075eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 27085eeb39c2SIan Campbell 27095eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 27105eeb39c2SIan Campbell xenevtchn_fd(xe); 27115eeb39c2SIan Campbell 27125eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 27135eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 27145eeb39c2SIan Campbell 27155eeb39c2SIan Campbell return 0; 27165eeb39c2SIan Campbell} 27175eeb39c2SIan CampbellEOF 27185eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 27195eeb39c2SIan Campbell then 2720f1167ee6SJuergen Gross xen_ctrl_version=40701 27211badb709SPaolo Bonzini xen=enabled 2722cdadde39SRoger Pau Monne 2723cdadde39SRoger Pau Monne # Xen 4.6 2724cdadde39SRoger Pau Monne elif 2725cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2726cdadde39SRoger Pau Monne#include <xenctrl.h> 2727e108a3c1SAnthony PERARD#include <xenstore.h> 2728d5b93ddfSAnthony PERARD#include <stdint.h> 2729d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2730d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2731d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2732d5b93ddfSAnthony PERARD#endif 2733d5b93ddfSAnthony PERARDint main(void) { 2734d5b93ddfSAnthony PERARD xc_interface *xc; 2735d5b93ddfSAnthony PERARD xs_daemon_open(); 2736d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2737d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2738d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2739b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 27408688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2741d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 274220a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2743d8b441a3SJan Beulich return 0; 2744d8b441a3SJan Beulich} 2745d8b441a3SJan BeulichEOF 2746d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2747d8b441a3SJan Beulich then 2748f1167ee6SJuergen Gross xen_ctrl_version=40600 27491badb709SPaolo Bonzini xen=enabled 2750d8b441a3SJan Beulich 2751d8b441a3SJan Beulich # Xen 4.5 2752d8b441a3SJan Beulich elif 2753d8b441a3SJan Beulich cat > $TMPC <<EOF && 2754d8b441a3SJan Beulich#include <xenctrl.h> 2755d8b441a3SJan Beulich#include <xenstore.h> 2756d8b441a3SJan Beulich#include <stdint.h> 2757d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2758d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2759d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2760d8b441a3SJan Beulich#endif 2761d8b441a3SJan Beulichint main(void) { 2762d8b441a3SJan Beulich xc_interface *xc; 2763d8b441a3SJan Beulich xs_daemon_open(); 2764d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2765d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2766d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2767d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2768d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 27693996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 27703996e85cSPaul Durrant return 0; 27713996e85cSPaul Durrant} 27723996e85cSPaul DurrantEOF 27733996e85cSPaul Durrant compile_prog "" "$xen_libs" 27743996e85cSPaul Durrant then 2775f1167ee6SJuergen Gross xen_ctrl_version=40500 27761badb709SPaolo Bonzini xen=enabled 27773996e85cSPaul Durrant 27783996e85cSPaul Durrant elif 27793996e85cSPaul Durrant cat > $TMPC <<EOF && 27803996e85cSPaul Durrant#include <xenctrl.h> 27813996e85cSPaul Durrant#include <xenstore.h> 27823996e85cSPaul Durrant#include <stdint.h> 27833996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 27843996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 27853996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 27863996e85cSPaul Durrant#endif 27873996e85cSPaul Durrantint main(void) { 27883996e85cSPaul Durrant xc_interface *xc; 27893996e85cSPaul Durrant xs_daemon_open(); 27903996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 27913996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 27923996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 27933996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 27943996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 27958688e065SStefano Stabellini return 0; 27968688e065SStefano Stabellini} 27978688e065SStefano StabelliniEOF 27988688e065SStefano Stabellini compile_prog "" "$xen_libs" 279969deef08SPeter Maydell then 2800f1167ee6SJuergen Gross xen_ctrl_version=40200 28011badb709SPaolo Bonzini xen=enabled 28028688e065SStefano Stabellini 2803e37630caSaliguori else 28041badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 2805edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2806edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2807fc321b4bSJuan Quintela fi 28081badb709SPaolo Bonzini xen=disabled 2809e37630caSaliguori fi 2810d5b93ddfSAnthony PERARD 28111badb709SPaolo Bonzini if test "$xen" = enabled; then 2812f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 2813582ea95fSMarc-André Lureau xen_libs="$xen_libs $xen_stable_libs " 28145eeb39c2SIan Campbell fi 2815d5b93ddfSAnthony PERARD fi 2816e37630caSaliguori fi 2817c1cdd9d5SJuergen Grossfi 2818e37630caSaliguori 28191badb709SPaolo Bonziniif test "$xen_pci_passthrough" != "disabled"; then 28201badb709SPaolo Bonzini if test "$xen" = "enabled" && test "$linux" = "yes"; then 28211badb709SPaolo Bonzini xen_pci_passthrough=enabled 2822eb6fda0fSAnthony PERARD else 28231badb709SPaolo Bonzini if test "$xen_pci_passthrough" = "enabled"; then 282476ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 282576ad07a4SPeter Maydell " but this feature requires /sys from Linux" 2826eb6fda0fSAnthony PERARD fi 28271badb709SPaolo Bonzini xen_pci_passthrough=disabled 2828d661d9a4SJustin Terry (VM) fi 2829d661d9a4SJustin Terry (VM)fi 2830d661d9a4SJustin Terry (VM) 2831d661d9a4SJustin Terry (VM)########################################## 2832e8f3bd71SMarc-André Lureau# gettext probe 2833e8f3bd71SMarc-André Lureauif test "$gettext" != "false" ; then 2834e8f3bd71SMarc-André Lureau if has xgettext; then 2835e8f3bd71SMarc-André Lureau gettext=true 2836e8f3bd71SMarc-André Lureau else 2837e8f3bd71SMarc-André Lureau if test "$gettext" = "true" ; then 2838e8f3bd71SMarc-André Lureau feature_not_found "gettext" "Install xgettext binary" 2839e8f3bd71SMarc-André Lureau fi 2840e8f3bd71SMarc-André Lureau gettext=false 2841e8f3bd71SMarc-André Lureau fi 2842e8f3bd71SMarc-André Lureaufi 2843e8f3bd71SMarc-André Lureau 2844e8f3bd71SMarc-André Lureau########################################## 2845f676c67eSJeremy White# X11 probe 2846f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 28478781595bSGerd Hoffmann have_x11=yes 284889138857SStefan Weil x11_cflags=$($pkg_config --cflags x11) 284989138857SStefan Weil x11_libs=$($pkg_config --libs x11) 2850f676c67eSJeremy Whitefi 2851f676c67eSJeremy White 2852f676c67eSJeremy White########################################## 2853a4ccabcfSAnthony Liguori# GTK probe 2854a4ccabcfSAnthony Liguori 28555a464e6cSPeter Xuif test "$gtk" != "no"; then 285689d85cdeSDaniel P. Berrangé gtkpackage="gtk+-3.0" 285789d85cdeSDaniel P. Berrangé gtkx11package="gtk+-x11-3.0" 28587b23d121SVolker Rümelin gtkversion="3.22.0" 2859bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 286089138857SStefan Weil gtk_cflags=$($pkg_config --cflags $gtkpackage) 286189138857SStefan Weil gtk_libs=$($pkg_config --libs $gtkpackage) 286289138857SStefan Weil gtk_version=$($pkg_config --modversion $gtkpackage) 28630a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 28648781595bSGerd Hoffmann need_x11=yes 2865f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 2866f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 28670a337ed0SGerd Hoffmann fi 2868bbbf9bfbSStefan Weil gtk="yes" 2869bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 28705fe309ffSGerd Hoffmann feature_not_found "gtk" "Install gtk3-devel" 2871bbbf9bfbSStefan Weil else 2872bbbf9bfbSStefan Weil gtk="no" 2873bbbf9bfbSStefan Weil fi 2874bbbf9bfbSStefan Weilfi 2875bbbf9bfbSStefan Weil 2876ddbb0d09SDaniel P. Berrange 2877ddbb0d09SDaniel P. Berrange########################################## 2878ddbb0d09SDaniel P. Berrange# GNUTLS probe 2879ddbb0d09SDaniel P. Berrange 2880ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 2881a73e82efSRichard Henderson pass="no" 2882a0722409SDaniel P. Berrangé if $pkg_config --exists "gnutls >= 3.1.18"; then 288389138857SStefan Weil gnutls_cflags=$($pkg_config --cflags gnutls) 288489138857SStefan Weil gnutls_libs=$($pkg_config --libs gnutls) 2885a73e82efSRichard Henderson # Packaging for the static libraries is not always correct. 2886a73e82efSRichard Henderson # At least ubuntu 18.04 ships only shared libraries. 2887a73e82efSRichard Henderson write_c_skeleton 2888a73e82efSRichard Henderson if compile_prog "" "$gnutls_libs" ; then 2889a73e82efSRichard Henderson pass="yes" 2890a73e82efSRichard Henderson fi 2891a73e82efSRichard Henderson fi 2892a73e82efSRichard Henderson if test "$pass" = "no" && test "$gnutls" = "yes"; then 2893a0722409SDaniel P. Berrangé feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 2894ddbb0d09SDaniel P. Berrange else 2895a73e82efSRichard Henderson gnutls="$pass" 2896ddbb0d09SDaniel P. Berrange fi 2897ddbb0d09SDaniel P. Berrangefi 2898ddbb0d09SDaniel P. Berrange 289991bfcdb0SDaniel P. Berrange 290091bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 290191bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 2902a0722409SDaniel P. Berrangé# explicitly 290391bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 290491bfcdb0SDaniel P. Berrangethen 2905a0722409SDaniel P. Berrangé if test "$nettle" = "yes" 290691bfcdb0SDaniel P. Berrange then 290791bfcdb0SDaniel P. Berrange gcrypt="no" 290891bfcdb0SDaniel P. Berrange fi 290991bfcdb0SDaniel P. Berrangefi 291091bfcdb0SDaniel P. Berrange 291191bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 291291bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 2913a0722409SDaniel P. Berrangé# explicitly 291491bfcdb0SDaniel P. Berrangeif test -z "$nettle" 291591bfcdb0SDaniel P. Berrangethen 2916a0722409SDaniel P. Berrangé if test "$gcrypt" = "yes" 291791bfcdb0SDaniel P. Berrange then 291891bfcdb0SDaniel P. Berrange nettle="no" 291991bfcdb0SDaniel P. Berrange fi 292091bfcdb0SDaniel P. Berrangefi 292191bfcdb0SDaniel P. Berrange 2922dea7a64eSDaniel P. Berrangéhas_libgcrypt() { 292391bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 292491bfcdb0SDaniel P. Berrange then 292591bfcdb0SDaniel P. Berrange return 1 292691bfcdb0SDaniel P. Berrange fi 292791bfcdb0SDaniel P. Berrange 292891bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 292991bfcdb0SDaniel P. Berrange then 293089138857SStefan Weil host=$(libgcrypt-config --host) 293191bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 293291bfcdb0SDaniel P. Berrange then 293391bfcdb0SDaniel P. Berrange return 1 293491bfcdb0SDaniel P. Berrange fi 293591bfcdb0SDaniel P. Berrange fi 293691bfcdb0SDaniel P. Berrange 2937dea7a64eSDaniel P. Berrangé maj=`libgcrypt-config --version | awk -F . '{print $1}'` 2938dea7a64eSDaniel P. Berrangé min=`libgcrypt-config --version | awk -F . '{print $2}'` 2939dea7a64eSDaniel P. Berrangé 2940dea7a64eSDaniel P. Berrangé if test $maj != 1 || test $min -lt 5 2941dea7a64eSDaniel P. Berrangé then 2942dea7a64eSDaniel P. Berrangé return 1 2943dea7a64eSDaniel P. Berrangé fi 2944dea7a64eSDaniel P. Berrangé 294591bfcdb0SDaniel P. Berrange return 0 294691bfcdb0SDaniel P. Berrange} 294791bfcdb0SDaniel P. Berrange 2948a0722409SDaniel P. Berrangé 2949a0722409SDaniel P. Berrangéif test "$nettle" != "no"; then 2950a73e82efSRichard Henderson pass="no" 295164dd2f3bSDaniel P. Berrangé if $pkg_config --exists "nettle >= 2.7.1"; then 2952a0722409SDaniel P. Berrangé nettle_cflags=$($pkg_config --cflags nettle) 2953a0722409SDaniel P. Berrangé nettle_libs=$($pkg_config --libs nettle) 2954a0722409SDaniel P. Berrangé nettle_version=$($pkg_config --modversion nettle) 2955a73e82efSRichard Henderson # Link test to make sure the given libraries work (e.g for static). 2956a73e82efSRichard Henderson write_c_skeleton 2957a73e82efSRichard Henderson if compile_prog "" "$nettle_libs" ; then 2958a0722409SDaniel P. Berrangé if test -z "$gcrypt"; then 2959a0722409SDaniel P. Berrangé gcrypt="no" 2960a0722409SDaniel P. Berrangé fi 2961a73e82efSRichard Henderson pass="yes" 2962a73e82efSRichard Henderson fi 2963a73e82efSRichard Henderson fi 2964dc2207afSDaniel P. Berrangé if test "$pass" = "yes" 2965dc2207afSDaniel P. Berrangé then 2966dc2207afSDaniel P. Berrangé cat > $TMPC << EOF 2967dc2207afSDaniel P. Berrangé#include <nettle/xts.h> 2968dc2207afSDaniel P. Berrangéint main(void) { 2969dc2207afSDaniel P. Berrangé return 0; 2970dc2207afSDaniel P. Berrangé} 2971dc2207afSDaniel P. BerrangéEOF 2972dc2207afSDaniel P. Berrangé if compile_prog "$nettle_cflags" "$nettle_libs" ; then 2973dc2207afSDaniel P. Berrangé nettle_xts=yes 2974dc2207afSDaniel P. Berrangé qemu_private_xts=no 2975dc2207afSDaniel P. Berrangé fi 2976dc2207afSDaniel P. Berrangé fi 2977a73e82efSRichard Henderson if test "$pass" = "no" && test "$nettle" = "yes"; then 297864dd2f3bSDaniel P. Berrangé feature_not_found "nettle" "Install nettle devel >= 2.7.1" 2979a0722409SDaniel P. Berrangé else 2980a73e82efSRichard Henderson nettle="$pass" 2981a0722409SDaniel P. Berrangé fi 2982a0722409SDaniel P. Berrangéfi 2983a0722409SDaniel P. Berrangé 298491bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 2985a73e82efSRichard Henderson pass="no" 2986dea7a64eSDaniel P. Berrangé if has_libgcrypt; then 298789138857SStefan Weil gcrypt_cflags=$(libgcrypt-config --cflags) 298889138857SStefan Weil gcrypt_libs=$(libgcrypt-config --libs) 2989a73e82efSRichard Henderson # Debian has removed -lgpg-error from libgcrypt-config 299091bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 299191bfcdb0SDaniel P. Berrange # turn breaks static builds... 299291bfcdb0SDaniel P. Berrange if test "$static" = "yes" 299391bfcdb0SDaniel P. Berrange then 299491bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 299591bfcdb0SDaniel P. Berrange fi 29961f923c70SLongpeng(Mike) 2997a73e82efSRichard Henderson # Link test to make sure the given libraries work (e.g for static). 2998a73e82efSRichard Henderson write_c_skeleton 2999a73e82efSRichard Henderson if compile_prog "" "$gcrypt_libs" ; then 3000a73e82efSRichard Henderson pass="yes" 3001a73e82efSRichard Henderson fi 3002a73e82efSRichard Henderson fi 3003a73e82efSRichard Henderson if test "$pass" = "yes"; then 300437788f25SDaniel P. Berrange gcrypt="yes" 30051f923c70SLongpeng(Mike) cat > $TMPC << EOF 30061f923c70SLongpeng(Mike)#include <gcrypt.h> 30071f923c70SLongpeng(Mike)int main(void) { 30081f923c70SLongpeng(Mike) gcry_mac_hd_t handle; 30091f923c70SLongpeng(Mike) gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 30101f923c70SLongpeng(Mike) GCRY_MAC_FLAG_SECURE, NULL); 30111f923c70SLongpeng(Mike) return 0; 30121f923c70SLongpeng(Mike)} 30131f923c70SLongpeng(Mike)EOF 30141f923c70SLongpeng(Mike) if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 30151f923c70SLongpeng(Mike) gcrypt_hmac=yes 30161f923c70SLongpeng(Mike) fi 3017e0576942SDaniel P. Berrangé cat > $TMPC << EOF 3018e0576942SDaniel P. Berrangé#include <gcrypt.h> 3019e0576942SDaniel P. Berrangéint main(void) { 3020e0576942SDaniel P. Berrangé gcry_cipher_hd_t handle; 3021e0576942SDaniel P. Berrangé gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); 3022e0576942SDaniel P. Berrangé return 0; 3023e0576942SDaniel P. Berrangé} 3024e0576942SDaniel P. BerrangéEOF 3025e0576942SDaniel P. Berrangé if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3026e0576942SDaniel P. Berrangé gcrypt_xts=yes 3027e0576942SDaniel P. Berrangé qemu_private_xts=no 3028e0576942SDaniel P. Berrangé fi 3029a73e82efSRichard Henderson elif test "$gcrypt" = "yes"; then 3030dea7a64eSDaniel P. Berrangé feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 303191bfcdb0SDaniel P. Berrange else 303291bfcdb0SDaniel P. Berrange gcrypt="no" 303391bfcdb0SDaniel P. Berrange fi 303462893b67SDaniel P. Berrangefi 303562893b67SDaniel P. Berrange 3036ddbb0d09SDaniel P. Berrange 303791bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 303891bfcdb0SDaniel P. Berrangethen 303991bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 304091bfcdb0SDaniel P. Berrangefi 3041ed754746SDaniel P. Berrange 30429a2fd434SDaniel P. Berrange########################################## 30439a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 30449a2fd434SDaniel P. Berrange 30459a2fd434SDaniel P. Berrangetasn1=yes 304690246037SDaniel P. Berrangetasn1_cflags="" 304790246037SDaniel P. Berrangetasn1_libs="" 30489a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 304989138857SStefan Weil tasn1_cflags=$($pkg_config --cflags libtasn1) 305089138857SStefan Weil tasn1_libs=$($pkg_config --libs libtasn1) 30519a2fd434SDaniel P. Berrangeelse 30529a2fd434SDaniel P. Berrange tasn1=no 30539a2fd434SDaniel P. Berrangefi 30549a2fd434SDaniel P. Berrange 3055ed754746SDaniel P. Berrange 3056bbbf9bfbSStefan Weil########################################## 30578953caf3SDaniel P. Berrange# PAM probe 30588953caf3SDaniel P. Berrange 30598953caf3SDaniel P. Berrangeif test "$auth_pam" != "no"; then 30608953caf3SDaniel P. Berrange cat > $TMPC <<EOF 30618953caf3SDaniel P. Berrange#include <security/pam_appl.h> 30628953caf3SDaniel P. Berrange#include <stdio.h> 30638953caf3SDaniel P. Berrangeint main(void) { 30648953caf3SDaniel P. Berrange const char *service_name = "qemu"; 30658953caf3SDaniel P. Berrange const char *user = "frank"; 30669c9642d0SDr. David Alan Gilbert const struct pam_conv pam_conv = { 0 }; 30678953caf3SDaniel P. Berrange pam_handle_t *pamh = NULL; 30689c9642d0SDr. David Alan Gilbert pam_start(service_name, user, &pam_conv, &pamh); 30698953caf3SDaniel P. Berrange return 0; 30708953caf3SDaniel P. Berrange} 30718953caf3SDaniel P. BerrangeEOF 30728953caf3SDaniel P. Berrange if compile_prog "" "-lpam" ; then 30738953caf3SDaniel P. Berrange auth_pam=yes 30748953caf3SDaniel P. Berrange else 30758953caf3SDaniel P. Berrange if test "$auth_pam" = "yes"; then 30768953caf3SDaniel P. Berrange feature_not_found "PAM" "Install PAM development package" 30778953caf3SDaniel P. Berrange else 30788953caf3SDaniel P. Berrange auth_pam=no 30798953caf3SDaniel P. Berrange fi 30808953caf3SDaniel P. Berrange fi 30818953caf3SDaniel P. Berrangefi 30828953caf3SDaniel P. Berrange 30838953caf3SDaniel P. Berrange########################################## 3084559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 3085559607eaSDaniel P. Berrange 3086559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 3087559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 3088559607eaSDaniel P. Berrange have_ifaddrs_h=no 3089559607eaSDaniel P. Berrangefi 3090559607eaSDaniel P. Berrange 3091e865b97fSChen Gang######################################### 3092e865b97fSChen Gang# libdrm check 3093e865b97fSChen Ganghave_drm_h=no 3094e865b97fSChen Gangif check_include "libdrm/drm.h" ; then 3095e865b97fSChen Gang have_drm_h=yes 3096e865b97fSChen Gangfi 3097e865b97fSChen Gang 30982a4b472cSDavid CARLIER######################################### 30992a4b472cSDavid CARLIER# sys/signal.h check 31002a4b472cSDavid CARLIERhave_sys_signal_h=no 31012a4b472cSDavid CARLIERif check_include "sys/signal.h" ; then 31022a4b472cSDavid CARLIER have_sys_signal_h=yes 31032a4b472cSDavid CARLIERfi 31042a4b472cSDavid CARLIER 3105559607eaSDaniel P. Berrange########################################## 3106bbbf9bfbSStefan Weil# VTE probe 3107bbbf9bfbSStefan Weil 3108bbbf9bfbSStefan Weilif test "$vte" != "no"; then 3109c6feff9eSCole Robinson vteminversion="0.32.0" 3110c6feff9eSCole Robinson if $pkg_config --exists "vte-2.91"; then 3111c6feff9eSCole Robinson vtepackage="vte-2.91" 3112c6feff9eSCole Robinson else 3113528de90aSDaniel P. Berrange vtepackage="vte-2.90" 3114c6feff9eSCole Robinson fi 3115c6feff9eSCole Robinson if $pkg_config --exists "$vtepackage >= $vteminversion"; then 311689138857SStefan Weil vte_cflags=$($pkg_config --cflags $vtepackage) 311789138857SStefan Weil vte_libs=$($pkg_config --libs $vtepackage) 311889138857SStefan Weil vteversion=$($pkg_config --modversion $vtepackage) 3119bbbf9bfbSStefan Weil vte="yes" 3120bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 3121c6feff9eSCole Robinson feature_not_found "vte" "Install libvte-2.90/2.91 devel" 31229e04c683SStefan Weil else 3123bbbf9bfbSStefan Weil vte="no" 3124a4ccabcfSAnthony Liguori fi 3125a4ccabcfSAnthony Liguorifi 3126a4ccabcfSAnthony Liguori 3127a4ccabcfSAnthony Liguori########################################## 31282da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 31292da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 31302da776dbSMichael R. Hines cat > $TMPC <<EOF 31312da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 31322da776dbSMichael R. Hinesint main(void) { return 0; } 31332da776dbSMichael R. HinesEOF 3134ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 31352da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 31362da776dbSMichael R. Hines rdma="yes" 31372da776dbSMichael R. Hines else 31382da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 31392da776dbSMichael R. Hines error_exit \ 3140ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 31412da776dbSMichael R. Hines " Your options:" \ 3142ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 31432da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 31442da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 31452da776dbSMichael R. Hines fi 31462da776dbSMichael R. Hines rdma="no" 31472da776dbSMichael R. Hines fi 31482da776dbSMichael R. Hinesfi 31492da776dbSMichael R. Hines 315021ab34c9SMarcel Apfelbaum########################################## 315121ab34c9SMarcel Apfelbaum# PVRDMA detection 315221ab34c9SMarcel Apfelbaum 315321ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 315421ab34c9SMarcel Apfelbaum#include <sys/mman.h> 315521ab34c9SMarcel Apfelbaum 315621ab34c9SMarcel Apfelbaumint 315721ab34c9SMarcel Apfelbaummain(void) 315821ab34c9SMarcel Apfelbaum{ 315921ab34c9SMarcel Apfelbaum char buf = 0; 316021ab34c9SMarcel Apfelbaum void *addr = &buf; 316121ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 316221ab34c9SMarcel Apfelbaum 316321ab34c9SMarcel Apfelbaum return 0; 316421ab34c9SMarcel Apfelbaum} 316521ab34c9SMarcel ApfelbaumEOF 316621ab34c9SMarcel Apfelbaum 316721ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 316821ab34c9SMarcel Apfelbaum case "$pvrdma" in 316921ab34c9SMarcel Apfelbaum "") 317021ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 317121ab34c9SMarcel Apfelbaum pvrdma="yes" 317221ab34c9SMarcel Apfelbaum else 317321ab34c9SMarcel Apfelbaum pvrdma="no" 317421ab34c9SMarcel Apfelbaum fi 317521ab34c9SMarcel Apfelbaum ;; 317621ab34c9SMarcel Apfelbaum "yes") 317721ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 317821ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 317921ab34c9SMarcel Apfelbaum fi 318021ab34c9SMarcel Apfelbaum pvrdma="yes" 318121ab34c9SMarcel Apfelbaum ;; 318221ab34c9SMarcel Apfelbaum "no") 318321ab34c9SMarcel Apfelbaum pvrdma="no" 318421ab34c9SMarcel Apfelbaum ;; 318521ab34c9SMarcel Apfelbaum esac 318621ab34c9SMarcel Apfelbaumelse 318721ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 318821ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 318921ab34c9SMarcel Apfelbaum fi 319021ab34c9SMarcel Apfelbaum pvrdma="no" 319121ab34c9SMarcel Apfelbaumfi 319295c6bff3SBenoît Canet 3193ee108585SYuval Shaia# Let's see if enhanced reg_mr is supported 3194ee108585SYuval Shaiaif test "$pvrdma" = "yes" ; then 3195ee108585SYuval Shaia 3196ee108585SYuval Shaiacat > $TMPC <<EOF && 3197ee108585SYuval Shaia#include <infiniband/verbs.h> 3198ee108585SYuval Shaia 3199ee108585SYuval Shaiaint 3200ee108585SYuval Shaiamain(void) 3201ee108585SYuval Shaia{ 3202ee108585SYuval Shaia struct ibv_mr *mr; 3203ee108585SYuval Shaia struct ibv_pd *pd = NULL; 3204ee108585SYuval Shaia size_t length = 10; 3205ee108585SYuval Shaia uint64_t iova = 0; 3206ee108585SYuval Shaia int access = 0; 3207ee108585SYuval Shaia void *addr = NULL; 3208ee108585SYuval Shaia 3209ee108585SYuval Shaia mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 3210ee108585SYuval Shaia 3211ee108585SYuval Shaia ibv_dereg_mr(mr); 3212ee108585SYuval Shaia 3213ee108585SYuval Shaia return 0; 3214ee108585SYuval Shaia} 3215ee108585SYuval ShaiaEOF 3216ee108585SYuval Shaia if ! compile_prog "" "-libverbs"; then 3217ee108585SYuval Shaia QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 3218ee108585SYuval Shaia fi 3219ee108585SYuval Shaiafi 3220ee108585SYuval Shaia 322195c6bff3SBenoît Canet########################################## 3222c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 3223dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 3224dce512deSChristoph Hellwig cat > $TMPC << EOF 3225ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 3226dce512deSChristoph Hellwig#include <xfs/xfs.h> 3227dce512deSChristoph Hellwigint main(void) 3228dce512deSChristoph Hellwig{ 3229dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 3230dce512deSChristoph Hellwig return 0; 3231dce512deSChristoph Hellwig} 3232dce512deSChristoph HellwigEOF 3233dce512deSChristoph Hellwig if compile_prog "" "" ; then 3234dce512deSChristoph Hellwig xfs="yes" 3235dce512deSChristoph Hellwig else 3236dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 3237e3a6e0daSzhaolichang feature_not_found "xfs" "Install xfsprogs/xfslibs devel" 3238dce512deSChristoph Hellwig fi 3239dce512deSChristoph Hellwig xfs=no 3240dce512deSChristoph Hellwig fi 3241dce512deSChristoph Hellwigfi 3242dce512deSChristoph Hellwig 3243dce512deSChristoph Hellwig########################################## 32448a16d273Sths# vde libraries probe 3245dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 32464baae0acSJuan Quintela vde_libs="-lvdeplug" 32478a16d273Sths cat > $TMPC << EOF 32488a16d273Sths#include <libvdeplug.h> 32494a7f0e06Spbrookint main(void) 32504a7f0e06Spbrook{ 32514a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 3252fea08e08SPeter Maydell char s[] = ""; 3253fea08e08SPeter Maydell vde_open(s, s, &a); 32544a7f0e06Spbrook return 0; 32554a7f0e06Spbrook} 32568a16d273SthsEOF 325752166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 32584baae0acSJuan Quintela vde=yes 3259dfb278bdSJuan Quintela else 3260dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 326121684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3262dfb278bdSJuan Quintela fi 3263dfb278bdSJuan Quintela vde=no 32648a16d273Sths fi 32658a16d273Sthsfi 32668a16d273Sths 32678a16d273Sths########################################## 32680a985b37SVincenzo Maffione# netmap support probe 32690a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 32700a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 32710a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 32720a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 32730a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 327458952137SVincenzo Maffioneif test "$netmap" != "no" ; then 327558952137SVincenzo Maffione cat > $TMPC << EOF 327658952137SVincenzo Maffione#include <inttypes.h> 327758952137SVincenzo Maffione#include <net/if.h> 327858952137SVincenzo Maffione#include <net/netmap.h> 327958952137SVincenzo Maffione#include <net/netmap_user.h> 32800a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 32810a985b37SVincenzo Maffione#error 32820a985b37SVincenzo Maffione#endif 328358952137SVincenzo Maffioneint main(void) { return 0; } 328458952137SVincenzo MaffioneEOF 328558952137SVincenzo Maffione if compile_prog "" "" ; then 328658952137SVincenzo Maffione netmap=yes 328758952137SVincenzo Maffione else 328858952137SVincenzo Maffione if test "$netmap" = "yes" ; then 328958952137SVincenzo Maffione feature_not_found "netmap" 329058952137SVincenzo Maffione fi 329158952137SVincenzo Maffione netmap=no 329258952137SVincenzo Maffione fi 329358952137SVincenzo Maffionefi 329458952137SVincenzo Maffione 329558952137SVincenzo Maffione########################################## 329647e98658SCorey Bryant# libcap-ng library probe 329747e98658SCorey Bryantif test "$cap_ng" != "no" ; then 329847e98658SCorey Bryant cap_libs="-lcap-ng" 329947e98658SCorey Bryant cat > $TMPC << EOF 330047e98658SCorey Bryant#include <cap-ng.h> 330147e98658SCorey Bryantint main(void) 330247e98658SCorey Bryant{ 330347e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 330447e98658SCorey Bryant return 0; 330547e98658SCorey Bryant} 330647e98658SCorey BryantEOF 330747e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 330847e98658SCorey Bryant cap_ng=yes 330947e98658SCorey Bryant else 331047e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 331121684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 331247e98658SCorey Bryant fi 331347e98658SCorey Bryant cap_ng=no 331447e98658SCorey Bryant fi 331547e98658SCorey Bryantfi 331647e98658SCorey Bryant 331747e98658SCorey Bryant########################################## 3318c2de5c91Smalc# Sound support libraries probe 33198f28f3fbSths 332089138857SStefan Weilaudio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3321c2de5c91Smalcfor drv in $audio_drv_list; do 3322c2de5c91Smalc case $drv in 3323e42975a1SGerd Hoffmann alsa | try-alsa) 3324c80a867fSGerd Hoffmann if $pkg_config alsa --exists; then 3325c80a867fSGerd Hoffmann alsa_libs=$($pkg_config alsa --libs) 3326478e943fSPaolo Bonzini alsa_cflags=$($pkg_config alsa --cflags) 3327478e943fSPaolo Bonzini alsa=yes 3328e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3329e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') 3330e42975a1SGerd Hoffmann fi 3331e42975a1SGerd Hoffmann else 3332e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3333e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') 3334c80a867fSGerd Hoffmann else 3335c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3336c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3337c80a867fSGerd Hoffmann fi 3338e42975a1SGerd Hoffmann fi 3339c2de5c91Smalc ;; 3340c2de5c91Smalc 3341e42975a1SGerd Hoffmann pa | try-pa) 3342c80a867fSGerd Hoffmann if $pkg_config libpulse --exists; then 3343478e943fSPaolo Bonzini libpulse=yes 3344c80a867fSGerd Hoffmann pulse_libs=$($pkg_config libpulse --libs) 3345478e943fSPaolo Bonzini pulse_cflags=$($pkg_config libpulse --cflags) 3346e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3347e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') 3348e42975a1SGerd Hoffmann fi 3349e42975a1SGerd Hoffmann else 3350e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3351e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') 3352c80a867fSGerd Hoffmann else 3353c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3354c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3355c80a867fSGerd Hoffmann fi 3356e42975a1SGerd Hoffmann fi 3357b8e59f18Smalc ;; 3358b8e59f18Smalc 3359373967b2SGerd Hoffmann sdl) 3360373967b2SGerd Hoffmann if test "$sdl" = "no"; then 3361373967b2SGerd Hoffmann error_exit "sdl not found or disabled, can not use sdl audio driver" 3362373967b2SGerd Hoffmann fi 3363373967b2SGerd Hoffmann ;; 3364373967b2SGerd Hoffmann 3365e42975a1SGerd Hoffmann try-sdl) 3366e42975a1SGerd Hoffmann if test "$sdl" = "no"; then 3367e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') 3368e42975a1SGerd Hoffmann else 3369e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') 3370e42975a1SGerd Hoffmann fi 3371e42975a1SGerd Hoffmann ;; 3372e42975a1SGerd Hoffmann 3373997e690aSJuan Quintela coreaudio) 3374b1149911SFam Zheng coreaudio_libs="-framework CoreAudio" 3375997e690aSJuan Quintela ;; 3376997e690aSJuan Quintela 3377a4bf6780SJuan Quintela dsound) 3378b1149911SFam Zheng dsound_libs="-lole32 -ldxguid" 3379d5631638Smalc audio_win_int="yes" 3380a4bf6780SJuan Quintela ;; 3381a4bf6780SJuan Quintela 3382a4bf6780SJuan Quintela oss) 3383b1149911SFam Zheng oss_libs="$oss_lib" 3384a4bf6780SJuan Quintela ;; 3385a4bf6780SJuan Quintela 33862e445703SGeoffrey McRae jack | try-jack) 33872e445703SGeoffrey McRae if $pkg_config jack --exists; then 3388478e943fSPaolo Bonzini libjack=yes 33892e445703SGeoffrey McRae jack_libs=$($pkg_config jack --libs) 33902e445703SGeoffrey McRae if test "$drv" = "try-jack"; then 33912e445703SGeoffrey McRae audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') 33922e445703SGeoffrey McRae fi 33932e445703SGeoffrey McRae else 33942e445703SGeoffrey McRae if test "$drv" = "try-jack"; then 33952e445703SGeoffrey McRae audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') 33962e445703SGeoffrey McRae else 33972e445703SGeoffrey McRae error_exit "$drv check failed" \ 33982e445703SGeoffrey McRae "Make sure to have the $drv libs and headers installed." 33992e445703SGeoffrey McRae fi 34002e445703SGeoffrey McRae fi 34012e445703SGeoffrey McRae ;; 34022e445703SGeoffrey McRae 3403e4c63a6aSmalc *) 34041c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 340576ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 340676ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 3407e4c63a6aSmalc } 3408e4c63a6aSmalc ;; 3409c2de5c91Smalc esac 3410c2de5c91Smalcdone 34118f28f3fbSths 34124d3b6f6eSbalrog########################################## 34132e4d9fb1Saurel32# BrlAPI probe 34142e4d9fb1Saurel32 34154ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 3416eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 34172e4d9fb1Saurel32 cat > $TMPC << EOF 34182e4d9fb1Saurel32#include <brlapi.h> 3419832ce9c2SScott Wood#include <stddef.h> 34202e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 34212e4d9fb1Saurel32EOF 342252166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 34232e4d9fb1Saurel32 brlapi=yes 34244ffcedb6SJuan Quintela else 34254ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 342621684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 34274ffcedb6SJuan Quintela fi 34284ffcedb6SJuan Quintela brlapi=no 3429eb82284fSJuan Quintela fi 3430eb82284fSJuan Quintelafi 34312e4d9fb1Saurel32 34322e4d9fb1Saurel32########################################## 3433769ce76dSAlexander Graf# curl probe 3434a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 343565d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 3436a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 34374e2b0658SPaolo Bonzini else 34384e2b0658SPaolo Bonzini curlconfig=curl-config 34394e2b0658SPaolo Bonzini fi 3440769ce76dSAlexander Graf cat > $TMPC << EOF 3441769ce76dSAlexander Graf#include <curl/curl.h> 34420b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3443769ce76dSAlexander GrafEOF 344489138857SStefan Weil curl_cflags=$($curlconfig --cflags 2>/dev/null) 344589138857SStefan Weil curl_libs=$($curlconfig --libs 2>/dev/null) 3446b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 3447769ce76dSAlexander Graf curl=yes 3448788c8196SJuan Quintela else 3449788c8196SJuan Quintela if test "$curl" = "yes" ; then 345021684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 3451788c8196SJuan Quintela fi 3452788c8196SJuan Quintela curl=no 3453769ce76dSAlexander Graf fi 3454769ce76dSAlexander Graffi # test "$curl" 3455769ce76dSAlexander Graf 3456769ce76dSAlexander Graf########################################## 3457e18df141SAnthony Liguori# glib support probe 3458a52d28afSPaolo Bonzini 345900f2cfbbSDaniel P. Berrangéglib_req_ver=2.48 3460aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 3461aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 3462a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 3463aa0d1f44SPaolo Bonzinifi 346454cb65d8SEmilio G. Cotaif test "$plugins" = yes; then 346554cb65d8SEmilio G. Cota glib_modules="$glib_modules gmodule-2.0" 346654cb65d8SEmilio G. Cotafi 3467e26110cfSFam Zheng 3468aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 3469e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 347089138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 347189138857SStefan Weil glib_libs=$($pkg_config --libs $i) 3472e18df141SAnthony Liguori else 3473e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3474e26110cfSFam Zheng fi 3475e26110cfSFam Zhengdone 3476e26110cfSFam Zheng 3477215b0c2fSPaolo Bonzini# This workaround is required due to a bug in pkg-config file for glib as it 3478215b0c2fSPaolo Bonzini# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 3479215b0c2fSPaolo Bonzini 3480215b0c2fSPaolo Bonziniif test "$static" = yes && test "$mingw32" = yes; then 3481215b0c2fSPaolo Bonzini glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags" 3482215b0c2fSPaolo Bonzinifi 3483215b0c2fSPaolo Bonzini 3484f876b765SMarc-André Lureauif $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 3485f876b765SMarc-André Lureau gio=yes 3486f876b765SMarc-André Lureau gio_cflags=$($pkg_config --cflags gio-2.0) 3487f876b765SMarc-André Lureau gio_libs=$($pkg_config --libs gio-2.0) 348825a97a56SMarc-André Lureau gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 34890dba4897SMarc-André Lureau if [ ! -x "$gdbus_codegen" ]; then 34900dba4897SMarc-André Lureau gdbus_codegen= 34910dba4897SMarc-André Lureau fi 3492f876b765SMarc-André Lureauelse 3493f876b765SMarc-André Lureau gio=no 3494f876b765SMarc-André Lureaufi 3495f876b765SMarc-André Lureau 349625a97a56SMarc-André Lureauif $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 349725a97a56SMarc-André Lureau gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 349825a97a56SMarc-André Lureau gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 349925a97a56SMarc-André Lureaufi 350025a97a56SMarc-André Lureau 3501977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 3502977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 3503977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 3504977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 3505977a82abSDaniel P. Berrangecat > $TMPC <<EOF 3506977a82abSDaniel P. Berrange#include <glib.h> 3507977a82abSDaniel P. Berrange#include <unistd.h> 3508977a82abSDaniel P. Berrange 3509977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 3510977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3511977a82abSDaniel P. Berrange 3512977a82abSDaniel P. Berrangeint main(void) { 3513977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3514977a82abSDaniel P. Berrange return 0; 3515977a82abSDaniel P. Berrange} 3516977a82abSDaniel P. BerrangeEOF 3517977a82abSDaniel P. Berrange 3518215b0c2fSPaolo Bonziniif ! compile_prog "$glib_cflags" "$glib_libs" ; then 3519977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3520977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 3521977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 3522977a82abSDaniel P. Berrange "build target" 3523977a82abSDaniel P. Berrangefi 3524977a82abSDaniel P. Berrange 3525bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3526bbbf2e04SJohn Snowcat > $TMPC << EOF 3527bbbf2e04SJohn Snow#include <glib.h> 3528bbbf2e04SJohn Snowint main(void) { return 0; } 3529bbbf2e04SJohn SnowEOF 3530bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3531bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 3532bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 35335770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-Wno-unknown-attributes $CONFIGURE_CFLAGS" 3534bbbf2e04SJohn Snow fi 3535bbbf2e04SJohn Snowfi 3536bbbf2e04SJohn Snow 35379bda600bSEric Blake# Silence clang warnings triggered by glib < 2.57.2 35389bda600bSEric Blakecat > $TMPC << EOF 35399bda600bSEric Blake#include <glib.h> 35409bda600bSEric Blaketypedef struct Foo { 35419bda600bSEric Blake int i; 35429bda600bSEric Blake} Foo; 35439bda600bSEric Blakestatic void foo_free(Foo *f) 35449bda600bSEric Blake{ 35459bda600bSEric Blake g_free(f); 35469bda600bSEric Blake} 35479bda600bSEric BlakeG_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 35489bda600bSEric Blakeint main(void) { return 0; } 35499bda600bSEric BlakeEOF 35509bda600bSEric Blakeif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 35519bda600bSEric Blake if cc_has_warning_flag "-Wno-unused-function"; then 35529bda600bSEric Blake glib_cflags="$glib_cflags -Wno-unused-function" 35535770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function" 35549bda600bSEric Blake fi 35559bda600bSEric Blakefi 35569bda600bSEric Blake 3557e26110cfSFam Zheng########################################## 3558e26110cfSFam Zheng# SHA command probe for modules 3559e26110cfSFam Zhengif test "$modules" = yes; then 3560e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 3561e26110cfSFam Zheng for c in $shacmd_probe; do 35628ccefb91SFam Zheng if has $c; then 3563e26110cfSFam Zheng shacmd="$c" 3564e26110cfSFam Zheng break 3565e26110cfSFam Zheng fi 3566e26110cfSFam Zheng done 3567e26110cfSFam Zheng if test "$shacmd" = ""; then 3568e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3569e26110cfSFam Zheng fi 3570e18df141SAnthony Liguorifi 3571e18df141SAnthony Liguori 3572e18df141SAnthony Liguori########################################## 3573e5d355d1Saliguori# pthread probe 35744b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 35753c529d93Saliguori 3576e5d355d1Saliguoripthread=no 3577414f0dabSblueswir1cat > $TMPC << EOF 35783c529d93Saliguori#include <pthread.h> 35797a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 35807a42bbe4SStefan Weilint main(void) { 35817a42bbe4SStefan Weil pthread_t thread; 35827a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 35837a42bbe4SStefan Weil return 0; 35847a42bbe4SStefan Weil} 3585414f0dabSblueswir1EOF 3586bd00d539SAndreas Färberif compile_prog "" "" ; then 3587bd00d539SAndreas Färber pthread=yes 3588bd00d539SAndreas Färberelse 3589de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 359052166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 3591e5d355d1Saliguori pthread=yes 3592e3c56761SPeter Portante found=no 3593e3c56761SPeter Portante for lib_entry in $LIBS; do 3594e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 3595e3c56761SPeter Portante found=yes 3596e3c56761SPeter Portante break 3597e3c56761SPeter Portante fi 3598e3c56761SPeter Portante done 3599e3c56761SPeter Portante if test "$found" = "no"; then 36005572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 3601e3c56761SPeter Portante fi 3602de65fe0fSSebastian Herbszt break 3603414f0dabSblueswir1 fi 3604de65fe0fSSebastian Herbszt done 3605bd00d539SAndreas Färberfi 3606414f0dabSblueswir1 3607e633a5c6SEric Blakeif test "$mingw32" != yes && test "$pthread" = no; then 360876ad07a4SPeter Maydell error_exit "pthread check failed" \ 360976ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 3610e5d355d1Saliguorifi 3611e5d355d1Saliguori 3612479a5747SRoman Bolshakov# check for pthread_setname_np with thread id 3613479a5747SRoman Bolshakovpthread_setname_np_w_tid=no 36145c312079SDr. David Alan Gilbertcat > $TMPC << EOF 36155c312079SDr. David Alan Gilbert#include <pthread.h> 36165c312079SDr. David Alan Gilbert 36175c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 36185c312079SDr. David Alan Gilbertint main(void) 36195c312079SDr. David Alan Gilbert{ 36205c312079SDr. David Alan Gilbert pthread_t thread; 36215c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 36225c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 36235c312079SDr. David Alan Gilbert return 0; 36245c312079SDr. David Alan Gilbert} 36255c312079SDr. David Alan GilbertEOF 36265c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 3627479a5747SRoman Bolshakov pthread_setname_np_w_tid=yes 3628479a5747SRoman Bolshakovfi 3629479a5747SRoman Bolshakov 3630479a5747SRoman Bolshakov# check for pthread_setname_np without thread id 3631479a5747SRoman Bolshakovpthread_setname_np_wo_tid=no 3632479a5747SRoman Bolshakovcat > $TMPC << EOF 3633479a5747SRoman Bolshakov#include <pthread.h> 3634479a5747SRoman Bolshakov 363512a9b8d8SThomas Huthstatic void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } 3636479a5747SRoman Bolshakovint main(void) 3637479a5747SRoman Bolshakov{ 3638479a5747SRoman Bolshakov pthread_t thread; 3639479a5747SRoman Bolshakov pthread_create(&thread, 0, f, 0); 3640479a5747SRoman Bolshakov return 0; 3641479a5747SRoman Bolshakov} 3642479a5747SRoman BolshakovEOF 3643479a5747SRoman Bolshakovif compile_prog "" "$pthread_lib" ; then 3644479a5747SRoman Bolshakov pthread_setname_np_wo_tid=yes 36455c312079SDr. David Alan Gilbertfi 36465c312079SDr. David Alan Gilbert 3647bf9298b9Saliguori########################################## 3648f27aaf4bSChristian Brunner# rbd probe 3649f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 3650f27aaf4bSChristian Brunner cat > $TMPC <<EOF 3651f27aaf4bSChristian Brunner#include <stdio.h> 3652ad32e9c0SJosh Durgin#include <rbd/librbd.h> 3653f27aaf4bSChristian Brunnerint main(void) { 3654ad32e9c0SJosh Durgin rados_t cluster; 3655ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 3656f27aaf4bSChristian Brunner return 0; 3657f27aaf4bSChristian Brunner} 3658f27aaf4bSChristian BrunnerEOF 3659ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 3660f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 3661f27aaf4bSChristian Brunner rbd=yes 3662f27aaf4bSChristian Brunner else 3663f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 366421684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 3665f27aaf4bSChristian Brunner fi 3666f27aaf4bSChristian Brunner rbd=no 3667f27aaf4bSChristian Brunner fi 3668f27aaf4bSChristian Brunnerfi 3669f27aaf4bSChristian Brunner 3670f27aaf4bSChristian Brunner########################################## 3671b10d49d7SPino Toscano# libssh probe 3672b10d49d7SPino Toscanoif test "$libssh" != "no" ; then 3673b10d49d7SPino Toscano if $pkg_config --exists libssh; then 3674b10d49d7SPino Toscano libssh_cflags=$($pkg_config libssh --cflags) 3675b10d49d7SPino Toscano libssh_libs=$($pkg_config libssh --libs) 3676b10d49d7SPino Toscano libssh=yes 36770a12ec87SRichard W.M. Jones else 3678b10d49d7SPino Toscano if test "$libssh" = "yes" ; then 3679b10d49d7SPino Toscano error_exit "libssh required for --enable-libssh" 36800a12ec87SRichard W.M. Jones fi 3681b10d49d7SPino Toscano libssh=no 36820a12ec87SRichard W.M. Jones fi 36830a12ec87SRichard W.M. Jonesfi 36840a12ec87SRichard W.M. Jones 36850a12ec87SRichard W.M. Jones########################################## 3686b10d49d7SPino Toscano# Check for libssh 0.8 3687b10d49d7SPino Toscano# This is done like this instead of using the LIBSSH_VERSION_* and 3688b10d49d7SPino Toscano# SSH_VERSION_* macros because some distributions in the past shipped 3689b10d49d7SPino Toscano# snapshots of the future 0.8 from Git, and those snapshots did not 3690b10d49d7SPino Toscano# have updated version numbers (still referring to 0.7.0). 36919a2d462eSRichard W.M. Jones 3692b10d49d7SPino Toscanoif test "$libssh" = "yes"; then 36939a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 3694b10d49d7SPino Toscano#include <libssh/libssh.h> 3695b10d49d7SPino Toscanoint main(void) { return ssh_get_server_publickey(NULL, NULL); } 36969a2d462eSRichard W.M. JonesEOF 3697b10d49d7SPino Toscano if compile_prog "$libssh_cflags" "$libssh_libs"; then 3698b10d49d7SPino Toscano libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" 36999a2d462eSRichard W.M. Jones fi 37009a2d462eSRichard W.M. Jonesfi 37019a2d462eSRichard W.M. Jones 37029a2d462eSRichard W.M. Jones########################################## 37035c6c3a6cSChristoph Hellwig# linux-aio probe 37045c6c3a6cSChristoph Hellwig 37055c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 37065c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 37075c6c3a6cSChristoph Hellwig#include <libaio.h> 37085c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 3709832ce9c2SScott Wood#include <stddef.h> 37105c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 37115c6c3a6cSChristoph HellwigEOF 37125c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 37135c6c3a6cSChristoph Hellwig linux_aio=yes 37145c6c3a6cSChristoph Hellwig else 37155c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 371621684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 37175c6c3a6cSChristoph Hellwig fi 37183cfcae3cSLuiz Capitulino linux_aio=no 37195c6c3a6cSChristoph Hellwig fi 37205c6c3a6cSChristoph Hellwigfi 3721c10dd856SAarushi Mehta########################################## 3722c10dd856SAarushi Mehta# linux-io-uring probe 3723c10dd856SAarushi Mehta 3724c10dd856SAarushi Mehtaif test "$linux_io_uring" != "no" ; then 3725c10dd856SAarushi Mehta if $pkg_config liburing; then 3726c10dd856SAarushi Mehta linux_io_uring_cflags=$($pkg_config --cflags liburing) 3727c10dd856SAarushi Mehta linux_io_uring_libs=$($pkg_config --libs liburing) 3728c10dd856SAarushi Mehta linux_io_uring=yes 3729c10dd856SAarushi Mehta else 3730c10dd856SAarushi Mehta if test "$linux_io_uring" = "yes" ; then 3731c10dd856SAarushi Mehta feature_not_found "linux io_uring" "Install liburing devel" 3732c10dd856SAarushi Mehta fi 3733c10dd856SAarushi Mehta linux_io_uring=no 3734c10dd856SAarushi Mehta fi 3735c10dd856SAarushi Mehtafi 37365c6c3a6cSChristoph Hellwig 37375c6c3a6cSChristoph Hellwig########################################## 37387aaa6a16SPaolo Bonzini# TPM emulation is only on POSIX 37393b8acc11SPaolo Bonzini 37407aaa6a16SPaolo Bonziniif test "$tpm" = ""; then 37417aaa6a16SPaolo Bonzini if test "$mingw32" = "yes"; then 37427aaa6a16SPaolo Bonzini tpm=no 37433b8acc11SPaolo Bonzini else 37447aaa6a16SPaolo Bonzini tpm=yes 37457aaa6a16SPaolo Bonzini fi 37467aaa6a16SPaolo Bonzinielif test "$tpm" = "yes"; then 37477aaa6a16SPaolo Bonzini if test "$mingw32" = "yes" ; then 37487aaa6a16SPaolo Bonzini error_exit "TPM emulation only available on POSIX systems" 37497aaa6a16SPaolo Bonzini fi 37503b8acc11SPaolo Bonzinifi 37513b8acc11SPaolo Bonzini 37523b8acc11SPaolo Bonzini########################################## 3753758e8e38SVenkateswararao Jujjuri (JV)# attr probe 3754758e8e38SVenkateswararao Jujjuri (JV) 3755ec0d5893SMarc-André Lureaulibattr_libs= 3756758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 3757758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 3758758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 3759758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 3760f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 3761f2338fb4SPavel Borzenkov#include <attr/xattr.h> 3762f2338fb4SPavel Borzenkov#else 37634f26f2b6SAvi Kivity#include <sys/xattr.h> 3764f2338fb4SPavel Borzenkov#endif 3765758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 3766758e8e38SVenkateswararao Jujjuri (JV)EOF 37674f26f2b6SAvi Kivity if compile_prog "" "" ; then 37684f26f2b6SAvi Kivity attr=yes 37694f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 3770f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 3771758e8e38SVenkateswararao Jujjuri (JV) attr=yes 3772ec0d5893SMarc-André Lureau libattr_libs="-lattr" 37734f26f2b6SAvi Kivity libattr=yes 3774758e8e38SVenkateswararao Jujjuri (JV) else 3775758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 377621684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 3777758e8e38SVenkateswararao Jujjuri (JV) fi 3778758e8e38SVenkateswararao Jujjuri (JV) attr=no 3779758e8e38SVenkateswararao Jujjuri (JV) fi 3780758e8e38SVenkateswararao Jujjuri (JV)fi 3781758e8e38SVenkateswararao Jujjuri (JV) 3782758e8e38SVenkateswararao Jujjuri (JV)########################################## 3783bf9298b9Saliguori# iovec probe 3784bf9298b9Saliguoricat > $TMPC <<EOF 3785db34f0b3Sblueswir1#include <sys/types.h> 3786bf9298b9Saliguori#include <sys/uio.h> 3787db34f0b3Sblueswir1#include <unistd.h> 3788f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 3789bf9298b9SaliguoriEOF 3790bf9298b9Saliguoriiovec=no 379152166aa0SJuan Quintelaif compile_prog "" "" ; then 3792bf9298b9Saliguori iovec=yes 3793bf9298b9Saliguorifi 3794bf9298b9Saliguori 3795f652e6afSaurel32########################################## 3796ceb42de8Saliguori# preadv probe 3797ceb42de8Saliguoricat > $TMPC <<EOF 3798ceb42de8Saliguori#include <sys/types.h> 3799ceb42de8Saliguori#include <sys/uio.h> 3800ceb42de8Saliguori#include <unistd.h> 3801c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 3802ceb42de8SaliguoriEOF 3803ceb42de8Saliguoripreadv=no 380452166aa0SJuan Quintelaif compile_prog "" "" ; then 3805ceb42de8Saliguori preadv=yes 3806ceb42de8Saliguorifi 3807ceb42de8Saliguori 3808ceb42de8Saliguori########################################## 3809f652e6afSaurel32# fdt probe 3810e169e1e1SPeter Maydell 3811fbb4121dSPaolo Bonzinicase "$fdt" in 3812fbb4121dSPaolo Bonzini auto | enabled | internal) 3813fbb4121dSPaolo Bonzini # Simpler to always update submodule, even if not needed. 3814fbb4121dSPaolo Bonzini if test -e "${source_path}/.git" && test $git_update = 'yes' ; then 3815aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 3816aef45d51SDaniel P. Berrange fi 3817fbb4121dSPaolo Bonzini ;; 3818fbb4121dSPaolo Bonziniesac 3819f652e6afSaurel32 382020ff075bSMichael Walle########################################## 3821fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 3822b1546f32SGerd Hoffmann 3823d52c454aSMarc-André Lureaugbm="no" 3824d52c454aSMarc-André Lureauif $pkg_config gbm; then 3825d52c454aSMarc-André Lureau gbm_cflags="$($pkg_config --cflags gbm)" 3826d52c454aSMarc-André Lureau gbm_libs="$($pkg_config --libs gbm)" 3827d52c454aSMarc-André Lureau gbm="yes" 3828d52c454aSMarc-André Lureaufi 3829d52c454aSMarc-André Lureau 3830da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 38314939a1dfSMichael Tokarev opengl_pkgs="epoxy gbm" 38325f9b1e35SGerd Hoffmann if $pkg_config $opengl_pkgs; then 38335f9b1e35SGerd Hoffmann opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 38345f9b1e35SGerd Hoffmann opengl_libs="$($pkg_config --libs $opengl_pkgs)" 3835da076ffeSGerd Hoffmann opengl=yes 3836925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 3837925a0400SGerd Hoffmann gtk_gl="yes" 3838925a0400SGerd Hoffmann fi 383920ff075bSMichael Walle else 3840da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3841dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 384220ff075bSMichael Walle fi 3843f676c67eSJeremy White opengl_cflags="" 3844da076ffeSGerd Hoffmann opengl_libs="" 3845da076ffeSGerd Hoffmann opengl=no 384620ff075bSMichael Walle fi 384720ff075bSMichael Wallefi 384820ff075bSMichael Walle 3849014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 3850014cb152SGerd Hoffmann cat > $TMPC << EOF 3851014cb152SGerd Hoffmann#include <epoxy/egl.h> 3852014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 3853014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 3854014cb152SGerd Hoffmann#endif 3855014cb152SGerd Hoffmannint main(void) { return 0; } 3856014cb152SGerd HoffmannEOF 3857014cb152SGerd Hoffmann if compile_prog "" "" ; then 3858014cb152SGerd Hoffmann opengl_dmabuf=yes 3859014cb152SGerd Hoffmann fi 3860014cb152SGerd Hoffmannfi 3861c9a12e75SChrysostomos Nanakos 3862e633a5c6SEric Blakeif test "$opengl" = "yes" && test "$have_x11" = "yes"; then 386399e1a93bSPhilippe Mathieu-Daudé for target in $target_list; do 386499e1a93bSPhilippe Mathieu-Daudé case $target in 386599e1a93bSPhilippe Mathieu-Daudé lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL 386699e1a93bSPhilippe Mathieu-Daudé need_x11=yes 386799e1a93bSPhilippe Mathieu-Daudé ;; 386899e1a93bSPhilippe Mathieu-Daudé esac 386999e1a93bSPhilippe Mathieu-Daudé done 387099e1a93bSPhilippe Mathieu-Daudéfi 387199e1a93bSPhilippe Mathieu-Daudé 3872ed279a06SKlim Kireev########################################## 3873ed279a06SKlim Kireev# libxml2 probe 3874ed279a06SKlim Kireevif test "$libxml2" != "no" ; then 3875ed279a06SKlim Kireev if $pkg_config --exists libxml-2.0; then 3876ed279a06SKlim Kireev libxml2="yes" 3877ed279a06SKlim Kireev libxml2_cflags=$($pkg_config --cflags libxml-2.0) 3878ed279a06SKlim Kireev libxml2_libs=$($pkg_config --libs libxml-2.0) 3879ed279a06SKlim Kireev else 3880ed279a06SKlim Kireev if test "$libxml2" = "yes"; then 3881ed279a06SKlim Kireev feature_not_found "libxml2" "Install libxml2 devel" 3882ed279a06SKlim Kireev fi 3883ed279a06SKlim Kireev libxml2="no" 3884ed279a06SKlim Kireev fi 3885ed279a06SKlim Kireevfi 3886c9a12e75SChrysostomos Nanakos 3887eb100396SBharata B Rao########################################## 3888eb100396SBharata B Rao# glusterfs probe 3889eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 389065d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 3891e01bee08SBharata B Rao glusterfs="yes" 389289138857SStefan Weil glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 389389138857SStefan Weil glusterfs_libs=$($pkg_config --libs glusterfs-api) 3894d85fa9ebSJeff Cody if $pkg_config --atleast-version=4 glusterfs-api; then 3895d85fa9ebSJeff Cody glusterfs_xlator_opt="yes" 3896d85fa9ebSJeff Cody fi 389765d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 38980c14fb47SBharata B Rao glusterfs_discard="yes" 38990c14fb47SBharata B Rao fi 39007c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 3901df3a429aSNiels de Vos glusterfs_fallocate="yes" 39027c815372SBharata B Rao glusterfs_zerofill="yes" 39037c815372SBharata B Rao fi 3904e014dbe7SPrasanna Kumar Kalever cat > $TMPC << EOF 3905e014dbe7SPrasanna Kumar Kalever#include <glusterfs/api/glfs.h> 3906e014dbe7SPrasanna Kumar Kalever 3907e014dbe7SPrasanna Kumar Kaleverint 3908e014dbe7SPrasanna Kumar Kalevermain(void) 3909e014dbe7SPrasanna Kumar Kalever{ 3910e014dbe7SPrasanna Kumar Kalever /* new glfs_ftruncate() passes two additional args */ 3911e014dbe7SPrasanna Kumar Kalever return glfs_ftruncate(NULL, 0, NULL, NULL); 3912e014dbe7SPrasanna Kumar Kalever} 3913e014dbe7SPrasanna Kumar KaleverEOF 3914e014dbe7SPrasanna Kumar Kalever if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 3915e014dbe7SPrasanna Kumar Kalever glusterfs_ftruncate_has_stat="yes" 3916e014dbe7SPrasanna Kumar Kalever fi 39170e3b891fSNiels de Vos cat > $TMPC << EOF 39180e3b891fSNiels de Vos#include <glusterfs/api/glfs.h> 39190e3b891fSNiels de Vos 39200e3b891fSNiels de Vos/* new glfs_io_cbk() passes two additional glfs_stat structs */ 39210e3b891fSNiels de Vosstatic void 39220e3b891fSNiels de Vosglusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) 39230e3b891fSNiels de Vos{} 39240e3b891fSNiels de Vos 39250e3b891fSNiels de Vosint 39260e3b891fSNiels de Vosmain(void) 39270e3b891fSNiels de Vos{ 39280e3b891fSNiels de Vos glfs_io_cbk iocb = &glusterfs_iocb; 39290e3b891fSNiels de Vos iocb(NULL, 0 , NULL, NULL, NULL); 39300e3b891fSNiels de Vos return 0; 39310e3b891fSNiels de Vos} 39320e3b891fSNiels de VosEOF 39330e3b891fSNiels de Vos if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 39340e3b891fSNiels de Vos glusterfs_iocb_has_stat="yes" 39350e3b891fSNiels de Vos fi 3936eb100396SBharata B Rao else 3937eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 39388efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 39398efc9363SHu Tao "Install glusterfs-api devel >= 3" 3940eb100396SBharata B Rao fi 3941e01bee08SBharata B Rao glusterfs="no" 3942eb100396SBharata B Rao fi 3943eb100396SBharata B Raofi 3944eb100396SBharata B Rao 394539386ac7Saurel32# Check for inotify functions when we are building linux-user 39463b3f24adSaurel32# emulator. This is done because older glibc versions don't 39473b3f24adSaurel32# have syscall stubs for these implemented. In that case we 39483b3f24adSaurel32# don't provide them even if kernel supports them. 39493b3f24adSaurel32# 39503b3f24adSaurel32inotify=no 39513b3f24adSaurel32cat > $TMPC << EOF 39523b3f24adSaurel32#include <sys/inotify.h> 39533b3f24adSaurel32 39543b3f24adSaurel32int 39553b3f24adSaurel32main(void) 39563b3f24adSaurel32{ 39573b3f24adSaurel32 /* try to start inotify */ 39588690e420Saurel32 return inotify_init(); 39593b3f24adSaurel32} 39603b3f24adSaurel32EOF 396152166aa0SJuan Quintelaif compile_prog "" "" ; then 39623b3f24adSaurel32 inotify=yes 39633b3f24adSaurel32fi 39643b3f24adSaurel32 3965c05c7a73SRiku Voipioinotify1=no 3966c05c7a73SRiku Voipiocat > $TMPC << EOF 3967c05c7a73SRiku Voipio#include <sys/inotify.h> 3968c05c7a73SRiku Voipio 3969c05c7a73SRiku Voipioint 3970c05c7a73SRiku Voipiomain(void) 3971c05c7a73SRiku Voipio{ 3972c05c7a73SRiku Voipio /* try to start inotify */ 3973c05c7a73SRiku Voipio return inotify_init1(0); 3974c05c7a73SRiku Voipio} 3975c05c7a73SRiku VoipioEOF 3976c05c7a73SRiku Voipioif compile_prog "" "" ; then 3977c05c7a73SRiku Voipio inotify1=yes 3978c05c7a73SRiku Voipiofi 3979c05c7a73SRiku Voipio 3980099d6b0fSRiku Voipio# check if pipe2 is there 3981099d6b0fSRiku Voipiopipe2=no 3982099d6b0fSRiku Voipiocat > $TMPC << EOF 3983099d6b0fSRiku Voipio#include <unistd.h> 3984099d6b0fSRiku Voipio#include <fcntl.h> 3985099d6b0fSRiku Voipio 3986099d6b0fSRiku Voipioint main(void) 3987099d6b0fSRiku Voipio{ 3988099d6b0fSRiku Voipio int pipefd[2]; 39899bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 3990099d6b0fSRiku Voipio} 3991099d6b0fSRiku VoipioEOF 399252166aa0SJuan Quintelaif compile_prog "" "" ; then 3993099d6b0fSRiku Voipio pipe2=yes 3994099d6b0fSRiku Voipiofi 3995099d6b0fSRiku Voipio 399640ff6d7eSKevin Wolf# check if accept4 is there 399740ff6d7eSKevin Wolfaccept4=no 399840ff6d7eSKevin Wolfcat > $TMPC << EOF 399940ff6d7eSKevin Wolf#include <sys/socket.h> 400040ff6d7eSKevin Wolf#include <stddef.h> 400140ff6d7eSKevin Wolf 400240ff6d7eSKevin Wolfint main(void) 400340ff6d7eSKevin Wolf{ 400440ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 400540ff6d7eSKevin Wolf return 0; 400640ff6d7eSKevin Wolf} 400740ff6d7eSKevin WolfEOF 400840ff6d7eSKevin Wolfif compile_prog "" "" ; then 400940ff6d7eSKevin Wolf accept4=yes 401040ff6d7eSKevin Wolffi 401140ff6d7eSKevin Wolf 40123ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 40133ce34dfbSvibisreenivasansplice=no 40143ce34dfbSvibisreenivasancat > $TMPC << EOF 40153ce34dfbSvibisreenivasan#include <unistd.h> 40163ce34dfbSvibisreenivasan#include <fcntl.h> 40173ce34dfbSvibisreenivasan#include <limits.h> 40183ce34dfbSvibisreenivasan 40193ce34dfbSvibisreenivasanint main(void) 40203ce34dfbSvibisreenivasan{ 402166ea0f22SStefan Weil int len, fd = 0; 40223ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 40233ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 40243ce34dfbSvibisreenivasan return 0; 40253ce34dfbSvibisreenivasan} 40263ce34dfbSvibisreenivasanEOF 402752166aa0SJuan Quintelaif compile_prog "" "" ; then 40283ce34dfbSvibisreenivasan splice=yes 40293ce34dfbSvibisreenivasanfi 40303ce34dfbSvibisreenivasan 4031dcc38d1cSMarcelo Tosatti########################################## 4032a99d57bbSWanlong Gao# libnuma probe 4033a99d57bbSWanlong Gao 4034a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 4035a99d57bbSWanlong Gao cat > $TMPC << EOF 4036a99d57bbSWanlong Gao#include <numa.h> 4037a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 4038a99d57bbSWanlong GaoEOF 4039a99d57bbSWanlong Gao 4040a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 4041a99d57bbSWanlong Gao numa=yes 4042ab318051SMarc-André Lureau numa_libs="-lnuma" 4043a99d57bbSWanlong Gao else 4044a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 4045a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 4046a99d57bbSWanlong Gao fi 4047a99d57bbSWanlong Gao numa=no 4048a99d57bbSWanlong Gao fi 4049a99d57bbSWanlong Gaofi 4050a99d57bbSWanlong Gao 4051aa087962SPaolo Bonzinimalloc=system 40527b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 40537b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 40547b01cb97SAlexandre Derumier exit 1 4055aa087962SPaolo Bonzinielif test "$tcmalloc" = "yes" ; then 4056aa087962SPaolo Bonzini malloc=tcmalloc 4057aa087962SPaolo Bonzinielif test "$jemalloc" = "yes" ; then 4058aa087962SPaolo Bonzini malloc=jemalloc 40597b01cb97SAlexandre Derumierfi 40607b01cb97SAlexandre Derumier 40617b01cb97SAlexandre Derumier########################################## 4062dcc38d1cSMarcelo Tosatti# signalfd probe 4063dcc38d1cSMarcelo Tosattisignalfd="no" 4064dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 4065dcc38d1cSMarcelo Tosatti#include <unistd.h> 4066dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 4067dcc38d1cSMarcelo Tosatti#include <signal.h> 4068dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4069dcc38d1cSMarcelo TosattiEOF 4070dcc38d1cSMarcelo Tosatti 4071dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 4072dcc38d1cSMarcelo Tosatti signalfd=yes 4073dcc38d1cSMarcelo Tosattifi 4074dcc38d1cSMarcelo Tosatti 4075d339d766SRichard W.M. Jones# check if optreset global is declared by <getopt.h> 4076d339d766SRichard W.M. Jonesoptreset="no" 4077d339d766SRichard W.M. Jonescat > $TMPC << EOF 4078d339d766SRichard W.M. Jones#include <getopt.h> 4079d339d766SRichard W.M. Jonesint main(void) { return optreset; } 4080d339d766SRichard W.M. JonesEOF 4081d339d766SRichard W.M. Jones 4082d339d766SRichard W.M. Jonesif compile_prog "" "" ; then 4083d339d766SRichard W.M. Jones optreset=yes 4084d339d766SRichard W.M. Jonesfi 4085d339d766SRichard W.M. Jones 4086c2882b96SRiku Voipio# check if eventfd is supported 4087c2882b96SRiku Voipioeventfd=no 4088c2882b96SRiku Voipiocat > $TMPC << EOF 4089c2882b96SRiku Voipio#include <sys/eventfd.h> 4090c2882b96SRiku Voipio 4091c2882b96SRiku Voipioint main(void) 4092c2882b96SRiku Voipio{ 409355cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4094c2882b96SRiku Voipio} 4095c2882b96SRiku VoipioEOF 4096c2882b96SRiku Voipioif compile_prog "" "" ; then 4097c2882b96SRiku Voipio eventfd=yes 4098c2882b96SRiku Voipiofi 4099c2882b96SRiku Voipio 4100751bcc39SMarc-André Lureau# check if memfd is supported 4101751bcc39SMarc-André Lureaumemfd=no 4102751bcc39SMarc-André Lureaucat > $TMPC << EOF 410375e5b70eSPaolo Bonzini#include <sys/mman.h> 4104751bcc39SMarc-André Lureau 4105751bcc39SMarc-André Lureauint main(void) 4106751bcc39SMarc-André Lureau{ 4107751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 4108751bcc39SMarc-André Lureau} 4109751bcc39SMarc-André LureauEOF 4110751bcc39SMarc-André Lureauif compile_prog "" "" ; then 4111751bcc39SMarc-André Lureau memfd=yes 4112751bcc39SMarc-André Lureaufi 4113751bcc39SMarc-André Lureau 4114955727d2SCortland Tölva# check for usbfs 4115955727d2SCortland Tölvahave_usbfs=no 4116955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 411796566d09SThomas Petazzoni cat > $TMPC << EOF 411896566d09SThomas Petazzoni#include <linux/usbdevice_fs.h> 411996566d09SThomas Petazzoni 412096566d09SThomas Petazzoni#ifndef USBDEVFS_GET_CAPABILITIES 412196566d09SThomas Petazzoni#error "USBDEVFS_GET_CAPABILITIES undefined" 412296566d09SThomas Petazzoni#endif 412396566d09SThomas Petazzoni 412496566d09SThomas Petazzoni#ifndef USBDEVFS_DISCONNECT_CLAIM 412596566d09SThomas Petazzoni#error "USBDEVFS_DISCONNECT_CLAIM undefined" 412696566d09SThomas Petazzoni#endif 412796566d09SThomas Petazzoni 412896566d09SThomas Petazzoniint main(void) 412996566d09SThomas Petazzoni{ 413096566d09SThomas Petazzoni return 0; 413196566d09SThomas Petazzoni} 413296566d09SThomas PetazzoniEOF 413396566d09SThomas Petazzoni if compile_prog "" ""; then 4134955727d2SCortland Tölva have_usbfs=yes 4135955727d2SCortland Tölva fi 4136955727d2SCortland Tölvafi 4137751bcc39SMarc-André Lureau 4138d0927938SUlrich Hecht# check for fallocate 4139d0927938SUlrich Hechtfallocate=no 4140d0927938SUlrich Hechtcat > $TMPC << EOF 4141d0927938SUlrich Hecht#include <fcntl.h> 4142d0927938SUlrich Hecht 4143d0927938SUlrich Hechtint main(void) 4144d0927938SUlrich Hecht{ 4145d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 4146d0927938SUlrich Hecht return 0; 4147d0927938SUlrich Hecht} 4148d0927938SUlrich HechtEOF 41498fb03151SPeter Maydellif compile_prog "" "" ; then 4150d0927938SUlrich Hecht fallocate=yes 4151d0927938SUlrich Hechtfi 4152d0927938SUlrich Hecht 41533d4fa43eSKusanagi Kouichi# check for fallocate hole punching 41543d4fa43eSKusanagi Kouichifallocate_punch_hole=no 41553d4fa43eSKusanagi Kouichicat > $TMPC << EOF 41563d4fa43eSKusanagi Kouichi#include <fcntl.h> 41573d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 41583d4fa43eSKusanagi Kouichi 41593d4fa43eSKusanagi Kouichiint main(void) 41603d4fa43eSKusanagi Kouichi{ 41613d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 41623d4fa43eSKusanagi Kouichi return 0; 41633d4fa43eSKusanagi Kouichi} 41643d4fa43eSKusanagi KouichiEOF 41653d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 41663d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 41673d4fa43eSKusanagi Kouichifi 41683d4fa43eSKusanagi Kouichi 4169b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 4170b953f075SDenis V. Lunevfallocate_zero_range=no 4171b953f075SDenis V. Lunevcat > $TMPC << EOF 4172b953f075SDenis V. Lunev#include <fcntl.h> 4173b953f075SDenis V. Lunev#include <linux/falloc.h> 4174b953f075SDenis V. Lunev 4175b953f075SDenis V. Lunevint main(void) 4176b953f075SDenis V. Lunev{ 4177b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4178b953f075SDenis V. Lunev return 0; 4179b953f075SDenis V. Lunev} 4180b953f075SDenis V. LunevEOF 4181b953f075SDenis V. Lunevif compile_prog "" "" ; then 4182b953f075SDenis V. Lunev fallocate_zero_range=yes 4183b953f075SDenis V. Lunevfi 4184b953f075SDenis V. Lunev 4185ed911435SKevin Wolf# check for posix_fallocate 4186ed911435SKevin Wolfposix_fallocate=no 4187ed911435SKevin Wolfcat > $TMPC << EOF 4188ed911435SKevin Wolf#include <fcntl.h> 4189ed911435SKevin Wolf 4190ed911435SKevin Wolfint main(void) 4191ed911435SKevin Wolf{ 4192ed911435SKevin Wolf posix_fallocate(0, 0, 0); 4193ed911435SKevin Wolf return 0; 4194ed911435SKevin Wolf} 4195ed911435SKevin WolfEOF 4196ed911435SKevin Wolfif compile_prog "" "" ; then 4197ed911435SKevin Wolf posix_fallocate=yes 4198ed911435SKevin Wolffi 4199ed911435SKevin Wolf 4200c727f47dSPeter Maydell# check for sync_file_range 4201c727f47dSPeter Maydellsync_file_range=no 4202c727f47dSPeter Maydellcat > $TMPC << EOF 4203c727f47dSPeter Maydell#include <fcntl.h> 4204c727f47dSPeter Maydell 4205c727f47dSPeter Maydellint main(void) 4206c727f47dSPeter Maydell{ 4207c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 4208c727f47dSPeter Maydell return 0; 4209c727f47dSPeter Maydell} 4210c727f47dSPeter MaydellEOF 42118fb03151SPeter Maydellif compile_prog "" "" ; then 4212c727f47dSPeter Maydell sync_file_range=yes 4213c727f47dSPeter Maydellfi 4214c727f47dSPeter Maydell 4215dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 4216dace20dcSPeter Maydellfiemap=no 4217dace20dcSPeter Maydellcat > $TMPC << EOF 4218dace20dcSPeter Maydell#include <sys/ioctl.h> 4219dace20dcSPeter Maydell#include <linux/fs.h> 4220dace20dcSPeter Maydell#include <linux/fiemap.h> 4221dace20dcSPeter Maydell 4222dace20dcSPeter Maydellint main(void) 4223dace20dcSPeter Maydell{ 4224dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 4225dace20dcSPeter Maydell return 0; 4226dace20dcSPeter Maydell} 4227dace20dcSPeter MaydellEOF 42288fb03151SPeter Maydellif compile_prog "" "" ; then 4229dace20dcSPeter Maydell fiemap=yes 4230dace20dcSPeter Maydellfi 4231dace20dcSPeter Maydell 4232d0927938SUlrich Hecht# check for dup3 4233d0927938SUlrich Hechtdup3=no 4234d0927938SUlrich Hechtcat > $TMPC << EOF 4235d0927938SUlrich Hecht#include <unistd.h> 4236d0927938SUlrich Hecht 4237d0927938SUlrich Hechtint main(void) 4238d0927938SUlrich Hecht{ 4239d0927938SUlrich Hecht dup3(0, 0, 0); 4240d0927938SUlrich Hecht return 0; 4241d0927938SUlrich Hecht} 4242d0927938SUlrich HechtEOF 424378f5d726SJan Kiszkaif compile_prog "" "" ; then 4244d0927938SUlrich Hecht dup3=yes 4245d0927938SUlrich Hechtfi 4246d0927938SUlrich Hecht 42474e0c6529SAlex Bligh# check for ppoll support 42484e0c6529SAlex Blighppoll=no 42494e0c6529SAlex Blighcat > $TMPC << EOF 42504e0c6529SAlex Bligh#include <poll.h> 42514e0c6529SAlex Bligh 42524e0c6529SAlex Blighint main(void) 42534e0c6529SAlex Bligh{ 42544e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 42554e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 42564e0c6529SAlex Bligh return 0; 42574e0c6529SAlex Bligh} 42584e0c6529SAlex BlighEOF 42594e0c6529SAlex Blighif compile_prog "" "" ; then 42604e0c6529SAlex Bligh ppoll=yes 42614e0c6529SAlex Blighfi 42624e0c6529SAlex Bligh 4263cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 4264cd758dd0SAlex Blighprctl_pr_set_timerslack=no 4265cd758dd0SAlex Blighcat > $TMPC << EOF 4266cd758dd0SAlex Bligh#include <sys/prctl.h> 4267cd758dd0SAlex Bligh 4268cd758dd0SAlex Blighint main(void) 4269cd758dd0SAlex Bligh{ 4270cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4271cd758dd0SAlex Bligh return 0; 4272cd758dd0SAlex Bligh} 4273cd758dd0SAlex BlighEOF 4274cd758dd0SAlex Blighif compile_prog "" "" ; then 4275cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 4276cd758dd0SAlex Blighfi 4277cd758dd0SAlex Bligh 42783b6edd16SPeter Maydell# check for epoll support 42793b6edd16SPeter Maydellepoll=no 42803b6edd16SPeter Maydellcat > $TMPC << EOF 42813b6edd16SPeter Maydell#include <sys/epoll.h> 42823b6edd16SPeter Maydell 42833b6edd16SPeter Maydellint main(void) 42843b6edd16SPeter Maydell{ 42853b6edd16SPeter Maydell epoll_create(0); 42863b6edd16SPeter Maydell return 0; 42873b6edd16SPeter Maydell} 42883b6edd16SPeter MaydellEOF 42898fb03151SPeter Maydellif compile_prog "" "" ; then 42903b6edd16SPeter Maydell epoll=yes 42913b6edd16SPeter Maydellfi 42923b6edd16SPeter Maydell 4293227f0214SPeter Maydell# epoll_create1 is a later addition 4294227f0214SPeter Maydell# so we must check separately for its presence 42953b6edd16SPeter Maydellepoll_create1=no 42963b6edd16SPeter Maydellcat > $TMPC << EOF 42973b6edd16SPeter Maydell#include <sys/epoll.h> 42983b6edd16SPeter Maydell 42993b6edd16SPeter Maydellint main(void) 43003b6edd16SPeter Maydell{ 430119e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 430219e83f6bSPeter Maydell * a function being called. This is necessary so that on 430319e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 430419e83f6bSPeter Maydell * the library but not declared in the header file we will 430519e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 430619e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 430719e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 430819e83f6bSPeter Maydell */ 4309c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 43103b6edd16SPeter Maydell} 43113b6edd16SPeter MaydellEOF 43128fb03151SPeter Maydellif compile_prog "" "" ; then 43133b6edd16SPeter Maydell epoll_create1=yes 43143b6edd16SPeter Maydellfi 43153b6edd16SPeter Maydell 4316a8fd1abaSPeter Maydell# check for sendfile support 4317a8fd1abaSPeter Maydellsendfile=no 4318a8fd1abaSPeter Maydellcat > $TMPC << EOF 4319a8fd1abaSPeter Maydell#include <sys/sendfile.h> 4320a8fd1abaSPeter Maydell 4321a8fd1abaSPeter Maydellint main(void) 4322a8fd1abaSPeter Maydell{ 4323a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 4324a8fd1abaSPeter Maydell} 4325a8fd1abaSPeter MaydellEOF 4326a8fd1abaSPeter Maydellif compile_prog "" "" ; then 4327a8fd1abaSPeter Maydell sendfile=yes 4328a8fd1abaSPeter Maydellfi 4329a8fd1abaSPeter Maydell 433051834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 433151834341SRiku Voipiotimerfd=no 433251834341SRiku Voipiocat > $TMPC << EOF 433351834341SRiku Voipio#include <sys/timerfd.h> 433451834341SRiku Voipio 433551834341SRiku Voipioint main(void) 433651834341SRiku Voipio{ 433751834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 433851834341SRiku Voipio} 433951834341SRiku VoipioEOF 434051834341SRiku Voipioif compile_prog "" "" ; then 434151834341SRiku Voipio timerfd=yes 434251834341SRiku Voipiofi 434351834341SRiku Voipio 43449af5c906SRiku Voipio# check for setns and unshare support 43459af5c906SRiku Voipiosetns=no 43469af5c906SRiku Voipiocat > $TMPC << EOF 43479af5c906SRiku Voipio#include <sched.h> 43489af5c906SRiku Voipio 43499af5c906SRiku Voipioint main(void) 43509af5c906SRiku Voipio{ 43519af5c906SRiku Voipio int ret; 43529af5c906SRiku Voipio ret = setns(0, 0); 43539af5c906SRiku Voipio ret = unshare(0); 43549af5c906SRiku Voipio return ret; 43559af5c906SRiku Voipio} 43569af5c906SRiku VoipioEOF 43579af5c906SRiku Voipioif compile_prog "" "" ; then 43589af5c906SRiku Voipio setns=yes 43599af5c906SRiku Voipiofi 43609af5c906SRiku Voipio 436138860a03SAleksandar Markovic# clock_adjtime probe 436238860a03SAleksandar Markovicclock_adjtime=no 436338860a03SAleksandar Markoviccat > $TMPC <<EOF 436438860a03SAleksandar Markovic#include <time.h> 436538860a03SAleksandar Markovic 436638860a03SAleksandar Markovicint main(void) 436738860a03SAleksandar Markovic{ 436838860a03SAleksandar Markovic return clock_adjtime(0, 0); 436938860a03SAleksandar Markovic} 437038860a03SAleksandar MarkovicEOF 437138860a03SAleksandar Markovicclock_adjtime=no 437238860a03SAleksandar Markovicif compile_prog "" "" ; then 437338860a03SAleksandar Markovic clock_adjtime=yes 437438860a03SAleksandar Markovicfi 437538860a03SAleksandar Markovic 43765a03cd00SAleksandar Markovic# syncfs probe 43775a03cd00SAleksandar Markovicsyncfs=no 43785a03cd00SAleksandar Markoviccat > $TMPC <<EOF 43795a03cd00SAleksandar Markovic#include <unistd.h> 43805a03cd00SAleksandar Markovic 43815a03cd00SAleksandar Markovicint main(void) 43825a03cd00SAleksandar Markovic{ 43835a03cd00SAleksandar Markovic return syncfs(0); 43845a03cd00SAleksandar Markovic} 43855a03cd00SAleksandar MarkovicEOF 43865a03cd00SAleksandar Markovicsyncfs=no 43875a03cd00SAleksandar Markovicif compile_prog "" "" ; then 43885a03cd00SAleksandar Markovic syncfs=yes 43895a03cd00SAleksandar Markovicfi 43905a03cd00SAleksandar Markovic 4391db37dd89SAleksandar Markovic# check for kcov support (kernel must be 4.4+, compiled with certain options) 4392db37dd89SAleksandar Markovickcov=no 4393db37dd89SAleksandar Markovicif check_include sys/kcov.h ; then 4394db37dd89SAleksandar Markovic kcov=yes 4395db37dd89SAleksandar Markovicfi 4396db37dd89SAleksandar Markovic 4397d6092e08SFilip Bozuta# check for btrfs filesystem support (kernel must be 3.9+) 4398d6092e08SFilip Bozutabtrfs=no 4399d6092e08SFilip Bozutaif check_include linux/btrfs.h ; then 4400d6092e08SFilip Bozuta btrfs=yes 4401d6092e08SFilip Bozutafi 4402d6092e08SFilip Bozuta 4403f514f41cSStefan Weil# Search for bswap_32 function 44046ae9a1f4SJuan Quintelabyteswap_h=no 44056ae9a1f4SJuan Quintelacat > $TMPC << EOF 44066ae9a1f4SJuan Quintela#include <byteswap.h> 44076ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 44086ae9a1f4SJuan QuintelaEOF 440952166aa0SJuan Quintelaif compile_prog "" "" ; then 44106ae9a1f4SJuan Quintela byteswap_h=yes 44116ae9a1f4SJuan Quintelafi 44126ae9a1f4SJuan Quintela 441375f13596SStefan Weil# Search for bswap32 function 44146ae9a1f4SJuan Quintelabswap_h=no 44156ae9a1f4SJuan Quintelacat > $TMPC << EOF 44166ae9a1f4SJuan Quintela#include <sys/endian.h> 44176ae9a1f4SJuan Quintela#include <sys/types.h> 44186ae9a1f4SJuan Quintela#include <machine/bswap.h> 44196ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 44206ae9a1f4SJuan QuintelaEOF 442152166aa0SJuan Quintelaif compile_prog "" "" ; then 44226ae9a1f4SJuan Quintela bswap_h=yes 44236ae9a1f4SJuan Quintelafi 44246ae9a1f4SJuan Quintela 4425da93a1fdSaliguori########################################## 4426e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 4427c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 4428e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 44293c33ea96SPaolo Bonzini libiscsi="yes" 4430ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 4431ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 4432c589b249SRonnie Sahlberg else 4433c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 4434e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 4435c589b249SRonnie Sahlberg fi 4436c589b249SRonnie Sahlberg libiscsi="no" 4437c589b249SRonnie Sahlberg fi 4438c589b249SRonnie Sahlbergfi 4439c589b249SRonnie Sahlberg 4440c589b249SRonnie Sahlberg########################################## 4441da93a1fdSaliguori# Do we need librt 44428bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 44438bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 44448bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 44458bacde8dSNatanael Copa# function in addition. 4446da93a1fdSaliguoricat > $TMPC <<EOF 4447da93a1fdSaliguori#include <signal.h> 4448da93a1fdSaliguori#include <time.h> 44498bacde8dSNatanael Copaint main(void) { 44508bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 44518bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 44528bacde8dSNatanael Copa} 4453da93a1fdSaliguoriEOF 4454da93a1fdSaliguori 445552166aa0SJuan Quintelaif compile_prog "" "" ; then 445607ffa4bdSJuan Quintela : 44578bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 445818e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 445918e588b1SRick Liu LIBS="$LIBS -lrt" 4460da93a1fdSaliguorifi 4461da93a1fdSaliguori 4462f2995ee4SPaolo Bonzini# Check whether we have openpty() in either libc or libutil 4463d99e97e6SThomas Huthcat > $TMPC << EOF 4464d99e97e6SThomas Huthextern int openpty(int *am, int *as, char *name, void *termp, void *winp); 4465d99e97e6SThomas Huthint main(void) { return openpty(0, 0, 0, 0, 0); } 4466d99e97e6SThomas HuthEOF 4467d99e97e6SThomas Huth 44689df8b20dSThomas Huthhave_openpty="no" 44699df8b20dSThomas Huthif compile_prog "" "" ; then 44709df8b20dSThomas Huth have_openpty="yes" 44719df8b20dSThomas Huthelse 4472d99e97e6SThomas Huth if compile_prog "" "-lutil" ; then 44739df8b20dSThomas Huth have_openpty="yes" 4474d99e97e6SThomas Huth fi 44756362a53fSJuan Quintelafi 44766362a53fSJuan Quintela 4477de5071c5SBlue Swirl########################################## 4478cd4ec0b4SGerd Hoffmann# spice probe 4479cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 4480cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 4481cd4ec0b4SGerd Hoffmann#include <spice.h> 4482cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 4483cd4ec0b4SGerd HoffmannEOF 4484710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 4485710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 44861b63665cSMarc-André Lureau if $pkg_config --atleast-version=0.12.5 spice-server && \ 448765d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 4488cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 4489cd4ec0b4SGerd Hoffmann spice="yes" 4490cd4ec0b4SGerd Hoffmann else 4491cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 44928efc9363SHu Tao feature_not_found "spice" \ 44931b63665cSMarc-André Lureau "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" 4494cd4ec0b4SGerd Hoffmann fi 4495cd4ec0b4SGerd Hoffmann spice="no" 4496cd4ec0b4SGerd Hoffmann fi 4497cd4ec0b4SGerd Hoffmannfi 4498cd4ec0b4SGerd Hoffmann 44997b02f544SMarc-André Lureau# check for smartcard support 45007b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 45010f5c642dSMichal Privoznik if $pkg_config --atleast-version=2.5.1 libcacard; then 45027b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 45037b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 45047b02f544SMarc-André Lureau smartcard="yes" 4505111a38b0SRobert Relyea else 45067b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 45077b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 4508111a38b0SRobert Relyea fi 45097b02f544SMarc-André Lureau smartcard="no" 4510111a38b0SRobert Relyea fi 4511111a38b0SRobert Relyeafi 4512111a38b0SRobert Relyea 45132b2325ffSGerd Hoffmann# check for libusb 45142b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 451565d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 45162b2325ffSGerd Hoffmann libusb="yes" 4517ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 4518ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 45192b2325ffSGerd Hoffmann else 45202b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 45218efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 45222b2325ffSGerd Hoffmann fi 45232b2325ffSGerd Hoffmann libusb="no" 45242b2325ffSGerd Hoffmann fi 45252b2325ffSGerd Hoffmannfi 45262b2325ffSGerd Hoffmann 452769354a83SHans de Goede# check for usbredirparser for usb network redirection support 452869354a83SHans de Goedeif test "$usb_redir" != "no" ; then 452965d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 453069354a83SHans de Goede usb_redir="yes" 4531ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 4532ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 453369354a83SHans de Goede else 453469354a83SHans de Goede if test "$usb_redir" = "yes"; then 453521684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 453669354a83SHans de Goede fi 453769354a83SHans de Goede usb_redir="no" 453869354a83SHans de Goede fi 453969354a83SHans de Goedefi 454069354a83SHans de Goede 4541cd4ec0b4SGerd Hoffmann########################################## 4542d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 4543d9840e25STomoki Sekiyama 4544e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 4545e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 4546d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 4547690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 4548d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 4549d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 4550690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 4551d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 4552d9840e25STomoki Sekiyama ;; 4553690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 4554d9840e25STomoki Sekiyama esac 4555d9840e25STomoki Sekiyama cat > $TMPC << EOF 4556d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 4557d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 4558d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 4559d9840e25STomoki SekiyamaEOF 4560d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 4561d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 4562d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 4563315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 4564f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 4565d9840e25STomoki Sekiyama else 4566d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 4567d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 4568d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 4569d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 4570d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 4571d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 4572d9840e25STomoki Sekiyama feature_not_found "VSS support" 4573d9840e25STomoki Sekiyama fi 4574d9840e25STomoki Sekiyama guest_agent_with_vss="no" 4575d9840e25STomoki Sekiyama fi 4576d9840e25STomoki Sekiyamafi 4577d9840e25STomoki Sekiyama 4578d9840e25STomoki Sekiyama########################################## 4579d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 4580d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 4581d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 4582d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 4583d9840e25STomoki Sekiyama 4584e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 4585e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 4586d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 4587d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 4588d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 4589d9840e25STomoki Sekiyama if test -n "$programfiles"; then 4590d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 4591d9840e25STomoki Sekiyama else 4592d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 4593d9840e25STomoki Sekiyama fi 4594d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 4595d9840e25STomoki Sekiyama win_sdk="" 4596d9840e25STomoki Sekiyama fi 4597d9840e25STomoki Sekiyamafi 4598d9840e25STomoki Sekiyama 4599d9840e25STomoki Sekiyama########################################## 460050cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 4601e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 460250cbebb9SMichael Roth cat > $TMPC << EOF 460350cbebb9SMichael Roth#include <windows.h> 460450cbebb9SMichael Roth#include <ntddscsi.h> 460550cbebb9SMichael Rothint main(void) { 460650cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 460750cbebb9SMichael Roth#error Missing required ioctl definitions 460850cbebb9SMichael Roth#endif 460950cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 461050cbebb9SMichael Roth return addr.Lun; 461150cbebb9SMichael Roth} 461250cbebb9SMichael RothEOF 461350cbebb9SMichael Roth if compile_prog "" "" ; then 461450cbebb9SMichael Roth guest_agent_ntddscsi=yes 4615996b9cdcSMatt Hines libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 461650cbebb9SMichael Roth fi 461750cbebb9SMichael Rothfi 461850cbebb9SMichael Roth 461950cbebb9SMichael Roth########################################## 46209d9e1521SGerd Hoffmann# virgl renderer probe 46219d9e1521SGerd Hoffmann 46229d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 46239d9e1521SGerd Hoffmann cat > $TMPC << EOF 46249d9e1521SGerd Hoffmann#include <virglrenderer.h> 46259d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 46269d9e1521SGerd HoffmannEOF 46279d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 46289d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 462947479c55SMarc-André Lureau virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 46309d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 46319d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 46329d9e1521SGerd Hoffmann virglrenderer="yes" 46339d9e1521SGerd Hoffmann else 46349d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 46359d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 46369d9e1521SGerd Hoffmann fi 46379d9e1521SGerd Hoffmann virglrenderer="no" 46389d9e1521SGerd Hoffmann fi 46399d9e1521SGerd Hoffmannfi 46409d9e1521SGerd Hoffmann 46419d9e1521SGerd Hoffmann########################################## 46428ca80760SRichard Henderson# capstone 46438ca80760SRichard Henderson 4644e219c499SRichard Hendersoncase "$capstone" in 46458b18cdbfSRichard Henderson auto | enabled | internal) 46468b18cdbfSRichard Henderson # Simpler to always update submodule, even if not needed. 46478b18cdbfSRichard Henderson if test -e "${source_path}/.git" && test $git_update = 'yes' ; then 4648e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 4649e219c499SRichard Henderson fi 4650e219c499SRichard Henderson ;; 4651e219c499SRichard Hendersonesac 46528ca80760SRichard Henderson 46538ca80760SRichard Henderson########################################## 46545f6b9e8fSBlue Swirl# check if we have fdatasync 46555f6b9e8fSBlue Swirl 46565f6b9e8fSBlue Swirlfdatasync=no 46575f6b9e8fSBlue Swirlcat > $TMPC << EOF 46585f6b9e8fSBlue Swirl#include <unistd.h> 4659d1722a27SAlexandre Raymondint main(void) { 4660d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 4661d1722a27SAlexandre Raymondreturn fdatasync(0); 4662d1722a27SAlexandre Raymond#else 4663e172fe11SStefan Weil#error Not supported 4664d1722a27SAlexandre Raymond#endif 4665d1722a27SAlexandre Raymond} 46665f6b9e8fSBlue SwirlEOF 46675f6b9e8fSBlue Swirlif compile_prog "" "" ; then 46685f6b9e8fSBlue Swirl fdatasync=yes 46695f6b9e8fSBlue Swirlfi 46705f6b9e8fSBlue Swirl 467194a420b1SStefan Hajnoczi########################################## 4672e78815a5SAndreas Färber# check if we have madvise 4673e78815a5SAndreas Färber 4674e78815a5SAndreas Färbermadvise=no 4675e78815a5SAndreas Färbercat > $TMPC << EOF 4676e78815a5SAndreas Färber#include <sys/types.h> 4677e78815a5SAndreas Färber#include <sys/mman.h> 4678832ce9c2SScott Wood#include <stddef.h> 4679e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 4680e78815a5SAndreas FärberEOF 4681e78815a5SAndreas Färberif compile_prog "" "" ; then 4682e78815a5SAndreas Färber madvise=yes 4683e78815a5SAndreas Färberfi 4684e78815a5SAndreas Färber 4685e78815a5SAndreas Färber########################################## 4686e78815a5SAndreas Färber# check if we have posix_madvise 4687e78815a5SAndreas Färber 4688e78815a5SAndreas Färberposix_madvise=no 4689e78815a5SAndreas Färbercat > $TMPC << EOF 4690e78815a5SAndreas Färber#include <sys/mman.h> 4691832ce9c2SScott Wood#include <stddef.h> 4692e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 4693e78815a5SAndreas FärberEOF 4694e78815a5SAndreas Färberif compile_prog "" "" ; then 4695e78815a5SAndreas Färber posix_madvise=yes 4696e78815a5SAndreas Färberfi 4697e78815a5SAndreas Färber 4698e78815a5SAndreas Färber########################################## 46999bc5a719SAndreas Gustafsson# check if we have posix_memalign() 47009bc5a719SAndreas Gustafsson 47019bc5a719SAndreas Gustafssonposix_memalign=no 47029bc5a719SAndreas Gustafssoncat > $TMPC << EOF 47039bc5a719SAndreas Gustafsson#include <stdlib.h> 47049bc5a719SAndreas Gustafssonint main(void) { 47059bc5a719SAndreas Gustafsson void *p; 47069bc5a719SAndreas Gustafsson return posix_memalign(&p, 8, 8); 47079bc5a719SAndreas Gustafsson} 47089bc5a719SAndreas GustafssonEOF 47099bc5a719SAndreas Gustafssonif compile_prog "" "" ; then 47109bc5a719SAndreas Gustafsson posix_memalign=yes 47119bc5a719SAndreas Gustafssonfi 47129bc5a719SAndreas Gustafsson 47139bc5a719SAndreas Gustafsson########################################## 47140a852417SPaul Durrant# check if we have posix_syslog 47150a852417SPaul Durrant 47160a852417SPaul Durrantposix_syslog=no 47170a852417SPaul Durrantcat > $TMPC << EOF 47180a852417SPaul Durrant#include <syslog.h> 47190a852417SPaul Durrantint main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 47200a852417SPaul DurrantEOF 47210a852417SPaul Durrantif compile_prog "" "" ; then 47220a852417SPaul Durrant posix_syslog=yes 47230a852417SPaul Durrantfi 47240a852417SPaul Durrant 47250a852417SPaul Durrant########################################## 4726401bc051SPeter Maydell# check if we have sem_timedwait 4727401bc051SPeter Maydell 4728401bc051SPeter Maydellsem_timedwait=no 4729401bc051SPeter Maydellcat > $TMPC << EOF 4730401bc051SPeter Maydell#include <semaphore.h> 4731811294b7SDaniel P. Berrangéint main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } 4732401bc051SPeter MaydellEOF 4733401bc051SPeter Maydellif compile_prog "" "" ; then 4734401bc051SPeter Maydell sem_timedwait=yes 4735401bc051SPeter Maydellfi 4736401bc051SPeter Maydell 4737401bc051SPeter Maydell########################################## 47385c99fa37SKeno Fischer# check if we have strchrnul 47395c99fa37SKeno Fischer 47405c99fa37SKeno Fischerstrchrnul=no 47415c99fa37SKeno Fischercat > $TMPC << EOF 47425c99fa37SKeno Fischer#include <string.h> 47435c99fa37SKeno Fischerint main(void); 47445c99fa37SKeno Fischer// Use a haystack that the compiler shouldn't be able to constant fold 47455c99fa37SKeno Fischerchar *haystack = (char*)&main; 47465c99fa37SKeno Fischerint main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 47475c99fa37SKeno FischerEOF 47485c99fa37SKeno Fischerif compile_prog "" "" ; then 47495c99fa37SKeno Fischer strchrnul=yes 47505c99fa37SKeno Fischerfi 47515c99fa37SKeno Fischer 47528a792b03SJiufei Xue######################################### 47538a792b03SJiufei Xue# check if we have st_atim 47548a792b03SJiufei Xue 47558a792b03SJiufei Xuest_atim=no 47568a792b03SJiufei Xuecat > $TMPC << EOF 47578a792b03SJiufei Xue#include <sys/stat.h> 47588a792b03SJiufei Xue#include <stddef.h> 47598a792b03SJiufei Xueint main(void) { return offsetof(struct stat, st_atim); } 47608a792b03SJiufei XueEOF 47618a792b03SJiufei Xueif compile_prog "" "" ; then 47628a792b03SJiufei Xue st_atim=yes 47638a792b03SJiufei Xuefi 47648a792b03SJiufei Xue 47655c99fa37SKeno Fischer########################################## 476694a420b1SStefan Hajnoczi# check if trace backend exists 476794a420b1SStefan Hajnoczi 47685b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 476994a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 47705b808275SLluís Vilanova error_exit "invalid trace backends" \ 47715b808275SLluís Vilanova "Please choose supported trace backends." 477294a420b1SStefan Hajnoczifi 477394a420b1SStefan Hajnoczi 47747e24e92aSStefan Hajnoczi########################################## 47757e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 47765b808275SLluís Vilanovaif have_backend "ust"; then 47777e24e92aSStefan Hajnoczi cat > $TMPC << EOF 4778bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 47797e24e92aSStefan Hajnocziint main(void) { return 0; } 47807e24e92aSStefan HajnocziEOF 4781c79ed23dSFrancis Deslauriers if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 4782bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 478389138857SStefan Weil lttng_ust_libs=$($pkg_config --libs lttng-ust) 47847e24e92aSStefan Hajnoczi else 4785c79ed23dSFrancis Deslauriers lttng_ust_libs="-llttng-ust -ldl" 4786bf15f63cSMohamad Gebai fi 4787bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 478889138857SStefan Weil urcu_bp_libs=$($pkg_config --libs liburcu-bp) 4789bf15f63cSMohamad Gebai else 4790bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 4791bf15f63cSMohamad Gebai fi 4792bf15f63cSMohamad Gebai else 4793bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 47947e24e92aSStefan Hajnoczi fi 47957e24e92aSStefan Hajnoczifi 4796b3d08c02SDaniel P. Berrange 4797b3d08c02SDaniel P. Berrange########################################## 4798b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 47995b808275SLluís Vilanovaif have_backend "dtrace"; then 4800b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 480176ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 4802b3d08c02SDaniel P. Berrange fi 4803c276b17dSDaniel P. Berrange trace_backend_stap="no" 4804c276b17dSDaniel P. Berrange if has 'stap' ; then 4805c276b17dSDaniel P. Berrange trace_backend_stap="yes" 4806c276b17dSDaniel P. Berrange fi 4807b3d08c02SDaniel P. Berrangefi 4808b3d08c02SDaniel P. Berrange 48097e24e92aSStefan Hajnoczi########################################## 4810519175a2SAlex Barcelo# check and set a backend for coroutine 4811d0e2fce5SAneesh Kumar K.V 48127c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 481333c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 481433c53c54SDaniel P. Berrange# specific one. 48157c2acc70SPeter Maydell 48167c2acc70SPeter Maydellucontext_works=no 4817d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 4818d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 4819d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 4820cdf84806SPeter Maydell#ifdef __stub_makecontext 4821cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 4822cdf84806SPeter Maydell#endif 482375cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 4824d0e2fce5SAneesh Kumar K.VEOF 4825d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 48267c2acc70SPeter Maydell ucontext_works=yes 4827d0e2fce5SAneesh Kumar K.V fi 4828519175a2SAlex Barcelofi 48297c2acc70SPeter Maydell 48307c2acc70SPeter Maydellif test "$coroutine" = ""; then 48317c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 48327c2acc70SPeter Maydell coroutine=win32 48337c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 48347c2acc70SPeter Maydell coroutine=ucontext 4835519175a2SAlex Barcelo else 48367c2acc70SPeter Maydell coroutine=sigaltstack 48377c2acc70SPeter Maydell fi 48387c2acc70SPeter Maydellelse 48397c2acc70SPeter Maydell case $coroutine in 48407c2acc70SPeter Maydell windows) 48417c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 48427c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 48437c2acc70SPeter Maydell fi 48447c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 48457c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 48467c2acc70SPeter Maydell coroutine=win32 48477c2acc70SPeter Maydell ;; 48487c2acc70SPeter Maydell ucontext) 48497c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 48507c2acc70SPeter Maydell feature_not_found "ucontext" 48517c2acc70SPeter Maydell fi 48527c2acc70SPeter Maydell ;; 485333c53c54SDaniel P. Berrange sigaltstack) 48547c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 48557c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 48567c2acc70SPeter Maydell fi 48577c2acc70SPeter Maydell ;; 48587c2acc70SPeter Maydell *) 485976ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 48607c2acc70SPeter Maydell ;; 48617c2acc70SPeter Maydell esac 4862d0e2fce5SAneesh Kumar K.Vfi 4863d0e2fce5SAneesh Kumar K.V 486470c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 486570c60c08SStefan Hajnoczi coroutine_pool=yes 486670c60c08SStefan Hajnoczifi 486770c60c08SStefan Hajnoczi 48687d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 48697d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 48707d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 48717d992e4dSPeter Lieven coroutine_pool=no 48727d992e4dSPeter Lieven fi 48737d992e4dSPeter Lievenfi 48747d992e4dSPeter Lieven 48751e4f6065SDaniele Buono################################################## 48761e4f6065SDaniele Buono# SafeStack 48771e4f6065SDaniele Buono 48781e4f6065SDaniele Buono 48791e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 48801e4f6065SDaniele Buonocat > $TMPC << EOF 48811e4f6065SDaniele Buonoint main(int argc, char *argv[]) 48821e4f6065SDaniele Buono{ 48831e4f6065SDaniele Buono#if ! __has_feature(safe_stack) 48841e4f6065SDaniele Buono#error SafeStack Disabled 48851e4f6065SDaniele Buono#endif 48861e4f6065SDaniele Buono return 0; 48871e4f6065SDaniele Buono} 48881e4f6065SDaniele BuonoEOF 48891e4f6065SDaniele Buono flag="-fsanitize=safe-stack" 48901e4f6065SDaniele Buono # Check that safe-stack is supported and enabled. 48911e4f6065SDaniele Buono if compile_prog "-Werror $flag" "$flag"; then 48921e4f6065SDaniele Buono # Flag needed both at compilation and at linking 48931e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 48941e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 48951e4f6065SDaniele Buono else 48961e4f6065SDaniele Buono error_exit "SafeStack not supported by your compiler" 48971e4f6065SDaniele Buono fi 48981e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 48991e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 49001e4f6065SDaniele Buono fi 49011e4f6065SDaniele Buonoelse 49021e4f6065SDaniele Buonocat > $TMPC << EOF 49031e4f6065SDaniele Buonoint main(int argc, char *argv[]) 49041e4f6065SDaniele Buono{ 49051e4f6065SDaniele Buono#if defined(__has_feature) 49061e4f6065SDaniele Buono#if __has_feature(safe_stack) 49071e4f6065SDaniele Buono#error SafeStack Enabled 49081e4f6065SDaniele Buono#endif 49091e4f6065SDaniele Buono#endif 49101e4f6065SDaniele Buono return 0; 49111e4f6065SDaniele Buono} 49121e4f6065SDaniele BuonoEOF 49131e4f6065SDaniele Buonoif test "$safe_stack" = "no"; then 49141e4f6065SDaniele Buono # Make sure that safe-stack is disabled 49151e4f6065SDaniele Buono if ! compile_prog "-Werror" ""; then 49161e4f6065SDaniele Buono # SafeStack was already enabled, try to explicitly remove the feature 49171e4f6065SDaniele Buono flag="-fno-sanitize=safe-stack" 49181e4f6065SDaniele Buono if ! compile_prog "-Werror $flag" "$flag"; then 49191e4f6065SDaniele Buono error_exit "Configure cannot disable SafeStack" 49201e4f6065SDaniele Buono fi 49211e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 49221e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 49231e4f6065SDaniele Buono fi 49241e4f6065SDaniele Buonoelse # "$safe_stack" = "" 49251e4f6065SDaniele Buono # Set safe_stack to yes or no based on pre-existing flags 49261e4f6065SDaniele Buono if compile_prog "-Werror" ""; then 49271e4f6065SDaniele Buono safe_stack="no" 49281e4f6065SDaniele Buono else 49291e4f6065SDaniele Buono safe_stack="yes" 49301e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 49311e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 49321e4f6065SDaniele Buono fi 49331e4f6065SDaniele Buono fi 49341e4f6065SDaniele Buonofi 49351e4f6065SDaniele Buonofi 49367d992e4dSPeter Lieven 4937d0e2fce5SAneesh Kumar K.V########################################## 4938d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 4939d2042378SAneesh Kumar K.V 49404e1797f9SStefan Weilopen_by_handle_at=no 4941d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 4942d2042378SAneesh Kumar K.V#include <fcntl.h> 4943acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 4944acc55ba8SStefan Weil# error missing definition 4945acc55ba8SStefan Weil#else 494675cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 4947acc55ba8SStefan Weil#endif 4948d2042378SAneesh Kumar K.VEOF 4949d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 4950d2042378SAneesh Kumar K.V open_by_handle_at=yes 4951d2042378SAneesh Kumar K.Vfi 4952d2042378SAneesh Kumar K.V 4953e06a765eSHarsh Prateek Bora######################################## 4954e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 4955e06a765eSHarsh Prateek Bora 4956e06a765eSHarsh Prateek Boralinux_magic_h=no 4957e06a765eSHarsh Prateek Boracat > $TMPC << EOF 4958e06a765eSHarsh Prateek Bora#include <linux/magic.h> 4959e06a765eSHarsh Prateek Boraint main(void) { 496075cafad7SStefan Weil return 0; 4961e06a765eSHarsh Prateek Bora} 4962e06a765eSHarsh Prateek BoraEOF 4963e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 4964e06a765eSHarsh Prateek Bora linux_magic_h=yes 4965e06a765eSHarsh Prateek Borafi 4966e06a765eSHarsh Prateek Bora 49678ab1bf12SLuiz Capitulino######################################## 4968541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 49693f4349dcSKevin Wolf 49703f4349dcSKevin Wolfvalgrind_h=no 49713f4349dcSKevin Wolfcat > $TMPC << EOF 49723f4349dcSKevin Wolf#include <valgrind/valgrind.h> 49733f4349dcSKevin Wolfint main(void) { 49743f4349dcSKevin Wolf return 0; 49753f4349dcSKevin Wolf} 49763f4349dcSKevin WolfEOF 49773f4349dcSKevin Wolfif compile_prog "" "" ; then 49783f4349dcSKevin Wolf valgrind_h=yes 49793f4349dcSKevin Wolffi 49803f4349dcSKevin Wolf 49813f4349dcSKevin Wolf######################################## 49828ab1bf12SLuiz Capitulino# check if environ is declared 49838ab1bf12SLuiz Capitulino 49848ab1bf12SLuiz Capitulinohas_environ=no 49858ab1bf12SLuiz Capitulinocat > $TMPC << EOF 49868ab1bf12SLuiz Capitulino#include <unistd.h> 49878ab1bf12SLuiz Capitulinoint main(void) { 4988c075a723SBlue Swirl environ = 0; 49898ab1bf12SLuiz Capitulino return 0; 49908ab1bf12SLuiz Capitulino} 49918ab1bf12SLuiz CapitulinoEOF 49928ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 49938ab1bf12SLuiz Capitulino has_environ=yes 49948ab1bf12SLuiz Capitulinofi 49958ab1bf12SLuiz Capitulino 499676a347e1SRichard Henderson######################################## 499776a347e1SRichard Henderson# check if cpuid.h is usable. 499876a347e1SRichard Henderson 499976a347e1SRichard Hendersoncat > $TMPC << EOF 500076a347e1SRichard Henderson#include <cpuid.h> 500176a347e1SRichard Hendersonint main(void) { 5002774d566cSPeter Maydell unsigned a, b, c, d; 5003774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 5004774d566cSPeter Maydell 5005774d566cSPeter Maydell if (max >= 1) { 5006774d566cSPeter Maydell __cpuid(1, a, b, c, d); 5007774d566cSPeter Maydell } 5008774d566cSPeter Maydell 5009774d566cSPeter Maydell if (max >= 7) { 5010774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 5011774d566cSPeter Maydell } 5012774d566cSPeter Maydell 501376a347e1SRichard Henderson return 0; 501476a347e1SRichard Henderson} 501576a347e1SRichard HendersonEOF 501676a347e1SRichard Hendersonif compile_prog "" "" ; then 501776a347e1SRichard Henderson cpuid_h=yes 501876a347e1SRichard Hendersonfi 501976a347e1SRichard Henderson 50205dd89908SRichard Henderson########################################## 50215dd89908SRichard Henderson# avx2 optimization requirement check 50225dd89908SRichard Henderson# 50235dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 50245dd89908SRichard Henderson# since we won't be able to select the new routines. 50255dd89908SRichard Henderson 5026e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 50275dd89908SRichard Henderson cat > $TMPC << EOF 50285dd89908SRichard Henderson#pragma GCC push_options 50295dd89908SRichard Henderson#pragma GCC target("avx2") 50305dd89908SRichard Henderson#include <cpuid.h> 50315dd89908SRichard Henderson#include <immintrin.h> 50325dd89908SRichard Hendersonstatic int bar(void *a) { 50335dd89908SRichard Henderson __m256i x = *(__m256i *)a; 50345dd89908SRichard Henderson return _mm256_testz_si256(x, x); 50355dd89908SRichard Henderson} 50365dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 50375dd89908SRichard HendersonEOF 50385dd89908SRichard Henderson if compile_object "" ; then 50395dd89908SRichard Henderson avx2_opt="yes" 504086583a07SLiam Merwick else 504186583a07SLiam Merwick avx2_opt="no" 50425dd89908SRichard Henderson fi 50435dd89908SRichard Hendersonfi 50445dd89908SRichard Henderson 50456b8cd447SRobert Hoo########################################## 50466b8cd447SRobert Hoo# avx512f optimization requirement check 50476b8cd447SRobert Hoo# 50486b8cd447SRobert Hoo# There is no point enabling this if cpuid.h is not usable, 50496b8cd447SRobert Hoo# since we won't be able to select the new routines. 50506b8cd447SRobert Hoo# by default, it is turned off. 50516b8cd447SRobert Hoo# if user explicitly want to enable it, check environment 50526b8cd447SRobert Hoo 50536b8cd447SRobert Hooif test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 50546b8cd447SRobert Hoo cat > $TMPC << EOF 50556b8cd447SRobert Hoo#pragma GCC push_options 50566b8cd447SRobert Hoo#pragma GCC target("avx512f") 50576b8cd447SRobert Hoo#include <cpuid.h> 50586b8cd447SRobert Hoo#include <immintrin.h> 50596b8cd447SRobert Hoostatic int bar(void *a) { 50606b8cd447SRobert Hoo __m512i x = *(__m512i *)a; 50616b8cd447SRobert Hoo return _mm512_test_epi64_mask(x, x); 50626b8cd447SRobert Hoo} 50636b8cd447SRobert Hooint main(int argc, char *argv[]) 50646b8cd447SRobert Hoo{ 50656b8cd447SRobert Hoo return bar(argv[0]); 50666b8cd447SRobert Hoo} 50676b8cd447SRobert HooEOF 50686b8cd447SRobert Hoo if ! compile_object "" ; then 50696b8cd447SRobert Hoo avx512f_opt="no" 50706b8cd447SRobert Hoo fi 50716b8cd447SRobert Hooelse 50726b8cd447SRobert Hoo avx512f_opt="no" 50736b8cd447SRobert Hoofi 50746b8cd447SRobert Hoo 5075f540166bSRichard Henderson######################################## 5076f540166bSRichard Henderson# check if __[u]int128_t is usable. 5077f540166bSRichard Henderson 5078f540166bSRichard Hendersonint128=no 5079f540166bSRichard Hendersoncat > $TMPC << EOF 5080f540166bSRichard Henderson__int128_t a; 5081f540166bSRichard Henderson__uint128_t b; 5082f540166bSRichard Hendersonint main (void) { 5083f540166bSRichard Henderson a = a + b; 5084f540166bSRichard Henderson b = a * b; 5085464e3671SPeter Maydell a = a * a; 5086f540166bSRichard Henderson return 0; 5087f540166bSRichard Henderson} 5088f540166bSRichard HendersonEOF 5089f540166bSRichard Hendersonif compile_prog "" "" ; then 5090f540166bSRichard Henderson int128=yes 5091f540166bSRichard Hendersonfi 509276a347e1SRichard Henderson 50937ebee43eSRichard Henderson######################################### 50947ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 50957ebee43eSRichard Henderson 50967ebee43eSRichard Hendersonatomic128=no 50977ebee43eSRichard Hendersonif test "$int128" = "yes"; then 50987ebee43eSRichard Henderson cat > $TMPC << EOF 50997ebee43eSRichard Hendersonint main(void) 51007ebee43eSRichard Henderson{ 51017ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 51027ebee43eSRichard Henderson y = __atomic_load_16(&x, 0); 51037ebee43eSRichard Henderson __atomic_store_16(&x, y, 0); 51047ebee43eSRichard Henderson __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 51057ebee43eSRichard Henderson return 0; 51067ebee43eSRichard Henderson} 51077ebee43eSRichard HendersonEOF 51087ebee43eSRichard Henderson if compile_prog "" "" ; then 51097ebee43eSRichard Henderson atomic128=yes 51107ebee43eSRichard Henderson fi 51117ebee43eSRichard Hendersonfi 51127ebee43eSRichard Henderson 5113e6cd4bb5SRichard Hendersoncmpxchg128=no 5114e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 5115e6cd4bb5SRichard Henderson cat > $TMPC << EOF 5116e6cd4bb5SRichard Hendersonint main(void) 5117e6cd4bb5SRichard Henderson{ 5118e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 5119e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 5120e6cd4bb5SRichard Henderson return 0; 5121e6cd4bb5SRichard Henderson} 5122e6cd4bb5SRichard HendersonEOF 5123e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 5124e6cd4bb5SRichard Henderson cmpxchg128=yes 5125e6cd4bb5SRichard Henderson fi 5126e6cd4bb5SRichard Hendersonfi 5127e6cd4bb5SRichard Henderson 5128df79b996SRichard Henderson######################################### 5129df79b996SRichard Henderson# See if 64-bit atomic operations are supported. 5130df79b996SRichard Henderson# Note that without __atomic builtins, we can only 5131df79b996SRichard Henderson# assume atomic loads/stores max at pointer size. 5132df79b996SRichard Henderson 5133df79b996SRichard Hendersoncat > $TMPC << EOF 5134df79b996SRichard Henderson#include <stdint.h> 5135df79b996SRichard Hendersonint main(void) 5136df79b996SRichard Henderson{ 5137df79b996SRichard Henderson uint64_t x = 0, y = 0; 5138df79b996SRichard Henderson#ifdef __ATOMIC_RELAXED 51395fe40765SThomas Huth y = __atomic_load_n(&x, __ATOMIC_RELAXED); 51405fe40765SThomas Huth __atomic_store_n(&x, y, __ATOMIC_RELAXED); 51415fe40765SThomas Huth __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); 51425fe40765SThomas Huth __atomic_exchange_n(&x, y, __ATOMIC_RELAXED); 51435fe40765SThomas Huth __atomic_fetch_add(&x, y, __ATOMIC_RELAXED); 5144df79b996SRichard Henderson#else 5145df79b996SRichard Henderson typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5146df79b996SRichard Henderson __sync_lock_test_and_set(&x, y); 5147df79b996SRichard Henderson __sync_val_compare_and_swap(&x, y, 0); 5148df79b996SRichard Henderson __sync_fetch_and_add(&x, y); 5149df79b996SRichard Henderson#endif 5150df79b996SRichard Henderson return 0; 5151df79b996SRichard Henderson} 5152df79b996SRichard HendersonEOF 5153df79b996SRichard Hendersonif compile_prog "" "" ; then 5154df79b996SRichard Henderson atomic64=yes 5155df79b996SRichard Hendersonfi 5156df79b996SRichard Henderson 515726fffe29SEmilio G. Cota######################################### 515826fffe29SEmilio G. Cota# See if --dynamic-list is supported by the linker 515926fffe29SEmilio G. Cotald_dynamic_list="no" 516026fffe29SEmilio G. Cotaif test "$static" = "no" ; then 516126fffe29SEmilio G. Cota cat > $TMPTXT <<EOF 516226fffe29SEmilio G. Cota{ 516326fffe29SEmilio G. Cota foo; 516426fffe29SEmilio G. Cota}; 516526fffe29SEmilio G. CotaEOF 516626fffe29SEmilio G. Cota 516726fffe29SEmilio G. Cota cat > $TMPC <<EOF 516826fffe29SEmilio G. Cota#include <stdio.h> 516926fffe29SEmilio G. Cotavoid foo(void); 517026fffe29SEmilio G. Cota 517126fffe29SEmilio G. Cotavoid foo(void) 517226fffe29SEmilio G. Cota{ 517326fffe29SEmilio G. Cota printf("foo\n"); 517426fffe29SEmilio G. Cota} 517526fffe29SEmilio G. Cota 517626fffe29SEmilio G. Cotaint main(void) 517726fffe29SEmilio G. Cota{ 517826fffe29SEmilio G. Cota foo(); 517926fffe29SEmilio G. Cota return 0; 518026fffe29SEmilio G. Cota} 518126fffe29SEmilio G. CotaEOF 518226fffe29SEmilio G. Cota 518326fffe29SEmilio G. Cota if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 518426fffe29SEmilio G. Cota ld_dynamic_list="yes" 518526fffe29SEmilio G. Cota fi 518626fffe29SEmilio G. Cotafi 518726fffe29SEmilio G. Cota 518826fffe29SEmilio G. Cota######################################### 518926fffe29SEmilio G. Cota# See if -exported_symbols_list is supported by the linker 519026fffe29SEmilio G. Cota 519126fffe29SEmilio G. Cotald_exported_symbols_list="no" 519226fffe29SEmilio G. Cotaif test "$static" = "no" ; then 519326fffe29SEmilio G. Cota cat > $TMPTXT <<EOF 519426fffe29SEmilio G. Cota _foo 519526fffe29SEmilio G. CotaEOF 519626fffe29SEmilio G. Cota 519726fffe29SEmilio G. Cota if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 519826fffe29SEmilio G. Cota ld_exported_symbols_list="yes" 519926fffe29SEmilio G. Cota fi 520026fffe29SEmilio G. Cotafi 520126fffe29SEmilio G. Cota 520226fffe29SEmilio G. Cotaif test "$plugins" = "yes" && 520326fffe29SEmilio G. Cota test "$ld_dynamic_list" = "no" && 520426fffe29SEmilio G. Cota test "$ld_exported_symbols_list" = "no" ; then 520526fffe29SEmilio G. Cota error_exit \ 520626fffe29SEmilio G. Cota "Plugin support requires dynamic linking and specifying a set of symbols " \ 520726fffe29SEmilio G. Cota "that are exported to plugins. Unfortunately your linker doesn't " \ 520826fffe29SEmilio G. Cota "support the flag (--dynamic-list or -exported_symbols_list) used " \ 520926fffe29SEmilio G. Cota "for this purpose. You can't build with --static." 521026fffe29SEmilio G. Cotafi 521126fffe29SEmilio G. Cota 52121e6e9acaSRichard Henderson######################################## 5213db8aaae8SRichard Henderson# See if __attribute__((alias)) is supported. 5214db8aaae8SRichard Henderson# This false for Xcode 9, but has been remedied for Xcode 10. 5215db8aaae8SRichard Henderson# Unfortunately, travis uses Xcode 9 by default. 5216db8aaae8SRichard Henderson 5217db8aaae8SRichard Hendersonattralias=no 5218db8aaae8SRichard Hendersoncat > $TMPC << EOF 5219db8aaae8SRichard Hendersonint x = 1; 5220db8aaae8SRichard Hendersonextern const int y __attribute__((alias("x"))); 5221db8aaae8SRichard Hendersonint main(void) { return 0; } 5222db8aaae8SRichard HendersonEOF 5223db8aaae8SRichard Hendersonif compile_prog "" "" ; then 5224db8aaae8SRichard Henderson attralias=yes 5225db8aaae8SRichard Hendersonfi 5226db8aaae8SRichard Henderson 5227db8aaae8SRichard Henderson######################################## 52281e6e9acaSRichard Henderson# check if getauxval is available. 52291e6e9acaSRichard Henderson 52301e6e9acaSRichard Hendersongetauxval=no 52311e6e9acaSRichard Hendersoncat > $TMPC << EOF 52321e6e9acaSRichard Henderson#include <sys/auxv.h> 52331e6e9acaSRichard Hendersonint main(void) { 52341e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 52351e6e9acaSRichard Henderson} 52361e6e9acaSRichard HendersonEOF 52371e6e9acaSRichard Hendersonif compile_prog "" "" ; then 52381e6e9acaSRichard Henderson getauxval=yes 52391e6e9acaSRichard Hendersonfi 52401e6e9acaSRichard Henderson 5241fd0e6053SJohn Snow######################################## 5242fd0e6053SJohn Snow# check if ccache is interfering with 5243fd0e6053SJohn Snow# semantic analysis of macros 5244fd0e6053SJohn Snow 52455e4dfd3dSJohn Snowunset CCACHE_CPP2 5246fd0e6053SJohn Snowccache_cpp2=no 5247fd0e6053SJohn Snowcat > $TMPC << EOF 5248fd0e6053SJohn Snowstatic const int Z = 1; 5249fd0e6053SJohn Snow#define fn() ({ Z; }) 5250fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 5251fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 5252fd0e6053SJohn Snow#define ID(X) (X) 5253fd0e6053SJohn Snowint main(int argc, char *argv[]) 5254fd0e6053SJohn Snow{ 5255fd0e6053SJohn Snow int x = 0, y = 0; 5256fd0e6053SJohn Snow x = ID(x); 5257fd0e6053SJohn Snow x = fn(); 5258fd0e6053SJohn Snow fn(); 5259fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 5260fd0e6053SJohn Snow if (TAUT(Z)) return 0; 5261fd0e6053SJohn Snow return 0; 5262fd0e6053SJohn Snow} 5263fd0e6053SJohn SnowEOF 5264fd0e6053SJohn Snow 5265fd0e6053SJohn Snowif ! compile_object "-Werror"; then 5266fd0e6053SJohn Snow ccache_cpp2=yes 5267fd0e6053SJohn Snowfi 5268fd0e6053SJohn Snow 5269b553a042SJohn Snow################################################# 5270b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 5271b553a042SJohn Snow 5272b553a042SJohn Snowif test "$fortify_source" != "no"; then 5273b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5274b553a042SJohn Snow fortify_source="no"; 5275e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 5276cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5277b553a042SJohn Snow fortify_source="no"; 5278b553a042SJohn Snow else 5279b553a042SJohn Snow fortify_source="yes" 5280b553a042SJohn Snow fi 5281b553a042SJohn Snowfi 5282b553a042SJohn Snow 52831efad060SFam Zheng############################################### 52841efad060SFam Zheng# Check if copy_file_range is provided by glibc 52851efad060SFam Zhenghave_copy_file_range=no 52861efad060SFam Zhengcat > $TMPC << EOF 52871efad060SFam Zheng#include <unistd.h> 52881efad060SFam Zhengint main(void) { 52891efad060SFam Zheng copy_file_range(0, NULL, 0, NULL, 0, 0); 52901efad060SFam Zheng return 0; 52911efad060SFam Zheng} 52921efad060SFam ZhengEOF 52931efad060SFam Zhengif compile_prog "" "" ; then 52941efad060SFam Zheng have_copy_file_range=yes 52951efad060SFam Zhengfi 52961efad060SFam Zheng 5297d2042378SAneesh Kumar K.V########################################## 5298277abf15SJan Vesely# check if struct fsxattr is available via linux/fs.h 5299277abf15SJan Vesely 5300277abf15SJan Veselyhave_fsxattr=no 5301277abf15SJan Veselycat > $TMPC << EOF 5302277abf15SJan Vesely#include <linux/fs.h> 5303277abf15SJan Veselystruct fsxattr foo; 5304277abf15SJan Veselyint main(void) { 5305277abf15SJan Vesely return 0; 5306277abf15SJan Vesely} 5307277abf15SJan VeselyEOF 5308277abf15SJan Veselyif compile_prog "" "" ; then 5309277abf15SJan Vesely have_fsxattr=yes 5310277abf15SJan Veselyfi 5311277abf15SJan Vesely 5312b66e10e4SPeter Maydell########################################## 5313a40161cbSPaolo Bonzini# check for usable membarrier system call 5314a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 5315a40161cbSPaolo Bonzini have_membarrier=no 5316a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 5317a40161cbSPaolo Bonzini have_membarrier=yes 5318a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 5319a40161cbSPaolo Bonzini cat > $TMPC << EOF 5320a40161cbSPaolo Bonzini #include <linux/membarrier.h> 5321a40161cbSPaolo Bonzini #include <sys/syscall.h> 5322a40161cbSPaolo Bonzini #include <unistd.h> 5323a40161cbSPaolo Bonzini #include <stdlib.h> 5324a40161cbSPaolo Bonzini int main(void) { 5325a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5326a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5327a40161cbSPaolo Bonzini exit(0); 5328a40161cbSPaolo Bonzini } 5329a40161cbSPaolo BonziniEOF 5330a40161cbSPaolo Bonzini if compile_prog "" "" ; then 5331a40161cbSPaolo Bonzini have_membarrier=yes 5332a40161cbSPaolo Bonzini fi 5333a40161cbSPaolo Bonzini fi 5334a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 5335a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 5336a40161cbSPaolo Bonzini fi 5337a40161cbSPaolo Bonzinielse 5338a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 5339a40161cbSPaolo Bonzini # work on Wine. 5340a40161cbSPaolo Bonzini membarrier=no 5341a40161cbSPaolo Bonzinifi 5342a40161cbSPaolo Bonzini 5343a40161cbSPaolo Bonzini########################################## 5344b66e10e4SPeter Maydell# check if rtnetlink.h exists and is useful 5345575b22b1SLaurent Vivierhave_rtnetlink=no 5346575b22b1SLaurent Viviercat > $TMPC << EOF 5347575b22b1SLaurent Vivier#include <linux/rtnetlink.h> 5348575b22b1SLaurent Vivierint main(void) { 5349575b22b1SLaurent Vivier return IFLA_PROTO_DOWN; 5350575b22b1SLaurent Vivier} 5351575b22b1SLaurent VivierEOF 5352575b22b1SLaurent Vivierif compile_prog "" "" ; then 5353575b22b1SLaurent Vivier have_rtnetlink=yes 5354575b22b1SLaurent Vivierfi 5355575b22b1SLaurent Vivier 53566a02c806SStefan Hajnoczi########################################## 53576a02c806SStefan Hajnoczi# check for usable AF_VSOCK environment 53586a02c806SStefan Hajnoczihave_af_vsock=no 53596a02c806SStefan Hajnoczicat > $TMPC << EOF 53606a02c806SStefan Hajnoczi#include <errno.h> 53616a02c806SStefan Hajnoczi#include <sys/types.h> 53626a02c806SStefan Hajnoczi#include <sys/socket.h> 53636a02c806SStefan Hajnoczi#if !defined(AF_VSOCK) 53646a02c806SStefan Hajnoczi# error missing AF_VSOCK flag 53656a02c806SStefan Hajnoczi#endif 53666a02c806SStefan Hajnoczi#include <linux/vm_sockets.h> 53676a02c806SStefan Hajnocziint main(void) { 53686a02c806SStefan Hajnoczi int sock, ret; 53696a02c806SStefan Hajnoczi struct sockaddr_vm svm; 53706a02c806SStefan Hajnoczi socklen_t len = sizeof(svm); 53716a02c806SStefan Hajnoczi sock = socket(AF_VSOCK, SOCK_STREAM, 0); 53726a02c806SStefan Hajnoczi ret = getpeername(sock, (struct sockaddr *)&svm, &len); 53736a02c806SStefan Hajnoczi if ((ret == -1) && (errno == ENOTCONN)) { 53746a02c806SStefan Hajnoczi return 0; 53756a02c806SStefan Hajnoczi } 53766a02c806SStefan Hajnoczi return -1; 53776a02c806SStefan Hajnoczi} 53786a02c806SStefan HajnocziEOF 53796a02c806SStefan Hajnocziif compile_prog "" "" ; then 53806a02c806SStefan Hajnoczi have_af_vsock=yes 53816a02c806SStefan Hajnoczifi 53826a02c806SStefan Hajnoczi 5383f0d92b56SLongpeng(Mike)########################################## 5384f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 53854f67366eSThomas Huthhave_afalg=no 5386f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 5387f0d92b56SLongpeng(Mike)#include <errno.h> 5388f0d92b56SLongpeng(Mike)#include <sys/types.h> 5389f0d92b56SLongpeng(Mike)#include <sys/socket.h> 5390f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 5391f0d92b56SLongpeng(Mike)int main(void) { 5392f0d92b56SLongpeng(Mike) int sock; 5393f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 5394f0d92b56SLongpeng(Mike) return sock; 5395f0d92b56SLongpeng(Mike)} 5396f0d92b56SLongpeng(Mike)EOF 5397f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 5398f0d92b56SLongpeng(Mike) have_afalg=yes 5399f0d92b56SLongpeng(Mike)fi 5400f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 5401f0d92b56SLongpeng(Mike)then 5402f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 5403f0d92b56SLongpeng(Mike) then 5404f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 5405f0d92b56SLongpeng(Mike) fi 5406f0d92b56SLongpeng(Mike)fi 5407f0d92b56SLongpeng(Mike) 5408f0d92b56SLongpeng(Mike) 54096969ec6cSJames Clarke################################################# 54104d04351fSChristopher Covington# check for sysmacros.h 54114d04351fSChristopher Covington 54124d04351fSChristopher Covingtonhave_sysmacros=no 54134d04351fSChristopher Covingtoncat > $TMPC << EOF 54144d04351fSChristopher Covington#include <sys/sysmacros.h> 54154d04351fSChristopher Covingtonint main(void) { 54164d04351fSChristopher Covington return makedev(0, 0); 54174d04351fSChristopher Covington} 54184d04351fSChristopher CovingtonEOF 54194d04351fSChristopher Covingtonif compile_prog "" "" ; then 54204d04351fSChristopher Covington have_sysmacros=yes 54214d04351fSChristopher Covingtonfi 54224d04351fSChristopher Covington 54234d04351fSChristopher Covington########################################## 542449e00a18SAndreas Grapentin# check for _Static_assert() 542549e00a18SAndreas Grapentin 542649e00a18SAndreas Grapentinhave_static_assert=no 542749e00a18SAndreas Grapentincat > $TMPC << EOF 542849e00a18SAndreas Grapentin_Static_assert(1, "success"); 542949e00a18SAndreas Grapentinint main(void) { 543049e00a18SAndreas Grapentin return 0; 543149e00a18SAndreas Grapentin} 543249e00a18SAndreas GrapentinEOF 543349e00a18SAndreas Grapentinif compile_prog "" "" ; then 543449e00a18SAndreas Grapentin have_static_assert=yes 543549e00a18SAndreas Grapentinfi 543649e00a18SAndreas Grapentin 543749e00a18SAndreas Grapentin########################################## 5438e674605fSTomáš Golembiovský# check for utmpx.h, it is missing e.g. on OpenBSD 5439e674605fSTomáš Golembiovský 5440e674605fSTomáš Golembiovskýhave_utmpx=no 5441e674605fSTomáš Golembiovskýcat > $TMPC << EOF 5442e674605fSTomáš Golembiovský#include <utmpx.h> 5443e674605fSTomáš Golembiovskýstruct utmpx user_info; 5444e674605fSTomáš Golembiovskýint main(void) { 5445e674605fSTomáš Golembiovský return 0; 5446e674605fSTomáš Golembiovský} 5447e674605fSTomáš GolembiovskýEOF 5448e674605fSTomáš Golembiovskýif compile_prog "" "" ; then 5449e674605fSTomáš Golembiovský have_utmpx=yes 5450e674605fSTomáš Golembiovskýfi 5451e674605fSTomáš Golembiovský 5452e674605fSTomáš Golembiovský########################################## 5453db1ed1abSRichard Henderson# check for getrandom() 5454db1ed1abSRichard Henderson 5455db1ed1abSRichard Hendersonhave_getrandom=no 5456db1ed1abSRichard Hendersoncat > $TMPC << EOF 5457db1ed1abSRichard Henderson#include <sys/random.h> 5458db1ed1abSRichard Hendersonint main(void) { 5459db1ed1abSRichard Henderson return getrandom(0, 0, GRND_NONBLOCK); 5460db1ed1abSRichard Henderson} 5461db1ed1abSRichard HendersonEOF 5462db1ed1abSRichard Hendersonif compile_prog "" "" ; then 5463db1ed1abSRichard Henderson have_getrandom=yes 5464db1ed1abSRichard Hendersonfi 5465db1ed1abSRichard Henderson 5466db1ed1abSRichard Henderson########################################## 5467247724cbSMarc-André Lureau# checks for sanitizers 5468247724cbSMarc-André Lureau 5469247724cbSMarc-André Lureauhave_asan=no 5470247724cbSMarc-André Lureauhave_ubsan=no 5471d83414e1SMarc-André Lureauhave_asan_iface_h=no 5472d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 5473247724cbSMarc-André Lureau 5474247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 5475b9f44da2SMarc-André Lureau write_c_skeleton 5476247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 5477247724cbSMarc-André Lureau have_asan=yes 5478247724cbSMarc-André Lureau fi 5479b9f44da2SMarc-André Lureau 5480b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 5481b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 5482b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 5483b9f44da2SMarc-André Lureau cat > $TMPC << EOF 5484b9f44da2SMarc-André Lureau#include <stdlib.h> 5485b9f44da2SMarc-André Lureauint main(void) { 5486b9f44da2SMarc-André Lureau void *tmp = malloc(10); 5487f2dfe54cSLeonid Bloch if (tmp != NULL) { 5488b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 5489b9f44da2SMarc-André Lureau } 5490d1abf3fcSOlaf Hering return 1; 5491f2dfe54cSLeonid Bloch} 5492b9f44da2SMarc-André LureauEOF 5493247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 5494247724cbSMarc-André Lureau have_ubsan=yes 5495247724cbSMarc-André Lureau fi 5496d83414e1SMarc-André Lureau 5497d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 5498d83414e1SMarc-André Lureau have_asan_iface_h=yes 5499d83414e1SMarc-André Lureau fi 5500d83414e1SMarc-André Lureau 5501d83414e1SMarc-André Lureau cat > $TMPC << EOF 5502d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 5503d83414e1SMarc-André Lureauint main(void) { 5504d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 5505d83414e1SMarc-André Lureau return 0; 5506d83414e1SMarc-André Lureau} 5507d83414e1SMarc-André LureauEOF 5508d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 5509d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 5510d83414e1SMarc-André Lureau fi 5511247724cbSMarc-André Lureaufi 5512247724cbSMarc-André Lureau 5513247724cbSMarc-André Lureau########################################## 5514adc28027SAlexander Bulekov# checks for fuzzer 551554c9e41dSAlexander Bulekovif test "$fuzzing" = "yes" && test -z "${LIB_FUZZING_ENGINE+xxx}"; then 5516adc28027SAlexander Bulekov write_c_fuzzer_skeleton 5517dd016265SAlexander Bulekov if compile_prog "$CPU_CFLAGS -Werror -fsanitize=fuzzer" ""; then 5518adc28027SAlexander Bulekov have_fuzzer=yes 551964ed6f92SPaolo Bonzini else 552064ed6f92SPaolo Bonzini error_exit "Your compiler doesn't support -fsanitize=fuzzer" 552164ed6f92SPaolo Bonzini exit 1 5522adc28027SAlexander Bulekov fi 5523adc28027SAlexander Bulekovfi 5524adc28027SAlexander Bulekov 55250aebab04SLingfeng Yang# Thread sanitizer is, for now, much noisier than the other sanitizers; 55260aebab04SLingfeng Yang# keep it separate until that is not the case. 55270aebab04SLingfeng Yangif test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 55280aebab04SLingfeng Yang error_exit "TSAN is not supported with other sanitiziers." 55290aebab04SLingfeng Yangfi 55300aebab04SLingfeng Yanghave_tsan=no 55310aebab04SLingfeng Yanghave_tsan_iface_fiber=no 55320aebab04SLingfeng Yangif test "$tsan" = "yes" ; then 55330aebab04SLingfeng Yang write_c_skeleton 55340aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 55350aebab04SLingfeng Yang have_tsan=yes 55360aebab04SLingfeng Yang fi 55370aebab04SLingfeng Yang cat > $TMPC << EOF 55380aebab04SLingfeng Yang#include <sanitizer/tsan_interface.h> 55390aebab04SLingfeng Yangint main(void) { 55400aebab04SLingfeng Yang __tsan_create_fiber(0); 55410aebab04SLingfeng Yang return 0; 55420aebab04SLingfeng Yang} 55430aebab04SLingfeng YangEOF 55440aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 55450aebab04SLingfeng Yang have_tsan_iface_fiber=yes 55460aebab04SLingfeng Yang fi 55470aebab04SLingfeng Yangfi 55480aebab04SLingfeng Yang 5549adc28027SAlexander Bulekov########################################## 555017824406SJunyan He# check for libpmem 555117824406SJunyan He 555217824406SJunyan Heif test "$libpmem" != "no"; then 555317824406SJunyan He if $pkg_config --exists "libpmem"; then 555417824406SJunyan He libpmem="yes" 555517824406SJunyan He libpmem_libs=$($pkg_config --libs libpmem) 555617824406SJunyan He libpmem_cflags=$($pkg_config --cflags libpmem) 555717824406SJunyan He else 555817824406SJunyan He if test "$libpmem" = "yes" ; then 555917824406SJunyan He feature_not_found "libpmem" "Install nvml or pmdk" 556017824406SJunyan He fi 556117824406SJunyan He libpmem="no" 556217824406SJunyan He fi 556317824406SJunyan Hefi 556417824406SJunyan He 556517824406SJunyan He########################################## 556621b2eca6SJingqi Liu# check for libdaxctl 556721b2eca6SJingqi Liu 556821b2eca6SJingqi Liuif test "$libdaxctl" != "no"; then 556921b2eca6SJingqi Liu if $pkg_config --atleast-version=57 "libdaxctl"; then 557021b2eca6SJingqi Liu libdaxctl="yes" 557121b2eca6SJingqi Liu libdaxctl_libs=$($pkg_config --libs libdaxctl) 557221b2eca6SJingqi Liu libdaxctl_cflags=$($pkg_config --cflags libdaxctl) 557321b2eca6SJingqi Liu else 557421b2eca6SJingqi Liu if test "$libdaxctl" = "yes" ; then 557521b2eca6SJingqi Liu feature_not_found "libdaxctl" "Install libdaxctl" 557621b2eca6SJingqi Liu fi 557721b2eca6SJingqi Liu libdaxctl="no" 557821b2eca6SJingqi Liu fi 557921b2eca6SJingqi Liufi 558021b2eca6SJingqi Liu 558121b2eca6SJingqi Liu########################################## 5582675b9b53SMarc-André Lureau# check for slirp 5583675b9b53SMarc-André Lureau 5584675b9b53SMarc-André Lureaucase "$slirp" in 55854d34a86bSPaolo Bonzini auto | enabled | internal) 55864d34a86bSPaolo Bonzini # Simpler to always update submodule, even if not needed. 55874d34a86bSPaolo Bonzini if test -e "${source_path}/.git" && test $git_update = 'yes' ; then 55887c57bdd8SMarc-André Lureau git_submodules="${git_submodules} slirp" 55897c57bdd8SMarc-André Lureau fi 5590675b9b53SMarc-André Lureau ;; 5591675b9b53SMarc-André Lureauesac 5592675b9b53SMarc-André Lureau 559354e7aac0SAlexey Krasikov########################################## 559454e7aac0SAlexey Krasikov# check for usable __NR_keyctl syscall 559554e7aac0SAlexey Krasikov 559654e7aac0SAlexey Krasikovif test "$linux" = "yes" ; then 559754e7aac0SAlexey Krasikov 559854e7aac0SAlexey Krasikov have_keyring=no 559954e7aac0SAlexey Krasikov cat > $TMPC << EOF 560054e7aac0SAlexey Krasikov#include <errno.h> 560154e7aac0SAlexey Krasikov#include <asm/unistd.h> 560254e7aac0SAlexey Krasikov#include <linux/keyctl.h> 560354e7aac0SAlexey Krasikov#include <unistd.h> 560454e7aac0SAlexey Krasikovint main(void) { 560554e7aac0SAlexey Krasikov return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 560654e7aac0SAlexey Krasikov} 560754e7aac0SAlexey KrasikovEOF 560854e7aac0SAlexey Krasikov if compile_prog "" "" ; then 560954e7aac0SAlexey Krasikov have_keyring=yes 561054e7aac0SAlexey Krasikov fi 561154e7aac0SAlexey Krasikovfi 561254e7aac0SAlexey Krasikovif test "$secret_keyring" != "no" 561354e7aac0SAlexey Krasikovthen 5614b418d265SDavid Edmondson if test "$have_keyring" = "yes" 561554e7aac0SAlexey Krasikov then 561654e7aac0SAlexey Krasikov secret_keyring=yes 561754e7aac0SAlexey Krasikov else 561854e7aac0SAlexey Krasikov if test "$secret_keyring" = "yes" 561954e7aac0SAlexey Krasikov then 562054e7aac0SAlexey Krasikov error_exit "syscall __NR_keyctl requested, \ 562154e7aac0SAlexey Krasikovbut not implemented on your system" 562254e7aac0SAlexey Krasikov else 562354e7aac0SAlexey Krasikov secret_keyring=no 562454e7aac0SAlexey Krasikov fi 562554e7aac0SAlexey Krasikov fi 562654e7aac0SAlexey Krasikovfi 562754e7aac0SAlexey Krasikov 562892500362SAlexey Krasikov########################################## 5629e86ecd4bSJuan Quintela# End of CC checks 5630e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 5631e86ecd4bSJuan Quintela 5632d83414e1SMarc-André Lureauwrite_c_skeleton 5633d83414e1SMarc-André Lureau 56341d728c39SBlue Swirlif test "$gcov" = "yes" ; then 5635bf0e56a3SMarc-André Lureau : 5636b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 5637086d5f75SPaolo Bonzini QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 5638086d5f75SPaolo Bonzini debug=no 5639086d5f75SPaolo Bonzinifi 5640086d5f75SPaolo Bonzini 5641086d5f75SPaolo Bonzinicase "$ARCH" in 5642086d5f75SPaolo Bonzinialpha) 5643086d5f75SPaolo Bonzini # Ensure there's only a single GP 5644086d5f75SPaolo Bonzini QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 5645086d5f75SPaolo Bonzini;; 5646086d5f75SPaolo Bonziniesac 5647086d5f75SPaolo Bonzini 5648086d5f75SPaolo Bonziniif test "$gprof" = "yes" ; then 5649086d5f75SPaolo Bonzini QEMU_CFLAGS="-p $QEMU_CFLAGS" 5650086d5f75SPaolo Bonzini QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 5651086d5f75SPaolo Bonzinifi 5652a316e378SJuan Quintela 5653247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 5654db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 5655db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 5656d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 5657d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 5658d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5659d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 5660d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 5661d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5662d83414e1SMarc-André Lureau fi 5663247724cbSMarc-André Lureaufi 56640aebab04SLingfeng Yangif test "$have_tsan" = "yes" ; then 56650aebab04SLingfeng Yang if test "$have_tsan_iface_fiber" = "yes" ; then 56660aebab04SLingfeng Yang QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 56670aebab04SLingfeng Yang QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 56680aebab04SLingfeng Yang else 56690aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing fiber annotation interface." 56700aebab04SLingfeng Yang fi 56710aebab04SLingfeng Yangelif test "$tsan" = "yes" ; then 56720aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing sanitize thread interface." 56730aebab04SLingfeng Yangfi 5674247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 5675db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 5676db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 5677247724cbSMarc-André Lureaufi 5678247724cbSMarc-André Lureau 56796542aa9cSPeter Lieven########################################## 56806542aa9cSPeter Lieven# Do we have libnfs 56816542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 5682b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 56836542aa9cSPeter Lieven libnfs="yes" 56846542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 56856542aa9cSPeter Lieven else 56866542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 56878efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 56886542aa9cSPeter Lieven fi 56896542aa9cSPeter Lieven libnfs="no" 56906542aa9cSPeter Lieven fi 56916542aa9cSPeter Lievenfi 56921d728c39SBlue Swirl 56933efac6ebSTomáš Golembiovský########################################## 56943efac6ebSTomáš Golembiovský 56950aebab04SLingfeng Yang# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 56960aebab04SLingfeng Yangif test "$solaris" = "no" && test "$tsan" = "no"; then 5697e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 5698db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 5699e86ecd4bSJuan Quintela fi 5700e86ecd4bSJuan Quintelafi 5701e86ecd4bSJuan Quintela 5702952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 5703952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 5704cb8baa77SMark Cave-Ayland flags="--no-seh --nxcompat" 5705cb8baa77SMark Cave-Ayland 5706cb8baa77SMark Cave-Ayland # Disable ASLR for debug builds to allow debugging with gdb 5707cb8baa77SMark Cave-Ayland if test "$debug" = "no" ; then 5708cb8baa77SMark Cave-Ayland flags="--dynamicbase $flags" 5709cb8baa77SMark Cave-Ayland fi 5710cb8baa77SMark Cave-Ayland 5711cb8baa77SMark Cave-Ayland for flag in $flags; do 5712e9a3591fSChristian Borntraeger if ld_has $flag ; then 5713db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 5714952afb71SBlue Swirl fi 5715952afb71SBlue Swirl done 5716952afb71SBlue Swirlfi 5717952afb71SBlue Swirl 5718e0580342SKamil Rytarowski# We can only support ivshmem if we have eventfd 5719e0580342SKamil Rytarowskiif [ "$eventfd" = "yes" ]; then 5720e0580342SKamil Rytarowski ivshmem=yes 5721e0580342SKamil Rytarowskifi 5722e0580342SKamil Rytarowski 57234b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 5724b855f8d1SPaolo Bonzini if test "$linux" = yes; then 57257e462613SPaolo Bonzini if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then 5726983eef5aSMeador Inge virtfs=yes 5727983eef5aSMeador Inge else 5728983eef5aSMeador Inge if test "$virtfs" = yes; then 57297e462613SPaolo Bonzini error_exit "VirtFS requires libcap-ng devel and libattr devel" 5730983eef5aSMeador Inge fi 573117500370SAndreas Färber virtfs=no 5732983eef5aSMeador Inge fi 5733b855f8d1SPaolo Bonzini else 5734b855f8d1SPaolo Bonzini if test "$virtfs" = yes; then 5735b855f8d1SPaolo Bonzini error_exit "VirtFS is supported only on Linux" 5736b855f8d1SPaolo Bonzini fi 5737b855f8d1SPaolo Bonzini virtfs=no 573817bff52bSM. Mohan Kumar fi 5739ff69fd8cSLaurent Vivierfi 57409d6bc27bSMichael Roth 57419d6bc27bSMichael Roth# Probe for guest agent support/options 57429d6bc27bSMichael Roth 5743e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 5744a5125905SLaurent Vivier if [ "$softmmu" = no -a "$want_tools" = no ] ; then 5745a5125905SLaurent Vivier guest_agent=no 5746a5125905SLaurent Vivier elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 5747e8ef31a3SMichael Tokarev guest_agent=yes 5748e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 5749e8ef31a3SMichael Tokarev guest_agent=no 5750e8ef31a3SMichael Tokarev else 5751e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 5752ca35f780SPaolo Bonzini fi 57534b1c11fdSDaniel P. Berrangefi 5754ca35f780SPaolo Bonzini 57559d6bc27bSMichael Roth# Guest agent Window MSI package 57569d6bc27bSMichael Roth 57579d6bc27bSMichael Rothif test "$guest_agent" != yes; then 57589d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 57599d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 57609d6bc27bSMichael Roth fi 57619d6bc27bSMichael Roth guest_agent_msi=no 57629d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 57639d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 57649d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 57659d6bc27bSMichael Roth fi 57669d6bc27bSMichael Roth guest_agent_msi=no 57679d6bc27bSMichael Rothelif ! has wixl; then 57689d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 57699d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 57709d6bc27bSMichael Roth fi 57719d6bc27bSMichael Roth guest_agent_msi=no 57721a34904eSMichael Rothelse 57731a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 57741a34904eSMichael Roth # disabled explicitly 57751a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 57761a34904eSMichael Roth guest_agent_msi=yes 57771a34904eSMichael Roth fi 57789d6bc27bSMichael Rothfi 57799d6bc27bSMichael Roth 57801a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 57819d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 57829d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 57839d6bc27bSMichael Roth fi 57849d6bc27bSMichael Roth 57859d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 57869d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 57879d6bc27bSMichael Roth fi 57889d6bc27bSMichael Roth 57899d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 57909d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 57919d6bc27bSMichael Roth fi 57929d6bc27bSMichael Roth 57939d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 579489138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 57959d6bc27bSMichael Roth fi 57969d6bc27bSMichael Roth 579789138857SStefan Weil QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 57989d6bc27bSMichael Roth 57999d6bc27bSMichael Roth case "$cpu" in 58009d6bc27bSMichael Roth x86_64) 58019d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 58029d6bc27bSMichael Roth ;; 58039d6bc27bSMichael Roth i386) 58049d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 58059d6bc27bSMichael Roth ;; 58069d6bc27bSMichael Roth *) 58079d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 58089d6bc27bSMichael Roth ;; 58099d6bc27bSMichael Roth esac 58109d6bc27bSMichael Rothfi 58119d6bc27bSMichael Roth 5812ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 5813ca35f780SPaolo Bonziniroms= 5814e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 5815e633a5c6SEric Blake test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 5816e633a5c6SEric Blake test "$softmmu" = yes ; then 5817e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 5818c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 5819c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 5820c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 5821e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 5822e57218b6SPeter Maydell ld_i386_emulation="$emu" 5823ca35f780SPaolo Bonzini roms="optionrom" 5824e57218b6SPeter Maydell break 5825e57218b6SPeter Maydell fi 5826e57218b6SPeter Maydell done 5827ca35f780SPaolo Bonzinifi 5828ca35f780SPaolo Bonzini 58292e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 58309933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 58312e33c3f8SThomas Huth write_c_skeleton 58322e33c3f8SThomas Huth if compile_prog "-march=z900" ""; then 58339933c305SChristian Borntraeger roms="$roms s390-ccw" 58341ef6bfc2SPhilippe Mathieu-Daudé # SLOF is required for building the s390-ccw firmware on s390x, 58351ef6bfc2SPhilippe Mathieu-Daudé # since it is using the libnet code from SLOF for network booting. 58361ef6bfc2SPhilippe Mathieu-Daudé if test -e "${source_path}/.git" ; then 58371ef6bfc2SPhilippe Mathieu-Daudé git_submodules="${git_submodules} roms/SLOF" 58381ef6bfc2SPhilippe Mathieu-Daudé fi 58399933c305SChristian Borntraeger fi 58402e33c3f8SThomas Huthfi 58419933c305SChristian Borntraeger 584211cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 584311cde1c8SBruno 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. 584411cde1c8SBruno Dominguezif has $cxx; then 584511cde1c8SBruno Dominguez cat > $TMPC <<EOF 584611cde1c8SBruno Dominguezint c_function(void); 584711cde1c8SBruno Dominguezint main(void) { return c_function(); } 584811cde1c8SBruno DominguezEOF 584911cde1c8SBruno Dominguez 585011cde1c8SBruno Dominguez compile_object 585111cde1c8SBruno Dominguez 585211cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 585311cde1c8SBruno Dominguezextern "C" { 585411cde1c8SBruno Dominguez int c_function(void); 585511cde1c8SBruno Dominguez} 585611cde1c8SBruno Dominguezint c_function(void) { return 42; } 585711cde1c8SBruno DominguezEOF 585811cde1c8SBruno Dominguez 585911cde1c8SBruno Dominguez update_cxxflags 586011cde1c8SBruno Dominguez 58615770e8afSPaolo Bonzini if do_cxx $CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 586211cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 586311cde1c8SBruno Dominguez : 586411cde1c8SBruno Dominguez else 586511cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 586611cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 586711cde1c8SBruno Dominguez cxx= 586811cde1c8SBruno Dominguez fi 586911cde1c8SBruno Dominguezelse 587011cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 587111cde1c8SBruno Dominguez cxx= 587211cde1c8SBruno Dominguezfi 587311cde1c8SBruno Dominguez 58745d91a2edSYonggang Luoif test $git_update = 'yes' ; then 58755d91a2edSYonggang Luo (cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update "$git_submodules") 58765d91a2edSYonggang Luofi 58775d91a2edSYonggang Luo 587898ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 587997a847bcSbellard 588098ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 588198ec69acSJuan Quintelaecho >> $config_host_mak 588298ec69acSJuan Quintela 5883e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 5884cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 5885aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 5886f62bbee5SDaniel P. Berrangeecho "GIT_UPDATE=$git_update" >> $config_host_mak 5887804edf29SJuan Quintela 588898ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 5889727e5283SPaolo Bonzini 5890f3494749SPaolo Bonziniif test "$default_devices" = "yes" ; then 5891f3494749SPaolo Bonzini echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak 5892f3494749SPaolo Bonzinielse 5893f3494749SPaolo Bonzini echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak 5894f3494749SPaolo Bonzinifi 5895f8393946Saurel32if test "$debug_tcg" = "yes" ; then 58962358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 5897f8393946Saurel32fi 58981625af87Saliguoriif test "$strip_opt" = "yes" ; then 589952ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 59001625af87Saliguorifi 59017d13299dSbellardif test "$bigendian" = "yes" ; then 5902e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 590397a847bcSbellardfi 590467b915a5Sbellardif test "$mingw32" = "yes" ; then 590598ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 590689138857SStefan Weil rc_version=$(cat $source_path/VERSION) 59079fe6de94SBlue Swirl version_major=${rc_version%%.*} 59089fe6de94SBlue Swirl rc_version=${rc_version#*.} 59099fe6de94SBlue Swirl version_minor=${rc_version%%.*} 59109fe6de94SBlue Swirl rc_version=${rc_version#*.} 59119fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 59129fe6de94SBlue Swirl version_micro=0 59139fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 59149fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 5915d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 5916d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 5917f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 5918d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 5919d9840e25STomoki Sekiyama fi 592050cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 592176dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 592250cbebb9SMichael Roth fi 59231a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 59244bad7c3bSStefan Hajnoczi echo "CONFIG_QGA_MSI=y" >> $config_host_mak 59259dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 59269dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 59279dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 59289dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 59299dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 59309dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 59319dacf32dSYossi Hindin fi 5932210fa556Spbrookelse 593335f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 5934210fa556Spbrookfi 5935128ab2ffSblueswir1 5936dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 5937dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 5938dffcb71cSMark McLoughlinfi 5939dffcb71cSMark McLoughlin 594083fb7adfSbellardif test "$darwin" = "yes" ; then 594198ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 594283fb7adfSbellardfi 5943b29fe3edSmalc 5944ec530c81Sbellardif test "$solaris" = "yes" ; then 594598ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 5946ec530c81Sbellardfi 5947179cf400SAndreas Färberif test "$haiku" = "yes" ; then 5948179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 5949179cf400SAndreas Färberfi 595097a847bcSbellardif test "$static" = "yes" ; then 595198ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 595297a847bcSbellardfi 59531ba16968SStefan Weilif test "$profiler" = "yes" ; then 59542358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 595505c2a3e7Sbellardfi 5956c932ce31SPaolo Bonziniif test "$want_tools" = "yes" ; then 5957c932ce31SPaolo Bonzini echo "CONFIG_TOOLS=y" >> $config_host_mak 5958c932ce31SPaolo Bonzinifi 5959f15bff25SPaolo Bonziniif test "$guest_agent" = "yes" ; then 5960f15bff25SPaolo Bonzini echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 5961f15bff25SPaolo Bonzinifi 5962e2d8830eSBradecho "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 59638a16d273Sthsif test "$vde" = "yes" ; then 596498ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 5965e2ad6f16SFam Zheng echo "VDE_LIBS=$vde_libs" >> $config_host_mak 59668a16d273Sthsfi 596758952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 596858952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 596958952137SVincenzo Maffionefi 5970015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 5971015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 5972015a33bdSGongleifi 59734cc600d2SPaolo Bonziniif test "$gprof" = "yes" ; then 59744cc600d2SPaolo Bonzini echo "CONFIG_GPROF=y" >> $config_host_mak 59754cc600d2SPaolo Bonzinifi 597647e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 5977a358bca2SPaolo Bonzini echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak 59783f99cf57SPaolo Bonzini echo "LIBCAP_NG_LIBS=$cap_libs" >> $config_host_mak 597947e98658SCorey Bryantfi 59802358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 59810c58ac1cSmalcfor drv in $audio_drv_list; do 59821ef1ec2aSGerd Hoffmann def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 5983484e2cc7SPaolo Bonzini echo "$def=y" >> $config_host_mak 59840c58ac1cSmalcdone 5985478e943fSPaolo Bonziniif test "$alsa" = "yes" ; then 5986478e943fSPaolo Bonzini echo "CONFIG_ALSA=y" >> $config_host_mak 5987478e943fSPaolo Bonzinifi 5988b1149911SFam Zhengecho "ALSA_LIBS=$alsa_libs" >> $config_host_mak 5989478e943fSPaolo Bonziniecho "ALSA_CFLAGS=$alsa_cflags" >> $config_host_mak 5990478e943fSPaolo Bonziniif test "$libpulse" = "yes" ; then 5991478e943fSPaolo Bonzini echo "CONFIG_LIBPULSE=y" >> $config_host_mak 5992478e943fSPaolo Bonzinifi 5993b1149911SFam Zhengecho "PULSE_LIBS=$pulse_libs" >> $config_host_mak 5994478e943fSPaolo Bonziniecho "PULSE_CFLAGS=$pulse_cflags" >> $config_host_mak 5995b1149911SFam Zhengecho "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 5996b1149911SFam Zhengecho "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 5997b1149911SFam Zhengecho "OSS_LIBS=$oss_libs" >> $config_host_mak 5998478e943fSPaolo Bonziniif test "$libjack" = "yes" ; then 5999478e943fSPaolo Bonzini echo "CONFIG_LIBJACK=y" >> $config_host_mak 6000478e943fSPaolo Bonzinifi 60012e445703SGeoffrey McRaeecho "JACK_LIBS=$jack_libs" >> $config_host_mak 6002d5631638Smalcif test "$audio_win_int" = "yes" ; then 6003d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 6004d5631638Smalcfi 6005b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 6006b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 6007dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 6008dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 6009dce512deSChristoph Hellwigfi 601089138857SStefan Weilqemu_version=$(head $source_path/VERSION) 60112358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 601298ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 60132b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 601417969268SFam Zhengif test "$modules" = "yes"; then 6015e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 6016e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 601789138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 601817969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 601917969268SFam Zhengfi 6020bd83c861SChristian Ehrhardtif test "$module_upgrades" = "yes"; then 6021bd83c861SChristian Ehrhardt echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 6022bd83c861SChristian Ehrhardtfi 6023e633a5c6SEric Blakeif test "$have_x11" = "yes" && test "$need_x11" = "yes"; then 60248781595bSGerd Hoffmann echo "CONFIG_X11=y" >> $config_host_mak 60258781595bSGerd Hoffmann echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 60268781595bSGerd Hoffmann echo "X11_LIBS=$x11_libs" >> $config_host_mak 60278781595bSGerd Hoffmannfi 6028099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 60292358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 6030099d6b0fSRiku Voipiofi 603140ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 603240ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 603340ff6d7eSKevin Wolffi 60343ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 60352358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 60363ce34dfbSvibisreenivasanfi 6037c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 6038c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 6039c2882b96SRiku Voipiofi 6040751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 6041751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 6042751bcc39SMarc-André Lureaufi 6043955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 6044955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 6045955727d2SCortland Tölvafi 6046d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 6047d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 6048d0927938SUlrich Hechtfi 60493d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 60503d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 60513d4fa43eSKusanagi Kouichifi 6052b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 6053b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 6054b953f075SDenis V. Lunevfi 6055ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 6056ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 6057ed911435SKevin Wolffi 6058c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 6059c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 6060c727f47dSPeter Maydellfi 6061dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 6062dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 6063dace20dcSPeter Maydellfi 6064d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 6065d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 6066d0927938SUlrich Hechtfi 60674e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 60684e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 60694e0c6529SAlex Blighfi 6070cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 6071cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 6072cd758dd0SAlex Blighfi 60733b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 60743b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 60753b6edd16SPeter Maydellfi 60763b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 60773b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 60783b6edd16SPeter Maydellfi 6079a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 6080a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 6081a8fd1abaSPeter Maydellfi 608251834341SRiku Voipioif test "$timerfd" = "yes" ; then 608351834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 608451834341SRiku Voipiofi 60859af5c906SRiku Voipioif test "$setns" = "yes" ; then 60869af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 60879af5c906SRiku Voipiofi 608838860a03SAleksandar Markovicif test "$clock_adjtime" = "yes" ; then 608938860a03SAleksandar Markovic echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 609038860a03SAleksandar Markovicfi 60915a03cd00SAleksandar Markovicif test "$syncfs" = "yes" ; then 60925a03cd00SAleksandar Markovic echo "CONFIG_SYNCFS=y" >> $config_host_mak 60935a03cd00SAleksandar Markovicfi 6094db37dd89SAleksandar Markovicif test "$kcov" = "yes" ; then 6095db37dd89SAleksandar Markovic echo "CONFIG_KCOV=y" >> $config_host_mak 6096db37dd89SAleksandar Markovicfi 6097d6092e08SFilip Bozutaif test "$btrfs" = "yes" ; then 6098d6092e08SFilip Bozuta echo "CONFIG_BTRFS=y" >> $config_host_mak 6099d6092e08SFilip Bozutafi 61003b3f24adSaurel32if test "$inotify" = "yes" ; then 61012358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 61023b3f24adSaurel32fi 6103c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 6104c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 6105c05c7a73SRiku Voipiofi 6106401bc051SPeter Maydellif test "$sem_timedwait" = "yes" ; then 6107401bc051SPeter Maydell echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 6108401bc051SPeter Maydellfi 61095c99fa37SKeno Fischerif test "$strchrnul" = "yes" ; then 61105c99fa37SKeno Fischer echo "HAVE_STRCHRNUL=y" >> $config_host_mak 61115c99fa37SKeno Fischerfi 61128a792b03SJiufei Xueif test "$st_atim" = "yes" ; then 61138a792b03SJiufei Xue echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak 61148a792b03SJiufei Xuefi 61156ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 61166ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 61176ae9a1f4SJuan Quintelafi 61186ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 61196ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 61206ae9a1f4SJuan Quintelafi 6121769ce76dSAlexander Grafif test "$curl" = "yes" ; then 6122484e2cc7SPaolo Bonzini echo "CONFIG_CURL=y" >> $config_host_mak 6123b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 61246ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 6125769ce76dSAlexander Graffi 61262e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 612798ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 61288eca2889SFam Zheng echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 61292e4d9fb1Saurel32fi 6130a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 6131484e2cc7SPaolo Bonzini echo "CONFIG_GTK=y" >> $config_host_mak 6132a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 6133014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 6134925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 6135925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 6136925a0400SGerd Hoffmann fi 6137bbbf9bfbSStefan Weilfi 6138f876b765SMarc-André Lureauif test "$gio" = "yes" ; then 6139f876b765SMarc-André Lureau echo "CONFIG_GIO=y" >> $config_host_mak 6140f876b765SMarc-André Lureau echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 6141f876b765SMarc-André Lureau echo "GIO_LIBS=$gio_libs" >> $config_host_mak 614225a97a56SMarc-André Lureau echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 6143f876b765SMarc-André Lureaufi 6144a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 6145ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 6146ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 6147a81df1b6SPaolo Bonzini echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak 6148a81df1b6SPaolo Bonzini echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak 6149ddbb0d09SDaniel P. Berrangefi 615091bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 615191bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 61521f923c70SLongpeng(Mike) if test "$gcrypt_hmac" = "yes" ; then 61531f923c70SLongpeng(Mike) echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 61541f923c70SLongpeng(Mike) fi 615546859d93SDaniel P. Berrangé echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak 615646859d93SDaniel P. Berrangé echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak 615762893b67SDaniel P. Berrangefi 615891bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 615991bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 6160becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 6161a81df1b6SPaolo Bonzini echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak 6162a81df1b6SPaolo Bonzini echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak 6163ed754746SDaniel P. Berrangefi 6164e0576942SDaniel P. Berrangéif test "$qemu_private_xts" = "yes" ; then 6165e0576942SDaniel P. Berrangé echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak 6166e0576942SDaniel P. Berrangéfi 61679a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 61689a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 61699a2fd434SDaniel P. Berrangefi 61708953caf3SDaniel P. Berrangeif test "$auth_pam" = "yes" ; then 61718953caf3SDaniel P. Berrange echo "CONFIG_AUTH_PAM=y" >> $config_host_mak 61728953caf3SDaniel P. Berrangefi 6173559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 6174559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 6175559607eaSDaniel P. Berrangefi 6176e865b97fSChen Gangif test "$have_drm_h" = "yes" ; then 6177e865b97fSChen Gang echo "HAVE_DRM_H=y" >> $config_host_mak 6178e865b97fSChen Gangfi 61796b39b063SEric Blakeif test "$have_broken_size_max" = "yes" ; then 61806b39b063SEric Blake echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 61816b39b063SEric Blakefi 61829df8b20dSThomas Huthif test "$have_openpty" = "yes" ; then 61839df8b20dSThomas Huth echo "HAVE_OPENPTY=y" >> $config_host_mak 61849df8b20dSThomas Huthfi 61852a4b472cSDavid CARLIERif test "$have_sys_signal_h" = "yes" ; then 61862a4b472cSDavid CARLIER echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak 61872a4b472cSDavid CARLIERfi 6188277abf15SJan Vesely 6189277abf15SJan Vesely# Work around a system header bug with some kernel/XFS header 6190277abf15SJan Vesely# versions where they both try to define 'struct fsxattr': 6191277abf15SJan Vesely# xfs headers will not try to redefine structs from linux headers 6192277abf15SJan Vesely# if this macro is set. 6193277abf15SJan Veselyif test "$have_fsxattr" = "yes" ; then 6194277abf15SJan Vesely echo "HAVE_FSXATTR=y" >> $config_host_mak 6195277abf15SJan Veselyfi 61961efad060SFam Zhengif test "$have_copy_file_range" = "yes" ; then 61971efad060SFam Zheng echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 61981efad060SFam Zhengfi 6199bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 6200bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 6201a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 6202e0fb129cSGerd Hoffmann echo "VTE_LIBS=$vte_libs" >> $config_host_mak 6203a4ccabcfSAnthony Liguorifi 62049d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 62059d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 62069d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 62079d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 62089d9e1521SGerd Hoffmannfi 62091badb709SPaolo Bonziniif test "$xen" = "enabled" ; then 62106dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 6211d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 6212582ea95fSMarc-André Lureau echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 6213582ea95fSMarc-André Lureau echo "XEN_LIBS=$xen_libs" >> $config_host_mak 6214e37630caSaliguorifi 62155c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 62165c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 62175c6c3a6cSChristoph Hellwigfi 6218c10dd856SAarushi Mehtaif test "$linux_io_uring" = "yes" ; then 6219c10dd856SAarushi Mehta echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak 6220c10dd856SAarushi Mehta echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak 6221c10dd856SAarushi Mehta echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak 6222c10dd856SAarushi Mehtafi 6223758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 6224758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 6225ec0d5893SMarc-André Lureau echo "LIBATTR_LIBS=$libattr_libs" >> $config_host_mak 6226758e8e38SVenkateswararao Jujjuri (JV)fi 62274f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 62284f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 62294f26f2b6SAvi Kivityfi 6230983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 6231758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 6232758e8e38SVenkateswararao Jujjuri (JV)fi 62335e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 62345e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 62355e9be92dSNicholas Bellingerfi 6236af3bba76SPaolo Bonziniif test "$vhost_net" = "yes" ; then 6237af3bba76SPaolo Bonzini echo "CONFIG_VHOST_NET=y" >> $config_host_mak 6238af3bba76SPaolo Bonzinifi 6239af3bba76SPaolo Bonziniif test "$vhost_net_user" = "yes" ; then 624056f41de7SPaolo Bonzini echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 624103ce5744SNikolay Nikolaevfi 6242108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" ; then 6243108a6481SCindy Lu echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 6244108a6481SCindy Lufi 6245042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 6246042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 6247042cea27SGongleifi 6248fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 6249fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 62505fe97d88SStefano Garzarella if test "$vhost_user" = "yes" ; then 62515fe97d88SStefano Garzarella echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 62525fe97d88SStefano Garzarella fi 6253fc0b9b0eSStefan Hajnoczifi 6254299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" ; then 6255299e6f19SPaolo Bonzini echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 6256299e6f19SPaolo Bonzinifi 6257e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 6258e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 6259e6a74868SMarc-André Lureaufi 6260108a6481SCindy Luif test "$vhost_vdpa" = "yes" ; then 6261108a6481SCindy Lu echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 6262108a6481SCindy Lufi 626398fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" ; then 626498fc1adaSDr. David Alan Gilbert echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 626598fc1adaSDr. David Alan Gilbertfi 6266bf9298b9Saliguoriif test "$iovec" = "yes" ; then 62672358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 6268bf9298b9Saliguorifi 6269ceb42de8Saliguoriif test "$preadv" = "yes" ; then 62702358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 6271ceb42de8Saliguorifi 6272a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 6273a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 6274a40161cbSPaolo Bonzinifi 6275dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 6276dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 6277dcc38d1cSMarcelo Tosattifi 6278d339d766SRichard W.M. Jonesif test "$optreset" = "yes" ; then 6279d339d766SRichard W.M. Jones echo "HAVE_OPTRESET=y" >> $config_host_mak 6280d339d766SRichard W.M. Jonesfi 62811badb709SPaolo Bonziniif test "$tcg" = "enabled"; then 62829195b2c2SStefan Weil if test "$tcg_interpreter" = "yes" ; then 62839195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 62849195b2c2SStefan Weil fi 6285b3f6ea7eSPaolo Bonzinifi 62865f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 62875f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 62885f6b9e8fSBlue Swirlfi 6289e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 6290e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 6291e78815a5SAndreas Färberfi 6292e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 6293e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 6294e78815a5SAndreas Färberfi 62959bc5a719SAndreas Gustafssonif test "$posix_memalign" = "yes" ; then 62969bc5a719SAndreas Gustafsson echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 62979bc5a719SAndreas Gustafssonfi 6298cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 6299cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 63002634733cSPaolo Bonzini echo "SPICE_CFLAGS=$spice_cflags" >> $config_host_mak 63012634733cSPaolo Bonzini echo "SPICE_LIBS=$spice_libs" >> $config_host_mak 6302cd4ec0b4SGerd Hoffmannfi 6303cd4ec0b4SGerd Hoffmann 63047b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 63057b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 63067b62bf5aSFam Zheng echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 63077b62bf5aSFam Zheng echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 6308111a38b0SRobert Relyeafi 6309111a38b0SRobert Relyea 63102b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 63112b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 6312b878b652SFam Zheng echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 6313b878b652SFam Zheng echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 63142b2325ffSGerd Hoffmannfi 63152b2325ffSGerd Hoffmann 631669354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 631769354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 6318cc7923fcSFam Zheng echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 6319cc7923fcSFam Zheng echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 632069354a83SHans de Goedefi 632169354a83SHans de Goede 6322da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 6323da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 6324de2d3005SPaolo Bonzini echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 6325da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 6326014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 6327014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 6328014cb152SGerd Hoffmann fi 632920ff075bSMichael Wallefi 633020ff075bSMichael Walle 6331d52c454aSMarc-André Lureauif test "$gbm" = "yes" ; then 6332d52c454aSMarc-André Lureau echo "CONFIG_GBM=y" >> $config_host_mak 6333d52c454aSMarc-André Lureau echo "GBM_LIBS=$gbm_libs" >> $config_host_mak 6334d52c454aSMarc-André Lureau echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak 6335d52c454aSMarc-André Lureaufi 6336d52c454aSMarc-André Lureau 6337d52c454aSMarc-André Lureau 633899f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 633999f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 634099f2dbd3SLiang Lifi 634199f2dbd3SLiang Li 63426b8cd447SRobert Hooif test "$avx512f_opt" = "yes" ; then 63436b8cd447SRobert Hoo echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 63446b8cd447SRobert Hoofi 63456b8cd447SRobert Hoo 6346607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 6347607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 6348708eab42SMarc-André Lureau echo "LZO_LIBS=$lzo_libs" >> $config_host_mak 6349607dacd0Sqiaonuohanfi 6350607dacd0Sqiaonuohan 6351607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 6352607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 6353708eab42SMarc-André Lureau echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak 6354607dacd0Sqiaonuohanfi 6355607dacd0Sqiaonuohan 63566b383c08SPeter Wuif test "$bzip2" = "yes" ; then 63576b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 63586b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 63596b383c08SPeter Wufi 63606b383c08SPeter Wu 636183bc1f97SJulio Faraccoif test "$lzfse" = "yes" ; then 636283bc1f97SJulio Faracco echo "CONFIG_LZFSE=y" >> $config_host_mak 636383bc1f97SJulio Faracco echo "LZFSE_LIBS=-llzfse" >> $config_host_mak 636483bc1f97SJulio Faraccofi 636583bc1f97SJulio Faracco 63663a678481SJuan Quintelaif test "$zstd" = "yes" ; then 63673a678481SJuan Quintela echo "CONFIG_ZSTD=y" >> $config_host_mak 63685e5733e5SMarc-André Lureau echo "ZSTD_CFLAGS=$zstd_cflags" >> $config_host_mak 63695e5733e5SMarc-André Lureau echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak 63703a678481SJuan Quintelafi 63713a678481SJuan Quintela 6372c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 6373484e2cc7SPaolo Bonzini echo "CONFIG_LIBISCSI=y" >> $config_host_mak 63746ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 63756ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 6376c589b249SRonnie Sahlbergfi 6377c589b249SRonnie Sahlberg 63786542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 6379484e2cc7SPaolo Bonzini echo "CONFIG_LIBNFS=y" >> $config_host_mak 63804be4879fSColin Lord echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 63816542aa9cSPeter Lievenfi 63826542aa9cSPeter Lieven 6383f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 6384f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 6385c3883e1fSFam Zheng echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 6386c3883e1fSFam Zheng echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 6387f794573eSEduardo Otubofi 6388f794573eSEduardo Otubo 638983fb7adfSbellard# XXX: suppress that 63907d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 63912358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 63927d3505c5Sbellardfi 63937d3505c5Sbellard 63943556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 63953556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 63963556c233SPaolo Bonzinifi 6397f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 6398484e2cc7SPaolo Bonzini echo "CONFIG_RBD=y" >> $config_host_mak 63996ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 6400f27aaf4bSChristian Brunnerfi 640120ff6c80SAnthony Liguori 64027c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 640370c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 640470c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 640570c60c08SStefan Hajnoczielse 640670c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 640770c60c08SStefan Hajnoczifi 6408d0e2fce5SAneesh Kumar K.V 64097d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 64107d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 64117d992e4dSPeter Lievenfi 64127d992e4dSPeter Lieven 6413f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 6414f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 6415f0d92b56SLongpeng(Mike)fi 6416f0d92b56SLongpeng(Mike) 6417d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 6418d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 6419d2042378SAneesh Kumar K.Vfi 6420d2042378SAneesh Kumar K.V 6421e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 6422e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 6423e06a765eSHarsh Prateek Borafi 6424e06a765eSHarsh Prateek Bora 64253f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 64263f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 64273f4349dcSKevin Wolffi 64283f4349dcSKevin Wolf 6429d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 6430d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 6431d83414e1SMarc-André Lureaufi 6432d83414e1SMarc-André Lureau 64330aebab04SLingfeng Yangif test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 64340aebab04SLingfeng Yang echo "CONFIG_TSAN=y" >> $config_host_mak 64350aebab04SLingfeng Yangfi 64360aebab04SLingfeng Yang 64378ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 64388ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 64398ab1bf12SLuiz Capitulinofi 64408ab1bf12SLuiz Capitulino 644176a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 644276a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 644376a347e1SRichard Hendersonfi 644476a347e1SRichard Henderson 6445f540166bSRichard Hendersonif test "$int128" = "yes" ; then 6446f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 6447f540166bSRichard Hendersonfi 6448f540166bSRichard Henderson 64497ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 64507ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 64517ebee43eSRichard Hendersonfi 64527ebee43eSRichard Henderson 6453e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 6454e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 6455e6cd4bb5SRichard Hendersonfi 6456e6cd4bb5SRichard Henderson 6457df79b996SRichard Hendersonif test "$atomic64" = "yes" ; then 6458df79b996SRichard Henderson echo "CONFIG_ATOMIC64=y" >> $config_host_mak 6459df79b996SRichard Hendersonfi 6460df79b996SRichard Henderson 6461db8aaae8SRichard Hendersonif test "$attralias" = "yes" ; then 6462db8aaae8SRichard Henderson echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak 6463db8aaae8SRichard Hendersonfi 6464db8aaae8SRichard Henderson 64651e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 64661e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 64671e6e9acaSRichard Hendersonfi 64681e6e9acaSRichard Henderson 6469eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 6470484e2cc7SPaolo Bonzini echo "CONFIG_GLUSTERFS=y" >> $config_host_mak 64716ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 64726ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 6473eb100396SBharata B Raofi 6474eb100396SBharata B Rao 6475d85fa9ebSJeff Codyif test "$glusterfs_xlator_opt" = "yes" ; then 6476d85fa9ebSJeff Cody echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 6477d85fa9ebSJeff Codyfi 6478d85fa9ebSJeff Cody 64790c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 64800c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 64810c14fb47SBharata B Raofi 64820c14fb47SBharata B Rao 6483df3a429aSNiels de Vosif test "$glusterfs_fallocate" = "yes" ; then 6484df3a429aSNiels de Vos echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 6485df3a429aSNiels de Vosfi 6486df3a429aSNiels de Vos 64877c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 64887c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 64897c815372SBharata B Raofi 64907c815372SBharata B Rao 6491e014dbe7SPrasanna Kumar Kaleverif test "$glusterfs_ftruncate_has_stat" = "yes" ; then 6492e014dbe7SPrasanna Kumar Kalever echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak 6493e014dbe7SPrasanna Kumar Kaleverfi 6494e014dbe7SPrasanna Kumar Kalever 64950e3b891fSNiels de Vosif test "$glusterfs_iocb_has_stat" = "yes" ; then 64960e3b891fSNiels de Vos echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak 64970e3b891fSNiels de Vosfi 64980e3b891fSNiels de Vos 6499b10d49d7SPino Toscanoif test "$libssh" = "yes" ; then 6500484e2cc7SPaolo Bonzini echo "CONFIG_LIBSSH=y" >> $config_host_mak 6501b10d49d7SPino Toscano echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 6502b10d49d7SPino Toscano echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 65030a12ec87SRichard W.M. Jonesfi 65040a12ec87SRichard W.M. Jones 6505ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 6506ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 6507ed1701c6SDr. David Alan Gilbertfi 6508ed1701c6SDr. David Alan Gilbert 65093b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 65103cae16dbSPaolo Bonzini echo 'CONFIG_TPM=y' >> $config_host_mak 65113b8acc11SPaolo Bonzinifi 65123b8acc11SPaolo Bonzini 65135b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 65145b808275SLluís Vilanovaif have_backend "nop"; then 65156d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 651622890ab5SPrerna Saxenafi 65175b808275SLluís Vilanovaif have_backend "simple"; then 65186d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 65196d8a764eSLluís # Set the appropriate trace file. 6520953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 65219410b56cSPrerna Saxenafi 6522ed7f5f1dSPaolo Bonziniif have_backend "log"; then 6523ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 65246d8a764eSLluísfi 65255b808275SLluís Vilanovaif have_backend "ust"; then 65266d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 6527a81df1b6SPaolo Bonzini echo "LTTNG_UST_LIBS=$lttng_ust_libs" >> $config_host_mak 6528a81df1b6SPaolo Bonzini echo "URCU_BP_LIBS=$urcu_bp_libs" >> $config_host_mak 65296d8a764eSLluísfi 65305b808275SLluís Vilanovaif have_backend "dtrace"; then 65316d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 65326d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 65336d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 65346d8a764eSLluís fi 6535c276b17dSDaniel P. Berrangefi 65365b808275SLluís Vilanovaif have_backend "ftrace"; then 6537781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 6538781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 6539781e9545SEiichi Tsukata else 654021684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 6541781e9545SEiichi Tsukata fi 6542781e9545SEiichi Tsukatafi 65430a852417SPaul Durrantif have_backend "syslog"; then 65440a852417SPaul Durrant if test "$posix_syslog" = "yes" ; then 65450a852417SPaul Durrant echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 65460a852417SPaul Durrant else 65470a852417SPaul Durrant feature_not_found "syslog(trace backend)" "syslog not available" 65480a852417SPaul Durrant fi 65490a852417SPaul Durrantfi 65509410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 65519410b56cSPrerna Saxena 65522da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 65532da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 6554392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 65552da776dbSMichael R. Hinesfi 65562da776dbSMichael R. Hines 655721ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 655821ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 655921ab34c9SMarcel Apfelbaumfi 656021ab34c9SMarcel Apfelbaum 6561575b22b1SLaurent Vivierif test "$have_rtnetlink" = "yes" ; then 6562575b22b1SLaurent Vivier echo "CONFIG_RTNETLINK=y" >> $config_host_mak 6563575b22b1SLaurent Vivierfi 6564575b22b1SLaurent Vivier 6565ed279a06SKlim Kireevif test "$libxml2" = "yes" ; then 6566ed279a06SKlim Kireev echo "CONFIG_LIBXML2=y" >> $config_host_mak 6567ed279a06SKlim Kireev echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 6568ed279a06SKlim Kireev echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 6569ed279a06SKlim Kireevfi 6570ed279a06SKlim Kireev 6571a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 6572a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 6573a6b1d4c0SChanglong Xiefi 6574a6b1d4c0SChanglong Xie 65756a02c806SStefan Hajnocziif test "$have_af_vsock" = "yes" ; then 65766a02c806SStefan Hajnoczi echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 65776a02c806SStefan Hajnoczifi 65786a02c806SStefan Hajnoczi 65794d04351fSChristopher Covingtonif test "$have_sysmacros" = "yes" ; then 65804d04351fSChristopher Covington echo "CONFIG_SYSMACROS=y" >> $config_host_mak 65814d04351fSChristopher Covingtonfi 65824d04351fSChristopher Covington 658349e00a18SAndreas Grapentinif test "$have_static_assert" = "yes" ; then 658449e00a18SAndreas Grapentin echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 658549e00a18SAndreas Grapentinfi 658649e00a18SAndreas Grapentin 6587e674605fSTomáš Golembiovskýif test "$have_utmpx" = "yes" ; then 6588e674605fSTomáš Golembiovský echo "HAVE_UTMPX=y" >> $config_host_mak 6589e674605fSTomáš Golembiovskýfi 6590db1ed1abSRichard Hendersonif test "$have_getrandom" = "yes" ; then 6591db1ed1abSRichard Henderson echo "CONFIG_GETRANDOM=y" >> $config_host_mak 6592db1ed1abSRichard Hendersonfi 6593e0580342SKamil Rytarowskiif test "$ivshmem" = "yes" ; then 6594e0580342SKamil Rytarowski echo "CONFIG_IVSHMEM=y" >> $config_host_mak 6595e0580342SKamil Rytarowskifi 6596ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 6597ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 6598ba59fb77SPaolo Bonzinifi 6599e0580342SKamil Rytarowski 66005c312079SDr. David Alan Gilbert# Hold two types of flag: 66015c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 66025c312079SDr. David Alan Gilbert# a thread we have a handle to 6603479a5747SRoman Bolshakov# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular 66045c312079SDr. David Alan Gilbert# platform 6605479a5747SRoman Bolshakovif test "$pthread_setname_np_w_tid" = "yes" ; then 66065c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 6607479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak 6608479a5747SRoman Bolshakovelif test "$pthread_setname_np_wo_tid" = "yes" ; then 6609479a5747SRoman Bolshakov echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 6610479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak 66115c312079SDr. David Alan Gilbertfi 66125c312079SDr. David Alan Gilbert 661317824406SJunyan Heif test "$libpmem" = "yes" ; then 661417824406SJunyan He echo "CONFIG_LIBPMEM=y" >> $config_host_mak 6615c9322ab5SMarc-André Lureau echo "LIBPMEM_LIBS=$libpmem_libs" >> $config_host_mak 6616c9322ab5SMarc-André Lureau echo "LIBPMEM_CFLAGS=$libpmem_cflags" >> $config_host_mak 661717824406SJunyan Hefi 661817824406SJunyan He 661921b2eca6SJingqi Liuif test "$libdaxctl" = "yes" ; then 662021b2eca6SJingqi Liu echo "CONFIG_LIBDAXCTL=y" >> $config_host_mak 6621c7c91a74SBruce Rogers echo "LIBDAXCTL_LIBS=$libdaxctl_libs" >> $config_host_mak 662221b2eca6SJingqi Liufi 662321b2eca6SJingqi Liu 66242f740136SJeff Codyif test "$bochs" = "yes" ; then 66252f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 66262f740136SJeff Codyfi 66272f740136SJeff Codyif test "$cloop" = "yes" ; then 66282f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 66292f740136SJeff Codyfi 66302f740136SJeff Codyif test "$dmg" = "yes" ; then 66312f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 66322f740136SJeff Codyfi 66332f740136SJeff Codyif test "$qcow1" = "yes" ; then 66342f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 66352f740136SJeff Codyfi 66362f740136SJeff Codyif test "$vdi" = "yes" ; then 66372f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 66382f740136SJeff Codyfi 66392f740136SJeff Codyif test "$vvfat" = "yes" ; then 66402f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 66412f740136SJeff Codyfi 66422f740136SJeff Codyif test "$qed" = "yes" ; then 66432f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 66442f740136SJeff Codyfi 66452f740136SJeff Codyif test "$parallels" = "yes" ; then 66462f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 66472f740136SJeff Codyfi 66482f740136SJeff Codyif test "$sheepdog" = "yes" ; then 6649e1c42697SDaniel P. Berrangé add_to deprecated_features "sheepdog" 66502f740136SJeff Cody echo "CONFIG_SHEEPDOG=y" >> $config_host_mak 66512f740136SJeff Codyfi 6652c9c8b88fSDavid CARLIERif test "$pty_h" = "yes" ; then 6653c9c8b88fSDavid CARLIER echo "HAVE_PTY_H=y" >> $config_host_mak 6654c9c8b88fSDavid CARLIERfi 6655195588ccSDavid CARLIERif test "$have_mlockall" = "yes" ; then 6656195588ccSDavid CARLIER echo "HAVE_MLOCKALL=y" >> $config_host_mak 6657195588ccSDavid CARLIERfi 6658adc28027SAlexander Bulekovif test "$fuzzing" = "yes" ; then 665954c9e41dSAlexander Bulekov # If LIB_FUZZING_ENGINE is set, assume we are running on OSS-Fuzz, and the 666054c9e41dSAlexander Bulekov # needed CFLAGS have already been provided 666154c9e41dSAlexander Bulekov if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then 6662086d5f75SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" 666354c9e41dSAlexander Bulekov FUZZ_EXE_LDFLAGS="-fsanitize=fuzzer" 666454c9e41dSAlexander Bulekov else 666554c9e41dSAlexander Bulekov FUZZ_EXE_LDFLAGS="$LIB_FUZZING_ENGINE" 666654c9e41dSAlexander Bulekov fi 6667adc28027SAlexander Bulekovfi 66682f740136SJeff Cody 666940e8c6f4SAlex Bennéeif test "$plugins" = "yes" ; then 667040e8c6f4SAlex Bennée echo "CONFIG_PLUGIN=y" >> $config_host_mak 667126fffe29SEmilio G. Cota # Copy the export object list to the build dir 667226fffe29SEmilio G. Cota if test "$ld_dynamic_list" = "yes" ; then 667326fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 667426fffe29SEmilio G. Cota ld_symbols=qemu-plugins-ld.symbols 667526fffe29SEmilio G. Cota cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 667626fffe29SEmilio G. Cota elif test "$ld_exported_symbols_list" = "yes" ; then 667726fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 667826fffe29SEmilio G. Cota ld64_symbols=qemu-plugins-ld64.symbols 667926fffe29SEmilio G. Cota echo "# Automatically generated by configure - do not modify" > $ld64_symbols 668026fffe29SEmilio G. Cota grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 668126fffe29SEmilio G. Cota sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 668226fffe29SEmilio G. Cota else 668326fffe29SEmilio G. Cota error_exit \ 668426fffe29SEmilio G. Cota "If \$plugins=yes, either \$ld_dynamic_list or " \ 668526fffe29SEmilio G. Cota "\$ld_exported_symbols_list should have been set to 'yes'." 668626fffe29SEmilio G. Cota fi 668740e8c6f4SAlex Bennéefi 668840e8c6f4SAlex Bennée 6689f48e590aSAlex Bennéeif test -n "$gdb_bin" ; then 6690f48e590aSAlex Bennée echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 6691f48e590aSAlex Bennéefi 6692f48e590aSAlex Bennée 669354e7aac0SAlexey Krasikovif test "$secret_keyring" = "yes" ; then 669454e7aac0SAlexey Krasikov echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 669554e7aac0SAlexey Krasikovfi 669654e7aac0SAlexey Krasikov 669798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 6698804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 6699c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 670039d87c8cSAlex Bennéeecho "GENISOIMAGE=$genisoimage" >> $config_host_mak 6701a5665051SPaolo Bonziniecho "MESON=$meson" >> $config_host_mak 670209e93326SPaolo Bonziniecho "NINJA=$ninja" >> $config_host_mak 6703804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 6704a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 6705859aef02SPaolo Bonzini echo "CONFIG_IASL=$iasl" >> $config_host_mak 6706a31a8642SMichael S. Tsirkinfi 670783f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 67083c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 6709804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 671045d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 6711cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 67125f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 67133dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 6714804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 6715804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 67169f81aeb5SAlistair Francisecho "RANLIB=$ranlib" >> $config_host_mak 67174852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 6718daa79d9aSAlex Bennéeecho "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak 67199fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 672046eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 6721a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 672211cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 6723a81df1b6SPaolo Bonziniecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 6724a81df1b6SPaolo Bonziniecho "GLIB_LIBS=$glib_libs" >> $config_host_mak 67258a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 6726db5adeaaSPaolo Bonziniecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 6727e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 6728804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 6729484e2cc7SPaolo Bonziniecho "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak 6730f15bff25SPaolo Bonziniecho "LIBS_QGA=$libs_qga" >> $config_host_mak 673190246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 673290246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 67331d728c39SBlue Swirlif test "$gcov" = "yes" ; then 67341d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 67351d728c39SBlue Swirlfi 6736804edf29SJuan Quintela 6737adc28027SAlexander Bulekovif test "$fuzzing" != "no"; then 6738adc28027SAlexander Bulekov echo "CONFIG_FUZZ=y" >> $config_host_mak 6739adc28027SAlexander Bulekovfi 674054c9e41dSAlexander Bulekovecho "FUZZ_EXE_LDFLAGS=$FUZZ_EXE_LDFLAGS" >> $config_host_mak 67413efac6ebSTomáš Golembiovský 6742b767d257SMarek Marczykowski-Góreckiif test "$rng_none" = "yes"; then 6743b767d257SMarek Marczykowski-Górecki echo "CONFIG_RNG_NONE=y" >> $config_host_mak 6744b767d257SMarek Marczykowski-Góreckifi 6745b767d257SMarek Marczykowski-Górecki 67466efd7517SPeter Maydell# use included Linux headers 67476efd7517SPeter Maydellif test "$linux" = "yes" ; then 6748a307beb6SAndreas Färber mkdir -p linux-headers 67496efd7517SPeter Maydell case "$cpu" in 6750c72b26ecSRichard Henderson i386|x86_64|x32) 675108312a63SPeter Maydell linux_arch=x86 67526efd7517SPeter Maydell ;; 6753f8378accSRichard Henderson ppc|ppc64|ppc64le) 675408312a63SPeter Maydell linux_arch=powerpc 67556efd7517SPeter Maydell ;; 67566efd7517SPeter Maydell s390x) 675708312a63SPeter Maydell linux_arch=s390 675808312a63SPeter Maydell ;; 67591f080313SClaudio Fontana aarch64) 67601f080313SClaudio Fontana linux_arch=arm64 67611f080313SClaudio Fontana ;; 6762222e7d11SSanjay Lal mips64) 6763222e7d11SSanjay Lal linux_arch=mips 6764222e7d11SSanjay Lal ;; 676508312a63SPeter Maydell *) 676608312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 676708312a63SPeter Maydell linux_arch="$cpu" 67686efd7517SPeter Maydell ;; 67696efd7517SPeter Maydell esac 677008312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 677108312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 677208312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 677308312a63SPeter Maydell fi 67746efd7517SPeter Maydellfi 67756efd7517SPeter Maydell 677697a847bcSbellardfor target in $target_list; do 677797a847bcSbellard target_dir="$target" 677889138857SStefan Weil target_name=$(echo $target | cut -d '-' -f 1) 677997a847bcSbellard mkdir -p $target_dir 6780fdb75aefSPaolo Bonzini case $target in 6781fdb75aefSPaolo Bonzini *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; 6782fdb75aefSPaolo Bonzini *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; 67832408a527Saurel32 esac 678456aebc89Spbrookdone 67857d13299dSbellard 6786765686d6SPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak 6787fdb75aefSPaolo Bonziniif test "$default_targets" = "yes"; then 6788fdb75aefSPaolo Bonzini echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 6789fdb75aefSPaolo Bonzinifi 6790a540f158SPeter Crosthwaite 6791a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 6792a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 6793ab318051SMarc-André Lureau echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 6794a99d57bbSWanlong Gaofi 6795a99d57bbSWanlong Gao 6796fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 6797fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 6798fd0e6053SJohn Snowfi 6799fd0e6053SJohn Snow 68001e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 68011e4f6065SDaniele Buono echo "CONFIG_SAFESTACK=y" >> $config_host_mak 68021e4f6065SDaniele Buonofi 68031e4f6065SDaniele Buono 6804e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 6805e29e5c6eSPeter Maydell# DIRS are directories which we simply mkdir in the build tree; 6806e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 6807e29e5c6eSPeter Maydell# (these can be both files and directories). 6808e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 6809e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 6810e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 6811e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 6812e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 6813e29e5c6eSPeter Maydell# directory and symlink the directory instead. 681409db9b9dSGerd Hoffmann# UNLINK is used to remove symlinks from older development versions 681509db9b9dSGerd Hoffmann# that might get into the way when doing "git update" without doing 681609db9b9dSGerd Hoffmann# a "make distclean" in between. 68171cf4323eSThomas HuthDIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" 68181cf4323eSThomas HuthDIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 6819b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 6820744a928cSAlexey KardashevskiyDIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 68218db2a4fdSGerd HoffmannDIRS="$DIRS roms/seabios" 6822c17a386bSAlex BennéeDIRS="$DIRS contrib/plugins/" 68232038f8c8SPaolo BonziniLINKS="Makefile" 6824e8f3bd71SMarc-André LureauLINKS="$LINKS tests/tcg/lm32/Makefile" 68253941996bSPaolo BonziniLINKS="$LINKS tests/tcg/Makefile.target" 6826ddcf607fSGerd HoffmannLINKS="$LINKS pc-bios/optionrom/Makefile" 6827e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 68288db2a4fdSGerd HoffmannLINKS="$LINKS roms/seabios/Makefile" 6829e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 6830e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 683139950353SPeter MaydellLINKS="$LINKS tests/acceptance tests/data" 683239950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 68338f8fd9edSCleber RosaLINKS="$LINKS python" 6834c17a386bSAlex BennéeLINKS="$LINKS contrib/plugins/Makefile " 683509db9b9dSGerd HoffmannUNLINK="pc-bios/keymaps" 6836753d11f2SRichard Hendersonfor bios_file in \ 6837753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 68383a631b8eSBin Meng $source_path/pc-bios/*.elf \ 6839225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 6840753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 6841753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 6842e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 6843753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 68444e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 684526ce90fdSLaszlo Ersek $source_path/pc-bios/edk2-*.fd.bz2 \ 6846753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 6847753d11f2SRichard Hendersondo 6848e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 68497ea78b74SJan Kiszkadone 6850d1807a4fSPaolo Bonzinimkdir -p $DIRS 6851e29e5c6eSPeter Maydellfor f in $LINKS ; do 68520f4d8894SPaolo Bonzini if [ -e "$source_path/$f" ]; then 6853f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 6854f9245e10SPeter Maydell fi 68557d13299dSbellarddone 685609db9b9dSGerd Hoffmannfor f in $UNLINK ; do 685709db9b9dSGerd Hoffmann if [ -L "$f" ]; then 685809db9b9dSGerd Hoffmann rm -f "$f" 685909db9b9dSGerd Hoffmann fi 686009db9b9dSGerd Hoffmanndone 68611ad2134fSPaul Brook 68622038f8c8SPaolo Bonzini(for i in $cross_cc_vars; do 68632038f8c8SPaolo Bonzini export $i 68642038f8c8SPaolo Bonzinidone 6865afc3a8f9SAlex Bennéeexport target_list source_path use_containers 68662038f8c8SPaolo Bonzini$source_path/tests/tcg/configure.sh) 68672038f8c8SPaolo Bonzini 6868c34ebfdcSAnthony Liguori# temporary config to build submodules 68698db2a4fdSGerd Hoffmannfor rom in seabios; do 6870c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 687137116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 6872c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 6873cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 68745f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 6875c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 6876c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 68773dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 6878c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 6879a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 6880c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 68819f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 6882c34ebfdcSAnthony Liguoridone 6883c34ebfdcSAnthony Liguori 688476c7560aSMax Reitz# set up qemu-iotests in this build directory 688576c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 688676c7560aSMax Reitz 688776c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 688876c7560aSMax Reitzecho >> "$iotests_common_env" 688976c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 689076c7560aSMax Reitz 6891a5665051SPaolo Bonziniif test "$skip_meson" = no; then 6892fc929892SMarc-André Lureaucross="config-meson.cross.new" 6893fc929892SMarc-André Lureaumeson_quote() { 689447b30835SPaolo Bonzini echo "'$(echo $* | sed "s/ /','/g")'" 6895fc929892SMarc-André Lureau} 6896fc929892SMarc-André Lureau 6897fc929892SMarc-André Lureauecho "# Automatically generated by configure - do not modify" > $cross 6898fc929892SMarc-André Lureauecho "[properties]" >> $cross 6899fc929892SMarc-André Lureautest -z "$cxx" && echo "link_language = 'c'" >> $cross 690047b30835SPaolo Bonziniecho "[built-in options]" >> $cross 690147b30835SPaolo Bonziniecho "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross 690247b30835SPaolo Bonziniecho "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross 690347b30835SPaolo Bonziniecho "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 690447b30835SPaolo Bonziniecho "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 6905fc929892SMarc-André Lureauecho "[binaries]" >> $cross 690647b30835SPaolo Bonziniecho "c = [$(meson_quote $cc)]" >> $cross 690747b30835SPaolo Bonzinitest -n "$cxx" && echo "cpp = [$(meson_quote $cxx)]" >> $cross 690847b30835SPaolo Bonziniecho "ar = [$(meson_quote $ar)]" >> $cross 690947b30835SPaolo Bonziniecho "nm = [$(meson_quote $nm)]" >> $cross 691047b30835SPaolo Bonziniecho "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross 691147b30835SPaolo Bonziniecho "ranlib = [$(meson_quote $ranlib)]" >> $cross 6912e8178514SPaolo Bonziniif has $sdl2_config; then 691347b30835SPaolo Bonzini echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 6914e8178514SPaolo Bonzinifi 691547b30835SPaolo Bonziniecho "strip = [$(meson_quote $strip)]" >> $cross 691647b30835SPaolo Bonziniecho "windres = [$(meson_quote $windres)]" >> $cross 6917fc929892SMarc-André Lureauif test -n "$cross_prefix"; then 6918fc929892SMarc-André Lureau cross_arg="--cross-file config-meson.cross" 6919fc929892SMarc-André Lureau echo "[host_machine]" >> $cross 6920fc929892SMarc-André Lureau if test "$mingw32" = "yes" ; then 6921fc929892SMarc-André Lureau echo "system = 'windows'" >> $cross 6922fc929892SMarc-André Lureau fi 6923853b4bafSThomas Huth if test "$linux" = "yes" ; then 6924853b4bafSThomas Huth echo "system = 'linux'" >> $cross 6925853b4bafSThomas Huth fi 6926fc929892SMarc-André Lureau case "$ARCH" in 6927fc929892SMarc-André Lureau i386|x86_64) 6928fc929892SMarc-André Lureau echo "cpu_family = 'x86'" >> $cross 6929fc929892SMarc-André Lureau ;; 6930fc929892SMarc-André Lureau ppc64le) 6931fc929892SMarc-André Lureau echo "cpu_family = 'ppc64'" >> $cross 6932fc929892SMarc-André Lureau ;; 6933fc929892SMarc-André Lureau *) 6934fc929892SMarc-André Lureau echo "cpu_family = '$ARCH'" >> $cross 6935fc929892SMarc-André Lureau ;; 6936fc929892SMarc-André Lureau esac 6937fc929892SMarc-André Lureau echo "cpu = '$cpu'" >> $cross 6938fc929892SMarc-André Lureau if test "$bigendian" = "yes" ; then 6939fc929892SMarc-André Lureau echo "endian = 'big'" >> $cross 6940fc929892SMarc-André Lureau else 6941fc929892SMarc-André Lureau echo "endian = 'little'" >> $cross 6942fc929892SMarc-André Lureau fi 6943fc929892SMarc-André Lureauelse 6944fc929892SMarc-André Lureau cross_arg="--native-file config-meson.cross" 6945fc929892SMarc-André Lureaufi 6946fc929892SMarc-André Lureaumv $cross config-meson.cross 6947fc929892SMarc-André Lureau 6948a5665051SPaolo Bonzinirm -rf meson-private meson-info meson-logs 694909e93326SPaolo BonziniNINJA=$ninja $meson setup \ 6950d17f305aSPaolo Bonzini --prefix "$prefix" \ 6951d17f305aSPaolo Bonzini --libdir "$libdir" \ 6952d17f305aSPaolo Bonzini --libexecdir "$libexecdir" \ 6953d17f305aSPaolo Bonzini --bindir "$bindir" \ 6954d17f305aSPaolo Bonzini --includedir "$includedir" \ 6955d17f305aSPaolo Bonzini --datadir "$datadir" \ 6956d17f305aSPaolo Bonzini --mandir "$mandir" \ 6957d17f305aSPaolo Bonzini --sysconfdir "$sysconfdir" \ 695816bf7a33SPaolo Bonzini --localedir "$localedir" \ 6959d17f305aSPaolo Bonzini --localstatedir "$local_statedir" \ 6960d17f305aSPaolo Bonzini -Ddocdir="$docdir" \ 696116bf7a33SPaolo Bonzini -Dqemu_firmwarepath="$firmwarepath" \ 696273f3aa37SMarc-André Lureau -Dqemu_suffix="$qemu_suffix" \ 6963a5665051SPaolo Bonzini -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 6964a5665051SPaolo Bonzini -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 6965a5665051SPaolo Bonzini -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 6966a5665051SPaolo Bonzini -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 6967da6d48b9SMarc-André Lureau -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 69680c3dd50eSPaolo Bonzini -Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 6969bf0e56a3SMarc-André Lureau -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 6970deb62371SPaolo Bonzini -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ 69711badb709SPaolo Bonzini -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ 69721badb709SPaolo Bonzini -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ 6973b4e312e9SPaolo Bonzini -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ 6974a0b93237SPaolo Bonzini -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ 69750a40bcb7SCésar Belley -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ 6976fbb4121dSPaolo Bonzini -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ 69775c53015aSPaolo Bonzini -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ 6978*c8d5450bSPaolo Bonzini -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ 6979fc929892SMarc-André Lureau $cross_arg \ 6980a5665051SPaolo Bonzini "$PWD" "$source_path" 6981a5665051SPaolo Bonzini 6982a5665051SPaolo Bonziniif test "$?" -ne 0 ; then 6983a5665051SPaolo Bonzini error_exit "meson setup failed" 6984a5665051SPaolo Bonzinifi 6985a5665051SPaolo Bonzinifi 6986a5665051SPaolo Bonzini 69872d838d9bSAlex Bennéeif test -n "${deprecated_features}"; then 69882d838d9bSAlex Bennée echo "Warning, deprecated features enabled." 69892d838d9bSAlex Bennée echo "Please see docs/system/deprecated.rst" 69902d838d9bSAlex Bennée echo " features: ${deprecated_features}" 69912d838d9bSAlex Bennéefi 69922d838d9bSAlex Bennée 6993dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 6994dc655404SMichael S. Tsirkincat <<EOD >config.status 6995dc655404SMichael S. Tsirkin#!/bin/sh 6996dc655404SMichael S. Tsirkin# Generated by configure. 6997dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 6998dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 6999dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 7000dc655404SMichael S. TsirkinEOD 7001e811da7fSDaniel P. Berrangé 7002e811da7fSDaniel P. Berrangépreserve_env() { 7003e811da7fSDaniel P. Berrangé envname=$1 7004e811da7fSDaniel P. Berrangé 7005e811da7fSDaniel P. Berrangé eval envval=\$$envname 7006e811da7fSDaniel P. Berrangé 7007e811da7fSDaniel P. Berrangé if test -n "$envval" 7008e811da7fSDaniel P. Berrangé then 7009e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 7010e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 7011e811da7fSDaniel P. Berrangé else 7012e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 7013e811da7fSDaniel P. Berrangé fi 7014e811da7fSDaniel P. Berrangé} 7015e811da7fSDaniel P. Berrangé 7016e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 7017e811da7fSDaniel P. Berrangé# features/build target configure will detect 7018e811da7fSDaniel P. Berrangépreserve_env AR 7019e811da7fSDaniel P. Berrangépreserve_env AS 7020e811da7fSDaniel P. Berrangépreserve_env CC 7021e811da7fSDaniel P. Berrangépreserve_env CPP 7022e811da7fSDaniel P. Berrangépreserve_env CXX 7023e811da7fSDaniel P. Berrangépreserve_env INSTALL 7024e811da7fSDaniel P. Berrangépreserve_env LD 7025e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 7026e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 7027e811da7fSDaniel P. Berrangépreserve_env MAKE 7028e811da7fSDaniel P. Berrangépreserve_env NM 7029e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 7030e811da7fSDaniel P. Berrangépreserve_env PATH 7031e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 7032e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 7033e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 7034e811da7fSDaniel P. Berrangépreserve_env PYTHON 7035e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 7036e811da7fSDaniel P. Berrangépreserve_env SMBD 7037e811da7fSDaniel P. Berrangépreserve_env STRIP 7038e811da7fSDaniel P. Berrangépreserve_env WINDRES 7039e811da7fSDaniel P. Berrangé 7040dc655404SMichael S. Tsirkinprintf "exec" >>config.status 7041a5665051SPaolo Bonzinifor i in "$0" "$@"; do 7042a5665051SPaolo Bonzini test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status 7043a5665051SPaolo Bonzinidone 7044cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 7045dc655404SMichael S. Tsirkinchmod +x config.status 7046dc655404SMichael S. Tsirkin 70478cd05ab6SPeter Maydellrm -r "$TMPDIR1" 7048