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="" 298377529c0SPaolo Bonzinicurses="" 299377529c0SPaolo Bonzinidocs="" 300fbb4121dSPaolo Bonzinifdt="auto" 30158952137SVincenzo Maffionenetmap="no" 30235be72baSPaolo Bonzinisdl="auto" 30335be72baSPaolo Bonzinisdl_image="auto" 304983eef5aSMeador Ingevirtfs="" 3056ec0e15dSPaolo Bonzinimpath="auto" 306a0b93237SPaolo Bonzinivnc="enabled" 307deb62371SPaolo Bonzinisparse="auto" 308377529c0SPaolo Bonzinivde="" 309a0b93237SPaolo Bonzinivnc_sasl="auto" 310a0b93237SPaolo Bonzinivnc_jpeg="auto" 311a0b93237SPaolo Bonzinivnc_png="auto" 3124113f4cfSLaurent Vivierxkbcommon="auto" 313377529c0SPaolo Bonzinixen="" 314d5b93ddfSAnthony PERARDxen_ctrl_version="" 3151badb709SPaolo Bonzinixen_pci_passthrough="auto" 316377529c0SPaolo Bonzinilinux_aio="" 317c10dd856SAarushi Mehtalinux_io_uring="" 31847e98658SCorey Bryantcap_ng="" 319377529c0SPaolo Bonziniattr="" 3204f26f2b6SAvi Kivitylibattr="" 321377529c0SPaolo Bonzinixfs="" 3221badb709SPaolo Bonzinitcg="enabled" 323a40161cbSPaolo Bonzinimembarrier="" 324299e6f19SPaolo Bonzinivhost_net="" 325299e6f19SPaolo Bonzinivhost_crypto="" 326299e6f19SPaolo Bonzinivhost_scsi="" 327299e6f19SPaolo Bonzinivhost_vsock="" 328e6a74868SMarc-André Lureauvhost_user="" 32998fc1adaSDr. David Alan Gilbertvhost_user_fs="" 3303bd40ec7SPaolo Bonzinikvm="auto" 3313bd40ec7SPaolo Bonzinihax="auto" 3323bd40ec7SPaolo Bonzinihvf="auto" 3333bd40ec7SPaolo Bonziniwhpx="auto" 3342da776dbSMichael R. Hinesrdma="" 33521ab34c9SMarcel Apfelbaumpvrdma="" 336377529c0SPaolo Bonzinigprof="no" 337377529c0SPaolo Bonzinidebug_tcg="no" 338377529c0SPaolo Bonzinidebug="no" 339247724cbSMarc-André Lureausanitizers="no" 3400aebab04SLingfeng Yangtsan="no" 341b553a042SJohn Snowfortify_source="" 342377529c0SPaolo Bonzinistrip_opt="yes" 3439195b2c2SStefan Weiltcg_interpreter="no" 344377529c0SPaolo Bonzinibigendian="no" 345377529c0SPaolo Bonzinimingw32="no" 3461d728c39SBlue Swirlgcov="no" 347377529c0SPaolo BonziniEXESUF="" 348484e2cc7SPaolo BonziniHOST_DSOSUF=".so" 34917969268SFam Zhengmodules="no" 350bd83c861SChristian Ehrhardtmodule_upgrades="no" 351377529c0SPaolo Bonziniprefix="/usr/local" 35210ff82d1SMarc-André Lureauqemu_suffix="qemu" 3534d34a86bSPaolo Bonzinislirp="auto" 354377529c0SPaolo Bonzinioss_lib="" 355377529c0SPaolo Bonzinibsd="no" 356377529c0SPaolo Bonzinilinux="no" 357377529c0SPaolo Bonzinisolaris="no" 358377529c0SPaolo Bonziniprofiler="no" 359b4e312e9SPaolo Bonzinicocoa="auto" 360377529c0SPaolo Bonzinisoftmmu="yes" 361377529c0SPaolo Bonzinilinux_user="no" 362377529c0SPaolo Bonzinibsd_user="no" 363377529c0SPaolo Bonziniblobs="yes" 36405dfa22bSPhilippe Mathieu-Daudéedk2_blobs="no" 365377529c0SPaolo Bonzinipkgversion="" 36640d6444eSAvi Kivitypie="" 3673556c233SPaolo Bonziniqom_cast_debug="yes" 368baf86d6bSPaolo Bonzinitrace_backends="log" 369377529c0SPaolo Bonzinitrace_file="trace" 370377529c0SPaolo Bonzinispice="" 371377529c0SPaolo Bonzinirbd="" 3727b02f544SMarc-André Lureausmartcard="" 3730a40bcb7SCésar Belleyu2f="auto" 3742b2325ffSGerd Hoffmannlibusb="" 37569354a83SHans de Goedeusb_redir="" 376da076ffeSGerd Hoffmannopengl="" 377014cb152SGerd Hoffmannopengl_dmabuf="no" 3785dd89908SRichard Hendersoncpuid_h="no" 37986583a07SLiam Merwickavx2_opt="" 3808b18cdbfSRichard Hendersoncapstone="auto" 381b25c9dffSStefan Weillzo="" 382b25c9dffSStefan Weilsnappy="" 3836b383c08SPeter Wubzip2="" 38483bc1f97SJulio Faraccolzfse="" 3853a678481SJuan Quintelazstd="" 386e8ef31a3SMichael Tokarevguest_agent="" 387d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 38850cbebb9SMichael Rothguest_agent_ntddscsi="no" 3899dacf32dSYossi Hindinguest_agent_msi="" 390d9840e25STomoki Sekiyamavss_win32_sdk="" 391d9840e25STomoki Sekiyamawin_sdk="no" 392e10ee3f5SPhilippe Mathieu-Daudéwant_tools="" 393c589b249SRonnie Sahlberglibiscsi="" 3946542aa9cSPeter Lievenlibnfs="" 395519175a2SAlex Barcelocoroutine="" 39670c60c08SStefan Hajnoczicoroutine_pool="" 3977d992e4dSPeter Lievendebug_stack_usage="no" 398f0d92b56SLongpeng(Mike)crypto_afalg="no" 399f794573eSEduardo Otuboseccomp="" 400eb100396SBharata B Raoglusterfs="" 401d85fa9ebSJeff Codyglusterfs_xlator_opt="no" 4020c14fb47SBharata B Raoglusterfs_discard="no" 403df3a429aSNiels de Vosglusterfs_fallocate="no" 4047c815372SBharata B Raoglusterfs_zerofill="no" 405e014dbe7SPrasanna Kumar Kaleverglusterfs_ftruncate_has_stat="no" 4060e3b891fSNiels de Vosglusterfs_iocb_has_stat="no" 407a4ccabcfSAnthony Liguorigtk="" 408925a0400SGerd Hoffmanngtk_gl="no" 409a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 410ddbb0d09SDaniel P. Berrangegnutls="" 41191bfcdb0SDaniel P. Berrangenettle="" 412dc2207afSDaniel P. Berrangénettle_xts="no" 41391bfcdb0SDaniel P. Berrangegcrypt="" 4141f923c70SLongpeng(Mike)gcrypt_hmac="no" 415e0576942SDaniel P. Berrangégcrypt_xts="no" 416e0576942SDaniel P. Berrangéqemu_private_xts="yes" 4178953caf3SDaniel P. Berrangeauth_pam="" 418bbbf9bfbSStefan Weilvte="" 4199d9e1521SGerd Hoffmannvirglrenderer="" 4207aaa6a16SPaolo Bonzinitpm="" 421b10d49d7SPino Toscanolibssh="" 422ed1701c6SDr. David Alan Gilbertlive_block_migration="yes" 423a99d57bbSWanlong Gaonuma="" 4242847b469SFam Zhengtcmalloc="no" 4257b01cb97SAlexandre Derumierjemalloc="no" 426a6b1d4c0SChanglong Xiereplication="yes" 4272f740136SJeff Codybochs="yes" 4282f740136SJeff Codycloop="yes" 4292f740136SJeff Codydmg="yes" 4302f740136SJeff Codyqcow1="yes" 4312f740136SJeff Codyvdi="yes" 4322f740136SJeff Codyvvfat="yes" 4332f740136SJeff Codyqed="yes" 4342f740136SJeff Codyparallels="yes" 4352f740136SJeff Codysheepdog="yes" 436ed279a06SKlim Kireevlibxml2="" 437ba59fb77SPaolo Bonzinidebug_mutex="no" 43817824406SJunyan Helibpmem="" 439f3494749SPaolo Bonzinidefault_devices="yes" 44040e8c6f4SAlex Bennéeplugins="no" 441adc28027SAlexander Bulekovfuzzing="no" 442b767d257SMarek Marczykowski-Góreckirng_none="no" 44354e7aac0SAlexey Krasikovsecret_keyring="" 44421b2eca6SJingqi Liulibdaxctl="" 445a5665051SPaolo Bonzinimeson="" 44648328880SPaolo Bonzinininja="" 447a5665051SPaolo Bonziniskip_meson=no 448e8f3bd71SMarc-André Lureaugettext="" 449377529c0SPaolo Bonzini 450fb59dabdSPeter Maydellbogus_os="no" 451aa087962SPaolo Bonzinimalloc_trim="auto" 452898be3e0SPeter Maydell 453ac0df51dSaliguori# parse CC options first 454ac0df51dSaliguorifor opt do 45589138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 456ac0df51dSaliguori case "$opt" in 457ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 458ac0df51dSaliguori ;; 4593d8df640SPaolo Bonzini --cc=*) CC="$optarg" 460ac0df51dSaliguori ;; 46183f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 46283f73fceSTomoki Sekiyama ;; 4632ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 4642ff6b91eSJuan Quintela ;; 465de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 466db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 467e2a2ed06SJuan Quintela ;; 46811cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 46911cde1c8SBruno Dominguez ;; 470db5adeaaSPaolo Bonzini --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 471f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 472e2a2ed06SJuan Quintela ;; 4735bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 4745bc62e01SGerd Hoffmann ;; 4755bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 4765bc62e01SGerd Hoffmann ;; 477d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 478d75402b5SAlex Bennée ;; 479d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 480d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 4812038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 482d422b2bcSAlex Bennée ;; 483d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 4842038f8c8SPaolo Bonzini cc_archs="$cc_archs $cc_arch" 485d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 4862038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 487d75402b5SAlex Bennée ;; 488ac0df51dSaliguori esac 489ac0df51dSaliguoridone 490ac0df51dSaliguori# OS specific 491ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 49293148aa5SStefan Weil# we can eliminate its usage altogether. 493ac0df51dSaliguori 494e49d021eSPeter Maydell# Preferred compiler: 495e49d021eSPeter Maydell# ${CC} (if set) 496e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 497e49d021eSPeter Maydell# system compiler 498e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 499e49d021eSPeter Maydell cc="$host_cc" 500e49d021eSPeter Maydellelse 501b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 502e49d021eSPeter Maydellfi 503e49d021eSPeter Maydell 50483f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 50583f73fceSTomoki Sekiyama cxx="c++" 50683f73fceSTomoki Sekiyamaelse 50783f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 50883f73fceSTomoki Sekiyamafi 50983f73fceSTomoki Sekiyama 510b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 511cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 5125f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 5133dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 514b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 515b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 5169f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 5174852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 518b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 519b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 52017884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 52117884d7bSSergei Trofimovichquery_pkg_config() { 52217884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 52317884d7bSSergei Trofimovich} 52417884d7bSSergei Trofimovichpkg_config=query_pkg_config 52547c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 526ac0df51dSaliguori 52745d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 52845d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 52945d285abSPeter Maydell 530be17dc90SMichael S. Tsirkin# default flags for all hosts 5312d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 5322d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 5332d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 5342d31515bSPeter Maydell# provides these semantics.) 535086d5f75SPaolo BonziniQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 536086d5f75SPaolo BonziniQEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 537c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 538be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 53925211446SPaolo BonziniQEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include" 54025211446SPaolo BonziniQEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl" 5415770e8afSPaolo Bonzini 5425770e8afSPaolo Bonzini# Flags that are needed during configure but later taken care of by Meson 5435770e8afSPaolo BonziniCONFIGURE_CFLAGS="-std=gnu99 -Wall" 5445770e8afSPaolo BonziniCONFIGURE_LDFLAGS= 545086d5f75SPaolo Bonzini 546be17dc90SMichael S. Tsirkin 547ac0df51dSaliguoricheck_define() { 548ac0df51dSaliguoricat > $TMPC <<EOF 549ac0df51dSaliguori#if !defined($1) 550fd786e1aSPeter Maydell#error $1 not defined 551ac0df51dSaliguori#endif 552ac0df51dSaliguoriint main(void) { return 0; } 553ac0df51dSaliguoriEOF 55452166aa0SJuan Quintela compile_object 555ac0df51dSaliguori} 556ac0df51dSaliguori 557307119e7SGerd Hoffmanncheck_include() { 558307119e7SGerd Hoffmanncat > $TMPC <<EOF 559307119e7SGerd Hoffmann#include <$1> 560307119e7SGerd Hoffmannint main(void) { return 0; } 561307119e7SGerd HoffmannEOF 562307119e7SGerd Hoffmann compile_object 563307119e7SGerd Hoffmann} 564307119e7SGerd Hoffmann 56593b25869SJohn Snowwrite_c_skeleton() { 56693b25869SJohn Snow cat > $TMPC <<EOF 56793b25869SJohn Snowint main(void) { return 0; } 56893b25869SJohn SnowEOF 56993b25869SJohn Snow} 57093b25869SJohn Snow 571adc28027SAlexander Bulekovwrite_c_fuzzer_skeleton() { 572adc28027SAlexander Bulekov cat > $TMPC <<EOF 573adc28027SAlexander Bulekov#include <stdint.h> 574adc28027SAlexander Bulekov#include <sys/types.h> 575adc28027SAlexander Bulekovint LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); 576adc28027SAlexander Bulekovint LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } 577adc28027SAlexander BulekovEOF 578adc28027SAlexander Bulekov} 579adc28027SAlexander Bulekov 580bbea4050SPeter Maydellif check_define __linux__ ; then 581bbea4050SPeter Maydell targetos="Linux" 582bbea4050SPeter Maydellelif check_define _WIN32 ; then 583bbea4050SPeter Maydell targetos='MINGW32' 584bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 585bbea4050SPeter Maydell targetos='OpenBSD' 586bbea4050SPeter Maydellelif check_define __sun__ ; then 587bbea4050SPeter Maydell targetos='SunOS' 588bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 589bbea4050SPeter Maydell targetos='Haiku' 590951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 591951fedfcSPeter Maydell targetos='FreeBSD' 592951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 593951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 594951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 595951fedfcSPeter Maydell targetos='DragonFly' 596951fedfcSPeter Maydellelif check_define __NetBSD__; then 597951fedfcSPeter Maydell targetos='NetBSD' 598951fedfcSPeter Maydellelif check_define __APPLE__; then 599951fedfcSPeter Maydell targetos='Darwin' 600bbea4050SPeter Maydellelse 601951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 602951fedfcSPeter Maydell # might be going to just print the --help text, or it might 603951fedfcSPeter Maydell # be the result of a missing compiler. 604951fedfcSPeter Maydell targetos='bogus' 605951fedfcSPeter Maydell bogus_os='yes' 606bbea4050SPeter Maydellfi 607bbea4050SPeter Maydell 608bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 609bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 610bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 611bbea4050SPeter Maydell# the correct CPU with the --cpu option. 612bbea4050SPeter Maydellcase $targetos in 613bbea4050SPeter MaydellDarwin) 614bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 615bbea4050SPeter Maydell # run 64-bit userspace code. 616bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 617bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 618bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 619bbea4050SPeter Maydell cpu="x86_64" 620bbea4050SPeter Maydell fi 621bbea4050SPeter Maydell ;; 622bbea4050SPeter MaydellSunOS) 62389138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 624bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 625bbea4050SPeter Maydell cpu="x86_64" 626bbea4050SPeter Maydell fi 627bbea4050SPeter Maydellesac 628bbea4050SPeter Maydell 6292ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 6302ff6b91eSJuan Quintela # command line argument 6312ff6b91eSJuan Quintela : 6322ff6b91eSJuan Quintelaelif check_define __i386__ ; then 633ac0df51dSaliguori cpu="i386" 634ac0df51dSaliguorielif check_define __x86_64__ ; then 635c72b26ecSRichard Henderson if check_define __ILP32__ ; then 636c72b26ecSRichard Henderson cpu="x32" 637c72b26ecSRichard Henderson else 638ac0df51dSaliguori cpu="x86_64" 639c72b26ecSRichard Henderson fi 6403aa9bd6cSblueswir1elif check_define __sparc__ ; then 6413aa9bd6cSblueswir1 if check_define __arch64__ ; then 6423aa9bd6cSblueswir1 cpu="sparc64" 6433aa9bd6cSblueswir1 else 6443aa9bd6cSblueswir1 cpu="sparc" 6453aa9bd6cSblueswir1 fi 646fdf7ed96Smalcelif check_define _ARCH_PPC ; then 647fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 648f8378accSRichard Henderson if check_define _LITTLE_ENDIAN ; then 649f8378accSRichard Henderson cpu="ppc64le" 650f8378accSRichard Henderson else 651fdf7ed96Smalc cpu="ppc64" 652f8378accSRichard Henderson fi 653ac0df51dSaliguori else 654fdf7ed96Smalc cpu="ppc" 655fdf7ed96Smalc fi 656afa05235SAurelien Jarnoelif check_define __mips__ ; then 657afa05235SAurelien Jarno cpu="mips" 658d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 659d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 660d66ed0eaSAurelien Jarno cpu="s390x" 661d66ed0eaSAurelien Jarno else 662d66ed0eaSAurelien Jarno cpu="s390" 663d66ed0eaSAurelien Jarno fi 664c4f80543SAlistair Franciselif check_define __riscv ; then 665c4f80543SAlistair Francis if check_define _LP64 ; then 666c4f80543SAlistair Francis cpu="riscv64" 667c4f80543SAlistair Francis else 668c4f80543SAlistair Francis cpu="riscv32" 669c4f80543SAlistair Francis fi 67021d89f84SPeter Maydellelif check_define __arm__ ; then 67121d89f84SPeter Maydell cpu="arm" 6721f080313SClaudio Fontanaelif check_define __aarch64__ ; then 6731f080313SClaudio Fontana cpu="aarch64" 674fdf7ed96Smalcelse 67589138857SStefan Weil cpu=$(uname -m) 676ac0df51dSaliguorifi 677ac0df51dSaliguori 678359bc95dSPeter MaydellARCH= 679359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 680359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 6817d13299dSbellardcase "$cpu" in 682ee35e968SThomas Huth ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 683898be3e0SPeter Maydell ;; 684f8378accSRichard Henderson ppc64le) 685f8378accSRichard Henderson ARCH="ppc64" 686f8378accSRichard Henderson ;; 6877d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 68897a847bcSbellard cpu="i386" 6897d13299dSbellard ;; 690aaa5fa14Saurel32 x86_64|amd64) 691aaa5fa14Saurel32 cpu="x86_64" 692aaa5fa14Saurel32 ;; 69321d89f84SPeter Maydell armv*b|armv*l|arm) 69421d89f84SPeter Maydell cpu="arm" 6957d13299dSbellard ;; 6961f080313SClaudio Fontana aarch64) 6971f080313SClaudio Fontana cpu="aarch64" 6981f080313SClaudio Fontana ;; 699afa05235SAurelien Jarno mips*) 700afa05235SAurelien Jarno cpu="mips" 701afa05235SAurelien Jarno ;; 7023142255cSblueswir1 sparc|sun4[cdmuv]) 703ae228531Sbellard cpu="sparc" 704ae228531Sbellard ;; 7057d13299dSbellard *) 706359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 707359bc95dSPeter Maydell ARCH=unknown 7087d13299dSbellard ;; 7097d13299dSbellardesac 710359bc95dSPeter Maydellif test -z "$ARCH"; then 711359bc95dSPeter Maydell ARCH="$cpu" 712359bc95dSPeter Maydellfi 713e2d52ad3SJuan Quintela 7147d13299dSbellard# OS specific 7150dbfc675SJuan Quintela 7167d13299dSbellardcase $targetos in 71767b915a5SbellardMINGW32*) 71867b915a5Sbellard mingw32="yes" 719299e6f19SPaolo Bonzini vhost_user="no" 7203cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 721307119e7SGerd Hoffmann if check_include dsound.h; then 7223cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 723307119e7SGerd Hoffmann else 724307119e7SGerd Hoffmann audio_drv_list="" 725307119e7SGerd Hoffmann fi 726898be3e0SPeter Maydell supported_os="yes" 727fb648e9cSDaniel P. Berrangé pie="no" 72867b915a5Sbellard;; 7295c40d2bdSthsGNU/kFreeBSD) 730a167ba50SAurelien Jarno bsd="yes" 7316a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7320bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 7335c40d2bdSths;; 7347d3505c5SbellardFreeBSD) 7357d3505c5Sbellard bsd="yes" 7360db4a067SPaolo Bonzini make="${MAKE-gmake}" 7376a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7380bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 739f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 74058952137SVincenzo Maffione netmap="" # enable netmap autodetect 7417d3505c5Sbellard;; 742c5e97233Sblueswir1DragonFly) 743c5e97233Sblueswir1 bsd="yes" 7440db4a067SPaolo Bonzini make="${MAKE-gmake}" 7456a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7460bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 747c5e97233Sblueswir1;; 7487d3505c5SbellardNetBSD) 7497d3505c5Sbellard bsd="yes" 7500db4a067SPaolo Bonzini make="${MAKE-gmake}" 7516a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7520bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 7538ef92a88Sblueswir1 oss_lib="-lossaudio" 7547d3505c5Sbellard;; 7557d3505c5SbellardOpenBSD) 7567d3505c5Sbellard bsd="yes" 7570db4a067SPaolo Bonzini make="${MAKE-gmake}" 758f92c7168SGerd Hoffmann audio_drv_list="try-sdl" 7590bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 7607d3505c5Sbellard;; 76183fb7adfSbellardDarwin) 76283fb7adfSbellard bsd="yes" 76383fb7adfSbellard darwin="yes" 7641b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 765a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 766db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" 7671b0f9cc2Saliguori fi 768b4e312e9SPaolo Bonzini cocoa="enabled" 7696a485418SGerd Hoffmann audio_drv_list="coreaudio try-sdl" 77014382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 771db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" 772a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 773a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 774a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 77583fb7adfSbellard;; 776ec530c81SbellardSunOS) 777ec530c81Sbellard solaris="yes" 7780db4a067SPaolo Bonzini make="${MAKE-gmake}" 779e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 7806b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 7816a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7826b4d2ba1Sths fi 783c2de5c91Smalc audio_possible_drivers="oss sdl" 784d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 785d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 786d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 787d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 788ec530c81Sbellard;; 789179cf400SAndreas FärberHaiku) 790179cf400SAndreas Färber haiku="yes" 791fc433430SDavid CARLIER QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" 792179cf400SAndreas Färber;; 793898be3e0SPeter MaydellLinux) 7947183834aSGerd Hoffmann audio_drv_list="try-pa oss" 7950bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 7965327cf48Sbellard linux="yes" 797831b7825Sths linux_user="yes" 79858683d07SPaolo Bonzini QEMU_INCLUDES="-isystem ${source_path}/linux-headers -Ilinux-headers $QEMU_INCLUDES" 799898be3e0SPeter Maydell;; 8007d13299dSbellardesac 8017d13299dSbellard 8027d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 803b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 80484778508Sblueswir1 bsd_user="yes" 8057d3505c5Sbellard fi 80608de3949SAndreas Färberfi 8077d3505c5Sbellard 8080db4a067SPaolo Bonzini: ${make=${MAKE-make}} 809b6daf4d3SPaolo Bonzini 810faf44142SDaniel P. Berrangé# We prefer python 3.x. A bare 'python' is traditionally 811faf44142SDaniel P. Berrangé# python 2.x, but some distros have it as python 3.x, so 812ddf90699SEduardo Habkost# we check that too 813faf44142SDaniel P. Berrangépython= 8140a01d76fSMarc-André Lureauexplicit_python=no 815ddf90699SEduardo Habkostfor binary in "${PYTHON-python3}" python 816faf44142SDaniel P. Berrangédo 817faf44142SDaniel P. Berrangé if has "$binary" 818faf44142SDaniel P. Berrangé then 81995c5f2deSPaolo Bonzini python=$(command -v "$binary") 820faf44142SDaniel P. Berrangé break 821faf44142SDaniel P. Berrangé fi 822faf44142SDaniel P. Berrangédone 823903458c8SMarkus Armbruster 824903458c8SMarkus Armbrustersphinx_build= 825903458c8SMarkus Armbrusterfor binary in sphinx-build-3 sphinx-build 826903458c8SMarkus Armbrusterdo 827903458c8SMarkus Armbruster if has "$binary" 828903458c8SMarkus Armbruster then 829903458c8SMarkus Armbruster sphinx_build=$(command -v "$binary") 830903458c8SMarkus Armbruster break 831903458c8SMarkus Armbruster fi 832903458c8SMarkus Armbrusterdone 833903458c8SMarkus Armbruster 83439d87c8cSAlex Bennée# Check for ancillary tools used in testing 83539d87c8cSAlex Bennéegenisoimage= 8363df437c7SAlex Bennéefor binary in genisoimage mkisofs 83739d87c8cSAlex Bennéedo 83839d87c8cSAlex Bennée if has $binary 83939d87c8cSAlex Bennée then 84039d87c8cSAlex Bennée genisoimage=$(command -v "$binary") 84139d87c8cSAlex Bennée break 84239d87c8cSAlex Bennée fi 84339d87c8cSAlex Bennéedone 84439d87c8cSAlex Bennée 845e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 8460db4a067SPaolo Bonzini 8473c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 8483c4a4d0dSPeter Maydellif has clang; then 8493c4a4d0dSPeter Maydell objcc=clang 8503c4a4d0dSPeter Maydellelse 8513c4a4d0dSPeter Maydell objcc="$cc" 8523c4a4d0dSPeter Maydellfi 8533c4a4d0dSPeter Maydell 8543457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 8553457a3f8SJuan Quintela EXESUF=".exe" 856484e2cc7SPaolo Bonzini HOST_DSOSUF=".dll" 85778e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 8585770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS" 85993b25869SJohn Snow write_c_skeleton; 860d17f305aSPaolo Bonzini prefix="/qemu" 86177433a5fSMarc-André Lureau qemu_suffix="" 862105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 8633457a3f8SJuan Quintelafi 8643457a3f8SJuan Quintela 865487fefdbSAnthony Liguoriwerror="" 86685aa5189Sbellard 8677d13299dSbellardfor opt do 86889138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 8697d13299dSbellard case "$opt" in 8702efc3265Sbellard --help|-h) show_help=yes 8712efc3265Sbellard ;; 87299123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 87399123e13SMike Frysinger ;; 874b1a550a0Spbrook --prefix=*) prefix="$optarg" 8757d13299dSbellard ;; 876b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 87732ce6337Sbellard ;; 878ac0df51dSaliguori --cross-prefix=*) 8797d13299dSbellard ;; 880ac0df51dSaliguori --cc=*) 8817d13299dSbellard ;; 882b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 88383469015Sbellard ;; 88483f73fceSTomoki Sekiyama --cxx=*) 88583f73fceSTomoki Sekiyama ;; 886e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 887e007dbecSMichael S. Tsirkin ;; 8883c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 8893c4a4d0dSPeter Maydell ;; 890b1a550a0Spbrook --make=*) make="$optarg" 8917d13299dSbellard ;; 892b6daf4d3SPaolo Bonzini --install=*) 8936a882643Spbrook ;; 8940a01d76fSMarc-André Lureau --python=*) python="$optarg" ; explicit_python=yes 895c886edfbSBlue Swirl ;; 8962eb054c2SPeter Maydell --sphinx-build=*) sphinx_build="$optarg" 8972eb054c2SPeter Maydell ;; 898a5665051SPaolo Bonzini --skip-meson) skip_meson=yes 899a5665051SPaolo Bonzini ;; 900a5665051SPaolo Bonzini --meson=*) meson="$optarg" 901a5665051SPaolo Bonzini ;; 90248328880SPaolo Bonzini --ninja=*) ninja="$optarg" 90348328880SPaolo Bonzini ;; 904e2d8830eSBrad --smbd=*) smbd="$optarg" 905e2d8830eSBrad ;; 906e2a2ed06SJuan Quintela --extra-cflags=*) 9077d13299dSbellard ;; 90811cde1c8SBruno Dominguez --extra-cxxflags=*) 90911cde1c8SBruno Dominguez ;; 910e2a2ed06SJuan Quintela --extra-ldflags=*) 9117d13299dSbellard ;; 9125bc62e01SGerd Hoffmann --enable-debug-info) 9135bc62e01SGerd Hoffmann ;; 9145bc62e01SGerd Hoffmann --disable-debug-info) 9155bc62e01SGerd Hoffmann ;; 916d75402b5SAlex Bennée --cross-cc-*) 917d75402b5SAlex Bennée ;; 91817969268SFam Zheng --enable-modules) 91917969268SFam Zheng modules="yes" 92017969268SFam Zheng ;; 9213aa88b31SStefan Hajnoczi --disable-modules) 9223aa88b31SStefan Hajnoczi modules="no" 9233aa88b31SStefan Hajnoczi ;; 924bd83c861SChristian Ehrhardt --disable-module-upgrades) module_upgrades="no" 925bd83c861SChristian Ehrhardt ;; 926bd83c861SChristian Ehrhardt --enable-module-upgrades) module_upgrades="yes" 927bd83c861SChristian Ehrhardt ;; 9282ff6b91eSJuan Quintela --cpu=*) 9297d13299dSbellard ;; 930b1a550a0Spbrook --target-list=*) target_list="$optarg" 931447e133fSAlex Bennée if test "$target_list_exclude"; then 932447e133fSAlex Bennée error_exit "Can't mix --target-list with --target-list-exclude" 933447e133fSAlex Bennée fi 934447e133fSAlex Bennée ;; 935447e133fSAlex Bennée --target-list-exclude=*) target_list_exclude="$optarg" 936447e133fSAlex Bennée if test "$target_list"; then 937447e133fSAlex Bennée error_exit "Can't mix --target-list-exclude with --target-list" 938447e133fSAlex Bennée fi 939de83cd02Sbellard ;; 9405b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 9415b808275SLluís Vilanova ;; 9425b808275SLluís Vilanova # XXX: backwards compatibility 9435b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 94494a420b1SStefan Hajnoczi ;; 94574242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 9469410b56cSPrerna Saxena ;; 947f3494749SPaolo Bonzini --with-default-devices) default_devices="yes" 948f3494749SPaolo Bonzini ;; 949f3494749SPaolo Bonzini --without-default-devices) default_devices="no" 950f3494749SPaolo Bonzini ;; 9517d13299dSbellard --enable-gprof) gprof="yes" 9527d13299dSbellard ;; 9531d728c39SBlue Swirl --enable-gcov) gcov="yes" 9541d728c39SBlue Swirl ;; 95579427693SLoïc Minier --static) 95679427693SLoïc Minier static="yes" 95717884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 95843ce4dfeSbellard ;; 9590b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 9600b24e75fSPaolo Bonzini ;; 9610b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 9620b24e75fSPaolo Bonzini ;; 9633aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 9643aa5d2beSAlon Levy ;; 9658bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 9668bf188aaSMichael Tokarev ;; 9670f94d6daSAlon Levy --includedir=*) includedir="$optarg" 9680f94d6daSAlon Levy ;; 969528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 9700b24e75fSPaolo Bonzini ;; 97177433a5fSMarc-André Lureau --with-suffix=*) qemu_suffix="$optarg" 972023d3d67SEduardo Habkost ;; 973850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 9740b24e75fSPaolo Bonzini ;; 975ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 97607381cc1SAnthony Liguori ;; 977785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 978785c23aeSLuiz Capitulino ;; 9793d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 9803d5eecabSGerd Hoffmann ;; 981181ce1d0SOlaf Hering --host=*|--build=*|\ 982181ce1d0SOlaf Hering --disable-dependency-tracking|\ 983785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 984023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 985023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 986023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 987023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 988023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 989023ddd74SMax Filippov # lots of directory switches by default. 990023ddd74SMax Filippov ;; 99135be72baSPaolo Bonzini --disable-sdl) sdl="disabled" 99297a847bcSbellard ;; 99335be72baSPaolo Bonzini --enable-sdl) sdl="enabled" 994c4198157SJuan Quintela ;; 99535be72baSPaolo Bonzini --disable-sdl-image) sdl_image="disabled" 996a442fe2fSDaniel P. Berrangé ;; 99735be72baSPaolo Bonzini --enable-sdl-image) sdl_image="enabled" 998a442fe2fSDaniel P. Berrangé ;; 9993556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 10003556c233SPaolo Bonzini ;; 10013556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 10023556c233SPaolo Bonzini ;; 1003983eef5aSMeador Inge --disable-virtfs) virtfs="no" 1004983eef5aSMeador Inge ;; 1005983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 1006983eef5aSMeador Inge ;; 10076ec0e15dSPaolo Bonzini --disable-mpath) mpath="disabled" 1008fe8fc5aeSPaolo Bonzini ;; 10096ec0e15dSPaolo Bonzini --enable-mpath) mpath="enabled" 1010fe8fc5aeSPaolo Bonzini ;; 1011a0b93237SPaolo Bonzini --disable-vnc) vnc="disabled" 1012821601eaSJes Sorensen ;; 1013a0b93237SPaolo Bonzini --enable-vnc) vnc="enabled" 1014821601eaSJes Sorensen ;; 1015e8f3bd71SMarc-André Lureau --disable-gettext) gettext="false" 1016e8f3bd71SMarc-André Lureau ;; 1017e8f3bd71SMarc-André Lureau --enable-gettext) gettext="true" 1018e8f3bd71SMarc-André Lureau ;; 10192f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 10202f6a1ab0Sblueswir1 ;; 10210c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 10220c58ac1cSmalc ;; 102389138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1024b64ec4e4SFam Zheng ;; 102589138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1026eb852011SMarkus Armbruster ;; 1027f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 1028f8393946Saurel32 ;; 1029f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 1030f8393946Saurel32 ;; 1031f3d08ee6SPaul Brook --enable-debug) 1032f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 1033f3d08ee6SPaul Brook debug_tcg="yes" 10341fcc6d42SPeter Xu debug_mutex="yes" 1035f3d08ee6SPaul Brook debug="yes" 1036f3d08ee6SPaul Brook strip_opt="no" 1037b553a042SJohn Snow fortify_source="no" 1038f3d08ee6SPaul Brook ;; 1039247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1040247724cbSMarc-André Lureau ;; 1041247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1042247724cbSMarc-André Lureau ;; 10430aebab04SLingfeng Yang --enable-tsan) tsan="yes" 10440aebab04SLingfeng Yang ;; 10450aebab04SLingfeng Yang --disable-tsan) tsan="no" 10460aebab04SLingfeng Yang ;; 1047deb62371SPaolo Bonzini --enable-sparse) sparse="enabled" 104803b4fe7dSaliguori ;; 1049deb62371SPaolo Bonzini --disable-sparse) sparse="disabled" 105003b4fe7dSaliguori ;; 10511625af87Saliguori --disable-strip) strip_opt="no" 10521625af87Saliguori ;; 1053a0b93237SPaolo Bonzini --disable-vnc-sasl) vnc_sasl="disabled" 10542f9606b3Saliguori ;; 1055a0b93237SPaolo Bonzini --enable-vnc-sasl) vnc_sasl="enabled" 1056ea784e3bSJuan Quintela ;; 1057a0b93237SPaolo Bonzini --disable-vnc-jpeg) vnc_jpeg="disabled" 10582f6f5c7aSCorentin Chary ;; 1059a0b93237SPaolo Bonzini --enable-vnc-jpeg) vnc_jpeg="enabled" 10602f6f5c7aSCorentin Chary ;; 1061a0b93237SPaolo Bonzini --disable-vnc-png) vnc_png="disabled" 1062efe556adSCorentin Chary ;; 1063a0b93237SPaolo Bonzini --enable-vnc-png) vnc_png="enabled" 1064efe556adSCorentin Chary ;; 10654d34a86bSPaolo Bonzini --disable-slirp) slirp="disabled" 1066c20709aaSbellard ;; 10674d34a86bSPaolo Bonzini --enable-slirp=git) slirp="internal" 10687c57bdd8SMarc-André Lureau ;; 1069675b9b53SMarc-André Lureau --enable-slirp=system) slirp="system" 1070675b9b53SMarc-André Lureau ;; 1071e0e6c8c0Saliguori --disable-vde) vde="no" 10728a16d273Sths ;; 1073dfb278bdSJuan Quintela --enable-vde) vde="yes" 1074dfb278bdSJuan Quintela ;; 107558952137SVincenzo Maffione --disable-netmap) netmap="no" 107658952137SVincenzo Maffione ;; 107758952137SVincenzo Maffione --enable-netmap) netmap="yes" 107858952137SVincenzo Maffione ;; 10791badb709SPaolo Bonzini --disable-xen) xen="disabled" 1080e37630caSaliguori ;; 10811badb709SPaolo Bonzini --enable-xen) xen="enabled" 1082fc321b4bSJuan Quintela ;; 10831badb709SPaolo Bonzini --disable-xen-pci-passthrough) xen_pci_passthrough="disabled" 1084eb6fda0fSAnthony PERARD ;; 10851badb709SPaolo Bonzini --enable-xen-pci-passthrough) xen_pci_passthrough="enabled" 1086eb6fda0fSAnthony PERARD ;; 10872e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 10882e4d9fb1Saurel32 ;; 10894ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 10904ffcedb6SJuan Quintela ;; 10911badb709SPaolo Bonzini --disable-kvm) kvm="disabled" 10927ba1e619Saliguori ;; 10931badb709SPaolo Bonzini --enable-kvm) kvm="enabled" 1094b31a0277SJuan Quintela ;; 10951badb709SPaolo Bonzini --disable-hax) hax="disabled" 1096180fb750Szhanghailiang ;; 10971badb709SPaolo Bonzini --enable-hax) hax="enabled" 1098180fb750Szhanghailiang ;; 10991badb709SPaolo Bonzini --disable-hvf) hvf="disabled" 1100c97d6d2cSSergio Andres Gomez Del Real ;; 11011badb709SPaolo Bonzini --enable-hvf) hvf="enabled" 1102c97d6d2cSSergio Andres Gomez Del Real ;; 11031badb709SPaolo Bonzini --disable-whpx) whpx="disabled" 1104d661d9a4SJustin Terry (VM) ;; 11051badb709SPaolo Bonzini --enable-whpx) whpx="enabled" 1106d661d9a4SJustin Terry (VM) ;; 11079195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 11089195b2c2SStefan Weil ;; 11099195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 11109195b2c2SStefan Weil ;; 111147e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 111247e98658SCorey Bryant ;; 111347e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 111447e98658SCorey Bryant ;; 11151badb709SPaolo Bonzini --disable-tcg) tcg="disabled" 1116b3f6ea7eSPaolo Bonzini ;; 11171badb709SPaolo Bonzini --enable-tcg) tcg="enabled" 1118b3f6ea7eSPaolo Bonzini ;; 1119aa087962SPaolo Bonzini --disable-malloc-trim) malloc_trim="disabled" 11205a22ab71SYang Zhong ;; 1121aa087962SPaolo Bonzini --enable-malloc-trim) malloc_trim="enabled" 11225a22ab71SYang Zhong ;; 1123cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1124cd4ec0b4SGerd Hoffmann ;; 1125cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 1126cd4ec0b4SGerd Hoffmann ;; 1127c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 1128c589b249SRonnie Sahlberg ;; 1129c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 1130c589b249SRonnie Sahlberg ;; 11316542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 11326542aa9cSPeter Lieven ;; 11336542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 11346542aa9cSPeter Lieven ;; 113505c2a3e7Sbellard --enable-profiler) profiler="yes" 113605c2a3e7Sbellard ;; 1137b4e312e9SPaolo Bonzini --disable-cocoa) cocoa="disabled" 113814821030SPavel Borzenkov ;; 1139c2de5c91Smalc --enable-cocoa) 1140b4e312e9SPaolo Bonzini cocoa="enabled" ; 114189138857SStefan Weil audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 11425b0753e0Sbellard ;; 1143cad25d69Spbrook --disable-system) softmmu="no" 11440a8e90f4Spbrook ;; 1145cad25d69Spbrook --enable-system) softmmu="yes" 11460a8e90f4Spbrook ;; 11470953a80fSZachary Amsden --disable-user) 11480953a80fSZachary Amsden linux_user="no" ; 11490953a80fSZachary Amsden bsd_user="no" ; 11500953a80fSZachary Amsden ;; 11510953a80fSZachary Amsden --enable-user) ;; 1152831b7825Sths --disable-linux-user) linux_user="no" 11530a8e90f4Spbrook ;; 1154831b7825Sths --enable-linux-user) linux_user="yes" 1155831b7825Sths ;; 115684778508Sblueswir1 --disable-bsd-user) bsd_user="no" 115784778508Sblueswir1 ;; 115884778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 115984778508Sblueswir1 ;; 116040d6444eSAvi Kivity --enable-pie) pie="yes" 116134005a00SKirill A. Shutemov ;; 116240d6444eSAvi Kivity --disable-pie) pie="no" 116334005a00SKirill A. Shutemov ;; 116485aa5189Sbellard --enable-werror) werror="yes" 116585aa5189Sbellard ;; 116685aa5189Sbellard --disable-werror) werror="no" 116785aa5189Sbellard ;; 116863678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 116963678e17SSteven Noonan ;; 117063678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 117163678e17SSteven Noonan ;; 11721e4f6065SDaniele Buono --enable-safe-stack) safe_stack="yes" 11731e4f6065SDaniele Buono ;; 11741e4f6065SDaniele Buono --disable-safe-stack) safe_stack="no" 11751e4f6065SDaniele Buono ;; 11764d3b6f6eSbalrog --disable-curses) curses="no" 11774d3b6f6eSbalrog ;; 1178c584a6d0SJuan Quintela --enable-curses) curses="yes" 1179c584a6d0SJuan Quintela ;; 1180e08bb301SSamuel Thibault --disable-iconv) iconv="no" 1181e08bb301SSamuel Thibault ;; 1182e08bb301SSamuel Thibault --enable-iconv) iconv="yes" 1183e08bb301SSamuel Thibault ;; 1184769ce76dSAlexander Graf --disable-curl) curl="no" 1185769ce76dSAlexander Graf ;; 1186788c8196SJuan Quintela --enable-curl) curl="yes" 1187788c8196SJuan Quintela ;; 1188fbb4121dSPaolo Bonzini --disable-fdt) fdt="disabled" 11892df87df7SJuan Quintela ;; 1190fbb4121dSPaolo Bonzini --enable-fdt) fdt="enabled" 1191fbb4121dSPaolo Bonzini ;; 1192fbb4121dSPaolo Bonzini --enable-fdt=git) fdt="internal" 1193fbb4121dSPaolo Bonzini ;; 1194fbb4121dSPaolo Bonzini --enable-fdt=system) fdt="system" 11952df87df7SJuan Quintela ;; 11965c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 11975c6c3a6cSChristoph Hellwig ;; 11985c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 11995c6c3a6cSChristoph Hellwig ;; 1200c10dd856SAarushi Mehta --disable-linux-io-uring) linux_io_uring="no" 1201c10dd856SAarushi Mehta ;; 1202c10dd856SAarushi Mehta --enable-linux-io-uring) linux_io_uring="yes" 1203c10dd856SAarushi Mehta ;; 1204758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 1205758e8e38SVenkateswararao Jujjuri (JV) ;; 1206758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 1207758e8e38SVenkateswararao Jujjuri (JV) ;; 1208a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1209a40161cbSPaolo Bonzini ;; 1210a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1211a40161cbSPaolo Bonzini ;; 121277755340Sths --disable-blobs) blobs="no" 121377755340Sths ;; 12147e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 12154a19f1ecSpbrook ;; 1216519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1217519175a2SAlex Barcelo ;; 121870c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 121970c60c08SStefan Hajnoczi ;; 122070c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 122170c60c08SStefan Hajnoczi ;; 12227d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 12237d992e4dSPeter Lieven ;; 1224f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1225f0d92b56SLongpeng(Mike) ;; 1226f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1227f0d92b56SLongpeng(Mike) ;; 1228a25dba17SJuan Quintela --disable-docs) docs="no" 122970ec5dc0SAnthony Liguori ;; 1230a25dba17SJuan Quintela --enable-docs) docs="yes" 123183a3ab8bSJuan Quintela ;; 1232d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1233d5970055SMichael S. Tsirkin ;; 1234d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1235d5970055SMichael S. Tsirkin ;; 1236042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1237042cea27SGonglei ;; 1238299e6f19SPaolo Bonzini --enable-vhost-crypto) vhost_crypto="yes" 1239042cea27SGonglei ;; 12405e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 12415e9be92dSNicholas Bellinger ;; 12425e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 12435e9be92dSNicholas Bellinger ;; 1244fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1245fc0b9b0eSStefan Hajnoczi ;; 1246fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1247fc0b9b0eSStefan Hajnoczi ;; 124898fc1adaSDr. David Alan Gilbert --disable-vhost-user-fs) vhost_user_fs="no" 124998fc1adaSDr. David Alan Gilbert ;; 125098fc1adaSDr. David Alan Gilbert --enable-vhost-user-fs) vhost_user_fs="yes" 125198fc1adaSDr. David Alan Gilbert ;; 1252da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 125320ff075bSMichael Walle ;; 1254da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 125520ff075bSMichael Walle ;; 1256f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1257f27aaf4bSChristian Brunner ;; 1258f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1259f27aaf4bSChristian Brunner ;; 12608c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 12618c84cf11SSergei Trofimovich ;; 12628c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 12638c84cf11SSergei Trofimovich ;; 12647b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1265111a38b0SRobert Relyea ;; 12667b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1267111a38b0SRobert Relyea ;; 12680a40bcb7SCésar Belley --disable-u2f) u2f="disabled" 12690a40bcb7SCésar Belley ;; 12700a40bcb7SCésar Belley --enable-u2f) u2f="enabled" 12710a40bcb7SCésar Belley ;; 12722b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 12732b2325ffSGerd Hoffmann ;; 12742b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 12752b2325ffSGerd Hoffmann ;; 127669354a83SHans de Goede --disable-usb-redir) usb_redir="no" 127769354a83SHans de Goede ;; 127869354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 127969354a83SHans de Goede ;; 12801ffb3bbbSPaolo Bonzini --disable-zlib-test) 12811ece9905SAlon Levy ;; 1282b25c9dffSStefan Weil --disable-lzo) lzo="no" 1283b25c9dffSStefan Weil ;; 1284607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1285607dacd0Sqiaonuohan ;; 1286b25c9dffSStefan Weil --disable-snappy) snappy="no" 1287b25c9dffSStefan Weil ;; 1288607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1289607dacd0Sqiaonuohan ;; 12906b383c08SPeter Wu --disable-bzip2) bzip2="no" 12916b383c08SPeter Wu ;; 12926b383c08SPeter Wu --enable-bzip2) bzip2="yes" 12936b383c08SPeter Wu ;; 129483bc1f97SJulio Faracco --enable-lzfse) lzfse="yes" 129583bc1f97SJulio Faracco ;; 129683bc1f97SJulio Faracco --disable-lzfse) lzfse="no" 129783bc1f97SJulio Faracco ;; 12983a678481SJuan Quintela --disable-zstd) zstd="no" 12993a678481SJuan Quintela ;; 13003a678481SJuan Quintela --enable-zstd) zstd="yes" 13013a678481SJuan Quintela ;; 1302d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1303d138cee9SMichael Roth ;; 1304d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1305d138cee9SMichael Roth ;; 13069dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 13079dacf32dSYossi Hindin ;; 13089dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 13099dacf32dSYossi Hindin ;; 1310d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1311d9840e25STomoki Sekiyama ;; 1312d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1313d9840e25STomoki Sekiyama ;; 1314d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1315d9840e25STomoki Sekiyama ;; 1316d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1317d9840e25STomoki Sekiyama ;; 1318d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1319d9840e25STomoki Sekiyama ;; 1320d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1321d9840e25STomoki Sekiyama ;; 13224b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 13234b1c11fdSDaniel P. Berrange ;; 13244b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 13254b1c11fdSDaniel P. Berrange ;; 1326f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1327f794573eSEduardo Otubo ;; 1328f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1329f794573eSEduardo Otubo ;; 1330eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1331eb100396SBharata B Rao ;; 133286583a07SLiam Merwick --disable-avx2) avx2_opt="no" 133386583a07SLiam Merwick ;; 133486583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 133586583a07SLiam Merwick ;; 13366b8cd447SRobert Hoo --disable-avx512f) avx512f_opt="no" 13376b8cd447SRobert Hoo ;; 13386b8cd447SRobert Hoo --enable-avx512f) avx512f_opt="yes" 13396b8cd447SRobert Hoo ;; 13406b8cd447SRobert Hoo 1341eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1342eb100396SBharata B Rao ;; 134352b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 134452b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1345583f6e7bSStefan Hajnoczi ;; 1346cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1347cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1348cb6414dfSFam Zheng ;; 1349315d3184SFam Zheng --enable-uuid|--disable-uuid) 1350315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1351315d3184SFam Zheng ;; 1352a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1353a4ccabcfSAnthony Liguori ;; 1354a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1355a4ccabcfSAnthony Liguori ;; 1356a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1357a1c5e949SDaniel P. Berrange ;; 1358ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1359ddbb0d09SDaniel P. Berrange ;; 1360ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1361ddbb0d09SDaniel P. Berrange ;; 136291bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 136391bfcdb0SDaniel P. Berrange ;; 136491bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 136591bfcdb0SDaniel P. Berrange ;; 136691bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 136791bfcdb0SDaniel P. Berrange ;; 136891bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 136991bfcdb0SDaniel P. Berrange ;; 13708953caf3SDaniel P. Berrange --disable-auth-pam) auth_pam="no" 13718953caf3SDaniel P. Berrange ;; 13728953caf3SDaniel P. Berrange --enable-auth-pam) auth_pam="yes" 13738953caf3SDaniel P. Berrange ;; 13742da776dbSMichael R. Hines --enable-rdma) rdma="yes" 13752da776dbSMichael R. Hines ;; 13762da776dbSMichael R. Hines --disable-rdma) rdma="no" 13772da776dbSMichael R. Hines ;; 137821ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 137921ab34c9SMarcel Apfelbaum ;; 138021ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 138121ab34c9SMarcel Apfelbaum ;; 1382bbbf9bfbSStefan Weil --disable-vte) vte="no" 1383bbbf9bfbSStefan Weil ;; 1384bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1385bbbf9bfbSStefan Weil ;; 13869d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 13879d9e1521SGerd Hoffmann ;; 13889d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 13899d9e1521SGerd Hoffmann ;; 1390e91c793cSCole Robinson --disable-tpm) tpm="no" 1391e91c793cSCole Robinson ;; 1392ab214c29SStefan Berger --enable-tpm) tpm="yes" 1393ab214c29SStefan Berger ;; 1394b10d49d7SPino Toscano --disable-libssh) libssh="no" 13950a12ec87SRichard W.M. Jones ;; 1396b10d49d7SPino Toscano --enable-libssh) libssh="yes" 13970a12ec87SRichard W.M. Jones ;; 1398ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1399ed1701c6SDr. David Alan Gilbert ;; 1400ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1401ed1701c6SDr. David Alan Gilbert ;; 1402a99d57bbSWanlong Gao --disable-numa) numa="no" 1403a99d57bbSWanlong Gao ;; 1404a99d57bbSWanlong Gao --enable-numa) numa="yes" 1405a99d57bbSWanlong Gao ;; 1406ed279a06SKlim Kireev --disable-libxml2) libxml2="no" 1407ed279a06SKlim Kireev ;; 1408ed279a06SKlim Kireev --enable-libxml2) libxml2="yes" 1409ed279a06SKlim Kireev ;; 14102847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 14112847b469SFam Zheng ;; 14122847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 14132847b469SFam Zheng ;; 14147b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 14157b01cb97SAlexandre Derumier ;; 14167b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 14177b01cb97SAlexandre Derumier ;; 1418a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1419a6b1d4c0SChanglong Xie ;; 1420a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1421a6b1d4c0SChanglong Xie ;; 14222f740136SJeff Cody --disable-bochs) bochs="no" 14232f740136SJeff Cody ;; 14242f740136SJeff Cody --enable-bochs) bochs="yes" 14252f740136SJeff Cody ;; 14262f740136SJeff Cody --disable-cloop) cloop="no" 14272f740136SJeff Cody ;; 14282f740136SJeff Cody --enable-cloop) cloop="yes" 14292f740136SJeff Cody ;; 14302f740136SJeff Cody --disable-dmg) dmg="no" 14312f740136SJeff Cody ;; 14322f740136SJeff Cody --enable-dmg) dmg="yes" 14332f740136SJeff Cody ;; 14342f740136SJeff Cody --disable-qcow1) qcow1="no" 14352f740136SJeff Cody ;; 14362f740136SJeff Cody --enable-qcow1) qcow1="yes" 14372f740136SJeff Cody ;; 14382f740136SJeff Cody --disable-vdi) vdi="no" 14392f740136SJeff Cody ;; 14402f740136SJeff Cody --enable-vdi) vdi="yes" 14412f740136SJeff Cody ;; 14422f740136SJeff Cody --disable-vvfat) vvfat="no" 14432f740136SJeff Cody ;; 14442f740136SJeff Cody --enable-vvfat) vvfat="yes" 14452f740136SJeff Cody ;; 14462f740136SJeff Cody --disable-qed) qed="no" 14472f740136SJeff Cody ;; 14482f740136SJeff Cody --enable-qed) qed="yes" 14492f740136SJeff Cody ;; 14502f740136SJeff Cody --disable-parallels) parallels="no" 14512f740136SJeff Cody ;; 14522f740136SJeff Cody --enable-parallels) parallels="yes" 14532f740136SJeff Cody ;; 14542f740136SJeff Cody --disable-sheepdog) sheepdog="no" 14552f740136SJeff Cody ;; 14562f740136SJeff Cody --enable-sheepdog) sheepdog="yes" 14572f740136SJeff Cody ;; 1458e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1459e6a74868SMarc-André Lureau ;; 1460299e6f19SPaolo Bonzini --enable-vhost-user) vhost_user="yes" 1461299e6f19SPaolo Bonzini ;; 1462108a6481SCindy Lu --disable-vhost-vdpa) vhost_vdpa="no" 1463108a6481SCindy Lu ;; 1464108a6481SCindy Lu --enable-vhost-vdpa) vhost_vdpa="yes" 1465108a6481SCindy Lu ;; 1466299e6f19SPaolo Bonzini --disable-vhost-kernel) vhost_kernel="no" 1467299e6f19SPaolo Bonzini ;; 1468299e6f19SPaolo Bonzini --enable-vhost-kernel) vhost_kernel="yes" 1469e6a74868SMarc-André Lureau ;; 14708b18cdbfSRichard Henderson --disable-capstone) capstone="disabled" 14718ca80760SRichard Henderson ;; 14728b18cdbfSRichard Henderson --enable-capstone) capstone="enabled" 14738ca80760SRichard Henderson ;; 14748b18cdbfSRichard Henderson --enable-capstone=git) capstone="internal" 1475e219c499SRichard Henderson ;; 1476e219c499SRichard Henderson --enable-capstone=system) capstone="system" 1477e219c499SRichard Henderson ;; 1478cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1479cc84d63aSDaniel P. Berrange ;; 1480f62bbee5SDaniel P. Berrange --enable-git-update) git_update=yes 1481f62bbee5SDaniel P. Berrange ;; 1482f62bbee5SDaniel P. Berrange --disable-git-update) git_update=no 1483f62bbee5SDaniel P. Berrange ;; 1484ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1485ba59fb77SPaolo Bonzini ;; 1486ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1487ba59fb77SPaolo Bonzini ;; 148817824406SJunyan He --enable-libpmem) libpmem=yes 148917824406SJunyan He ;; 149017824406SJunyan He --disable-libpmem) libpmem=no 149117824406SJunyan He ;; 14924113f4cfSLaurent Vivier --enable-xkbcommon) xkbcommon="enabled" 149375411919SJames Le Cuirot ;; 14944113f4cfSLaurent Vivier --disable-xkbcommon) xkbcommon="disabled" 149575411919SJames Le Cuirot ;; 149640e8c6f4SAlex Bennée --enable-plugins) plugins="yes" 149740e8c6f4SAlex Bennée ;; 149840e8c6f4SAlex Bennée --disable-plugins) plugins="no" 149940e8c6f4SAlex Bennée ;; 1500afc3a8f9SAlex Bennée --enable-containers) use_containers="yes" 1501afc3a8f9SAlex Bennée ;; 1502afc3a8f9SAlex Bennée --disable-containers) use_containers="no" 1503afc3a8f9SAlex Bennée ;; 1504adc28027SAlexander Bulekov --enable-fuzzing) fuzzing=yes 1505adc28027SAlexander Bulekov ;; 1506adc28027SAlexander Bulekov --disable-fuzzing) fuzzing=no 1507adc28027SAlexander Bulekov ;; 1508f48e590aSAlex Bennée --gdb=*) gdb_bin="$optarg" 1509f48e590aSAlex Bennée ;; 1510b767d257SMarek Marczykowski-Górecki --enable-rng-none) rng_none=yes 1511b767d257SMarek Marczykowski-Górecki ;; 1512b767d257SMarek Marczykowski-Górecki --disable-rng-none) rng_none=no 1513b767d257SMarek Marczykowski-Górecki ;; 151454e7aac0SAlexey Krasikov --enable-keyring) secret_keyring="yes" 151554e7aac0SAlexey Krasikov ;; 151654e7aac0SAlexey Krasikov --disable-keyring) secret_keyring="no" 151754e7aac0SAlexey Krasikov ;; 151821b2eca6SJingqi Liu --enable-libdaxctl) libdaxctl=yes 151921b2eca6SJingqi Liu ;; 152021b2eca6SJingqi Liu --disable-libdaxctl) libdaxctl=no 152121b2eca6SJingqi Liu ;; 15222d2ad6d0SFam Zheng *) 15232d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 15242d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 15252d2ad6d0SFam Zheng exit 1 15267f1559c6Sbalrog ;; 15277d13299dSbellard esac 15287d13299dSbellarddone 15297d13299dSbellard 153087727cb1SPaolo Bonzinifirmwarepath="${firmwarepath:-$prefix/share/qemu-firmware}" 153122a87800SMarc-André Lureaulibdir="${libdir:-$prefix/lib}" 153222a87800SMarc-André Lureaulibexecdir="${libexecdir:-$prefix/libexec}" 153322a87800SMarc-André Lureauincludedir="${includedir:-$prefix/include}" 153422a87800SMarc-André Lureau 153522a87800SMarc-André Lureauif test "$mingw32" = "yes" ; then 153622a87800SMarc-André Lureau mandir="$prefix" 153722a87800SMarc-André Lureau datadir="$prefix" 1538ca8c0909SMarc-André Lureau docdir="$prefix" 153922a87800SMarc-André Lureau bindir="$prefix" 154022a87800SMarc-André Lureau sysconfdir="$prefix" 154122a87800SMarc-André Lureau local_statedir= 154222a87800SMarc-André Lureauelse 154322a87800SMarc-André Lureau mandir="${mandir:-$prefix/share/man}" 154422a87800SMarc-André Lureau datadir="${datadir:-$prefix/share}" 1545ca8c0909SMarc-André Lureau docdir="${docdir:-$prefix/share/doc}" 154622a87800SMarc-André Lureau bindir="${bindir:-$prefix/bin}" 154722a87800SMarc-André Lureau sysconfdir="${sysconfdir:-$prefix/etc}" 154822a87800SMarc-André Lureau local_statedir="${local_statedir:-$prefix/var}" 154922a87800SMarc-André Lureaufi 155022a87800SMarc-André Lureau 155140293e58Sbellardcase "$cpu" in 1552e3608d66SRichard Henderson ppc) 1553e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1554db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1555e3608d66SRichard Henderson ;; 1556e3608d66SRichard Henderson ppc64) 1557e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1558db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1559e3608d66SRichard Henderson ;; 15609b9c37c3SRichard Henderson sparc) 1561f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1562db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 15633142255cSblueswir1 ;; 1564ed968ff1SJuan Quintela sparc64) 156579f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1566db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 15673142255cSblueswir1 ;; 156876d83bdeSths s390) 1569061cdd81SRichard Henderson CPU_CFLAGS="-m31" 1570db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 157128d7cc49SRichard Henderson ;; 157228d7cc49SRichard Henderson s390x) 1573061cdd81SRichard Henderson CPU_CFLAGS="-m64" 1574db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 157576d83bdeSths ;; 157640293e58Sbellard i386) 157779f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 1578db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 157940293e58Sbellard ;; 158040293e58Sbellard x86_64) 15817ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 15827ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 15837ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 15847ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 1585db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1586379f6698SPaul Brook ;; 1587c72b26ecSRichard Henderson x32) 1588c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1589db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1590c72b26ecSRichard Henderson ;; 159130163d89SPeter Maydell # No special flags required for other host CPUs 15923142255cSblueswir1esac 15933142255cSblueswir1 15942038f8c8SPaolo Bonzinieval "cross_cc_${cpu}=\$host_cc" 15952038f8c8SPaolo Bonzinicross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 159679f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 159779f3b12fSPeter Crosthwaite 1598affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1599affc88ccSPeter Maydell# support, even if we're using TCI. 1600affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1601affc88ccSPeter Maydell bsd_user="no" 1602affc88ccSPeter Maydell linux_user="no" 1603affc88ccSPeter Maydellfi 1604affc88ccSPeter Maydell 160560e0df25SPeter Maydelldefault_target_list="" 1606fdb75aefSPaolo Bonzinideprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user,lm32-softmmu,unicore32-softmmu 1607fdb75aefSPaolo Bonzinideprecated_features="" 16086e92f823SPeter Maydellmak_wilds="" 16096e92f823SPeter Maydell 161060e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 161173362fc0SPaolo Bonzini mak_wilds="${mak_wilds} $source_path/default-configs/targets/*-softmmu.mak" 161260e0df25SPeter Maydellfi 161360e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 161473362fc0SPaolo Bonzini mak_wilds="${mak_wilds} $source_path/default-configs/targets/*-linux-user.mak" 161560e0df25SPeter Maydellfi 161660e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 161773362fc0SPaolo Bonzini mak_wilds="${mak_wilds} $source_path/default-configs/targets/*-bsd-user.mak" 161860e0df25SPeter Maydellfi 161960e0df25SPeter Maydell 16203a5ae4a9SAlex Bennée# If the user doesn't explicitly specify a deprecated target we will 16213a5ae4a9SAlex Bennée# skip it. 16223a5ae4a9SAlex Bennéeif test -z "$target_list"; then 16233a5ae4a9SAlex Bennée if test -z "$target_list_exclude"; then 16243a5ae4a9SAlex Bennée target_list_exclude="$deprecated_targets_list" 16253a5ae4a9SAlex Bennée else 16263a5ae4a9SAlex Bennée target_list_exclude="$target_list_exclude,$deprecated_targets_list" 16273a5ae4a9SAlex Bennée fi 16282d838d9bSAlex Bennéefi 16292d838d9bSAlex Bennée 1630447e133fSAlex Bennéefor config in $mak_wilds; do 1631447e133fSAlex Bennée target="$(basename "$config" .mak)" 163298db9a06SAlex Bennée if echo "$target_list_exclude" | grep -vq "$target"; then 1633447e133fSAlex Bennée default_target_list="${default_target_list} $target" 1634447e133fSAlex Bennée fi 1635447e133fSAlex Bennéedone 16366e92f823SPeter Maydell 1637c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 163864a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1639c53eeaf7SStefan Hajnoczi 1640af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1641af5db58eSpbrookcat << EOF 1642af5db58eSpbrook 1643af5db58eSpbrookUsage: configure [options] 1644af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1645af5db58eSpbrook 164608fb77edSStefan WeilStandard options: 164708fb77edSStefan Weil --help print this message 164808fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 164908fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 165008fb77edSStefan Weil use %M for cpu name [$interp_prefix] 165108fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 165208fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 165308fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 1654447e133fSAlex Bennée --target-list-exclude=LIST exclude a set of targets from the default target-list 165508fb77edSStefan Weil 165608fb77edSStefan WeilAdvanced options (experts only): 165708fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 165808fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 165908fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 166008fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 166108fb77edSStefan Weil build time 166208fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 166308fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 166408fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 166511cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 166608fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1667d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1668d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 166908fb77edSStefan Weil --make=MAKE use specified make [$make] 167008fb77edSStefan Weil --python=PYTHON use specified python [$python] 16712eb054c2SPeter Maydell --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1672a5665051SPaolo Bonzini --meson=MESON use specified meson [$meson] 167348328880SPaolo Bonzini --ninja=NINJA use specified ninja [$ninja] 167408fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1675db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 167608fb77edSStefan Weil --static enable static build [$static] 167708fb77edSStefan Weil --mandir=PATH install man pages in PATH 167810ff82d1SMarc-André Lureau --datadir=PATH install firmware in PATH/$qemu_suffix 167910ff82d1SMarc-André Lureau --docdir=PATH install documentation in PATH/$qemu_suffix 168008fb77edSStefan Weil --bindir=PATH install binaries in PATH 168108fb77edSStefan Weil --libdir=PATH install libraries in PATH 1682db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 168310ff82d1SMarc-André Lureau --sysconfdir=PATH install config in PATH/$qemu_suffix 168408fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 16853d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 168613336606SRobert Foley --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1687ca8c0909SMarc-André Lureau --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix] 1688db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 168908fb77edSStefan Weil --enable-debug enable common debug build options 1690247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 16910aebab04SLingfeng Yang --enable-tsan enable thread sanitizer 169208fb77edSStefan Weil --disable-strip disable stripping binaries 169308fb77edSStefan Weil --disable-werror disable compilation abort on warning 169463678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 169508fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 169608fb77edSStefan Weil Available drivers: $audio_possible_drivers 169708fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 169808fb77edSStefan Weil --block-drv-rw-whitelist=L 169908fb77edSStefan Weil set block driver read-write whitelist 170008fb77edSStefan Weil (affects only QEMU, not qemu-img) 170108fb77edSStefan Weil --block-drv-ro-whitelist=L 170208fb77edSStefan Weil set block driver read-only whitelist 170308fb77edSStefan Weil (affects only QEMU, not qemu-img) 17045b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1705c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 170608fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 170708fb77edSStefan Weil Default:trace-<pid> 1708c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1709c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 17105a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1711c23f23b9SMichael Tokarev --oss-lib path to OSS library 1712c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 171308fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 171433c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 171508fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 1716c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1717c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1718c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1719a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1720c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1721c12d66aaSLin Ma --enable-profiler profiler support 1722c12d66aaSLin Ma --enable-debug-stack-usage 1723c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 172440e8c6f4SAlex Bennée --enable-plugins 172540e8c6f4SAlex Bennée enable plugins via shared library loading 1726afc3a8f9SAlex Bennée --disable-containers don't use containers for cross-building 1727f48e590aSAlex Bennée --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1728c23f23b9SMichael Tokarev 1729c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1730c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1731c23f23b9SMichael Tokarev 1732c23f23b9SMichael Tokarev system all system emulation targets 1733c23f23b9SMichael Tokarev user supported user emulation targets 1734c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1735c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1736c23f23b9SMichael Tokarev docs build documentation 1737c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1738c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1739c23f23b9SMichael Tokarev pie Position Independent Executables 174021e709aaSMarc-André Lureau modules modules support (non-Windows) 1741bd83c861SChristian Ehrhardt module-upgrades try to load modules from alternate paths for upgrades 1742c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1743c23f23b9SMichael Tokarev debug-info debugging information 1744c23f23b9SMichael Tokarev sparse sparse checker 17451e4f6065SDaniele Buono safe-stack SafeStack Stack Smash Protection. Depends on 17461e4f6065SDaniele Buono clang/llvm >= 3.7 and requires coroutine backend ucontext. 1747c23f23b9SMichael Tokarev 1748ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 174991bfcdb0SDaniel P. Berrange nettle nettle cryptography support 175091bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 17518953caf3SDaniel P. Berrange auth-pam PAM access control 1752c23f23b9SMichael Tokarev sdl SDL UI 175304c6e16fSMarkus Armbruster sdl-image SDL Image support for icons 1754c23f23b9SMichael Tokarev gtk gtk UI 1755c23f23b9SMichael Tokarev vte vte support for the gtk UI 1756c23f23b9SMichael Tokarev curses curses UI 1757e08bb301SSamuel Thibault iconv font glyph conversion support 1758c23f23b9SMichael Tokarev vnc VNC UI support 1759c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1760c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1761c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1762c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1763c23f23b9SMichael Tokarev virtfs VirtFS 1764fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1765c23f23b9SMichael Tokarev xen xen backend driver support 176670c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1767c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1768c23f23b9SMichael Tokarev curl curl connectivity 1769a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1770c23f23b9SMichael Tokarev fdt fdt device tree 1771c23f23b9SMichael Tokarev kvm KVM acceleration support 1772b0cb0a66SVincent Palatin hax HAX acceleration support 1773c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 1774d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 177521ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 177621ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1777c23f23b9SMichael Tokarev vde support for vde network 1778c23f23b9SMichael Tokarev netmap support for netmap network 1779c23f23b9SMichael Tokarev linux-aio Linux AIO support 1780c10dd856SAarushi Mehta linux-io-uring Linux io_uring support 1781c23f23b9SMichael Tokarev cap-ng libcap-ng support 1782c23f23b9SMichael Tokarev attr attr and xattr support 1783299e6f19SPaolo Bonzini vhost-net vhost-net kernel acceleration support 1784299e6f19SPaolo Bonzini vhost-vsock virtio sockets device support 1785299e6f19SPaolo Bonzini vhost-scsi vhost-scsi kernel target support 1786299e6f19SPaolo Bonzini vhost-crypto vhost-user-crypto backend support 1787299e6f19SPaolo Bonzini vhost-kernel vhost kernel backend support 1788299e6f19SPaolo Bonzini vhost-user vhost-user backend support 1789108a6481SCindy Lu vhost-vdpa vhost-vdpa kernel backend support 1790c23f23b9SMichael Tokarev spice spice 1791c23f23b9SMichael Tokarev rbd rados block device (rbd) 1792c23f23b9SMichael Tokarev libiscsi iscsi support 1793c23f23b9SMichael Tokarev libnfs nfs support 17947b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 17950a40bcb7SCésar Belley u2f U2F support (u2f-emu) 1796c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1797ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1798c23f23b9SMichael Tokarev usb-redir usb network redirection support 1799c23f23b9SMichael Tokarev lzo support of lzo compression library 1800c23f23b9SMichael Tokarev snappy support of snappy compression library 1801c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1802c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 180383bc1f97SJulio Faracco lzfse support of lzfse compression library 180483bc1f97SJulio Faracco (for reading lzfse-compressed dmg images) 18053a678481SJuan Quintela zstd support for zstd compression library 1806d298ac10SDenis Plotnikov (for migration compression and qcow2 cluster compression) 1807c23f23b9SMichael Tokarev seccomp seccomp support 1808c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1809c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1810c23f23b9SMichael Tokarev tpm TPM support 1811b10d49d7SPino Toscano libssh ssh block device support 1812c23f23b9SMichael Tokarev numa libnuma support 1813ed279a06SKlim Kireev libxml2 for Parallels image format 1814c23f23b9SMichael Tokarev tcmalloc tcmalloc support 18157b01cb97SAlexandre Derumier jemalloc jemalloc support 181686583a07SLiam Merwick avx2 AVX2 optimization support 18176b8cd447SRobert Hoo avx512f AVX512F optimization support 1818a6b1d4c0SChanglong Xie replication replication support 1819c12d66aaSLin Ma opengl opengl support 1820c12d66aaSLin Ma virglrenderer virgl rendering support 1821c12d66aaSLin Ma xfsctl xfsctl support 1822c12d66aaSLin Ma qom-cast-debug cast debugging support 18238de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 18242f740136SJeff Cody bochs bochs image format support 18252f740136SJeff Cody cloop cloop image format support 18262f740136SJeff Cody dmg dmg image format support 18272f740136SJeff Cody qcow1 qcow v1 image format support 18282f740136SJeff Cody vdi vdi image format support 18292f740136SJeff Cody vvfat vvfat image format support 18302f740136SJeff Cody qed qed image format support 18312f740136SJeff Cody parallels parallels image format support 18322f740136SJeff Cody sheepdog sheepdog block driver support 1833f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 18348ca80760SRichard Henderson capstone capstone disassembler support 1835ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 183617824406SJunyan He libpmem libpmem support 183775411919SJames Le Cuirot xkbcommon xkbcommon support 1838b767d257SMarek Marczykowski-Górecki rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 183921b2eca6SJingqi Liu libdaxctl libdaxctl support 184008fb77edSStefan Weil 184108fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1842af5db58eSpbrookEOF 18432d2ad6d0SFam Zhengexit 0 1844af5db58eSpbrookfi 1845af5db58eSpbrook 18469c790242SThomas Huth# Remove old dependency files to make sure that they get properly regenerated 1847bb768f71SThomas Huthrm -f */config-devices.mak.d 18489c790242SThomas Huth 1849faf44142SDaniel P. Berrangéif test -z "$python" 1850faf44142SDaniel P. Berrangéthen 1851c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1852c53eeaf7SStefan Hajnoczifi 1853c53eeaf7SStefan Hajnoczi 1854c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1855c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 18561b11f28dSThomas Huthif ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then 18571b11f28dSThomas Huth error_exit "Cannot use '$python', Python >= 3.6 is required." \ 1858c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1859c53eeaf7SStefan Hajnoczifi 1860c53eeaf7SStefan Hajnoczi 1861755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 1862406ab2f3SCleber 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) 1863755ee70fSCleber Rosa 1864c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1865c53eeaf7SStefan Hajnoczipython="$python -B" 1866c53eeaf7SStefan Hajnoczi 18670a01d76fSMarc-André Lureauif test -z "$meson"; then 186846504430SPaolo Bonzini if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.1; then 18690a01d76fSMarc-André Lureau meson=meson 18700a01d76fSMarc-André Lureau elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 18710a01d76fSMarc-André Lureau meson=git 18720a01d76fSMarc-André Lureau elif test -e "${source_path}/meson/meson.py" ; then 18730a01d76fSMarc-André Lureau meson=internal 18740a01d76fSMarc-André Lureau else 18750a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 18760a01d76fSMarc-André Lureau error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 18770a01d76fSMarc-André Lureau else 1878a5665051SPaolo Bonzini error_exit "Meson not found. Use --meson=/path/to/meson" 1879a5665051SPaolo Bonzini fi 18800a01d76fSMarc-André Lureau fi 18810a01d76fSMarc-André Lureauelse 18820a01d76fSMarc-André Lureau # Meson uses its own Python interpreter to invoke other Python scripts, 18830a01d76fSMarc-André Lureau # but the user wants to use the one they specified with --python. 18840a01d76fSMarc-André Lureau # 18850a01d76fSMarc-André Lureau # We do not want to override the distro Python interpreter (and sometimes 18860a01d76fSMarc-André Lureau # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 18870a01d76fSMarc-André Lureau # just require --meson=git|internal together with --python. 18880a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 18890a01d76fSMarc-André Lureau case "$meson" in 18900a01d76fSMarc-André Lureau git | internal) ;; 18910a01d76fSMarc-André Lureau *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 18920a01d76fSMarc-André Lureau esac 18930a01d76fSMarc-André Lureau fi 18940a01d76fSMarc-André Lureaufi 1895a5665051SPaolo Bonzini 18960a01d76fSMarc-André Lureauif test "$meson" = git; then 18970a01d76fSMarc-André Lureau git_submodules="${git_submodules} meson" 18980a01d76fSMarc-André Lureaufi 18990a01d76fSMarc-André Lureau 19000a01d76fSMarc-André Lureaucase "$meson" in 19010a01d76fSMarc-André Lureau git | internal) 1902a5665051SPaolo Bonzini if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then 1903a5665051SPaolo Bonzini error_exit "Python setuptools not found" 1904a5665051SPaolo Bonzini fi 19050a01d76fSMarc-André Lureau meson="$python ${source_path}/meson/meson.py" 19060a01d76fSMarc-André Lureau ;; 190784ec0c24SPaolo Bonzini *) meson=$(command -v "$meson") ;; 19080a01d76fSMarc-André Lureauesac 19090a01d76fSMarc-André Lureau 191048328880SPaolo Bonzini# Probe for ninja (used for compdb) 191148328880SPaolo Bonzini 191248328880SPaolo Bonziniif test -z "$ninja"; then 191348328880SPaolo Bonzini for c in ninja ninja-build samu; do 191448328880SPaolo Bonzini if has $c; then 191548328880SPaolo Bonzini ninja=$(command -v "$c") 191648328880SPaolo Bonzini break 191748328880SPaolo Bonzini fi 191848328880SPaolo Bonzini done 191948328880SPaolo Bonzinifi 1920a5665051SPaolo Bonzini 19219aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 19229aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 19239aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 19249aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 19259aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 19269aae6e54SDaniel Henrique Barbozaif compile_object ; then 19279aae6e54SDaniel Henrique Barboza : C compiler works ok 19289aae6e54SDaniel Henrique Barbozaelse 19299aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 19309aae6e54SDaniel Henrique Barbozafi 19319aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 19329aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 19339aae6e54SDaniel Henrique Barbozafi 19349aae6e54SDaniel Henrique Barboza 19359c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 19369c83ffd8SPeter Maydell# by default. Only enable by default for git builds 19379c83ffd8SPeter Maydellif test -z "$werror" ; then 1938fd73745dSAlexey Kardashevskiy if test -e "$source_path/.git" && \ 1939e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 19409c83ffd8SPeter Maydell werror="yes" 19419c83ffd8SPeter Maydell else 19429c83ffd8SPeter Maydell werror="no" 19439c83ffd8SPeter Maydell fi 19449c83ffd8SPeter Maydellfi 19459c83ffd8SPeter Maydell 1946fb59dabdSPeter Maydellif test "$bogus_os" = "yes"; then 1947fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1948fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1949fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1950fb59dabdSPeter Maydell # host OS we should stop now. 1951951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1952fb59dabdSPeter Maydellfi 1953fb59dabdSPeter Maydell 1954efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 1955efc6c070SThomas Huthcat > $TMPC << EOF 1956efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 1957efc6c070SThomas Huth# ifdef __apple_build_version__ 1958efc6c070SThomas Huth# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) 1959efc6c070SThomas Huth# error You need at least XCode Clang v5.1 to compile QEMU 1960efc6c070SThomas Huth# endif 1961efc6c070SThomas Huth# else 1962efc6c070SThomas Huth# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) 1963efc6c070SThomas Huth# error You need at least Clang v3.4 to compile QEMU 1964efc6c070SThomas Huth# endif 1965efc6c070SThomas Huth# endif 1966efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 1967efc6c070SThomas Huth# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 1968efc6c070SThomas Huth# error You need at least GCC v4.8 to compile QEMU 1969efc6c070SThomas Huth# endif 1970efc6c070SThomas Huth#else 1971efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 1972efc6c070SThomas Huth#endif 1973efc6c070SThomas Huthint main (void) { return 0; } 1974efc6c070SThomas HuthEOF 1975efc6c070SThomas Huthif ! compile_prog "" "" ; then 1976efc6c070SThomas Huth error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" 1977efc6c070SThomas Huthfi 1978efc6c070SThomas Huth 197900849b92SRichard Henderson# Accumulate -Wfoo and -Wno-bar separately. 198000849b92SRichard Henderson# We will list all of the enable flags first, and the disable flags second. 198100849b92SRichard Henderson# Note that we do not add -Werror, because that would enable it for all 198200849b92SRichard Henderson# configure tests. If a configure test failed due to -Werror this would 198300849b92SRichard Henderson# just silently disable some features, so it's too error prone. 198400849b92SRichard Henderson 198500849b92SRichard Hendersonwarn_flags= 198600849b92SRichard Hendersonadd_to warn_flags -Wold-style-declaration 198700849b92SRichard Hendersonadd_to warn_flags -Wold-style-definition 198800849b92SRichard Hendersonadd_to warn_flags -Wtype-limits 198900849b92SRichard Hendersonadd_to warn_flags -Wformat-security 199000849b92SRichard Hendersonadd_to warn_flags -Wformat-y2k 199100849b92SRichard Hendersonadd_to warn_flags -Winit-self 199200849b92SRichard Hendersonadd_to warn_flags -Wignored-qualifiers 199300849b92SRichard Hendersonadd_to warn_flags -Wempty-body 199400849b92SRichard Hendersonadd_to warn_flags -Wnested-externs 199500849b92SRichard Hendersonadd_to warn_flags -Wendif-labels 199600849b92SRichard Hendersonadd_to warn_flags -Wexpansion-to-defined 199700849b92SRichard Henderson 199800849b92SRichard Hendersonnowarn_flags= 199900849b92SRichard Hendersonadd_to nowarn_flags -Wno-initializer-overrides 200000849b92SRichard Hendersonadd_to nowarn_flags -Wno-missing-include-dirs 200100849b92SRichard Hendersonadd_to nowarn_flags -Wno-shift-negative-value 200200849b92SRichard Hendersonadd_to nowarn_flags -Wno-string-plus-int 200300849b92SRichard Hendersonadd_to nowarn_flags -Wno-typedef-redefinition 2004aabab967SRichard Hendersonadd_to nowarn_flags -Wno-tautological-type-limit-compare 2005bac8d222SRichard Hendersonadd_to nowarn_flags -Wno-psabi 200600849b92SRichard Henderson 200700849b92SRichard Hendersongcc_flags="$warn_flags $nowarn_flags" 200893b25869SJohn Snow 200993b25869SJohn Snowcc_has_warning_flag() { 201093b25869SJohn Snow write_c_skeleton; 201193b25869SJohn Snow 2012a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 2013a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 2014a1d29d6cSPeter Maydell # warning options). 201593b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 201693b25869SJohn Snow compile_prog "-Werror $optflag" "" 201793b25869SJohn Snow} 201893b25869SJohn Snow 201993b25869SJohn Snowfor flag in $gcc_flags; do 202093b25869SJohn Snow if cc_has_warning_flag $flag ; then 20218d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 20228d05095cSPaolo Bonzini fi 20238d05095cSPaolo Bonzinidone 20248d05095cSPaolo Bonzini 202563678e17SSteven Noonanif test "$stack_protector" != "no"; then 2026fccd35a0SRodrigo Rebello cat > $TMPC << EOF 2027fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 2028fccd35a0SRodrigo Rebello{ 2029fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 2030fccd35a0SRodrigo Rebello while (*c) { 2031fccd35a0SRodrigo Rebello *p++ = *c++; 2032fccd35a0SRodrigo Rebello } 2033fccd35a0SRodrigo Rebello return 0; 2034fccd35a0SRodrigo Rebello} 2035fccd35a0SRodrigo RebelloEOF 203663678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 20373b463a3fSMiroslav Rezanina sp_on=0 203863678e17SSteven Noonan for flag in $gcc_flags; do 2039590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 2040590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 2041086d5f75SPaolo Bonzini if compile_object "-Werror $flag" && 2042590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 204363678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2044db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 20453b463a3fSMiroslav Rezanina sp_on=1 204663678e17SSteven Noonan break 204763678e17SSteven Noonan fi 204863678e17SSteven Noonan done 20493b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 20503b463a3fSMiroslav Rezanina if test $sp_on = 0; then 20513b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 20523b463a3fSMiroslav Rezanina fi 20533b463a3fSMiroslav Rezanina fi 205437746c5eSMarc-André Lureaufi 205537746c5eSMarc-André Lureau 205620bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 205720bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 205820bc94a2SPaolo Bonzinicat > $TMPC << EOF 205920bc94a2SPaolo Bonzinistruct { 206020bc94a2SPaolo Bonzini int a[2]; 206120bc94a2SPaolo Bonzini} x = {0}; 206220bc94a2SPaolo BonziniEOF 206320bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 206420bc94a2SPaolo Bonzini : 206520bc94a2SPaolo Bonzinielse 206620bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 206720bc94a2SPaolo Bonzinifi 206820bc94a2SPaolo Bonzini 206921e709aaSMarc-André Lureau# Our module code doesn't support Windows 207021e709aaSMarc-André Lureauif test "$modules" = "yes" && test "$mingw32" = "yes" ; then 207121e709aaSMarc-André Lureau error_exit "Modules are not available for Windows" 207221e709aaSMarc-André Lureaufi 207321e709aaSMarc-André Lureau 2074bd83c861SChristian Ehrhardt# module_upgrades is only reasonable if modules are enabled 2075bd83c861SChristian Ehrhardtif test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2076bd83c861SChristian Ehrhardt error_exit "Can't enable module-upgrades as Modules are not enabled" 2077bd83c861SChristian Ehrhardtfi 2078bd83c861SChristian Ehrhardt 2079d376e9deSThomas Huth# Static linking is not possible with modules or PIE 208040d6444eSAvi Kivityif test "$static" = "yes" ; then 2081aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 2082aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 2083aa0d1f44SPaolo Bonzini fi 208440d6444eSAvi Kivityfi 208540d6444eSAvi Kivity 2086768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 2087768b7855SEmilio G. Cota cat > $TMPC << EOF 2088768b7855SEmilio G. Cotastatic __thread int tls_var; 2089768b7855SEmilio G. Cotaint main(void) { return tls_var; } 2090768b7855SEmilio G. CotaEOF 2091768b7855SEmilio G. Cota 2092768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 2093768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 2094768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 2095768b7855SEmilio G. Cotafi 2096768b7855SEmilio G. Cota 209740d6444eSAvi Kivitycat > $TMPC << EOF 209821d4a791SAvi Kivity 209921d4a791SAvi Kivity#ifdef __linux__ 210021d4a791SAvi Kivity# define THREAD __thread 210121d4a791SAvi Kivity#else 210221d4a791SAvi Kivity# define THREAD 210321d4a791SAvi Kivity#endif 210421d4a791SAvi Kivitystatic THREAD int tls_var; 210521d4a791SAvi Kivityint main(void) { return tls_var; } 210640d6444eSAvi KivityEOF 2107b2634124SRichard Henderson 2108b2634124SRichard Henderson# Check we support --no-pie first; we will need this for building ROMs. 2109412aeacdSAlex Bennéeif compile_prog "-Werror -fno-pie" "-no-pie"; then 2110412aeacdSAlex Bennée CFLAGS_NOPIE="-fno-pie" 2111b2634124SRichard Henderson LDFLAGS_NOPIE="-no-pie" 2112412aeacdSAlex Bennéefi 2113412aeacdSAlex Bennée 211412781462SRichard Hendersonif test "$static" = "yes"; then 2115eca7a8e6SRichard Henderson if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 21165770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 211712781462SRichard Henderson QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 211812781462SRichard Henderson pie="yes" 211912781462SRichard Henderson elif test "$pie" = "yes"; then 212012781462SRichard Henderson error_exit "-static-pie not available due to missing toolchain support" 212112781462SRichard Henderson else 212212781462SRichard Henderson QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 212312781462SRichard Henderson pie="no" 212412781462SRichard Henderson fi 212512781462SRichard Hendersonelif test "$pie" = "no"; then 21265770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" 21275770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS" 2128eca7a8e6SRichard Hendersonelif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 21295770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" 21305770e8afSPaolo Bonzini CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" 213140d6444eSAvi Kivity pie="yes" 21322c674109SRichard Hendersonelif test "$pie" = "yes"; then 213376ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 213440d6444eSAvi Kivityelse 213540d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 213640d6444eSAvi Kivity pie="no" 213740d6444eSAvi Kivityfi 213840d6444eSAvi Kivity 2139e6cbd751SRichard Henderson# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2140e6cbd751SRichard Henderson# The combination is known as "full relro", because .got.plt is read-only too. 2141e6cbd751SRichard Hendersonif compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2142e6cbd751SRichard Henderson QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2143e6cbd751SRichard Hendersonfi 2144e6cbd751SRichard Henderson 214509dada40SPaolo Bonzini########################################## 214609dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 214709dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 214809dada40SPaolo Bonzini# specification is necessary 214909dada40SPaolo Bonzini 215009dada40SPaolo Bonziniif test "$cpu" = "i386"; then 215109dada40SPaolo Bonzini cat > $TMPC << EOF 215209dada40SPaolo Bonzinistatic int sfaa(int *ptr) 215309dada40SPaolo Bonzini{ 215409dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 215509dada40SPaolo Bonzini} 215609dada40SPaolo Bonzini 215709dada40SPaolo Bonziniint main(void) 215809dada40SPaolo Bonzini{ 215909dada40SPaolo Bonzini int val = 42; 21601405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 216109dada40SPaolo Bonzini sfaa(&val); 216209dada40SPaolo Bonzini return val; 216309dada40SPaolo Bonzini} 216409dada40SPaolo BonziniEOF 216509dada40SPaolo Bonzini if ! compile_prog "" "" ; then 216609dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 216709dada40SPaolo Bonzini fi 216809dada40SPaolo Bonzinifi 216909dada40SPaolo Bonzini 217009dada40SPaolo Bonzini######################################### 2171ec530c81Sbellard# Solaris specific configure tool chain decisions 217209dada40SPaolo Bonzini 2173ec530c81Sbellardif test "$solaris" = "yes" ; then 21746792aa11SLoïc Minier if has ar; then 21756792aa11SLoïc Minier : 21766792aa11SLoïc Minier else 2177ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 217876ad07a4SPeter Maydell error_exit "No path includes ar" \ 217976ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 2180ec530c81Sbellard fi 218176ad07a4SPeter Maydell error_exit "No path includes ar" 2182ec530c81Sbellard fi 2183ec530c81Sbellardfi 2184ec530c81Sbellard 2185afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 2186fdb75aefSPaolo Bonzini default_targets=yes 2187d880a3baSPaolo Bonzini for target in $default_target_list; do 2188d880a3baSPaolo Bonzini target_list="$target_list $target" 2189d880a3baSPaolo Bonzini done 2190d880a3baSPaolo Bonzini target_list="${target_list# }" 2191121afa9eSAnthony Liguorielse 2192fdb75aefSPaolo Bonzini default_targets=no 219389138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2194d880a3baSPaolo Bonzini for target in $target_list; do 219525b48338SPeter Maydell # Check that we recognised the target name; this allows a more 219625b48338SPeter Maydell # friendly error message than if we let it fall through. 219725b48338SPeter Maydell case " $default_target_list " in 219825b48338SPeter Maydell *" $target "*) 219925b48338SPeter Maydell ;; 220025b48338SPeter Maydell *) 220125b48338SPeter Maydell error_exit "Unknown target name '$target'" 220225b48338SPeter Maydell ;; 220325b48338SPeter Maydell esac 220425b48338SPeter Maydell done 2205d880a3baSPaolo Bonzinifi 220625b48338SPeter Maydell 2207fdb75aefSPaolo Bonzinifor target in $target_list; do 2208fdb75aefSPaolo Bonzini # if a deprecated target is enabled we note it here 2209fdb75aefSPaolo Bonzini if echo "$deprecated_targets_list" | grep -q "$target"; then 2210fdb75aefSPaolo Bonzini add_to deprecated_features $target 2211fdb75aefSPaolo Bonzini fi 2212fdb75aefSPaolo Bonzinidone 2213fdb75aefSPaolo Bonzini 2214f55fe278SPaolo Bonzini# see if system emulation was really requested 2215f55fe278SPaolo Bonzinicase " $target_list " in 2216f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 2217f55fe278SPaolo Bonzini ;; 2218f55fe278SPaolo Bonzini *) softmmu=no 2219f55fe278SPaolo Bonzini ;; 2220f55fe278SPaolo Bonziniesac 22215327cf48Sbellard 222205dfa22bSPhilippe Mathieu-Daudéfor target in $target_list; do 222305dfa22bSPhilippe Mathieu-Daudé case "$target" in 222405dfa22bSPhilippe Mathieu-Daudé arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu) 222505dfa22bSPhilippe Mathieu-Daudé edk2_blobs="yes" 222605dfa22bSPhilippe Mathieu-Daudé ;; 222705dfa22bSPhilippe Mathieu-Daudé esac 222805dfa22bSPhilippe Mathieu-Daudédone 2229623ef637SPhilippe Mathieu-Daudé# The EDK2 binaries are compressed with bzip2 2230623ef637SPhilippe Mathieu-Daudéif test "$edk2_blobs" = "yes" && ! has bzip2; then 2231623ef637SPhilippe Mathieu-Daudé error_exit "The bzip2 program is required for building QEMU" 2232623ef637SPhilippe Mathieu-Daudéfi 223305dfa22bSPhilippe Mathieu-Daudé 2234249247c9SJuan Quintelafeature_not_found() { 2235249247c9SJuan Quintela feature=$1 223621684af0SStewart Smith remedy=$2 2237249247c9SJuan Quintela 223876ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 223921684af0SStewart Smith "configure was not able to find it." \ 224021684af0SStewart Smith "$remedy" 2241249247c9SJuan Quintela} 2242249247c9SJuan Quintela 22437d13299dSbellard# --- 22447d13299dSbellard# big/little endian test 22457d13299dSbellardcat > $TMPC << EOF 224661cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 224761cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 224861cc919fSMike Frysingerextern int foo(short *, short *); 224961cc919fSMike Frysingerint main(int argc, char *argv[]) { 225061cc919fSMike Frysinger return foo(big_endian, little_endian); 22517d13299dSbellard} 22527d13299dSbellardEOF 22537d13299dSbellard 225461cc919fSMike Frysingerif compile_object ; then 225512f15c91SAlice Frosi if strings -a $TMPO | grep -q BiGeNdIaN ; then 225661cc919fSMike Frysinger bigendian="yes" 225712f15c91SAlice Frosi elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 225861cc919fSMike Frysinger bigendian="no" 22597d13299dSbellard else 22607d13299dSbellard echo big/little test failed 22617d13299dSbellard fi 22627d13299dSbellardelse 226361cc919fSMike Frysinger echo big/little test failed 22647d13299dSbellardfi 22657d13299dSbellard 2266b0a47e79SJuan Quintela########################################## 2267e10ee3f5SPhilippe Mathieu-Daudé# system tools 2268e10ee3f5SPhilippe Mathieu-Daudéif test -z "$want_tools"; then 2269e10ee3f5SPhilippe Mathieu-Daudé if test "$softmmu" = "no"; then 2270e10ee3f5SPhilippe Mathieu-Daudé want_tools=no 2271e10ee3f5SPhilippe Mathieu-Daudé else 2272e10ee3f5SPhilippe Mathieu-Daudé want_tools=yes 2273e10ee3f5SPhilippe Mathieu-Daudé fi 2274e10ee3f5SPhilippe Mathieu-Daudéfi 2275e10ee3f5SPhilippe Mathieu-Daudé 2276e10ee3f5SPhilippe Mathieu-Daudé########################################## 2277a30878e7SPeter Maydell# cocoa implies not SDL or GTK 2278a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 2279a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 2280b4e312e9SPaolo Bonziniif test "$cocoa" = "enabled"; then 2281b4e312e9SPaolo Bonzini if test "$sdl" = "enabled"; then 2282a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2283a30878e7SPeter Maydell fi 2284a30878e7SPeter Maydell if test "$gtk" = "yes"; then 2285a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2286a30878e7SPeter Maydell fi 2287a30878e7SPeter Maydell gtk=no 228835be72baSPaolo Bonzini sdl=disabled 2289a30878e7SPeter Maydellfi 2290a30878e7SPeter Maydell 22916b39b063SEric Blake# Some versions of Mac OS X incorrectly define SIZE_MAX 22926b39b063SEric Blakecat > $TMPC << EOF 22936b39b063SEric Blake#include <stdint.h> 22946b39b063SEric Blake#include <stdio.h> 22956b39b063SEric Blakeint main(int argc, char *argv[]) { 22966b39b063SEric Blake return printf("%zu", SIZE_MAX); 22976b39b063SEric Blake} 22986b39b063SEric BlakeEOF 22996b39b063SEric Blakehave_broken_size_max=no 23006b39b063SEric Blakeif ! compile_object -Werror ; then 23016b39b063SEric Blake have_broken_size_max=yes 23026b39b063SEric Blakefi 23036b39b063SEric Blake 2304a30878e7SPeter Maydell########################################## 2305015a33bdSGonglei# L2TPV3 probe 2306015a33bdSGonglei 2307015a33bdSGongleicat > $TMPC <<EOF 2308015a33bdSGonglei#include <sys/socket.h> 2309bff6cb72SMichael Tokarev#include <linux/ip.h> 2310015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2311015a33bdSGongleiEOF 2312015a33bdSGongleiif compile_prog "" "" ; then 2313015a33bdSGonglei l2tpv3=yes 2314015a33bdSGongleielse 2315015a33bdSGonglei l2tpv3=no 2316015a33bdSGongleifi 2317015a33bdSGonglei 2318c9c8b88fSDavid CARLIERif check_include "pty.h" ; then 2319c9c8b88fSDavid CARLIER pty_h=yes 2320c9c8b88fSDavid CARLIERelse 2321c9c8b88fSDavid CARLIER pty_h=no 2322c9c8b88fSDavid CARLIERfi 2323c9c8b88fSDavid CARLIER 2324195588ccSDavid CARLIERcat > $TMPC <<EOF 2325195588ccSDavid CARLIER#include <sys/mman.h> 2326195588ccSDavid CARLIERint main(int argc, char *argv[]) { 2327195588ccSDavid CARLIER return mlockall(MCL_FUTURE); 2328195588ccSDavid CARLIER} 2329195588ccSDavid CARLIEREOF 2330195588ccSDavid CARLIERif compile_prog "" "" ; then 2331195588ccSDavid CARLIER have_mlockall=yes 2332195588ccSDavid CARLIERelse 2333195588ccSDavid CARLIER have_mlockall=no 2334195588ccSDavid CARLIERfi 2335195588ccSDavid CARLIER 2336299e6f19SPaolo Bonzini######################################### 2337299e6f19SPaolo Bonzini# vhost interdependencies and host support 2338299e6f19SPaolo Bonzini 2339299e6f19SPaolo Bonzini# vhost backends 2340299e6f19SPaolo Bonzinitest "$vhost_user" = "" && vhost_user=yes 2341299e6f19SPaolo Bonziniif test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then 2342299e6f19SPaolo Bonzini error_exit "vhost-user isn't available on win32" 2343299e6f19SPaolo Bonzinifi 2344108a6481SCindy Lutest "$vhost_vdpa" = "" && vhost_vdpa=$linux 2345108a6481SCindy Luif test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 2346108a6481SCindy Lu error_exit "vhost-vdpa is only available on Linux" 2347108a6481SCindy Lufi 2348299e6f19SPaolo Bonzinitest "$vhost_kernel" = "" && vhost_kernel=$linux 2349299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2350299e6f19SPaolo Bonzini error_exit "vhost-kernel is only available on Linux" 2351299e6f19SPaolo Bonzinifi 2352299e6f19SPaolo Bonzini 2353299e6f19SPaolo Bonzini# vhost-kernel devices 2354299e6f19SPaolo Bonzinitest "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2355299e6f19SPaolo Bonziniif test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2356299e6f19SPaolo Bonzini error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2357299e6f19SPaolo Bonzinifi 2358299e6f19SPaolo Bonzinitest "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2359299e6f19SPaolo Bonziniif test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2360299e6f19SPaolo Bonzini error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2361299e6f19SPaolo Bonzinifi 2362299e6f19SPaolo Bonzini 2363299e6f19SPaolo Bonzini# vhost-user backends 2364299e6f19SPaolo Bonzinitest "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2365299e6f19SPaolo Bonziniif test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2366299e6f19SPaolo Bonzini error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2367299e6f19SPaolo Bonzinifi 2368299e6f19SPaolo Bonzinitest "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2369299e6f19SPaolo Bonziniif test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2370299e6f19SPaolo Bonzini error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2371299e6f19SPaolo Bonzinifi 237298fc1adaSDr. David Alan Gilberttest "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 237398fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 237498fc1adaSDr. David Alan Gilbert error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 237598fc1adaSDr. David Alan Gilbertfi 2376108a6481SCindy Lu#vhost-vdpa backends 2377108a6481SCindy Lutest "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 2378108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 2379108a6481SCindy Lu error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 2380108a6481SCindy Lufi 2381299e6f19SPaolo Bonzini 238240bc0ca9SLaurent Vivier# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity 2383299e6f19SPaolo Bonziniif test "$vhost_net" = ""; then 2384299e6f19SPaolo Bonzini test "$vhost_net_user" = "yes" && vhost_net=yes 238540bc0ca9SLaurent Vivier test "$vhost_net_vdpa" = "yes" && vhost_net=yes 2386299e6f19SPaolo Bonzini test "$vhost_kernel" = "yes" && vhost_net=yes 2387299e6f19SPaolo Bonzinifi 2388299e6f19SPaolo Bonzini 2389015a33bdSGonglei########################################## 23904d9310f4SDaniel P. Berrange# MinGW / Mingw-w64 localtime_r/gmtime_r check 23914d9310f4SDaniel P. Berrange 23924d9310f4SDaniel P. Berrangeif test "$mingw32" = "yes"; then 23934d9310f4SDaniel P. Berrange # Some versions of MinGW / Mingw-w64 lack localtime_r 23944d9310f4SDaniel P. Berrange # and gmtime_r entirely. 23954d9310f4SDaniel P. Berrange # 23964d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 define a macro for 23974d9310f4SDaniel P. Berrange # localtime_r/gmtime_r. 23984d9310f4SDaniel P. Berrange # 23994d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 will define functions 24004d9310f4SDaniel P. Berrange # for localtime_r/gmtime_r, but only if you have 24014d9310f4SDaniel P. Berrange # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 24024d9310f4SDaniel P. Berrange # though, unistd.h and pthread.h both define 24034d9310f4SDaniel P. Berrange # that for you. 24044d9310f4SDaniel P. Berrange # 24054d9310f4SDaniel P. Berrange # So this #undef localtime_r and #include <unistd.h> 24064d9310f4SDaniel P. Berrange # are not in fact redundant. 24074d9310f4SDaniel P. Berrangecat > $TMPC << EOF 24084d9310f4SDaniel P. Berrange#include <unistd.h> 24094d9310f4SDaniel P. Berrange#include <time.h> 24104d9310f4SDaniel P. Berrange#undef localtime_r 24114d9310f4SDaniel P. Berrangeint main(void) { localtime_r(NULL, NULL); return 0; } 24124d9310f4SDaniel P. BerrangeEOF 24134d9310f4SDaniel P. Berrange if compile_prog "" "" ; then 24144d9310f4SDaniel P. Berrange localtime_r="yes" 24154d9310f4SDaniel P. Berrange else 24164d9310f4SDaniel P. Berrange localtime_r="no" 24174d9310f4SDaniel P. Berrange fi 24184d9310f4SDaniel P. Berrangefi 24194d9310f4SDaniel P. Berrange 24204d9310f4SDaniel P. Berrange########################################## 2421779ab5e3SStefan Weil# pkg-config probe 2422779ab5e3SStefan Weil 2423779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 242476ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2425779ab5e3SStefan Weilfi 2426779ab5e3SStefan Weil 2427779ab5e3SStefan Weil########################################## 2428b0a47e79SJuan Quintela# NPTL probe 2429b0a47e79SJuan Quintela 243024cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2431bd0c5661Spbrook cat > $TMPC <<EOF 2432bd0c5661Spbrook#include <sched.h> 243330813ceaSpbrook#include <linux/futex.h> 2434182eacc0SStefan Weilint main(void) { 2435bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2436bd0c5661Spbrook#error bork 2437bd0c5661Spbrook#endif 2438182eacc0SStefan Weil return 0; 2439bd0c5661Spbrook} 2440bd0c5661SpbrookEOF 244124cb36a6SPeter Maydell if ! compile_object ; then 244221684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2443b0a47e79SJuan Quintela fi 2444bd0c5661Spbrookfi 2445bd0c5661Spbrook 2446ac62922eSbalrog########################################## 2447607dacd0Sqiaonuohan# lzo check 2448607dacd0Sqiaonuohan 2449607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 2450607dacd0Sqiaonuohan cat > $TMPC << EOF 2451607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 2452607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 2453607dacd0SqiaonuohanEOF 2454607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 2455708eab42SMarc-André Lureau lzo_libs="-llzo2" 2456b25c9dffSStefan Weil lzo="yes" 2457b25c9dffSStefan Weil else 2458b25c9dffSStefan Weil if test "$lzo" = "yes"; then 2459b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 2460b25c9dffSStefan Weil fi 2461b25c9dffSStefan Weil lzo="no" 2462b25c9dffSStefan Weil fi 2463607dacd0Sqiaonuohanfi 2464607dacd0Sqiaonuohan 2465607dacd0Sqiaonuohan########################################## 2466607dacd0Sqiaonuohan# snappy check 2467607dacd0Sqiaonuohan 2468607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 2469607dacd0Sqiaonuohan cat > $TMPC << EOF 2470607dacd0Sqiaonuohan#include <snappy-c.h> 2471607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 2472607dacd0SqiaonuohanEOF 2473607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 2474708eab42SMarc-André Lureau snappy_libs='-lsnappy' 2475b25c9dffSStefan Weil snappy="yes" 2476b25c9dffSStefan Weil else 2477b25c9dffSStefan Weil if test "$snappy" = "yes"; then 2478b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 2479b25c9dffSStefan Weil fi 2480b25c9dffSStefan Weil snappy="no" 2481b25c9dffSStefan Weil fi 2482607dacd0Sqiaonuohanfi 2483607dacd0Sqiaonuohan 2484607dacd0Sqiaonuohan########################################## 24856b383c08SPeter Wu# bzip2 check 24866b383c08SPeter Wu 24876b383c08SPeter Wuif test "$bzip2" != "no" ; then 24886b383c08SPeter Wu cat > $TMPC << EOF 24896b383c08SPeter Wu#include <bzlib.h> 24906b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 24916b383c08SPeter WuEOF 24926b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 24936b383c08SPeter Wu bzip2="yes" 24946b383c08SPeter Wu else 24956b383c08SPeter Wu if test "$bzip2" = "yes"; then 24966b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 24976b383c08SPeter Wu fi 24986b383c08SPeter Wu bzip2="no" 24996b383c08SPeter Wu fi 25006b383c08SPeter Wufi 25016b383c08SPeter Wu 25026b383c08SPeter Wu########################################## 250383bc1f97SJulio Faracco# lzfse check 250483bc1f97SJulio Faracco 250583bc1f97SJulio Faraccoif test "$lzfse" != "no" ; then 250683bc1f97SJulio Faracco cat > $TMPC << EOF 250783bc1f97SJulio Faracco#include <lzfse.h> 250883bc1f97SJulio Faraccoint main(void) { lzfse_decode_scratch_size(); return 0; } 250983bc1f97SJulio FaraccoEOF 251083bc1f97SJulio Faracco if compile_prog "" "-llzfse" ; then 251183bc1f97SJulio Faracco lzfse="yes" 251283bc1f97SJulio Faracco else 251383bc1f97SJulio Faracco if test "$lzfse" = "yes"; then 251483bc1f97SJulio Faracco feature_not_found "lzfse" "Install lzfse devel" 251583bc1f97SJulio Faracco fi 251683bc1f97SJulio Faracco lzfse="no" 251783bc1f97SJulio Faracco fi 251883bc1f97SJulio Faraccofi 251983bc1f97SJulio Faracco 252083bc1f97SJulio Faracco########################################## 25213a678481SJuan Quintela# zstd check 25223a678481SJuan Quintela 25233a678481SJuan Quintelaif test "$zstd" != "no" ; then 2524297254c7SJuan Quintela libzstd_minver="1.4.0" 2525297254c7SJuan Quintela if $pkg_config --atleast-version=$libzstd_minver libzstd ; then 25263a678481SJuan Quintela zstd_cflags="$($pkg_config --cflags libzstd)" 25273a678481SJuan Quintela zstd_libs="$($pkg_config --libs libzstd)" 25283a678481SJuan Quintela zstd="yes" 25293a678481SJuan Quintela else 25303a678481SJuan Quintela if test "$zstd" = "yes" ; then 25313a678481SJuan Quintela feature_not_found "libzstd" "Install libzstd devel" 25323a678481SJuan Quintela fi 25333a678481SJuan Quintela zstd="no" 25343a678481SJuan Quintela fi 25353a678481SJuan Quintelafi 25363a678481SJuan Quintela 25373a678481SJuan Quintela########################################## 2538f794573eSEduardo Otubo# libseccomp check 2539f794573eSEduardo Otubo 2540f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 25413e684455SMichael Strosaker libseccomp_minver="2.3.0" 254225ed0eccSHelge Deller if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2543c3883e1fSFam Zheng seccomp_cflags="$($pkg_config --cflags libseccomp)" 2544c3883e1fSFam Zheng seccomp_libs="$($pkg_config --libs libseccomp)" 2545f794573eSEduardo Otubo seccomp="yes" 2546f794573eSEduardo Otubo else 2547f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 2548693e5910SAndrew Jones feature_not_found "libseccomp" \ 2549693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 2550896848f0SEduardo Otubo fi 2551e84d5956SYann E. MORIN seccomp="no" 2552f794573eSEduardo Otubo fi 2553f794573eSEduardo Otubofi 25543bd40ec7SPaolo Bonzini 2555f794573eSEduardo Otubo########################################## 2556e37630caSaliguori# xen probe 2557e37630caSaliguori 25581badb709SPaolo Bonziniif test "$xen" != "disabled" ; then 2559c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2560c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2561c1cdd9d5SJuergen Gross # to obtain all needed flags. 2562c1cdd9d5SJuergen Gross 2563c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2564c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2565c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2566c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 25671badb709SPaolo Bonzini xen=enabled 2568c1cdd9d5SJuergen Gross xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2569c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 257058ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 257158ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 257258ea9a7aSAnthony PERARD fi 2573582ea95fSMarc-André Lureau xen_cflags="$($pkg_config --cflags $xen_pc)" 2574582ea95fSMarc-André Lureau xen_libs="$($pkg_config --libs $xen_pc)" 2575c1cdd9d5SJuergen Gross else 2576c1cdd9d5SJuergen Gross 2577b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 2578d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2579d5b93ddfSAnthony PERARD 258050ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 258150ced5b3SStefan Weil # If no, we are done and there is no Xen support. 258250ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 258350ced5b3SStefan Weil 258450ced5b3SStefan Weil # Xen (any) 258550ced5b3SStefan Weil cat > $TMPC <<EOF 258650ced5b3SStefan Weil#include <xenctrl.h> 258750ced5b3SStefan Weilint main(void) { 258850ced5b3SStefan Weil return 0; 258950ced5b3SStefan Weil} 259050ced5b3SStefan WeilEOF 259150ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 259250ced5b3SStefan Weil # Xen not found 25931badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 259421684af0SStewart Smith feature_not_found "xen" "Install xen devel" 259550ced5b3SStefan Weil fi 25961badb709SPaolo Bonzini xen=disabled 259750ced5b3SStefan Weil 2598d5b93ddfSAnthony PERARD # Xen unstable 259969deef08SPeter Maydell elif 260069deef08SPeter Maydell cat > $TMPC <<EOF && 26012cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 26022cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 26032cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2604d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 26052cbf8903SRoss Lagerwallint main(void) { 26062cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2607d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 26082cbf8903SRoss Lagerwall 26092cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 26102cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 26112cbf8903SRoss Lagerwall 2612d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2613d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2614d3c49ebbSPaul Durrant 26152cbf8903SRoss Lagerwall return 0; 26162cbf8903SRoss Lagerwall} 26172cbf8903SRoss LagerwallEOF 26182cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 26192cbf8903SRoss Lagerwall then 26202cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 26212cbf8903SRoss Lagerwall xen_ctrl_version=41100 26221badb709SPaolo Bonzini xen=enabled 26232cbf8903SRoss Lagerwall elif 26242cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 26255ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 26265ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 262758ea9a7aSAnthony PERARD#include <xentoolcore.h> 26285ba3d756SIgor Druzhininint main(void) { 26295ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 26305ba3d756SIgor Druzhinin 26315ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 26325ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 263358ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 26345ba3d756SIgor Druzhinin 26355ba3d756SIgor Druzhinin return 0; 26365ba3d756SIgor Druzhinin} 26375ba3d756SIgor DruzhininEOF 263858ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 26395ba3d756SIgor Druzhinin then 264058ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 26415ba3d756SIgor Druzhinin xen_ctrl_version=41000 26421badb709SPaolo Bonzini xen=enabled 26435ba3d756SIgor Druzhinin elif 26445ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2645da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2646da8090ccSPaul Durrant#define __XEN_TOOLS__ 2647da8090ccSPaul Durrant#include <xendevicemodel.h> 2648da8090ccSPaul Durrantint main(void) { 2649da8090ccSPaul Durrant xendevicemodel_handle *xd; 2650da8090ccSPaul Durrant 2651da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2652da8090ccSPaul Durrant xendevicemodel_close(xd); 2653da8090ccSPaul Durrant 2654da8090ccSPaul Durrant return 0; 2655da8090ccSPaul Durrant} 2656da8090ccSPaul DurrantEOF 2657da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2658da8090ccSPaul Durrant then 2659da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2660f1167ee6SJuergen Gross xen_ctrl_version=40900 26611badb709SPaolo Bonzini xen=enabled 2662da8090ccSPaul Durrant elif 2663da8090ccSPaul Durrant cat > $TMPC <<EOF && 26645eeb39c2SIan Campbell/* 26655eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 26665eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2667b6eb9b45SPaulina Szubarczyk * 2668b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2669b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2670b6eb9b45SPaulina Szubarczyk */ 2671b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2672b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2673b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2674b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2675b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2676b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2677b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2678b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2679b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2680b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2681b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2682b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2683b6eb9b45SPaulina Szubarczyk#endif 2684b6eb9b45SPaulina Szubarczykint main(void) { 2685b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2686b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2687b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2688b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2689b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2690b6eb9b45SPaulina Szubarczyk 2691b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2692b6eb9b45SPaulina Szubarczyk 2693b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2694b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2695b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2696b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2697b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2698b6eb9b45SPaulina Szubarczyk 2699b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2700b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2701b6eb9b45SPaulina Szubarczyk 2702b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2703b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2704b6eb9b45SPaulina Szubarczyk 2705b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2706b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2707b6eb9b45SPaulina Szubarczyk 2708b6eb9b45SPaulina Szubarczyk return 0; 2709b6eb9b45SPaulina Szubarczyk} 2710b6eb9b45SPaulina SzubarczykEOF 2711b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2712b6eb9b45SPaulina Szubarczyk then 2713f1167ee6SJuergen Gross xen_ctrl_version=40800 27141badb709SPaolo Bonzini xen=enabled 2715b6eb9b45SPaulina Szubarczyk elif 2716b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2717b6eb9b45SPaulina Szubarczyk/* 2718b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2719b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 27205eeb39c2SIan Campbell */ 27215eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 27225eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 27235eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 27245eeb39c2SIan Campbell#include <xenctrl.h> 27255eeb39c2SIan Campbell#include <xenstore.h> 27265eeb39c2SIan Campbell#include <xenevtchn.h> 27275eeb39c2SIan Campbell#include <xengnttab.h> 27285eeb39c2SIan Campbell#include <xenforeignmemory.h> 27295eeb39c2SIan Campbell#include <stdint.h> 27305eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 27315eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 27325eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 27335eeb39c2SIan Campbell#endif 27345eeb39c2SIan Campbellint main(void) { 27355eeb39c2SIan Campbell xc_interface *xc = NULL; 27365eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 27375eeb39c2SIan Campbell xenevtchn_handle *xe; 27385eeb39c2SIan Campbell xengnttab_handle *xg; 27395eeb39c2SIan Campbell 27405eeb39c2SIan Campbell xs_daemon_open(); 27415eeb39c2SIan Campbell 27425eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 27435eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 27445eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 27455eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 27465eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 27475eeb39c2SIan Campbell 27485eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 27495eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 27505eeb39c2SIan Campbell 27515eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 27525eeb39c2SIan Campbell xenevtchn_fd(xe); 27535eeb39c2SIan Campbell 27545eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 27555eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 27565eeb39c2SIan Campbell 27575eeb39c2SIan Campbell return 0; 27585eeb39c2SIan Campbell} 27595eeb39c2SIan CampbellEOF 27605eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 27615eeb39c2SIan Campbell then 2762f1167ee6SJuergen Gross xen_ctrl_version=40701 27631badb709SPaolo Bonzini xen=enabled 2764cdadde39SRoger Pau Monne 2765cdadde39SRoger Pau Monne # Xen 4.6 2766cdadde39SRoger Pau Monne elif 2767cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2768cdadde39SRoger Pau Monne#include <xenctrl.h> 2769e108a3c1SAnthony PERARD#include <xenstore.h> 2770d5b93ddfSAnthony PERARD#include <stdint.h> 2771d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2772d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2773d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2774d5b93ddfSAnthony PERARD#endif 2775d5b93ddfSAnthony PERARDint main(void) { 2776d5b93ddfSAnthony PERARD xc_interface *xc; 2777d5b93ddfSAnthony PERARD xs_daemon_open(); 2778d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2779d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2780d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2781b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 27828688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2783d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 278420a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2785d8b441a3SJan Beulich return 0; 2786d8b441a3SJan Beulich} 2787d8b441a3SJan BeulichEOF 2788d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2789d8b441a3SJan Beulich then 2790f1167ee6SJuergen Gross xen_ctrl_version=40600 27911badb709SPaolo Bonzini xen=enabled 2792d8b441a3SJan Beulich 2793d8b441a3SJan Beulich # Xen 4.5 2794d8b441a3SJan Beulich elif 2795d8b441a3SJan Beulich cat > $TMPC <<EOF && 2796d8b441a3SJan Beulich#include <xenctrl.h> 2797d8b441a3SJan Beulich#include <xenstore.h> 2798d8b441a3SJan Beulich#include <stdint.h> 2799d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2800d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2801d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2802d8b441a3SJan Beulich#endif 2803d8b441a3SJan Beulichint main(void) { 2804d8b441a3SJan Beulich xc_interface *xc; 2805d8b441a3SJan Beulich xs_daemon_open(); 2806d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2807d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2808d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2809d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2810d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 28113996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 28123996e85cSPaul Durrant return 0; 28133996e85cSPaul Durrant} 28143996e85cSPaul DurrantEOF 28153996e85cSPaul Durrant compile_prog "" "$xen_libs" 28163996e85cSPaul Durrant then 2817f1167ee6SJuergen Gross xen_ctrl_version=40500 28181badb709SPaolo Bonzini xen=enabled 28193996e85cSPaul Durrant 28203996e85cSPaul Durrant elif 28213996e85cSPaul Durrant cat > $TMPC <<EOF && 28223996e85cSPaul Durrant#include <xenctrl.h> 28233996e85cSPaul Durrant#include <xenstore.h> 28243996e85cSPaul Durrant#include <stdint.h> 28253996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 28263996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 28273996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 28283996e85cSPaul Durrant#endif 28293996e85cSPaul Durrantint main(void) { 28303996e85cSPaul Durrant xc_interface *xc; 28313996e85cSPaul Durrant xs_daemon_open(); 28323996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 28333996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 28343996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 28353996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 28363996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 28378688e065SStefano Stabellini return 0; 28388688e065SStefano Stabellini} 28398688e065SStefano StabelliniEOF 28408688e065SStefano Stabellini compile_prog "" "$xen_libs" 284169deef08SPeter Maydell then 2842f1167ee6SJuergen Gross xen_ctrl_version=40200 28431badb709SPaolo Bonzini xen=enabled 28448688e065SStefano Stabellini 2845e37630caSaliguori else 28461badb709SPaolo Bonzini if test "$xen" = "enabled" ; then 2847edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2848edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2849fc321b4bSJuan Quintela fi 28501badb709SPaolo Bonzini xen=disabled 2851e37630caSaliguori fi 2852d5b93ddfSAnthony PERARD 28531badb709SPaolo Bonzini if test "$xen" = enabled; then 2854f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 2855582ea95fSMarc-André Lureau xen_libs="$xen_libs $xen_stable_libs " 28565eeb39c2SIan Campbell fi 2857d5b93ddfSAnthony PERARD fi 2858e37630caSaliguori fi 2859c1cdd9d5SJuergen Grossfi 2860e37630caSaliguori 28611badb709SPaolo Bonziniif test "$xen_pci_passthrough" != "disabled"; then 28621badb709SPaolo Bonzini if test "$xen" = "enabled" && test "$linux" = "yes"; then 28631badb709SPaolo Bonzini xen_pci_passthrough=enabled 2864eb6fda0fSAnthony PERARD else 28651badb709SPaolo Bonzini if test "$xen_pci_passthrough" = "enabled"; then 286676ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 286776ad07a4SPeter Maydell " but this feature requires /sys from Linux" 2868eb6fda0fSAnthony PERARD fi 28691badb709SPaolo Bonzini xen_pci_passthrough=disabled 2870d661d9a4SJustin Terry (VM) fi 2871d661d9a4SJustin Terry (VM)fi 2872d661d9a4SJustin Terry (VM) 2873d661d9a4SJustin Terry (VM)########################################## 2874e8f3bd71SMarc-André Lureau# gettext probe 2875e8f3bd71SMarc-André Lureauif test "$gettext" != "false" ; then 2876e8f3bd71SMarc-André Lureau if has xgettext; then 2877e8f3bd71SMarc-André Lureau gettext=true 2878e8f3bd71SMarc-André Lureau else 2879e8f3bd71SMarc-André Lureau if test "$gettext" = "true" ; then 2880e8f3bd71SMarc-André Lureau feature_not_found "gettext" "Install xgettext binary" 2881e8f3bd71SMarc-André Lureau fi 2882e8f3bd71SMarc-André Lureau gettext=false 2883e8f3bd71SMarc-André Lureau fi 2884e8f3bd71SMarc-André Lureaufi 2885e8f3bd71SMarc-André Lureau 2886e8f3bd71SMarc-André Lureau########################################## 2887f676c67eSJeremy White# X11 probe 2888f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 28898781595bSGerd Hoffmann have_x11=yes 289089138857SStefan Weil x11_cflags=$($pkg_config --cflags x11) 289189138857SStefan Weil x11_libs=$($pkg_config --libs x11) 2892f676c67eSJeremy Whitefi 2893f676c67eSJeremy White 2894f676c67eSJeremy White########################################## 2895a4ccabcfSAnthony Liguori# GTK probe 2896a4ccabcfSAnthony Liguori 28975a464e6cSPeter Xuif test "$gtk" != "no"; then 289889d85cdeSDaniel P. Berrangé gtkpackage="gtk+-3.0" 289989d85cdeSDaniel P. Berrangé gtkx11package="gtk+-x11-3.0" 29007b23d121SVolker Rümelin gtkversion="3.22.0" 2901bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 290289138857SStefan Weil gtk_cflags=$($pkg_config --cflags $gtkpackage) 290389138857SStefan Weil gtk_libs=$($pkg_config --libs $gtkpackage) 290489138857SStefan Weil gtk_version=$($pkg_config --modversion $gtkpackage) 29050a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 29068781595bSGerd Hoffmann need_x11=yes 2907f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 2908f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 29090a337ed0SGerd Hoffmann fi 2910bbbf9bfbSStefan Weil gtk="yes" 2911bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 29125fe309ffSGerd Hoffmann feature_not_found "gtk" "Install gtk3-devel" 2913bbbf9bfbSStefan Weil else 2914bbbf9bfbSStefan Weil gtk="no" 2915bbbf9bfbSStefan Weil fi 2916bbbf9bfbSStefan Weilfi 2917bbbf9bfbSStefan Weil 2918ddbb0d09SDaniel P. Berrange 2919ddbb0d09SDaniel P. Berrange########################################## 2920ddbb0d09SDaniel P. Berrange# GNUTLS probe 2921ddbb0d09SDaniel P. Berrange 2922ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 2923a73e82efSRichard Henderson pass="no" 2924a0722409SDaniel P. Berrangé if $pkg_config --exists "gnutls >= 3.1.18"; then 292589138857SStefan Weil gnutls_cflags=$($pkg_config --cflags gnutls) 292689138857SStefan Weil gnutls_libs=$($pkg_config --libs gnutls) 2927a73e82efSRichard Henderson # Packaging for the static libraries is not always correct. 2928a73e82efSRichard Henderson # At least ubuntu 18.04 ships only shared libraries. 2929a73e82efSRichard Henderson write_c_skeleton 2930a73e82efSRichard Henderson if compile_prog "" "$gnutls_libs" ; then 2931a73e82efSRichard Henderson pass="yes" 2932a73e82efSRichard Henderson fi 2933a73e82efSRichard Henderson fi 2934a73e82efSRichard Henderson if test "$pass" = "no" && test "$gnutls" = "yes"; then 2935a0722409SDaniel P. Berrangé feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 2936ddbb0d09SDaniel P. Berrange else 2937a73e82efSRichard Henderson gnutls="$pass" 2938ddbb0d09SDaniel P. Berrange fi 2939ddbb0d09SDaniel P. Berrangefi 2940ddbb0d09SDaniel P. Berrange 294191bfcdb0SDaniel P. Berrange 294291bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 294391bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 2944a0722409SDaniel P. Berrangé# explicitly 294591bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 294691bfcdb0SDaniel P. Berrangethen 2947a0722409SDaniel P. Berrangé if test "$nettle" = "yes" 294891bfcdb0SDaniel P. Berrange then 294991bfcdb0SDaniel P. Berrange gcrypt="no" 295091bfcdb0SDaniel P. Berrange fi 295191bfcdb0SDaniel P. Berrangefi 295291bfcdb0SDaniel P. Berrange 295391bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 295491bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 2955a0722409SDaniel P. Berrangé# explicitly 295691bfcdb0SDaniel P. Berrangeif test -z "$nettle" 295791bfcdb0SDaniel P. Berrangethen 2958a0722409SDaniel P. Berrangé if test "$gcrypt" = "yes" 295991bfcdb0SDaniel P. Berrange then 296091bfcdb0SDaniel P. Berrange nettle="no" 296191bfcdb0SDaniel P. Berrange fi 296291bfcdb0SDaniel P. Berrangefi 296391bfcdb0SDaniel P. Berrange 2964dea7a64eSDaniel P. Berrangéhas_libgcrypt() { 296591bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 296691bfcdb0SDaniel P. Berrange then 296791bfcdb0SDaniel P. Berrange return 1 296891bfcdb0SDaniel P. Berrange fi 296991bfcdb0SDaniel P. Berrange 297091bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 297191bfcdb0SDaniel P. Berrange then 297289138857SStefan Weil host=$(libgcrypt-config --host) 297391bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 297491bfcdb0SDaniel P. Berrange then 297591bfcdb0SDaniel P. Berrange return 1 297691bfcdb0SDaniel P. Berrange fi 297791bfcdb0SDaniel P. Berrange fi 297891bfcdb0SDaniel P. Berrange 2979dea7a64eSDaniel P. Berrangé maj=`libgcrypt-config --version | awk -F . '{print $1}'` 2980dea7a64eSDaniel P. Berrangé min=`libgcrypt-config --version | awk -F . '{print $2}'` 2981dea7a64eSDaniel P. Berrangé 2982dea7a64eSDaniel P. Berrangé if test $maj != 1 || test $min -lt 5 2983dea7a64eSDaniel P. Berrangé then 2984dea7a64eSDaniel P. Berrangé return 1 2985dea7a64eSDaniel P. Berrangé fi 2986dea7a64eSDaniel P. Berrangé 298791bfcdb0SDaniel P. Berrange return 0 298891bfcdb0SDaniel P. Berrange} 298991bfcdb0SDaniel P. Berrange 2990a0722409SDaniel P. Berrangé 2991a0722409SDaniel P. Berrangéif test "$nettle" != "no"; then 2992a73e82efSRichard Henderson pass="no" 299364dd2f3bSDaniel P. Berrangé if $pkg_config --exists "nettle >= 2.7.1"; then 2994a0722409SDaniel P. Berrangé nettle_cflags=$($pkg_config --cflags nettle) 2995a0722409SDaniel P. Berrangé nettle_libs=$($pkg_config --libs nettle) 2996a0722409SDaniel P. Berrangé nettle_version=$($pkg_config --modversion nettle) 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 "" "$nettle_libs" ; then 3000a0722409SDaniel P. Berrangé if test -z "$gcrypt"; then 3001a0722409SDaniel P. Berrangé gcrypt="no" 3002a0722409SDaniel P. Berrangé fi 3003a73e82efSRichard Henderson pass="yes" 3004a73e82efSRichard Henderson fi 3005a73e82efSRichard Henderson fi 3006dc2207afSDaniel P. Berrangé if test "$pass" = "yes" 3007dc2207afSDaniel P. Berrangé then 3008dc2207afSDaniel P. Berrangé cat > $TMPC << EOF 3009dc2207afSDaniel P. Berrangé#include <nettle/xts.h> 3010dc2207afSDaniel P. Berrangéint main(void) { 3011dc2207afSDaniel P. Berrangé return 0; 3012dc2207afSDaniel P. Berrangé} 3013dc2207afSDaniel P. BerrangéEOF 3014dc2207afSDaniel P. Berrangé if compile_prog "$nettle_cflags" "$nettle_libs" ; then 3015dc2207afSDaniel P. Berrangé nettle_xts=yes 3016dc2207afSDaniel P. Berrangé qemu_private_xts=no 3017dc2207afSDaniel P. Berrangé fi 3018dc2207afSDaniel P. Berrangé fi 3019a73e82efSRichard Henderson if test "$pass" = "no" && test "$nettle" = "yes"; then 302064dd2f3bSDaniel P. Berrangé feature_not_found "nettle" "Install nettle devel >= 2.7.1" 3021a0722409SDaniel P. Berrangé else 3022a73e82efSRichard Henderson nettle="$pass" 3023a0722409SDaniel P. Berrangé fi 3024a0722409SDaniel P. Berrangéfi 3025a0722409SDaniel P. Berrangé 302691bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 3027a73e82efSRichard Henderson pass="no" 3028dea7a64eSDaniel P. Berrangé if has_libgcrypt; then 302989138857SStefan Weil gcrypt_cflags=$(libgcrypt-config --cflags) 303089138857SStefan Weil gcrypt_libs=$(libgcrypt-config --libs) 3031a73e82efSRichard Henderson # Debian has removed -lgpg-error from libgcrypt-config 303291bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 303391bfcdb0SDaniel P. Berrange # turn breaks static builds... 303491bfcdb0SDaniel P. Berrange if test "$static" = "yes" 303591bfcdb0SDaniel P. Berrange then 303691bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 303791bfcdb0SDaniel P. Berrange fi 30381f923c70SLongpeng(Mike) 3039a73e82efSRichard Henderson # Link test to make sure the given libraries work (e.g for static). 3040a73e82efSRichard Henderson write_c_skeleton 3041a73e82efSRichard Henderson if compile_prog "" "$gcrypt_libs" ; then 3042a73e82efSRichard Henderson pass="yes" 3043a73e82efSRichard Henderson fi 3044a73e82efSRichard Henderson fi 3045a73e82efSRichard Henderson if test "$pass" = "yes"; then 304637788f25SDaniel P. Berrange gcrypt="yes" 30471f923c70SLongpeng(Mike) cat > $TMPC << EOF 30481f923c70SLongpeng(Mike)#include <gcrypt.h> 30491f923c70SLongpeng(Mike)int main(void) { 30501f923c70SLongpeng(Mike) gcry_mac_hd_t handle; 30511f923c70SLongpeng(Mike) gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 30521f923c70SLongpeng(Mike) GCRY_MAC_FLAG_SECURE, NULL); 30531f923c70SLongpeng(Mike) return 0; 30541f923c70SLongpeng(Mike)} 30551f923c70SLongpeng(Mike)EOF 30561f923c70SLongpeng(Mike) if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 30571f923c70SLongpeng(Mike) gcrypt_hmac=yes 30581f923c70SLongpeng(Mike) fi 3059e0576942SDaniel P. Berrangé cat > $TMPC << EOF 3060e0576942SDaniel P. Berrangé#include <gcrypt.h> 3061e0576942SDaniel P. Berrangéint main(void) { 3062e0576942SDaniel P. Berrangé gcry_cipher_hd_t handle; 3063e0576942SDaniel P. Berrangé gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); 3064e0576942SDaniel P. Berrangé return 0; 3065e0576942SDaniel P. Berrangé} 3066e0576942SDaniel P. BerrangéEOF 3067e0576942SDaniel P. Berrangé if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3068e0576942SDaniel P. Berrangé gcrypt_xts=yes 3069e0576942SDaniel P. Berrangé qemu_private_xts=no 3070e0576942SDaniel P. Berrangé fi 3071a73e82efSRichard Henderson elif test "$gcrypt" = "yes"; then 3072dea7a64eSDaniel P. Berrangé feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 307391bfcdb0SDaniel P. Berrange else 307491bfcdb0SDaniel P. Berrange gcrypt="no" 307591bfcdb0SDaniel P. Berrange fi 307662893b67SDaniel P. Berrangefi 307762893b67SDaniel P. Berrange 3078ddbb0d09SDaniel P. Berrange 307991bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 308091bfcdb0SDaniel P. Berrangethen 308191bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 308291bfcdb0SDaniel P. Berrangefi 3083ed754746SDaniel P. Berrange 30849a2fd434SDaniel P. Berrange########################################## 30859a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 30869a2fd434SDaniel P. Berrange 30879a2fd434SDaniel P. Berrangetasn1=yes 308890246037SDaniel P. Berrangetasn1_cflags="" 308990246037SDaniel P. Berrangetasn1_libs="" 30909a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 309189138857SStefan Weil tasn1_cflags=$($pkg_config --cflags libtasn1) 309289138857SStefan Weil tasn1_libs=$($pkg_config --libs libtasn1) 30939a2fd434SDaniel P. Berrangeelse 30949a2fd434SDaniel P. Berrange tasn1=no 30959a2fd434SDaniel P. Berrangefi 30969a2fd434SDaniel P. Berrange 3097ed754746SDaniel P. Berrange 3098bbbf9bfbSStefan Weil########################################## 30998953caf3SDaniel P. Berrange# PAM probe 31008953caf3SDaniel P. Berrange 31018953caf3SDaniel P. Berrangeif test "$auth_pam" != "no"; then 31028953caf3SDaniel P. Berrange cat > $TMPC <<EOF 31038953caf3SDaniel P. Berrange#include <security/pam_appl.h> 31048953caf3SDaniel P. Berrange#include <stdio.h> 31058953caf3SDaniel P. Berrangeint main(void) { 31068953caf3SDaniel P. Berrange const char *service_name = "qemu"; 31078953caf3SDaniel P. Berrange const char *user = "frank"; 31089c9642d0SDr. David Alan Gilbert const struct pam_conv pam_conv = { 0 }; 31098953caf3SDaniel P. Berrange pam_handle_t *pamh = NULL; 31109c9642d0SDr. David Alan Gilbert pam_start(service_name, user, &pam_conv, &pamh); 31118953caf3SDaniel P. Berrange return 0; 31128953caf3SDaniel P. Berrange} 31138953caf3SDaniel P. BerrangeEOF 31148953caf3SDaniel P. Berrange if compile_prog "" "-lpam" ; then 31158953caf3SDaniel P. Berrange auth_pam=yes 31168953caf3SDaniel P. Berrange else 31178953caf3SDaniel P. Berrange if test "$auth_pam" = "yes"; then 31188953caf3SDaniel P. Berrange feature_not_found "PAM" "Install PAM development package" 31198953caf3SDaniel P. Berrange else 31208953caf3SDaniel P. Berrange auth_pam=no 31218953caf3SDaniel P. Berrange fi 31228953caf3SDaniel P. Berrange fi 31238953caf3SDaniel P. Berrangefi 31248953caf3SDaniel P. Berrange 31258953caf3SDaniel P. Berrange########################################## 3126559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 3127559607eaSDaniel P. Berrange 3128559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 3129559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 3130559607eaSDaniel P. Berrange have_ifaddrs_h=no 3131559607eaSDaniel P. Berrangefi 3132559607eaSDaniel P. Berrange 3133e865b97fSChen Gang######################################### 3134e865b97fSChen Gang# libdrm check 3135e865b97fSChen Ganghave_drm_h=no 3136e865b97fSChen Gangif check_include "libdrm/drm.h" ; then 3137e865b97fSChen Gang have_drm_h=yes 3138e865b97fSChen Gangfi 3139e865b97fSChen Gang 31402a4b472cSDavid CARLIER######################################### 31412a4b472cSDavid CARLIER# sys/signal.h check 31422a4b472cSDavid CARLIERhave_sys_signal_h=no 31432a4b472cSDavid CARLIERif check_include "sys/signal.h" ; then 31442a4b472cSDavid CARLIER have_sys_signal_h=yes 31452a4b472cSDavid CARLIERfi 31462a4b472cSDavid CARLIER 3147559607eaSDaniel P. Berrange########################################## 3148bbbf9bfbSStefan Weil# VTE probe 3149bbbf9bfbSStefan Weil 3150bbbf9bfbSStefan Weilif test "$vte" != "no"; then 3151c6feff9eSCole Robinson vteminversion="0.32.0" 3152c6feff9eSCole Robinson if $pkg_config --exists "vte-2.91"; then 3153c6feff9eSCole Robinson vtepackage="vte-2.91" 3154c6feff9eSCole Robinson else 3155528de90aSDaniel P. Berrange vtepackage="vte-2.90" 3156c6feff9eSCole Robinson fi 3157c6feff9eSCole Robinson if $pkg_config --exists "$vtepackage >= $vteminversion"; then 315889138857SStefan Weil vte_cflags=$($pkg_config --cflags $vtepackage) 315989138857SStefan Weil vte_libs=$($pkg_config --libs $vtepackage) 316089138857SStefan Weil vteversion=$($pkg_config --modversion $vtepackage) 3161bbbf9bfbSStefan Weil vte="yes" 3162bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 3163c6feff9eSCole Robinson feature_not_found "vte" "Install libvte-2.90/2.91 devel" 31649e04c683SStefan Weil else 3165bbbf9bfbSStefan Weil vte="no" 3166a4ccabcfSAnthony Liguori fi 3167a4ccabcfSAnthony Liguorifi 3168a4ccabcfSAnthony Liguori 3169a4ccabcfSAnthony Liguori########################################## 31702da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 31712da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 31722da776dbSMichael R. Hines cat > $TMPC <<EOF 31732da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 31742da776dbSMichael R. Hinesint main(void) { return 0; } 31752da776dbSMichael R. HinesEOF 3176ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 31772da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 31782da776dbSMichael R. Hines rdma="yes" 31792da776dbSMichael R. Hines else 31802da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 31812da776dbSMichael R. Hines error_exit \ 3182ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 31832da776dbSMichael R. Hines " Your options:" \ 3184ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 31852da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 31862da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 31872da776dbSMichael R. Hines fi 31882da776dbSMichael R. Hines rdma="no" 31892da776dbSMichael R. Hines fi 31902da776dbSMichael R. Hinesfi 31912da776dbSMichael R. Hines 319221ab34c9SMarcel Apfelbaum########################################## 319321ab34c9SMarcel Apfelbaum# PVRDMA detection 319421ab34c9SMarcel Apfelbaum 319521ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 319621ab34c9SMarcel Apfelbaum#include <sys/mman.h> 319721ab34c9SMarcel Apfelbaum 319821ab34c9SMarcel Apfelbaumint 319921ab34c9SMarcel Apfelbaummain(void) 320021ab34c9SMarcel Apfelbaum{ 320121ab34c9SMarcel Apfelbaum char buf = 0; 320221ab34c9SMarcel Apfelbaum void *addr = &buf; 320321ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 320421ab34c9SMarcel Apfelbaum 320521ab34c9SMarcel Apfelbaum return 0; 320621ab34c9SMarcel Apfelbaum} 320721ab34c9SMarcel ApfelbaumEOF 320821ab34c9SMarcel Apfelbaum 320921ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 321021ab34c9SMarcel Apfelbaum case "$pvrdma" in 321121ab34c9SMarcel Apfelbaum "") 321221ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 321321ab34c9SMarcel Apfelbaum pvrdma="yes" 321421ab34c9SMarcel Apfelbaum else 321521ab34c9SMarcel Apfelbaum pvrdma="no" 321621ab34c9SMarcel Apfelbaum fi 321721ab34c9SMarcel Apfelbaum ;; 321821ab34c9SMarcel Apfelbaum "yes") 321921ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 322021ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 322121ab34c9SMarcel Apfelbaum fi 322221ab34c9SMarcel Apfelbaum pvrdma="yes" 322321ab34c9SMarcel Apfelbaum ;; 322421ab34c9SMarcel Apfelbaum "no") 322521ab34c9SMarcel Apfelbaum pvrdma="no" 322621ab34c9SMarcel Apfelbaum ;; 322721ab34c9SMarcel Apfelbaum esac 322821ab34c9SMarcel Apfelbaumelse 322921ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 323021ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 323121ab34c9SMarcel Apfelbaum fi 323221ab34c9SMarcel Apfelbaum pvrdma="no" 323321ab34c9SMarcel Apfelbaumfi 323495c6bff3SBenoît Canet 3235ee108585SYuval Shaia# Let's see if enhanced reg_mr is supported 3236ee108585SYuval Shaiaif test "$pvrdma" = "yes" ; then 3237ee108585SYuval Shaia 3238ee108585SYuval Shaiacat > $TMPC <<EOF && 3239ee108585SYuval Shaia#include <infiniband/verbs.h> 3240ee108585SYuval Shaia 3241ee108585SYuval Shaiaint 3242ee108585SYuval Shaiamain(void) 3243ee108585SYuval Shaia{ 3244ee108585SYuval Shaia struct ibv_mr *mr; 3245ee108585SYuval Shaia struct ibv_pd *pd = NULL; 3246ee108585SYuval Shaia size_t length = 10; 3247ee108585SYuval Shaia uint64_t iova = 0; 3248ee108585SYuval Shaia int access = 0; 3249ee108585SYuval Shaia void *addr = NULL; 3250ee108585SYuval Shaia 3251ee108585SYuval Shaia mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 3252ee108585SYuval Shaia 3253ee108585SYuval Shaia ibv_dereg_mr(mr); 3254ee108585SYuval Shaia 3255ee108585SYuval Shaia return 0; 3256ee108585SYuval Shaia} 3257ee108585SYuval ShaiaEOF 3258ee108585SYuval Shaia if ! compile_prog "" "-libverbs"; then 3259ee108585SYuval Shaia QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 3260ee108585SYuval Shaia fi 3261ee108585SYuval Shaiafi 3262ee108585SYuval Shaia 326395c6bff3SBenoît Canet########################################## 3264c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 3265dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 3266dce512deSChristoph Hellwig cat > $TMPC << EOF 3267ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 3268dce512deSChristoph Hellwig#include <xfs/xfs.h> 3269dce512deSChristoph Hellwigint main(void) 3270dce512deSChristoph Hellwig{ 3271dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 3272dce512deSChristoph Hellwig return 0; 3273dce512deSChristoph Hellwig} 3274dce512deSChristoph HellwigEOF 3275dce512deSChristoph Hellwig if compile_prog "" "" ; then 3276dce512deSChristoph Hellwig xfs="yes" 3277dce512deSChristoph Hellwig else 3278dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 3279e3a6e0daSzhaolichang feature_not_found "xfs" "Install xfsprogs/xfslibs devel" 3280dce512deSChristoph Hellwig fi 3281dce512deSChristoph Hellwig xfs=no 3282dce512deSChristoph Hellwig fi 3283dce512deSChristoph Hellwigfi 3284dce512deSChristoph Hellwig 3285dce512deSChristoph Hellwig########################################## 32868a16d273Sths# vde libraries probe 3287dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 32884baae0acSJuan Quintela vde_libs="-lvdeplug" 32898a16d273Sths cat > $TMPC << EOF 32908a16d273Sths#include <libvdeplug.h> 32914a7f0e06Spbrookint main(void) 32924a7f0e06Spbrook{ 32934a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 3294fea08e08SPeter Maydell char s[] = ""; 3295fea08e08SPeter Maydell vde_open(s, s, &a); 32964a7f0e06Spbrook return 0; 32974a7f0e06Spbrook} 32988a16d273SthsEOF 329952166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 33004baae0acSJuan Quintela vde=yes 3301dfb278bdSJuan Quintela else 3302dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 330321684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3304dfb278bdSJuan Quintela fi 3305dfb278bdSJuan Quintela vde=no 33068a16d273Sths fi 33078a16d273Sthsfi 33088a16d273Sths 33098a16d273Sths########################################## 33100a985b37SVincenzo Maffione# netmap support probe 33110a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 33120a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 33130a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 33140a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 33150a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 331658952137SVincenzo Maffioneif test "$netmap" != "no" ; then 331758952137SVincenzo Maffione cat > $TMPC << EOF 331858952137SVincenzo Maffione#include <inttypes.h> 331958952137SVincenzo Maffione#include <net/if.h> 332058952137SVincenzo Maffione#include <net/netmap.h> 332158952137SVincenzo Maffione#include <net/netmap_user.h> 33220a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 33230a985b37SVincenzo Maffione#error 33240a985b37SVincenzo Maffione#endif 332558952137SVincenzo Maffioneint main(void) { return 0; } 332658952137SVincenzo MaffioneEOF 332758952137SVincenzo Maffione if compile_prog "" "" ; then 332858952137SVincenzo Maffione netmap=yes 332958952137SVincenzo Maffione else 333058952137SVincenzo Maffione if test "$netmap" = "yes" ; then 333158952137SVincenzo Maffione feature_not_found "netmap" 333258952137SVincenzo Maffione fi 333358952137SVincenzo Maffione netmap=no 333458952137SVincenzo Maffione fi 333558952137SVincenzo Maffionefi 333658952137SVincenzo Maffione 333758952137SVincenzo Maffione########################################## 333847e98658SCorey Bryant# libcap-ng library probe 333947e98658SCorey Bryantif test "$cap_ng" != "no" ; then 334047e98658SCorey Bryant cap_libs="-lcap-ng" 334147e98658SCorey Bryant cat > $TMPC << EOF 334247e98658SCorey Bryant#include <cap-ng.h> 334347e98658SCorey Bryantint main(void) 334447e98658SCorey Bryant{ 334547e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 334647e98658SCorey Bryant return 0; 334747e98658SCorey Bryant} 334847e98658SCorey BryantEOF 334947e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 335047e98658SCorey Bryant cap_ng=yes 335147e98658SCorey Bryant else 335247e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 335321684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 335447e98658SCorey Bryant fi 335547e98658SCorey Bryant cap_ng=no 335647e98658SCorey Bryant fi 335747e98658SCorey Bryantfi 335847e98658SCorey Bryant 335947e98658SCorey Bryant########################################## 3360c2de5c91Smalc# Sound support libraries probe 33618f28f3fbSths 336289138857SStefan Weilaudio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3363c2de5c91Smalcfor drv in $audio_drv_list; do 3364c2de5c91Smalc case $drv in 3365e42975a1SGerd Hoffmann alsa | try-alsa) 3366c80a867fSGerd Hoffmann if $pkg_config alsa --exists; then 3367c80a867fSGerd Hoffmann alsa_libs=$($pkg_config alsa --libs) 3368478e943fSPaolo Bonzini alsa_cflags=$($pkg_config alsa --cflags) 3369478e943fSPaolo Bonzini alsa=yes 3370e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3371e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') 3372e42975a1SGerd Hoffmann fi 3373e42975a1SGerd Hoffmann else 3374e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3375e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') 3376c80a867fSGerd Hoffmann else 3377c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3378c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3379c80a867fSGerd Hoffmann fi 3380e42975a1SGerd Hoffmann fi 3381c2de5c91Smalc ;; 3382c2de5c91Smalc 3383e42975a1SGerd Hoffmann pa | try-pa) 3384c80a867fSGerd Hoffmann if $pkg_config libpulse --exists; then 3385478e943fSPaolo Bonzini libpulse=yes 3386c80a867fSGerd Hoffmann pulse_libs=$($pkg_config libpulse --libs) 3387478e943fSPaolo Bonzini pulse_cflags=$($pkg_config libpulse --cflags) 3388e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3389e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') 3390e42975a1SGerd Hoffmann fi 3391e42975a1SGerd Hoffmann else 3392e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3393e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') 3394c80a867fSGerd Hoffmann else 3395c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3396c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3397c80a867fSGerd Hoffmann fi 3398e42975a1SGerd Hoffmann fi 3399b8e59f18Smalc ;; 3400b8e59f18Smalc 3401373967b2SGerd Hoffmann sdl) 3402373967b2SGerd Hoffmann if test "$sdl" = "no"; then 3403373967b2SGerd Hoffmann error_exit "sdl not found or disabled, can not use sdl audio driver" 3404373967b2SGerd Hoffmann fi 3405373967b2SGerd Hoffmann ;; 3406373967b2SGerd Hoffmann 3407e42975a1SGerd Hoffmann try-sdl) 3408e42975a1SGerd Hoffmann if test "$sdl" = "no"; then 3409e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') 3410e42975a1SGerd Hoffmann else 3411e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') 3412e42975a1SGerd Hoffmann fi 3413e42975a1SGerd Hoffmann ;; 3414e42975a1SGerd Hoffmann 3415997e690aSJuan Quintela coreaudio) 3416b1149911SFam Zheng coreaudio_libs="-framework CoreAudio" 3417997e690aSJuan Quintela ;; 3418997e690aSJuan Quintela 3419a4bf6780SJuan Quintela dsound) 3420b1149911SFam Zheng dsound_libs="-lole32 -ldxguid" 3421d5631638Smalc audio_win_int="yes" 3422a4bf6780SJuan Quintela ;; 3423a4bf6780SJuan Quintela 3424a4bf6780SJuan Quintela oss) 3425b1149911SFam Zheng oss_libs="$oss_lib" 3426a4bf6780SJuan Quintela ;; 3427a4bf6780SJuan Quintela 34282e445703SGeoffrey McRae jack | try-jack) 34292e445703SGeoffrey McRae if $pkg_config jack --exists; then 3430478e943fSPaolo Bonzini libjack=yes 34312e445703SGeoffrey McRae jack_libs=$($pkg_config jack --libs) 34322e445703SGeoffrey McRae if test "$drv" = "try-jack"; then 34332e445703SGeoffrey McRae audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') 34342e445703SGeoffrey McRae fi 34352e445703SGeoffrey McRae else 34362e445703SGeoffrey McRae if test "$drv" = "try-jack"; then 34372e445703SGeoffrey McRae audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') 34382e445703SGeoffrey McRae else 34392e445703SGeoffrey McRae error_exit "$drv check failed" \ 34402e445703SGeoffrey McRae "Make sure to have the $drv libs and headers installed." 34412e445703SGeoffrey McRae fi 34422e445703SGeoffrey McRae fi 34432e445703SGeoffrey McRae ;; 34442e445703SGeoffrey McRae 3445e4c63a6aSmalc *) 34461c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 344776ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 344876ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 3449e4c63a6aSmalc } 3450e4c63a6aSmalc ;; 3451c2de5c91Smalc esac 3452c2de5c91Smalcdone 34538f28f3fbSths 34544d3b6f6eSbalrog########################################## 34552e4d9fb1Saurel32# BrlAPI probe 34562e4d9fb1Saurel32 34574ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 3458eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 34592e4d9fb1Saurel32 cat > $TMPC << EOF 34602e4d9fb1Saurel32#include <brlapi.h> 3461832ce9c2SScott Wood#include <stddef.h> 34622e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 34632e4d9fb1Saurel32EOF 346452166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 34652e4d9fb1Saurel32 brlapi=yes 34664ffcedb6SJuan Quintela else 34674ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 346821684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 34694ffcedb6SJuan Quintela fi 34704ffcedb6SJuan Quintela brlapi=no 3471eb82284fSJuan Quintela fi 3472eb82284fSJuan Quintelafi 34732e4d9fb1Saurel32 34742e4d9fb1Saurel32########################################## 3475e08bb301SSamuel Thibault# iconv probe 3476e08bb301SSamuel Thibaultif test "$iconv" != "no" ; then 3477e08bb301SSamuel Thibault cat > $TMPC << EOF 3478e08bb301SSamuel Thibault#include <iconv.h> 3479e08bb301SSamuel Thibaultint main(void) { 3480e08bb301SSamuel Thibault iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); 3481e08bb301SSamuel Thibault return conv != (iconv_t) -1; 3482e08bb301SSamuel Thibault} 3483e08bb301SSamuel ThibaultEOF 3484e08bb301SSamuel Thibault iconv_prefix_list="/usr/local:/usr" 3485e08bb301SSamuel Thibault iconv_lib_list=":-liconv" 3486e08bb301SSamuel Thibault IFS=: 3487e08bb301SSamuel Thibault for iconv_prefix in $iconv_prefix_list; do 3488e08bb301SSamuel Thibault IFS=: 3489e08bb301SSamuel Thibault iconv_cflags="-I$iconv_prefix/include" 3490e08bb301SSamuel Thibault iconv_ldflags="-L$iconv_prefix/lib" 3491e08bb301SSamuel Thibault for iconv_link in $iconv_lib_list; do 3492e08bb301SSamuel Thibault unset IFS 3493e08bb301SSamuel Thibault iconv_lib="$iconv_ldflags $iconv_link" 3494e08bb301SSamuel Thibault echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log 3495e08bb301SSamuel Thibault if compile_prog "$iconv_cflags" "$iconv_lib" ; then 3496e08bb301SSamuel Thibault iconv_found=yes 3497e08bb301SSamuel Thibault break 3498e08bb301SSamuel Thibault fi 3499e08bb301SSamuel Thibault done 3500e08bb301SSamuel Thibault if test "$iconv_found" = yes ; then 3501e08bb301SSamuel Thibault break 3502e08bb301SSamuel Thibault fi 3503e08bb301SSamuel Thibault done 3504e08bb301SSamuel Thibault if test "$iconv_found" = "yes" ; then 3505e08bb301SSamuel Thibault iconv=yes 3506e08bb301SSamuel Thibault else 3507e08bb301SSamuel Thibault if test "$iconv" = "yes" ; then 3508e08bb301SSamuel Thibault feature_not_found "iconv" "Install iconv devel" 3509e08bb301SSamuel Thibault fi 3510e08bb301SSamuel Thibault iconv=no 3511e08bb301SSamuel Thibault fi 3512e08bb301SSamuel Thibaultfi 3513e08bb301SSamuel Thibault 3514e08bb301SSamuel Thibault########################################## 35154d3b6f6eSbalrog# curses probe 3516e08bb301SSamuel Thibaultif test "$iconv" = "no" ; then 3517e08bb301SSamuel Thibault # curses will need iconv 3518e08bb301SSamuel Thibault curses=no 3519e08bb301SSamuel Thibaultfi 3520a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 3521e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 35228ddc5bf9SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 35238ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3524e095e2f3SStefan Weil else 35257c703002SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 35268ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3527e095e2f3SStefan Weil fi 3528c584a6d0SJuan Quintela curses_found=no 35294d3b6f6eSbalrog cat > $TMPC << EOF 35308ddc5bf9SSamuel Thibault#include <locale.h> 35314d3b6f6eSbalrog#include <curses.h> 35328ddc5bf9SSamuel Thibault#include <wchar.h> 35332f8b7cd5SSamuel Thibault#include <langinfo.h> 3534ef9a2524SStefan Weilint main(void) { 35352f8b7cd5SSamuel Thibault const char *codeset; 35368ddc5bf9SSamuel Thibault wchar_t wch = L'w'; 35378ddc5bf9SSamuel Thibault setlocale(LC_ALL, ""); 3538ef9a2524SStefan Weil resize_term(0, 0); 35398ddc5bf9SSamuel Thibault addwstr(L"wide chars\n"); 35408ddc5bf9SSamuel Thibault addnwstr(&wch, 1); 35417c703002SSamuel Thibault add_wch(WACS_DEGREE); 35422f8b7cd5SSamuel Thibault codeset = nl_langinfo(CODESET); 35432f8b7cd5SSamuel Thibault return codeset != 0; 3544ef9a2524SStefan Weil} 35454d3b6f6eSbalrogEOF 3546ecbe251fSVadim Evard IFS=: 35478ddc5bf9SSamuel Thibault for curses_inc in $curses_inc_list; do 3548b01a4fd3SPeter Maydell # Make sure we get the wide character prototypes 3549b01a4fd3SPeter Maydell curses_inc="-DNCURSES_WIDECHAR $curses_inc" 35507c703002SSamuel Thibault IFS=: 35518ddc5bf9SSamuel Thibault for curses_lib in $curses_lib_list; do 3552ecbe251fSVadim Evard unset IFS 35538ddc5bf9SSamuel Thibault if compile_prog "$curses_inc" "$curses_lib" ; then 3554c584a6d0SJuan Quintela curses_found=yes 35554f78ef9aSJuan Quintela break 35564d3b6f6eSbalrog fi 35574f78ef9aSJuan Quintela done 35587c703002SSamuel Thibault if test "$curses_found" = yes ; then 35597c703002SSamuel Thibault break 35607c703002SSamuel Thibault fi 35618ddc5bf9SSamuel Thibault done 3562ecbe251fSVadim Evard unset IFS 3563c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 3564c584a6d0SJuan Quintela curses=yes 3565c584a6d0SJuan Quintela else 3566c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 356721684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 3568c584a6d0SJuan Quintela fi 3569c584a6d0SJuan Quintela curses=no 3570c584a6d0SJuan Quintela fi 35714f78ef9aSJuan Quintelafi 35724d3b6f6eSbalrog 3573414f0dabSblueswir1########################################## 3574769ce76dSAlexander Graf# curl probe 3575a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 357665d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 3577a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 35784e2b0658SPaolo Bonzini else 35794e2b0658SPaolo Bonzini curlconfig=curl-config 35804e2b0658SPaolo Bonzini fi 3581769ce76dSAlexander Graf cat > $TMPC << EOF 3582769ce76dSAlexander Graf#include <curl/curl.h> 35830b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3584769ce76dSAlexander GrafEOF 358589138857SStefan Weil curl_cflags=$($curlconfig --cflags 2>/dev/null) 358689138857SStefan Weil curl_libs=$($curlconfig --libs 2>/dev/null) 3587b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 3588769ce76dSAlexander Graf curl=yes 3589788c8196SJuan Quintela else 3590788c8196SJuan Quintela if test "$curl" = "yes" ; then 359121684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 3592788c8196SJuan Quintela fi 3593788c8196SJuan Quintela curl=no 3594769ce76dSAlexander Graf fi 3595769ce76dSAlexander Graffi # test "$curl" 3596769ce76dSAlexander Graf 3597769ce76dSAlexander Graf########################################## 3598e18df141SAnthony Liguori# glib support probe 3599a52d28afSPaolo Bonzini 360000f2cfbbSDaniel P. Berrangéglib_req_ver=2.48 3601aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 3602aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 3603a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 3604aa0d1f44SPaolo Bonzinifi 360554cb65d8SEmilio G. Cotaif test "$plugins" = yes; then 360654cb65d8SEmilio G. Cota glib_modules="$glib_modules gmodule-2.0" 360754cb65d8SEmilio G. Cotafi 3608e26110cfSFam Zheng 3609aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 3610e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 361189138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 361289138857SStefan Weil glib_libs=$($pkg_config --libs $i) 3613e18df141SAnthony Liguori else 3614e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3615e26110cfSFam Zheng fi 3616e26110cfSFam Zhengdone 3617e26110cfSFam Zheng 3618215b0c2fSPaolo Bonzini# This workaround is required due to a bug in pkg-config file for glib as it 3619215b0c2fSPaolo Bonzini# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 3620215b0c2fSPaolo Bonzini 3621215b0c2fSPaolo Bonziniif test "$static" = yes && test "$mingw32" = yes; then 3622215b0c2fSPaolo Bonzini glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags" 3623215b0c2fSPaolo Bonzinifi 3624215b0c2fSPaolo Bonzini 3625f876b765SMarc-André Lureauif $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 3626f876b765SMarc-André Lureau gio=yes 3627f876b765SMarc-André Lureau gio_cflags=$($pkg_config --cflags gio-2.0) 3628f876b765SMarc-André Lureau gio_libs=$($pkg_config --libs gio-2.0) 362925a97a56SMarc-André Lureau gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 36300dba4897SMarc-André Lureau if [ ! -x "$gdbus_codegen" ]; then 36310dba4897SMarc-André Lureau gdbus_codegen= 36320dba4897SMarc-André Lureau fi 3633f876b765SMarc-André Lureauelse 3634f876b765SMarc-André Lureau gio=no 3635f876b765SMarc-André Lureaufi 3636f876b765SMarc-André Lureau 363725a97a56SMarc-André Lureauif $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 363825a97a56SMarc-André Lureau gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 363925a97a56SMarc-André Lureau gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 364025a97a56SMarc-André Lureaufi 364125a97a56SMarc-André Lureau 3642977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 3643977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 3644977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 3645977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 3646977a82abSDaniel P. Berrangecat > $TMPC <<EOF 3647977a82abSDaniel P. Berrange#include <glib.h> 3648977a82abSDaniel P. Berrange#include <unistd.h> 3649977a82abSDaniel P. Berrange 3650977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 3651977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3652977a82abSDaniel P. Berrange 3653977a82abSDaniel P. Berrangeint main(void) { 3654977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3655977a82abSDaniel P. Berrange return 0; 3656977a82abSDaniel P. Berrange} 3657977a82abSDaniel P. BerrangeEOF 3658977a82abSDaniel P. Berrange 3659215b0c2fSPaolo Bonziniif ! compile_prog "$glib_cflags" "$glib_libs" ; then 3660977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3661977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 3662977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 3663977a82abSDaniel P. Berrange "build target" 3664977a82abSDaniel P. Berrangefi 3665977a82abSDaniel P. Berrange 3666bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3667bbbf2e04SJohn Snowcat > $TMPC << EOF 3668bbbf2e04SJohn Snow#include <glib.h> 3669bbbf2e04SJohn Snowint main(void) { return 0; } 3670bbbf2e04SJohn SnowEOF 3671bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3672bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 3673bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 36745770e8afSPaolo Bonzini CONFIGURE_CFLAGS="-Wno-unknown-attributes $CONFIGURE_CFLAGS" 3675bbbf2e04SJohn Snow fi 3676bbbf2e04SJohn Snowfi 3677bbbf2e04SJohn Snow 36789bda600bSEric Blake# Silence clang warnings triggered by glib < 2.57.2 36799bda600bSEric Blakecat > $TMPC << EOF 36809bda600bSEric Blake#include <glib.h> 36819bda600bSEric Blaketypedef struct Foo { 36829bda600bSEric Blake int i; 36839bda600bSEric Blake} Foo; 36849bda600bSEric Blakestatic void foo_free(Foo *f) 36859bda600bSEric Blake{ 36869bda600bSEric Blake g_free(f); 36879bda600bSEric Blake} 36889bda600bSEric BlakeG_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 36899bda600bSEric Blakeint main(void) { return 0; } 36909bda600bSEric BlakeEOF 36919bda600bSEric Blakeif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 36929bda600bSEric Blake if cc_has_warning_flag "-Wno-unused-function"; then 36939bda600bSEric Blake glib_cflags="$glib_cflags -Wno-unused-function" 36945770e8afSPaolo Bonzini CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function" 36959bda600bSEric Blake fi 36969bda600bSEric Blakefi 36979bda600bSEric Blake 3698e26110cfSFam Zheng########################################## 3699e26110cfSFam Zheng# SHA command probe for modules 3700e26110cfSFam Zhengif test "$modules" = yes; then 3701e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 3702e26110cfSFam Zheng for c in $shacmd_probe; do 37038ccefb91SFam Zheng if has $c; then 3704e26110cfSFam Zheng shacmd="$c" 3705e26110cfSFam Zheng break 3706e26110cfSFam Zheng fi 3707e26110cfSFam Zheng done 3708e26110cfSFam Zheng if test "$shacmd" = ""; then 3709e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3710e26110cfSFam Zheng fi 3711e18df141SAnthony Liguorifi 3712e18df141SAnthony Liguori 3713e18df141SAnthony Liguori########################################## 3714e5d355d1Saliguori# pthread probe 37154b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 37163c529d93Saliguori 3717e5d355d1Saliguoripthread=no 3718414f0dabSblueswir1cat > $TMPC << EOF 37193c529d93Saliguori#include <pthread.h> 37207a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 37217a42bbe4SStefan Weilint main(void) { 37227a42bbe4SStefan Weil pthread_t thread; 37237a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 37247a42bbe4SStefan Weil return 0; 37257a42bbe4SStefan Weil} 3726414f0dabSblueswir1EOF 3727bd00d539SAndreas Färberif compile_prog "" "" ; then 3728bd00d539SAndreas Färber pthread=yes 3729bd00d539SAndreas Färberelse 3730de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 373152166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 3732e5d355d1Saliguori pthread=yes 3733e3c56761SPeter Portante found=no 3734e3c56761SPeter Portante for lib_entry in $LIBS; do 3735e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 3736e3c56761SPeter Portante found=yes 3737e3c56761SPeter Portante break 3738e3c56761SPeter Portante fi 3739e3c56761SPeter Portante done 3740e3c56761SPeter Portante if test "$found" = "no"; then 37415572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 3742e3c56761SPeter Portante fi 3743409437e1SDaniel P. Berrange PTHREAD_LIB="$pthread_lib" 3744de65fe0fSSebastian Herbszt break 3745414f0dabSblueswir1 fi 3746de65fe0fSSebastian Herbszt done 3747bd00d539SAndreas Färberfi 3748414f0dabSblueswir1 3749e633a5c6SEric Blakeif test "$mingw32" != yes && test "$pthread" = no; then 375076ad07a4SPeter Maydell error_exit "pthread check failed" \ 375176ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 3752e5d355d1Saliguorifi 3753e5d355d1Saliguori 3754479a5747SRoman Bolshakov# check for pthread_setname_np with thread id 3755479a5747SRoman Bolshakovpthread_setname_np_w_tid=no 37565c312079SDr. David Alan Gilbertcat > $TMPC << EOF 37575c312079SDr. David Alan Gilbert#include <pthread.h> 37585c312079SDr. David Alan Gilbert 37595c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 37605c312079SDr. David Alan Gilbertint main(void) 37615c312079SDr. David Alan Gilbert{ 37625c312079SDr. David Alan Gilbert pthread_t thread; 37635c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 37645c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 37655c312079SDr. David Alan Gilbert return 0; 37665c312079SDr. David Alan Gilbert} 37675c312079SDr. David Alan GilbertEOF 37685c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 3769479a5747SRoman Bolshakov pthread_setname_np_w_tid=yes 3770479a5747SRoman Bolshakovfi 3771479a5747SRoman Bolshakov 3772479a5747SRoman Bolshakov# check for pthread_setname_np without thread id 3773479a5747SRoman Bolshakovpthread_setname_np_wo_tid=no 3774479a5747SRoman Bolshakovcat > $TMPC << EOF 3775479a5747SRoman Bolshakov#include <pthread.h> 3776479a5747SRoman Bolshakov 377712a9b8d8SThomas Huthstatic void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } 3778479a5747SRoman Bolshakovint main(void) 3779479a5747SRoman Bolshakov{ 3780479a5747SRoman Bolshakov pthread_t thread; 3781479a5747SRoman Bolshakov pthread_create(&thread, 0, f, 0); 3782479a5747SRoman Bolshakov return 0; 3783479a5747SRoman Bolshakov} 3784479a5747SRoman BolshakovEOF 3785479a5747SRoman Bolshakovif compile_prog "" "$pthread_lib" ; then 3786479a5747SRoman Bolshakov pthread_setname_np_wo_tid=yes 37875c312079SDr. David Alan Gilbertfi 37885c312079SDr. David Alan Gilbert 3789bf9298b9Saliguori########################################## 3790f27aaf4bSChristian Brunner# rbd probe 3791f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 3792f27aaf4bSChristian Brunner cat > $TMPC <<EOF 3793f27aaf4bSChristian Brunner#include <stdio.h> 3794ad32e9c0SJosh Durgin#include <rbd/librbd.h> 3795f27aaf4bSChristian Brunnerint main(void) { 3796ad32e9c0SJosh Durgin rados_t cluster; 3797ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 3798f27aaf4bSChristian Brunner return 0; 3799f27aaf4bSChristian Brunner} 3800f27aaf4bSChristian BrunnerEOF 3801ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 3802f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 3803f27aaf4bSChristian Brunner rbd=yes 3804f27aaf4bSChristian Brunner else 3805f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 380621684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 3807f27aaf4bSChristian Brunner fi 3808f27aaf4bSChristian Brunner rbd=no 3809f27aaf4bSChristian Brunner fi 3810f27aaf4bSChristian Brunnerfi 3811f27aaf4bSChristian Brunner 3812f27aaf4bSChristian Brunner########################################## 3813b10d49d7SPino Toscano# libssh probe 3814b10d49d7SPino Toscanoif test "$libssh" != "no" ; then 3815b10d49d7SPino Toscano if $pkg_config --exists libssh; then 3816b10d49d7SPino Toscano libssh_cflags=$($pkg_config libssh --cflags) 3817b10d49d7SPino Toscano libssh_libs=$($pkg_config libssh --libs) 3818b10d49d7SPino Toscano libssh=yes 38190a12ec87SRichard W.M. Jones else 3820b10d49d7SPino Toscano if test "$libssh" = "yes" ; then 3821b10d49d7SPino Toscano error_exit "libssh required for --enable-libssh" 38220a12ec87SRichard W.M. Jones fi 3823b10d49d7SPino Toscano libssh=no 38240a12ec87SRichard W.M. Jones fi 38250a12ec87SRichard W.M. Jonesfi 38260a12ec87SRichard W.M. Jones 38270a12ec87SRichard W.M. Jones########################################## 3828b10d49d7SPino Toscano# Check for libssh 0.8 3829b10d49d7SPino Toscano# This is done like this instead of using the LIBSSH_VERSION_* and 3830b10d49d7SPino Toscano# SSH_VERSION_* macros because some distributions in the past shipped 3831b10d49d7SPino Toscano# snapshots of the future 0.8 from Git, and those snapshots did not 3832b10d49d7SPino Toscano# have updated version numbers (still referring to 0.7.0). 38339a2d462eSRichard W.M. Jones 3834b10d49d7SPino Toscanoif test "$libssh" = "yes"; then 38359a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 3836b10d49d7SPino Toscano#include <libssh/libssh.h> 3837b10d49d7SPino Toscanoint main(void) { return ssh_get_server_publickey(NULL, NULL); } 38389a2d462eSRichard W.M. JonesEOF 3839b10d49d7SPino Toscano if compile_prog "$libssh_cflags" "$libssh_libs"; then 3840b10d49d7SPino Toscano libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" 38419a2d462eSRichard W.M. Jones fi 38429a2d462eSRichard W.M. Jonesfi 38439a2d462eSRichard W.M. Jones 38449a2d462eSRichard W.M. Jones########################################## 38455c6c3a6cSChristoph Hellwig# linux-aio probe 38465c6c3a6cSChristoph Hellwig 38475c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 38485c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 38495c6c3a6cSChristoph Hellwig#include <libaio.h> 38505c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 3851832ce9c2SScott Wood#include <stddef.h> 38525c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 38535c6c3a6cSChristoph HellwigEOF 38545c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 38555c6c3a6cSChristoph Hellwig linux_aio=yes 38565c6c3a6cSChristoph Hellwig else 38575c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 385821684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 38595c6c3a6cSChristoph Hellwig fi 38603cfcae3cSLuiz Capitulino linux_aio=no 38615c6c3a6cSChristoph Hellwig fi 38625c6c3a6cSChristoph Hellwigfi 3863c10dd856SAarushi Mehta########################################## 3864c10dd856SAarushi Mehta# linux-io-uring probe 3865c10dd856SAarushi Mehta 3866c10dd856SAarushi Mehtaif test "$linux_io_uring" != "no" ; then 3867c10dd856SAarushi Mehta if $pkg_config liburing; then 3868c10dd856SAarushi Mehta linux_io_uring_cflags=$($pkg_config --cflags liburing) 3869c10dd856SAarushi Mehta linux_io_uring_libs=$($pkg_config --libs liburing) 3870c10dd856SAarushi Mehta linux_io_uring=yes 3871c10dd856SAarushi Mehta else 3872c10dd856SAarushi Mehta if test "$linux_io_uring" = "yes" ; then 3873c10dd856SAarushi Mehta feature_not_found "linux io_uring" "Install liburing devel" 3874c10dd856SAarushi Mehta fi 3875c10dd856SAarushi Mehta linux_io_uring=no 3876c10dd856SAarushi Mehta fi 3877c10dd856SAarushi Mehtafi 38785c6c3a6cSChristoph Hellwig 38795c6c3a6cSChristoph Hellwig########################################## 38807aaa6a16SPaolo Bonzini# TPM emulation is only on POSIX 38813b8acc11SPaolo Bonzini 38827aaa6a16SPaolo Bonziniif test "$tpm" = ""; then 38837aaa6a16SPaolo Bonzini if test "$mingw32" = "yes"; then 38847aaa6a16SPaolo Bonzini tpm=no 38853b8acc11SPaolo Bonzini else 38867aaa6a16SPaolo Bonzini tpm=yes 38877aaa6a16SPaolo Bonzini fi 38887aaa6a16SPaolo Bonzinielif test "$tpm" = "yes"; then 38897aaa6a16SPaolo Bonzini if test "$mingw32" = "yes" ; then 38907aaa6a16SPaolo Bonzini error_exit "TPM emulation only available on POSIX systems" 38917aaa6a16SPaolo Bonzini fi 38923b8acc11SPaolo Bonzinifi 38933b8acc11SPaolo Bonzini 38943b8acc11SPaolo Bonzini########################################## 3895758e8e38SVenkateswararao Jujjuri (JV)# attr probe 3896758e8e38SVenkateswararao Jujjuri (JV) 3897ec0d5893SMarc-André Lureaulibattr_libs= 3898758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 3899758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 3900758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 3901758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 3902f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 3903f2338fb4SPavel Borzenkov#include <attr/xattr.h> 3904f2338fb4SPavel Borzenkov#else 39054f26f2b6SAvi Kivity#include <sys/xattr.h> 3906f2338fb4SPavel Borzenkov#endif 3907758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 3908758e8e38SVenkateswararao Jujjuri (JV)EOF 39094f26f2b6SAvi Kivity if compile_prog "" "" ; then 39104f26f2b6SAvi Kivity attr=yes 39114f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 3912f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 3913758e8e38SVenkateswararao Jujjuri (JV) attr=yes 3914ec0d5893SMarc-André Lureau libattr_libs="-lattr" 39154f26f2b6SAvi Kivity libattr=yes 3916758e8e38SVenkateswararao Jujjuri (JV) else 3917758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 391821684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 3919758e8e38SVenkateswararao Jujjuri (JV) fi 3920758e8e38SVenkateswararao Jujjuri (JV) attr=no 3921758e8e38SVenkateswararao Jujjuri (JV) fi 3922758e8e38SVenkateswararao Jujjuri (JV)fi 3923758e8e38SVenkateswararao Jujjuri (JV) 3924758e8e38SVenkateswararao Jujjuri (JV)########################################## 3925bf9298b9Saliguori# iovec probe 3926bf9298b9Saliguoricat > $TMPC <<EOF 3927db34f0b3Sblueswir1#include <sys/types.h> 3928bf9298b9Saliguori#include <sys/uio.h> 3929db34f0b3Sblueswir1#include <unistd.h> 3930f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 3931bf9298b9SaliguoriEOF 3932bf9298b9Saliguoriiovec=no 393352166aa0SJuan Quintelaif compile_prog "" "" ; then 3934bf9298b9Saliguori iovec=yes 3935bf9298b9Saliguorifi 3936bf9298b9Saliguori 3937f652e6afSaurel32########################################## 3938ceb42de8Saliguori# preadv probe 3939ceb42de8Saliguoricat > $TMPC <<EOF 3940ceb42de8Saliguori#include <sys/types.h> 3941ceb42de8Saliguori#include <sys/uio.h> 3942ceb42de8Saliguori#include <unistd.h> 3943c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 3944ceb42de8SaliguoriEOF 3945ceb42de8Saliguoripreadv=no 394652166aa0SJuan Quintelaif compile_prog "" "" ; then 3947ceb42de8Saliguori preadv=yes 3948ceb42de8Saliguorifi 3949ceb42de8Saliguori 3950ceb42de8Saliguori########################################## 3951f652e6afSaurel32# fdt probe 3952e169e1e1SPeter Maydell 3953fbb4121dSPaolo Bonzinicase "$fdt" in 3954fbb4121dSPaolo Bonzini auto | enabled | internal) 3955fbb4121dSPaolo Bonzini # Simpler to always update submodule, even if not needed. 3956fbb4121dSPaolo Bonzini if test -e "${source_path}/.git" && test $git_update = 'yes' ; then 3957aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 3958aef45d51SDaniel P. Berrange fi 3959fbb4121dSPaolo Bonzini ;; 3960fbb4121dSPaolo Bonziniesac 3961f652e6afSaurel32 396220ff075bSMichael Walle########################################## 3963fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 3964b1546f32SGerd Hoffmann 3965d52c454aSMarc-André Lureaugbm="no" 3966d52c454aSMarc-André Lureauif $pkg_config gbm; then 3967d52c454aSMarc-André Lureau gbm_cflags="$($pkg_config --cflags gbm)" 3968d52c454aSMarc-André Lureau gbm_libs="$($pkg_config --libs gbm)" 3969d52c454aSMarc-André Lureau gbm="yes" 3970d52c454aSMarc-André Lureaufi 3971d52c454aSMarc-André Lureau 3972da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 39734939a1dfSMichael Tokarev opengl_pkgs="epoxy gbm" 39745f9b1e35SGerd Hoffmann if $pkg_config $opengl_pkgs; then 39755f9b1e35SGerd Hoffmann opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 39765f9b1e35SGerd Hoffmann opengl_libs="$($pkg_config --libs $opengl_pkgs)" 3977da076ffeSGerd Hoffmann opengl=yes 3978925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 3979925a0400SGerd Hoffmann gtk_gl="yes" 3980925a0400SGerd Hoffmann fi 398120ff075bSMichael Walle else 3982da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3983dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 398420ff075bSMichael Walle fi 3985f676c67eSJeremy White opengl_cflags="" 3986da076ffeSGerd Hoffmann opengl_libs="" 3987da076ffeSGerd Hoffmann opengl=no 398820ff075bSMichael Walle fi 398920ff075bSMichael Wallefi 399020ff075bSMichael Walle 3991014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 3992014cb152SGerd Hoffmann cat > $TMPC << EOF 3993014cb152SGerd Hoffmann#include <epoxy/egl.h> 3994014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 3995014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 3996014cb152SGerd Hoffmann#endif 3997014cb152SGerd Hoffmannint main(void) { return 0; } 3998014cb152SGerd HoffmannEOF 3999014cb152SGerd Hoffmann if compile_prog "" "" ; then 4000014cb152SGerd Hoffmann opengl_dmabuf=yes 4001014cb152SGerd Hoffmann fi 4002014cb152SGerd Hoffmannfi 4003c9a12e75SChrysostomos Nanakos 4004e633a5c6SEric Blakeif test "$opengl" = "yes" && test "$have_x11" = "yes"; then 400599e1a93bSPhilippe Mathieu-Daudé for target in $target_list; do 400699e1a93bSPhilippe Mathieu-Daudé case $target in 400799e1a93bSPhilippe Mathieu-Daudé lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL 400899e1a93bSPhilippe Mathieu-Daudé need_x11=yes 400999e1a93bSPhilippe Mathieu-Daudé ;; 401099e1a93bSPhilippe Mathieu-Daudé esac 401199e1a93bSPhilippe Mathieu-Daudé done 401299e1a93bSPhilippe Mathieu-Daudéfi 401399e1a93bSPhilippe Mathieu-Daudé 4014ed279a06SKlim Kireev########################################## 4015ed279a06SKlim Kireev# libxml2 probe 4016ed279a06SKlim Kireevif test "$libxml2" != "no" ; then 4017ed279a06SKlim Kireev if $pkg_config --exists libxml-2.0; then 4018ed279a06SKlim Kireev libxml2="yes" 4019ed279a06SKlim Kireev libxml2_cflags=$($pkg_config --cflags libxml-2.0) 4020ed279a06SKlim Kireev libxml2_libs=$($pkg_config --libs libxml-2.0) 4021ed279a06SKlim Kireev else 4022ed279a06SKlim Kireev if test "$libxml2" = "yes"; then 4023ed279a06SKlim Kireev feature_not_found "libxml2" "Install libxml2 devel" 4024ed279a06SKlim Kireev fi 4025ed279a06SKlim Kireev libxml2="no" 4026ed279a06SKlim Kireev fi 4027ed279a06SKlim Kireevfi 4028c9a12e75SChrysostomos Nanakos 4029eb100396SBharata B Rao########################################## 4030eb100396SBharata B Rao# glusterfs probe 4031eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 403265d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 4033e01bee08SBharata B Rao glusterfs="yes" 403489138857SStefan Weil glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 403589138857SStefan Weil glusterfs_libs=$($pkg_config --libs glusterfs-api) 4036d85fa9ebSJeff Cody if $pkg_config --atleast-version=4 glusterfs-api; then 4037d85fa9ebSJeff Cody glusterfs_xlator_opt="yes" 4038d85fa9ebSJeff Cody fi 403965d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 40400c14fb47SBharata B Rao glusterfs_discard="yes" 40410c14fb47SBharata B Rao fi 40427c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 4043df3a429aSNiels de Vos glusterfs_fallocate="yes" 40447c815372SBharata B Rao glusterfs_zerofill="yes" 40457c815372SBharata B Rao fi 4046e014dbe7SPrasanna Kumar Kalever cat > $TMPC << EOF 4047e014dbe7SPrasanna Kumar Kalever#include <glusterfs/api/glfs.h> 4048e014dbe7SPrasanna Kumar Kalever 4049e014dbe7SPrasanna Kumar Kaleverint 4050e014dbe7SPrasanna Kumar Kalevermain(void) 4051e014dbe7SPrasanna Kumar Kalever{ 4052e014dbe7SPrasanna Kumar Kalever /* new glfs_ftruncate() passes two additional args */ 4053e014dbe7SPrasanna Kumar Kalever return glfs_ftruncate(NULL, 0, NULL, NULL); 4054e014dbe7SPrasanna Kumar Kalever} 4055e014dbe7SPrasanna Kumar KaleverEOF 4056e014dbe7SPrasanna Kumar Kalever if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 4057e014dbe7SPrasanna Kumar Kalever glusterfs_ftruncate_has_stat="yes" 4058e014dbe7SPrasanna Kumar Kalever fi 40590e3b891fSNiels de Vos cat > $TMPC << EOF 40600e3b891fSNiels de Vos#include <glusterfs/api/glfs.h> 40610e3b891fSNiels de Vos 40620e3b891fSNiels de Vos/* new glfs_io_cbk() passes two additional glfs_stat structs */ 40630e3b891fSNiels de Vosstatic void 40640e3b891fSNiels de Vosglusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) 40650e3b891fSNiels de Vos{} 40660e3b891fSNiels de Vos 40670e3b891fSNiels de Vosint 40680e3b891fSNiels de Vosmain(void) 40690e3b891fSNiels de Vos{ 40700e3b891fSNiels de Vos glfs_io_cbk iocb = &glusterfs_iocb; 40710e3b891fSNiels de Vos iocb(NULL, 0 , NULL, NULL, NULL); 40720e3b891fSNiels de Vos return 0; 40730e3b891fSNiels de Vos} 40740e3b891fSNiels de VosEOF 40750e3b891fSNiels de Vos if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 40760e3b891fSNiels de Vos glusterfs_iocb_has_stat="yes" 40770e3b891fSNiels de Vos fi 4078eb100396SBharata B Rao else 4079eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 40808efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 40818efc9363SHu Tao "Install glusterfs-api devel >= 3" 4082eb100396SBharata B Rao fi 4083e01bee08SBharata B Rao glusterfs="no" 4084eb100396SBharata B Rao fi 4085eb100396SBharata B Raofi 4086eb100396SBharata B Rao 408739386ac7Saurel32# Check for inotify functions when we are building linux-user 40883b3f24adSaurel32# emulator. This is done because older glibc versions don't 40893b3f24adSaurel32# have syscall stubs for these implemented. In that case we 40903b3f24adSaurel32# don't provide them even if kernel supports them. 40913b3f24adSaurel32# 40923b3f24adSaurel32inotify=no 40933b3f24adSaurel32cat > $TMPC << EOF 40943b3f24adSaurel32#include <sys/inotify.h> 40953b3f24adSaurel32 40963b3f24adSaurel32int 40973b3f24adSaurel32main(void) 40983b3f24adSaurel32{ 40993b3f24adSaurel32 /* try to start inotify */ 41008690e420Saurel32 return inotify_init(); 41013b3f24adSaurel32} 41023b3f24adSaurel32EOF 410352166aa0SJuan Quintelaif compile_prog "" "" ; then 41043b3f24adSaurel32 inotify=yes 41053b3f24adSaurel32fi 41063b3f24adSaurel32 4107c05c7a73SRiku Voipioinotify1=no 4108c05c7a73SRiku Voipiocat > $TMPC << EOF 4109c05c7a73SRiku Voipio#include <sys/inotify.h> 4110c05c7a73SRiku Voipio 4111c05c7a73SRiku Voipioint 4112c05c7a73SRiku Voipiomain(void) 4113c05c7a73SRiku Voipio{ 4114c05c7a73SRiku Voipio /* try to start inotify */ 4115c05c7a73SRiku Voipio return inotify_init1(0); 4116c05c7a73SRiku Voipio} 4117c05c7a73SRiku VoipioEOF 4118c05c7a73SRiku Voipioif compile_prog "" "" ; then 4119c05c7a73SRiku Voipio inotify1=yes 4120c05c7a73SRiku Voipiofi 4121c05c7a73SRiku Voipio 4122099d6b0fSRiku Voipio# check if pipe2 is there 4123099d6b0fSRiku Voipiopipe2=no 4124099d6b0fSRiku Voipiocat > $TMPC << EOF 4125099d6b0fSRiku Voipio#include <unistd.h> 4126099d6b0fSRiku Voipio#include <fcntl.h> 4127099d6b0fSRiku Voipio 4128099d6b0fSRiku Voipioint main(void) 4129099d6b0fSRiku Voipio{ 4130099d6b0fSRiku Voipio int pipefd[2]; 41319bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 4132099d6b0fSRiku Voipio} 4133099d6b0fSRiku VoipioEOF 413452166aa0SJuan Quintelaif compile_prog "" "" ; then 4135099d6b0fSRiku Voipio pipe2=yes 4136099d6b0fSRiku Voipiofi 4137099d6b0fSRiku Voipio 413840ff6d7eSKevin Wolf# check if accept4 is there 413940ff6d7eSKevin Wolfaccept4=no 414040ff6d7eSKevin Wolfcat > $TMPC << EOF 414140ff6d7eSKevin Wolf#include <sys/socket.h> 414240ff6d7eSKevin Wolf#include <stddef.h> 414340ff6d7eSKevin Wolf 414440ff6d7eSKevin Wolfint main(void) 414540ff6d7eSKevin Wolf{ 414640ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 414740ff6d7eSKevin Wolf return 0; 414840ff6d7eSKevin Wolf} 414940ff6d7eSKevin WolfEOF 415040ff6d7eSKevin Wolfif compile_prog "" "" ; then 415140ff6d7eSKevin Wolf accept4=yes 415240ff6d7eSKevin Wolffi 415340ff6d7eSKevin Wolf 41543ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 41553ce34dfbSvibisreenivasansplice=no 41563ce34dfbSvibisreenivasancat > $TMPC << EOF 41573ce34dfbSvibisreenivasan#include <unistd.h> 41583ce34dfbSvibisreenivasan#include <fcntl.h> 41593ce34dfbSvibisreenivasan#include <limits.h> 41603ce34dfbSvibisreenivasan 41613ce34dfbSvibisreenivasanint main(void) 41623ce34dfbSvibisreenivasan{ 416366ea0f22SStefan Weil int len, fd = 0; 41643ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 41653ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 41663ce34dfbSvibisreenivasan return 0; 41673ce34dfbSvibisreenivasan} 41683ce34dfbSvibisreenivasanEOF 416952166aa0SJuan Quintelaif compile_prog "" "" ; then 41703ce34dfbSvibisreenivasan splice=yes 41713ce34dfbSvibisreenivasanfi 41723ce34dfbSvibisreenivasan 4173dcc38d1cSMarcelo Tosatti########################################## 4174a99d57bbSWanlong Gao# libnuma probe 4175a99d57bbSWanlong Gao 4176a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 4177a99d57bbSWanlong Gao cat > $TMPC << EOF 4178a99d57bbSWanlong Gao#include <numa.h> 4179a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 4180a99d57bbSWanlong GaoEOF 4181a99d57bbSWanlong Gao 4182a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 4183a99d57bbSWanlong Gao numa=yes 4184ab318051SMarc-André Lureau numa_libs="-lnuma" 4185a99d57bbSWanlong Gao else 4186a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 4187a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 4188a99d57bbSWanlong Gao fi 4189a99d57bbSWanlong Gao numa=no 4190a99d57bbSWanlong Gao fi 4191a99d57bbSWanlong Gaofi 4192a99d57bbSWanlong Gao 4193aa087962SPaolo Bonzinimalloc=system 41947b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 41957b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 41967b01cb97SAlexandre Derumier exit 1 4197aa087962SPaolo Bonzinielif test "$tcmalloc" = "yes" ; then 4198aa087962SPaolo Bonzini malloc=tcmalloc 4199aa087962SPaolo Bonzinielif test "$jemalloc" = "yes" ; then 4200aa087962SPaolo Bonzini malloc=jemalloc 42017b01cb97SAlexandre Derumierfi 42027b01cb97SAlexandre Derumier 42037b01cb97SAlexandre Derumier########################################## 4204dcc38d1cSMarcelo Tosatti# signalfd probe 4205dcc38d1cSMarcelo Tosattisignalfd="no" 4206dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 4207dcc38d1cSMarcelo Tosatti#include <unistd.h> 4208dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 4209dcc38d1cSMarcelo Tosatti#include <signal.h> 4210dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4211dcc38d1cSMarcelo TosattiEOF 4212dcc38d1cSMarcelo Tosatti 4213dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 4214dcc38d1cSMarcelo Tosatti signalfd=yes 4215dcc38d1cSMarcelo Tosattifi 4216dcc38d1cSMarcelo Tosatti 4217d339d766SRichard W.M. Jones# check if optreset global is declared by <getopt.h> 4218d339d766SRichard W.M. Jonesoptreset="no" 4219d339d766SRichard W.M. Jonescat > $TMPC << EOF 4220d339d766SRichard W.M. Jones#include <getopt.h> 4221d339d766SRichard W.M. Jonesint main(void) { return optreset; } 4222d339d766SRichard W.M. JonesEOF 4223d339d766SRichard W.M. Jones 4224d339d766SRichard W.M. Jonesif compile_prog "" "" ; then 4225d339d766SRichard W.M. Jones optreset=yes 4226d339d766SRichard W.M. Jonesfi 4227d339d766SRichard W.M. Jones 4228c2882b96SRiku Voipio# check if eventfd is supported 4229c2882b96SRiku Voipioeventfd=no 4230c2882b96SRiku Voipiocat > $TMPC << EOF 4231c2882b96SRiku Voipio#include <sys/eventfd.h> 4232c2882b96SRiku Voipio 4233c2882b96SRiku Voipioint main(void) 4234c2882b96SRiku Voipio{ 423555cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4236c2882b96SRiku Voipio} 4237c2882b96SRiku VoipioEOF 4238c2882b96SRiku Voipioif compile_prog "" "" ; then 4239c2882b96SRiku Voipio eventfd=yes 4240c2882b96SRiku Voipiofi 4241c2882b96SRiku Voipio 4242751bcc39SMarc-André Lureau# check if memfd is supported 4243751bcc39SMarc-André Lureaumemfd=no 4244751bcc39SMarc-André Lureaucat > $TMPC << EOF 424575e5b70eSPaolo Bonzini#include <sys/mman.h> 4246751bcc39SMarc-André Lureau 4247751bcc39SMarc-André Lureauint main(void) 4248751bcc39SMarc-André Lureau{ 4249751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 4250751bcc39SMarc-André Lureau} 4251751bcc39SMarc-André LureauEOF 4252751bcc39SMarc-André Lureauif compile_prog "" "" ; then 4253751bcc39SMarc-André Lureau memfd=yes 4254751bcc39SMarc-André Lureaufi 4255751bcc39SMarc-André Lureau 4256955727d2SCortland Tölva# check for usbfs 4257955727d2SCortland Tölvahave_usbfs=no 4258955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 425996566d09SThomas Petazzoni cat > $TMPC << EOF 426096566d09SThomas Petazzoni#include <linux/usbdevice_fs.h> 426196566d09SThomas Petazzoni 426296566d09SThomas Petazzoni#ifndef USBDEVFS_GET_CAPABILITIES 426396566d09SThomas Petazzoni#error "USBDEVFS_GET_CAPABILITIES undefined" 426496566d09SThomas Petazzoni#endif 426596566d09SThomas Petazzoni 426696566d09SThomas Petazzoni#ifndef USBDEVFS_DISCONNECT_CLAIM 426796566d09SThomas Petazzoni#error "USBDEVFS_DISCONNECT_CLAIM undefined" 426896566d09SThomas Petazzoni#endif 426996566d09SThomas Petazzoni 427096566d09SThomas Petazzoniint main(void) 427196566d09SThomas Petazzoni{ 427296566d09SThomas Petazzoni return 0; 427396566d09SThomas Petazzoni} 427496566d09SThomas PetazzoniEOF 427596566d09SThomas Petazzoni if compile_prog "" ""; then 4276955727d2SCortland Tölva have_usbfs=yes 4277955727d2SCortland Tölva fi 4278955727d2SCortland Tölvafi 4279751bcc39SMarc-André Lureau 4280d0927938SUlrich Hecht# check for fallocate 4281d0927938SUlrich Hechtfallocate=no 4282d0927938SUlrich Hechtcat > $TMPC << EOF 4283d0927938SUlrich Hecht#include <fcntl.h> 4284d0927938SUlrich Hecht 4285d0927938SUlrich Hechtint main(void) 4286d0927938SUlrich Hecht{ 4287d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 4288d0927938SUlrich Hecht return 0; 4289d0927938SUlrich Hecht} 4290d0927938SUlrich HechtEOF 42918fb03151SPeter Maydellif compile_prog "" "" ; then 4292d0927938SUlrich Hecht fallocate=yes 4293d0927938SUlrich Hechtfi 4294d0927938SUlrich Hecht 42953d4fa43eSKusanagi Kouichi# check for fallocate hole punching 42963d4fa43eSKusanagi Kouichifallocate_punch_hole=no 42973d4fa43eSKusanagi Kouichicat > $TMPC << EOF 42983d4fa43eSKusanagi Kouichi#include <fcntl.h> 42993d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 43003d4fa43eSKusanagi Kouichi 43013d4fa43eSKusanagi Kouichiint main(void) 43023d4fa43eSKusanagi Kouichi{ 43033d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 43043d4fa43eSKusanagi Kouichi return 0; 43053d4fa43eSKusanagi Kouichi} 43063d4fa43eSKusanagi KouichiEOF 43073d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 43083d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 43093d4fa43eSKusanagi Kouichifi 43103d4fa43eSKusanagi Kouichi 4311b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 4312b953f075SDenis V. Lunevfallocate_zero_range=no 4313b953f075SDenis V. Lunevcat > $TMPC << EOF 4314b953f075SDenis V. Lunev#include <fcntl.h> 4315b953f075SDenis V. Lunev#include <linux/falloc.h> 4316b953f075SDenis V. Lunev 4317b953f075SDenis V. Lunevint main(void) 4318b953f075SDenis V. Lunev{ 4319b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4320b953f075SDenis V. Lunev return 0; 4321b953f075SDenis V. Lunev} 4322b953f075SDenis V. LunevEOF 4323b953f075SDenis V. Lunevif compile_prog "" "" ; then 4324b953f075SDenis V. Lunev fallocate_zero_range=yes 4325b953f075SDenis V. Lunevfi 4326b953f075SDenis V. Lunev 4327ed911435SKevin Wolf# check for posix_fallocate 4328ed911435SKevin Wolfposix_fallocate=no 4329ed911435SKevin Wolfcat > $TMPC << EOF 4330ed911435SKevin Wolf#include <fcntl.h> 4331ed911435SKevin Wolf 4332ed911435SKevin Wolfint main(void) 4333ed911435SKevin Wolf{ 4334ed911435SKevin Wolf posix_fallocate(0, 0, 0); 4335ed911435SKevin Wolf return 0; 4336ed911435SKevin Wolf} 4337ed911435SKevin WolfEOF 4338ed911435SKevin Wolfif compile_prog "" "" ; then 4339ed911435SKevin Wolf posix_fallocate=yes 4340ed911435SKevin Wolffi 4341ed911435SKevin Wolf 4342c727f47dSPeter Maydell# check for sync_file_range 4343c727f47dSPeter Maydellsync_file_range=no 4344c727f47dSPeter Maydellcat > $TMPC << EOF 4345c727f47dSPeter Maydell#include <fcntl.h> 4346c727f47dSPeter Maydell 4347c727f47dSPeter Maydellint main(void) 4348c727f47dSPeter Maydell{ 4349c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 4350c727f47dSPeter Maydell return 0; 4351c727f47dSPeter Maydell} 4352c727f47dSPeter MaydellEOF 43538fb03151SPeter Maydellif compile_prog "" "" ; then 4354c727f47dSPeter Maydell sync_file_range=yes 4355c727f47dSPeter Maydellfi 4356c727f47dSPeter Maydell 4357dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 4358dace20dcSPeter Maydellfiemap=no 4359dace20dcSPeter Maydellcat > $TMPC << EOF 4360dace20dcSPeter Maydell#include <sys/ioctl.h> 4361dace20dcSPeter Maydell#include <linux/fs.h> 4362dace20dcSPeter Maydell#include <linux/fiemap.h> 4363dace20dcSPeter Maydell 4364dace20dcSPeter Maydellint main(void) 4365dace20dcSPeter Maydell{ 4366dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 4367dace20dcSPeter Maydell return 0; 4368dace20dcSPeter Maydell} 4369dace20dcSPeter MaydellEOF 43708fb03151SPeter Maydellif compile_prog "" "" ; then 4371dace20dcSPeter Maydell fiemap=yes 4372dace20dcSPeter Maydellfi 4373dace20dcSPeter Maydell 4374d0927938SUlrich Hecht# check for dup3 4375d0927938SUlrich Hechtdup3=no 4376d0927938SUlrich Hechtcat > $TMPC << EOF 4377d0927938SUlrich Hecht#include <unistd.h> 4378d0927938SUlrich Hecht 4379d0927938SUlrich Hechtint main(void) 4380d0927938SUlrich Hecht{ 4381d0927938SUlrich Hecht dup3(0, 0, 0); 4382d0927938SUlrich Hecht return 0; 4383d0927938SUlrich Hecht} 4384d0927938SUlrich HechtEOF 438578f5d726SJan Kiszkaif compile_prog "" "" ; then 4386d0927938SUlrich Hecht dup3=yes 4387d0927938SUlrich Hechtfi 4388d0927938SUlrich Hecht 43894e0c6529SAlex Bligh# check for ppoll support 43904e0c6529SAlex Blighppoll=no 43914e0c6529SAlex Blighcat > $TMPC << EOF 43924e0c6529SAlex Bligh#include <poll.h> 43934e0c6529SAlex Bligh 43944e0c6529SAlex Blighint main(void) 43954e0c6529SAlex Bligh{ 43964e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 43974e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 43984e0c6529SAlex Bligh return 0; 43994e0c6529SAlex Bligh} 44004e0c6529SAlex BlighEOF 44014e0c6529SAlex Blighif compile_prog "" "" ; then 44024e0c6529SAlex Bligh ppoll=yes 44034e0c6529SAlex Blighfi 44044e0c6529SAlex Bligh 4405cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 4406cd758dd0SAlex Blighprctl_pr_set_timerslack=no 4407cd758dd0SAlex Blighcat > $TMPC << EOF 4408cd758dd0SAlex Bligh#include <sys/prctl.h> 4409cd758dd0SAlex Bligh 4410cd758dd0SAlex Blighint main(void) 4411cd758dd0SAlex Bligh{ 4412cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4413cd758dd0SAlex Bligh return 0; 4414cd758dd0SAlex Bligh} 4415cd758dd0SAlex BlighEOF 4416cd758dd0SAlex Blighif compile_prog "" "" ; then 4417cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 4418cd758dd0SAlex Blighfi 4419cd758dd0SAlex Bligh 44203b6edd16SPeter Maydell# check for epoll support 44213b6edd16SPeter Maydellepoll=no 44223b6edd16SPeter Maydellcat > $TMPC << EOF 44233b6edd16SPeter Maydell#include <sys/epoll.h> 44243b6edd16SPeter Maydell 44253b6edd16SPeter Maydellint main(void) 44263b6edd16SPeter Maydell{ 44273b6edd16SPeter Maydell epoll_create(0); 44283b6edd16SPeter Maydell return 0; 44293b6edd16SPeter Maydell} 44303b6edd16SPeter MaydellEOF 44318fb03151SPeter Maydellif compile_prog "" "" ; then 44323b6edd16SPeter Maydell epoll=yes 44333b6edd16SPeter Maydellfi 44343b6edd16SPeter Maydell 4435227f0214SPeter Maydell# epoll_create1 is a later addition 4436227f0214SPeter Maydell# so we must check separately for its presence 44373b6edd16SPeter Maydellepoll_create1=no 44383b6edd16SPeter Maydellcat > $TMPC << EOF 44393b6edd16SPeter Maydell#include <sys/epoll.h> 44403b6edd16SPeter Maydell 44413b6edd16SPeter Maydellint main(void) 44423b6edd16SPeter Maydell{ 444319e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 444419e83f6bSPeter Maydell * a function being called. This is necessary so that on 444519e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 444619e83f6bSPeter Maydell * the library but not declared in the header file we will 444719e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 444819e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 444919e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 445019e83f6bSPeter Maydell */ 4451c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 44523b6edd16SPeter Maydell} 44533b6edd16SPeter MaydellEOF 44548fb03151SPeter Maydellif compile_prog "" "" ; then 44553b6edd16SPeter Maydell epoll_create1=yes 44563b6edd16SPeter Maydellfi 44573b6edd16SPeter Maydell 4458a8fd1abaSPeter Maydell# check for sendfile support 4459a8fd1abaSPeter Maydellsendfile=no 4460a8fd1abaSPeter Maydellcat > $TMPC << EOF 4461a8fd1abaSPeter Maydell#include <sys/sendfile.h> 4462a8fd1abaSPeter Maydell 4463a8fd1abaSPeter Maydellint main(void) 4464a8fd1abaSPeter Maydell{ 4465a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 4466a8fd1abaSPeter Maydell} 4467a8fd1abaSPeter MaydellEOF 4468a8fd1abaSPeter Maydellif compile_prog "" "" ; then 4469a8fd1abaSPeter Maydell sendfile=yes 4470a8fd1abaSPeter Maydellfi 4471a8fd1abaSPeter Maydell 447251834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 447351834341SRiku Voipiotimerfd=no 447451834341SRiku Voipiocat > $TMPC << EOF 447551834341SRiku Voipio#include <sys/timerfd.h> 447651834341SRiku Voipio 447751834341SRiku Voipioint main(void) 447851834341SRiku Voipio{ 447951834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 448051834341SRiku Voipio} 448151834341SRiku VoipioEOF 448251834341SRiku Voipioif compile_prog "" "" ; then 448351834341SRiku Voipio timerfd=yes 448451834341SRiku Voipiofi 448551834341SRiku Voipio 44869af5c906SRiku Voipio# check for setns and unshare support 44879af5c906SRiku Voipiosetns=no 44889af5c906SRiku Voipiocat > $TMPC << EOF 44899af5c906SRiku Voipio#include <sched.h> 44909af5c906SRiku Voipio 44919af5c906SRiku Voipioint main(void) 44929af5c906SRiku Voipio{ 44939af5c906SRiku Voipio int ret; 44949af5c906SRiku Voipio ret = setns(0, 0); 44959af5c906SRiku Voipio ret = unshare(0); 44969af5c906SRiku Voipio return ret; 44979af5c906SRiku Voipio} 44989af5c906SRiku VoipioEOF 44999af5c906SRiku Voipioif compile_prog "" "" ; then 45009af5c906SRiku Voipio setns=yes 45019af5c906SRiku Voipiofi 45029af5c906SRiku Voipio 450338860a03SAleksandar Markovic# clock_adjtime probe 450438860a03SAleksandar Markovicclock_adjtime=no 450538860a03SAleksandar Markoviccat > $TMPC <<EOF 450638860a03SAleksandar Markovic#include <time.h> 450738860a03SAleksandar Markovic 450838860a03SAleksandar Markovicint main(void) 450938860a03SAleksandar Markovic{ 451038860a03SAleksandar Markovic return clock_adjtime(0, 0); 451138860a03SAleksandar Markovic} 451238860a03SAleksandar MarkovicEOF 451338860a03SAleksandar Markovicclock_adjtime=no 451438860a03SAleksandar Markovicif compile_prog "" "" ; then 451538860a03SAleksandar Markovic clock_adjtime=yes 451638860a03SAleksandar Markovicfi 451738860a03SAleksandar Markovic 45185a03cd00SAleksandar Markovic# syncfs probe 45195a03cd00SAleksandar Markovicsyncfs=no 45205a03cd00SAleksandar Markoviccat > $TMPC <<EOF 45215a03cd00SAleksandar Markovic#include <unistd.h> 45225a03cd00SAleksandar Markovic 45235a03cd00SAleksandar Markovicint main(void) 45245a03cd00SAleksandar Markovic{ 45255a03cd00SAleksandar Markovic return syncfs(0); 45265a03cd00SAleksandar Markovic} 45275a03cd00SAleksandar MarkovicEOF 45285a03cd00SAleksandar Markovicsyncfs=no 45295a03cd00SAleksandar Markovicif compile_prog "" "" ; then 45305a03cd00SAleksandar Markovic syncfs=yes 45315a03cd00SAleksandar Markovicfi 45325a03cd00SAleksandar Markovic 4533db37dd89SAleksandar Markovic# check for kcov support (kernel must be 4.4+, compiled with certain options) 4534db37dd89SAleksandar Markovickcov=no 4535db37dd89SAleksandar Markovicif check_include sys/kcov.h ; then 4536db37dd89SAleksandar Markovic kcov=yes 4537db37dd89SAleksandar Markovicfi 4538db37dd89SAleksandar Markovic 4539d6092e08SFilip Bozuta# check for btrfs filesystem support (kernel must be 3.9+) 4540d6092e08SFilip Bozutabtrfs=no 4541d6092e08SFilip Bozutaif check_include linux/btrfs.h ; then 4542d6092e08SFilip Bozuta btrfs=yes 4543d6092e08SFilip Bozutafi 4544d6092e08SFilip Bozuta 4545516e8b7dSPeter Maydell# If we're making warnings fatal, apply this to Sphinx runs as well 4546516e8b7dSPeter Maydellsphinx_werror="" 4547516e8b7dSPeter Maydellif test "$werror" = "yes"; then 4548516e8b7dSPeter Maydell sphinx_werror="-W" 4549516e8b7dSPeter Maydellfi 4550516e8b7dSPeter Maydell 45515f71eac0SPeter Maydell# Check we have a new enough version of sphinx-build 45525f71eac0SPeter Maydellhas_sphinx_build() { 45535f71eac0SPeter Maydell # This is a bit awkward but works: create a trivial document and 45545f71eac0SPeter Maydell # try to run it with our configuration file (which enforces a 45555f71eac0SPeter Maydell # version requirement). This will fail if either 45565f71eac0SPeter Maydell # sphinx-build doesn't exist at all or if it is too old. 45575f71eac0SPeter Maydell mkdir -p "$TMPDIR1/sphinx" 45585f71eac0SPeter Maydell touch "$TMPDIR1/sphinx/index.rst" 4559988ae6c3SAlex Bennée "$sphinx_build" $sphinx_werror -c "$source_path/docs" \ 4560988ae6c3SAlex Bennée -b html "$TMPDIR1/sphinx" \ 4561988ae6c3SAlex Bennée "$TMPDIR1/sphinx/out" >> config.log 2>&1 45625f71eac0SPeter Maydell} 45635f71eac0SPeter Maydell 4564cc8ae6deSpbrook# Check if tools are available to build documentation. 4565a25dba17SJuan Quintelaif test "$docs" != "no" ; then 4566758b617aSPeter Maydell if has_sphinx_build; then 4567758b617aSPeter Maydell sphinx_ok=yes 4568758b617aSPeter Maydell else 4569758b617aSPeter Maydell sphinx_ok=no 4570758b617aSPeter Maydell fi 45711615aeafSPeter Maydell if test "$sphinx_ok" = "yes"; then 4572a25dba17SJuan Quintela docs=yes 457383a3ab8bSJuan Quintela else 4574a25dba17SJuan Quintela if test "$docs" = "yes" ; then 4575758b617aSPeter Maydell if has $sphinx_build && test "$sphinx_ok" != "yes"; then 4576758b617aSPeter Maydell echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 4577758b617aSPeter Maydell fi 45781615aeafSPeter Maydell feature_not_found "docs" "Install a Python 3 version of python-sphinx" 457983a3ab8bSJuan Quintela fi 4580a25dba17SJuan Quintela docs=no 458183a3ab8bSJuan Quintela fi 4582cc8ae6deSpbrookfi 4583cc8ae6deSpbrook 4584f514f41cSStefan Weil# Search for bswap_32 function 45856ae9a1f4SJuan Quintelabyteswap_h=no 45866ae9a1f4SJuan Quintelacat > $TMPC << EOF 45876ae9a1f4SJuan Quintela#include <byteswap.h> 45886ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 45896ae9a1f4SJuan QuintelaEOF 459052166aa0SJuan Quintelaif compile_prog "" "" ; then 45916ae9a1f4SJuan Quintela byteswap_h=yes 45926ae9a1f4SJuan Quintelafi 45936ae9a1f4SJuan Quintela 459475f13596SStefan Weil# Search for bswap32 function 45956ae9a1f4SJuan Quintelabswap_h=no 45966ae9a1f4SJuan Quintelacat > $TMPC << EOF 45976ae9a1f4SJuan Quintela#include <sys/endian.h> 45986ae9a1f4SJuan Quintela#include <sys/types.h> 45996ae9a1f4SJuan Quintela#include <machine/bswap.h> 46006ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 46016ae9a1f4SJuan QuintelaEOF 460252166aa0SJuan Quintelaif compile_prog "" "" ; then 46036ae9a1f4SJuan Quintela bswap_h=yes 46046ae9a1f4SJuan Quintelafi 46056ae9a1f4SJuan Quintela 4606da93a1fdSaliguori########################################## 4607e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 4608c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 4609e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 46103c33ea96SPaolo Bonzini libiscsi="yes" 4611ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 4612ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 4613c589b249SRonnie Sahlberg else 4614c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 4615e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 4616c589b249SRonnie Sahlberg fi 4617c589b249SRonnie Sahlberg libiscsi="no" 4618c589b249SRonnie Sahlberg fi 4619c589b249SRonnie Sahlbergfi 4620c589b249SRonnie Sahlberg 4621c589b249SRonnie Sahlberg########################################## 4622da93a1fdSaliguori# Do we need librt 46238bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 46248bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 46258bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 46268bacde8dSNatanael Copa# function in addition. 4627da93a1fdSaliguoricat > $TMPC <<EOF 4628da93a1fdSaliguori#include <signal.h> 4629da93a1fdSaliguori#include <time.h> 46308bacde8dSNatanael Copaint main(void) { 46318bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 46328bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 46338bacde8dSNatanael Copa} 4634da93a1fdSaliguoriEOF 4635da93a1fdSaliguori 463652166aa0SJuan Quintelaif compile_prog "" "" ; then 463707ffa4bdSJuan Quintela : 46388bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 463918e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 464018e588b1SRick Liu LIBS="$LIBS -lrt" 4641da93a1fdSaliguorifi 4642da93a1fdSaliguori 4643f2995ee4SPaolo Bonzini# Check whether we have openpty() in either libc or libutil 4644d99e97e6SThomas Huthcat > $TMPC << EOF 4645d99e97e6SThomas Huthextern int openpty(int *am, int *as, char *name, void *termp, void *winp); 4646d99e97e6SThomas Huthint main(void) { return openpty(0, 0, 0, 0, 0); } 4647d99e97e6SThomas HuthEOF 4648d99e97e6SThomas Huth 46499df8b20dSThomas Huthhave_openpty="no" 46509df8b20dSThomas Huthif compile_prog "" "" ; then 46519df8b20dSThomas Huth have_openpty="yes" 46529df8b20dSThomas Huthelse 4653d99e97e6SThomas Huth if compile_prog "" "-lutil" ; then 46549df8b20dSThomas Huth have_openpty="yes" 4655d99e97e6SThomas Huth fi 46566362a53fSJuan Quintelafi 46576362a53fSJuan Quintela 4658de5071c5SBlue Swirl########################################## 4659cd4ec0b4SGerd Hoffmann# spice probe 4660cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 4661cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 4662cd4ec0b4SGerd Hoffmann#include <spice.h> 4663cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 4664cd4ec0b4SGerd HoffmannEOF 4665710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 4666710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 46671b63665cSMarc-André Lureau if $pkg_config --atleast-version=0.12.5 spice-server && \ 466865d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 4669cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 4670cd4ec0b4SGerd Hoffmann spice="yes" 4671cd4ec0b4SGerd Hoffmann else 4672cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 46738efc9363SHu Tao feature_not_found "spice" \ 46741b63665cSMarc-André Lureau "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" 4675cd4ec0b4SGerd Hoffmann fi 4676cd4ec0b4SGerd Hoffmann spice="no" 4677cd4ec0b4SGerd Hoffmann fi 4678cd4ec0b4SGerd Hoffmannfi 4679cd4ec0b4SGerd Hoffmann 46807b02f544SMarc-André Lureau# check for smartcard support 46817b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 46820f5c642dSMichal Privoznik if $pkg_config --atleast-version=2.5.1 libcacard; then 46837b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 46847b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 46857b02f544SMarc-André Lureau smartcard="yes" 4686111a38b0SRobert Relyea else 46877b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 46887b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 4689111a38b0SRobert Relyea fi 46907b02f544SMarc-André Lureau smartcard="no" 4691111a38b0SRobert Relyea fi 4692111a38b0SRobert Relyeafi 4693111a38b0SRobert Relyea 46942b2325ffSGerd Hoffmann# check for libusb 46952b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 469665d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 46972b2325ffSGerd Hoffmann libusb="yes" 4698ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 4699ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 47002b2325ffSGerd Hoffmann else 47012b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 47028efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 47032b2325ffSGerd Hoffmann fi 47042b2325ffSGerd Hoffmann libusb="no" 47052b2325ffSGerd Hoffmann fi 47062b2325ffSGerd Hoffmannfi 47072b2325ffSGerd Hoffmann 470869354a83SHans de Goede# check for usbredirparser for usb network redirection support 470969354a83SHans de Goedeif test "$usb_redir" != "no" ; then 471065d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 471169354a83SHans de Goede usb_redir="yes" 4712ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 4713ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 471469354a83SHans de Goede else 471569354a83SHans de Goede if test "$usb_redir" = "yes"; then 471621684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 471769354a83SHans de Goede fi 471869354a83SHans de Goede usb_redir="no" 471969354a83SHans de Goede fi 472069354a83SHans de Goedefi 472169354a83SHans de Goede 4722cd4ec0b4SGerd Hoffmann########################################## 4723d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 4724d9840e25STomoki Sekiyama 4725e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 4726e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 4727d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 4728690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 4729d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 4730d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 4731690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 4732d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 4733d9840e25STomoki Sekiyama ;; 4734690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 4735d9840e25STomoki Sekiyama esac 4736d9840e25STomoki Sekiyama cat > $TMPC << EOF 4737d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 4738d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 4739d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 4740d9840e25STomoki SekiyamaEOF 4741d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 4742d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 4743d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 4744315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 4745f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 4746d9840e25STomoki Sekiyama else 4747d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 4748d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 4749d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 4750d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 4751d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 4752d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 4753d9840e25STomoki Sekiyama feature_not_found "VSS support" 4754d9840e25STomoki Sekiyama fi 4755d9840e25STomoki Sekiyama guest_agent_with_vss="no" 4756d9840e25STomoki Sekiyama fi 4757d9840e25STomoki Sekiyamafi 4758d9840e25STomoki Sekiyama 4759d9840e25STomoki Sekiyama########################################## 4760d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 4761d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 4762d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 4763d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 4764d9840e25STomoki Sekiyama 4765e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 4766e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 4767d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 4768d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 4769d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 4770d9840e25STomoki Sekiyama if test -n "$programfiles"; then 4771d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 4772d9840e25STomoki Sekiyama else 4773d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 4774d9840e25STomoki Sekiyama fi 4775d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 4776d9840e25STomoki Sekiyama win_sdk="" 4777d9840e25STomoki Sekiyama fi 4778d9840e25STomoki Sekiyamafi 4779d9840e25STomoki Sekiyama 4780d9840e25STomoki Sekiyama########################################## 478150cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 4782e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 478350cbebb9SMichael Roth cat > $TMPC << EOF 478450cbebb9SMichael Roth#include <windows.h> 478550cbebb9SMichael Roth#include <ntddscsi.h> 478650cbebb9SMichael Rothint main(void) { 478750cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 478850cbebb9SMichael Roth#error Missing required ioctl definitions 478950cbebb9SMichael Roth#endif 479050cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 479150cbebb9SMichael Roth return addr.Lun; 479250cbebb9SMichael Roth} 479350cbebb9SMichael RothEOF 479450cbebb9SMichael Roth if compile_prog "" "" ; then 479550cbebb9SMichael Roth guest_agent_ntddscsi=yes 4796996b9cdcSMatt Hines libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 479750cbebb9SMichael Roth fi 479850cbebb9SMichael Rothfi 479950cbebb9SMichael Roth 480050cbebb9SMichael Roth########################################## 48019d9e1521SGerd Hoffmann# virgl renderer probe 48029d9e1521SGerd Hoffmann 48039d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 48049d9e1521SGerd Hoffmann cat > $TMPC << EOF 48059d9e1521SGerd Hoffmann#include <virglrenderer.h> 48069d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 48079d9e1521SGerd HoffmannEOF 48089d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 48099d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 481047479c55SMarc-André Lureau virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 48119d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 48129d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 48139d9e1521SGerd Hoffmann virglrenderer="yes" 48149d9e1521SGerd Hoffmann else 48159d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 48169d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 48179d9e1521SGerd Hoffmann fi 48189d9e1521SGerd Hoffmann virglrenderer="no" 48199d9e1521SGerd Hoffmann fi 48209d9e1521SGerd Hoffmannfi 48219d9e1521SGerd Hoffmann 48229d9e1521SGerd Hoffmann########################################## 48238ca80760SRichard Henderson# capstone 48248ca80760SRichard Henderson 4825e219c499SRichard Hendersoncase "$capstone" in 48268b18cdbfSRichard Henderson auto | enabled | internal) 48278b18cdbfSRichard Henderson # Simpler to always update submodule, even if not needed. 48288b18cdbfSRichard Henderson if test -e "${source_path}/.git" && test $git_update = 'yes' ; then 4829e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 4830e219c499SRichard Henderson fi 4831e219c499SRichard Henderson ;; 4832e219c499SRichard Hendersonesac 48338ca80760SRichard Henderson 48348ca80760SRichard Henderson########################################## 48355f6b9e8fSBlue Swirl# check if we have fdatasync 48365f6b9e8fSBlue Swirl 48375f6b9e8fSBlue Swirlfdatasync=no 48385f6b9e8fSBlue Swirlcat > $TMPC << EOF 48395f6b9e8fSBlue Swirl#include <unistd.h> 4840d1722a27SAlexandre Raymondint main(void) { 4841d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 4842d1722a27SAlexandre Raymondreturn fdatasync(0); 4843d1722a27SAlexandre Raymond#else 4844e172fe11SStefan Weil#error Not supported 4845d1722a27SAlexandre Raymond#endif 4846d1722a27SAlexandre Raymond} 48475f6b9e8fSBlue SwirlEOF 48485f6b9e8fSBlue Swirlif compile_prog "" "" ; then 48495f6b9e8fSBlue Swirl fdatasync=yes 48505f6b9e8fSBlue Swirlfi 48515f6b9e8fSBlue Swirl 485294a420b1SStefan Hajnoczi########################################## 4853e78815a5SAndreas Färber# check if we have madvise 4854e78815a5SAndreas Färber 4855e78815a5SAndreas Färbermadvise=no 4856e78815a5SAndreas Färbercat > $TMPC << EOF 4857e78815a5SAndreas Färber#include <sys/types.h> 4858e78815a5SAndreas Färber#include <sys/mman.h> 4859832ce9c2SScott Wood#include <stddef.h> 4860e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 4861e78815a5SAndreas FärberEOF 4862e78815a5SAndreas Färberif compile_prog "" "" ; then 4863e78815a5SAndreas Färber madvise=yes 4864e78815a5SAndreas Färberfi 4865e78815a5SAndreas Färber 4866e78815a5SAndreas Färber########################################## 4867e78815a5SAndreas Färber# check if we have posix_madvise 4868e78815a5SAndreas Färber 4869e78815a5SAndreas Färberposix_madvise=no 4870e78815a5SAndreas Färbercat > $TMPC << EOF 4871e78815a5SAndreas Färber#include <sys/mman.h> 4872832ce9c2SScott Wood#include <stddef.h> 4873e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 4874e78815a5SAndreas FärberEOF 4875e78815a5SAndreas Färberif compile_prog "" "" ; then 4876e78815a5SAndreas Färber posix_madvise=yes 4877e78815a5SAndreas Färberfi 4878e78815a5SAndreas Färber 4879e78815a5SAndreas Färber########################################## 48809bc5a719SAndreas Gustafsson# check if we have posix_memalign() 48819bc5a719SAndreas Gustafsson 48829bc5a719SAndreas Gustafssonposix_memalign=no 48839bc5a719SAndreas Gustafssoncat > $TMPC << EOF 48849bc5a719SAndreas Gustafsson#include <stdlib.h> 48859bc5a719SAndreas Gustafssonint main(void) { 48869bc5a719SAndreas Gustafsson void *p; 48879bc5a719SAndreas Gustafsson return posix_memalign(&p, 8, 8); 48889bc5a719SAndreas Gustafsson} 48899bc5a719SAndreas GustafssonEOF 48909bc5a719SAndreas Gustafssonif compile_prog "" "" ; then 48919bc5a719SAndreas Gustafsson posix_memalign=yes 48929bc5a719SAndreas Gustafssonfi 48939bc5a719SAndreas Gustafsson 48949bc5a719SAndreas Gustafsson########################################## 48950a852417SPaul Durrant# check if we have posix_syslog 48960a852417SPaul Durrant 48970a852417SPaul Durrantposix_syslog=no 48980a852417SPaul Durrantcat > $TMPC << EOF 48990a852417SPaul Durrant#include <syslog.h> 49000a852417SPaul Durrantint main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 49010a852417SPaul DurrantEOF 49020a852417SPaul Durrantif compile_prog "" "" ; then 49030a852417SPaul Durrant posix_syslog=yes 49040a852417SPaul Durrantfi 49050a852417SPaul Durrant 49060a852417SPaul Durrant########################################## 4907401bc051SPeter Maydell# check if we have sem_timedwait 4908401bc051SPeter Maydell 4909401bc051SPeter Maydellsem_timedwait=no 4910401bc051SPeter Maydellcat > $TMPC << EOF 4911401bc051SPeter Maydell#include <semaphore.h> 4912811294b7SDaniel P. Berrangéint main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } 4913401bc051SPeter MaydellEOF 4914401bc051SPeter Maydellif compile_prog "" "" ; then 4915401bc051SPeter Maydell sem_timedwait=yes 4916401bc051SPeter Maydellfi 4917401bc051SPeter Maydell 4918401bc051SPeter Maydell########################################## 49195c99fa37SKeno Fischer# check if we have strchrnul 49205c99fa37SKeno Fischer 49215c99fa37SKeno Fischerstrchrnul=no 49225c99fa37SKeno Fischercat > $TMPC << EOF 49235c99fa37SKeno Fischer#include <string.h> 49245c99fa37SKeno Fischerint main(void); 49255c99fa37SKeno Fischer// Use a haystack that the compiler shouldn't be able to constant fold 49265c99fa37SKeno Fischerchar *haystack = (char*)&main; 49275c99fa37SKeno Fischerint main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 49285c99fa37SKeno FischerEOF 49295c99fa37SKeno Fischerif compile_prog "" "" ; then 49305c99fa37SKeno Fischer strchrnul=yes 49315c99fa37SKeno Fischerfi 49325c99fa37SKeno Fischer 49338a792b03SJiufei Xue######################################### 49348a792b03SJiufei Xue# check if we have st_atim 49358a792b03SJiufei Xue 49368a792b03SJiufei Xuest_atim=no 49378a792b03SJiufei Xuecat > $TMPC << EOF 49388a792b03SJiufei Xue#include <sys/stat.h> 49398a792b03SJiufei Xue#include <stddef.h> 49408a792b03SJiufei Xueint main(void) { return offsetof(struct stat, st_atim); } 49418a792b03SJiufei XueEOF 49428a792b03SJiufei Xueif compile_prog "" "" ; then 49438a792b03SJiufei Xue st_atim=yes 49448a792b03SJiufei Xuefi 49458a792b03SJiufei Xue 49465c99fa37SKeno Fischer########################################## 494794a420b1SStefan Hajnoczi# check if trace backend exists 494894a420b1SStefan Hajnoczi 49495b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 495094a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 49515b808275SLluís Vilanova error_exit "invalid trace backends" \ 49525b808275SLluís Vilanova "Please choose supported trace backends." 495394a420b1SStefan Hajnoczifi 495494a420b1SStefan Hajnoczi 49557e24e92aSStefan Hajnoczi########################################## 49567e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 49575b808275SLluís Vilanovaif have_backend "ust"; then 49587e24e92aSStefan Hajnoczi cat > $TMPC << EOF 4959bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 49607e24e92aSStefan Hajnocziint main(void) { return 0; } 49617e24e92aSStefan HajnocziEOF 4962c79ed23dSFrancis Deslauriers if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 4963bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 496489138857SStefan Weil lttng_ust_libs=$($pkg_config --libs lttng-ust) 49657e24e92aSStefan Hajnoczi else 4966c79ed23dSFrancis Deslauriers lttng_ust_libs="-llttng-ust -ldl" 4967bf15f63cSMohamad Gebai fi 4968bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 496989138857SStefan Weil urcu_bp_libs=$($pkg_config --libs liburcu-bp) 4970bf15f63cSMohamad Gebai else 4971bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 4972bf15f63cSMohamad Gebai fi 4973bf15f63cSMohamad Gebai else 4974bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 49757e24e92aSStefan Hajnoczi fi 49767e24e92aSStefan Hajnoczifi 4977b3d08c02SDaniel P. Berrange 4978b3d08c02SDaniel P. Berrange########################################## 4979b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 49805b808275SLluís Vilanovaif have_backend "dtrace"; then 4981b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 498276ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 4983b3d08c02SDaniel P. Berrange fi 4984c276b17dSDaniel P. Berrange trace_backend_stap="no" 4985c276b17dSDaniel P. Berrange if has 'stap' ; then 4986c276b17dSDaniel P. Berrange trace_backend_stap="yes" 4987c276b17dSDaniel P. Berrange fi 4988b3d08c02SDaniel P. Berrangefi 4989b3d08c02SDaniel P. Berrange 49907e24e92aSStefan Hajnoczi########################################## 4991519175a2SAlex Barcelo# check and set a backend for coroutine 4992d0e2fce5SAneesh Kumar K.V 49937c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 499433c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 499533c53c54SDaniel P. Berrange# specific one. 49967c2acc70SPeter Maydell 49977c2acc70SPeter Maydellucontext_works=no 4998d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 4999d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 5000d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 5001cdf84806SPeter Maydell#ifdef __stub_makecontext 5002cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 5003cdf84806SPeter Maydell#endif 500475cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 5005d0e2fce5SAneesh Kumar K.VEOF 5006d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 50077c2acc70SPeter Maydell ucontext_works=yes 5008d0e2fce5SAneesh Kumar K.V fi 5009519175a2SAlex Barcelofi 50107c2acc70SPeter Maydell 50117c2acc70SPeter Maydellif test "$coroutine" = ""; then 50127c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 50137c2acc70SPeter Maydell coroutine=win32 50147c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 50157c2acc70SPeter Maydell coroutine=ucontext 5016519175a2SAlex Barcelo else 50177c2acc70SPeter Maydell coroutine=sigaltstack 50187c2acc70SPeter Maydell fi 50197c2acc70SPeter Maydellelse 50207c2acc70SPeter Maydell case $coroutine in 50217c2acc70SPeter Maydell windows) 50227c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 50237c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 50247c2acc70SPeter Maydell fi 50257c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 50267c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 50277c2acc70SPeter Maydell coroutine=win32 50287c2acc70SPeter Maydell ;; 50297c2acc70SPeter Maydell ucontext) 50307c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 50317c2acc70SPeter Maydell feature_not_found "ucontext" 50327c2acc70SPeter Maydell fi 50337c2acc70SPeter Maydell ;; 503433c53c54SDaniel P. Berrange sigaltstack) 50357c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 50367c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 50377c2acc70SPeter Maydell fi 50387c2acc70SPeter Maydell ;; 50397c2acc70SPeter Maydell *) 504076ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 50417c2acc70SPeter Maydell ;; 50427c2acc70SPeter Maydell esac 5043d0e2fce5SAneesh Kumar K.Vfi 5044d0e2fce5SAneesh Kumar K.V 504570c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 504670c60c08SStefan Hajnoczi coroutine_pool=yes 504770c60c08SStefan Hajnoczifi 504870c60c08SStefan Hajnoczi 50497d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 50507d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 50517d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 50527d992e4dSPeter Lieven coroutine_pool=no 50537d992e4dSPeter Lieven fi 50547d992e4dSPeter Lievenfi 50557d992e4dSPeter Lieven 50561e4f6065SDaniele Buono################################################## 50571e4f6065SDaniele Buono# SafeStack 50581e4f6065SDaniele Buono 50591e4f6065SDaniele Buono 50601e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 50611e4f6065SDaniele Buonocat > $TMPC << EOF 50621e4f6065SDaniele Buonoint main(int argc, char *argv[]) 50631e4f6065SDaniele Buono{ 50641e4f6065SDaniele Buono#if ! __has_feature(safe_stack) 50651e4f6065SDaniele Buono#error SafeStack Disabled 50661e4f6065SDaniele Buono#endif 50671e4f6065SDaniele Buono return 0; 50681e4f6065SDaniele Buono} 50691e4f6065SDaniele BuonoEOF 50701e4f6065SDaniele Buono flag="-fsanitize=safe-stack" 50711e4f6065SDaniele Buono # Check that safe-stack is supported and enabled. 50721e4f6065SDaniele Buono if compile_prog "-Werror $flag" "$flag"; then 50731e4f6065SDaniele Buono # Flag needed both at compilation and at linking 50741e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 50751e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 50761e4f6065SDaniele Buono else 50771e4f6065SDaniele Buono error_exit "SafeStack not supported by your compiler" 50781e4f6065SDaniele Buono fi 50791e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 50801e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 50811e4f6065SDaniele Buono fi 50821e4f6065SDaniele Buonoelse 50831e4f6065SDaniele Buonocat > $TMPC << EOF 50841e4f6065SDaniele Buonoint main(int argc, char *argv[]) 50851e4f6065SDaniele Buono{ 50861e4f6065SDaniele Buono#if defined(__has_feature) 50871e4f6065SDaniele Buono#if __has_feature(safe_stack) 50881e4f6065SDaniele Buono#error SafeStack Enabled 50891e4f6065SDaniele Buono#endif 50901e4f6065SDaniele Buono#endif 50911e4f6065SDaniele Buono return 0; 50921e4f6065SDaniele Buono} 50931e4f6065SDaniele BuonoEOF 50941e4f6065SDaniele Buonoif test "$safe_stack" = "no"; then 50951e4f6065SDaniele Buono # Make sure that safe-stack is disabled 50961e4f6065SDaniele Buono if ! compile_prog "-Werror" ""; then 50971e4f6065SDaniele Buono # SafeStack was already enabled, try to explicitly remove the feature 50981e4f6065SDaniele Buono flag="-fno-sanitize=safe-stack" 50991e4f6065SDaniele Buono if ! compile_prog "-Werror $flag" "$flag"; then 51001e4f6065SDaniele Buono error_exit "Configure cannot disable SafeStack" 51011e4f6065SDaniele Buono fi 51021e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 51031e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 51041e4f6065SDaniele Buono fi 51051e4f6065SDaniele Buonoelse # "$safe_stack" = "" 51061e4f6065SDaniele Buono # Set safe_stack to yes or no based on pre-existing flags 51071e4f6065SDaniele Buono if compile_prog "-Werror" ""; then 51081e4f6065SDaniele Buono safe_stack="no" 51091e4f6065SDaniele Buono else 51101e4f6065SDaniele Buono safe_stack="yes" 51111e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 51121e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 51131e4f6065SDaniele Buono fi 51141e4f6065SDaniele Buono fi 51151e4f6065SDaniele Buonofi 51161e4f6065SDaniele Buonofi 51177d992e4dSPeter Lieven 5118d0e2fce5SAneesh Kumar K.V########################################## 5119d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 5120d2042378SAneesh Kumar K.V 51214e1797f9SStefan Weilopen_by_handle_at=no 5122d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 5123d2042378SAneesh Kumar K.V#include <fcntl.h> 5124acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 5125acc55ba8SStefan Weil# error missing definition 5126acc55ba8SStefan Weil#else 512775cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 5128acc55ba8SStefan Weil#endif 5129d2042378SAneesh Kumar K.VEOF 5130d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 5131d2042378SAneesh Kumar K.V open_by_handle_at=yes 5132d2042378SAneesh Kumar K.Vfi 5133d2042378SAneesh Kumar K.V 5134e06a765eSHarsh Prateek Bora######################################## 5135e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 5136e06a765eSHarsh Prateek Bora 5137e06a765eSHarsh Prateek Boralinux_magic_h=no 5138e06a765eSHarsh Prateek Boracat > $TMPC << EOF 5139e06a765eSHarsh Prateek Bora#include <linux/magic.h> 5140e06a765eSHarsh Prateek Boraint main(void) { 514175cafad7SStefan Weil return 0; 5142e06a765eSHarsh Prateek Bora} 5143e06a765eSHarsh Prateek BoraEOF 5144e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 5145e06a765eSHarsh Prateek Bora linux_magic_h=yes 5146e06a765eSHarsh Prateek Borafi 5147e06a765eSHarsh Prateek Bora 51488ab1bf12SLuiz Capitulino######################################## 5149541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 51503f4349dcSKevin Wolf 51513f4349dcSKevin Wolfvalgrind_h=no 51523f4349dcSKevin Wolfcat > $TMPC << EOF 51533f4349dcSKevin Wolf#include <valgrind/valgrind.h> 51543f4349dcSKevin Wolfint main(void) { 51553f4349dcSKevin Wolf return 0; 51563f4349dcSKevin Wolf} 51573f4349dcSKevin WolfEOF 51583f4349dcSKevin Wolfif compile_prog "" "" ; then 51593f4349dcSKevin Wolf valgrind_h=yes 51603f4349dcSKevin Wolffi 51613f4349dcSKevin Wolf 51623f4349dcSKevin Wolf######################################## 51638ab1bf12SLuiz Capitulino# check if environ is declared 51648ab1bf12SLuiz Capitulino 51658ab1bf12SLuiz Capitulinohas_environ=no 51668ab1bf12SLuiz Capitulinocat > $TMPC << EOF 51678ab1bf12SLuiz Capitulino#include <unistd.h> 51688ab1bf12SLuiz Capitulinoint main(void) { 5169c075a723SBlue Swirl environ = 0; 51708ab1bf12SLuiz Capitulino return 0; 51718ab1bf12SLuiz Capitulino} 51728ab1bf12SLuiz CapitulinoEOF 51738ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 51748ab1bf12SLuiz Capitulino has_environ=yes 51758ab1bf12SLuiz Capitulinofi 51768ab1bf12SLuiz Capitulino 517776a347e1SRichard Henderson######################################## 517876a347e1SRichard Henderson# check if cpuid.h is usable. 517976a347e1SRichard Henderson 518076a347e1SRichard Hendersoncat > $TMPC << EOF 518176a347e1SRichard Henderson#include <cpuid.h> 518276a347e1SRichard Hendersonint main(void) { 5183774d566cSPeter Maydell unsigned a, b, c, d; 5184774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 5185774d566cSPeter Maydell 5186774d566cSPeter Maydell if (max >= 1) { 5187774d566cSPeter Maydell __cpuid(1, a, b, c, d); 5188774d566cSPeter Maydell } 5189774d566cSPeter Maydell 5190774d566cSPeter Maydell if (max >= 7) { 5191774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 5192774d566cSPeter Maydell } 5193774d566cSPeter Maydell 519476a347e1SRichard Henderson return 0; 519576a347e1SRichard Henderson} 519676a347e1SRichard HendersonEOF 519776a347e1SRichard Hendersonif compile_prog "" "" ; then 519876a347e1SRichard Henderson cpuid_h=yes 519976a347e1SRichard Hendersonfi 520076a347e1SRichard Henderson 52015dd89908SRichard Henderson########################################## 52025dd89908SRichard Henderson# avx2 optimization requirement check 52035dd89908SRichard Henderson# 52045dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 52055dd89908SRichard Henderson# since we won't be able to select the new routines. 52065dd89908SRichard Henderson 5207e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 52085dd89908SRichard Henderson cat > $TMPC << EOF 52095dd89908SRichard Henderson#pragma GCC push_options 52105dd89908SRichard Henderson#pragma GCC target("avx2") 52115dd89908SRichard Henderson#include <cpuid.h> 52125dd89908SRichard Henderson#include <immintrin.h> 52135dd89908SRichard Hendersonstatic int bar(void *a) { 52145dd89908SRichard Henderson __m256i x = *(__m256i *)a; 52155dd89908SRichard Henderson return _mm256_testz_si256(x, x); 52165dd89908SRichard Henderson} 52175dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 52185dd89908SRichard HendersonEOF 52195dd89908SRichard Henderson if compile_object "" ; then 52205dd89908SRichard Henderson avx2_opt="yes" 522186583a07SLiam Merwick else 522286583a07SLiam Merwick avx2_opt="no" 52235dd89908SRichard Henderson fi 52245dd89908SRichard Hendersonfi 52255dd89908SRichard Henderson 52266b8cd447SRobert Hoo########################################## 52276b8cd447SRobert Hoo# avx512f optimization requirement check 52286b8cd447SRobert Hoo# 52296b8cd447SRobert Hoo# There is no point enabling this if cpuid.h is not usable, 52306b8cd447SRobert Hoo# since we won't be able to select the new routines. 52316b8cd447SRobert Hoo# by default, it is turned off. 52326b8cd447SRobert Hoo# if user explicitly want to enable it, check environment 52336b8cd447SRobert Hoo 52346b8cd447SRobert Hooif test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 52356b8cd447SRobert Hoo cat > $TMPC << EOF 52366b8cd447SRobert Hoo#pragma GCC push_options 52376b8cd447SRobert Hoo#pragma GCC target("avx512f") 52386b8cd447SRobert Hoo#include <cpuid.h> 52396b8cd447SRobert Hoo#include <immintrin.h> 52406b8cd447SRobert Hoostatic int bar(void *a) { 52416b8cd447SRobert Hoo __m512i x = *(__m512i *)a; 52426b8cd447SRobert Hoo return _mm512_test_epi64_mask(x, x); 52436b8cd447SRobert Hoo} 52446b8cd447SRobert Hooint main(int argc, char *argv[]) 52456b8cd447SRobert Hoo{ 52466b8cd447SRobert Hoo return bar(argv[0]); 52476b8cd447SRobert Hoo} 52486b8cd447SRobert HooEOF 52496b8cd447SRobert Hoo if ! compile_object "" ; then 52506b8cd447SRobert Hoo avx512f_opt="no" 52516b8cd447SRobert Hoo fi 52526b8cd447SRobert Hooelse 52536b8cd447SRobert Hoo avx512f_opt="no" 52546b8cd447SRobert Hoofi 52556b8cd447SRobert Hoo 5256f540166bSRichard Henderson######################################## 5257f540166bSRichard Henderson# check if __[u]int128_t is usable. 5258f540166bSRichard Henderson 5259f540166bSRichard Hendersonint128=no 5260f540166bSRichard Hendersoncat > $TMPC << EOF 5261f540166bSRichard Henderson__int128_t a; 5262f540166bSRichard Henderson__uint128_t b; 5263f540166bSRichard Hendersonint main (void) { 5264f540166bSRichard Henderson a = a + b; 5265f540166bSRichard Henderson b = a * b; 5266464e3671SPeter Maydell a = a * a; 5267f540166bSRichard Henderson return 0; 5268f540166bSRichard Henderson} 5269f540166bSRichard HendersonEOF 5270f540166bSRichard Hendersonif compile_prog "" "" ; then 5271f540166bSRichard Henderson int128=yes 5272f540166bSRichard Hendersonfi 527376a347e1SRichard Henderson 52747ebee43eSRichard Henderson######################################### 52757ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 52767ebee43eSRichard Henderson 52777ebee43eSRichard Hendersonatomic128=no 52787ebee43eSRichard Hendersonif test "$int128" = "yes"; then 52797ebee43eSRichard Henderson cat > $TMPC << EOF 52807ebee43eSRichard Hendersonint main(void) 52817ebee43eSRichard Henderson{ 52827ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 52837ebee43eSRichard Henderson y = __atomic_load_16(&x, 0); 52847ebee43eSRichard Henderson __atomic_store_16(&x, y, 0); 52857ebee43eSRichard Henderson __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 52867ebee43eSRichard Henderson return 0; 52877ebee43eSRichard Henderson} 52887ebee43eSRichard HendersonEOF 52897ebee43eSRichard Henderson if compile_prog "" "" ; then 52907ebee43eSRichard Henderson atomic128=yes 52917ebee43eSRichard Henderson fi 52927ebee43eSRichard Hendersonfi 52937ebee43eSRichard Henderson 5294e6cd4bb5SRichard Hendersoncmpxchg128=no 5295e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 5296e6cd4bb5SRichard Henderson cat > $TMPC << EOF 5297e6cd4bb5SRichard Hendersonint main(void) 5298e6cd4bb5SRichard Henderson{ 5299e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 5300e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 5301e6cd4bb5SRichard Henderson return 0; 5302e6cd4bb5SRichard Henderson} 5303e6cd4bb5SRichard HendersonEOF 5304e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 5305e6cd4bb5SRichard Henderson cmpxchg128=yes 5306e6cd4bb5SRichard Henderson fi 5307e6cd4bb5SRichard Hendersonfi 5308e6cd4bb5SRichard Henderson 5309df79b996SRichard Henderson######################################### 5310df79b996SRichard Henderson# See if 64-bit atomic operations are supported. 5311df79b996SRichard Henderson# Note that without __atomic builtins, we can only 5312df79b996SRichard Henderson# assume atomic loads/stores max at pointer size. 5313df79b996SRichard Henderson 5314df79b996SRichard Hendersoncat > $TMPC << EOF 5315df79b996SRichard Henderson#include <stdint.h> 5316df79b996SRichard Hendersonint main(void) 5317df79b996SRichard Henderson{ 5318df79b996SRichard Henderson uint64_t x = 0, y = 0; 5319df79b996SRichard Henderson#ifdef __ATOMIC_RELAXED 53205fe40765SThomas Huth y = __atomic_load_n(&x, __ATOMIC_RELAXED); 53215fe40765SThomas Huth __atomic_store_n(&x, y, __ATOMIC_RELAXED); 53225fe40765SThomas Huth __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); 53235fe40765SThomas Huth __atomic_exchange_n(&x, y, __ATOMIC_RELAXED); 53245fe40765SThomas Huth __atomic_fetch_add(&x, y, __ATOMIC_RELAXED); 5325df79b996SRichard Henderson#else 5326df79b996SRichard Henderson typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5327df79b996SRichard Henderson __sync_lock_test_and_set(&x, y); 5328df79b996SRichard Henderson __sync_val_compare_and_swap(&x, y, 0); 5329df79b996SRichard Henderson __sync_fetch_and_add(&x, y); 5330df79b996SRichard Henderson#endif 5331df79b996SRichard Henderson return 0; 5332df79b996SRichard Henderson} 5333df79b996SRichard HendersonEOF 5334df79b996SRichard Hendersonif compile_prog "" "" ; then 5335df79b996SRichard Henderson atomic64=yes 5336df79b996SRichard Hendersonfi 5337df79b996SRichard Henderson 533826fffe29SEmilio G. Cota######################################### 533926fffe29SEmilio G. Cota# See if --dynamic-list is supported by the linker 534026fffe29SEmilio G. Cotald_dynamic_list="no" 534126fffe29SEmilio G. Cotaif test "$static" = "no" ; then 534226fffe29SEmilio G. Cota cat > $TMPTXT <<EOF 534326fffe29SEmilio G. Cota{ 534426fffe29SEmilio G. Cota foo; 534526fffe29SEmilio G. Cota}; 534626fffe29SEmilio G. CotaEOF 534726fffe29SEmilio G. Cota 534826fffe29SEmilio G. Cota cat > $TMPC <<EOF 534926fffe29SEmilio G. Cota#include <stdio.h> 535026fffe29SEmilio G. Cotavoid foo(void); 535126fffe29SEmilio G. Cota 535226fffe29SEmilio G. Cotavoid foo(void) 535326fffe29SEmilio G. Cota{ 535426fffe29SEmilio G. Cota printf("foo\n"); 535526fffe29SEmilio G. Cota} 535626fffe29SEmilio G. Cota 535726fffe29SEmilio G. Cotaint main(void) 535826fffe29SEmilio G. Cota{ 535926fffe29SEmilio G. Cota foo(); 536026fffe29SEmilio G. Cota return 0; 536126fffe29SEmilio G. Cota} 536226fffe29SEmilio G. CotaEOF 536326fffe29SEmilio G. Cota 536426fffe29SEmilio G. Cota if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 536526fffe29SEmilio G. Cota ld_dynamic_list="yes" 536626fffe29SEmilio G. Cota fi 536726fffe29SEmilio G. Cotafi 536826fffe29SEmilio G. Cota 536926fffe29SEmilio G. Cota######################################### 537026fffe29SEmilio G. Cota# See if -exported_symbols_list is supported by the linker 537126fffe29SEmilio G. Cota 537226fffe29SEmilio G. Cotald_exported_symbols_list="no" 537326fffe29SEmilio G. Cotaif test "$static" = "no" ; then 537426fffe29SEmilio G. Cota cat > $TMPTXT <<EOF 537526fffe29SEmilio G. Cota _foo 537626fffe29SEmilio G. CotaEOF 537726fffe29SEmilio G. Cota 537826fffe29SEmilio G. Cota if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 537926fffe29SEmilio G. Cota ld_exported_symbols_list="yes" 538026fffe29SEmilio G. Cota fi 538126fffe29SEmilio G. Cotafi 538226fffe29SEmilio G. Cota 538326fffe29SEmilio G. Cotaif test "$plugins" = "yes" && 538426fffe29SEmilio G. Cota test "$ld_dynamic_list" = "no" && 538526fffe29SEmilio G. Cota test "$ld_exported_symbols_list" = "no" ; then 538626fffe29SEmilio G. Cota error_exit \ 538726fffe29SEmilio G. Cota "Plugin support requires dynamic linking and specifying a set of symbols " \ 538826fffe29SEmilio G. Cota "that are exported to plugins. Unfortunately your linker doesn't " \ 538926fffe29SEmilio G. Cota "support the flag (--dynamic-list or -exported_symbols_list) used " \ 539026fffe29SEmilio G. Cota "for this purpose. You can't build with --static." 539126fffe29SEmilio G. Cotafi 539226fffe29SEmilio G. Cota 53931e6e9acaSRichard Henderson######################################## 5394db8aaae8SRichard Henderson# See if __attribute__((alias)) is supported. 5395db8aaae8SRichard Henderson# This false for Xcode 9, but has been remedied for Xcode 10. 5396db8aaae8SRichard Henderson# Unfortunately, travis uses Xcode 9 by default. 5397db8aaae8SRichard Henderson 5398db8aaae8SRichard Hendersonattralias=no 5399db8aaae8SRichard Hendersoncat > $TMPC << EOF 5400db8aaae8SRichard Hendersonint x = 1; 5401db8aaae8SRichard Hendersonextern const int y __attribute__((alias("x"))); 5402db8aaae8SRichard Hendersonint main(void) { return 0; } 5403db8aaae8SRichard HendersonEOF 5404db8aaae8SRichard Hendersonif compile_prog "" "" ; then 5405db8aaae8SRichard Henderson attralias=yes 5406db8aaae8SRichard Hendersonfi 5407db8aaae8SRichard Henderson 5408db8aaae8SRichard Henderson######################################## 54091e6e9acaSRichard Henderson# check if getauxval is available. 54101e6e9acaSRichard Henderson 54111e6e9acaSRichard Hendersongetauxval=no 54121e6e9acaSRichard Hendersoncat > $TMPC << EOF 54131e6e9acaSRichard Henderson#include <sys/auxv.h> 54141e6e9acaSRichard Hendersonint main(void) { 54151e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 54161e6e9acaSRichard Henderson} 54171e6e9acaSRichard HendersonEOF 54181e6e9acaSRichard Hendersonif compile_prog "" "" ; then 54191e6e9acaSRichard Henderson getauxval=yes 54201e6e9acaSRichard Hendersonfi 54211e6e9acaSRichard Henderson 5422fd0e6053SJohn Snow######################################## 5423fd0e6053SJohn Snow# check if ccache is interfering with 5424fd0e6053SJohn Snow# semantic analysis of macros 5425fd0e6053SJohn Snow 54265e4dfd3dSJohn Snowunset CCACHE_CPP2 5427fd0e6053SJohn Snowccache_cpp2=no 5428fd0e6053SJohn Snowcat > $TMPC << EOF 5429fd0e6053SJohn Snowstatic const int Z = 1; 5430fd0e6053SJohn Snow#define fn() ({ Z; }) 5431fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 5432fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 5433fd0e6053SJohn Snow#define ID(X) (X) 5434fd0e6053SJohn Snowint main(int argc, char *argv[]) 5435fd0e6053SJohn Snow{ 5436fd0e6053SJohn Snow int x = 0, y = 0; 5437fd0e6053SJohn Snow x = ID(x); 5438fd0e6053SJohn Snow x = fn(); 5439fd0e6053SJohn Snow fn(); 5440fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 5441fd0e6053SJohn Snow if (TAUT(Z)) return 0; 5442fd0e6053SJohn Snow return 0; 5443fd0e6053SJohn Snow} 5444fd0e6053SJohn SnowEOF 5445fd0e6053SJohn Snow 5446fd0e6053SJohn Snowif ! compile_object "-Werror"; then 5447fd0e6053SJohn Snow ccache_cpp2=yes 5448fd0e6053SJohn Snowfi 5449fd0e6053SJohn Snow 5450b553a042SJohn Snow################################################# 5451b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 5452b553a042SJohn Snow 5453b553a042SJohn Snowif test "$fortify_source" != "no"; then 5454b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5455b553a042SJohn Snow fortify_source="no"; 5456e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 5457cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5458b553a042SJohn Snow fortify_source="no"; 5459b553a042SJohn Snow else 5460b553a042SJohn Snow fortify_source="yes" 5461b553a042SJohn Snow fi 5462b553a042SJohn Snowfi 5463b553a042SJohn Snow 54641efad060SFam Zheng############################################### 54651efad060SFam Zheng# Check if copy_file_range is provided by glibc 54661efad060SFam Zhenghave_copy_file_range=no 54671efad060SFam Zhengcat > $TMPC << EOF 54681efad060SFam Zheng#include <unistd.h> 54691efad060SFam Zhengint main(void) { 54701efad060SFam Zheng copy_file_range(0, NULL, 0, NULL, 0, 0); 54711efad060SFam Zheng return 0; 54721efad060SFam Zheng} 54731efad060SFam ZhengEOF 54741efad060SFam Zhengif compile_prog "" "" ; then 54751efad060SFam Zheng have_copy_file_range=yes 54761efad060SFam Zhengfi 54771efad060SFam Zheng 5478d2042378SAneesh Kumar K.V########################################## 5479277abf15SJan Vesely# check if struct fsxattr is available via linux/fs.h 5480277abf15SJan Vesely 5481277abf15SJan Veselyhave_fsxattr=no 5482277abf15SJan Veselycat > $TMPC << EOF 5483277abf15SJan Vesely#include <linux/fs.h> 5484277abf15SJan Veselystruct fsxattr foo; 5485277abf15SJan Veselyint main(void) { 5486277abf15SJan Vesely return 0; 5487277abf15SJan Vesely} 5488277abf15SJan VeselyEOF 5489277abf15SJan Veselyif compile_prog "" "" ; then 5490277abf15SJan Vesely have_fsxattr=yes 5491277abf15SJan Veselyfi 5492277abf15SJan Vesely 5493b66e10e4SPeter Maydell########################################## 5494a40161cbSPaolo Bonzini# check for usable membarrier system call 5495a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 5496a40161cbSPaolo Bonzini have_membarrier=no 5497a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 5498a40161cbSPaolo Bonzini have_membarrier=yes 5499a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 5500a40161cbSPaolo Bonzini cat > $TMPC << EOF 5501a40161cbSPaolo Bonzini #include <linux/membarrier.h> 5502a40161cbSPaolo Bonzini #include <sys/syscall.h> 5503a40161cbSPaolo Bonzini #include <unistd.h> 5504a40161cbSPaolo Bonzini #include <stdlib.h> 5505a40161cbSPaolo Bonzini int main(void) { 5506a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5507a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5508a40161cbSPaolo Bonzini exit(0); 5509a40161cbSPaolo Bonzini } 5510a40161cbSPaolo BonziniEOF 5511a40161cbSPaolo Bonzini if compile_prog "" "" ; then 5512a40161cbSPaolo Bonzini have_membarrier=yes 5513a40161cbSPaolo Bonzini fi 5514a40161cbSPaolo Bonzini fi 5515a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 5516a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 5517a40161cbSPaolo Bonzini fi 5518a40161cbSPaolo Bonzinielse 5519a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 5520a40161cbSPaolo Bonzini # work on Wine. 5521a40161cbSPaolo Bonzini membarrier=no 5522a40161cbSPaolo Bonzinifi 5523a40161cbSPaolo Bonzini 5524a40161cbSPaolo Bonzini########################################## 5525b66e10e4SPeter Maydell# check if rtnetlink.h exists and is useful 5526575b22b1SLaurent Vivierhave_rtnetlink=no 5527575b22b1SLaurent Viviercat > $TMPC << EOF 5528575b22b1SLaurent Vivier#include <linux/rtnetlink.h> 5529575b22b1SLaurent Vivierint main(void) { 5530575b22b1SLaurent Vivier return IFLA_PROTO_DOWN; 5531575b22b1SLaurent Vivier} 5532575b22b1SLaurent VivierEOF 5533575b22b1SLaurent Vivierif compile_prog "" "" ; then 5534575b22b1SLaurent Vivier have_rtnetlink=yes 5535575b22b1SLaurent Vivierfi 5536575b22b1SLaurent Vivier 55376a02c806SStefan Hajnoczi########################################## 55386a02c806SStefan Hajnoczi# check for usable AF_VSOCK environment 55396a02c806SStefan Hajnoczihave_af_vsock=no 55406a02c806SStefan Hajnoczicat > $TMPC << EOF 55416a02c806SStefan Hajnoczi#include <errno.h> 55426a02c806SStefan Hajnoczi#include <sys/types.h> 55436a02c806SStefan Hajnoczi#include <sys/socket.h> 55446a02c806SStefan Hajnoczi#if !defined(AF_VSOCK) 55456a02c806SStefan Hajnoczi# error missing AF_VSOCK flag 55466a02c806SStefan Hajnoczi#endif 55476a02c806SStefan Hajnoczi#include <linux/vm_sockets.h> 55486a02c806SStefan Hajnocziint main(void) { 55496a02c806SStefan Hajnoczi int sock, ret; 55506a02c806SStefan Hajnoczi struct sockaddr_vm svm; 55516a02c806SStefan Hajnoczi socklen_t len = sizeof(svm); 55526a02c806SStefan Hajnoczi sock = socket(AF_VSOCK, SOCK_STREAM, 0); 55536a02c806SStefan Hajnoczi ret = getpeername(sock, (struct sockaddr *)&svm, &len); 55546a02c806SStefan Hajnoczi if ((ret == -1) && (errno == ENOTCONN)) { 55556a02c806SStefan Hajnoczi return 0; 55566a02c806SStefan Hajnoczi } 55576a02c806SStefan Hajnoczi return -1; 55586a02c806SStefan Hajnoczi} 55596a02c806SStefan HajnocziEOF 55606a02c806SStefan Hajnocziif compile_prog "" "" ; then 55616a02c806SStefan Hajnoczi have_af_vsock=yes 55626a02c806SStefan Hajnoczifi 55636a02c806SStefan Hajnoczi 5564f0d92b56SLongpeng(Mike)########################################## 5565f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 55664f67366eSThomas Huthhave_afalg=no 5567f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 5568f0d92b56SLongpeng(Mike)#include <errno.h> 5569f0d92b56SLongpeng(Mike)#include <sys/types.h> 5570f0d92b56SLongpeng(Mike)#include <sys/socket.h> 5571f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 5572f0d92b56SLongpeng(Mike)int main(void) { 5573f0d92b56SLongpeng(Mike) int sock; 5574f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 5575f0d92b56SLongpeng(Mike) return sock; 5576f0d92b56SLongpeng(Mike)} 5577f0d92b56SLongpeng(Mike)EOF 5578f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 5579f0d92b56SLongpeng(Mike) have_afalg=yes 5580f0d92b56SLongpeng(Mike)fi 5581f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 5582f0d92b56SLongpeng(Mike)then 5583f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 5584f0d92b56SLongpeng(Mike) then 5585f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 5586f0d92b56SLongpeng(Mike) fi 5587f0d92b56SLongpeng(Mike)fi 5588f0d92b56SLongpeng(Mike) 5589f0d92b56SLongpeng(Mike) 55906969ec6cSJames Clarke################################################# 55914d04351fSChristopher Covington# check for sysmacros.h 55924d04351fSChristopher Covington 55934d04351fSChristopher Covingtonhave_sysmacros=no 55944d04351fSChristopher Covingtoncat > $TMPC << EOF 55954d04351fSChristopher Covington#include <sys/sysmacros.h> 55964d04351fSChristopher Covingtonint main(void) { 55974d04351fSChristopher Covington return makedev(0, 0); 55984d04351fSChristopher Covington} 55994d04351fSChristopher CovingtonEOF 56004d04351fSChristopher Covingtonif compile_prog "" "" ; then 56014d04351fSChristopher Covington have_sysmacros=yes 56024d04351fSChristopher Covingtonfi 56034d04351fSChristopher Covington 56044d04351fSChristopher Covington########################################## 560549e00a18SAndreas Grapentin# check for _Static_assert() 560649e00a18SAndreas Grapentin 560749e00a18SAndreas Grapentinhave_static_assert=no 560849e00a18SAndreas Grapentincat > $TMPC << EOF 560949e00a18SAndreas Grapentin_Static_assert(1, "success"); 561049e00a18SAndreas Grapentinint main(void) { 561149e00a18SAndreas Grapentin return 0; 561249e00a18SAndreas Grapentin} 561349e00a18SAndreas GrapentinEOF 561449e00a18SAndreas Grapentinif compile_prog "" "" ; then 561549e00a18SAndreas Grapentin have_static_assert=yes 561649e00a18SAndreas Grapentinfi 561749e00a18SAndreas Grapentin 561849e00a18SAndreas Grapentin########################################## 5619e674605fSTomáš Golembiovský# check for utmpx.h, it is missing e.g. on OpenBSD 5620e674605fSTomáš Golembiovský 5621e674605fSTomáš Golembiovskýhave_utmpx=no 5622e674605fSTomáš Golembiovskýcat > $TMPC << EOF 5623e674605fSTomáš Golembiovský#include <utmpx.h> 5624e674605fSTomáš Golembiovskýstruct utmpx user_info; 5625e674605fSTomáš Golembiovskýint main(void) { 5626e674605fSTomáš Golembiovský return 0; 5627e674605fSTomáš Golembiovský} 5628e674605fSTomáš GolembiovskýEOF 5629e674605fSTomáš Golembiovskýif compile_prog "" "" ; then 5630e674605fSTomáš Golembiovský have_utmpx=yes 5631e674605fSTomáš Golembiovskýfi 5632e674605fSTomáš Golembiovský 5633e674605fSTomáš Golembiovský########################################## 5634db1ed1abSRichard Henderson# check for getrandom() 5635db1ed1abSRichard Henderson 5636db1ed1abSRichard Hendersonhave_getrandom=no 5637db1ed1abSRichard Hendersoncat > $TMPC << EOF 5638db1ed1abSRichard Henderson#include <sys/random.h> 5639db1ed1abSRichard Hendersonint main(void) { 5640db1ed1abSRichard Henderson return getrandom(0, 0, GRND_NONBLOCK); 5641db1ed1abSRichard Henderson} 5642db1ed1abSRichard HendersonEOF 5643db1ed1abSRichard Hendersonif compile_prog "" "" ; then 5644db1ed1abSRichard Henderson have_getrandom=yes 5645db1ed1abSRichard Hendersonfi 5646db1ed1abSRichard Henderson 5647db1ed1abSRichard Henderson########################################## 5648247724cbSMarc-André Lureau# checks for sanitizers 5649247724cbSMarc-André Lureau 5650247724cbSMarc-André Lureauhave_asan=no 5651247724cbSMarc-André Lureauhave_ubsan=no 5652d83414e1SMarc-André Lureauhave_asan_iface_h=no 5653d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 5654247724cbSMarc-André Lureau 5655247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 5656b9f44da2SMarc-André Lureau write_c_skeleton 5657247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 5658247724cbSMarc-André Lureau have_asan=yes 5659247724cbSMarc-André Lureau fi 5660b9f44da2SMarc-André Lureau 5661b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 5662b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 5663b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 5664b9f44da2SMarc-André Lureau cat > $TMPC << EOF 5665b9f44da2SMarc-André Lureau#include <stdlib.h> 5666b9f44da2SMarc-André Lureauint main(void) { 5667b9f44da2SMarc-André Lureau void *tmp = malloc(10); 5668f2dfe54cSLeonid Bloch if (tmp != NULL) { 5669b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 5670b9f44da2SMarc-André Lureau } 5671d1abf3fcSOlaf Hering return 1; 5672f2dfe54cSLeonid Bloch} 5673b9f44da2SMarc-André LureauEOF 5674247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 5675247724cbSMarc-André Lureau have_ubsan=yes 5676247724cbSMarc-André Lureau fi 5677d83414e1SMarc-André Lureau 5678d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 5679d83414e1SMarc-André Lureau have_asan_iface_h=yes 5680d83414e1SMarc-André Lureau fi 5681d83414e1SMarc-André Lureau 5682d83414e1SMarc-André Lureau cat > $TMPC << EOF 5683d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 5684d83414e1SMarc-André Lureauint main(void) { 5685d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 5686d83414e1SMarc-André Lureau return 0; 5687d83414e1SMarc-André Lureau} 5688d83414e1SMarc-André LureauEOF 5689d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 5690d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 5691d83414e1SMarc-André Lureau fi 5692247724cbSMarc-André Lureaufi 5693247724cbSMarc-André Lureau 5694247724cbSMarc-André Lureau########################################## 5695adc28027SAlexander Bulekov# checks for fuzzer 569654c9e41dSAlexander Bulekovif test "$fuzzing" = "yes" && test -z "${LIB_FUZZING_ENGINE+xxx}"; then 5697adc28027SAlexander Bulekov write_c_fuzzer_skeleton 5698dd016265SAlexander Bulekov if compile_prog "$CPU_CFLAGS -Werror -fsanitize=fuzzer" ""; then 5699adc28027SAlexander Bulekov have_fuzzer=yes 570064ed6f92SPaolo Bonzini else 570164ed6f92SPaolo Bonzini error_exit "Your compiler doesn't support -fsanitize=fuzzer" 570264ed6f92SPaolo Bonzini exit 1 5703adc28027SAlexander Bulekov fi 5704adc28027SAlexander Bulekovfi 5705adc28027SAlexander Bulekov 57060aebab04SLingfeng Yang# Thread sanitizer is, for now, much noisier than the other sanitizers; 57070aebab04SLingfeng Yang# keep it separate until that is not the case. 57080aebab04SLingfeng Yangif test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 57090aebab04SLingfeng Yang error_exit "TSAN is not supported with other sanitiziers." 57100aebab04SLingfeng Yangfi 57110aebab04SLingfeng Yanghave_tsan=no 57120aebab04SLingfeng Yanghave_tsan_iface_fiber=no 57130aebab04SLingfeng Yangif test "$tsan" = "yes" ; then 57140aebab04SLingfeng Yang write_c_skeleton 57150aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 57160aebab04SLingfeng Yang have_tsan=yes 57170aebab04SLingfeng Yang fi 57180aebab04SLingfeng Yang cat > $TMPC << EOF 57190aebab04SLingfeng Yang#include <sanitizer/tsan_interface.h> 57200aebab04SLingfeng Yangint main(void) { 57210aebab04SLingfeng Yang __tsan_create_fiber(0); 57220aebab04SLingfeng Yang return 0; 57230aebab04SLingfeng Yang} 57240aebab04SLingfeng YangEOF 57250aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 57260aebab04SLingfeng Yang have_tsan_iface_fiber=yes 57270aebab04SLingfeng Yang fi 57280aebab04SLingfeng Yangfi 57290aebab04SLingfeng Yang 5730adc28027SAlexander Bulekov########################################## 573117824406SJunyan He# check for libpmem 573217824406SJunyan He 573317824406SJunyan Heif test "$libpmem" != "no"; then 573417824406SJunyan He if $pkg_config --exists "libpmem"; then 573517824406SJunyan He libpmem="yes" 573617824406SJunyan He libpmem_libs=$($pkg_config --libs libpmem) 573717824406SJunyan He libpmem_cflags=$($pkg_config --cflags libpmem) 573817824406SJunyan He else 573917824406SJunyan He if test "$libpmem" = "yes" ; then 574017824406SJunyan He feature_not_found "libpmem" "Install nvml or pmdk" 574117824406SJunyan He fi 574217824406SJunyan He libpmem="no" 574317824406SJunyan He fi 574417824406SJunyan Hefi 574517824406SJunyan He 574617824406SJunyan He########################################## 574721b2eca6SJingqi Liu# check for libdaxctl 574821b2eca6SJingqi Liu 574921b2eca6SJingqi Liuif test "$libdaxctl" != "no"; then 575021b2eca6SJingqi Liu if $pkg_config --atleast-version=57 "libdaxctl"; then 575121b2eca6SJingqi Liu libdaxctl="yes" 575221b2eca6SJingqi Liu libdaxctl_libs=$($pkg_config --libs libdaxctl) 575321b2eca6SJingqi Liu libdaxctl_cflags=$($pkg_config --cflags libdaxctl) 575421b2eca6SJingqi Liu else 575521b2eca6SJingqi Liu if test "$libdaxctl" = "yes" ; then 575621b2eca6SJingqi Liu feature_not_found "libdaxctl" "Install libdaxctl" 575721b2eca6SJingqi Liu fi 575821b2eca6SJingqi Liu libdaxctl="no" 575921b2eca6SJingqi Liu fi 576021b2eca6SJingqi Liufi 576121b2eca6SJingqi Liu 576221b2eca6SJingqi Liu########################################## 5763675b9b53SMarc-André Lureau# check for slirp 5764675b9b53SMarc-André Lureau 5765675b9b53SMarc-André Lureaucase "$slirp" in 57664d34a86bSPaolo Bonzini auto | enabled | internal) 57674d34a86bSPaolo Bonzini # Simpler to always update submodule, even if not needed. 57684d34a86bSPaolo Bonzini if test -e "${source_path}/.git" && test $git_update = 'yes' ; then 57697c57bdd8SMarc-André Lureau git_submodules="${git_submodules} slirp" 57707c57bdd8SMarc-André Lureau fi 5771675b9b53SMarc-André Lureau ;; 5772675b9b53SMarc-André Lureauesac 5773675b9b53SMarc-André Lureau 577454e7aac0SAlexey Krasikov########################################## 577554e7aac0SAlexey Krasikov# check for usable __NR_keyctl syscall 577654e7aac0SAlexey Krasikov 577754e7aac0SAlexey Krasikovif test "$linux" = "yes" ; then 577854e7aac0SAlexey Krasikov 577954e7aac0SAlexey Krasikov have_keyring=no 578054e7aac0SAlexey Krasikov cat > $TMPC << EOF 578154e7aac0SAlexey Krasikov#include <errno.h> 578254e7aac0SAlexey Krasikov#include <asm/unistd.h> 578354e7aac0SAlexey Krasikov#include <linux/keyctl.h> 578454e7aac0SAlexey Krasikov#include <unistd.h> 578554e7aac0SAlexey Krasikovint main(void) { 578654e7aac0SAlexey Krasikov return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 578754e7aac0SAlexey Krasikov} 578854e7aac0SAlexey KrasikovEOF 578954e7aac0SAlexey Krasikov if compile_prog "" "" ; then 579054e7aac0SAlexey Krasikov have_keyring=yes 579154e7aac0SAlexey Krasikov fi 579254e7aac0SAlexey Krasikovfi 579354e7aac0SAlexey Krasikovif test "$secret_keyring" != "no" 579454e7aac0SAlexey Krasikovthen 5795b418d265SDavid Edmondson if test "$have_keyring" = "yes" 579654e7aac0SAlexey Krasikov then 579754e7aac0SAlexey Krasikov secret_keyring=yes 579854e7aac0SAlexey Krasikov else 579954e7aac0SAlexey Krasikov if test "$secret_keyring" = "yes" 580054e7aac0SAlexey Krasikov then 580154e7aac0SAlexey Krasikov error_exit "syscall __NR_keyctl requested, \ 580254e7aac0SAlexey Krasikovbut not implemented on your system" 580354e7aac0SAlexey Krasikov else 580454e7aac0SAlexey Krasikov secret_keyring=no 580554e7aac0SAlexey Krasikov fi 580654e7aac0SAlexey Krasikov fi 580754e7aac0SAlexey Krasikovfi 580854e7aac0SAlexey Krasikov 580992500362SAlexey Krasikov########################################## 5810e86ecd4bSJuan Quintela# End of CC checks 5811e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 5812e86ecd4bSJuan Quintela 5813d83414e1SMarc-André Lureauwrite_c_skeleton 5814d83414e1SMarc-André Lureau 58151d728c39SBlue Swirlif test "$gcov" = "yes" ; then 5816bf0e56a3SMarc-André Lureau : 5817b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 5818086d5f75SPaolo Bonzini QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 5819086d5f75SPaolo Bonzini debug=no 5820086d5f75SPaolo Bonzinifi 5821086d5f75SPaolo Bonzini 5822086d5f75SPaolo Bonzinicase "$ARCH" in 5823086d5f75SPaolo Bonzinialpha) 5824086d5f75SPaolo Bonzini # Ensure there's only a single GP 5825086d5f75SPaolo Bonzini QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 5826086d5f75SPaolo Bonzini;; 5827086d5f75SPaolo Bonziniesac 5828086d5f75SPaolo Bonzini 5829086d5f75SPaolo Bonziniif test "$gprof" = "yes" ; then 5830086d5f75SPaolo Bonzini QEMU_CFLAGS="-p $QEMU_CFLAGS" 5831086d5f75SPaolo Bonzini QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 5832086d5f75SPaolo Bonzinifi 5833a316e378SJuan Quintela 5834247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 5835db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 5836db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 5837d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 5838d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 5839d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5840d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 5841d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 5842d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5843d83414e1SMarc-André Lureau fi 5844247724cbSMarc-André Lureaufi 58450aebab04SLingfeng Yangif test "$have_tsan" = "yes" ; then 58460aebab04SLingfeng Yang if test "$have_tsan_iface_fiber" = "yes" ; then 58470aebab04SLingfeng Yang QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 58480aebab04SLingfeng Yang QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 58490aebab04SLingfeng Yang else 58500aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing fiber annotation interface." 58510aebab04SLingfeng Yang fi 58520aebab04SLingfeng Yangelif test "$tsan" = "yes" ; then 58530aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing sanitize thread interface." 58540aebab04SLingfeng Yangfi 5855247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 5856db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 5857db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 5858247724cbSMarc-André Lureaufi 5859247724cbSMarc-André Lureau 58606542aa9cSPeter Lieven########################################## 58616542aa9cSPeter Lieven# Do we have libnfs 58626542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 5863b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 58646542aa9cSPeter Lieven libnfs="yes" 58656542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 58666542aa9cSPeter Lieven else 58676542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 58688efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 58696542aa9cSPeter Lieven fi 58706542aa9cSPeter Lieven libnfs="no" 58716542aa9cSPeter Lieven fi 58726542aa9cSPeter Lievenfi 58731d728c39SBlue Swirl 58743efac6ebSTomáš Golembiovský########################################## 58753efac6ebSTomáš Golembiovský 58760aebab04SLingfeng Yang# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 58770aebab04SLingfeng Yangif test "$solaris" = "no" && test "$tsan" = "no"; then 5878e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 5879db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 5880e86ecd4bSJuan Quintela fi 5881e86ecd4bSJuan Quintelafi 5882e86ecd4bSJuan Quintela 5883952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 5884952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 5885cb8baa77SMark Cave-Ayland flags="--no-seh --nxcompat" 5886cb8baa77SMark Cave-Ayland 5887cb8baa77SMark Cave-Ayland # Disable ASLR for debug builds to allow debugging with gdb 5888cb8baa77SMark Cave-Ayland if test "$debug" = "no" ; then 5889cb8baa77SMark Cave-Ayland flags="--dynamicbase $flags" 5890cb8baa77SMark Cave-Ayland fi 5891cb8baa77SMark Cave-Ayland 5892cb8baa77SMark Cave-Ayland for flag in $flags; do 5893e9a3591fSChristian Borntraeger if ld_has $flag ; then 5894db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 5895952afb71SBlue Swirl fi 5896952afb71SBlue Swirl done 5897952afb71SBlue Swirlfi 5898952afb71SBlue Swirl 589910ff82d1SMarc-André Lureauqemu_confdir="$sysconfdir/$qemu_suffix" 590010ff82d1SMarc-André Lureauqemu_moddir="$libdir/$qemu_suffix" 590110ff82d1SMarc-André Lureauqemu_datadir="$datadir/$qemu_suffix" 5902ca8c0909SMarc-André Lureauqemu_docdir="$docdir/$qemu_suffix" 5903834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 5904a8260d38SDaniel P. Berrangéqemu_icondir="$datadir/icons" 590567ea9546SDaniel P. Berrangéqemu_desktopdir="$datadir/applications" 59065a67135aSbellard 5907e0580342SKamil Rytarowski# We can only support ivshmem if we have eventfd 5908e0580342SKamil Rytarowskiif [ "$eventfd" = "yes" ]; then 5909e0580342SKamil Rytarowski ivshmem=yes 5910e0580342SKamil Rytarowskifi 5911e0580342SKamil Rytarowski 59124b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 5913b855f8d1SPaolo Bonzini if test "$linux" = yes; then 59147e462613SPaolo Bonzini if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then 5915983eef5aSMeador Inge virtfs=yes 5916983eef5aSMeador Inge else 5917983eef5aSMeador Inge if test "$virtfs" = yes; then 59187e462613SPaolo Bonzini error_exit "VirtFS requires libcap-ng devel and libattr devel" 5919983eef5aSMeador Inge fi 592017500370SAndreas Färber virtfs=no 5921983eef5aSMeador Inge fi 5922b855f8d1SPaolo Bonzini else 5923b855f8d1SPaolo Bonzini if test "$virtfs" = yes; then 5924b855f8d1SPaolo Bonzini error_exit "VirtFS is supported only on Linux" 5925b855f8d1SPaolo Bonzini fi 5926b855f8d1SPaolo Bonzini virtfs=no 592717bff52bSM. Mohan Kumar fi 5928ff69fd8cSLaurent Vivierfi 59299d6bc27bSMichael Roth 59309d6bc27bSMichael Roth# Probe for guest agent support/options 59319d6bc27bSMichael Roth 5932e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 5933a5125905SLaurent Vivier if [ "$softmmu" = no -a "$want_tools" = no ] ; then 5934a5125905SLaurent Vivier guest_agent=no 5935a5125905SLaurent Vivier elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 5936e8ef31a3SMichael Tokarev guest_agent=yes 5937e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 5938e8ef31a3SMichael Tokarev guest_agent=no 5939e8ef31a3SMichael Tokarev else 5940e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 5941ca35f780SPaolo Bonzini fi 59424b1c11fdSDaniel P. Berrangefi 5943ca35f780SPaolo Bonzini 59449d6bc27bSMichael Roth# Guest agent Window MSI package 59459d6bc27bSMichael Roth 59469d6bc27bSMichael Rothif test "$guest_agent" != yes; then 59479d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 59489d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 59499d6bc27bSMichael Roth fi 59509d6bc27bSMichael Roth guest_agent_msi=no 59519d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 59529d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 59539d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 59549d6bc27bSMichael Roth fi 59559d6bc27bSMichael Roth guest_agent_msi=no 59569d6bc27bSMichael Rothelif ! has wixl; then 59579d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 59589d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 59599d6bc27bSMichael Roth fi 59609d6bc27bSMichael Roth guest_agent_msi=no 59611a34904eSMichael Rothelse 59621a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 59631a34904eSMichael Roth # disabled explicitly 59641a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 59651a34904eSMichael Roth guest_agent_msi=yes 59661a34904eSMichael Roth fi 59679d6bc27bSMichael Rothfi 59689d6bc27bSMichael Roth 59691a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 59709d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 59719d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 59729d6bc27bSMichael Roth fi 59739d6bc27bSMichael Roth 59749d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 59759d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 59769d6bc27bSMichael Roth fi 59779d6bc27bSMichael Roth 59789d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 59799d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 59809d6bc27bSMichael Roth fi 59819d6bc27bSMichael Roth 59829d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 598389138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 59849d6bc27bSMichael Roth fi 59859d6bc27bSMichael Roth 598689138857SStefan Weil QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 59879d6bc27bSMichael Roth 59889d6bc27bSMichael Roth case "$cpu" in 59899d6bc27bSMichael Roth x86_64) 59909d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 59919d6bc27bSMichael Roth ;; 59929d6bc27bSMichael Roth i386) 59939d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 59949d6bc27bSMichael Roth ;; 59959d6bc27bSMichael Roth *) 59969d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 59979d6bc27bSMichael Roth ;; 59989d6bc27bSMichael Roth esac 59999d6bc27bSMichael Rothfi 60009d6bc27bSMichael Roth 6001ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 6002ca35f780SPaolo Bonziniroms= 6003e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 6004e633a5c6SEric Blake test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 6005e633a5c6SEric Blake test "$softmmu" = yes ; then 6006e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 6007c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 6008c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 6009c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 6010e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 6011e57218b6SPeter Maydell ld_i386_emulation="$emu" 6012ca35f780SPaolo Bonzini roms="optionrom" 6013e57218b6SPeter Maydell break 6014e57218b6SPeter Maydell fi 6015e57218b6SPeter Maydell done 6016ca35f780SPaolo Bonzinifi 6017ca35f780SPaolo Bonzini 60182e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 60199933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 60202e33c3f8SThomas Huth write_c_skeleton 60212e33c3f8SThomas Huth if compile_prog "-march=z900" ""; then 60229933c305SChristian Borntraeger roms="$roms s390-ccw" 60231ef6bfc2SPhilippe Mathieu-Daudé # SLOF is required for building the s390-ccw firmware on s390x, 60241ef6bfc2SPhilippe Mathieu-Daudé # since it is using the libnet code from SLOF for network booting. 60251ef6bfc2SPhilippe Mathieu-Daudé if test -e "${source_path}/.git" ; then 60261ef6bfc2SPhilippe Mathieu-Daudé git_submodules="${git_submodules} roms/SLOF" 60271ef6bfc2SPhilippe Mathieu-Daudé fi 60289933c305SChristian Borntraeger fi 60292e33c3f8SThomas Huthfi 60309933c305SChristian Borntraeger 603111cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 603211cde1c8SBruno 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. 603311cde1c8SBruno Dominguezif has $cxx; then 603411cde1c8SBruno Dominguez cat > $TMPC <<EOF 603511cde1c8SBruno Dominguezint c_function(void); 603611cde1c8SBruno Dominguezint main(void) { return c_function(); } 603711cde1c8SBruno DominguezEOF 603811cde1c8SBruno Dominguez 603911cde1c8SBruno Dominguez compile_object 604011cde1c8SBruno Dominguez 604111cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 604211cde1c8SBruno Dominguezextern "C" { 604311cde1c8SBruno Dominguez int c_function(void); 604411cde1c8SBruno Dominguez} 604511cde1c8SBruno Dominguezint c_function(void) { return 42; } 604611cde1c8SBruno DominguezEOF 604711cde1c8SBruno Dominguez 604811cde1c8SBruno Dominguez update_cxxflags 604911cde1c8SBruno Dominguez 60505770e8afSPaolo Bonzini if do_cxx $CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 605111cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 605211cde1c8SBruno Dominguez : 605311cde1c8SBruno Dominguez else 605411cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 605511cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 605611cde1c8SBruno Dominguez cxx= 605711cde1c8SBruno Dominguez fi 605811cde1c8SBruno Dominguezelse 605911cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 606011cde1c8SBruno Dominguez cxx= 606111cde1c8SBruno Dominguezfi 606211cde1c8SBruno Dominguez 60635d91a2edSYonggang Luoif test $git_update = 'yes' ; then 60645d91a2edSYonggang Luo (cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update "$git_submodules") 60655d91a2edSYonggang Luofi 60665d91a2edSYonggang Luo 606798ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 606897a847bcSbellard 606998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 607098ec69acSJuan Quintelaecho >> $config_host_mak 607198ec69acSJuan Quintela 6072e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 607399d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 607499d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 60753aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 60768bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 60770f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 607899d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 607922d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 60809afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 60813d5eecabSGerd Hoffmannecho "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 6082e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 60835a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 6084785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 60855a699bbbSLaszlo Ersekfi 6086f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 6087834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 6088a8260d38SDaniel P. Berrangéecho "qemu_icondir=$qemu_icondir" >> $config_host_mak 608967ea9546SDaniel P. Berrangéecho "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak 6090cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 6091aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6092f62bbee5SDaniel P. Berrangeecho "GIT_UPDATE=$git_update" >> $config_host_mak 6093804edf29SJuan Quintela 609498ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 6095727e5283SPaolo Bonzini 6096f3494749SPaolo Bonziniif test "$default_devices" = "yes" ; then 6097f3494749SPaolo Bonzini echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak 6098f3494749SPaolo Bonzinielse 6099f3494749SPaolo Bonzini echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak 6100f3494749SPaolo Bonzinifi 6101f8393946Saurel32if test "$debug_tcg" = "yes" ; then 61022358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6103f8393946Saurel32fi 61041625af87Saliguoriif test "$strip_opt" = "yes" ; then 610552ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 61061625af87Saliguorifi 61077d13299dSbellardif test "$bigendian" = "yes" ; then 6108e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 610997a847bcSbellardfi 611067b915a5Sbellardif test "$mingw32" = "yes" ; then 611198ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 611289138857SStefan Weil rc_version=$(cat $source_path/VERSION) 61139fe6de94SBlue Swirl version_major=${rc_version%%.*} 61149fe6de94SBlue Swirl rc_version=${rc_version#*.} 61159fe6de94SBlue Swirl version_minor=${rc_version%%.*} 61169fe6de94SBlue Swirl rc_version=${rc_version#*.} 61179fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 61189fe6de94SBlue Swirl version_micro=0 61199fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 61209fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6121d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 6122d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6123f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6124d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6125d9840e25STomoki Sekiyama fi 612650cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 612776dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 612850cbebb9SMichael Roth fi 61291a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 61304bad7c3bSStefan Hajnoczi echo "CONFIG_QGA_MSI=y" >> $config_host_mak 61319dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 61329dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 61339dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 61349dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 61359dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 61369dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 61379dacf32dSYossi Hindin fi 6138210fa556Spbrookelse 613935f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 6140210fa556Spbrookfi 6141128ab2ffSblueswir1 6142dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 6143dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 6144dffcb71cSMark McLoughlinfi 6145dffcb71cSMark McLoughlin 614683fb7adfSbellardif test "$darwin" = "yes" ; then 614798ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 614883fb7adfSbellardfi 6149b29fe3edSmalc 6150ec530c81Sbellardif test "$solaris" = "yes" ; then 615198ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 6152ec530c81Sbellardfi 6153179cf400SAndreas Färberif test "$haiku" = "yes" ; then 6154179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 6155179cf400SAndreas Färberfi 615697a847bcSbellardif test "$static" = "yes" ; then 615798ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 615897a847bcSbellardfi 61591ba16968SStefan Weilif test "$profiler" = "yes" ; then 61602358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 616105c2a3e7Sbellardfi 6162c932ce31SPaolo Bonziniif test "$want_tools" = "yes" ; then 6163c932ce31SPaolo Bonzini echo "CONFIG_TOOLS=y" >> $config_host_mak 6164c932ce31SPaolo Bonzinifi 6165f15bff25SPaolo Bonziniif test "$guest_agent" = "yes" ; then 6166f15bff25SPaolo Bonzini echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak 6167f15bff25SPaolo Bonzinifi 6168e2d8830eSBradecho "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 61698a16d273Sthsif test "$vde" = "yes" ; then 617098ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 6171e2ad6f16SFam Zheng echo "VDE_LIBS=$vde_libs" >> $config_host_mak 61728a16d273Sthsfi 617358952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 617458952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 617558952137SVincenzo Maffionefi 6176015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 6177015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 6178015a33bdSGongleifi 61794cc600d2SPaolo Bonziniif test "$gprof" = "yes" ; then 61804cc600d2SPaolo Bonzini echo "CONFIG_GPROF=y" >> $config_host_mak 61814cc600d2SPaolo Bonzinifi 618247e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 6183a358bca2SPaolo Bonzini echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak 61843f99cf57SPaolo Bonzini echo "LIBCAP_NG_LIBS=$cap_libs" >> $config_host_mak 618547e98658SCorey Bryantfi 61862358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 61870c58ac1cSmalcfor drv in $audio_drv_list; do 61881ef1ec2aSGerd Hoffmann def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 6189484e2cc7SPaolo Bonzini echo "$def=y" >> $config_host_mak 61900c58ac1cSmalcdone 6191478e943fSPaolo Bonziniif test "$alsa" = "yes" ; then 6192478e943fSPaolo Bonzini echo "CONFIG_ALSA=y" >> $config_host_mak 6193478e943fSPaolo Bonzinifi 6194b1149911SFam Zhengecho "ALSA_LIBS=$alsa_libs" >> $config_host_mak 6195478e943fSPaolo Bonziniecho "ALSA_CFLAGS=$alsa_cflags" >> $config_host_mak 6196478e943fSPaolo Bonziniif test "$libpulse" = "yes" ; then 6197478e943fSPaolo Bonzini echo "CONFIG_LIBPULSE=y" >> $config_host_mak 6198478e943fSPaolo Bonzinifi 6199b1149911SFam Zhengecho "PULSE_LIBS=$pulse_libs" >> $config_host_mak 6200478e943fSPaolo Bonziniecho "PULSE_CFLAGS=$pulse_cflags" >> $config_host_mak 6201b1149911SFam Zhengecho "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 6202b1149911SFam Zhengecho "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 6203b1149911SFam Zhengecho "OSS_LIBS=$oss_libs" >> $config_host_mak 6204478e943fSPaolo Bonziniif test "$libjack" = "yes" ; then 6205478e943fSPaolo Bonzini echo "CONFIG_LIBJACK=y" >> $config_host_mak 6206478e943fSPaolo Bonzinifi 62072e445703SGeoffrey McRaeecho "JACK_LIBS=$jack_libs" >> $config_host_mak 6208d5631638Smalcif test "$audio_win_int" = "yes" ; then 6209d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 6210d5631638Smalcfi 6211b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 6212b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 6213dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 6214dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 6215dce512deSChristoph Hellwigfi 621689138857SStefan Weilqemu_version=$(head $source_path/VERSION) 62172358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 621898ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 62192b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 6220a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 622198ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 6222cc8ae6deSpbrookfi 622317969268SFam Zhengif test "$modules" = "yes"; then 6224e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 6225e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 622689138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 622717969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 622817969268SFam Zhengfi 6229bd83c861SChristian Ehrhardtif test "$module_upgrades" = "yes"; then 6230bd83c861SChristian Ehrhardt echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 6231bd83c861SChristian Ehrhardtfi 6232e633a5c6SEric Blakeif test "$have_x11" = "yes" && test "$need_x11" = "yes"; then 62338781595bSGerd Hoffmann echo "CONFIG_X11=y" >> $config_host_mak 62348781595bSGerd Hoffmann echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 62358781595bSGerd Hoffmann echo "X11_LIBS=$x11_libs" >> $config_host_mak 62368781595bSGerd Hoffmannfi 6237e08bb301SSamuel Thibaultif test "$iconv" = "yes" ; then 6238e08bb301SSamuel Thibault echo "CONFIG_ICONV=y" >> $config_host_mak 6239e08bb301SSamuel Thibault echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak 6240e08bb301SSamuel Thibault echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak 6241e08bb301SSamuel Thibaultfi 62424d3b6f6eSbalrogif test "$curses" = "yes" ; then 6243484e2cc7SPaolo Bonzini echo "CONFIG_CURSES=y" >> $config_host_mak 62442373f7d5SGerd Hoffmann echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 62452373f7d5SGerd Hoffmann echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 6246ab4e5602SJan Kiszkafi 6247099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 62482358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 6249099d6b0fSRiku Voipiofi 625040ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 625140ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 625240ff6d7eSKevin Wolffi 62533ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 62542358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 62553ce34dfbSvibisreenivasanfi 6256c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 6257c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 6258c2882b96SRiku Voipiofi 6259751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 6260751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 6261751bcc39SMarc-André Lureaufi 6262955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 6263955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 6264955727d2SCortland Tölvafi 6265d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 6266d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 6267d0927938SUlrich Hechtfi 62683d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 62693d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 62703d4fa43eSKusanagi Kouichifi 6271b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 6272b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 6273b953f075SDenis V. Lunevfi 6274ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 6275ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 6276ed911435SKevin Wolffi 6277c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 6278c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 6279c727f47dSPeter Maydellfi 6280dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 6281dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 6282dace20dcSPeter Maydellfi 6283d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 6284d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 6285d0927938SUlrich Hechtfi 62864e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 62874e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 62884e0c6529SAlex Blighfi 6289cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 6290cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 6291cd758dd0SAlex Blighfi 62923b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 62933b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 62943b6edd16SPeter Maydellfi 62953b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 62963b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 62973b6edd16SPeter Maydellfi 6298a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 6299a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 6300a8fd1abaSPeter Maydellfi 630151834341SRiku Voipioif test "$timerfd" = "yes" ; then 630251834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 630351834341SRiku Voipiofi 63049af5c906SRiku Voipioif test "$setns" = "yes" ; then 63059af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 63069af5c906SRiku Voipiofi 630738860a03SAleksandar Markovicif test "$clock_adjtime" = "yes" ; then 630838860a03SAleksandar Markovic echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 630938860a03SAleksandar Markovicfi 63105a03cd00SAleksandar Markovicif test "$syncfs" = "yes" ; then 63115a03cd00SAleksandar Markovic echo "CONFIG_SYNCFS=y" >> $config_host_mak 63125a03cd00SAleksandar Markovicfi 6313db37dd89SAleksandar Markovicif test "$kcov" = "yes" ; then 6314db37dd89SAleksandar Markovic echo "CONFIG_KCOV=y" >> $config_host_mak 6315db37dd89SAleksandar Markovicfi 6316d6092e08SFilip Bozutaif test "$btrfs" = "yes" ; then 6317d6092e08SFilip Bozuta echo "CONFIG_BTRFS=y" >> $config_host_mak 6318d6092e08SFilip Bozutafi 63193b3f24adSaurel32if test "$inotify" = "yes" ; then 63202358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 63213b3f24adSaurel32fi 6322c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 6323c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 6324c05c7a73SRiku Voipiofi 6325401bc051SPeter Maydellif test "$sem_timedwait" = "yes" ; then 6326401bc051SPeter Maydell echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 6327401bc051SPeter Maydellfi 63285c99fa37SKeno Fischerif test "$strchrnul" = "yes" ; then 63295c99fa37SKeno Fischer echo "HAVE_STRCHRNUL=y" >> $config_host_mak 63305c99fa37SKeno Fischerfi 63318a792b03SJiufei Xueif test "$st_atim" = "yes" ; then 63328a792b03SJiufei Xue echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak 63338a792b03SJiufei Xuefi 63346ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 63356ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 63366ae9a1f4SJuan Quintelafi 63376ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 63386ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 63396ae9a1f4SJuan Quintelafi 6340769ce76dSAlexander Grafif test "$curl" = "yes" ; then 6341484e2cc7SPaolo Bonzini echo "CONFIG_CURL=y" >> $config_host_mak 6342b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 63436ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 6344769ce76dSAlexander Graffi 63452e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 634698ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 63478eca2889SFam Zheng echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 63482e4d9fb1Saurel32fi 6349a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 6350484e2cc7SPaolo Bonzini echo "CONFIG_GTK=y" >> $config_host_mak 6351a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 6352014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 6353925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 6354925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 6355925a0400SGerd Hoffmann fi 6356bbbf9bfbSStefan Weilfi 6357f876b765SMarc-André Lureauif test "$gio" = "yes" ; then 6358f876b765SMarc-André Lureau echo "CONFIG_GIO=y" >> $config_host_mak 6359f876b765SMarc-André Lureau echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 6360f876b765SMarc-André Lureau echo "GIO_LIBS=$gio_libs" >> $config_host_mak 636125a97a56SMarc-André Lureau echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 6362f876b765SMarc-André Lureaufi 6363a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 6364ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 6365ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 6366a81df1b6SPaolo Bonzini echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak 6367a81df1b6SPaolo Bonzini echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak 6368ddbb0d09SDaniel P. Berrangefi 636991bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 637091bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 63711f923c70SLongpeng(Mike) if test "$gcrypt_hmac" = "yes" ; then 63721f923c70SLongpeng(Mike) echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 63731f923c70SLongpeng(Mike) fi 637446859d93SDaniel P. Berrangé echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak 637546859d93SDaniel P. Berrangé echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak 637662893b67SDaniel P. Berrangefi 637791bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 637891bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 6379becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 6380a81df1b6SPaolo Bonzini echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak 6381a81df1b6SPaolo Bonzini echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak 6382ed754746SDaniel P. Berrangefi 6383e0576942SDaniel P. Berrangéif test "$qemu_private_xts" = "yes" ; then 6384e0576942SDaniel P. Berrangé echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak 6385e0576942SDaniel P. Berrangéfi 63869a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 63879a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 63889a2fd434SDaniel P. Berrangefi 63898953caf3SDaniel P. Berrangeif test "$auth_pam" = "yes" ; then 63908953caf3SDaniel P. Berrange echo "CONFIG_AUTH_PAM=y" >> $config_host_mak 63918953caf3SDaniel P. Berrangefi 6392559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 6393559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 6394559607eaSDaniel P. Berrangefi 6395e865b97fSChen Gangif test "$have_drm_h" = "yes" ; then 6396e865b97fSChen Gang echo "HAVE_DRM_H=y" >> $config_host_mak 6397e865b97fSChen Gangfi 63986b39b063SEric Blakeif test "$have_broken_size_max" = "yes" ; then 63996b39b063SEric Blake echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 64006b39b063SEric Blakefi 64019df8b20dSThomas Huthif test "$have_openpty" = "yes" ; then 64029df8b20dSThomas Huth echo "HAVE_OPENPTY=y" >> $config_host_mak 64039df8b20dSThomas Huthfi 64042a4b472cSDavid CARLIERif test "$have_sys_signal_h" = "yes" ; then 64052a4b472cSDavid CARLIER echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak 64062a4b472cSDavid CARLIERfi 6407277abf15SJan Vesely 6408277abf15SJan Vesely# Work around a system header bug with some kernel/XFS header 6409277abf15SJan Vesely# versions where they both try to define 'struct fsxattr': 6410277abf15SJan Vesely# xfs headers will not try to redefine structs from linux headers 6411277abf15SJan Vesely# if this macro is set. 6412277abf15SJan Veselyif test "$have_fsxattr" = "yes" ; then 6413277abf15SJan Vesely echo "HAVE_FSXATTR=y" >> $config_host_mak 6414277abf15SJan Veselyfi 64151efad060SFam Zhengif test "$have_copy_file_range" = "yes" ; then 64161efad060SFam Zheng echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 64171efad060SFam Zhengfi 6418bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 6419bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 6420a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 6421e0fb129cSGerd Hoffmann echo "VTE_LIBS=$vte_libs" >> $config_host_mak 6422a4ccabcfSAnthony Liguorifi 64239d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 64249d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 64259d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 64269d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 64279d9e1521SGerd Hoffmannfi 64281badb709SPaolo Bonziniif test "$xen" = "enabled" ; then 64296dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 6430d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 6431582ea95fSMarc-André Lureau echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak 6432582ea95fSMarc-André Lureau echo "XEN_LIBS=$xen_libs" >> $config_host_mak 6433e37630caSaliguorifi 64345c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 64355c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 64365c6c3a6cSChristoph Hellwigfi 6437c10dd856SAarushi Mehtaif test "$linux_io_uring" = "yes" ; then 6438c10dd856SAarushi Mehta echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak 6439c10dd856SAarushi Mehta echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak 6440c10dd856SAarushi Mehta echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak 6441c10dd856SAarushi Mehtafi 6442758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 6443758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 6444ec0d5893SMarc-André Lureau echo "LIBATTR_LIBS=$libattr_libs" >> $config_host_mak 6445758e8e38SVenkateswararao Jujjuri (JV)fi 64464f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 64474f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 64484f26f2b6SAvi Kivityfi 6449983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 6450758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 6451758e8e38SVenkateswararao Jujjuri (JV)fi 64525e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 64535e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 64545e9be92dSNicholas Bellingerfi 6455af3bba76SPaolo Bonziniif test "$vhost_net" = "yes" ; then 6456af3bba76SPaolo Bonzini echo "CONFIG_VHOST_NET=y" >> $config_host_mak 6457af3bba76SPaolo Bonzinifi 6458af3bba76SPaolo Bonziniif test "$vhost_net_user" = "yes" ; then 645956f41de7SPaolo Bonzini echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 646003ce5744SNikolay Nikolaevfi 6461108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" ; then 6462108a6481SCindy Lu echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 6463108a6481SCindy Lufi 6464042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 6465042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 6466042cea27SGongleifi 6467fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 6468fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 64695fe97d88SStefano Garzarella if test "$vhost_user" = "yes" ; then 64705fe97d88SStefano Garzarella echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 64715fe97d88SStefano Garzarella fi 6472fc0b9b0eSStefan Hajnoczifi 6473299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" ; then 6474299e6f19SPaolo Bonzini echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 6475299e6f19SPaolo Bonzinifi 6476e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 6477e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 6478e6a74868SMarc-André Lureaufi 6479108a6481SCindy Luif test "$vhost_vdpa" = "yes" ; then 6480108a6481SCindy Lu echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 6481108a6481SCindy Lufi 648298fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" ; then 648398fc1adaSDr. David Alan Gilbert echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 648498fc1adaSDr. David Alan Gilbertfi 648577755340Sthsif test "$blobs" = "yes" ; then 648698ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 648777755340Sthsfi 6488bf9298b9Saliguoriif test "$iovec" = "yes" ; then 64892358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 6490bf9298b9Saliguorifi 6491ceb42de8Saliguoriif test "$preadv" = "yes" ; then 64922358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 6493ceb42de8Saliguorifi 6494a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 6495a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 6496a40161cbSPaolo Bonzinifi 6497dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 6498dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 6499dcc38d1cSMarcelo Tosattifi 6500d339d766SRichard W.M. Jonesif test "$optreset" = "yes" ; then 6501d339d766SRichard W.M. Jones echo "HAVE_OPTRESET=y" >> $config_host_mak 6502d339d766SRichard W.M. Jonesfi 65031badb709SPaolo Bonziniif test "$tcg" = "enabled"; then 65049195b2c2SStefan Weil if test "$tcg_interpreter" = "yes" ; then 65059195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 65069195b2c2SStefan Weil fi 6507b3f6ea7eSPaolo Bonzinifi 65085f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 65095f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 65105f6b9e8fSBlue Swirlfi 6511e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 6512e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 6513e78815a5SAndreas Färberfi 6514e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 6515e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 6516e78815a5SAndreas Färberfi 65179bc5a719SAndreas Gustafssonif test "$posix_memalign" = "yes" ; then 65189bc5a719SAndreas Gustafsson echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 65199bc5a719SAndreas Gustafssonfi 6520cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 6521cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 65222634733cSPaolo Bonzini echo "SPICE_CFLAGS=$spice_cflags" >> $config_host_mak 65232634733cSPaolo Bonzini echo "SPICE_LIBS=$spice_libs" >> $config_host_mak 6524cd4ec0b4SGerd Hoffmannfi 6525cd4ec0b4SGerd Hoffmann 65267b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 65277b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 65287b62bf5aSFam Zheng echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 65297b62bf5aSFam Zheng echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 6530111a38b0SRobert Relyeafi 6531111a38b0SRobert Relyea 65322b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 65332b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 6534b878b652SFam Zheng echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 6535b878b652SFam Zheng echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 65362b2325ffSGerd Hoffmannfi 65372b2325ffSGerd Hoffmann 653869354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 653969354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 6540cc7923fcSFam Zheng echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 6541cc7923fcSFam Zheng echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 654269354a83SHans de Goedefi 654369354a83SHans de Goede 6544da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 6545da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 6546de2d3005SPaolo Bonzini echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 6547da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 6548014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 6549014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 6550014cb152SGerd Hoffmann fi 655120ff075bSMichael Wallefi 655220ff075bSMichael Walle 6553d52c454aSMarc-André Lureauif test "$gbm" = "yes" ; then 6554d52c454aSMarc-André Lureau echo "CONFIG_GBM=y" >> $config_host_mak 6555d52c454aSMarc-André Lureau echo "GBM_LIBS=$gbm_libs" >> $config_host_mak 6556d52c454aSMarc-André Lureau echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak 6557d52c454aSMarc-André Lureaufi 6558d52c454aSMarc-André Lureau 6559d52c454aSMarc-André Lureau 656099f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 656199f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 656299f2dbd3SLiang Lifi 656399f2dbd3SLiang Li 65646b8cd447SRobert Hooif test "$avx512f_opt" = "yes" ; then 65656b8cd447SRobert Hoo echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 65666b8cd447SRobert Hoofi 65676b8cd447SRobert Hoo 6568607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 6569607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 6570708eab42SMarc-André Lureau echo "LZO_LIBS=$lzo_libs" >> $config_host_mak 6571607dacd0Sqiaonuohanfi 6572607dacd0Sqiaonuohan 6573607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 6574607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 6575708eab42SMarc-André Lureau echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak 6576607dacd0Sqiaonuohanfi 6577607dacd0Sqiaonuohan 65786b383c08SPeter Wuif test "$bzip2" = "yes" ; then 65796b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 65806b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 65816b383c08SPeter Wufi 65826b383c08SPeter Wu 658383bc1f97SJulio Faraccoif test "$lzfse" = "yes" ; then 658483bc1f97SJulio Faracco echo "CONFIG_LZFSE=y" >> $config_host_mak 658583bc1f97SJulio Faracco echo "LZFSE_LIBS=-llzfse" >> $config_host_mak 658683bc1f97SJulio Faraccofi 658783bc1f97SJulio Faracco 65883a678481SJuan Quintelaif test "$zstd" = "yes" ; then 65893a678481SJuan Quintela echo "CONFIG_ZSTD=y" >> $config_host_mak 65905e5733e5SMarc-André Lureau echo "ZSTD_CFLAGS=$zstd_cflags" >> $config_host_mak 65915e5733e5SMarc-André Lureau echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak 65923a678481SJuan Quintelafi 65933a678481SJuan Quintela 6594c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 6595484e2cc7SPaolo Bonzini echo "CONFIG_LIBISCSI=y" >> $config_host_mak 65966ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 65976ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 6598c589b249SRonnie Sahlbergfi 6599c589b249SRonnie Sahlberg 66006542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 6601484e2cc7SPaolo Bonzini echo "CONFIG_LIBNFS=y" >> $config_host_mak 66024be4879fSColin Lord echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 66036542aa9cSPeter Lievenfi 66046542aa9cSPeter Lieven 6605f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 6606f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 6607c3883e1fSFam Zheng echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 6608c3883e1fSFam Zheng echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 6609f794573eSEduardo Otubofi 6610f794573eSEduardo Otubo 661183fb7adfSbellard# XXX: suppress that 66127d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 66132358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 66147d3505c5Sbellardfi 66157d3505c5Sbellard 66164d9310f4SDaniel P. Berrangeif test "$localtime_r" = "yes" ; then 66174d9310f4SDaniel P. Berrange echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 66184d9310f4SDaniel P. Berrangefi 66193556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 66203556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 66213556c233SPaolo Bonzinifi 6622f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 6623484e2cc7SPaolo Bonzini echo "CONFIG_RBD=y" >> $config_host_mak 66246ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 6625f27aaf4bSChristian Brunnerfi 662620ff6c80SAnthony Liguori 66277c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 662870c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 662970c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 663070c60c08SStefan Hajnoczielse 663170c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 663270c60c08SStefan Hajnoczifi 6633d0e2fce5SAneesh Kumar K.V 66347d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 66357d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 66367d992e4dSPeter Lievenfi 66377d992e4dSPeter Lieven 6638f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 6639f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 6640f0d92b56SLongpeng(Mike)fi 6641f0d92b56SLongpeng(Mike) 6642d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 6643d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 6644d2042378SAneesh Kumar K.Vfi 6645d2042378SAneesh Kumar K.V 6646e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 6647e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 6648e06a765eSHarsh Prateek Borafi 6649e06a765eSHarsh Prateek Bora 66503f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 66513f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 66523f4349dcSKevin Wolffi 66533f4349dcSKevin Wolf 6654d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 6655d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 6656d83414e1SMarc-André Lureaufi 6657d83414e1SMarc-André Lureau 66580aebab04SLingfeng Yangif test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 66590aebab04SLingfeng Yang echo "CONFIG_TSAN=y" >> $config_host_mak 66600aebab04SLingfeng Yangfi 66610aebab04SLingfeng Yang 66628ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 66638ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 66648ab1bf12SLuiz Capitulinofi 66658ab1bf12SLuiz Capitulino 666676a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 666776a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 666876a347e1SRichard Hendersonfi 666976a347e1SRichard Henderson 6670f540166bSRichard Hendersonif test "$int128" = "yes" ; then 6671f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 6672f540166bSRichard Hendersonfi 6673f540166bSRichard Henderson 66747ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 66757ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 66767ebee43eSRichard Hendersonfi 66777ebee43eSRichard Henderson 6678e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 6679e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 6680e6cd4bb5SRichard Hendersonfi 6681e6cd4bb5SRichard Henderson 6682df79b996SRichard Hendersonif test "$atomic64" = "yes" ; then 6683df79b996SRichard Henderson echo "CONFIG_ATOMIC64=y" >> $config_host_mak 6684df79b996SRichard Hendersonfi 6685df79b996SRichard Henderson 6686db8aaae8SRichard Hendersonif test "$attralias" = "yes" ; then 6687db8aaae8SRichard Henderson echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak 6688db8aaae8SRichard Hendersonfi 6689db8aaae8SRichard Henderson 66901e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 66911e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 66921e6e9acaSRichard Hendersonfi 66931e6e9acaSRichard Henderson 6694eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 6695484e2cc7SPaolo Bonzini echo "CONFIG_GLUSTERFS=y" >> $config_host_mak 66966ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 66976ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 6698eb100396SBharata B Raofi 6699eb100396SBharata B Rao 6700d85fa9ebSJeff Codyif test "$glusterfs_xlator_opt" = "yes" ; then 6701d85fa9ebSJeff Cody echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 6702d85fa9ebSJeff Codyfi 6703d85fa9ebSJeff Cody 67040c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 67050c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 67060c14fb47SBharata B Raofi 67070c14fb47SBharata B Rao 6708df3a429aSNiels de Vosif test "$glusterfs_fallocate" = "yes" ; then 6709df3a429aSNiels de Vos echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 6710df3a429aSNiels de Vosfi 6711df3a429aSNiels de Vos 67127c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 67137c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 67147c815372SBharata B Raofi 67157c815372SBharata B Rao 6716e014dbe7SPrasanna Kumar Kaleverif test "$glusterfs_ftruncate_has_stat" = "yes" ; then 6717e014dbe7SPrasanna Kumar Kalever echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak 6718e014dbe7SPrasanna Kumar Kaleverfi 6719e014dbe7SPrasanna Kumar Kalever 67200e3b891fSNiels de Vosif test "$glusterfs_iocb_has_stat" = "yes" ; then 67210e3b891fSNiels de Vos echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak 67220e3b891fSNiels de Vosfi 67230e3b891fSNiels de Vos 6724b10d49d7SPino Toscanoif test "$libssh" = "yes" ; then 6725484e2cc7SPaolo Bonzini echo "CONFIG_LIBSSH=y" >> $config_host_mak 6726b10d49d7SPino Toscano echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 6727b10d49d7SPino Toscano echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 67280a12ec87SRichard W.M. Jonesfi 67290a12ec87SRichard W.M. Jones 6730ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 6731ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 6732ed1701c6SDr. David Alan Gilbertfi 6733ed1701c6SDr. David Alan Gilbert 67343b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 67353cae16dbSPaolo Bonzini echo 'CONFIG_TPM=y' >> $config_host_mak 67363b8acc11SPaolo Bonzinifi 67373b8acc11SPaolo Bonzini 67385b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 67395b808275SLluís Vilanovaif have_backend "nop"; then 67406d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 674122890ab5SPrerna Saxenafi 67425b808275SLluís Vilanovaif have_backend "simple"; then 67436d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 67446d8a764eSLluís # Set the appropriate trace file. 6745953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 67469410b56cSPrerna Saxenafi 6747ed7f5f1dSPaolo Bonziniif have_backend "log"; then 6748ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 67496d8a764eSLluísfi 67505b808275SLluís Vilanovaif have_backend "ust"; then 67516d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 6752a81df1b6SPaolo Bonzini echo "LTTNG_UST_LIBS=$lttng_ust_libs" >> $config_host_mak 6753a81df1b6SPaolo Bonzini echo "URCU_BP_LIBS=$urcu_bp_libs" >> $config_host_mak 67546d8a764eSLluísfi 67555b808275SLluís Vilanovaif have_backend "dtrace"; then 67566d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 67576d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 67586d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 67596d8a764eSLluís fi 6760c276b17dSDaniel P. Berrangefi 67615b808275SLluís Vilanovaif have_backend "ftrace"; then 6762781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 6763781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 6764781e9545SEiichi Tsukata else 676521684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 6766781e9545SEiichi Tsukata fi 6767781e9545SEiichi Tsukatafi 67680a852417SPaul Durrantif have_backend "syslog"; then 67690a852417SPaul Durrant if test "$posix_syslog" = "yes" ; then 67700a852417SPaul Durrant echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 67710a852417SPaul Durrant else 67720a852417SPaul Durrant feature_not_found "syslog(trace backend)" "syslog not available" 67730a852417SPaul Durrant fi 67740a852417SPaul Durrantfi 67759410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 67769410b56cSPrerna Saxena 67772da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 67782da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 6779392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 67802da776dbSMichael R. Hinesfi 67812da776dbSMichael R. Hines 678221ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 678321ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 678421ab34c9SMarcel Apfelbaumfi 678521ab34c9SMarcel Apfelbaum 6786575b22b1SLaurent Vivierif test "$have_rtnetlink" = "yes" ; then 6787575b22b1SLaurent Vivier echo "CONFIG_RTNETLINK=y" >> $config_host_mak 6788575b22b1SLaurent Vivierfi 6789575b22b1SLaurent Vivier 6790ed279a06SKlim Kireevif test "$libxml2" = "yes" ; then 6791ed279a06SKlim Kireev echo "CONFIG_LIBXML2=y" >> $config_host_mak 6792ed279a06SKlim Kireev echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 6793ed279a06SKlim Kireev echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 6794ed279a06SKlim Kireevfi 6795ed279a06SKlim Kireev 6796a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 6797a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 6798a6b1d4c0SChanglong Xiefi 6799a6b1d4c0SChanglong Xie 68006a02c806SStefan Hajnocziif test "$have_af_vsock" = "yes" ; then 68016a02c806SStefan Hajnoczi echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 68026a02c806SStefan Hajnoczifi 68036a02c806SStefan Hajnoczi 68044d04351fSChristopher Covingtonif test "$have_sysmacros" = "yes" ; then 68054d04351fSChristopher Covington echo "CONFIG_SYSMACROS=y" >> $config_host_mak 68064d04351fSChristopher Covingtonfi 68074d04351fSChristopher Covington 680849e00a18SAndreas Grapentinif test "$have_static_assert" = "yes" ; then 680949e00a18SAndreas Grapentin echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 681049e00a18SAndreas Grapentinfi 681149e00a18SAndreas Grapentin 6812e674605fSTomáš Golembiovskýif test "$have_utmpx" = "yes" ; then 6813e674605fSTomáš Golembiovský echo "HAVE_UTMPX=y" >> $config_host_mak 6814e674605fSTomáš Golembiovskýfi 6815db1ed1abSRichard Hendersonif test "$have_getrandom" = "yes" ; then 6816db1ed1abSRichard Henderson echo "CONFIG_GETRANDOM=y" >> $config_host_mak 6817db1ed1abSRichard Hendersonfi 6818e0580342SKamil Rytarowskiif test "$ivshmem" = "yes" ; then 6819e0580342SKamil Rytarowski echo "CONFIG_IVSHMEM=y" >> $config_host_mak 6820e0580342SKamil Rytarowskifi 6821ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 6822ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 6823ba59fb77SPaolo Bonzinifi 6824e0580342SKamil Rytarowski 68255c312079SDr. David Alan Gilbert# Hold two types of flag: 68265c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 68275c312079SDr. David Alan Gilbert# a thread we have a handle to 6828479a5747SRoman Bolshakov# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular 68295c312079SDr. David Alan Gilbert# platform 6830479a5747SRoman Bolshakovif test "$pthread_setname_np_w_tid" = "yes" ; then 68315c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 6832479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak 6833479a5747SRoman Bolshakovelif test "$pthread_setname_np_wo_tid" = "yes" ; then 6834479a5747SRoman Bolshakov echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 6835479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak 68365c312079SDr. David Alan Gilbertfi 68375c312079SDr. David Alan Gilbert 683817824406SJunyan Heif test "$libpmem" = "yes" ; then 683917824406SJunyan He echo "CONFIG_LIBPMEM=y" >> $config_host_mak 6840c9322ab5SMarc-André Lureau echo "LIBPMEM_LIBS=$libpmem_libs" >> $config_host_mak 6841c9322ab5SMarc-André Lureau echo "LIBPMEM_CFLAGS=$libpmem_cflags" >> $config_host_mak 684217824406SJunyan Hefi 684317824406SJunyan He 684421b2eca6SJingqi Liuif test "$libdaxctl" = "yes" ; then 684521b2eca6SJingqi Liu echo "CONFIG_LIBDAXCTL=y" >> $config_host_mak 6846c7c91a74SBruce Rogers echo "LIBDAXCTL_LIBS=$libdaxctl_libs" >> $config_host_mak 684721b2eca6SJingqi Liufi 684821b2eca6SJingqi Liu 68492f740136SJeff Codyif test "$bochs" = "yes" ; then 68502f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 68512f740136SJeff Codyfi 68522f740136SJeff Codyif test "$cloop" = "yes" ; then 68532f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 68542f740136SJeff Codyfi 68552f740136SJeff Codyif test "$dmg" = "yes" ; then 68562f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 68572f740136SJeff Codyfi 68582f740136SJeff Codyif test "$qcow1" = "yes" ; then 68592f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 68602f740136SJeff Codyfi 68612f740136SJeff Codyif test "$vdi" = "yes" ; then 68622f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 68632f740136SJeff Codyfi 68642f740136SJeff Codyif test "$vvfat" = "yes" ; then 68652f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 68662f740136SJeff Codyfi 68672f740136SJeff Codyif test "$qed" = "yes" ; then 68682f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 68692f740136SJeff Codyfi 68702f740136SJeff Codyif test "$parallels" = "yes" ; then 68712f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 68722f740136SJeff Codyfi 68732f740136SJeff Codyif test "$sheepdog" = "yes" ; then 68742f740136SJeff Cody echo "CONFIG_SHEEPDOG=y" >> $config_host_mak 68752f740136SJeff Codyfi 6876c9c8b88fSDavid CARLIERif test "$pty_h" = "yes" ; then 6877c9c8b88fSDavid CARLIER echo "HAVE_PTY_H=y" >> $config_host_mak 6878c9c8b88fSDavid CARLIERfi 6879195588ccSDavid CARLIERif test "$have_mlockall" = "yes" ; then 6880195588ccSDavid CARLIER echo "HAVE_MLOCKALL=y" >> $config_host_mak 6881195588ccSDavid CARLIERfi 6882adc28027SAlexander Bulekovif test "$fuzzing" = "yes" ; then 688354c9e41dSAlexander Bulekov # If LIB_FUZZING_ENGINE is set, assume we are running on OSS-Fuzz, and the 688454c9e41dSAlexander Bulekov # needed CFLAGS have already been provided 688554c9e41dSAlexander Bulekov if test -z "${LIB_FUZZING_ENGINE+xxx}" ; then 6886086d5f75SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" 688754c9e41dSAlexander Bulekov FUZZ_EXE_LDFLAGS="-fsanitize=fuzzer" 688854c9e41dSAlexander Bulekov else 688954c9e41dSAlexander Bulekov FUZZ_EXE_LDFLAGS="$LIB_FUZZING_ENGINE" 689054c9e41dSAlexander Bulekov fi 6891adc28027SAlexander Bulekovfi 68922f740136SJeff Cody 689340e8c6f4SAlex Bennéeif test "$plugins" = "yes" ; then 689440e8c6f4SAlex Bennée echo "CONFIG_PLUGIN=y" >> $config_host_mak 689526fffe29SEmilio G. Cota # Copy the export object list to the build dir 689626fffe29SEmilio G. Cota if test "$ld_dynamic_list" = "yes" ; then 689726fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 689826fffe29SEmilio G. Cota ld_symbols=qemu-plugins-ld.symbols 689926fffe29SEmilio G. Cota cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 690026fffe29SEmilio G. Cota elif test "$ld_exported_symbols_list" = "yes" ; then 690126fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 690226fffe29SEmilio G. Cota ld64_symbols=qemu-plugins-ld64.symbols 690326fffe29SEmilio G. Cota echo "# Automatically generated by configure - do not modify" > $ld64_symbols 690426fffe29SEmilio G. Cota grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 690526fffe29SEmilio G. Cota sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 690626fffe29SEmilio G. Cota else 690726fffe29SEmilio G. Cota error_exit \ 690826fffe29SEmilio G. Cota "If \$plugins=yes, either \$ld_dynamic_list or " \ 690926fffe29SEmilio G. Cota "\$ld_exported_symbols_list should have been set to 'yes'." 691026fffe29SEmilio G. Cota fi 691140e8c6f4SAlex Bennéefi 691240e8c6f4SAlex Bennée 6913f48e590aSAlex Bennéeif test -n "$gdb_bin" ; then 6914f48e590aSAlex Bennée echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 6915f48e590aSAlex Bennéefi 6916f48e590aSAlex Bennée 691754e7aac0SAlexey Krasikovif test "$secret_keyring" = "yes" ; then 691854e7aac0SAlexey Krasikov echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 691954e7aac0SAlexey Krasikovfi 692054e7aac0SAlexey Krasikov 69215b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 692225211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES" 69235b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 692425211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES" 69255b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 692625211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES" 6927e633a5c6SEric Blakeelif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then 692825211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES" 692940d964b5SRichard Hendersonelif test "$ARCH" = "ppc64" ; then 693025211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES" 6931e633a5c6SEric Blakeelif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then 693225211446SPaolo Bonzini QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES" 69335b5e3037SPaolo Bonzinielse 693425211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES" 69355b5e3037SPaolo Bonzinifi 69365b5e3037SPaolo Bonzini 693798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 6938804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 6939c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 69402eb054c2SPeter Maydellecho "SPHINX_BUILD=$sphinx_build" >> $config_host_mak 694139d87c8cSAlex Bennéeecho "GENISOIMAGE=$genisoimage" >> $config_host_mak 6942a5665051SPaolo Bonziniecho "MESON=$meson" >> $config_host_mak 6943804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 6944a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 6945859aef02SPaolo Bonzini echo "CONFIG_IASL=$iasl" >> $config_host_mak 6946a31a8642SMichael S. Tsirkinfi 694783f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 69483c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 6949804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 695045d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 6951cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 69525f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 69533dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 6954804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 6955804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 69569f81aeb5SAlistair Francisecho "RANLIB=$ranlib" >> $config_host_mak 69574852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 6958daa79d9aSAlex Bennéeecho "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak 69599fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 696046eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 6961a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 696211cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 6963f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 6964a81df1b6SPaolo Bonziniecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 6965a81df1b6SPaolo Bonziniecho "GLIB_LIBS=$glib_libs" >> $config_host_mak 69668a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 6967db5adeaaSPaolo Bonziniecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 6968e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 6969409437e1SDaniel P. Berrangeecho "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 6970804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 6971484e2cc7SPaolo Bonziniecho "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak 6972f15bff25SPaolo Bonziniecho "LIBS_QGA=$libs_qga" >> $config_host_mak 697390246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 697490246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 69751d728c39SBlue Swirlif test "$gcov" = "yes" ; then 69761d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 69771d728c39SBlue Swirlfi 6978804edf29SJuan Quintela 6979adc28027SAlexander Bulekovif test "$fuzzing" != "no"; then 6980adc28027SAlexander Bulekov echo "CONFIG_FUZZ=y" >> $config_host_mak 6981adc28027SAlexander Bulekovfi 698254c9e41dSAlexander Bulekovecho "FUZZ_EXE_LDFLAGS=$FUZZ_EXE_LDFLAGS" >> $config_host_mak 69833efac6ebSTomáš Golembiovský 698405dfa22bSPhilippe Mathieu-Daudéif test "$edk2_blobs" = "yes" ; then 698505dfa22bSPhilippe Mathieu-Daudé echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak 698605dfa22bSPhilippe Mathieu-Daudéfi 698705dfa22bSPhilippe Mathieu-Daudé 6988b767d257SMarek Marczykowski-Góreckiif test "$rng_none" = "yes"; then 6989b767d257SMarek Marczykowski-Górecki echo "CONFIG_RNG_NONE=y" >> $config_host_mak 6990b767d257SMarek Marczykowski-Góreckifi 6991b767d257SMarek Marczykowski-Górecki 69926efd7517SPeter Maydell# use included Linux headers 69936efd7517SPeter Maydellif test "$linux" = "yes" ; then 6994a307beb6SAndreas Färber mkdir -p linux-headers 69956efd7517SPeter Maydell case "$cpu" in 6996c72b26ecSRichard Henderson i386|x86_64|x32) 699708312a63SPeter Maydell linux_arch=x86 69986efd7517SPeter Maydell ;; 6999f8378accSRichard Henderson ppc|ppc64|ppc64le) 700008312a63SPeter Maydell linux_arch=powerpc 70016efd7517SPeter Maydell ;; 70026efd7517SPeter Maydell s390x) 700308312a63SPeter Maydell linux_arch=s390 700408312a63SPeter Maydell ;; 70051f080313SClaudio Fontana aarch64) 70061f080313SClaudio Fontana linux_arch=arm64 70071f080313SClaudio Fontana ;; 7008222e7d11SSanjay Lal mips64) 7009222e7d11SSanjay Lal linux_arch=mips 7010222e7d11SSanjay Lal ;; 701108312a63SPeter Maydell *) 701208312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 701308312a63SPeter Maydell linux_arch="$cpu" 70146efd7517SPeter Maydell ;; 70156efd7517SPeter Maydell esac 701608312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 701708312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 701808312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 701908312a63SPeter Maydell fi 70206efd7517SPeter Maydellfi 70216efd7517SPeter Maydell 702297a847bcSbellardfor target in $target_list; do 702397a847bcSbellard target_dir="$target" 702489138857SStefan Weil target_name=$(echo $target | cut -d '-' -f 1) 702597a847bcSbellard mkdir -p $target_dir 7026fdb75aefSPaolo Bonzini case $target in 7027fdb75aefSPaolo Bonzini *-user) symlink "../qemu-$target_name" "$target_dir/qemu-$target_name" ;; 7028fdb75aefSPaolo Bonzini *) symlink "../qemu-system-$target_name" "$target_dir/qemu-system-$target_name" ;; 70292408a527Saurel32 esac 703056aebc89Spbrookdone 70317d13299dSbellard 7032765686d6SPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak 7033fdb75aefSPaolo Bonziniif test "$default_targets" = "yes"; then 7034fdb75aefSPaolo Bonzini echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak 7035fdb75aefSPaolo Bonzinifi 7036a540f158SPeter Crosthwaite 7037a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 7038a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 7039ab318051SMarc-André Lureau echo "NUMA_LIBS=$numa_libs" >> $config_host_mak 7040a99d57bbSWanlong Gaofi 7041a99d57bbSWanlong Gao 7042fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 7043fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 7044fd0e6053SJohn Snowfi 7045fd0e6053SJohn Snow 70461e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 70471e4f6065SDaniele Buono echo "CONFIG_SAFESTACK=y" >> $config_host_mak 70481e4f6065SDaniele Buonofi 70491e4f6065SDaniele Buono 7050e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 7051e29e5c6eSPeter Maydell# DIRS are directories which we simply mkdir in the build tree; 7052e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 7053e29e5c6eSPeter Maydell# (these can be both files and directories). 7054e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 7055e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 7056e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 7057e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 7058e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 7059e29e5c6eSPeter Maydell# directory and symlink the directory instead. 706009db9b9dSGerd Hoffmann# UNLINK is used to remove symlinks from older development versions 706109db9b9dSGerd Hoffmann# that might get into the way when doing "git update" without doing 706209db9b9dSGerd Hoffmann# a "make distclean" in between. 70631cf4323eSThomas HuthDIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" 70641cf4323eSThomas HuthDIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 7065b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 7066744a928cSAlexey KardashevskiyDIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 70678db2a4fdSGerd HoffmannDIRS="$DIRS roms/seabios" 7068c17a386bSAlex BennéeDIRS="$DIRS contrib/plugins/" 70692038f8c8SPaolo BonziniLINKS="Makefile" 7070e8f3bd71SMarc-André LureauLINKS="$LINKS tests/tcg/lm32/Makefile" 70713941996bSPaolo BonziniLINKS="$LINKS tests/tcg/Makefile.target" 7072ddcf607fSGerd HoffmannLINKS="$LINKS pc-bios/optionrom/Makefile" 7073e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 70748db2a4fdSGerd HoffmannLINKS="$LINKS roms/seabios/Makefile" 7075e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 7076e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 707739950353SPeter MaydellLINKS="$LINKS tests/acceptance tests/data" 707839950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 70798f8fd9edSCleber RosaLINKS="$LINKS python" 7080c17a386bSAlex BennéeLINKS="$LINKS contrib/plugins/Makefile " 708109db9b9dSGerd HoffmannUNLINK="pc-bios/keymaps" 7082753d11f2SRichard Hendersonfor bios_file in \ 7083753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 70843a631b8eSBin Meng $source_path/pc-bios/*.elf \ 7085225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 7086753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 7087753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 7088e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 7089753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 70904e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 709126ce90fdSLaszlo Ersek $source_path/pc-bios/edk2-*.fd.bz2 \ 7092753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 7093753d11f2SRichard Hendersondo 7094e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 70957ea78b74SJan Kiszkadone 7096d1807a4fSPaolo Bonzinimkdir -p $DIRS 7097e29e5c6eSPeter Maydellfor f in $LINKS ; do 70980f4d8894SPaolo Bonzini if [ -e "$source_path/$f" ]; then 7099f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 7100f9245e10SPeter Maydell fi 71017d13299dSbellarddone 710209db9b9dSGerd Hoffmannfor f in $UNLINK ; do 710309db9b9dSGerd Hoffmann if [ -L "$f" ]; then 710409db9b9dSGerd Hoffmann rm -f "$f" 710509db9b9dSGerd Hoffmann fi 710609db9b9dSGerd Hoffmanndone 71071ad2134fSPaul Brook 71082038f8c8SPaolo Bonzini(for i in $cross_cc_vars; do 71092038f8c8SPaolo Bonzini export $i 71102038f8c8SPaolo Bonzinidone 7111afc3a8f9SAlex Bennéeexport target_list source_path use_containers 71122038f8c8SPaolo Bonzini$source_path/tests/tcg/configure.sh) 71132038f8c8SPaolo Bonzini 7114c34ebfdcSAnthony Liguori# temporary config to build submodules 71158db2a4fdSGerd Hoffmannfor rom in seabios; do 7116c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 711737116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 7118c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 7119cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 71205f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 7121c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 7122c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 71233dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 7124c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 7125a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 7126c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 71279f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 7128c34ebfdcSAnthony Liguoridone 7129c34ebfdcSAnthony Liguori 713076c7560aSMax Reitz# set up qemu-iotests in this build directory 713176c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 713276c7560aSMax Reitz 713376c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 713476c7560aSMax Reitzecho >> "$iotests_common_env" 713576c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 713676c7560aSMax Reitz 7137a5665051SPaolo Bonziniif test "$skip_meson" = no; then 7138fc929892SMarc-André Lureaucross="config-meson.cross.new" 7139fc929892SMarc-André Lureaumeson_quote() { 714047b30835SPaolo Bonzini echo "'$(echo $* | sed "s/ /','/g")'" 7141fc929892SMarc-André Lureau} 7142fc929892SMarc-André Lureau 7143fc929892SMarc-André Lureauecho "# Automatically generated by configure - do not modify" > $cross 7144fc929892SMarc-André Lureauecho "[properties]" >> $cross 7145fc929892SMarc-André Lureautest -z "$cxx" && echo "link_language = 'c'" >> $cross 714647b30835SPaolo Bonziniecho "[built-in options]" >> $cross 714747b30835SPaolo Bonziniecho "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross 714847b30835SPaolo Bonziniecho "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross 714947b30835SPaolo Bonziniecho "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 715047b30835SPaolo Bonziniecho "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross 7151fc929892SMarc-André Lureauecho "[binaries]" >> $cross 715247b30835SPaolo Bonziniecho "c = [$(meson_quote $cc)]" >> $cross 715347b30835SPaolo Bonzinitest -n "$cxx" && echo "cpp = [$(meson_quote $cxx)]" >> $cross 715447b30835SPaolo Bonziniecho "ar = [$(meson_quote $ar)]" >> $cross 715547b30835SPaolo Bonziniecho "nm = [$(meson_quote $nm)]" >> $cross 715647b30835SPaolo Bonziniecho "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross 715747b30835SPaolo Bonziniecho "ranlib = [$(meson_quote $ranlib)]" >> $cross 7158e8178514SPaolo Bonziniif has $sdl2_config; then 715947b30835SPaolo Bonzini echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross 7160e8178514SPaolo Bonzinifi 716147b30835SPaolo Bonziniecho "strip = [$(meson_quote $strip)]" >> $cross 716247b30835SPaolo Bonziniecho "windres = [$(meson_quote $windres)]" >> $cross 7163fc929892SMarc-André Lureauif test -n "$cross_prefix"; then 7164fc929892SMarc-André Lureau cross_arg="--cross-file config-meson.cross" 7165fc929892SMarc-André Lureau echo "[host_machine]" >> $cross 7166fc929892SMarc-André Lureau if test "$mingw32" = "yes" ; then 7167fc929892SMarc-André Lureau echo "system = 'windows'" >> $cross 7168fc929892SMarc-André Lureau fi 7169853b4bafSThomas Huth if test "$linux" = "yes" ; then 7170853b4bafSThomas Huth echo "system = 'linux'" >> $cross 7171853b4bafSThomas Huth fi 7172fc929892SMarc-André Lureau case "$ARCH" in 7173fc929892SMarc-André Lureau i386|x86_64) 7174fc929892SMarc-André Lureau echo "cpu_family = 'x86'" >> $cross 7175fc929892SMarc-André Lureau ;; 7176fc929892SMarc-André Lureau ppc64le) 7177fc929892SMarc-André Lureau echo "cpu_family = 'ppc64'" >> $cross 7178fc929892SMarc-André Lureau ;; 7179fc929892SMarc-André Lureau *) 7180fc929892SMarc-André Lureau echo "cpu_family = '$ARCH'" >> $cross 7181fc929892SMarc-André Lureau ;; 7182fc929892SMarc-André Lureau esac 7183fc929892SMarc-André Lureau echo "cpu = '$cpu'" >> $cross 7184fc929892SMarc-André Lureau if test "$bigendian" = "yes" ; then 7185fc929892SMarc-André Lureau echo "endian = 'big'" >> $cross 7186fc929892SMarc-André Lureau else 7187fc929892SMarc-André Lureau echo "endian = 'little'" >> $cross 7188fc929892SMarc-André Lureau fi 7189fc929892SMarc-André Lureauelse 7190fc929892SMarc-André Lureau cross_arg="--native-file config-meson.cross" 7191fc929892SMarc-André Lureaufi 7192fc929892SMarc-André Lureaumv $cross config-meson.cross 7193fc929892SMarc-André Lureau 7194a5665051SPaolo Bonzinirm -rf meson-private meson-info meson-logs 719548328880SPaolo BonziniNINJA=${ninja:-$PWD/ninjatool} $meson setup \ 7196d17f305aSPaolo Bonzini --prefix "$prefix" \ 7197d17f305aSPaolo Bonzini --libdir "$libdir" \ 7198d17f305aSPaolo Bonzini --libexecdir "$libexecdir" \ 7199d17f305aSPaolo Bonzini --bindir "$bindir" \ 7200d17f305aSPaolo Bonzini --includedir "$includedir" \ 7201d17f305aSPaolo Bonzini --datadir "$datadir" \ 7202d17f305aSPaolo Bonzini --mandir "$mandir" \ 7203d17f305aSPaolo Bonzini --sysconfdir "$sysconfdir" \ 7204d17f305aSPaolo Bonzini --localstatedir "$local_statedir" \ 7205d17f305aSPaolo Bonzini -Ddocdir="$docdir" \ 720673f3aa37SMarc-André Lureau -Dqemu_suffix="$qemu_suffix" \ 7207a5665051SPaolo Bonzini -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 7208a5665051SPaolo Bonzini -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 7209a5665051SPaolo Bonzini -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 7210a5665051SPaolo Bonzini -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 7211da6d48b9SMarc-André Lureau -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 7212*0c3dd50eSPaolo Bonzini -Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 7213bf0e56a3SMarc-André Lureau -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 7214deb62371SPaolo Bonzini -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ 72151badb709SPaolo Bonzini -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ 72161badb709SPaolo Bonzini -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ 7217b4e312e9SPaolo Bonzini -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ 7218a0b93237SPaolo Bonzini -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ 72190a40bcb7SCésar Belley -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ 7220fbb4121dSPaolo Bonzini -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ 7221fc929892SMarc-André Lureau $cross_arg \ 7222a5665051SPaolo Bonzini "$PWD" "$source_path" 7223a5665051SPaolo Bonzini 7224a5665051SPaolo Bonziniif test "$?" -ne 0 ; then 7225a5665051SPaolo Bonzini error_exit "meson setup failed" 7226a5665051SPaolo Bonzinifi 7227a5665051SPaolo Bonzinitouch ninjatool.stamp 7228a5665051SPaolo Bonzinifi 7229a5665051SPaolo Bonzini 72302d838d9bSAlex Bennéeif test -n "${deprecated_features}"; then 72312d838d9bSAlex Bennée echo "Warning, deprecated features enabled." 72322d838d9bSAlex Bennée echo "Please see docs/system/deprecated.rst" 72332d838d9bSAlex Bennée echo " features: ${deprecated_features}" 72342d838d9bSAlex Bennéefi 72352d838d9bSAlex Bennée 7236dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 7237dc655404SMichael S. Tsirkincat <<EOD >config.status 7238dc655404SMichael S. Tsirkin#!/bin/sh 7239dc655404SMichael S. Tsirkin# Generated by configure. 7240dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 7241dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 7242dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 7243dc655404SMichael S. TsirkinEOD 7244e811da7fSDaniel P. Berrangé 7245e811da7fSDaniel P. Berrangépreserve_env() { 7246e811da7fSDaniel P. Berrangé envname=$1 7247e811da7fSDaniel P. Berrangé 7248e811da7fSDaniel P. Berrangé eval envval=\$$envname 7249e811da7fSDaniel P. Berrangé 7250e811da7fSDaniel P. Berrangé if test -n "$envval" 7251e811da7fSDaniel P. Berrangé then 7252e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 7253e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 7254e811da7fSDaniel P. Berrangé else 7255e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 7256e811da7fSDaniel P. Berrangé fi 7257e811da7fSDaniel P. Berrangé} 7258e811da7fSDaniel P. Berrangé 7259e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 7260e811da7fSDaniel P. Berrangé# features/build target configure will detect 7261e811da7fSDaniel P. Berrangépreserve_env AR 7262e811da7fSDaniel P. Berrangépreserve_env AS 7263e811da7fSDaniel P. Berrangépreserve_env CC 7264e811da7fSDaniel P. Berrangépreserve_env CPP 7265e811da7fSDaniel P. Berrangépreserve_env CXX 7266e811da7fSDaniel P. Berrangépreserve_env INSTALL 7267e811da7fSDaniel P. Berrangépreserve_env LD 7268e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 7269e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 7270e811da7fSDaniel P. Berrangépreserve_env MAKE 7271e811da7fSDaniel P. Berrangépreserve_env NM 7272e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 7273e811da7fSDaniel P. Berrangépreserve_env PATH 7274e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 7275e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 7276e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 7277e811da7fSDaniel P. Berrangépreserve_env PYTHON 7278e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 7279e811da7fSDaniel P. Berrangépreserve_env SMBD 7280e811da7fSDaniel P. Berrangépreserve_env STRIP 7281e811da7fSDaniel P. Berrangépreserve_env WINDRES 7282e811da7fSDaniel P. Berrangé 7283dc655404SMichael S. Tsirkinprintf "exec" >>config.status 7284a5665051SPaolo Bonzinifor i in "$0" "$@"; do 7285a5665051SPaolo Bonzini test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status 7286a5665051SPaolo Bonzinidone 7287cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 7288dc655404SMichael S. Tsirkinchmod +x config.status 7289dc655404SMichael S. Tsirkin 72908cd05ab6SPeter Maydellrm -r "$TMPDIR1" 7291