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 148cd05ab6SPeter Maydell# Temporary directory used for files created while 158cd05ab6SPeter Maydell# configure runs. Since it is in the build directory 168cd05ab6SPeter Maydell# we can safely blow away any previous version of it 178cd05ab6SPeter Maydell# (and we need not jump through hoops to try to delete 188cd05ab6SPeter Maydell# it when configure exits.) 198cd05ab6SPeter MaydellTMPDIR1="config-temp" 208cd05ab6SPeter Maydellrm -rf "${TMPDIR1}" 218cd05ab6SPeter Maydellmkdir -p "${TMPDIR1}" 228cd05ab6SPeter Maydellif [ $? -ne 0 ]; then 238cd05ab6SPeter Maydell echo "ERROR: failed to create temporary directory" 248cd05ab6SPeter Maydell exit 1 257d13299dSbellardfi 267d13299dSbellard 278cd05ab6SPeter MaydellTMPB="qemu-conf" 288cd05ab6SPeter MaydellTMPC="${TMPDIR1}/${TMPB}.c" 2966518bf6SDon SlutzTMPO="${TMPDIR1}/${TMPB}.o" 309c83ffd8SPeter MaydellTMPCXX="${TMPDIR1}/${TMPB}.cxx" 318cd05ab6SPeter MaydellTMPE="${TMPDIR1}/${TMPB}.exe" 326969ec6cSJames ClarkeTMPMO="${TMPDIR1}/${TMPB}.mo" 337d13299dSbellard 34da1d85e3SGerd Hoffmannrm -f config.log 359ac81bbbSmalc 36b48e3611SPeter Maydell# Print a helpful header at the top of config.log 37b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 38979ae168SPeter Maydellprintf "# Configured with:" >> config.log 39979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 40979ae168SPeter Maydellecho >> config.log 41b48e3611SPeter Maydellecho "#" >> config.log 42b48e3611SPeter Maydell 43d880a3baSPaolo Bonziniprint_error() { 44d880a3baSPaolo Bonzini (echo 4576ad07a4SPeter Maydell echo "ERROR: $1" 4676ad07a4SPeter Maydell while test -n "$2"; do 4776ad07a4SPeter Maydell echo " $2" 4876ad07a4SPeter Maydell shift 4976ad07a4SPeter Maydell done 50d880a3baSPaolo Bonzini echo) >&2 51d880a3baSPaolo Bonzini} 52d880a3baSPaolo Bonzini 53d880a3baSPaolo Bonzinierror_exit() { 54d880a3baSPaolo Bonzini print_error "$@" 5576ad07a4SPeter Maydell exit 1 5676ad07a4SPeter Maydell} 5776ad07a4SPeter Maydell 589c83ffd8SPeter Maydelldo_compiler() { 599c83ffd8SPeter Maydell # Run the compiler, capturing its output to the log. First argument 609c83ffd8SPeter Maydell # is compiler binary to execute. 619c83ffd8SPeter Maydell local compiler="$1" 629c83ffd8SPeter Maydell shift 638bbe05d7SIan Jackson if test -n "$BASH_VERSION"; then eval ' 648bbe05d7SIan Jackson echo >>config.log " 658bbe05d7SIan Jacksonfuncs: ${FUNCNAME[*]} 668bbe05d7SIan Jacksonlines: ${BASH_LINENO[*]}" 678bbe05d7SIan Jackson '; fi 689c83ffd8SPeter Maydell echo $compiler "$@" >> config.log 699c83ffd8SPeter Maydell $compiler "$@" >> config.log 2>&1 || return $? 708dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 718dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 728dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 738dc38a78SPeter Maydell # obvious to developers. 748dc38a78SPeter Maydell if test "$werror" != "yes"; then 758dc38a78SPeter Maydell return 0 768dc38a78SPeter Maydell fi 778dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 788dc38a78SPeter Maydell case "$*" in 798dc38a78SPeter Maydell *-Werror*) 808dc38a78SPeter Maydell return 0 818dc38a78SPeter Maydell ;; 828dc38a78SPeter Maydell esac 839c83ffd8SPeter Maydell echo $compiler -Werror "$@" >> config.log 849c83ffd8SPeter Maydell $compiler -Werror "$@" >> config.log 2>&1 && return $? 8576ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 8676ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 8776ad07a4SPeter Maydell "will be at the bottom of config.log." \ 8876ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 898dc38a78SPeter Maydell} 908dc38a78SPeter Maydell 919c83ffd8SPeter Maydelldo_cc() { 929c83ffd8SPeter Maydell do_compiler "$cc" "$@" 939c83ffd8SPeter Maydell} 949c83ffd8SPeter Maydell 959c83ffd8SPeter Maydelldo_cxx() { 969c83ffd8SPeter Maydell do_compiler "$cxx" "$@" 979c83ffd8SPeter Maydell} 989c83ffd8SPeter Maydell 999c83ffd8SPeter Maydellupdate_cxxflags() { 1009c83ffd8SPeter Maydell # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 1019c83ffd8SPeter Maydell # options which some versions of GCC's C++ compiler complain about 1029c83ffd8SPeter Maydell # because they only make sense for C programs. 10311cde1c8SBruno Dominguez QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS" 10411cde1c8SBruno Dominguez 1059c83ffd8SPeter Maydell for arg in $QEMU_CFLAGS; do 1069c83ffd8SPeter Maydell case $arg in 1079c83ffd8SPeter Maydell -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 1089c83ffd8SPeter Maydell -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 1099c83ffd8SPeter Maydell ;; 1107be41675SThomas Huth -std=gnu99) 1117be41675SThomas Huth QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98" 1127be41675SThomas Huth ;; 1139c83ffd8SPeter Maydell *) 1149c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1159c83ffd8SPeter Maydell ;; 1169c83ffd8SPeter Maydell esac 1179c83ffd8SPeter Maydell done 1189c83ffd8SPeter Maydell} 1199c83ffd8SPeter Maydell 12052166aa0SJuan Quintelacompile_object() { 121fd0e6053SJohn Snow local_cflags="$1" 122fd0e6053SJohn Snow do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 12352166aa0SJuan Quintela} 12452166aa0SJuan Quintela 12552166aa0SJuan Quintelacompile_prog() { 12652166aa0SJuan Quintela local_cflags="$1" 12752166aa0SJuan Quintela local_ldflags="$2" 1288dc38a78SPeter Maydell do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags 12952166aa0SJuan Quintela} 13052166aa0SJuan Quintela 13111568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 13211568d6dSPaolo Bonzinisymlink() { 13372b8b5a1SStefan Weil rm -rf "$2" 134ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 13572b8b5a1SStefan Weil ln -s "$1" "$2" 13611568d6dSPaolo Bonzini} 13711568d6dSPaolo Bonzini 1380dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1390dba6195SLoïc Minier# executable or a builtin) 1400dba6195SLoïc Minierhas() { 1410dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1420dba6195SLoïc Minier} 1430dba6195SLoïc Minier 1440dba6195SLoïc Minier# search for an executable in PATH 1450dba6195SLoïc Minierpath_of() { 1460dba6195SLoïc Minier local_command="$1" 1470dba6195SLoïc Minier local_ifs="$IFS" 1480dba6195SLoïc Minier local_dir="" 1490dba6195SLoïc Minier 1500dba6195SLoïc Minier # pathname has a dir component? 1510dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 1520dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 1530dba6195SLoïc Minier echo "$local_command" 1540dba6195SLoïc Minier return 0 1550dba6195SLoïc Minier fi 1560dba6195SLoïc Minier fi 1570dba6195SLoïc Minier if [ -z "$local_command" ]; then 1580dba6195SLoïc Minier return 1 1590dba6195SLoïc Minier fi 1600dba6195SLoïc Minier 1610dba6195SLoïc Minier IFS=: 1620dba6195SLoïc Minier for local_dir in $PATH; do 1630dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 1640dba6195SLoïc Minier echo "$local_dir/$local_command" 1650dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1660dba6195SLoïc Minier return 0 1670dba6195SLoïc Minier fi 1680dba6195SLoïc Minier done 1690dba6195SLoïc Minier # not found 1700dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1710dba6195SLoïc Minier return 1 1720dba6195SLoïc Minier} 1730dba6195SLoïc Minier 1745b808275SLluís Vilanovahave_backend () { 1755b808275SLluís Vilanova echo "$trace_backends" | grep "$1" >/dev/null 1765b808275SLluís Vilanova} 1775b808275SLluís Vilanova 1783b6b7550SPaolo Bonziniglob() { 1793b6b7550SPaolo Bonzini eval test -z '"${1#'"$2"'}"' 1803b6b7550SPaolo Bonzini} 1813b6b7550SPaolo Bonzini 1823b6b7550SPaolo Bonzinisupported_hax_target() { 1833b6b7550SPaolo Bonzini test "$hax" = "yes" || return 1 1843b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 1853b6b7550SPaolo Bonzini case "${1%-softmmu}" in 1863b6b7550SPaolo Bonzini i386|x86_64) 1873b6b7550SPaolo Bonzini return 0 1883b6b7550SPaolo Bonzini ;; 1893b6b7550SPaolo Bonzini esac 1903b6b7550SPaolo Bonzini return 1 1913b6b7550SPaolo Bonzini} 1923b6b7550SPaolo Bonzini 1933b6b7550SPaolo Bonzinisupported_kvm_target() { 1943b6b7550SPaolo Bonzini test "$kvm" = "yes" || return 1 1953b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 1963b6b7550SPaolo Bonzini case "${1%-softmmu}:$cpu" in 1973b6b7550SPaolo Bonzini arm:arm | aarch64:aarch64 | \ 1983b6b7550SPaolo Bonzini i386:i386 | i386:x86_64 | i386:x32 | \ 1993b6b7550SPaolo Bonzini x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ 2003b6b7550SPaolo Bonzini mips:mips | mipsel:mips | \ 201a69dc537SThomas Huth ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | \ 2023b6b7550SPaolo Bonzini s390x:s390x) 2033b6b7550SPaolo Bonzini return 0 2043b6b7550SPaolo Bonzini ;; 2053b6b7550SPaolo Bonzini esac 2063b6b7550SPaolo Bonzini return 1 2073b6b7550SPaolo Bonzini} 2083b6b7550SPaolo Bonzini 2093b6b7550SPaolo Bonzinisupported_xen_target() { 2103b6b7550SPaolo Bonzini test "$xen" = "yes" || return 1 2113b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 212b5ed2e11SPaolo Bonzini # Only i386 and x86_64 provide the xenpv machine. 213b5ed2e11SPaolo Bonzini case "${1%-softmmu}" in 214b5ed2e11SPaolo Bonzini i386|x86_64) 2153b6b7550SPaolo Bonzini return 0 2163b6b7550SPaolo Bonzini ;; 2173b6b7550SPaolo Bonzini esac 2183b6b7550SPaolo Bonzini return 1 2193b6b7550SPaolo Bonzini} 2203b6b7550SPaolo Bonzini 221c97d6d2cSSergio Andres Gomez Del Realsupported_hvf_target() { 222c97d6d2cSSergio Andres Gomez Del Real test "$hvf" = "yes" || return 1 223c97d6d2cSSergio Andres Gomez Del Real glob "$1" "*-softmmu" || return 1 224c97d6d2cSSergio Andres Gomez Del Real case "${1%-softmmu}" in 225c97d6d2cSSergio Andres Gomez Del Real x86_64) 226c97d6d2cSSergio Andres Gomez Del Real return 0 227c97d6d2cSSergio Andres Gomez Del Real ;; 228c97d6d2cSSergio Andres Gomez Del Real esac 229c97d6d2cSSergio Andres Gomez Del Real return 1 230c97d6d2cSSergio Andres Gomez Del Real} 231c97d6d2cSSergio Andres Gomez Del Real 232d661d9a4SJustin Terry (VM)supported_whpx_target() { 233d661d9a4SJustin Terry (VM) test "$whpx" = "yes" || return 1 234d661d9a4SJustin Terry (VM) glob "$1" "*-softmmu" || return 1 235d661d9a4SJustin Terry (VM) case "${1%-softmmu}" in 236d661d9a4SJustin Terry (VM) i386|x86_64) 237d661d9a4SJustin Terry (VM) return 0 238d661d9a4SJustin Terry (VM) ;; 239d661d9a4SJustin Terry (VM) esac 240d661d9a4SJustin Terry (VM) return 1 241d661d9a4SJustin Terry (VM)} 242d661d9a4SJustin Terry (VM) 243d880a3baSPaolo Bonzinisupported_target() { 244d880a3baSPaolo Bonzini case "$1" in 245d880a3baSPaolo Bonzini *-softmmu) 246d880a3baSPaolo Bonzini ;; 247d880a3baSPaolo Bonzini *-linux-user) 248d880a3baSPaolo Bonzini if test "$linux" != "yes"; then 249d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a Linux host" 250d880a3baSPaolo Bonzini return 1 251d880a3baSPaolo Bonzini fi 252d880a3baSPaolo Bonzini ;; 253d880a3baSPaolo Bonzini *-bsd-user) 254d880a3baSPaolo Bonzini if test "$bsd" != "yes"; then 255d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a BSD host" 256d880a3baSPaolo Bonzini return 1 257d880a3baSPaolo Bonzini fi 258d880a3baSPaolo Bonzini ;; 259d880a3baSPaolo Bonzini *) 260d880a3baSPaolo Bonzini print_error "Invalid target name '$target'" 261d880a3baSPaolo Bonzini return 1 262d880a3baSPaolo Bonzini ;; 263d880a3baSPaolo Bonzini esac 264b3f6ea7eSPaolo Bonzini test "$tcg" = "yes" && return 0 265b3f6ea7eSPaolo Bonzini supported_kvm_target "$1" && return 0 266b3f6ea7eSPaolo Bonzini supported_xen_target "$1" && return 0 267b3f6ea7eSPaolo Bonzini supported_hax_target "$1" && return 0 268c97d6d2cSSergio Andres Gomez Del Real supported_hvf_target "$1" && return 0 269d661d9a4SJustin Terry (VM) supported_whpx_target "$1" && return 0 270b3f6ea7eSPaolo Bonzini print_error "TCG disabled, but hardware accelerator not available for '$target'" 271b3f6ea7eSPaolo Bonzini return 1 272d880a3baSPaolo Bonzini} 273d880a3baSPaolo Bonzini 274e9a3591fSChristian Borntraeger 275e9a3591fSChristian Borntraegerld_has() { 276e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 277e9a3591fSChristian Borntraeger} 278e9a3591fSChristian Borntraeger 2797d13299dSbellard# default parameters 28089138857SStefan Weilsource_path=$(dirname "$0") 2812ff6b91eSJuan Quintelacpu="" 282a31a8642SMichael S. Tsirkiniasl="iasl" 2831e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 28443ce4dfeSbellardstatic="no" 2857d13299dSbellardcross_prefix="" 2860c58ac1cSmalcaudio_drv_list="" 287b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 288b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 289e49d021eSPeter Maydellhost_cc="cc" 29073da375eSJuan Quintelalibs_softmmu="" 2913e2e0e6bSJuan Quintelalibs_tools="" 29267f86e8eSJuan Quintelaaudio_pt_int="" 293d5631638Smalcaudio_win_int="" 294957f1f99SMichael Rothlibs_qga="" 2955bc62e01SGerd Hoffmanndebug_info="yes" 29663678e17SSteven Noonanstack_protector="" 297ac0df51dSaliguori 29892712822SDaniel P. Berrangeif test -e "$source_path/.git" 29992712822SDaniel P. Berrangethen 300f62bbee5SDaniel P. Berrange git_update=yes 30192712822SDaniel P. Berrange git_submodules="ui/keycodemapdb" 3023ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 3033ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 30492712822SDaniel P. Berrangeelse 305f62bbee5SDaniel P. Berrange git_update=no 306aef45d51SDaniel P. Berrange git_submodules="" 3075c0ef67aSDaniel P. Berrangé 3085c0ef67aSDaniel P. Berrangé if ! test -f "$source_path/ui/keycodemapdb/README" 3095c0ef67aSDaniel P. Berrangé then 3105c0ef67aSDaniel P. Berrangé echo 3115c0ef67aSDaniel P. Berrangé echo "ERROR: missing file $source_path/ui/keycodemapdb/README" 3125c0ef67aSDaniel P. Berrangé echo 3135c0ef67aSDaniel P. Berrangé echo "This is not a GIT checkout but module content appears to" 3145c0ef67aSDaniel P. Berrangé echo "be missing. Do not use 'git archive' or GitHub download links" 3155c0ef67aSDaniel P. Berrangé echo "to acquire QEMU source archives. Non-GIT builds are only" 3165c0ef67aSDaniel P. Berrangé echo "supported with source archives linked from:" 3175c0ef67aSDaniel P. Berrangé echo 3185c0ef67aSDaniel P. Berrangé echo " https://www.qemu.org/download/" 3195c0ef67aSDaniel P. Berrangé echo 3205c0ef67aSDaniel P. Berrangé echo "Developers working with GIT can use scripts/archive-source.sh" 3215c0ef67aSDaniel P. Berrangé echo "if they need to create valid source archives." 3225c0ef67aSDaniel P. Berrangé echo 3235c0ef67aSDaniel P. Berrangé exit 1 3245c0ef67aSDaniel P. Berrangé fi 32592712822SDaniel P. Berrangefi 326cc84d63aSDaniel P. Berrangegit="git" 327ac0df51dSaliguori 328afb63ebdSStefan Weil# Don't accept a target_list environment variable. 329afb63ebdSStefan Weilunset target_list 330377529c0SPaolo Bonzini 331377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 332377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 333377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 334377529c0SPaolo Bonzini# unless --disable-foo is given 335377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 336377529c0SPaolo Bonzini# feature will searched for, 337377529c0SPaolo Bonzini# if not found, configure exits with error 338377529c0SPaolo Bonzini# 339377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 340377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 341377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 342377529c0SPaolo Bonzini 343377529c0SPaolo Bonzinibluez="" 344377529c0SPaolo Bonzinibrlapi="" 345377529c0SPaolo Bonzinicurl="" 346377529c0SPaolo Bonzinicurses="" 347377529c0SPaolo Bonzinidocs="" 348377529c0SPaolo Bonzinifdt="" 34958952137SVincenzo Maffionenetmap="no" 350377529c0SPaolo Bonzinisdl="" 351a442fe2fSDaniel P. Berrangésdl_image="" 352983eef5aSMeador Ingevirtfs="" 353fe8fc5aeSPaolo Bonzinimpath="" 354821601eaSJes Sorensenvnc="yes" 355377529c0SPaolo Bonzinisparse="no" 356377529c0SPaolo Bonzinivde="" 357377529c0SPaolo Bonzinivnc_sasl="" 358377529c0SPaolo Bonzinivnc_jpeg="" 359377529c0SPaolo Bonzinivnc_png="" 3606a021536SGerd Hoffmannxkbcommon="" 361377529c0SPaolo Bonzinixen="" 362d5b93ddfSAnthony PERARDxen_ctrl_version="" 363eb6fda0fSAnthony PERARDxen_pci_passthrough="" 364377529c0SPaolo Bonzinilinux_aio="" 36547e98658SCorey Bryantcap_ng="" 366377529c0SPaolo Bonziniattr="" 3674f26f2b6SAvi Kivitylibattr="" 368377529c0SPaolo Bonzinixfs="" 369b3f6ea7eSPaolo Bonzinitcg="yes" 370a40161cbSPaolo Bonzinimembarrier="" 371d41a75a2SBradvhost_net="no" 372042cea27SGongleivhost_crypto="no" 3735e9be92dSNicholas Bellingervhost_scsi="no" 374fc0b9b0eSStefan Hajnoczivhost_vsock="no" 375e6a74868SMarc-André Lureauvhost_user="" 376d41a75a2SBradkvm="no" 377b0cb0a66SVincent Palatinhax="no" 378c97d6d2cSSergio Andres Gomez Del Realhvf="no" 379d661d9a4SJustin Terry (VM)whpx="no" 3802da776dbSMichael R. Hinesrdma="" 38121ab34c9SMarcel Apfelbaumpvrdma="" 382377529c0SPaolo Bonzinigprof="no" 383377529c0SPaolo Bonzinidebug_tcg="no" 384377529c0SPaolo Bonzinidebug="no" 385247724cbSMarc-André Lureausanitizers="no" 386b553a042SJohn Snowfortify_source="" 387377529c0SPaolo Bonzinistrip_opt="yes" 3889195b2c2SStefan Weiltcg_interpreter="no" 389377529c0SPaolo Bonzinibigendian="no" 390377529c0SPaolo Bonzinimingw32="no" 3911d728c39SBlue Swirlgcov="no" 3921d728c39SBlue Swirlgcov_tool="gcov" 393377529c0SPaolo BonziniEXESUF="" 39417969268SFam ZhengDSOSUF=".so" 39517969268SFam ZhengLDFLAGS_SHARED="-shared" 39617969268SFam Zhengmodules="no" 397377529c0SPaolo Bonziniprefix="/usr/local" 398377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 399528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 4003d5eecabSGerd Hoffmannfirmwarepath="\${prefix}/share/qemu-firmware" 401850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 402377529c0SPaolo Bonzinibindir="\${prefix}/bin" 4033aa5d2beSAlon Levylibdir="\${prefix}/lib" 4048bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 4050f94d6daSAlon Levyincludedir="\${prefix}/include" 406377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 407785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 408377529c0SPaolo Bonziniconfsuffix="/qemu" 409377529c0SPaolo Bonzinislirp="yes" 410377529c0SPaolo Bonzinioss_lib="" 411377529c0SPaolo Bonzinibsd="no" 412377529c0SPaolo Bonzinilinux="no" 413377529c0SPaolo Bonzinisolaris="no" 414377529c0SPaolo Bonziniprofiler="no" 415377529c0SPaolo Bonzinicocoa="no" 416377529c0SPaolo Bonzinisoftmmu="yes" 417377529c0SPaolo Bonzinilinux_user="no" 418377529c0SPaolo Bonzinibsd_user="no" 419377529c0SPaolo Bonziniblobs="yes" 420377529c0SPaolo Bonzinipkgversion="" 42140d6444eSAvi Kivitypie="" 4223556c233SPaolo Bonziniqom_cast_debug="yes" 423baf86d6bSPaolo Bonzinitrace_backends="log" 424377529c0SPaolo Bonzinitrace_file="trace" 425377529c0SPaolo Bonzinispice="" 426377529c0SPaolo Bonzinirbd="" 4277b02f544SMarc-André Lureausmartcard="" 4282b2325ffSGerd Hoffmannlibusb="" 42969354a83SHans de Goedeusb_redir="" 430da076ffeSGerd Hoffmannopengl="" 431014cb152SGerd Hoffmannopengl_dmabuf="no" 4325dd89908SRichard Hendersoncpuid_h="no" 43386583a07SLiam Merwickavx2_opt="" 4341ece9905SAlon Levyzlib="yes" 4358ca80760SRichard Hendersoncapstone="" 436b25c9dffSStefan Weillzo="" 437b25c9dffSStefan Weilsnappy="" 4386b383c08SPeter Wubzip2="" 43983bc1f97SJulio Faraccolzfse="" 440e8ef31a3SMichael Tokarevguest_agent="" 441d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 44250cbebb9SMichael Rothguest_agent_ntddscsi="no" 4439dacf32dSYossi Hindinguest_agent_msi="" 444d9840e25STomoki Sekiyamavss_win32_sdk="" 445d9840e25STomoki Sekiyamawin_sdk="no" 4464b1c11fdSDaniel P. Berrangewant_tools="yes" 447c589b249SRonnie Sahlberglibiscsi="" 4486542aa9cSPeter Lievenlibnfs="" 449519175a2SAlex Barcelocoroutine="" 45070c60c08SStefan Hajnoczicoroutine_pool="" 4517d992e4dSPeter Lievendebug_stack_usage="no" 452f0d92b56SLongpeng(Mike)crypto_afalg="no" 453f794573eSEduardo Otuboseccomp="" 454eb100396SBharata B Raoglusterfs="" 455d85fa9ebSJeff Codyglusterfs_xlator_opt="no" 4560c14fb47SBharata B Raoglusterfs_discard="no" 457df3a429aSNiels de Vosglusterfs_fallocate="no" 4587c815372SBharata B Raoglusterfs_zerofill="no" 459a4ccabcfSAnthony Liguorigtk="" 460925a0400SGerd Hoffmanngtk_gl="no" 461a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 462ddbb0d09SDaniel P. Berrangegnutls="" 46391bfcdb0SDaniel P. Berrangenettle="" 46491bfcdb0SDaniel P. Berrangegcrypt="" 4651f923c70SLongpeng(Mike)gcrypt_hmac="no" 466bbbf9bfbSStefan Weilvte="" 4679d9e1521SGerd Hoffmannvirglrenderer="" 468e91c793cSCole Robinsontpm="yes" 4690a12ec87SRichard W.M. Joneslibssh2="" 470ed1701c6SDr. David Alan Gilbertlive_block_migration="yes" 471a99d57bbSWanlong Gaonuma="" 4722847b469SFam Zhengtcmalloc="no" 4737b01cb97SAlexandre Derumierjemalloc="no" 474a6b1d4c0SChanglong Xiereplication="yes" 475da92c3ffSAshish Mittalvxhs="" 4762f740136SJeff Codybochs="yes" 4772f740136SJeff Codycloop="yes" 4782f740136SJeff Codydmg="yes" 4792f740136SJeff Codyqcow1="yes" 4802f740136SJeff Codyvdi="yes" 4812f740136SJeff Codyvvfat="yes" 4822f740136SJeff Codyqed="yes" 4832f740136SJeff Codyparallels="yes" 4842f740136SJeff Codysheepdog="yes" 485ed279a06SKlim Kireevlibxml2="" 48651a12b51SAlex Bennéedocker="no" 487ba59fb77SPaolo Bonzinidebug_mutex="no" 48817824406SJunyan Helibpmem="" 4893efac6ebSTomáš Golembiovskýlibudev="no" 490377529c0SPaolo Bonzini 491d75402b5SAlex Bennée# cross compilers defaults, can be overridden with --cross-cc-ARCH 492d75402b5SAlex Bennéecross_cc_aarch64="aarch64-linux-gnu-gcc" 493d422b2bcSAlex Bennéecross_cc_aarch64_be="$cross_cc_aarch64" 494d422b2bcSAlex Bennéecross_cc_cflags_aarch64_be="-mbig-endian" 495d75402b5SAlex Bennéecross_cc_arm="arm-linux-gnueabihf-gcc" 496d422b2bcSAlex Bennéecross_cc_cflags_armeb="-mbig-endian" 497716a507cSAlex Bennéecross_cc_i386="i386-pc-linux-gnu-gcc" 498716a507cSAlex Bennéecross_cc_cflags_i386="" 499d75402b5SAlex Bennéecross_cc_powerpc="powerpc-linux-gnu-gcc" 500d422b2bcSAlex Bennéecross_cc_powerpc="powerpc-linux-gnu-gcc" 501d75402b5SAlex Bennée 502d75402b5SAlex Bennéeenabled_cross_compilers="" 503d75402b5SAlex Bennée 504898be3e0SPeter Maydellsupported_cpu="no" 505898be3e0SPeter Maydellsupported_os="no" 506fb59dabdSPeter Maydellbogus_os="no" 5075a22ab71SYang Zhongmalloc_trim="" 508898be3e0SPeter Maydell 509ac0df51dSaliguori# parse CC options first 510ac0df51dSaliguorifor opt do 51189138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 512ac0df51dSaliguori case "$opt" in 513ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 514ac0df51dSaliguori ;; 5153d8df640SPaolo Bonzini --cc=*) CC="$optarg" 516ac0df51dSaliguori ;; 51783f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 51883f73fceSTomoki Sekiyama ;; 519ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 520ca4deeb1SPaolo Bonzini ;; 5212ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 5222ff6b91eSJuan Quintela ;; 523de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 524e2a2ed06SJuan Quintela ;; 52511cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 52611cde1c8SBruno Dominguez ;; 527a4969e90SAlex Bennée --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" 528f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 529e2a2ed06SJuan Quintela ;; 5305bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 5315bc62e01SGerd Hoffmann ;; 5325bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 5335bc62e01SGerd Hoffmann ;; 534d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 535d75402b5SAlex Bennée ;; 536d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 537d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 538d422b2bcSAlex Bennée ;; 539d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 540d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 541d75402b5SAlex Bennée ;; 542ac0df51dSaliguori esac 543ac0df51dSaliguoridone 544ac0df51dSaliguori# OS specific 545ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 54693148aa5SStefan Weil# we can eliminate its usage altogether. 547ac0df51dSaliguori 548e49d021eSPeter Maydell# Preferred compiler: 549e49d021eSPeter Maydell# ${CC} (if set) 550e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 551e49d021eSPeter Maydell# system compiler 552e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 553e49d021eSPeter Maydell cc="$host_cc" 554e49d021eSPeter Maydellelse 555b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 556e49d021eSPeter Maydellfi 557e49d021eSPeter Maydell 55883f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 55983f73fceSTomoki Sekiyama cxx="c++" 56083f73fceSTomoki Sekiyamaelse 56183f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 56283f73fceSTomoki Sekiyamafi 56383f73fceSTomoki Sekiyama 564b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 565cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 5665f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 5673dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 568b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 569b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 5709f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 5714852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 572b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 573b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 57417884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 57517884d7bSSergei Trofimovichquery_pkg_config() { 57617884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 57717884d7bSSergei Trofimovich} 57817884d7bSSergei Trofimovichpkg_config=query_pkg_config 57947c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 580ac0df51dSaliguori 58145d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 58245d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 58345d285abSPeter Maydell 584be17dc90SMichael S. Tsirkin# default flags for all hosts 5852d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 5862d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 5872d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 5882d31515bSPeter Maydell# provides these semantics.) 5897be41675SThomas HuthQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS" 590f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 591c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 592be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 5939edc19c9SMichael S. TsirkinQEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include" 5945bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 5955bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 596be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 5975bc62e01SGerd Hoffmannfi 598be17dc90SMichael S. Tsirkin 599ca4deeb1SPaolo Bonzini# make source path absolute 60089138857SStefan Weilsource_path=$(cd "$source_path"; pwd) 601ca4deeb1SPaolo Bonzini 602cab00a5aSMichael S. Tsirkin# running configure in the source tree? 603cab00a5aSMichael S. Tsirkin# we know that's the case if configure is there. 604cab00a5aSMichael S. Tsirkinif test -f "./configure"; then 605cab00a5aSMichael S. Tsirkin pwd_is_source_path="y" 606cab00a5aSMichael S. Tsirkinelse 607cab00a5aSMichael S. Tsirkin pwd_is_source_path="n" 608cab00a5aSMichael S. Tsirkinfi 609cab00a5aSMichael S. Tsirkin 610ac0df51dSaliguoricheck_define() { 611ac0df51dSaliguoricat > $TMPC <<EOF 612ac0df51dSaliguori#if !defined($1) 613fd786e1aSPeter Maydell#error $1 not defined 614ac0df51dSaliguori#endif 615ac0df51dSaliguoriint main(void) { return 0; } 616ac0df51dSaliguoriEOF 61752166aa0SJuan Quintela compile_object 618ac0df51dSaliguori} 619ac0df51dSaliguori 620307119e7SGerd Hoffmanncheck_include() { 621307119e7SGerd Hoffmanncat > $TMPC <<EOF 622307119e7SGerd Hoffmann#include <$1> 623307119e7SGerd Hoffmannint main(void) { return 0; } 624307119e7SGerd HoffmannEOF 625307119e7SGerd Hoffmann compile_object 626307119e7SGerd Hoffmann} 627307119e7SGerd Hoffmann 62893b25869SJohn Snowwrite_c_skeleton() { 62993b25869SJohn Snow cat > $TMPC <<EOF 63093b25869SJohn Snowint main(void) { return 0; } 63193b25869SJohn SnowEOF 63293b25869SJohn Snow} 63393b25869SJohn Snow 634bbea4050SPeter Maydellif check_define __linux__ ; then 635bbea4050SPeter Maydell targetos="Linux" 636bbea4050SPeter Maydellelif check_define _WIN32 ; then 637bbea4050SPeter Maydell targetos='MINGW32' 638bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 639bbea4050SPeter Maydell targetos='OpenBSD' 640bbea4050SPeter Maydellelif check_define __sun__ ; then 641bbea4050SPeter Maydell targetos='SunOS' 642bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 643bbea4050SPeter Maydell targetos='Haiku' 644951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 645951fedfcSPeter Maydell targetos='FreeBSD' 646951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 647951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 648951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 649951fedfcSPeter Maydell targetos='DragonFly' 650951fedfcSPeter Maydellelif check_define __NetBSD__; then 651951fedfcSPeter Maydell targetos='NetBSD' 652951fedfcSPeter Maydellelif check_define __APPLE__; then 653951fedfcSPeter Maydell targetos='Darwin' 654bbea4050SPeter Maydellelse 655951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 656951fedfcSPeter Maydell # might be going to just print the --help text, or it might 657951fedfcSPeter Maydell # be the result of a missing compiler. 658951fedfcSPeter Maydell targetos='bogus' 659951fedfcSPeter Maydell bogus_os='yes' 660bbea4050SPeter Maydellfi 661bbea4050SPeter Maydell 662bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 663bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 664bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 665bbea4050SPeter Maydell# the correct CPU with the --cpu option. 666bbea4050SPeter Maydellcase $targetos in 667bbea4050SPeter MaydellDarwin) 668bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 669bbea4050SPeter Maydell # run 64-bit userspace code. 670bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 671bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 672bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 673bbea4050SPeter Maydell cpu="x86_64" 674bbea4050SPeter Maydell fi 675bbea4050SPeter Maydell ;; 676bbea4050SPeter MaydellSunOS) 67789138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 678bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 679bbea4050SPeter Maydell cpu="x86_64" 680bbea4050SPeter Maydell fi 681bbea4050SPeter Maydellesac 682bbea4050SPeter Maydell 6832ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 6842ff6b91eSJuan Quintela # command line argument 6852ff6b91eSJuan Quintela : 6862ff6b91eSJuan Quintelaelif check_define __i386__ ; then 687ac0df51dSaliguori cpu="i386" 688ac0df51dSaliguorielif check_define __x86_64__ ; then 689c72b26ecSRichard Henderson if check_define __ILP32__ ; then 690c72b26ecSRichard Henderson cpu="x32" 691c72b26ecSRichard Henderson else 692ac0df51dSaliguori cpu="x86_64" 693c72b26ecSRichard Henderson fi 6943aa9bd6cSblueswir1elif check_define __sparc__ ; then 6953aa9bd6cSblueswir1 if check_define __arch64__ ; then 6963aa9bd6cSblueswir1 cpu="sparc64" 6973aa9bd6cSblueswir1 else 6983aa9bd6cSblueswir1 cpu="sparc" 6993aa9bd6cSblueswir1 fi 700fdf7ed96Smalcelif check_define _ARCH_PPC ; then 701fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 702fdf7ed96Smalc cpu="ppc64" 703ac0df51dSaliguori else 704fdf7ed96Smalc cpu="ppc" 705fdf7ed96Smalc fi 706afa05235SAurelien Jarnoelif check_define __mips__ ; then 707afa05235SAurelien Jarno cpu="mips" 708d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 709d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 710d66ed0eaSAurelien Jarno cpu="s390x" 711d66ed0eaSAurelien Jarno else 712d66ed0eaSAurelien Jarno cpu="s390" 713d66ed0eaSAurelien Jarno fi 714c4f80543SAlistair Franciselif check_define __riscv ; then 715c4f80543SAlistair Francis if check_define _LP64 ; then 716c4f80543SAlistair Francis cpu="riscv64" 717c4f80543SAlistair Francis else 718c4f80543SAlistair Francis cpu="riscv32" 719c4f80543SAlistair Francis fi 72021d89f84SPeter Maydellelif check_define __arm__ ; then 72121d89f84SPeter Maydell cpu="arm" 7221f080313SClaudio Fontanaelif check_define __aarch64__ ; then 7231f080313SClaudio Fontana cpu="aarch64" 724fdf7ed96Smalcelse 72589138857SStefan Weil cpu=$(uname -m) 726ac0df51dSaliguorifi 727ac0df51dSaliguori 728359bc95dSPeter MaydellARCH= 729359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 730359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 7317d13299dSbellardcase "$cpu" in 732c4f80543SAlistair Francis ppc|ppc64|s390|s390x|sparc64|x32|riscv32|riscv64) 733898be3e0SPeter Maydell cpu="$cpu" 734898be3e0SPeter Maydell supported_cpu="yes" 735d75402b5SAlex Bennée eval "cross_cc_${cpu}=\$host_cc" 736898be3e0SPeter Maydell ;; 7377d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 73897a847bcSbellard cpu="i386" 739898be3e0SPeter Maydell supported_cpu="yes" 740d75402b5SAlex Bennée cross_cc_i386=$host_cc 7417d13299dSbellard ;; 742aaa5fa14Saurel32 x86_64|amd64) 743aaa5fa14Saurel32 cpu="x86_64" 744898be3e0SPeter Maydell supported_cpu="yes" 745d75402b5SAlex Bennée cross_cc_x86_64=$host_cc 746aaa5fa14Saurel32 ;; 74721d89f84SPeter Maydell armv*b|armv*l|arm) 74821d89f84SPeter Maydell cpu="arm" 749898be3e0SPeter Maydell supported_cpu="yes" 750d75402b5SAlex Bennée cross_cc_arm=$host_cc 7517d13299dSbellard ;; 7521f080313SClaudio Fontana aarch64) 7531f080313SClaudio Fontana cpu="aarch64" 754898be3e0SPeter Maydell supported_cpu="yes" 755d75402b5SAlex Bennée cross_cc_aarch64=$host_cc 7561f080313SClaudio Fontana ;; 757afa05235SAurelien Jarno mips*) 758afa05235SAurelien Jarno cpu="mips" 759898be3e0SPeter Maydell supported_cpu="yes" 760d75402b5SAlex Bennée cross_cc_mips=$host_cc 761afa05235SAurelien Jarno ;; 7623142255cSblueswir1 sparc|sun4[cdmuv]) 763ae228531Sbellard cpu="sparc" 7646499fd15SPeter Maydell supported_cpu="yes" 765d75402b5SAlex Bennée cross_cc_sparc=$host_cc 766ae228531Sbellard ;; 7677d13299dSbellard *) 768359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 769359bc95dSPeter Maydell ARCH=unknown 7707d13299dSbellard ;; 7717d13299dSbellardesac 772359bc95dSPeter Maydellif test -z "$ARCH"; then 773359bc95dSPeter Maydell ARCH="$cpu" 774359bc95dSPeter Maydellfi 775e2d52ad3SJuan Quintela 7767d13299dSbellard# OS specific 7770dbfc675SJuan Quintela 778adfc3e91SStacey Son# host *BSD for user mode 779adfc3e91SStacey SonHOST_VARIANT_DIR="" 780adfc3e91SStacey Son 7817d13299dSbellardcase $targetos in 78267b915a5SbellardMINGW32*) 78367b915a5Sbellard mingw32="yes" 784b0cb0a66SVincent Palatin hax="yes" 7853cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 786307119e7SGerd Hoffmann if check_include dsound.h; then 7873cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 788307119e7SGerd Hoffmann else 789307119e7SGerd Hoffmann audio_drv_list="" 790307119e7SGerd Hoffmann fi 791898be3e0SPeter Maydell supported_os="yes" 79267b915a5Sbellard;; 7935c40d2bdSthsGNU/kFreeBSD) 794a167ba50SAurelien Jarno bsd="yes" 7956a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 7960bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 7975c40d2bdSths;; 7987d3505c5SbellardFreeBSD) 7997d3505c5Sbellard bsd="yes" 8000db4a067SPaolo Bonzini make="${MAKE-gmake}" 8016a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8020bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 803f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 804f01576f1SJuergen Lock LIBS="-lutil $LIBS" 805a7764f15SEd Maste # needed for kinfo_getproc 806a7764f15SEd Maste libs_qga="-lutil $libs_qga" 80758952137SVincenzo Maffione netmap="" # enable netmap autodetect 808adfc3e91SStacey Son HOST_VARIANT_DIR="freebsd" 809898be3e0SPeter Maydell supported_os="yes" 8107d3505c5Sbellard;; 811c5e97233Sblueswir1DragonFly) 812c5e97233Sblueswir1 bsd="yes" 8130db4a067SPaolo Bonzini make="${MAKE-gmake}" 8146a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8150bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 816adfc3e91SStacey Son HOST_VARIANT_DIR="dragonfly" 817c5e97233Sblueswir1;; 8187d3505c5SbellardNetBSD) 8197d3505c5Sbellard bsd="yes" 820*604a5b99SKamil Rytarowski hax="yes" 8210db4a067SPaolo Bonzini make="${MAKE-gmake}" 8226a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8230bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 8248ef92a88Sblueswir1 oss_lib="-lossaudio" 825adfc3e91SStacey Son HOST_VARIANT_DIR="netbsd" 8263c2bdbc1SKamil Rytarowski supported_os="yes" 8277d3505c5Sbellard;; 8287d3505c5SbellardOpenBSD) 8297d3505c5Sbellard bsd="yes" 8300db4a067SPaolo Bonzini make="${MAKE-gmake}" 831f92c7168SGerd Hoffmann audio_drv_list="try-sdl" 8320bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 833adfc3e91SStacey Son HOST_VARIANT_DIR="openbsd" 8340a773d55SBrad Smith supported_os="yes" 8357d3505c5Sbellard;; 83683fb7adfSbellardDarwin) 83783fb7adfSbellard bsd="yes" 83883fb7adfSbellard darwin="yes" 839b0cb0a66SVincent Palatin hax="yes" 840c97d6d2cSSergio Andres Gomez Del Real hvf="yes" 84117969268SFam Zheng LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 8421b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 843a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 8440c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 8451b0f9cc2Saliguori fi 846fd677642Sths cocoa="yes" 8476a485418SGerd Hoffmann audio_drv_list="coreaudio try-sdl" 84814382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 8490c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 8507973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 851a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 852a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 853a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 854adfc3e91SStacey Son HOST_VARIANT_DIR="darwin" 855898be3e0SPeter Maydell supported_os="yes" 85683fb7adfSbellard;; 857ec530c81SbellardSunOS) 858ec530c81Sbellard solaris="yes" 8590db4a067SPaolo Bonzini make="${MAKE-gmake}" 8600db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 861e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 8626b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 8636a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8646b4d2ba1Sths fi 865c2de5c91Smalc audio_possible_drivers="oss sdl" 866d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 867d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 868d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 869d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 870a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 871560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 872560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 873560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 874ec530c81Sbellard;; 875179cf400SAndreas FärberHaiku) 876179cf400SAndreas Färber haiku="yes" 877179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 878179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 879179cf400SAndreas Färber;; 880898be3e0SPeter MaydellLinux) 8816a485418SGerd Hoffmann audio_drv_list="try-pa try-alsa try-sdl oss" 8820bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 8835327cf48Sbellard linux="yes" 884831b7825Sths linux_user="yes" 885af2be207SJan Kiszka kvm="yes" 886af2be207SJan Kiszka vhost_net="yes" 887042cea27SGonglei vhost_crypto="yes" 8885e9be92dSNicholas Bellinger vhost_scsi="yes" 889fc0b9b0eSStefan Hajnoczi vhost_vsock="yes" 890e8d81a61SMao Zhongyi QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES" 891898be3e0SPeter Maydell supported_os="yes" 8923efac6ebSTomáš Golembiovský libudev="yes" 893898be3e0SPeter Maydell;; 8947d13299dSbellardesac 8957d13299dSbellard 8967d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 897b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 89884778508Sblueswir1 bsd_user="yes" 8997d3505c5Sbellard fi 90008de3949SAndreas Färberfi 9017d3505c5Sbellard 9020db4a067SPaolo Bonzini: ${make=${MAKE-make}} 9030db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 90452510f8bSStefan Weil: ${python=${PYTHON-python}} 905e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 9060db4a067SPaolo Bonzini 9073c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 9083c4a4d0dSPeter Maydellif has clang; then 9093c4a4d0dSPeter Maydell objcc=clang 9103c4a4d0dSPeter Maydellelse 9113c4a4d0dSPeter Maydell objcc="$cc" 9123c4a4d0dSPeter Maydellfi 9133c4a4d0dSPeter Maydell 9143457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 9153457a3f8SJuan Quintela EXESUF=".exe" 91617969268SFam Zheng DSOSUF=".dll" 91778e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 91878e9d4adSStefan Weil QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" 919f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 92093b25869SJohn Snow write_c_skeleton; 921f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 922f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 923f7cf5d5bSStefan Weil fi 924c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 925683035deSPaolo Bonzini mandir="\${prefix}" 926528ae5b8SEduardo Habkost datadir="\${prefix}" 927850da188SEduardo Habkost qemu_docdir="\${prefix}" 928683035deSPaolo Bonzini bindir="\${prefix}" 929683035deSPaolo Bonzini sysconfdir="\${prefix}" 9305a699bbbSLaszlo Ersek local_statedir= 931683035deSPaolo Bonzini confsuffix="" 932105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 9333457a3f8SJuan Quintelafi 9343457a3f8SJuan Quintela 935487fefdbSAnthony Liguoriwerror="" 93685aa5189Sbellard 9377d13299dSbellardfor opt do 93889138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 9397d13299dSbellard case "$opt" in 9402efc3265Sbellard --help|-h) show_help=yes 9412efc3265Sbellard ;; 94299123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 94399123e13SMike Frysinger ;; 944b1a550a0Spbrook --prefix=*) prefix="$optarg" 9457d13299dSbellard ;; 946b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 94732ce6337Sbellard ;; 948ca4deeb1SPaolo Bonzini --source-path=*) 9497d13299dSbellard ;; 950ac0df51dSaliguori --cross-prefix=*) 9517d13299dSbellard ;; 952ac0df51dSaliguori --cc=*) 9537d13299dSbellard ;; 954b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 95583469015Sbellard ;; 95683f73fceSTomoki Sekiyama --cxx=*) 95783f73fceSTomoki Sekiyama ;; 958e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 959e007dbecSMichael S. Tsirkin ;; 9603c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 9613c4a4d0dSPeter Maydell ;; 962b1a550a0Spbrook --make=*) make="$optarg" 9637d13299dSbellard ;; 9646a882643Spbrook --install=*) install="$optarg" 9656a882643Spbrook ;; 966c886edfbSBlue Swirl --python=*) python="$optarg" 967c886edfbSBlue Swirl ;; 9681d728c39SBlue Swirl --gcov=*) gcov_tool="$optarg" 9691d728c39SBlue Swirl ;; 970e2d8830eSBrad --smbd=*) smbd="$optarg" 971e2d8830eSBrad ;; 972e2a2ed06SJuan Quintela --extra-cflags=*) 9737d13299dSbellard ;; 97411cde1c8SBruno Dominguez --extra-cxxflags=*) 97511cde1c8SBruno Dominguez ;; 976e2a2ed06SJuan Quintela --extra-ldflags=*) 9777d13299dSbellard ;; 9785bc62e01SGerd Hoffmann --enable-debug-info) 9795bc62e01SGerd Hoffmann ;; 9805bc62e01SGerd Hoffmann --disable-debug-info) 9815bc62e01SGerd Hoffmann ;; 982d75402b5SAlex Bennée --cross-cc-*) 983d75402b5SAlex Bennée ;; 98417969268SFam Zheng --enable-modules) 98517969268SFam Zheng modules="yes" 98617969268SFam Zheng ;; 9873aa88b31SStefan Hajnoczi --disable-modules) 9883aa88b31SStefan Hajnoczi modules="no" 9893aa88b31SStefan Hajnoczi ;; 9902ff6b91eSJuan Quintela --cpu=*) 9917d13299dSbellard ;; 992b1a550a0Spbrook --target-list=*) target_list="$optarg" 993de83cd02Sbellard ;; 9945b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 9955b808275SLluís Vilanova ;; 9965b808275SLluís Vilanova # XXX: backwards compatibility 9975b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 99894a420b1SStefan Hajnoczi ;; 99974242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 10009410b56cSPrerna Saxena ;; 10017d13299dSbellard --enable-gprof) gprof="yes" 10027d13299dSbellard ;; 10031d728c39SBlue Swirl --enable-gcov) gcov="yes" 10041d728c39SBlue Swirl ;; 100579427693SLoïc Minier --static) 100679427693SLoïc Minier static="yes" 100779427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 100817884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 100943ce4dfeSbellard ;; 10100b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 10110b24e75fSPaolo Bonzini ;; 10120b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 10130b24e75fSPaolo Bonzini ;; 10143aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 10153aa5d2beSAlon Levy ;; 10168bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 10178bf188aaSMichael Tokarev ;; 10180f94d6daSAlon Levy --includedir=*) includedir="$optarg" 10190f94d6daSAlon Levy ;; 1020528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 10210b24e75fSPaolo Bonzini ;; 1022023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 1023023d3d67SEduardo Habkost ;; 1024850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 10250b24e75fSPaolo Bonzini ;; 1026ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 102707381cc1SAnthony Liguori ;; 1028785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 1029785c23aeSLuiz Capitulino ;; 10303d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 10313d5eecabSGerd Hoffmann ;; 1032181ce1d0SOlaf Hering --host=*|--build=*|\ 1033181ce1d0SOlaf Hering --disable-dependency-tracking|\ 1034785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 1035023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 1036023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 1037023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 1038023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 1039023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 1040023ddd74SMax Filippov # lots of directory switches by default. 1041023ddd74SMax Filippov ;; 104297a847bcSbellard --disable-sdl) sdl="no" 104397a847bcSbellard ;; 1044c4198157SJuan Quintela --enable-sdl) sdl="yes" 1045c4198157SJuan Quintela ;; 1046a442fe2fSDaniel P. Berrangé --disable-sdl-image) sdl_image="no" 1047a442fe2fSDaniel P. Berrangé ;; 1048a442fe2fSDaniel P. Berrangé --enable-sdl-image) sdl_image="yes" 1049a442fe2fSDaniel P. Berrangé ;; 10503556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 10513556c233SPaolo Bonzini ;; 10523556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 10533556c233SPaolo Bonzini ;; 1054983eef5aSMeador Inge --disable-virtfs) virtfs="no" 1055983eef5aSMeador Inge ;; 1056983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 1057983eef5aSMeador Inge ;; 1058fe8fc5aeSPaolo Bonzini --disable-mpath) mpath="no" 1059fe8fc5aeSPaolo Bonzini ;; 1060fe8fc5aeSPaolo Bonzini --enable-mpath) mpath="yes" 1061fe8fc5aeSPaolo Bonzini ;; 1062821601eaSJes Sorensen --disable-vnc) vnc="no" 1063821601eaSJes Sorensen ;; 1064821601eaSJes Sorensen --enable-vnc) vnc="yes" 1065821601eaSJes Sorensen ;; 10662f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 10672f6a1ab0Sblueswir1 ;; 10680c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 10690c58ac1cSmalc ;; 107089138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1071b64ec4e4SFam Zheng ;; 107289138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1073eb852011SMarkus Armbruster ;; 1074f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 1075f8393946Saurel32 ;; 1076f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 1077f8393946Saurel32 ;; 1078f3d08ee6SPaul Brook --enable-debug) 1079f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 1080f3d08ee6SPaul Brook debug_tcg="yes" 10811fcc6d42SPeter Xu debug_mutex="yes" 1082f3d08ee6SPaul Brook debug="yes" 1083f3d08ee6SPaul Brook strip_opt="no" 1084b553a042SJohn Snow fortify_source="no" 1085f3d08ee6SPaul Brook ;; 1086247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1087247724cbSMarc-André Lureau ;; 1088247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1089247724cbSMarc-André Lureau ;; 109003b4fe7dSaliguori --enable-sparse) sparse="yes" 109103b4fe7dSaliguori ;; 109203b4fe7dSaliguori --disable-sparse) sparse="no" 109303b4fe7dSaliguori ;; 10941625af87Saliguori --disable-strip) strip_opt="no" 10951625af87Saliguori ;; 10962f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 10972f9606b3Saliguori ;; 1098ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 1099ea784e3bSJuan Quintela ;; 11002f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 11012f6f5c7aSCorentin Chary ;; 11022f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 11032f6f5c7aSCorentin Chary ;; 1104efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 1105efe556adSCorentin Chary ;; 1106efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 1107efe556adSCorentin Chary ;; 1108443f1376Sbellard --disable-slirp) slirp="no" 1109c20709aaSbellard ;; 1110e0e6c8c0Saliguori --disable-vde) vde="no" 11118a16d273Sths ;; 1112dfb278bdSJuan Quintela --enable-vde) vde="yes" 1113dfb278bdSJuan Quintela ;; 111458952137SVincenzo Maffione --disable-netmap) netmap="no" 111558952137SVincenzo Maffione ;; 111658952137SVincenzo Maffione --enable-netmap) netmap="yes" 111758952137SVincenzo Maffione ;; 1118e37630caSaliguori --disable-xen) xen="no" 1119e37630caSaliguori ;; 1120fc321b4bSJuan Quintela --enable-xen) xen="yes" 1121fc321b4bSJuan Quintela ;; 1122eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 1123eb6fda0fSAnthony PERARD ;; 1124eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 1125eb6fda0fSAnthony PERARD ;; 11262e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 11272e4d9fb1Saurel32 ;; 11284ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 11294ffcedb6SJuan Quintela ;; 1130fb599c9aSbalrog --disable-bluez) bluez="no" 1131fb599c9aSbalrog ;; 1132a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 1133a20a6f46SJuan Quintela ;; 11347ba1e619Saliguori --disable-kvm) kvm="no" 11357ba1e619Saliguori ;; 1136b31a0277SJuan Quintela --enable-kvm) kvm="yes" 1137b31a0277SJuan Quintela ;; 1138b0cb0a66SVincent Palatin --disable-hax) hax="no" 1139180fb750Szhanghailiang ;; 1140b0cb0a66SVincent Palatin --enable-hax) hax="yes" 1141180fb750Szhanghailiang ;; 1142c97d6d2cSSergio Andres Gomez Del Real --disable-hvf) hvf="no" 1143c97d6d2cSSergio Andres Gomez Del Real ;; 1144c97d6d2cSSergio Andres Gomez Del Real --enable-hvf) hvf="yes" 1145c97d6d2cSSergio Andres Gomez Del Real ;; 1146d661d9a4SJustin Terry (VM) --disable-whpx) whpx="no" 1147d661d9a4SJustin Terry (VM) ;; 1148d661d9a4SJustin Terry (VM) --enable-whpx) whpx="yes" 1149d661d9a4SJustin Terry (VM) ;; 11509195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 11519195b2c2SStefan Weil ;; 11529195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 11539195b2c2SStefan Weil ;; 115447e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 115547e98658SCorey Bryant ;; 115647e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 115747e98658SCorey Bryant ;; 1158b3f6ea7eSPaolo Bonzini --disable-tcg) tcg="no" 1159b3f6ea7eSPaolo Bonzini ;; 1160b3f6ea7eSPaolo Bonzini --enable-tcg) tcg="yes" 1161b3f6ea7eSPaolo Bonzini ;; 11625a22ab71SYang Zhong --disable-malloc-trim) malloc_trim="no" 11635a22ab71SYang Zhong ;; 11645a22ab71SYang Zhong --enable-malloc-trim) malloc_trim="yes" 11655a22ab71SYang Zhong ;; 1166cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1167cd4ec0b4SGerd Hoffmann ;; 1168cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 1169cd4ec0b4SGerd Hoffmann ;; 1170c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 1171c589b249SRonnie Sahlberg ;; 1172c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 1173c589b249SRonnie Sahlberg ;; 11746542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 11756542aa9cSPeter Lieven ;; 11766542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 11776542aa9cSPeter Lieven ;; 117805c2a3e7Sbellard --enable-profiler) profiler="yes" 117905c2a3e7Sbellard ;; 118014821030SPavel Borzenkov --disable-cocoa) cocoa="no" 118114821030SPavel Borzenkov ;; 1182c2de5c91Smalc --enable-cocoa) 1183c2de5c91Smalc cocoa="yes" ; 118489138857SStefan Weil audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 11855b0753e0Sbellard ;; 1186cad25d69Spbrook --disable-system) softmmu="no" 11870a8e90f4Spbrook ;; 1188cad25d69Spbrook --enable-system) softmmu="yes" 11890a8e90f4Spbrook ;; 11900953a80fSZachary Amsden --disable-user) 11910953a80fSZachary Amsden linux_user="no" ; 11920953a80fSZachary Amsden bsd_user="no" ; 11930953a80fSZachary Amsden ;; 11940953a80fSZachary Amsden --enable-user) ;; 1195831b7825Sths --disable-linux-user) linux_user="no" 11960a8e90f4Spbrook ;; 1197831b7825Sths --enable-linux-user) linux_user="yes" 1198831b7825Sths ;; 119984778508Sblueswir1 --disable-bsd-user) bsd_user="no" 120084778508Sblueswir1 ;; 120184778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 120284778508Sblueswir1 ;; 120340d6444eSAvi Kivity --enable-pie) pie="yes" 120434005a00SKirill A. Shutemov ;; 120540d6444eSAvi Kivity --disable-pie) pie="no" 120634005a00SKirill A. Shutemov ;; 120785aa5189Sbellard --enable-werror) werror="yes" 120885aa5189Sbellard ;; 120985aa5189Sbellard --disable-werror) werror="no" 121085aa5189Sbellard ;; 121163678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 121263678e17SSteven Noonan ;; 121363678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 121463678e17SSteven Noonan ;; 12154d3b6f6eSbalrog --disable-curses) curses="no" 12164d3b6f6eSbalrog ;; 1217c584a6d0SJuan Quintela --enable-curses) curses="yes" 1218c584a6d0SJuan Quintela ;; 1219769ce76dSAlexander Graf --disable-curl) curl="no" 1220769ce76dSAlexander Graf ;; 1221788c8196SJuan Quintela --enable-curl) curl="yes" 1222788c8196SJuan Quintela ;; 12232df87df7SJuan Quintela --disable-fdt) fdt="no" 12242df87df7SJuan Quintela ;; 12252df87df7SJuan Quintela --enable-fdt) fdt="yes" 12262df87df7SJuan Quintela ;; 12275c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 12285c6c3a6cSChristoph Hellwig ;; 12295c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 12305c6c3a6cSChristoph Hellwig ;; 1231758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 1232758e8e38SVenkateswararao Jujjuri (JV) ;; 1233758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 1234758e8e38SVenkateswararao Jujjuri (JV) ;; 1235a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1236a40161cbSPaolo Bonzini ;; 1237a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1238a40161cbSPaolo Bonzini ;; 123977755340Sths --disable-blobs) blobs="no" 124077755340Sths ;; 12417e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 12424a19f1ecSpbrook ;; 1243519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1244519175a2SAlex Barcelo ;; 124570c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 124670c60c08SStefan Hajnoczi ;; 124770c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 124870c60c08SStefan Hajnoczi ;; 12497d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 12507d992e4dSPeter Lieven ;; 1251f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1252f0d92b56SLongpeng(Mike) ;; 1253f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1254f0d92b56SLongpeng(Mike) ;; 1255a25dba17SJuan Quintela --disable-docs) docs="no" 125670ec5dc0SAnthony Liguori ;; 1257a25dba17SJuan Quintela --enable-docs) docs="yes" 125883a3ab8bSJuan Quintela ;; 1259d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1260d5970055SMichael S. Tsirkin ;; 1261d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1262d5970055SMichael S. Tsirkin ;; 1263042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1264042cea27SGonglei ;; 1265042cea27SGonglei --enable-vhost-crypto) 1266042cea27SGonglei vhost_crypto="yes" 1267042cea27SGonglei if test "$mingw32" = "yes"; then 1268042cea27SGonglei error_exit "vhost-crypto isn't available on win32" 1269042cea27SGonglei fi 1270042cea27SGonglei ;; 12715e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 12725e9be92dSNicholas Bellinger ;; 12735e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 12745e9be92dSNicholas Bellinger ;; 1275fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1276fc0b9b0eSStefan Hajnoczi ;; 1277fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1278fc0b9b0eSStefan Hajnoczi ;; 1279da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 128020ff075bSMichael Walle ;; 1281da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 128220ff075bSMichael Walle ;; 1283f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1284f27aaf4bSChristian Brunner ;; 1285f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1286f27aaf4bSChristian Brunner ;; 12878c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 12888c84cf11SSergei Trofimovich ;; 12898c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 12908c84cf11SSergei Trofimovich ;; 12917b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1292111a38b0SRobert Relyea ;; 12937b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1294111a38b0SRobert Relyea ;; 12952b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 12962b2325ffSGerd Hoffmann ;; 12972b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 12982b2325ffSGerd Hoffmann ;; 129969354a83SHans de Goede --disable-usb-redir) usb_redir="no" 130069354a83SHans de Goede ;; 130169354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 130269354a83SHans de Goede ;; 13031ece9905SAlon Levy --disable-zlib-test) zlib="no" 13041ece9905SAlon Levy ;; 1305b25c9dffSStefan Weil --disable-lzo) lzo="no" 1306b25c9dffSStefan Weil ;; 1307607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1308607dacd0Sqiaonuohan ;; 1309b25c9dffSStefan Weil --disable-snappy) snappy="no" 1310b25c9dffSStefan Weil ;; 1311607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1312607dacd0Sqiaonuohan ;; 13136b383c08SPeter Wu --disable-bzip2) bzip2="no" 13146b383c08SPeter Wu ;; 13156b383c08SPeter Wu --enable-bzip2) bzip2="yes" 13166b383c08SPeter Wu ;; 131783bc1f97SJulio Faracco --enable-lzfse) lzfse="yes" 131883bc1f97SJulio Faracco ;; 131983bc1f97SJulio Faracco --disable-lzfse) lzfse="no" 132083bc1f97SJulio Faracco ;; 1321d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1322d138cee9SMichael Roth ;; 1323d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1324d138cee9SMichael Roth ;; 13259dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 13269dacf32dSYossi Hindin ;; 13279dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 13289dacf32dSYossi Hindin ;; 1329d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1330d9840e25STomoki Sekiyama ;; 1331d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1332d9840e25STomoki Sekiyama ;; 1333d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1334d9840e25STomoki Sekiyama ;; 1335d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1336d9840e25STomoki Sekiyama ;; 1337d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1338d9840e25STomoki Sekiyama ;; 1339d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1340d9840e25STomoki Sekiyama ;; 13414b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 13424b1c11fdSDaniel P. Berrange ;; 13434b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 13444b1c11fdSDaniel P. Berrange ;; 1345f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1346f794573eSEduardo Otubo ;; 1347f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1348f794573eSEduardo Otubo ;; 1349eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1350eb100396SBharata B Rao ;; 135186583a07SLiam Merwick --disable-avx2) avx2_opt="no" 135286583a07SLiam Merwick ;; 135386583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 135486583a07SLiam Merwick ;; 1355eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1356eb100396SBharata B Rao ;; 135752b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 135852b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1359583f6e7bSStefan Hajnoczi ;; 1360cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1361cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1362cb6414dfSFam Zheng ;; 1363315d3184SFam Zheng --enable-uuid|--disable-uuid) 1364315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1365315d3184SFam Zheng ;; 1366a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1367a4ccabcfSAnthony Liguori ;; 1368a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1369a4ccabcfSAnthony Liguori ;; 1370a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1371a1c5e949SDaniel P. Berrange ;; 1372ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1373ddbb0d09SDaniel P. Berrange ;; 1374ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1375ddbb0d09SDaniel P. Berrange ;; 137691bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 137791bfcdb0SDaniel P. Berrange ;; 137891bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 137991bfcdb0SDaniel P. Berrange ;; 138091bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 138191bfcdb0SDaniel P. Berrange ;; 138291bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 138391bfcdb0SDaniel P. Berrange ;; 13842da776dbSMichael R. Hines --enable-rdma) rdma="yes" 13852da776dbSMichael R. Hines ;; 13862da776dbSMichael R. Hines --disable-rdma) rdma="no" 13872da776dbSMichael R. Hines ;; 138821ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 138921ab34c9SMarcel Apfelbaum ;; 139021ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 139121ab34c9SMarcel Apfelbaum ;; 1392bbbf9bfbSStefan Weil --disable-vte) vte="no" 1393bbbf9bfbSStefan Weil ;; 1394bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1395bbbf9bfbSStefan Weil ;; 13969d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 13979d9e1521SGerd Hoffmann ;; 13989d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 13999d9e1521SGerd Hoffmann ;; 1400e91c793cSCole Robinson --disable-tpm) tpm="no" 1401e91c793cSCole Robinson ;; 1402ab214c29SStefan Berger --enable-tpm) tpm="yes" 1403ab214c29SStefan Berger ;; 14040a12ec87SRichard W.M. Jones --disable-libssh2) libssh2="no" 14050a12ec87SRichard W.M. Jones ;; 14060a12ec87SRichard W.M. Jones --enable-libssh2) libssh2="yes" 14070a12ec87SRichard W.M. Jones ;; 1408ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1409ed1701c6SDr. David Alan Gilbert ;; 1410ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1411ed1701c6SDr. David Alan Gilbert ;; 1412a99d57bbSWanlong Gao --disable-numa) numa="no" 1413a99d57bbSWanlong Gao ;; 1414a99d57bbSWanlong Gao --enable-numa) numa="yes" 1415a99d57bbSWanlong Gao ;; 1416ed279a06SKlim Kireev --disable-libxml2) libxml2="no" 1417ed279a06SKlim Kireev ;; 1418ed279a06SKlim Kireev --enable-libxml2) libxml2="yes" 1419ed279a06SKlim Kireev ;; 14202847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 14212847b469SFam Zheng ;; 14222847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 14232847b469SFam Zheng ;; 14247b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 14257b01cb97SAlexandre Derumier ;; 14267b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 14277b01cb97SAlexandre Derumier ;; 1428a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1429a6b1d4c0SChanglong Xie ;; 1430a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1431a6b1d4c0SChanglong Xie ;; 1432da92c3ffSAshish Mittal --disable-vxhs) vxhs="no" 1433da92c3ffSAshish Mittal ;; 1434da92c3ffSAshish Mittal --enable-vxhs) vxhs="yes" 1435da92c3ffSAshish Mittal ;; 14362f740136SJeff Cody --disable-bochs) bochs="no" 14372f740136SJeff Cody ;; 14382f740136SJeff Cody --enable-bochs) bochs="yes" 14392f740136SJeff Cody ;; 14402f740136SJeff Cody --disable-cloop) cloop="no" 14412f740136SJeff Cody ;; 14422f740136SJeff Cody --enable-cloop) cloop="yes" 14432f740136SJeff Cody ;; 14442f740136SJeff Cody --disable-dmg) dmg="no" 14452f740136SJeff Cody ;; 14462f740136SJeff Cody --enable-dmg) dmg="yes" 14472f740136SJeff Cody ;; 14482f740136SJeff Cody --disable-qcow1) qcow1="no" 14492f740136SJeff Cody ;; 14502f740136SJeff Cody --enable-qcow1) qcow1="yes" 14512f740136SJeff Cody ;; 14522f740136SJeff Cody --disable-vdi) vdi="no" 14532f740136SJeff Cody ;; 14542f740136SJeff Cody --enable-vdi) vdi="yes" 14552f740136SJeff Cody ;; 14562f740136SJeff Cody --disable-vvfat) vvfat="no" 14572f740136SJeff Cody ;; 14582f740136SJeff Cody --enable-vvfat) vvfat="yes" 14592f740136SJeff Cody ;; 14602f740136SJeff Cody --disable-qed) qed="no" 14612f740136SJeff Cody ;; 14622f740136SJeff Cody --enable-qed) qed="yes" 14632f740136SJeff Cody ;; 14642f740136SJeff Cody --disable-parallels) parallels="no" 14652f740136SJeff Cody ;; 14662f740136SJeff Cody --enable-parallels) parallels="yes" 14672f740136SJeff Cody ;; 14682f740136SJeff Cody --disable-sheepdog) sheepdog="no" 14692f740136SJeff Cody ;; 14702f740136SJeff Cody --enable-sheepdog) sheepdog="yes" 14712f740136SJeff Cody ;; 1472e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1473e6a74868SMarc-André Lureau ;; 1474e6a74868SMarc-André Lureau --enable-vhost-user) 1475e6a74868SMarc-André Lureau vhost_user="yes" 1476e6a74868SMarc-André Lureau if test "$mingw32" = "yes"; then 1477e6a74868SMarc-André Lureau error_exit "vhost-user isn't available on win32" 1478e6a74868SMarc-André Lureau fi 1479e6a74868SMarc-André Lureau ;; 14808ca80760SRichard Henderson --disable-capstone) capstone="no" 14818ca80760SRichard Henderson ;; 14828ca80760SRichard Henderson --enable-capstone) capstone="yes" 14838ca80760SRichard Henderson ;; 1484e219c499SRichard Henderson --enable-capstone=git) capstone="git" 1485e219c499SRichard Henderson ;; 1486e219c499SRichard Henderson --enable-capstone=system) capstone="system" 1487e219c499SRichard Henderson ;; 1488cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1489cc84d63aSDaniel P. Berrange ;; 1490f62bbee5SDaniel P. Berrange --enable-git-update) git_update=yes 1491f62bbee5SDaniel P. Berrange ;; 1492f62bbee5SDaniel P. Berrange --disable-git-update) git_update=no 1493f62bbee5SDaniel P. Berrange ;; 1494ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1495ba59fb77SPaolo Bonzini ;; 1496ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1497ba59fb77SPaolo Bonzini ;; 149817824406SJunyan He --enable-libpmem) libpmem=yes 149917824406SJunyan He ;; 150017824406SJunyan He --disable-libpmem) libpmem=no 150117824406SJunyan He ;; 15022d2ad6d0SFam Zheng *) 15032d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 15042d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 15052d2ad6d0SFam Zheng exit 1 15067f1559c6Sbalrog ;; 15077d13299dSbellard esac 15087d13299dSbellarddone 15097d13299dSbellard 1510e6a74868SMarc-André Lureauif test "$vhost_user" = ""; then 1511e6a74868SMarc-André Lureau if test "$mingw32" = "yes"; then 1512e6a74868SMarc-André Lureau vhost_user="no" 1513e6a74868SMarc-André Lureau else 1514e6a74868SMarc-André Lureau vhost_user="yes" 1515e6a74868SMarc-André Lureau fi 1516e6a74868SMarc-André Lureaufi 1517e6a74868SMarc-André Lureau 151840293e58Sbellardcase "$cpu" in 1519e3608d66SRichard Henderson ppc) 1520e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1521e3608d66SRichard Henderson LDFLAGS="-m32 $LDFLAGS" 152213a5abe2SAlex Bennée cross_cc_powerpc=$cc 152313a5abe2SAlex Bennée cross_cc_cflags_powerpc=$CPU_CFLAGS 1524e3608d66SRichard Henderson ;; 1525e3608d66SRichard Henderson ppc64) 1526e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1527e3608d66SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 152813a5abe2SAlex Bennée cross_cc_ppc64=$cc 152913a5abe2SAlex Bennée cross_cc_cflags_ppc64=$CPU_CFLAGS 1530e3608d66SRichard Henderson ;; 15319b9c37c3SRichard Henderson sparc) 1532f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1533f1079bb8SRichard Henderson LDFLAGS="-m32 -mv8plus $LDFLAGS" 153413a5abe2SAlex Bennée cross_cc_sparc=$cc 153513a5abe2SAlex Bennée cross_cc_cflags_sparc=$CPU_CFLAGS 15363142255cSblueswir1 ;; 1537ed968ff1SJuan Quintela sparc64) 153879f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1539f1079bb8SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 154013a5abe2SAlex Bennée cross_cc_sparc64=$cc 154113a5abe2SAlex Bennée cross_cc_cflags_sparc64=$CPU_CFLAGS 15423142255cSblueswir1 ;; 154376d83bdeSths s390) 1544061cdd81SRichard Henderson CPU_CFLAGS="-m31" 154528d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 154613a5abe2SAlex Bennée cross_cc_s390=$cc 154713a5abe2SAlex Bennée cross_cc_cflags_s390=$CPU_CFLAGS 154828d7cc49SRichard Henderson ;; 154928d7cc49SRichard Henderson s390x) 1550061cdd81SRichard Henderson CPU_CFLAGS="-m64" 155128d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 155213a5abe2SAlex Bennée cross_cc_s390x=$cc 155313a5abe2SAlex Bennée cross_cc_cflags_s390x=$CPU_CFLAGS 155476d83bdeSths ;; 155540293e58Sbellard i386) 155679f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 15570c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 1558716a507cSAlex Bennée cross_cc_i386=$cc 1559716a507cSAlex Bennée cross_cc_cflags_i386=$CPU_CFLAGS 156040293e58Sbellard ;; 156140293e58Sbellard x86_64) 15627ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 15637ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 15647ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 15657ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 15660c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 1567716a507cSAlex Bennée cross_cc_x86_64=$cc 1568716a507cSAlex Bennée cross_cc_cflags_x86_64=$CPU_CFLAGS 1569379f6698SPaul Brook ;; 1570c72b26ecSRichard Henderson x32) 1571c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1572c72b26ecSRichard Henderson LDFLAGS="-mx32 $LDFLAGS" 1573716a507cSAlex Bennée cross_cc_i386=$cc 157413a5abe2SAlex Bennée cross_cc_cflags_i386=$CPU_CFLAGS 1575c72b26ecSRichard Henderson ;; 157630163d89SPeter Maydell # No special flags required for other host CPUs 15773142255cSblueswir1esac 15783142255cSblueswir1 157979f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 158079f3b12fSPeter Crosthwaite 1581affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1582affc88ccSPeter Maydell# support, even if we're using TCI. 1583affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1584affc88ccSPeter Maydell bsd_user="no" 1585affc88ccSPeter Maydell linux_user="no" 1586affc88ccSPeter Maydellfi 1587affc88ccSPeter Maydell 158860e0df25SPeter Maydelldefault_target_list="" 158960e0df25SPeter Maydell 15906e92f823SPeter Maydellmak_wilds="" 15916e92f823SPeter Maydell 159260e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 15936e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 159460e0df25SPeter Maydellfi 159560e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 15966e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 159760e0df25SPeter Maydellfi 159860e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 15996e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 160060e0df25SPeter Maydellfi 160160e0df25SPeter Maydell 16026e92f823SPeter Maydellfor config in $mak_wilds; do 16036e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 16046e92f823SPeter Maydelldone 16056e92f823SPeter Maydell 1606c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 160764a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1608c53eeaf7SStefan Hajnoczi 1609af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1610af5db58eSpbrookcat << EOF 1611af5db58eSpbrook 1612af5db58eSpbrookUsage: configure [options] 1613af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1614af5db58eSpbrook 161508fb77edSStefan WeilStandard options: 161608fb77edSStefan Weil --help print this message 161708fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 161808fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 161908fb77edSStefan Weil use %M for cpu name [$interp_prefix] 162008fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 162108fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 162208fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 162308fb77edSStefan Weil 162408fb77edSStefan WeilAdvanced options (experts only): 162508fb77edSStefan Weil --source-path=PATH path of source code [$source_path] 162608fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 162708fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 162808fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 162908fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 163008fb77edSStefan Weil build time 163108fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 163208fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 163308fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 163411cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 163508fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1636d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1637d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 163808fb77edSStefan Weil --make=MAKE use specified make [$make] 163908fb77edSStefan Weil --install=INSTALL use specified install [$install] 164008fb77edSStefan Weil --python=PYTHON use specified python [$python] 164108fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1642db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 164308fb77edSStefan Weil --static enable static build [$static] 164408fb77edSStefan Weil --mandir=PATH install man pages in PATH 164508fb77edSStefan Weil --datadir=PATH install firmware in PATH$confsuffix 164608fb77edSStefan Weil --docdir=PATH install documentation in PATH$confsuffix 164708fb77edSStefan Weil --bindir=PATH install binaries in PATH 164808fb77edSStefan Weil --libdir=PATH install libraries in PATH 1649db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 165008fb77edSStefan Weil --sysconfdir=PATH install config in PATH$confsuffix 165108fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 16523d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 1653e26110cfSFam Zheng --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 1654db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 165508fb77edSStefan Weil --enable-debug enable common debug build options 1656247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 165708fb77edSStefan Weil --disable-strip disable stripping binaries 165808fb77edSStefan Weil --disable-werror disable compilation abort on warning 165963678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 166008fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 166108fb77edSStefan Weil Available drivers: $audio_possible_drivers 166208fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 166308fb77edSStefan Weil --block-drv-rw-whitelist=L 166408fb77edSStefan Weil set block driver read-write whitelist 166508fb77edSStefan Weil (affects only QEMU, not qemu-img) 166608fb77edSStefan Weil --block-drv-ro-whitelist=L 166708fb77edSStefan Weil set block driver read-only whitelist 166808fb77edSStefan Weil (affects only QEMU, not qemu-img) 16695b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1670c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 167108fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 167208fb77edSStefan Weil Default:trace-<pid> 1673c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1674c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 16755a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1676c23f23b9SMichael Tokarev --oss-lib path to OSS library 1677c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 167808fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 167933c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 168008fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 168108fb77edSStefan Weil --gcov=GCOV use specified gcov [$gcov_tool] 1682c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1683c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1684c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1685a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1686c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1687c12d66aaSLin Ma --enable-profiler profiler support 1688c12d66aaSLin Ma --enable-debug-stack-usage 1689c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 1690c23f23b9SMichael Tokarev 1691c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1692c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1693c23f23b9SMichael Tokarev 1694c23f23b9SMichael Tokarev system all system emulation targets 1695c23f23b9SMichael Tokarev user supported user emulation targets 1696c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1697c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1698c23f23b9SMichael Tokarev docs build documentation 1699c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1700c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1701c23f23b9SMichael Tokarev pie Position Independent Executables 1702c23f23b9SMichael Tokarev modules modules support 1703c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1704c23f23b9SMichael Tokarev debug-info debugging information 1705c23f23b9SMichael Tokarev sparse sparse checker 1706c23f23b9SMichael Tokarev 1707ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 170891bfcdb0SDaniel P. Berrange nettle nettle cryptography support 170991bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 1710c23f23b9SMichael Tokarev sdl SDL UI 1711a442fe2fSDaniel P. Berrangé sdl_image SDL Image support for icons 1712c23f23b9SMichael Tokarev gtk gtk UI 1713c23f23b9SMichael Tokarev vte vte support for the gtk UI 1714c23f23b9SMichael Tokarev curses curses UI 1715c23f23b9SMichael Tokarev vnc VNC UI support 1716c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1717c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1718c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1719c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1720c23f23b9SMichael Tokarev virtfs VirtFS 1721fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1722c23f23b9SMichael Tokarev xen xen backend driver support 172370c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1724c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1725c23f23b9SMichael Tokarev curl curl connectivity 1726a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1727c23f23b9SMichael Tokarev fdt fdt device tree 1728c23f23b9SMichael Tokarev bluez bluez stack connectivity 1729c23f23b9SMichael Tokarev kvm KVM acceleration support 1730b0cb0a66SVincent Palatin hax HAX acceleration support 1731c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 1732d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 173321ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 173421ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1735c23f23b9SMichael Tokarev vde support for vde network 1736c23f23b9SMichael Tokarev netmap support for netmap network 1737c23f23b9SMichael Tokarev linux-aio Linux AIO support 1738c23f23b9SMichael Tokarev cap-ng libcap-ng support 1739c23f23b9SMichael Tokarev attr attr and xattr support 1740c23f23b9SMichael Tokarev vhost-net vhost-net acceleration support 1741042cea27SGonglei vhost-crypto vhost-crypto acceleration support 1742c23f23b9SMichael Tokarev spice spice 1743c23f23b9SMichael Tokarev rbd rados block device (rbd) 1744c23f23b9SMichael Tokarev libiscsi iscsi support 1745c23f23b9SMichael Tokarev libnfs nfs support 17467b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 1747c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1748ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1749c23f23b9SMichael Tokarev usb-redir usb network redirection support 1750c23f23b9SMichael Tokarev lzo support of lzo compression library 1751c23f23b9SMichael Tokarev snappy support of snappy compression library 1752c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1753c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 175483bc1f97SJulio Faracco lzfse support of lzfse compression library 175583bc1f97SJulio Faracco (for reading lzfse-compressed dmg images) 1756c23f23b9SMichael Tokarev seccomp seccomp support 1757c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1758c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1759c23f23b9SMichael Tokarev tpm TPM support 1760c23f23b9SMichael Tokarev libssh2 ssh block device support 1761c23f23b9SMichael Tokarev numa libnuma support 1762ed279a06SKlim Kireev libxml2 for Parallels image format 1763c23f23b9SMichael Tokarev tcmalloc tcmalloc support 17647b01cb97SAlexandre Derumier jemalloc jemalloc support 176586583a07SLiam Merwick avx2 AVX2 optimization support 1766a6b1d4c0SChanglong Xie replication replication support 1767c12d66aaSLin Ma vhost-vsock virtio sockets device support 1768c12d66aaSLin Ma opengl opengl support 1769c12d66aaSLin Ma virglrenderer virgl rendering support 1770c12d66aaSLin Ma xfsctl xfsctl support 1771c12d66aaSLin Ma qom-cast-debug cast debugging support 17728de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 1773da92c3ffSAshish Mittal vxhs Veritas HyperScale vDisk backend support 17742f740136SJeff Cody bochs bochs image format support 17752f740136SJeff Cody cloop cloop image format support 17762f740136SJeff Cody dmg dmg image format support 17772f740136SJeff Cody qcow1 qcow v1 image format support 17782f740136SJeff Cody vdi vdi image format support 17792f740136SJeff Cody vvfat vvfat image format support 17802f740136SJeff Cody qed qed image format support 17812f740136SJeff Cody parallels parallels image format support 17822f740136SJeff Cody sheepdog sheepdog block driver support 1783f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 1784e6a74868SMarc-André Lureau vhost-user vhost-user support 17858ca80760SRichard Henderson capstone capstone disassembler support 1786ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 178717824406SJunyan He libpmem libpmem support 178808fb77edSStefan Weil 178908fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1790af5db58eSpbrookEOF 17912d2ad6d0SFam Zhengexit 0 1792af5db58eSpbrookfi 1793af5db58eSpbrook 1794c53eeaf7SStefan Hajnocziif ! has $python; then 1795c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1796c53eeaf7SStefan Hajnoczifi 1797c53eeaf7SStefan Hajnoczi 1798c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1799c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 18007f2b5544SEduardo Habkostif ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then 18017f2b5544SEduardo Habkost error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \ 1802c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1803c53eeaf7SStefan Hajnoczifi 1804c53eeaf7SStefan Hajnoczi 1805755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 1806755ee70fSCleber Rosapython_version=$($python -V 2>&1 | sed -e 's/Python\ //') 1807755ee70fSCleber Rosa 1808c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1809c53eeaf7SStefan Hajnoczipython="$python -B" 1810c53eeaf7SStefan Hajnoczi 18119aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 18129aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 18139aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 18149aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 18159aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 18169aae6e54SDaniel Henrique Barbozaif compile_object ; then 18179aae6e54SDaniel Henrique Barboza : C compiler works ok 18189aae6e54SDaniel Henrique Barbozaelse 18199aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 18209aae6e54SDaniel Henrique Barbozafi 18219aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 18229aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 18239aae6e54SDaniel Henrique Barbozafi 18249aae6e54SDaniel Henrique Barboza 1825359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1826359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1827359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1828359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1829359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1830359bc95dSPeter Maydell else 183176ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1832359bc95dSPeter Maydell fi 1833359bc95dSPeter Maydellfi 1834359bc95dSPeter Maydell 18359c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 18369c83ffd8SPeter Maydell# by default. Only enable by default for git builds 18379c83ffd8SPeter Maydellif test -z "$werror" ; then 1838e633a5c6SEric Blake if test -d "$source_path/.git" && \ 1839e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 18409c83ffd8SPeter Maydell werror="yes" 18419c83ffd8SPeter Maydell else 18429c83ffd8SPeter Maydell werror="no" 18439c83ffd8SPeter Maydell fi 18449c83ffd8SPeter Maydellfi 18459c83ffd8SPeter Maydell 1846fb59dabdSPeter Maydellif test "$bogus_os" = "yes"; then 1847fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1848fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1849fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1850fb59dabdSPeter Maydell # host OS we should stop now. 1851951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1852fb59dabdSPeter Maydellfi 1853fb59dabdSPeter Maydell 1854efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 1855efc6c070SThomas Huthcat > $TMPC << EOF 1856efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 1857efc6c070SThomas Huth# ifdef __apple_build_version__ 1858efc6c070SThomas Huth# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) 1859efc6c070SThomas Huth# error You need at least XCode Clang v5.1 to compile QEMU 1860efc6c070SThomas Huth# endif 1861efc6c070SThomas Huth# else 1862efc6c070SThomas Huth# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) 1863efc6c070SThomas Huth# error You need at least Clang v3.4 to compile QEMU 1864efc6c070SThomas Huth# endif 1865efc6c070SThomas Huth# endif 1866efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 1867efc6c070SThomas Huth# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 1868efc6c070SThomas Huth# error You need at least GCC v4.8 to compile QEMU 1869efc6c070SThomas Huth# endif 1870efc6c070SThomas Huth#else 1871efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 1872efc6c070SThomas Huth#endif 1873efc6c070SThomas Huthint main (void) { return 0; } 1874efc6c070SThomas HuthEOF 1875efc6c070SThomas Huthif ! compile_prog "" "" ; then 1876efc6c070SThomas Huth error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" 1877efc6c070SThomas Huthfi 1878efc6c070SThomas Huth 18798d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 18808d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 1881ac7568bdSDaniel P. Berrangegcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1882435405acSPranith Kumargcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" 1883b98fcfd8SPaolo Bonzinigcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" 188471429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags" 18850e39c4aaSGerd Hoffmanngcc_flags="-Wno-error=address-of-packed-member $gcc_flags" 18866ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 18876ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 18886ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 18896ca026cbSPeter Maydell# so it's too error prone. 189093b25869SJohn Snow 189193b25869SJohn Snowcc_has_warning_flag() { 189293b25869SJohn Snow write_c_skeleton; 189393b25869SJohn Snow 1894a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1895a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1896a1d29d6cSPeter Maydell # warning options). 189793b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 189893b25869SJohn Snow compile_prog "-Werror $optflag" "" 189993b25869SJohn Snow} 190093b25869SJohn Snow 190193b25869SJohn Snowfor flag in $gcc_flags; do 190293b25869SJohn Snow if cc_has_warning_flag $flag ; then 19038d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 19048d05095cSPaolo Bonzini fi 19058d05095cSPaolo Bonzinidone 19068d05095cSPaolo Bonzini 190763678e17SSteven Noonanif test "$stack_protector" != "no"; then 1908fccd35a0SRodrigo Rebello cat > $TMPC << EOF 1909fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 1910fccd35a0SRodrigo Rebello{ 1911fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 1912fccd35a0SRodrigo Rebello while (*c) { 1913fccd35a0SRodrigo Rebello *p++ = *c++; 1914fccd35a0SRodrigo Rebello } 1915fccd35a0SRodrigo Rebello return 0; 1916fccd35a0SRodrigo Rebello} 1917fccd35a0SRodrigo RebelloEOF 191863678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 19193b463a3fSMiroslav Rezanina sp_on=0 192063678e17SSteven Noonan for flag in $gcc_flags; do 1921590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 1922590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 1923590e5dd9SPeter Maydell if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && 1924590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 192563678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 19263b463a3fSMiroslav Rezanina sp_on=1 192763678e17SSteven Noonan break 192863678e17SSteven Noonan fi 192963678e17SSteven Noonan done 19303b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 19313b463a3fSMiroslav Rezanina if test $sp_on = 0; then 19323b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 19333b463a3fSMiroslav Rezanina fi 19343b463a3fSMiroslav Rezanina fi 193537746c5eSMarc-André Lureaufi 193637746c5eSMarc-André Lureau 193720bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 193820bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 193920bc94a2SPaolo Bonzinicat > $TMPC << EOF 194020bc94a2SPaolo Bonzinistruct { 194120bc94a2SPaolo Bonzini int a[2]; 194220bc94a2SPaolo Bonzini} x = {0}; 194320bc94a2SPaolo BonziniEOF 194420bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 194520bc94a2SPaolo Bonzini : 194620bc94a2SPaolo Bonzinielse 194720bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 194820bc94a2SPaolo Bonzinifi 194920bc94a2SPaolo Bonzini 1950d376e9deSThomas Huth# Static linking is not possible with modules or PIE 195140d6444eSAvi Kivityif test "$static" = "yes" ; then 1952aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1953aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1954aa0d1f44SPaolo Bonzini fi 195540d6444eSAvi Kivity if test "$pie" = "yes" ; then 195676ad07a4SPeter Maydell error_exit "static and pie are mutually incompatible" 195740d6444eSAvi Kivity else 195840d6444eSAvi Kivity pie="no" 195940d6444eSAvi Kivity fi 196040d6444eSAvi Kivityfi 196140d6444eSAvi Kivity 1962768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 1963768b7855SEmilio G. Cota cat > $TMPC << EOF 1964768b7855SEmilio G. Cotastatic __thread int tls_var; 1965768b7855SEmilio G. Cotaint main(void) { return tls_var; } 1966768b7855SEmilio G. CotaEOF 1967768b7855SEmilio G. Cota 1968768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 1969768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 1970768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 1971768b7855SEmilio G. Cotafi 1972768b7855SEmilio G. Cota 197340d6444eSAvi Kivityif test "$pie" = ""; then 197440d6444eSAvi Kivity case "$cpu-$targetos" in 1975c72b26ecSRichard Henderson i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) 197640d6444eSAvi Kivity ;; 197740d6444eSAvi Kivity *) 197840d6444eSAvi Kivity pie="no" 197940d6444eSAvi Kivity ;; 198040d6444eSAvi Kivity esac 198140d6444eSAvi Kivityfi 198240d6444eSAvi Kivity 198340d6444eSAvi Kivityif test "$pie" != "no" ; then 198440d6444eSAvi Kivity cat > $TMPC << EOF 198521d4a791SAvi Kivity 198621d4a791SAvi Kivity#ifdef __linux__ 198721d4a791SAvi Kivity# define THREAD __thread 198821d4a791SAvi Kivity#else 198921d4a791SAvi Kivity# define THREAD 199021d4a791SAvi Kivity#endif 199121d4a791SAvi Kivity 199221d4a791SAvi Kivitystatic THREAD int tls_var; 199321d4a791SAvi Kivity 199421d4a791SAvi Kivityint main(void) { return tls_var; } 199521d4a791SAvi Kivity 199640d6444eSAvi KivityEOF 199740d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 199840d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 199940d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 200040d6444eSAvi Kivity pie="yes" 200140d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 200240d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 200340d6444eSAvi Kivity fi 200440d6444eSAvi Kivity else 200540d6444eSAvi Kivity if test "$pie" = "yes"; then 200676ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 200740d6444eSAvi Kivity else 200840d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 200940d6444eSAvi Kivity pie="no" 201040d6444eSAvi Kivity fi 201140d6444eSAvi Kivity fi 201246eef33bSBrad 2013e4a7b344SStefan Hajnoczi if compile_prog "-Werror -fno-pie" "-nopie"; then 201446eef33bSBrad CFLAGS_NOPIE="-fno-pie" 201546eef33bSBrad LDFLAGS_NOPIE="-nopie" 201646eef33bSBrad fi 201740d6444eSAvi Kivityfi 201840d6444eSAvi Kivity 201909dada40SPaolo Bonzini########################################## 202009dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 202109dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 202209dada40SPaolo Bonzini# specification is necessary 202309dada40SPaolo Bonzini 202409dada40SPaolo Bonziniif test "$cpu" = "i386"; then 202509dada40SPaolo Bonzini cat > $TMPC << EOF 202609dada40SPaolo Bonzinistatic int sfaa(int *ptr) 202709dada40SPaolo Bonzini{ 202809dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 202909dada40SPaolo Bonzini} 203009dada40SPaolo Bonzini 203109dada40SPaolo Bonziniint main(void) 203209dada40SPaolo Bonzini{ 203309dada40SPaolo Bonzini int val = 42; 20341405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 203509dada40SPaolo Bonzini sfaa(&val); 203609dada40SPaolo Bonzini return val; 203709dada40SPaolo Bonzini} 203809dada40SPaolo BonziniEOF 203909dada40SPaolo Bonzini if ! compile_prog "" "" ; then 204009dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 204109dada40SPaolo Bonzini fi 204209dada40SPaolo Bonzinifi 204309dada40SPaolo Bonzini 204409dada40SPaolo Bonzini######################################### 2045ec530c81Sbellard# Solaris specific configure tool chain decisions 204609dada40SPaolo Bonzini 2047ec530c81Sbellardif test "$solaris" = "yes" ; then 20486792aa11SLoïc Minier if has $install; then 20496792aa11SLoïc Minier : 20506792aa11SLoïc Minier else 205176ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 205276ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 205376ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 2054ec530c81Sbellard fi 205589138857SStefan Weil if test "$(path_of $install)" = "/usr/sbin/install" ; then 205676ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 205776ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 205876ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 2059ec530c81Sbellard fi 20606792aa11SLoïc Minier if has ar; then 20616792aa11SLoïc Minier : 20626792aa11SLoïc Minier else 2063ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 206476ad07a4SPeter Maydell error_exit "No path includes ar" \ 206576ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 2066ec530c81Sbellard fi 206776ad07a4SPeter Maydell error_exit "No path includes ar" 2068ec530c81Sbellard fi 2069ec530c81Sbellardfi 2070ec530c81Sbellard 2071afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 2072d880a3baSPaolo Bonzini for target in $default_target_list; do 2073d880a3baSPaolo Bonzini supported_target $target 2>/dev/null && \ 2074d880a3baSPaolo Bonzini target_list="$target_list $target" 2075d880a3baSPaolo Bonzini done 2076d880a3baSPaolo Bonzini target_list="${target_list# }" 2077121afa9eSAnthony Liguorielse 207889138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2079d880a3baSPaolo Bonzini for target in $target_list; do 208025b48338SPeter Maydell # Check that we recognised the target name; this allows a more 208125b48338SPeter Maydell # friendly error message than if we let it fall through. 208225b48338SPeter Maydell case " $default_target_list " in 208325b48338SPeter Maydell *" $target "*) 208425b48338SPeter Maydell ;; 208525b48338SPeter Maydell *) 208625b48338SPeter Maydell error_exit "Unknown target name '$target'" 208725b48338SPeter Maydell ;; 208825b48338SPeter Maydell esac 2089d880a3baSPaolo Bonzini supported_target $target || exit 1 209025b48338SPeter Maydell done 2091d880a3baSPaolo Bonzinifi 209225b48338SPeter Maydell 2093f55fe278SPaolo Bonzini# see if system emulation was really requested 2094f55fe278SPaolo Bonzinicase " $target_list " in 2095f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 2096f55fe278SPaolo Bonzini ;; 2097f55fe278SPaolo Bonzini *) softmmu=no 2098f55fe278SPaolo Bonzini ;; 2099f55fe278SPaolo Bonziniesac 21005327cf48Sbellard 2101249247c9SJuan Quintelafeature_not_found() { 2102249247c9SJuan Quintela feature=$1 210321684af0SStewart Smith remedy=$2 2104249247c9SJuan Quintela 210576ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 210621684af0SStewart Smith "configure was not able to find it." \ 210721684af0SStewart Smith "$remedy" 2108249247c9SJuan Quintela} 2109249247c9SJuan Quintela 21107d13299dSbellard# --- 21117d13299dSbellard# big/little endian test 21127d13299dSbellardcat > $TMPC << EOF 211361cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 211461cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 211561cc919fSMike Frysingerextern int foo(short *, short *); 211661cc919fSMike Frysingerint main(int argc, char *argv[]) { 211761cc919fSMike Frysinger return foo(big_endian, little_endian); 21187d13299dSbellard} 21197d13299dSbellardEOF 21207d13299dSbellard 212161cc919fSMike Frysingerif compile_object ; then 212212f15c91SAlice Frosi if strings -a $TMPO | grep -q BiGeNdIaN ; then 212361cc919fSMike Frysinger bigendian="yes" 212412f15c91SAlice Frosi elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 212561cc919fSMike Frysinger bigendian="no" 21267d13299dSbellard else 21277d13299dSbellard echo big/little test failed 21287d13299dSbellard fi 21297d13299dSbellardelse 213061cc919fSMike Frysinger echo big/little test failed 21317d13299dSbellardfi 21327d13299dSbellard 2133b0a47e79SJuan Quintela########################################## 2134a30878e7SPeter Maydell# cocoa implies not SDL or GTK 2135a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 2136a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 2137a30878e7SPeter Maydellif test "$cocoa" = "yes"; then 2138a30878e7SPeter Maydell if test "$sdl" = "yes"; then 2139a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2140a30878e7SPeter Maydell fi 2141a30878e7SPeter Maydell if test "$gtk" = "yes"; then 2142a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2143a30878e7SPeter Maydell fi 2144a30878e7SPeter Maydell gtk=no 2145a30878e7SPeter Maydell sdl=no 2146a30878e7SPeter Maydellfi 2147a30878e7SPeter Maydell 21486b39b063SEric Blake# Some versions of Mac OS X incorrectly define SIZE_MAX 21496b39b063SEric Blakecat > $TMPC << EOF 21506b39b063SEric Blake#include <stdint.h> 21516b39b063SEric Blake#include <stdio.h> 21526b39b063SEric Blakeint main(int argc, char *argv[]) { 21536b39b063SEric Blake return printf("%zu", SIZE_MAX); 21546b39b063SEric Blake} 21556b39b063SEric BlakeEOF 21566b39b063SEric Blakehave_broken_size_max=no 21576b39b063SEric Blakeif ! compile_object -Werror ; then 21586b39b063SEric Blake have_broken_size_max=yes 21596b39b063SEric Blakefi 21606b39b063SEric Blake 2161a30878e7SPeter Maydell########################################## 2162015a33bdSGonglei# L2TPV3 probe 2163015a33bdSGonglei 2164015a33bdSGongleicat > $TMPC <<EOF 2165015a33bdSGonglei#include <sys/socket.h> 2166bff6cb72SMichael Tokarev#include <linux/ip.h> 2167015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2168015a33bdSGongleiEOF 2169015a33bdSGongleiif compile_prog "" "" ; then 2170015a33bdSGonglei l2tpv3=yes 2171015a33bdSGongleielse 2172015a33bdSGonglei l2tpv3=no 2173015a33bdSGongleifi 2174015a33bdSGonglei 2175015a33bdSGonglei########################################## 21764d9310f4SDaniel P. Berrange# MinGW / Mingw-w64 localtime_r/gmtime_r check 21774d9310f4SDaniel P. Berrange 21784d9310f4SDaniel P. Berrangeif test "$mingw32" = "yes"; then 21794d9310f4SDaniel P. Berrange # Some versions of MinGW / Mingw-w64 lack localtime_r 21804d9310f4SDaniel P. Berrange # and gmtime_r entirely. 21814d9310f4SDaniel P. Berrange # 21824d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 define a macro for 21834d9310f4SDaniel P. Berrange # localtime_r/gmtime_r. 21844d9310f4SDaniel P. Berrange # 21854d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 will define functions 21864d9310f4SDaniel P. Berrange # for localtime_r/gmtime_r, but only if you have 21874d9310f4SDaniel P. Berrange # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 21884d9310f4SDaniel P. Berrange # though, unistd.h and pthread.h both define 21894d9310f4SDaniel P. Berrange # that for you. 21904d9310f4SDaniel P. Berrange # 21914d9310f4SDaniel P. Berrange # So this #undef localtime_r and #include <unistd.h> 21924d9310f4SDaniel P. Berrange # are not in fact redundant. 21934d9310f4SDaniel P. Berrangecat > $TMPC << EOF 21944d9310f4SDaniel P. Berrange#include <unistd.h> 21954d9310f4SDaniel P. Berrange#include <time.h> 21964d9310f4SDaniel P. Berrange#undef localtime_r 21974d9310f4SDaniel P. Berrangeint main(void) { localtime_r(NULL, NULL); return 0; } 21984d9310f4SDaniel P. BerrangeEOF 21994d9310f4SDaniel P. Berrange if compile_prog "" "" ; then 22004d9310f4SDaniel P. Berrange localtime_r="yes" 22014d9310f4SDaniel P. Berrange else 22024d9310f4SDaniel P. Berrange localtime_r="no" 22034d9310f4SDaniel P. Berrange fi 22044d9310f4SDaniel P. Berrangefi 22054d9310f4SDaniel P. Berrange 22064d9310f4SDaniel P. Berrange########################################## 2207779ab5e3SStefan Weil# pkg-config probe 2208779ab5e3SStefan Weil 2209779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 221076ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2211779ab5e3SStefan Weilfi 2212779ab5e3SStefan Weil 2213779ab5e3SStefan Weil########################################## 2214b0a47e79SJuan Quintela# NPTL probe 2215b0a47e79SJuan Quintela 221624cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2217bd0c5661Spbrook cat > $TMPC <<EOF 2218bd0c5661Spbrook#include <sched.h> 221930813ceaSpbrook#include <linux/futex.h> 2220182eacc0SStefan Weilint main(void) { 2221bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2222bd0c5661Spbrook#error bork 2223bd0c5661Spbrook#endif 2224182eacc0SStefan Weil return 0; 2225bd0c5661Spbrook} 2226bd0c5661SpbrookEOF 222724cb36a6SPeter Maydell if ! compile_object ; then 222821684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2229b0a47e79SJuan Quintela fi 2230bd0c5661Spbrookfi 2231bd0c5661Spbrook 2232ac62922eSbalrog########################################## 2233607dacd0Sqiaonuohan# lzo check 2234607dacd0Sqiaonuohan 2235607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 2236607dacd0Sqiaonuohan cat > $TMPC << EOF 2237607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 2238607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 2239607dacd0SqiaonuohanEOF 2240607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 2241607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -llzo2" 2242b25c9dffSStefan Weil lzo="yes" 2243b25c9dffSStefan Weil else 2244b25c9dffSStefan Weil if test "$lzo" = "yes"; then 2245b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 2246b25c9dffSStefan Weil fi 2247b25c9dffSStefan Weil lzo="no" 2248b25c9dffSStefan Weil fi 2249607dacd0Sqiaonuohanfi 2250607dacd0Sqiaonuohan 2251607dacd0Sqiaonuohan########################################## 2252607dacd0Sqiaonuohan# snappy check 2253607dacd0Sqiaonuohan 2254607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 2255607dacd0Sqiaonuohan cat > $TMPC << EOF 2256607dacd0Sqiaonuohan#include <snappy-c.h> 2257607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 2258607dacd0SqiaonuohanEOF 2259607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 2260607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -lsnappy" 2261b25c9dffSStefan Weil snappy="yes" 2262b25c9dffSStefan Weil else 2263b25c9dffSStefan Weil if test "$snappy" = "yes"; then 2264b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 2265b25c9dffSStefan Weil fi 2266b25c9dffSStefan Weil snappy="no" 2267b25c9dffSStefan Weil fi 2268607dacd0Sqiaonuohanfi 2269607dacd0Sqiaonuohan 2270607dacd0Sqiaonuohan########################################## 22716b383c08SPeter Wu# bzip2 check 22726b383c08SPeter Wu 22736b383c08SPeter Wuif test "$bzip2" != "no" ; then 22746b383c08SPeter Wu cat > $TMPC << EOF 22756b383c08SPeter Wu#include <bzlib.h> 22766b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 22776b383c08SPeter WuEOF 22786b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 22796b383c08SPeter Wu bzip2="yes" 22806b383c08SPeter Wu else 22816b383c08SPeter Wu if test "$bzip2" = "yes"; then 22826b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 22836b383c08SPeter Wu fi 22846b383c08SPeter Wu bzip2="no" 22856b383c08SPeter Wu fi 22866b383c08SPeter Wufi 22876b383c08SPeter Wu 22886b383c08SPeter Wu########################################## 228983bc1f97SJulio Faracco# lzfse check 229083bc1f97SJulio Faracco 229183bc1f97SJulio Faraccoif test "$lzfse" != "no" ; then 229283bc1f97SJulio Faracco cat > $TMPC << EOF 229383bc1f97SJulio Faracco#include <lzfse.h> 229483bc1f97SJulio Faraccoint main(void) { lzfse_decode_scratch_size(); return 0; } 229583bc1f97SJulio FaraccoEOF 229683bc1f97SJulio Faracco if compile_prog "" "-llzfse" ; then 229783bc1f97SJulio Faracco lzfse="yes" 229883bc1f97SJulio Faracco else 229983bc1f97SJulio Faracco if test "$lzfse" = "yes"; then 230083bc1f97SJulio Faracco feature_not_found "lzfse" "Install lzfse devel" 230183bc1f97SJulio Faracco fi 230283bc1f97SJulio Faracco lzfse="no" 230383bc1f97SJulio Faracco fi 230483bc1f97SJulio Faraccofi 230583bc1f97SJulio Faracco 230683bc1f97SJulio Faracco########################################## 2307f794573eSEduardo Otubo# libseccomp check 2308f794573eSEduardo Otubo 2309d0699bd3SMarc-André Lureaulibseccomp_minver="2.2.0" 2310f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 2311693e5910SAndrew Jones case "$cpu" in 2312d0699bd3SMarc-André Lureau i386|x86_64|mips) 23135ce43972SJames Hogan ;; 2314693e5910SAndrew Jones arm|aarch64) 2315693e5910SAndrew Jones libseccomp_minver="2.2.3" 2316693e5910SAndrew Jones ;; 23173aa35fcfSThomas Huth ppc|ppc64|s390x) 23183e684455SMichael Strosaker libseccomp_minver="2.3.0" 23193e684455SMichael Strosaker ;; 2320693e5910SAndrew Jones *) 2321693e5910SAndrew Jones libseccomp_minver="" 2322693e5910SAndrew Jones ;; 2323693e5910SAndrew Jones esac 2324693e5910SAndrew Jones 2325693e5910SAndrew Jones if test "$libseccomp_minver" != "" && 2326693e5910SAndrew Jones $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2327c3883e1fSFam Zheng seccomp_cflags="$($pkg_config --cflags libseccomp)" 2328c3883e1fSFam Zheng seccomp_libs="$($pkg_config --libs libseccomp)" 2329f794573eSEduardo Otubo seccomp="yes" 2330f794573eSEduardo Otubo else 2331f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 2332693e5910SAndrew Jones if test "$libseccomp_minver" != "" ; then 2333693e5910SAndrew Jones feature_not_found "libseccomp" \ 2334693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 2335693e5910SAndrew Jones else 2336693e5910SAndrew Jones feature_not_found "libseccomp" \ 2337693e5910SAndrew Jones "libseccomp is not supported for host cpu $cpu" 2338693e5910SAndrew Jones fi 2339896848f0SEduardo Otubo fi 2340e84d5956SYann E. MORIN seccomp="no" 2341f794573eSEduardo Otubo fi 2342f794573eSEduardo Otubofi 2343f794573eSEduardo Otubo########################################## 2344e37630caSaliguori# xen probe 2345e37630caSaliguori 2346fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 2347c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2348c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2349c1cdd9d5SJuergen Gross # to obtain all needed flags. 2350c1cdd9d5SJuergen Gross 2351c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2352c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2353c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2354c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2355c1cdd9d5SJuergen Gross xen=yes 2356c1cdd9d5SJuergen Gross xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2357c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 235858ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 235958ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 236058ea9a7aSAnthony PERARD fi 2361c1cdd9d5SJuergen Gross QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" 2362c1cdd9d5SJuergen Gross libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" 2363c1cdd9d5SJuergen Gross else 2364c1cdd9d5SJuergen Gross 2365b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 2366d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2367d5b93ddfSAnthony PERARD 236850ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 236950ced5b3SStefan Weil # If no, we are done and there is no Xen support. 237050ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 237150ced5b3SStefan Weil 237250ced5b3SStefan Weil # Xen (any) 237350ced5b3SStefan Weil cat > $TMPC <<EOF 237450ced5b3SStefan Weil#include <xenctrl.h> 237550ced5b3SStefan Weilint main(void) { 237650ced5b3SStefan Weil return 0; 237750ced5b3SStefan Weil} 237850ced5b3SStefan WeilEOF 237950ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 238050ced5b3SStefan Weil # Xen not found 238150ced5b3SStefan Weil if test "$xen" = "yes" ; then 238221684af0SStewart Smith feature_not_found "xen" "Install xen devel" 238350ced5b3SStefan Weil fi 238450ced5b3SStefan Weil xen=no 238550ced5b3SStefan Weil 2386d5b93ddfSAnthony PERARD # Xen unstable 238769deef08SPeter Maydell elif 238869deef08SPeter Maydell cat > $TMPC <<EOF && 23892cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 23902cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 23912cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2392d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 23932cbf8903SRoss Lagerwallint main(void) { 23942cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2395d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 23962cbf8903SRoss Lagerwall 23972cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 23982cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 23992cbf8903SRoss Lagerwall 2400d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2401d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2402d3c49ebbSPaul Durrant 24032cbf8903SRoss Lagerwall return 0; 24042cbf8903SRoss Lagerwall} 24052cbf8903SRoss LagerwallEOF 24062cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 24072cbf8903SRoss Lagerwall then 24082cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 24092cbf8903SRoss Lagerwall xen_ctrl_version=41100 24102cbf8903SRoss Lagerwall xen=yes 24112cbf8903SRoss Lagerwall elif 24122cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 24135ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 24145ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 241558ea9a7aSAnthony PERARD#include <xentoolcore.h> 24165ba3d756SIgor Druzhininint main(void) { 24175ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 24185ba3d756SIgor Druzhinin 24195ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 24205ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 242158ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 24225ba3d756SIgor Druzhinin 24235ba3d756SIgor Druzhinin return 0; 24245ba3d756SIgor Druzhinin} 24255ba3d756SIgor DruzhininEOF 242658ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 24275ba3d756SIgor Druzhinin then 242858ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 24295ba3d756SIgor Druzhinin xen_ctrl_version=41000 24305ba3d756SIgor Druzhinin xen=yes 24315ba3d756SIgor Druzhinin elif 24325ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2433da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2434da8090ccSPaul Durrant#define __XEN_TOOLS__ 2435da8090ccSPaul Durrant#include <xendevicemodel.h> 2436da8090ccSPaul Durrantint main(void) { 2437da8090ccSPaul Durrant xendevicemodel_handle *xd; 2438da8090ccSPaul Durrant 2439da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2440da8090ccSPaul Durrant xendevicemodel_close(xd); 2441da8090ccSPaul Durrant 2442da8090ccSPaul Durrant return 0; 2443da8090ccSPaul Durrant} 2444da8090ccSPaul DurrantEOF 2445da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2446da8090ccSPaul Durrant then 2447da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2448f1167ee6SJuergen Gross xen_ctrl_version=40900 2449da8090ccSPaul Durrant xen=yes 2450da8090ccSPaul Durrant elif 2451da8090ccSPaul Durrant cat > $TMPC <<EOF && 24525eeb39c2SIan Campbell/* 24535eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 24545eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2455b6eb9b45SPaulina Szubarczyk * 2456b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2457b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2458b6eb9b45SPaulina Szubarczyk */ 2459b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2460b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2461b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2462b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2463b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2464b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2465b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2466b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2467b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2468b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2469b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2470b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2471b6eb9b45SPaulina Szubarczyk#endif 2472b6eb9b45SPaulina Szubarczykint main(void) { 2473b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2474b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2475b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2476b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2477b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2478b6eb9b45SPaulina Szubarczyk 2479b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2480b6eb9b45SPaulina Szubarczyk 2481b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2482b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2483b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2484b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2485b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2486b6eb9b45SPaulina Szubarczyk 2487b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2488b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2489b6eb9b45SPaulina Szubarczyk 2490b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2491b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2492b6eb9b45SPaulina Szubarczyk 2493b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2494b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2495b6eb9b45SPaulina Szubarczyk 2496b6eb9b45SPaulina Szubarczyk return 0; 2497b6eb9b45SPaulina Szubarczyk} 2498b6eb9b45SPaulina SzubarczykEOF 2499b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2500b6eb9b45SPaulina Szubarczyk then 2501f1167ee6SJuergen Gross xen_ctrl_version=40800 2502b6eb9b45SPaulina Szubarczyk xen=yes 2503b6eb9b45SPaulina Szubarczyk elif 2504b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2505b6eb9b45SPaulina Szubarczyk/* 2506b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2507b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 25085eeb39c2SIan Campbell */ 25095eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 25105eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 25115eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 25125eeb39c2SIan Campbell#include <xenctrl.h> 25135eeb39c2SIan Campbell#include <xenstore.h> 25145eeb39c2SIan Campbell#include <xenevtchn.h> 25155eeb39c2SIan Campbell#include <xengnttab.h> 25165eeb39c2SIan Campbell#include <xenforeignmemory.h> 25175eeb39c2SIan Campbell#include <stdint.h> 25185eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 25195eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 25205eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 25215eeb39c2SIan Campbell#endif 25225eeb39c2SIan Campbellint main(void) { 25235eeb39c2SIan Campbell xc_interface *xc = NULL; 25245eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 25255eeb39c2SIan Campbell xenevtchn_handle *xe; 25265eeb39c2SIan Campbell xengnttab_handle *xg; 25275eeb39c2SIan Campbell 25285eeb39c2SIan Campbell xs_daemon_open(); 25295eeb39c2SIan Campbell 25305eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 25315eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 25325eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 25335eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 25345eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 25355eeb39c2SIan Campbell 25365eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 25375eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 25385eeb39c2SIan Campbell 25395eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 25405eeb39c2SIan Campbell xenevtchn_fd(xe); 25415eeb39c2SIan Campbell 25425eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 25435eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 25445eeb39c2SIan Campbell 25455eeb39c2SIan Campbell return 0; 25465eeb39c2SIan Campbell} 25475eeb39c2SIan CampbellEOF 25485eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 25495eeb39c2SIan Campbell then 2550f1167ee6SJuergen Gross xen_ctrl_version=40701 25515eeb39c2SIan Campbell xen=yes 2552cdadde39SRoger Pau Monne 2553cdadde39SRoger Pau Monne # Xen 4.6 2554cdadde39SRoger Pau Monne elif 2555cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2556cdadde39SRoger Pau Monne#include <xenctrl.h> 2557e108a3c1SAnthony PERARD#include <xenstore.h> 2558d5b93ddfSAnthony PERARD#include <stdint.h> 2559d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2560d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2561d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2562d5b93ddfSAnthony PERARD#endif 2563d5b93ddfSAnthony PERARDint main(void) { 2564d5b93ddfSAnthony PERARD xc_interface *xc; 2565d5b93ddfSAnthony PERARD xs_daemon_open(); 2566d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2567d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2568d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2569b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 25708688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2571d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 257220a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2573d8b441a3SJan Beulich return 0; 2574d8b441a3SJan Beulich} 2575d8b441a3SJan BeulichEOF 2576d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2577d8b441a3SJan Beulich then 2578f1167ee6SJuergen Gross xen_ctrl_version=40600 2579d8b441a3SJan Beulich xen=yes 2580d8b441a3SJan Beulich 2581d8b441a3SJan Beulich # Xen 4.5 2582d8b441a3SJan Beulich elif 2583d8b441a3SJan Beulich cat > $TMPC <<EOF && 2584d8b441a3SJan Beulich#include <xenctrl.h> 2585d8b441a3SJan Beulich#include <xenstore.h> 2586d8b441a3SJan Beulich#include <stdint.h> 2587d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2588d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2589d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2590d8b441a3SJan Beulich#endif 2591d8b441a3SJan Beulichint main(void) { 2592d8b441a3SJan Beulich xc_interface *xc; 2593d8b441a3SJan Beulich xs_daemon_open(); 2594d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2595d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2596d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2597d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2598d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 25993996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 26003996e85cSPaul Durrant return 0; 26013996e85cSPaul Durrant} 26023996e85cSPaul DurrantEOF 26033996e85cSPaul Durrant compile_prog "" "$xen_libs" 26043996e85cSPaul Durrant then 2605f1167ee6SJuergen Gross xen_ctrl_version=40500 26063996e85cSPaul Durrant xen=yes 26073996e85cSPaul Durrant 26083996e85cSPaul Durrant elif 26093996e85cSPaul Durrant cat > $TMPC <<EOF && 26103996e85cSPaul Durrant#include <xenctrl.h> 26113996e85cSPaul Durrant#include <xenstore.h> 26123996e85cSPaul Durrant#include <stdint.h> 26133996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 26143996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 26153996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 26163996e85cSPaul Durrant#endif 26173996e85cSPaul Durrantint main(void) { 26183996e85cSPaul Durrant xc_interface *xc; 26193996e85cSPaul Durrant xs_daemon_open(); 26203996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 26213996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 26223996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 26233996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 26243996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 26258688e065SStefano Stabellini return 0; 26268688e065SStefano Stabellini} 26278688e065SStefano StabelliniEOF 26288688e065SStefano Stabellini compile_prog "" "$xen_libs" 262969deef08SPeter Maydell then 2630f1167ee6SJuergen Gross xen_ctrl_version=40200 26318688e065SStefano Stabellini xen=yes 26328688e065SStefano Stabellini 2633e37630caSaliguori else 2634fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 2635edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2636edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2637fc321b4bSJuan Quintela fi 2638fc321b4bSJuan Quintela xen=no 2639e37630caSaliguori fi 2640d5b93ddfSAnthony PERARD 2641d5b93ddfSAnthony PERARD if test "$xen" = yes; then 2642f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 26435eeb39c2SIan Campbell libs_softmmu="$xen_stable_libs $libs_softmmu" 26445eeb39c2SIan Campbell fi 2645d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 2646d5b93ddfSAnthony PERARD fi 2647e37630caSaliguori fi 2648c1cdd9d5SJuergen Grossfi 2649e37630caSaliguori 2650eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 2651edfb07edSIan Campbell if test "$xen" = "yes" && test "$linux" = "yes"; then 2652eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 2653eb6fda0fSAnthony PERARD else 2654eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 265576ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 265676ad07a4SPeter Maydell " but this feature requires /sys from Linux" 2657eb6fda0fSAnthony PERARD fi 2658eb6fda0fSAnthony PERARD xen_pci_passthrough=no 2659eb6fda0fSAnthony PERARD fi 2660eb6fda0fSAnthony PERARDfi 2661eb6fda0fSAnthony PERARD 2662e37630caSaliguori########################################## 2663d661d9a4SJustin Terry (VM)# Windows Hypervisor Platform accelerator (WHPX) check 2664d661d9a4SJustin Terry (VM)if test "$whpx" != "no" ; then 2665327fccb2SLucian Petrut if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then 2666d661d9a4SJustin Terry (VM) whpx="yes" 2667d661d9a4SJustin Terry (VM) else 2668d661d9a4SJustin Terry (VM) if test "$whpx" = "yes"; then 266953537bb1SJustin Terry (VM) via Qemu-devel feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" 2670d661d9a4SJustin Terry (VM) fi 2671d661d9a4SJustin Terry (VM) whpx="no" 2672d661d9a4SJustin Terry (VM) fi 2673d661d9a4SJustin Terry (VM)fi 2674d661d9a4SJustin Terry (VM) 2675d661d9a4SJustin Terry (VM)########################################## 2676dfffc653SJuan Quintela# Sparse probe 2677dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 26780dba6195SLoïc Minier if has cgcc; then 2679dfffc653SJuan Quintela sparse=yes 2680dfffc653SJuan Quintela else 2681dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 268221684af0SStewart Smith feature_not_found "sparse" "Install sparse binary" 2683dfffc653SJuan Quintela fi 2684dfffc653SJuan Quintela sparse=no 2685dfffc653SJuan Quintela fi 2686dfffc653SJuan Quintelafi 2687dfffc653SJuan Quintela 2688dfffc653SJuan Quintela########################################## 2689f676c67eSJeremy White# X11 probe 2690f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 26918781595bSGerd Hoffmann have_x11=yes 269289138857SStefan Weil x11_cflags=$($pkg_config --cflags x11) 269389138857SStefan Weil x11_libs=$($pkg_config --libs x11) 2694f676c67eSJeremy Whitefi 2695f676c67eSJeremy White 2696f676c67eSJeremy White########################################## 2697a4ccabcfSAnthony Liguori# GTK probe 2698a4ccabcfSAnthony Liguori 26995a464e6cSPeter Xuif test "$gtk" != "no"; then 270089d85cdeSDaniel P. Berrangé gtkpackage="gtk+-3.0" 270189d85cdeSDaniel P. Berrangé gtkx11package="gtk+-x11-3.0" 270258296cb6SDaniel P. Berrangé gtkversion="3.14.0" 2703bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 270489138857SStefan Weil gtk_cflags=$($pkg_config --cflags $gtkpackage) 270589138857SStefan Weil gtk_libs=$($pkg_config --libs $gtkpackage) 270689138857SStefan Weil gtk_version=$($pkg_config --modversion $gtkpackage) 27070a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 27088781595bSGerd Hoffmann need_x11=yes 2709f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 2710f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 27110a337ed0SGerd Hoffmann fi 2712bbbf9bfbSStefan Weil gtk="yes" 2713bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 27145fe309ffSGerd Hoffmann feature_not_found "gtk" "Install gtk3-devel" 2715bbbf9bfbSStefan Weil else 2716bbbf9bfbSStefan Weil gtk="no" 2717bbbf9bfbSStefan Weil fi 2718bbbf9bfbSStefan Weilfi 2719bbbf9bfbSStefan Weil 2720ddbb0d09SDaniel P. Berrange 2721ddbb0d09SDaniel P. Berrange########################################## 2722ddbb0d09SDaniel P. Berrange# GNUTLS probe 2723ddbb0d09SDaniel P. Berrange 2724ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 2725a0722409SDaniel P. Berrangé if $pkg_config --exists "gnutls >= 3.1.18"; then 272689138857SStefan Weil gnutls_cflags=$($pkg_config --cflags gnutls) 272789138857SStefan Weil gnutls_libs=$($pkg_config --libs gnutls) 2728ddbb0d09SDaniel P. Berrange libs_softmmu="$gnutls_libs $libs_softmmu" 2729ddbb0d09SDaniel P. Berrange libs_tools="$gnutls_libs $libs_tools" 2730ddbb0d09SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 2731ddbb0d09SDaniel P. Berrange gnutls="yes" 2732ddbb0d09SDaniel P. Berrange elif test "$gnutls" = "yes"; then 2733a0722409SDaniel P. Berrangé feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 2734ddbb0d09SDaniel P. Berrange else 2735ddbb0d09SDaniel P. Berrange gnutls="no" 2736ddbb0d09SDaniel P. Berrange fi 2737ddbb0d09SDaniel P. Berrangefi 2738ddbb0d09SDaniel P. Berrange 273991bfcdb0SDaniel P. Berrange 274091bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 274191bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 2742a0722409SDaniel P. Berrangé# explicitly 274391bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 274491bfcdb0SDaniel P. Berrangethen 2745a0722409SDaniel P. Berrangé if test "$nettle" = "yes" 274691bfcdb0SDaniel P. Berrange then 274791bfcdb0SDaniel P. Berrange gcrypt="no" 274891bfcdb0SDaniel P. Berrange fi 274991bfcdb0SDaniel P. Berrangefi 275091bfcdb0SDaniel P. Berrange 275191bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 275291bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 2753a0722409SDaniel P. Berrangé# explicitly 275491bfcdb0SDaniel P. Berrangeif test -z "$nettle" 275591bfcdb0SDaniel P. Berrangethen 2756a0722409SDaniel P. Berrangé if test "$gcrypt" = "yes" 275791bfcdb0SDaniel P. Berrange then 275891bfcdb0SDaniel P. Berrange nettle="no" 275991bfcdb0SDaniel P. Berrange fi 276091bfcdb0SDaniel P. Berrangefi 276191bfcdb0SDaniel P. Berrange 2762dea7a64eSDaniel P. Berrangéhas_libgcrypt() { 276391bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 276491bfcdb0SDaniel P. Berrange then 276591bfcdb0SDaniel P. Berrange return 1 276691bfcdb0SDaniel P. Berrange fi 276791bfcdb0SDaniel P. Berrange 276891bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 276991bfcdb0SDaniel P. Berrange then 277089138857SStefan Weil host=$(libgcrypt-config --host) 277191bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 277291bfcdb0SDaniel P. Berrange then 277391bfcdb0SDaniel P. Berrange return 1 277491bfcdb0SDaniel P. Berrange fi 277591bfcdb0SDaniel P. Berrange fi 277691bfcdb0SDaniel P. Berrange 2777dea7a64eSDaniel P. Berrangé maj=`libgcrypt-config --version | awk -F . '{print $1}'` 2778dea7a64eSDaniel P. Berrangé min=`libgcrypt-config --version | awk -F . '{print $2}'` 2779dea7a64eSDaniel P. Berrangé 2780dea7a64eSDaniel P. Berrangé if test $maj != 1 || test $min -lt 5 2781dea7a64eSDaniel P. Berrangé then 2782dea7a64eSDaniel P. Berrangé return 1 2783dea7a64eSDaniel P. Berrangé fi 2784dea7a64eSDaniel P. Berrangé 278591bfcdb0SDaniel P. Berrange return 0 278691bfcdb0SDaniel P. Berrange} 278791bfcdb0SDaniel P. Berrange 2788a0722409SDaniel P. Berrangé 2789a0722409SDaniel P. Berrangéif test "$nettle" != "no"; then 279064dd2f3bSDaniel P. Berrangé if $pkg_config --exists "nettle >= 2.7.1"; then 2791a0722409SDaniel P. Berrangé nettle_cflags=$($pkg_config --cflags nettle) 2792a0722409SDaniel P. Berrangé nettle_libs=$($pkg_config --libs nettle) 2793a0722409SDaniel P. Berrangé nettle_version=$($pkg_config --modversion nettle) 2794a0722409SDaniel P. Berrangé libs_softmmu="$nettle_libs $libs_softmmu" 2795a0722409SDaniel P. Berrangé libs_tools="$nettle_libs $libs_tools" 2796a0722409SDaniel P. Berrangé QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 2797a0722409SDaniel P. Berrangé nettle="yes" 2798a0722409SDaniel P. Berrangé 2799a0722409SDaniel P. Berrangé if test -z "$gcrypt"; then 2800a0722409SDaniel P. Berrangé gcrypt="no" 2801a0722409SDaniel P. Berrangé fi 2802a0722409SDaniel P. Berrangé else 2803a0722409SDaniel P. Berrangé if test "$nettle" = "yes"; then 280464dd2f3bSDaniel P. Berrangé feature_not_found "nettle" "Install nettle devel >= 2.7.1" 2805a0722409SDaniel P. Berrangé else 2806a0722409SDaniel P. Berrangé nettle="no" 2807a0722409SDaniel P. Berrangé fi 2808a0722409SDaniel P. Berrangé fi 2809a0722409SDaniel P. Berrangéfi 2810a0722409SDaniel P. Berrangé 281191bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 2812dea7a64eSDaniel P. Berrangé if has_libgcrypt; then 281389138857SStefan Weil gcrypt_cflags=$(libgcrypt-config --cflags) 281489138857SStefan Weil gcrypt_libs=$(libgcrypt-config --libs) 281591bfcdb0SDaniel P. Berrange # Debian has remove -lgpg-error from libgcrypt-config 281691bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 281791bfcdb0SDaniel P. Berrange # turn breaks static builds... 281891bfcdb0SDaniel P. Berrange if test "$static" = "yes" 281991bfcdb0SDaniel P. Berrange then 282091bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 282191bfcdb0SDaniel P. Berrange fi 282262893b67SDaniel P. Berrange libs_softmmu="$gcrypt_libs $libs_softmmu" 282362893b67SDaniel P. Berrange libs_tools="$gcrypt_libs $libs_tools" 282462893b67SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 282591bfcdb0SDaniel P. Berrange gcrypt="yes" 28261f923c70SLongpeng(Mike) 28271f923c70SLongpeng(Mike) cat > $TMPC << EOF 28281f923c70SLongpeng(Mike)#include <gcrypt.h> 28291f923c70SLongpeng(Mike)int main(void) { 28301f923c70SLongpeng(Mike) gcry_mac_hd_t handle; 28311f923c70SLongpeng(Mike) gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 28321f923c70SLongpeng(Mike) GCRY_MAC_FLAG_SECURE, NULL); 28331f923c70SLongpeng(Mike) return 0; 28341f923c70SLongpeng(Mike)} 28351f923c70SLongpeng(Mike)EOF 28361f923c70SLongpeng(Mike) if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 28371f923c70SLongpeng(Mike) gcrypt_hmac=yes 28381f923c70SLongpeng(Mike) fi 283962893b67SDaniel P. Berrange else 284091bfcdb0SDaniel P. Berrange if test "$gcrypt" = "yes"; then 2841dea7a64eSDaniel P. Berrangé feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 284291bfcdb0SDaniel P. Berrange else 284391bfcdb0SDaniel P. Berrange gcrypt="no" 284491bfcdb0SDaniel P. Berrange fi 284562893b67SDaniel P. Berrange fi 284662893b67SDaniel P. Berrangefi 284762893b67SDaniel P. Berrange 2848ddbb0d09SDaniel P. Berrange 284991bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 285091bfcdb0SDaniel P. Berrangethen 285191bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 285291bfcdb0SDaniel P. Berrangefi 2853ed754746SDaniel P. Berrange 28549a2fd434SDaniel P. Berrange########################################## 28559a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 28569a2fd434SDaniel P. Berrange 28579a2fd434SDaniel P. Berrangetasn1=yes 285890246037SDaniel P. Berrangetasn1_cflags="" 285990246037SDaniel P. Berrangetasn1_libs="" 28609a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 286189138857SStefan Weil tasn1_cflags=$($pkg_config --cflags libtasn1) 286289138857SStefan Weil tasn1_libs=$($pkg_config --libs libtasn1) 28639a2fd434SDaniel P. Berrangeelse 28649a2fd434SDaniel P. Berrange tasn1=no 28659a2fd434SDaniel P. Berrangefi 28669a2fd434SDaniel P. Berrange 2867ed754746SDaniel P. Berrange 2868bbbf9bfbSStefan Weil########################################## 2869559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 2870559607eaSDaniel P. Berrange 2871559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 2872559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 2873559607eaSDaniel P. Berrange have_ifaddrs_h=no 2874559607eaSDaniel P. Berrangefi 2875559607eaSDaniel P. Berrange 2876559607eaSDaniel P. Berrange########################################## 2877bbbf9bfbSStefan Weil# VTE probe 2878bbbf9bfbSStefan Weil 2879bbbf9bfbSStefan Weilif test "$vte" != "no"; then 2880c6feff9eSCole Robinson vteminversion="0.32.0" 2881c6feff9eSCole Robinson if $pkg_config --exists "vte-2.91"; then 2882c6feff9eSCole Robinson vtepackage="vte-2.91" 2883c6feff9eSCole Robinson else 2884528de90aSDaniel P. Berrange vtepackage="vte-2.90" 2885c6feff9eSCole Robinson fi 2886c6feff9eSCole Robinson if $pkg_config --exists "$vtepackage >= $vteminversion"; then 288789138857SStefan Weil vte_cflags=$($pkg_config --cflags $vtepackage) 288889138857SStefan Weil vte_libs=$($pkg_config --libs $vtepackage) 288989138857SStefan Weil vteversion=$($pkg_config --modversion $vtepackage) 2890bbbf9bfbSStefan Weil vte="yes" 2891bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 2892c6feff9eSCole Robinson feature_not_found "vte" "Install libvte-2.90/2.91 devel" 28939e04c683SStefan Weil else 2894bbbf9bfbSStefan Weil vte="no" 2895a4ccabcfSAnthony Liguori fi 2896a4ccabcfSAnthony Liguorifi 2897a4ccabcfSAnthony Liguori 2898a4ccabcfSAnthony Liguori########################################## 289911d9f695Sbellard# SDL probe 290011d9f695Sbellard 29013ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 29023ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 290347c03744SDave Airlie 2904c6093a05SPeter Xusdl_probe () 2905c6093a05SPeter Xu{ 29060015ca5cSDaniel P. Berrangé if $pkg_config sdl2 --exists; then 29070015ca5cSDaniel P. Berrangé sdlconfig="$pkg_config sdl2" 290889138857SStefan Weil sdlversion=$($sdlconfig --modversion 2>/dev/null) 29093ec87ffeSPaolo Bonzini elif has ${sdl_config}; then 29100015ca5cSDaniel P. Berrangé sdlconfig="$sdl2_config" 291189138857SStefan Weil sdlversion=$($sdlconfig --version) 2912a0dfd8a4SLoïc Minier else 2913a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 29148f4ea9cdSGerd Hoffmann feature_not_found "sdl" "Install SDL2-devel" 2915a0dfd8a4SLoïc Minier fi 2916a0dfd8a4SLoïc Minier sdl=no 2917c6093a05SPeter Xu # no need to do the rest 2918c6093a05SPeter Xu return 29199316f803SPaolo Bonzini fi 292029e5badaSScott Wood if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 29213ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 29223ec87ffeSPaolo Bonzini fi 292311d9f695Sbellard 292411d9f695Sbellard cat > $TMPC << EOF 292511d9f695Sbellard#include <SDL.h> 292611d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 292711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 292811d9f695SbellardEOF 292989138857SStefan Weil sdl_cflags=$($sdlconfig --cflags 2>/dev/null) 29302ca5c430SGerd Hoffmann sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug 293174f42e18STeLeMan if test "$static" = "yes" ; then 29320015ca5cSDaniel P. Berrangé if $pkg_config sdl2 --exists; then 29330015ca5cSDaniel P. Berrangé sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null) 29345f37e6d4SThomas Huth else 293589138857SStefan Weil sdl_libs=$($sdlconfig --static-libs 2>/dev/null) 29365f37e6d4SThomas Huth fi 293774f42e18STeLeMan else 293889138857SStefan Weil sdl_libs=$($sdlconfig --libs 2>/dev/null) 293974f42e18STeLeMan fi 294052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 294111d9f695Sbellard sdl=yes 29427c1f25b4Sbellard 294367c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 2944e633a5c6SEric Blake if test "$sdl" = "yes" && test "$static" = "yes" ; then 294567c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 294689138857SStefan Weil sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" 294789138857SStefan Weil sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" 294811d9f695Sbellard fi 294952166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 29501ac88f28SJuan Quintela : 29511ac88f28SJuan Quintela else 29521ac88f28SJuan Quintela sdl=no 29537c1f25b4Sbellard fi 29547c1f25b4Sbellard fi # static link 2955c4198157SJuan Quintela else # sdl not found 2956c4198157SJuan Quintela if test "$sdl" = "yes" ; then 29570015ca5cSDaniel P. Berrangé feature_not_found "sdl" "Install SDL2 devel" 2958c4198157SJuan Quintela fi 2959c4198157SJuan Quintela sdl=no 29607c1f25b4Sbellard fi # sdl compile test 2961c6093a05SPeter Xu} 2962c6093a05SPeter Xu 2963a442fe2fSDaniel P. Berrangésdl_image_probe () 2964a442fe2fSDaniel P. Berrangé{ 2965a442fe2fSDaniel P. Berrangé if test "$sdl_image" != "no" ; then 2966a442fe2fSDaniel P. Berrangé if $pkg_config SDL2_image --exists; then 2967a442fe2fSDaniel P. Berrangé if test "$static" = "yes"; then 2968a442fe2fSDaniel P. Berrangé sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null) 2969a442fe2fSDaniel P. Berrangé else 2970a442fe2fSDaniel P. Berrangé sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null) 2971a442fe2fSDaniel P. Berrangé fi 2972a442fe2fSDaniel P. Berrangé sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null) 2973a442fe2fSDaniel P. Berrangé sdl_image=yes 2974a442fe2fSDaniel P. Berrangé 2975a442fe2fSDaniel P. Berrangé sdl_cflags="$sdl_cflags $sdl_image_cflags" 2976a442fe2fSDaniel P. Berrangé sdl_libs="$sdl_libs $sdl_image_libs" 2977a442fe2fSDaniel P. Berrangé else 2978a442fe2fSDaniel P. Berrangé if test "$sdl_image" = "yes" ; then 2979a442fe2fSDaniel P. Berrangé feature_not_found "sdl_image" "Install SDL Image devel" 2980a442fe2fSDaniel P. Berrangé else 2981a442fe2fSDaniel P. Berrangé sdl_image=no 2982a442fe2fSDaniel P. Berrangé fi 2983a442fe2fSDaniel P. Berrangé fi 2984a442fe2fSDaniel P. Berrangé fi 2985a442fe2fSDaniel P. Berrangé} 2986a442fe2fSDaniel P. Berrangé 2987c6093a05SPeter Xuif test "$sdl" != "no" ; then 2988c6093a05SPeter Xu sdl_probe 2989fd677642Sthsfi 299011d9f695Sbellard 29915368a422Saliguoriif test "$sdl" = "yes" ; then 2992a442fe2fSDaniel P. Berrangé sdl_image_probe 2993a442fe2fSDaniel P. Berrangéelse 2994a442fe2fSDaniel P. Berrangé if test "$sdl_image" = "yes"; then 2995a442fe2fSDaniel P. Berrangé echo "warning: SDL Image requested, but SDL is not available, disabling" 2996a442fe2fSDaniel P. Berrangé fi 2997a442fe2fSDaniel P. Berrangé sdl_image=no 2998a442fe2fSDaniel P. Berrangéfi 2999a442fe2fSDaniel P. Berrangé 3000a442fe2fSDaniel P. Berrangéif test "$sdl" = "yes" ; then 30015368a422Saliguori cat > $TMPC <<EOF 30025368a422Saliguori#include <SDL.h> 30035368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 30045368a422Saliguori#include <X11/XKBlib.h> 30055368a422Saliguori#else 30065368a422Saliguori#error No x11 support 30075368a422Saliguori#endif 30085368a422Saliguoriint main(void) { return 0; } 30095368a422SaliguoriEOF 3010f676c67eSJeremy White if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then 30118781595bSGerd Hoffmann need_x11=yes 3012f676c67eSJeremy White sdl_cflags="$sdl_cflags $x11_cflags" 3013f676c67eSJeremy White sdl_libs="$sdl_libs $x11_libs" 30145368a422Saliguori fi 30155368a422Saliguorifi 30165368a422Saliguori 30178f28f3fbSths########################################## 30182da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 30192da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 30202da776dbSMichael R. Hines cat > $TMPC <<EOF 30212da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 30222da776dbSMichael R. Hinesint main(void) { return 0; } 30232da776dbSMichael R. HinesEOF 3024ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 30252da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 30262da776dbSMichael R. Hines rdma="yes" 3027ef6d4ccdSYuval Shaia libs_softmmu="$libs_softmmu $rdma_libs" 30282da776dbSMichael R. Hines else 30292da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 30302da776dbSMichael R. Hines error_exit \ 3031ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 30322da776dbSMichael R. Hines " Your options:" \ 3033ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 30342da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 30352da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 30362da776dbSMichael R. Hines fi 30372da776dbSMichael R. Hines rdma="no" 30382da776dbSMichael R. Hines fi 30392da776dbSMichael R. Hinesfi 30402da776dbSMichael R. Hines 304121ab34c9SMarcel Apfelbaum########################################## 304221ab34c9SMarcel Apfelbaum# PVRDMA detection 304321ab34c9SMarcel Apfelbaum 304421ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 304521ab34c9SMarcel Apfelbaum#include <sys/mman.h> 304621ab34c9SMarcel Apfelbaum 304721ab34c9SMarcel Apfelbaumint 304821ab34c9SMarcel Apfelbaummain(void) 304921ab34c9SMarcel Apfelbaum{ 305021ab34c9SMarcel Apfelbaum char buf = 0; 305121ab34c9SMarcel Apfelbaum void *addr = &buf; 305221ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 305321ab34c9SMarcel Apfelbaum 305421ab34c9SMarcel Apfelbaum return 0; 305521ab34c9SMarcel Apfelbaum} 305621ab34c9SMarcel ApfelbaumEOF 305721ab34c9SMarcel Apfelbaum 305821ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 305921ab34c9SMarcel Apfelbaum case "$pvrdma" in 306021ab34c9SMarcel Apfelbaum "") 306121ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 306221ab34c9SMarcel Apfelbaum pvrdma="yes" 306321ab34c9SMarcel Apfelbaum else 306421ab34c9SMarcel Apfelbaum pvrdma="no" 306521ab34c9SMarcel Apfelbaum fi 306621ab34c9SMarcel Apfelbaum ;; 306721ab34c9SMarcel Apfelbaum "yes") 306821ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 306921ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 307021ab34c9SMarcel Apfelbaum fi 307121ab34c9SMarcel Apfelbaum pvrdma="yes" 307221ab34c9SMarcel Apfelbaum ;; 307321ab34c9SMarcel Apfelbaum "no") 307421ab34c9SMarcel Apfelbaum pvrdma="no" 307521ab34c9SMarcel Apfelbaum ;; 307621ab34c9SMarcel Apfelbaum esac 307721ab34c9SMarcel Apfelbaumelse 307821ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 307921ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 308021ab34c9SMarcel Apfelbaum fi 308121ab34c9SMarcel Apfelbaum pvrdma="no" 308221ab34c9SMarcel Apfelbaumfi 308395c6bff3SBenoît Canet 308495c6bff3SBenoît Canet########################################## 30852f9606b3Saliguori# VNC SASL detection 3086e633a5c6SEric Blakeif test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then 30872f9606b3Saliguori cat > $TMPC <<EOF 30882f9606b3Saliguori#include <sasl/sasl.h> 30892f9606b3Saliguori#include <stdio.h> 30902f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 30912f9606b3SaliguoriEOF 30922f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 30932f9606b3Saliguori vnc_sasl_cflags="" 30942f9606b3Saliguori vnc_sasl_libs="-lsasl2" 309552166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 3096ea784e3bSJuan Quintela vnc_sasl=yes 3097fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 3098ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 30992f9606b3Saliguori else 3100ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 310121684af0SStewart Smith feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 3102ea784e3bSJuan Quintela fi 3103ea784e3bSJuan Quintela vnc_sasl=no 31042f9606b3Saliguori fi 31052f9606b3Saliguorifi 31062f9606b3Saliguori 31072f9606b3Saliguori########################################## 31082f6f5c7aSCorentin Chary# VNC JPEG detection 3109e633a5c6SEric Blakeif test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then 31102f6f5c7aSCorentin Charycat > $TMPC <<EOF 31112f6f5c7aSCorentin Chary#include <stdio.h> 31122f6f5c7aSCorentin Chary#include <jpeglib.h> 31132f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 31142f6f5c7aSCorentin CharyEOF 31152f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 31162f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 31172f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 31182f6f5c7aSCorentin Chary vnc_jpeg=yes 31192f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 3120ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 31212f6f5c7aSCorentin Chary else 31222f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 312321684af0SStewart Smith feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 31242f6f5c7aSCorentin Chary fi 31252f6f5c7aSCorentin Chary vnc_jpeg=no 31262f6f5c7aSCorentin Chary fi 31272f6f5c7aSCorentin Charyfi 31282f6f5c7aSCorentin Chary 31292f6f5c7aSCorentin Chary########################################## 3130efe556adSCorentin Chary# VNC PNG detection 3131e633a5c6SEric Blakeif test "$vnc" = "yes" && test "$vnc_png" != "no" ; then 3132efe556adSCorentin Charycat > $TMPC <<EOF 3133efe556adSCorentin Chary//#include <stdio.h> 3134efe556adSCorentin Chary#include <png.h> 3135832ce9c2SScott Wood#include <stddef.h> 3136efe556adSCorentin Charyint main(void) { 3137efe556adSCorentin Chary png_structp png_ptr; 3138efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 31397edc3fedSPeter Maydell return png_ptr != 0; 3140efe556adSCorentin Chary} 3141efe556adSCorentin CharyEOF 314265d5d3f9SStefan Weil if $pkg_config libpng --exists; then 314389138857SStefan Weil vnc_png_cflags=$($pkg_config libpng --cflags) 314489138857SStefan Weil vnc_png_libs=$($pkg_config libpng --libs) 31459af8025eSBrad else 3146efe556adSCorentin Chary vnc_png_cflags="" 3147efe556adSCorentin Chary vnc_png_libs="-lpng" 31489af8025eSBrad fi 3149efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 3150efe556adSCorentin Chary vnc_png=yes 3151efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 31529af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 3153efe556adSCorentin Chary else 3154efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 315521684af0SStewart Smith feature_not_found "vnc-png" "Install libpng devel" 3156efe556adSCorentin Chary fi 3157efe556adSCorentin Chary vnc_png=no 3158efe556adSCorentin Chary fi 3159efe556adSCorentin Charyfi 3160efe556adSCorentin Chary 3161efe556adSCorentin Chary########################################## 31626a021536SGerd Hoffmann# xkbcommon probe 31636a021536SGerd Hoffmannif test "$xkbcommon" != "no" ; then 31646a021536SGerd Hoffmann if $pkg_config xkbcommon --exists; then 31656a021536SGerd Hoffmann xkbcommon_cflags=$($pkg_config xkbcommon --cflags) 31666a021536SGerd Hoffmann xkbcommon_libs=$($pkg_config xkbcommon --libs) 31676a021536SGerd Hoffmann xkbcommon=yes 31686a021536SGerd Hoffmann else 31696a021536SGerd Hoffmann if test "$xkbcommon" = "yes" ; then 31706a021536SGerd Hoffmann feature_not_found "xkbcommon" "Install libxkbcommon-devel" 31716a021536SGerd Hoffmann fi 31726a021536SGerd Hoffmann xkbcommon=no 31736a021536SGerd Hoffmann fi 31746a021536SGerd Hoffmannfi 31756a021536SGerd Hoffmann 31766a021536SGerd Hoffmann########################################## 317776655d6dSaliguori# fnmatch() probe, used for ACL routines 317876655d6dSaliguorifnmatch="no" 317976655d6dSaliguoricat > $TMPC << EOF 318076655d6dSaliguori#include <fnmatch.h> 318176655d6dSaliguoriint main(void) 318276655d6dSaliguori{ 318376655d6dSaliguori fnmatch("foo", "foo", 0); 318476655d6dSaliguori return 0; 318576655d6dSaliguori} 318676655d6dSaliguoriEOF 318752166aa0SJuan Quintelaif compile_prog "" "" ; then 318876655d6dSaliguori fnmatch="yes" 318976655d6dSaliguorifi 319076655d6dSaliguori 319176655d6dSaliguori########################################## 3192c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 3193dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 3194dce512deSChristoph Hellwig cat > $TMPC << EOF 3195ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 3196dce512deSChristoph Hellwig#include <xfs/xfs.h> 3197dce512deSChristoph Hellwigint main(void) 3198dce512deSChristoph Hellwig{ 3199dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 3200dce512deSChristoph Hellwig return 0; 3201dce512deSChristoph Hellwig} 3202dce512deSChristoph HellwigEOF 3203dce512deSChristoph Hellwig if compile_prog "" "" ; then 3204dce512deSChristoph Hellwig xfs="yes" 3205dce512deSChristoph Hellwig else 3206dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 320721684af0SStewart Smith feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 3208dce512deSChristoph Hellwig fi 3209dce512deSChristoph Hellwig xfs=no 3210dce512deSChristoph Hellwig fi 3211dce512deSChristoph Hellwigfi 3212dce512deSChristoph Hellwig 3213dce512deSChristoph Hellwig########################################## 32148a16d273Sths# vde libraries probe 3215dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 32164baae0acSJuan Quintela vde_libs="-lvdeplug" 32178a16d273Sths cat > $TMPC << EOF 32188a16d273Sths#include <libvdeplug.h> 32194a7f0e06Spbrookint main(void) 32204a7f0e06Spbrook{ 32214a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 3222fea08e08SPeter Maydell char s[] = ""; 3223fea08e08SPeter Maydell vde_open(s, s, &a); 32244a7f0e06Spbrook return 0; 32254a7f0e06Spbrook} 32268a16d273SthsEOF 322752166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 32284baae0acSJuan Quintela vde=yes 3229dfb278bdSJuan Quintela else 3230dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 323121684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3232dfb278bdSJuan Quintela fi 3233dfb278bdSJuan Quintela vde=no 32348a16d273Sths fi 32358a16d273Sthsfi 32368a16d273Sths 32378a16d273Sths########################################## 32380a985b37SVincenzo Maffione# netmap support probe 32390a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 32400a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 32410a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 32420a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 32430a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 324458952137SVincenzo Maffioneif test "$netmap" != "no" ; then 324558952137SVincenzo Maffione cat > $TMPC << EOF 324658952137SVincenzo Maffione#include <inttypes.h> 324758952137SVincenzo Maffione#include <net/if.h> 324858952137SVincenzo Maffione#include <net/netmap.h> 324958952137SVincenzo Maffione#include <net/netmap_user.h> 32500a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 32510a985b37SVincenzo Maffione#error 32520a985b37SVincenzo Maffione#endif 325358952137SVincenzo Maffioneint main(void) { return 0; } 325458952137SVincenzo MaffioneEOF 325558952137SVincenzo Maffione if compile_prog "" "" ; then 325658952137SVincenzo Maffione netmap=yes 325758952137SVincenzo Maffione else 325858952137SVincenzo Maffione if test "$netmap" = "yes" ; then 325958952137SVincenzo Maffione feature_not_found "netmap" 326058952137SVincenzo Maffione fi 326158952137SVincenzo Maffione netmap=no 326258952137SVincenzo Maffione fi 326358952137SVincenzo Maffionefi 326458952137SVincenzo Maffione 326558952137SVincenzo Maffione########################################## 326647e98658SCorey Bryant# libcap-ng library probe 326747e98658SCorey Bryantif test "$cap_ng" != "no" ; then 326847e98658SCorey Bryant cap_libs="-lcap-ng" 326947e98658SCorey Bryant cat > $TMPC << EOF 327047e98658SCorey Bryant#include <cap-ng.h> 327147e98658SCorey Bryantint main(void) 327247e98658SCorey Bryant{ 327347e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 327447e98658SCorey Bryant return 0; 327547e98658SCorey Bryant} 327647e98658SCorey BryantEOF 327747e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 327847e98658SCorey Bryant cap_ng=yes 327947e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 328047e98658SCorey Bryant else 328147e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 328221684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 328347e98658SCorey Bryant fi 328447e98658SCorey Bryant cap_ng=no 328547e98658SCorey Bryant fi 328647e98658SCorey Bryantfi 328747e98658SCorey Bryant 328847e98658SCorey Bryant########################################## 3289c2de5c91Smalc# Sound support libraries probe 32908f28f3fbSths 329189138857SStefan Weilaudio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3292c2de5c91Smalcfor drv in $audio_drv_list; do 3293c2de5c91Smalc case $drv in 3294e42975a1SGerd Hoffmann alsa | try-alsa) 3295c80a867fSGerd Hoffmann if $pkg_config alsa --exists; then 3296c80a867fSGerd Hoffmann alsa_libs=$($pkg_config alsa --libs) 3297e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3298e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') 3299e42975a1SGerd Hoffmann fi 3300e42975a1SGerd Hoffmann else 3301e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3302e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') 3303c80a867fSGerd Hoffmann else 3304c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3305c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3306c80a867fSGerd Hoffmann fi 3307e42975a1SGerd Hoffmann fi 3308c2de5c91Smalc ;; 3309c2de5c91Smalc 3310e42975a1SGerd Hoffmann pa | try-pa) 3311c80a867fSGerd Hoffmann if $pkg_config libpulse --exists; then 3312c80a867fSGerd Hoffmann pulse_libs=$($pkg_config libpulse --libs) 331367f86e8eSJuan Quintela audio_pt_int="yes" 3314e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3315e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') 3316e42975a1SGerd Hoffmann fi 3317e42975a1SGerd Hoffmann else 3318e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3319e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') 3320c80a867fSGerd Hoffmann else 3321c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3322c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3323c80a867fSGerd Hoffmann fi 3324e42975a1SGerd Hoffmann fi 3325b8e59f18Smalc ;; 3326b8e59f18Smalc 3327373967b2SGerd Hoffmann sdl) 3328373967b2SGerd Hoffmann if test "$sdl" = "no"; then 3329373967b2SGerd Hoffmann error_exit "sdl not found or disabled, can not use sdl audio driver" 3330373967b2SGerd Hoffmann fi 3331373967b2SGerd Hoffmann ;; 3332373967b2SGerd Hoffmann 3333e42975a1SGerd Hoffmann try-sdl) 3334e42975a1SGerd Hoffmann if test "$sdl" = "no"; then 3335e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') 3336e42975a1SGerd Hoffmann else 3337e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') 3338e42975a1SGerd Hoffmann fi 3339e42975a1SGerd Hoffmann ;; 3340e42975a1SGerd Hoffmann 3341997e690aSJuan Quintela coreaudio) 3342b1149911SFam Zheng coreaudio_libs="-framework CoreAudio" 3343997e690aSJuan Quintela ;; 3344997e690aSJuan Quintela 3345a4bf6780SJuan Quintela dsound) 3346b1149911SFam Zheng dsound_libs="-lole32 -ldxguid" 3347d5631638Smalc audio_win_int="yes" 3348a4bf6780SJuan Quintela ;; 3349a4bf6780SJuan Quintela 3350a4bf6780SJuan Quintela oss) 3351b1149911SFam Zheng oss_libs="$oss_lib" 3352a4bf6780SJuan Quintela ;; 3353a4bf6780SJuan Quintela 3354e4c63a6aSmalc *) 33551c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 335676ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 335776ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 3358e4c63a6aSmalc } 3359e4c63a6aSmalc ;; 3360c2de5c91Smalc esac 3361c2de5c91Smalcdone 33628f28f3fbSths 33634d3b6f6eSbalrog########################################## 33642e4d9fb1Saurel32# BrlAPI probe 33652e4d9fb1Saurel32 33664ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 3367eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 33682e4d9fb1Saurel32 cat > $TMPC << EOF 33692e4d9fb1Saurel32#include <brlapi.h> 3370832ce9c2SScott Wood#include <stddef.h> 33712e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 33722e4d9fb1Saurel32EOF 337352166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 33742e4d9fb1Saurel32 brlapi=yes 33754ffcedb6SJuan Quintela else 33764ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 337721684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 33784ffcedb6SJuan Quintela fi 33794ffcedb6SJuan Quintela brlapi=no 3380eb82284fSJuan Quintela fi 3381eb82284fSJuan Quintelafi 33822e4d9fb1Saurel32 33832e4d9fb1Saurel32########################################## 33844d3b6f6eSbalrog# curses probe 3385a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 3386e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 33878ddc5bf9SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 33888ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3389e095e2f3SStefan Weil else 33907c703002SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 33918ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3392e095e2f3SStefan Weil fi 3393c584a6d0SJuan Quintela curses_found=no 33944d3b6f6eSbalrog cat > $TMPC << EOF 33958ddc5bf9SSamuel Thibault#include <locale.h> 33964d3b6f6eSbalrog#include <curses.h> 33978ddc5bf9SSamuel Thibault#include <wchar.h> 3398ef9a2524SStefan Weilint main(void) { 33998ddc5bf9SSamuel Thibault wchar_t wch = L'w'; 34008ddc5bf9SSamuel Thibault setlocale(LC_ALL, ""); 3401ef9a2524SStefan Weil resize_term(0, 0); 34028ddc5bf9SSamuel Thibault addwstr(L"wide chars\n"); 34038ddc5bf9SSamuel Thibault addnwstr(&wch, 1); 34047c703002SSamuel Thibault add_wch(WACS_DEGREE); 3405271f37abSKamil Rytarowski return 0; 3406ef9a2524SStefan Weil} 34074d3b6f6eSbalrogEOF 3408ecbe251fSVadim Evard IFS=: 34098ddc5bf9SSamuel Thibault for curses_inc in $curses_inc_list; do 3410b01a4fd3SPeter Maydell # Make sure we get the wide character prototypes 3411b01a4fd3SPeter Maydell curses_inc="-DNCURSES_WIDECHAR $curses_inc" 34127c703002SSamuel Thibault IFS=: 34138ddc5bf9SSamuel Thibault for curses_lib in $curses_lib_list; do 3414ecbe251fSVadim Evard unset IFS 34158ddc5bf9SSamuel Thibault if compile_prog "$curses_inc" "$curses_lib" ; then 3416c584a6d0SJuan Quintela curses_found=yes 34174f78ef9aSJuan Quintela break 34184d3b6f6eSbalrog fi 34194f78ef9aSJuan Quintela done 34207c703002SSamuel Thibault if test "$curses_found" = yes ; then 34217c703002SSamuel Thibault break 34227c703002SSamuel Thibault fi 34238ddc5bf9SSamuel Thibault done 3424ecbe251fSVadim Evard unset IFS 3425c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 3426c584a6d0SJuan Quintela curses=yes 3427c584a6d0SJuan Quintela else 3428c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 342921684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 3430c584a6d0SJuan Quintela fi 3431c584a6d0SJuan Quintela curses=no 3432c584a6d0SJuan Quintela fi 34334f78ef9aSJuan Quintelafi 34344d3b6f6eSbalrog 3435414f0dabSblueswir1########################################## 3436769ce76dSAlexander Graf# curl probe 3437a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 343865d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 3439a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 34404e2b0658SPaolo Bonzini else 34414e2b0658SPaolo Bonzini curlconfig=curl-config 34424e2b0658SPaolo Bonzini fi 3443769ce76dSAlexander Graf cat > $TMPC << EOF 3444769ce76dSAlexander Graf#include <curl/curl.h> 34450b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3446769ce76dSAlexander GrafEOF 344789138857SStefan Weil curl_cflags=$($curlconfig --cflags 2>/dev/null) 344889138857SStefan Weil curl_libs=$($curlconfig --libs 2>/dev/null) 3449b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 3450769ce76dSAlexander Graf curl=yes 3451788c8196SJuan Quintela else 3452788c8196SJuan Quintela if test "$curl" = "yes" ; then 345321684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 3454788c8196SJuan Quintela fi 3455788c8196SJuan Quintela curl=no 3456769ce76dSAlexander Graf fi 3457769ce76dSAlexander Graffi # test "$curl" 3458769ce76dSAlexander Graf 3459769ce76dSAlexander Graf########################################## 3460fb599c9aSbalrog# bluez support probe 3461a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 3462e820e3f4Sbalrog cat > $TMPC << EOF 3463e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 3464e820e3f4Sbalrogint main(void) { return bt_error(0); } 3465e820e3f4SbalrogEOF 346689138857SStefan Weil bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null) 346789138857SStefan Weil bluez_libs=$($pkg_config --libs bluez 2>/dev/null) 346852166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 3469a20a6f46SJuan Quintela bluez=yes 3470e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 3471e820e3f4Sbalrog else 3472a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 347321684af0SStewart Smith feature_not_found "bluez" "Install bluez-libs/libbluetooth devel" 3474a20a6f46SJuan Quintela fi 3475e820e3f4Sbalrog bluez="no" 3476e820e3f4Sbalrog fi 3477fb599c9aSbalrogfi 3478fb599c9aSbalrog 3479fb599c9aSbalrog########################################## 3480e18df141SAnthony Liguori# glib support probe 3481a52d28afSPaolo Bonzini 3482e7b3af81SDaniel P. Berrangéglib_req_ver=2.40 3483aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 3484aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 3485a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 3486aa0d1f44SPaolo Bonzinifi 3487e26110cfSFam Zheng 34884eaf7202SSameeh Jubran# This workaround is required due to a bug in pkg-config file for glib as it 34894eaf7202SSameeh Jubran# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 34904eaf7202SSameeh Jubran 3491e633a5c6SEric Blakeif test "$static" = yes && test "$mingw32" = yes; then 34924eaf7202SSameeh Jubran QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" 34934eaf7202SSameeh Jubranfi 34944eaf7202SSameeh Jubran 3495aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 3496e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 349789138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 349889138857SStefan Weil glib_libs=$($pkg_config --libs $i) 34994a058899SMarc-André Lureau QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" 350014015304SAnthony Liguori LIBS="$glib_libs $LIBS" 3501957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 3502e18df141SAnthony Liguori else 3503e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3504e26110cfSFam Zheng fi 3505e26110cfSFam Zhengdone 3506e26110cfSFam Zheng 3507977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 3508977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 3509977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 3510977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 3511977a82abSDaniel P. Berrangecat > $TMPC <<EOF 3512977a82abSDaniel P. Berrange#include <glib.h> 3513977a82abSDaniel P. Berrange#include <unistd.h> 3514977a82abSDaniel P. Berrange 3515977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 3516977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3517977a82abSDaniel P. Berrange 3518977a82abSDaniel P. Berrangeint main(void) { 3519977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3520977a82abSDaniel P. Berrange return 0; 3521977a82abSDaniel P. Berrange} 3522977a82abSDaniel P. BerrangeEOF 3523977a82abSDaniel P. Berrange 35245919e032SStefan Weilif ! compile_prog "$CFLAGS" "$LIBS" ; then 3525977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3526977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 3527977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 3528977a82abSDaniel P. Berrange "build target" 3529977a82abSDaniel P. Berrangefi 3530977a82abSDaniel P. Berrange 3531bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3532bbbf2e04SJohn Snowcat > $TMPC << EOF 3533bbbf2e04SJohn Snow#include <glib.h> 3534bbbf2e04SJohn Snowint main(void) { return 0; } 3535bbbf2e04SJohn SnowEOF 3536bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3537bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 3538bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 3539bbbf2e04SJohn Snow CFLAGS="-Wno-unknown-attributes $CFLAGS" 3540bbbf2e04SJohn Snow fi 3541bbbf2e04SJohn Snowfi 3542bbbf2e04SJohn Snow 35436a1f42bdSStefan Weil######################################### 35446a1f42bdSStefan Weil# zlib check 35456a1f42bdSStefan Weil 35466a1f42bdSStefan Weilif test "$zlib" != "no" ; then 35476a1f42bdSStefan Weil if $pkg_config --exists zlib; then 35486a1f42bdSStefan Weil zlib_cflags=$($pkg_config --cflags zlib) 35496a1f42bdSStefan Weil zlib_libs=$($pkg_config --libs zlib) 35506a1f42bdSStefan Weil QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" 35516a1f42bdSStefan Weil LIBS="$zlib_libs $LIBS" 35526a1f42bdSStefan Weil else 35536a1f42bdSStefan Weil cat > $TMPC << EOF 35546a1f42bdSStefan Weil#include <zlib.h> 35556a1f42bdSStefan Weilint main(void) { zlibVersion(); return 0; } 35566a1f42bdSStefan WeilEOF 35576a1f42bdSStefan Weil if compile_prog "" "-lz" ; then 35586a1f42bdSStefan Weil LIBS="$LIBS -lz" 35596a1f42bdSStefan Weil else 35606a1f42bdSStefan Weil error_exit "zlib check failed" \ 35616a1f42bdSStefan Weil "Make sure to have the zlib libs and headers installed." 35626a1f42bdSStefan Weil fi 35636a1f42bdSStefan Weil fi 35646a1f42bdSStefan Weilfi 35656a1f42bdSStefan Weil 3566e26110cfSFam Zheng########################################## 3567e26110cfSFam Zheng# SHA command probe for modules 3568e26110cfSFam Zhengif test "$modules" = yes; then 3569e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 3570e26110cfSFam Zheng for c in $shacmd_probe; do 35718ccefb91SFam Zheng if has $c; then 3572e26110cfSFam Zheng shacmd="$c" 3573e26110cfSFam Zheng break 3574e26110cfSFam Zheng fi 3575e26110cfSFam Zheng done 3576e26110cfSFam Zheng if test "$shacmd" = ""; then 3577e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3578e26110cfSFam Zheng fi 3579e18df141SAnthony Liguorifi 3580e18df141SAnthony Liguori 3581e18df141SAnthony Liguori########################################## 3582e2134eb9SGerd Hoffmann# pixman support probe 3583e2134eb9SGerd Hoffmann 3584e633a5c6SEric Blakeif test "$want_tools" = "no" && test "$softmmu" = "no"; then 358574880fe2SRobert Schiele pixman_cflags= 358674880fe2SRobert Schiele pixman_libs= 358735c4e86cSGerd Hoffmannelif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then 358889138857SStefan Weil pixman_cflags=$($pkg_config --cflags pixman-1) 358989138857SStefan Weil pixman_libs=$($pkg_config --libs pixman-1) 3590e2134eb9SGerd Hoffmannelse 3591c12b6d70SGerd Hoffmann error_exit "pixman >= 0.21.8 not present." \ 3592c12b6d70SGerd Hoffmann "Please install the pixman devel package." 3593e2134eb9SGerd Hoffmannfi 3594e2134eb9SGerd Hoffmann 3595e2134eb9SGerd Hoffmann########################################## 3596fe8fc5aeSPaolo Bonzini# libmpathpersist probe 3597fe8fc5aeSPaolo Bonzini 3598fe8fc5aeSPaolo Bonziniif test "$mpath" != "no" ; then 35991b0578f5SMurilo Opsfelder Araujo # probe for the new API 3600fe8fc5aeSPaolo Bonzini cat > $TMPC <<EOF 3601fe8fc5aeSPaolo Bonzini#include <libudev.h> 3602fe8fc5aeSPaolo Bonzini#include <mpath_persist.h> 3603fe8fc5aeSPaolo Bonziniunsigned mpath_mx_alloc_len = 1024; 3604fe8fc5aeSPaolo Bonziniint logsink; 3605b3f1c8c4SPaolo Bonzinistatic struct config *multipath_conf; 3606b3f1c8c4SPaolo Bonziniextern struct udev *udev; 3607b3f1c8c4SPaolo Bonziniextern struct config *get_multipath_config(void); 3608b3f1c8c4SPaolo Bonziniextern void put_multipath_config(struct config *conf); 3609b3f1c8c4SPaolo Bonzinistruct udev *udev; 3610b3f1c8c4SPaolo Bonzinistruct config *get_multipath_config(void) { return multipath_conf; } 3611b3f1c8c4SPaolo Bonzinivoid put_multipath_config(struct config *conf) { } 3612b3f1c8c4SPaolo Bonzini 3613fe8fc5aeSPaolo Bonziniint main(void) { 3614b3f1c8c4SPaolo Bonzini udev = udev_new(); 3615b3f1c8c4SPaolo Bonzini multipath_conf = mpath_lib_init(); 3616fe8fc5aeSPaolo Bonzini return 0; 3617fe8fc5aeSPaolo Bonzini} 3618fe8fc5aeSPaolo BonziniEOF 3619fe8fc5aeSPaolo Bonzini if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 3620fe8fc5aeSPaolo Bonzini mpathpersist=yes 36211b0578f5SMurilo Opsfelder Araujo mpathpersist_new_api=yes 36221b0578f5SMurilo Opsfelder Araujo else 36231b0578f5SMurilo Opsfelder Araujo # probe for the old API 36241b0578f5SMurilo Opsfelder Araujo cat > $TMPC <<EOF 36251b0578f5SMurilo Opsfelder Araujo#include <libudev.h> 36261b0578f5SMurilo Opsfelder Araujo#include <mpath_persist.h> 36271b0578f5SMurilo Opsfelder Araujounsigned mpath_mx_alloc_len = 1024; 36281b0578f5SMurilo Opsfelder Araujoint logsink; 36291b0578f5SMurilo Opsfelder Araujoint main(void) { 36301b0578f5SMurilo Opsfelder Araujo struct udev *udev = udev_new(); 36311b0578f5SMurilo Opsfelder Araujo mpath_lib_init(udev); 36321b0578f5SMurilo Opsfelder Araujo return 0; 36331b0578f5SMurilo Opsfelder Araujo} 36341b0578f5SMurilo Opsfelder AraujoEOF 36351b0578f5SMurilo Opsfelder Araujo if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 36361b0578f5SMurilo Opsfelder Araujo mpathpersist=yes 36371b0578f5SMurilo Opsfelder Araujo mpathpersist_new_api=no 3638fe8fc5aeSPaolo Bonzini else 3639fe8fc5aeSPaolo Bonzini mpathpersist=no 3640fe8fc5aeSPaolo Bonzini fi 36411b0578f5SMurilo Opsfelder Araujo fi 3642fe8fc5aeSPaolo Bonzinielse 3643fe8fc5aeSPaolo Bonzini mpathpersist=no 3644fe8fc5aeSPaolo Bonzinifi 3645fe8fc5aeSPaolo Bonzini 3646fe8fc5aeSPaolo Bonzini########################################## 364717bff52bSM. Mohan Kumar# libcap probe 364817bff52bSM. Mohan Kumar 364917bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 365017bff52bSM. Mohan Kumar cat > $TMPC <<EOF 365117bff52bSM. Mohan Kumar#include <stdio.h> 365217bff52bSM. Mohan Kumar#include <sys/capability.h> 3653cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 365417bff52bSM. Mohan KumarEOF 365517bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 365617bff52bSM. Mohan Kumar cap=yes 365717bff52bSM. Mohan Kumar else 365817bff52bSM. Mohan Kumar cap=no 365917bff52bSM. Mohan Kumar fi 366017bff52bSM. Mohan Kumarfi 366117bff52bSM. Mohan Kumar 366217bff52bSM. Mohan Kumar########################################## 3663e5d355d1Saliguori# pthread probe 36644b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 36653c529d93Saliguori 3666e5d355d1Saliguoripthread=no 3667414f0dabSblueswir1cat > $TMPC << EOF 36683c529d93Saliguori#include <pthread.h> 36697a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 36707a42bbe4SStefan Weilint main(void) { 36717a42bbe4SStefan Weil pthread_t thread; 36727a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 36737a42bbe4SStefan Weil return 0; 36747a42bbe4SStefan Weil} 3675414f0dabSblueswir1EOF 3676bd00d539SAndreas Färberif compile_prog "" "" ; then 3677bd00d539SAndreas Färber pthread=yes 3678bd00d539SAndreas Färberelse 3679de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 368052166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 3681e5d355d1Saliguori pthread=yes 3682e3c56761SPeter Portante found=no 3683e3c56761SPeter Portante for lib_entry in $LIBS; do 3684e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 3685e3c56761SPeter Portante found=yes 3686e3c56761SPeter Portante break 3687e3c56761SPeter Portante fi 3688e3c56761SPeter Portante done 3689e3c56761SPeter Portante if test "$found" = "no"; then 36905572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 369114ab3aa7SMarc-André Lureau libs_qga="$pthread_lib $libs_qga" 3692e3c56761SPeter Portante fi 3693409437e1SDaniel P. Berrange PTHREAD_LIB="$pthread_lib" 3694de65fe0fSSebastian Herbszt break 3695414f0dabSblueswir1 fi 3696de65fe0fSSebastian Herbszt done 3697bd00d539SAndreas Färberfi 3698414f0dabSblueswir1 3699e633a5c6SEric Blakeif test "$mingw32" != yes && test "$pthread" = no; then 370076ad07a4SPeter Maydell error_exit "pthread check failed" \ 370176ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 3702e5d355d1Saliguorifi 3703e5d355d1Saliguori 3704479a5747SRoman Bolshakov# check for pthread_setname_np with thread id 3705479a5747SRoman Bolshakovpthread_setname_np_w_tid=no 37065c312079SDr. David Alan Gilbertcat > $TMPC << EOF 37075c312079SDr. David Alan Gilbert#include <pthread.h> 37085c312079SDr. David Alan Gilbert 37095c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 37105c312079SDr. David Alan Gilbertint main(void) 37115c312079SDr. David Alan Gilbert{ 37125c312079SDr. David Alan Gilbert pthread_t thread; 37135c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 37145c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 37155c312079SDr. David Alan Gilbert return 0; 37165c312079SDr. David Alan Gilbert} 37175c312079SDr. David Alan GilbertEOF 37185c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 3719479a5747SRoman Bolshakov pthread_setname_np_w_tid=yes 3720479a5747SRoman Bolshakovfi 3721479a5747SRoman Bolshakov 3722479a5747SRoman Bolshakov# check for pthread_setname_np without thread id 3723479a5747SRoman Bolshakovpthread_setname_np_wo_tid=no 3724479a5747SRoman Bolshakovcat > $TMPC << EOF 3725479a5747SRoman Bolshakov#include <pthread.h> 3726479a5747SRoman Bolshakov 3727479a5747SRoman Bolshakovstatic void *f(void *p) { pthread_setname_np("QEMU"); } 3728479a5747SRoman Bolshakovint main(void) 3729479a5747SRoman Bolshakov{ 3730479a5747SRoman Bolshakov pthread_t thread; 3731479a5747SRoman Bolshakov pthread_create(&thread, 0, f, 0); 3732479a5747SRoman Bolshakov return 0; 3733479a5747SRoman Bolshakov} 3734479a5747SRoman BolshakovEOF 3735479a5747SRoman Bolshakovif compile_prog "" "$pthread_lib" ; then 3736479a5747SRoman Bolshakov pthread_setname_np_wo_tid=yes 37375c312079SDr. David Alan Gilbertfi 37385c312079SDr. David Alan Gilbert 3739bf9298b9Saliguori########################################## 3740f27aaf4bSChristian Brunner# rbd probe 3741f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 3742f27aaf4bSChristian Brunner cat > $TMPC <<EOF 3743f27aaf4bSChristian Brunner#include <stdio.h> 3744ad32e9c0SJosh Durgin#include <rbd/librbd.h> 3745f27aaf4bSChristian Brunnerint main(void) { 3746ad32e9c0SJosh Durgin rados_t cluster; 3747ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 3748f27aaf4bSChristian Brunner return 0; 3749f27aaf4bSChristian Brunner} 3750f27aaf4bSChristian BrunnerEOF 3751ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 3752f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 3753f27aaf4bSChristian Brunner rbd=yes 3754f27aaf4bSChristian Brunner else 3755f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 375621684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 3757f27aaf4bSChristian Brunner fi 3758f27aaf4bSChristian Brunner rbd=no 3759f27aaf4bSChristian Brunner fi 3760f27aaf4bSChristian Brunnerfi 3761f27aaf4bSChristian Brunner 3762f27aaf4bSChristian Brunner########################################## 37630a12ec87SRichard W.M. Jones# libssh2 probe 37644fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8 37650a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then 376665d5d3f9SStefan Weil if $pkg_config --atleast-version=$min_libssh2_version libssh2; then 376789138857SStefan Weil libssh2_cflags=$($pkg_config libssh2 --cflags) 376889138857SStefan Weil libssh2_libs=$($pkg_config libssh2 --libs) 37690a12ec87SRichard W.M. Jones libssh2=yes 37700a12ec87SRichard W.M. Jones else 37710a12ec87SRichard W.M. Jones if test "$libssh2" = "yes" ; then 37724fc16838SRichard W.M. Jones error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" 37730a12ec87SRichard W.M. Jones fi 37740a12ec87SRichard W.M. Jones libssh2=no 37750a12ec87SRichard W.M. Jones fi 37760a12ec87SRichard W.M. Jonesfi 37770a12ec87SRichard W.M. Jones 37780a12ec87SRichard W.M. Jones########################################## 37799a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe 37809a2d462eSRichard W.M. Jones 37819a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then 37829a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 37839a2d462eSRichard W.M. Jones#include <stdio.h> 37849a2d462eSRichard W.M. Jones#include <libssh2.h> 37859a2d462eSRichard W.M. Jones#include <libssh2_sftp.h> 37869a2d462eSRichard W.M. Jonesint main(void) { 37879a2d462eSRichard W.M. Jones LIBSSH2_SESSION *session; 37889a2d462eSRichard W.M. Jones LIBSSH2_SFTP *sftp; 37899a2d462eSRichard W.M. Jones LIBSSH2_SFTP_HANDLE *sftp_handle; 37909a2d462eSRichard W.M. Jones session = libssh2_session_init (); 37919a2d462eSRichard W.M. Jones sftp = libssh2_sftp_init (session); 37929a2d462eSRichard W.M. Jones sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); 37939a2d462eSRichard W.M. Jones libssh2_sftp_fsync (sftp_handle); 37949a2d462eSRichard W.M. Jones return 0; 37959a2d462eSRichard W.M. Jones} 37969a2d462eSRichard W.M. JonesEOF 37979a2d462eSRichard W.M. Jones # libssh2_cflags/libssh2_libs defined in previous test. 37989a2d462eSRichard W.M. Jones if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then 37999a2d462eSRichard W.M. Jones QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" 38009a2d462eSRichard W.M. Jones fi 38019a2d462eSRichard W.M. Jonesfi 38029a2d462eSRichard W.M. Jones 38039a2d462eSRichard W.M. Jones########################################## 38045c6c3a6cSChristoph Hellwig# linux-aio probe 38055c6c3a6cSChristoph Hellwig 38065c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 38075c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 38085c6c3a6cSChristoph Hellwig#include <libaio.h> 38095c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 3810832ce9c2SScott Wood#include <stddef.h> 38115c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 38125c6c3a6cSChristoph HellwigEOF 38135c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 38145c6c3a6cSChristoph Hellwig linux_aio=yes 38155c6c3a6cSChristoph Hellwig else 38165c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 381721684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 38185c6c3a6cSChristoph Hellwig fi 38193cfcae3cSLuiz Capitulino linux_aio=no 38205c6c3a6cSChristoph Hellwig fi 38215c6c3a6cSChristoph Hellwigfi 38225c6c3a6cSChristoph Hellwig 38235c6c3a6cSChristoph Hellwig########################################## 38243b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux 38253b8acc11SPaolo Bonzini 3826e633a5c6SEric Blakeif test "$targetos" = Linux && { test "$cpu" = i386 || test "$cpu" = x86_64; }; then 38273b8acc11SPaolo Bonzini tpm_passthrough=$tpm 38283b8acc11SPaolo Bonzinielse 38293b8acc11SPaolo Bonzini tpm_passthrough=no 38303b8acc11SPaolo Bonzinifi 38313b8acc11SPaolo Bonzini 3832f4ede81eSAmarnath Valluri# TPM emulator is for all posix systems 3833f4ede81eSAmarnath Valluriif test "$mingw32" != "yes"; then 3834f4ede81eSAmarnath Valluri tpm_emulator=$tpm 3835f4ede81eSAmarnath Vallurielse 3836f4ede81eSAmarnath Valluri tpm_emulator=no 3837f4ede81eSAmarnath Vallurifi 38383b8acc11SPaolo Bonzini########################################## 3839758e8e38SVenkateswararao Jujjuri (JV)# attr probe 3840758e8e38SVenkateswararao Jujjuri (JV) 3841758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 3842758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 3843758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 3844758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 3845f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 3846f2338fb4SPavel Borzenkov#include <attr/xattr.h> 3847f2338fb4SPavel Borzenkov#else 38484f26f2b6SAvi Kivity#include <sys/xattr.h> 3849f2338fb4SPavel Borzenkov#endif 3850758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 3851758e8e38SVenkateswararao Jujjuri (JV)EOF 38524f26f2b6SAvi Kivity if compile_prog "" "" ; then 38534f26f2b6SAvi Kivity attr=yes 38544f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 3855f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 3856758e8e38SVenkateswararao Jujjuri (JV) attr=yes 3857758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 38584f26f2b6SAvi Kivity libattr=yes 3859758e8e38SVenkateswararao Jujjuri (JV) else 3860758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 386121684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 3862758e8e38SVenkateswararao Jujjuri (JV) fi 3863758e8e38SVenkateswararao Jujjuri (JV) attr=no 3864758e8e38SVenkateswararao Jujjuri (JV) fi 3865758e8e38SVenkateswararao Jujjuri (JV)fi 3866758e8e38SVenkateswararao Jujjuri (JV) 3867758e8e38SVenkateswararao Jujjuri (JV)########################################## 3868bf9298b9Saliguori# iovec probe 3869bf9298b9Saliguoricat > $TMPC <<EOF 3870db34f0b3Sblueswir1#include <sys/types.h> 3871bf9298b9Saliguori#include <sys/uio.h> 3872db34f0b3Sblueswir1#include <unistd.h> 3873f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 3874bf9298b9SaliguoriEOF 3875bf9298b9Saliguoriiovec=no 387652166aa0SJuan Quintelaif compile_prog "" "" ; then 3877bf9298b9Saliguori iovec=yes 3878bf9298b9Saliguorifi 3879bf9298b9Saliguori 3880f652e6afSaurel32########################################## 3881ceb42de8Saliguori# preadv probe 3882ceb42de8Saliguoricat > $TMPC <<EOF 3883ceb42de8Saliguori#include <sys/types.h> 3884ceb42de8Saliguori#include <sys/uio.h> 3885ceb42de8Saliguori#include <unistd.h> 3886c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 3887ceb42de8SaliguoriEOF 3888ceb42de8Saliguoripreadv=no 388952166aa0SJuan Quintelaif compile_prog "" "" ; then 3890ceb42de8Saliguori preadv=yes 3891ceb42de8Saliguorifi 3892ceb42de8Saliguori 3893ceb42de8Saliguori########################################## 3894f652e6afSaurel32# fdt probe 3895e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 3896e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 3897e169e1e1SPeter Maydellfdt_required=no 3898e169e1e1SPeter Maydellfor target in $target_list; do 3899e169e1e1SPeter Maydell case $target in 3900a666409fSKONRAD Frederic aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu) 3901e169e1e1SPeter Maydell fdt_required=yes 3902e169e1e1SPeter Maydell ;; 3903e169e1e1SPeter Maydell esac 3904e169e1e1SPeter Maydelldone 3905e169e1e1SPeter Maydell 3906e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 3907e169e1e1SPeter Maydell if test "$fdt" = "no"; then 3908e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 3909e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 3910e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 3911e169e1e1SPeter Maydell fi 3912e169e1e1SPeter Maydell fdt=yes 3913e169e1e1SPeter Maydellfi 3914e169e1e1SPeter Maydell 39152df87df7SJuan Quintelaif test "$fdt" != "no" ; then 3916b41af4baSJuan Quintela fdt_libs="-lfdt" 391796ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 39186e85fce0SPaul Burton # and test for required functions to make sure we are on a version >= 1.4.2 3919f652e6afSaurel32 cat > $TMPC << EOF 392031ce0adbSThomas Huth#include <libfdt.h> 392196ce6545SPeter Crosthwaite#include <libfdt_env.h> 3922fea35ca4SAlexey Kardashevskiyint main(void) { fdt_check_full(NULL, 0); return 0; } 3923f652e6afSaurel32EOF 392452166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 3925a540f158SPeter Crosthwaite # system DTC is good - use it 3926e3971d61SPhilippe Mathieu-Daudé fdt=system 3927aef45d51SDaniel P. Berrange else 3928aef45d51SDaniel P. Berrange # have GIT checkout, so activate dtc submodule 3929aef45d51SDaniel P. Berrange if test -e "${source_path}/.git" ; then 3930aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 3931aef45d51SDaniel P. Berrange fi 3932aef45d51SDaniel P. Berrange if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then 3933e3971d61SPhilippe Mathieu-Daudé fdt=git 3934a540f158SPeter Crosthwaite mkdir -p dtc 3935cab00a5aSMichael S. Tsirkin if [ "$pwd_is_source_path" != "y" ] ; then 3936a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 3937a540f158SPeter Crosthwaite symlink "$source_path/dtc/scripts" "dtc/scripts" 39382df87df7SJuan Quintela fi 3939a540f158SPeter Crosthwaite fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 39408a99e9a3SPhilippe Mathieu-Daudé fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" 39418a99e9a3SPhilippe Mathieu-Daudé fdt_libs="$fdt_libs" 3942a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 3943aef45d51SDaniel P. Berrange # Not a git build & no libfdt found, prompt for system install 3944aef45d51SDaniel P. Berrange error_exit "DTC (libfdt) version >= 1.4.2 not present." \ 3945aef45d51SDaniel P. Berrange "Please install the DTC (libfdt) devel package" 3946a540f158SPeter Crosthwaite else 3947a540f158SPeter Crosthwaite # don't have and don't want 3948de3a354aSMichael Walle fdt_libs= 39492df87df7SJuan Quintela fdt=no 3950f652e6afSaurel32 fi 3951f652e6afSaurel32 fi 3952aef45d51SDaniel P. Berrangefi 3953f652e6afSaurel32 3954a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 3955a540f158SPeter Crosthwaite 395620ff075bSMichael Walle########################################## 3957fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 3958b1546f32SGerd Hoffmann 3959da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 39604939a1dfSMichael Tokarev opengl_pkgs="epoxy gbm" 39615f9b1e35SGerd Hoffmann if $pkg_config $opengl_pkgs; then 39625f9b1e35SGerd Hoffmann opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 39635f9b1e35SGerd Hoffmann opengl_libs="$($pkg_config --libs $opengl_pkgs)" 3964da076ffeSGerd Hoffmann opengl=yes 3965925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 3966925a0400SGerd Hoffmann gtk_gl="yes" 3967925a0400SGerd Hoffmann fi 3968cc720a5dSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" 396920ff075bSMichael Walle else 3970da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3971dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 397220ff075bSMichael Walle fi 3973f676c67eSJeremy White opengl_cflags="" 3974da076ffeSGerd Hoffmann opengl_libs="" 3975da076ffeSGerd Hoffmann opengl=no 397620ff075bSMichael Walle fi 397720ff075bSMichael Wallefi 397820ff075bSMichael Walle 3979014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 3980014cb152SGerd Hoffmann cat > $TMPC << EOF 3981014cb152SGerd Hoffmann#include <epoxy/egl.h> 3982014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 3983014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 3984014cb152SGerd Hoffmann#endif 3985014cb152SGerd Hoffmannint main(void) { return 0; } 3986014cb152SGerd HoffmannEOF 3987014cb152SGerd Hoffmann if compile_prog "" "" ; then 3988014cb152SGerd Hoffmann opengl_dmabuf=yes 3989014cb152SGerd Hoffmann fi 3990014cb152SGerd Hoffmannfi 3991c9a12e75SChrysostomos Nanakos 3992e633a5c6SEric Blakeif test "$opengl" = "yes" && test "$have_x11" = "yes"; then 399399e1a93bSPhilippe Mathieu-Daudé for target in $target_list; do 399499e1a93bSPhilippe Mathieu-Daudé case $target in 399599e1a93bSPhilippe Mathieu-Daudé lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL 399699e1a93bSPhilippe Mathieu-Daudé need_x11=yes 399799e1a93bSPhilippe Mathieu-Daudé ;; 399899e1a93bSPhilippe Mathieu-Daudé esac 399999e1a93bSPhilippe Mathieu-Daudé done 400099e1a93bSPhilippe Mathieu-Daudéfi 400199e1a93bSPhilippe Mathieu-Daudé 4002ed279a06SKlim Kireev########################################## 4003ed279a06SKlim Kireev# libxml2 probe 4004ed279a06SKlim Kireevif test "$libxml2" != "no" ; then 4005ed279a06SKlim Kireev if $pkg_config --exists libxml-2.0; then 4006ed279a06SKlim Kireev libxml2="yes" 4007ed279a06SKlim Kireev libxml2_cflags=$($pkg_config --cflags libxml-2.0) 4008ed279a06SKlim Kireev libxml2_libs=$($pkg_config --libs libxml-2.0) 4009ed279a06SKlim Kireev else 4010ed279a06SKlim Kireev if test "$libxml2" = "yes"; then 4011ed279a06SKlim Kireev feature_not_found "libxml2" "Install libxml2 devel" 4012ed279a06SKlim Kireev fi 4013ed279a06SKlim Kireev libxml2="no" 4014ed279a06SKlim Kireev fi 4015ed279a06SKlim Kireevfi 4016c9a12e75SChrysostomos Nanakos 4017eb100396SBharata B Rao########################################## 4018eb100396SBharata B Rao# glusterfs probe 4019eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 402065d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 4021e01bee08SBharata B Rao glusterfs="yes" 402289138857SStefan Weil glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 402389138857SStefan Weil glusterfs_libs=$($pkg_config --libs glusterfs-api) 4024d85fa9ebSJeff Cody if $pkg_config --atleast-version=4 glusterfs-api; then 4025d85fa9ebSJeff Cody glusterfs_xlator_opt="yes" 4026d85fa9ebSJeff Cody fi 402765d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 40280c14fb47SBharata B Rao glusterfs_discard="yes" 40290c14fb47SBharata B Rao fi 40307c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 4031df3a429aSNiels de Vos glusterfs_fallocate="yes" 40327c815372SBharata B Rao glusterfs_zerofill="yes" 40337c815372SBharata B Rao fi 4034eb100396SBharata B Rao else 4035eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 40368efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 40378efc9363SHu Tao "Install glusterfs-api devel >= 3" 4038eb100396SBharata B Rao fi 4039e01bee08SBharata B Rao glusterfs="no" 4040eb100396SBharata B Rao fi 4041eb100396SBharata B Raofi 4042eb100396SBharata B Rao 404339386ac7Saurel32# Check for inotify functions when we are building linux-user 40443b3f24adSaurel32# emulator. This is done because older glibc versions don't 40453b3f24adSaurel32# have syscall stubs for these implemented. In that case we 40463b3f24adSaurel32# don't provide them even if kernel supports them. 40473b3f24adSaurel32# 40483b3f24adSaurel32inotify=no 40493b3f24adSaurel32cat > $TMPC << EOF 40503b3f24adSaurel32#include <sys/inotify.h> 40513b3f24adSaurel32 40523b3f24adSaurel32int 40533b3f24adSaurel32main(void) 40543b3f24adSaurel32{ 40553b3f24adSaurel32 /* try to start inotify */ 40568690e420Saurel32 return inotify_init(); 40573b3f24adSaurel32} 40583b3f24adSaurel32EOF 405952166aa0SJuan Quintelaif compile_prog "" "" ; then 40603b3f24adSaurel32 inotify=yes 40613b3f24adSaurel32fi 40623b3f24adSaurel32 4063c05c7a73SRiku Voipioinotify1=no 4064c05c7a73SRiku Voipiocat > $TMPC << EOF 4065c05c7a73SRiku Voipio#include <sys/inotify.h> 4066c05c7a73SRiku Voipio 4067c05c7a73SRiku Voipioint 4068c05c7a73SRiku Voipiomain(void) 4069c05c7a73SRiku Voipio{ 4070c05c7a73SRiku Voipio /* try to start inotify */ 4071c05c7a73SRiku Voipio return inotify_init1(0); 4072c05c7a73SRiku Voipio} 4073c05c7a73SRiku VoipioEOF 4074c05c7a73SRiku Voipioif compile_prog "" "" ; then 4075c05c7a73SRiku Voipio inotify1=yes 4076c05c7a73SRiku Voipiofi 4077c05c7a73SRiku Voipio 4078099d6b0fSRiku Voipio# check if pipe2 is there 4079099d6b0fSRiku Voipiopipe2=no 4080099d6b0fSRiku Voipiocat > $TMPC << EOF 4081099d6b0fSRiku Voipio#include <unistd.h> 4082099d6b0fSRiku Voipio#include <fcntl.h> 4083099d6b0fSRiku Voipio 4084099d6b0fSRiku Voipioint main(void) 4085099d6b0fSRiku Voipio{ 4086099d6b0fSRiku Voipio int pipefd[2]; 40879bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 4088099d6b0fSRiku Voipio} 4089099d6b0fSRiku VoipioEOF 409052166aa0SJuan Quintelaif compile_prog "" "" ; then 4091099d6b0fSRiku Voipio pipe2=yes 4092099d6b0fSRiku Voipiofi 4093099d6b0fSRiku Voipio 409440ff6d7eSKevin Wolf# check if accept4 is there 409540ff6d7eSKevin Wolfaccept4=no 409640ff6d7eSKevin Wolfcat > $TMPC << EOF 409740ff6d7eSKevin Wolf#include <sys/socket.h> 409840ff6d7eSKevin Wolf#include <stddef.h> 409940ff6d7eSKevin Wolf 410040ff6d7eSKevin Wolfint main(void) 410140ff6d7eSKevin Wolf{ 410240ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 410340ff6d7eSKevin Wolf return 0; 410440ff6d7eSKevin Wolf} 410540ff6d7eSKevin WolfEOF 410640ff6d7eSKevin Wolfif compile_prog "" "" ; then 410740ff6d7eSKevin Wolf accept4=yes 410840ff6d7eSKevin Wolffi 410940ff6d7eSKevin Wolf 41103ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 41113ce34dfbSvibisreenivasansplice=no 41123ce34dfbSvibisreenivasancat > $TMPC << EOF 41133ce34dfbSvibisreenivasan#include <unistd.h> 41143ce34dfbSvibisreenivasan#include <fcntl.h> 41153ce34dfbSvibisreenivasan#include <limits.h> 41163ce34dfbSvibisreenivasan 41173ce34dfbSvibisreenivasanint main(void) 41183ce34dfbSvibisreenivasan{ 411966ea0f22SStefan Weil int len, fd = 0; 41203ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 41213ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 41223ce34dfbSvibisreenivasan return 0; 41233ce34dfbSvibisreenivasan} 41243ce34dfbSvibisreenivasanEOF 412552166aa0SJuan Quintelaif compile_prog "" "" ; then 41263ce34dfbSvibisreenivasan splice=yes 41273ce34dfbSvibisreenivasanfi 41283ce34dfbSvibisreenivasan 4129dcc38d1cSMarcelo Tosatti########################################## 4130a99d57bbSWanlong Gao# libnuma probe 4131a99d57bbSWanlong Gao 4132a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 4133a99d57bbSWanlong Gao cat > $TMPC << EOF 4134a99d57bbSWanlong Gao#include <numa.h> 4135a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 4136a99d57bbSWanlong GaoEOF 4137a99d57bbSWanlong Gao 4138a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 4139a99d57bbSWanlong Gao numa=yes 4140a99d57bbSWanlong Gao libs_softmmu="-lnuma $libs_softmmu" 4141a99d57bbSWanlong Gao else 4142a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 4143a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 4144a99d57bbSWanlong Gao fi 4145a99d57bbSWanlong Gao numa=no 4146a99d57bbSWanlong Gao fi 4147a99d57bbSWanlong Gaofi 4148a99d57bbSWanlong Gao 41497b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 41507b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 41517b01cb97SAlexandre Derumier exit 1 41527b01cb97SAlexandre Derumierfi 41537b01cb97SAlexandre Derumier 41545a22ab71SYang Zhong# Even if malloc_trim() is available, these non-libc memory allocators 41555a22ab71SYang Zhong# do not support it. 41565a22ab71SYang Zhongif test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then 41575a22ab71SYang Zhong if test "$malloc_trim" = "yes" ; then 41585a22ab71SYang Zhong echo "Disabling malloc_trim with non-libc memory allocator" 41595a22ab71SYang Zhong fi 41605a22ab71SYang Zhong malloc_trim="no" 41615a22ab71SYang Zhongfi 41625a22ab71SYang Zhong 41635a22ab71SYang Zhong####################################### 41645a22ab71SYang Zhong# malloc_trim 41655a22ab71SYang Zhong 41665a22ab71SYang Zhongif test "$malloc_trim" != "no" ; then 41675a22ab71SYang Zhong cat > $TMPC << EOF 41685a22ab71SYang Zhong#include <malloc.h> 41695a22ab71SYang Zhongint main(void) { malloc_trim(0); return 0; } 41705a22ab71SYang ZhongEOF 41715a22ab71SYang Zhong if compile_prog "" "" ; then 41725a22ab71SYang Zhong malloc_trim="yes" 41735a22ab71SYang Zhong else 41745a22ab71SYang Zhong malloc_trim="no" 41755a22ab71SYang Zhong fi 41765a22ab71SYang Zhongfi 41775a22ab71SYang Zhong 4178a99d57bbSWanlong Gao########################################## 41792847b469SFam Zheng# tcmalloc probe 41802847b469SFam Zheng 41812847b469SFam Zhengif test "$tcmalloc" = "yes" ; then 41822847b469SFam Zheng cat > $TMPC << EOF 41832847b469SFam Zheng#include <stdlib.h> 41842847b469SFam Zhengint main(void) { malloc(1); return 0; } 41852847b469SFam ZhengEOF 41862847b469SFam Zheng 41872847b469SFam Zheng if compile_prog "" "-ltcmalloc" ; then 41882847b469SFam Zheng LIBS="-ltcmalloc $LIBS" 41892847b469SFam Zheng else 41902847b469SFam Zheng feature_not_found "tcmalloc" "install gperftools devel" 41912847b469SFam Zheng fi 41922847b469SFam Zhengfi 41932847b469SFam Zheng 41942847b469SFam Zheng########################################## 41957b01cb97SAlexandre Derumier# jemalloc probe 41967b01cb97SAlexandre Derumier 41977b01cb97SAlexandre Derumierif test "$jemalloc" = "yes" ; then 41987b01cb97SAlexandre Derumier cat > $TMPC << EOF 41997b01cb97SAlexandre Derumier#include <stdlib.h> 42007b01cb97SAlexandre Derumierint main(void) { malloc(1); return 0; } 42017b01cb97SAlexandre DerumierEOF 42027b01cb97SAlexandre Derumier 42037b01cb97SAlexandre Derumier if compile_prog "" "-ljemalloc" ; then 42047b01cb97SAlexandre Derumier LIBS="-ljemalloc $LIBS" 42057b01cb97SAlexandre Derumier else 42067b01cb97SAlexandre Derumier feature_not_found "jemalloc" "install jemalloc devel" 42077b01cb97SAlexandre Derumier fi 42087b01cb97SAlexandre Derumierfi 42097b01cb97SAlexandre Derumier 42107b01cb97SAlexandre Derumier########################################## 4211dcc38d1cSMarcelo Tosatti# signalfd probe 4212dcc38d1cSMarcelo Tosattisignalfd="no" 4213dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 4214dcc38d1cSMarcelo Tosatti#include <unistd.h> 4215dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 4216dcc38d1cSMarcelo Tosatti#include <signal.h> 4217dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4218dcc38d1cSMarcelo TosattiEOF 4219dcc38d1cSMarcelo Tosatti 4220dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 4221dcc38d1cSMarcelo Tosatti signalfd=yes 4222dcc38d1cSMarcelo Tosattifi 4223dcc38d1cSMarcelo Tosatti 4224d339d766SRichard W.M. Jones# check if optreset global is declared by <getopt.h> 4225d339d766SRichard W.M. Jonesoptreset="no" 4226d339d766SRichard W.M. Jonescat > $TMPC << EOF 4227d339d766SRichard W.M. Jones#include <getopt.h> 4228d339d766SRichard W.M. Jonesint main(void) { return optreset; } 4229d339d766SRichard W.M. JonesEOF 4230d339d766SRichard W.M. Jones 4231d339d766SRichard W.M. Jonesif compile_prog "" "" ; then 4232d339d766SRichard W.M. Jones optreset=yes 4233d339d766SRichard W.M. Jonesfi 4234d339d766SRichard W.M. Jones 4235c2882b96SRiku Voipio# check if eventfd is supported 4236c2882b96SRiku Voipioeventfd=no 4237c2882b96SRiku Voipiocat > $TMPC << EOF 4238c2882b96SRiku Voipio#include <sys/eventfd.h> 4239c2882b96SRiku Voipio 4240c2882b96SRiku Voipioint main(void) 4241c2882b96SRiku Voipio{ 424255cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4243c2882b96SRiku Voipio} 4244c2882b96SRiku VoipioEOF 4245c2882b96SRiku Voipioif compile_prog "" "" ; then 4246c2882b96SRiku Voipio eventfd=yes 4247c2882b96SRiku Voipiofi 4248c2882b96SRiku Voipio 4249751bcc39SMarc-André Lureau# check if memfd is supported 4250751bcc39SMarc-André Lureaumemfd=no 4251751bcc39SMarc-André Lureaucat > $TMPC << EOF 425275e5b70eSPaolo Bonzini#include <sys/mman.h> 4253751bcc39SMarc-André Lureau 4254751bcc39SMarc-André Lureauint main(void) 4255751bcc39SMarc-André Lureau{ 4256751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 4257751bcc39SMarc-André Lureau} 4258751bcc39SMarc-André LureauEOF 4259751bcc39SMarc-André Lureauif compile_prog "" "" ; then 4260751bcc39SMarc-André Lureau memfd=yes 4261751bcc39SMarc-André Lureaufi 4262751bcc39SMarc-André Lureau 4263955727d2SCortland Tölva# check for usbfs 4264955727d2SCortland Tölvahave_usbfs=no 4265955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 4266955727d2SCortland Tölva if check_include linux/usbdevice_fs.h; then 4267955727d2SCortland Tölva have_usbfs=yes 4268955727d2SCortland Tölva fi 4269955727d2SCortland Tölva have_usbfs=yes 4270955727d2SCortland Tölvafi 4271751bcc39SMarc-André Lureau 4272d0927938SUlrich Hecht# check for fallocate 4273d0927938SUlrich Hechtfallocate=no 4274d0927938SUlrich Hechtcat > $TMPC << EOF 4275d0927938SUlrich Hecht#include <fcntl.h> 4276d0927938SUlrich Hecht 4277d0927938SUlrich Hechtint main(void) 4278d0927938SUlrich Hecht{ 4279d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 4280d0927938SUlrich Hecht return 0; 4281d0927938SUlrich Hecht} 4282d0927938SUlrich HechtEOF 42838fb03151SPeter Maydellif compile_prog "" "" ; then 4284d0927938SUlrich Hecht fallocate=yes 4285d0927938SUlrich Hechtfi 4286d0927938SUlrich Hecht 42873d4fa43eSKusanagi Kouichi# check for fallocate hole punching 42883d4fa43eSKusanagi Kouichifallocate_punch_hole=no 42893d4fa43eSKusanagi Kouichicat > $TMPC << EOF 42903d4fa43eSKusanagi Kouichi#include <fcntl.h> 42913d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 42923d4fa43eSKusanagi Kouichi 42933d4fa43eSKusanagi Kouichiint main(void) 42943d4fa43eSKusanagi Kouichi{ 42953d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 42963d4fa43eSKusanagi Kouichi return 0; 42973d4fa43eSKusanagi Kouichi} 42983d4fa43eSKusanagi KouichiEOF 42993d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 43003d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 43013d4fa43eSKusanagi Kouichifi 43023d4fa43eSKusanagi Kouichi 4303b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 4304b953f075SDenis V. Lunevfallocate_zero_range=no 4305b953f075SDenis V. Lunevcat > $TMPC << EOF 4306b953f075SDenis V. Lunev#include <fcntl.h> 4307b953f075SDenis V. Lunev#include <linux/falloc.h> 4308b953f075SDenis V. Lunev 4309b953f075SDenis V. Lunevint main(void) 4310b953f075SDenis V. Lunev{ 4311b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4312b953f075SDenis V. Lunev return 0; 4313b953f075SDenis V. Lunev} 4314b953f075SDenis V. LunevEOF 4315b953f075SDenis V. Lunevif compile_prog "" "" ; then 4316b953f075SDenis V. Lunev fallocate_zero_range=yes 4317b953f075SDenis V. Lunevfi 4318b953f075SDenis V. Lunev 4319ed911435SKevin Wolf# check for posix_fallocate 4320ed911435SKevin Wolfposix_fallocate=no 4321ed911435SKevin Wolfcat > $TMPC << EOF 4322ed911435SKevin Wolf#include <fcntl.h> 4323ed911435SKevin Wolf 4324ed911435SKevin Wolfint main(void) 4325ed911435SKevin Wolf{ 4326ed911435SKevin Wolf posix_fallocate(0, 0, 0); 4327ed911435SKevin Wolf return 0; 4328ed911435SKevin Wolf} 4329ed911435SKevin WolfEOF 4330ed911435SKevin Wolfif compile_prog "" "" ; then 4331ed911435SKevin Wolf posix_fallocate=yes 4332ed911435SKevin Wolffi 4333ed911435SKevin Wolf 4334c727f47dSPeter Maydell# check for sync_file_range 4335c727f47dSPeter Maydellsync_file_range=no 4336c727f47dSPeter Maydellcat > $TMPC << EOF 4337c727f47dSPeter Maydell#include <fcntl.h> 4338c727f47dSPeter Maydell 4339c727f47dSPeter Maydellint main(void) 4340c727f47dSPeter Maydell{ 4341c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 4342c727f47dSPeter Maydell return 0; 4343c727f47dSPeter Maydell} 4344c727f47dSPeter MaydellEOF 43458fb03151SPeter Maydellif compile_prog "" "" ; then 4346c727f47dSPeter Maydell sync_file_range=yes 4347c727f47dSPeter Maydellfi 4348c727f47dSPeter Maydell 4349dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 4350dace20dcSPeter Maydellfiemap=no 4351dace20dcSPeter Maydellcat > $TMPC << EOF 4352dace20dcSPeter Maydell#include <sys/ioctl.h> 4353dace20dcSPeter Maydell#include <linux/fs.h> 4354dace20dcSPeter Maydell#include <linux/fiemap.h> 4355dace20dcSPeter Maydell 4356dace20dcSPeter Maydellint main(void) 4357dace20dcSPeter Maydell{ 4358dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 4359dace20dcSPeter Maydell return 0; 4360dace20dcSPeter Maydell} 4361dace20dcSPeter MaydellEOF 43628fb03151SPeter Maydellif compile_prog "" "" ; then 4363dace20dcSPeter Maydell fiemap=yes 4364dace20dcSPeter Maydellfi 4365dace20dcSPeter Maydell 4366d0927938SUlrich Hecht# check for dup3 4367d0927938SUlrich Hechtdup3=no 4368d0927938SUlrich Hechtcat > $TMPC << EOF 4369d0927938SUlrich Hecht#include <unistd.h> 4370d0927938SUlrich Hecht 4371d0927938SUlrich Hechtint main(void) 4372d0927938SUlrich Hecht{ 4373d0927938SUlrich Hecht dup3(0, 0, 0); 4374d0927938SUlrich Hecht return 0; 4375d0927938SUlrich Hecht} 4376d0927938SUlrich HechtEOF 437778f5d726SJan Kiszkaif compile_prog "" "" ; then 4378d0927938SUlrich Hecht dup3=yes 4379d0927938SUlrich Hechtfi 4380d0927938SUlrich Hecht 43814e0c6529SAlex Bligh# check for ppoll support 43824e0c6529SAlex Blighppoll=no 43834e0c6529SAlex Blighcat > $TMPC << EOF 43844e0c6529SAlex Bligh#include <poll.h> 43854e0c6529SAlex Bligh 43864e0c6529SAlex Blighint main(void) 43874e0c6529SAlex Bligh{ 43884e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 43894e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 43904e0c6529SAlex Bligh return 0; 43914e0c6529SAlex Bligh} 43924e0c6529SAlex BlighEOF 43934e0c6529SAlex Blighif compile_prog "" "" ; then 43944e0c6529SAlex Bligh ppoll=yes 43954e0c6529SAlex Blighfi 43964e0c6529SAlex Bligh 4397cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 4398cd758dd0SAlex Blighprctl_pr_set_timerslack=no 4399cd758dd0SAlex Blighcat > $TMPC << EOF 4400cd758dd0SAlex Bligh#include <sys/prctl.h> 4401cd758dd0SAlex Bligh 4402cd758dd0SAlex Blighint main(void) 4403cd758dd0SAlex Bligh{ 4404cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4405cd758dd0SAlex Bligh return 0; 4406cd758dd0SAlex Bligh} 4407cd758dd0SAlex BlighEOF 4408cd758dd0SAlex Blighif compile_prog "" "" ; then 4409cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 4410cd758dd0SAlex Blighfi 4411cd758dd0SAlex Bligh 44123b6edd16SPeter Maydell# check for epoll support 44133b6edd16SPeter Maydellepoll=no 44143b6edd16SPeter Maydellcat > $TMPC << EOF 44153b6edd16SPeter Maydell#include <sys/epoll.h> 44163b6edd16SPeter Maydell 44173b6edd16SPeter Maydellint main(void) 44183b6edd16SPeter Maydell{ 44193b6edd16SPeter Maydell epoll_create(0); 44203b6edd16SPeter Maydell return 0; 44213b6edd16SPeter Maydell} 44223b6edd16SPeter MaydellEOF 44238fb03151SPeter Maydellif compile_prog "" "" ; then 44243b6edd16SPeter Maydell epoll=yes 44253b6edd16SPeter Maydellfi 44263b6edd16SPeter Maydell 4427227f0214SPeter Maydell# epoll_create1 is a later addition 4428227f0214SPeter Maydell# so we must check separately for its presence 44293b6edd16SPeter Maydellepoll_create1=no 44303b6edd16SPeter Maydellcat > $TMPC << EOF 44313b6edd16SPeter Maydell#include <sys/epoll.h> 44323b6edd16SPeter Maydell 44333b6edd16SPeter Maydellint main(void) 44343b6edd16SPeter Maydell{ 443519e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 443619e83f6bSPeter Maydell * a function being called. This is necessary so that on 443719e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 443819e83f6bSPeter Maydell * the library but not declared in the header file we will 443919e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 444019e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 444119e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 444219e83f6bSPeter Maydell */ 4443c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 44443b6edd16SPeter Maydell} 44453b6edd16SPeter MaydellEOF 44468fb03151SPeter Maydellif compile_prog "" "" ; then 44473b6edd16SPeter Maydell epoll_create1=yes 44483b6edd16SPeter Maydellfi 44493b6edd16SPeter Maydell 4450a8fd1abaSPeter Maydell# check for sendfile support 4451a8fd1abaSPeter Maydellsendfile=no 4452a8fd1abaSPeter Maydellcat > $TMPC << EOF 4453a8fd1abaSPeter Maydell#include <sys/sendfile.h> 4454a8fd1abaSPeter Maydell 4455a8fd1abaSPeter Maydellint main(void) 4456a8fd1abaSPeter Maydell{ 4457a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 4458a8fd1abaSPeter Maydell} 4459a8fd1abaSPeter MaydellEOF 4460a8fd1abaSPeter Maydellif compile_prog "" "" ; then 4461a8fd1abaSPeter Maydell sendfile=yes 4462a8fd1abaSPeter Maydellfi 4463a8fd1abaSPeter Maydell 446451834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 446551834341SRiku Voipiotimerfd=no 446651834341SRiku Voipiocat > $TMPC << EOF 446751834341SRiku Voipio#include <sys/timerfd.h> 446851834341SRiku Voipio 446951834341SRiku Voipioint main(void) 447051834341SRiku Voipio{ 447151834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 447251834341SRiku Voipio} 447351834341SRiku VoipioEOF 447451834341SRiku Voipioif compile_prog "" "" ; then 447551834341SRiku Voipio timerfd=yes 447651834341SRiku Voipiofi 447751834341SRiku Voipio 44789af5c906SRiku Voipio# check for setns and unshare support 44799af5c906SRiku Voipiosetns=no 44809af5c906SRiku Voipiocat > $TMPC << EOF 44819af5c906SRiku Voipio#include <sched.h> 44829af5c906SRiku Voipio 44839af5c906SRiku Voipioint main(void) 44849af5c906SRiku Voipio{ 44859af5c906SRiku Voipio int ret; 44869af5c906SRiku Voipio ret = setns(0, 0); 44879af5c906SRiku Voipio ret = unshare(0); 44889af5c906SRiku Voipio return ret; 44899af5c906SRiku Voipio} 44909af5c906SRiku VoipioEOF 44919af5c906SRiku Voipioif compile_prog "" "" ; then 44929af5c906SRiku Voipio setns=yes 44939af5c906SRiku Voipiofi 44949af5c906SRiku Voipio 449538860a03SAleksandar Markovic# clock_adjtime probe 449638860a03SAleksandar Markovicclock_adjtime=no 449738860a03SAleksandar Markoviccat > $TMPC <<EOF 449838860a03SAleksandar Markovic#include <time.h> 449938860a03SAleksandar Markovic 450038860a03SAleksandar Markovicint main(void) 450138860a03SAleksandar Markovic{ 450238860a03SAleksandar Markovic return clock_adjtime(0, 0); 450338860a03SAleksandar Markovic} 450438860a03SAleksandar MarkovicEOF 450538860a03SAleksandar Markovicclock_adjtime=no 450638860a03SAleksandar Markovicif compile_prog "" "" ; then 450738860a03SAleksandar Markovic clock_adjtime=yes 450838860a03SAleksandar Markovicfi 450938860a03SAleksandar Markovic 45105a03cd00SAleksandar Markovic# syncfs probe 45115a03cd00SAleksandar Markovicsyncfs=no 45125a03cd00SAleksandar Markoviccat > $TMPC <<EOF 45135a03cd00SAleksandar Markovic#include <unistd.h> 45145a03cd00SAleksandar Markovic 45155a03cd00SAleksandar Markovicint main(void) 45165a03cd00SAleksandar Markovic{ 45175a03cd00SAleksandar Markovic return syncfs(0); 45185a03cd00SAleksandar Markovic} 45195a03cd00SAleksandar MarkovicEOF 45205a03cd00SAleksandar Markovicsyncfs=no 45215a03cd00SAleksandar Markovicif compile_prog "" "" ; then 45225a03cd00SAleksandar Markovic syncfs=yes 45235a03cd00SAleksandar Markovicfi 45245a03cd00SAleksandar Markovic 4525cc8ae6deSpbrook# Check if tools are available to build documentation. 4526a25dba17SJuan Quintelaif test "$docs" != "no" ; then 452701668d98SStefan Weil if has makeinfo && has pod2man; then 4528a25dba17SJuan Quintela docs=yes 452983a3ab8bSJuan Quintela else 4530a25dba17SJuan Quintela if test "$docs" = "yes" ; then 453121684af0SStewart Smith feature_not_found "docs" "Install texinfo and Perl/perl-podlators" 453283a3ab8bSJuan Quintela fi 4533a25dba17SJuan Quintela docs=no 453483a3ab8bSJuan Quintela fi 4535cc8ae6deSpbrookfi 4536cc8ae6deSpbrook 4537f514f41cSStefan Weil# Search for bswap_32 function 45386ae9a1f4SJuan Quintelabyteswap_h=no 45396ae9a1f4SJuan Quintelacat > $TMPC << EOF 45406ae9a1f4SJuan Quintela#include <byteswap.h> 45416ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 45426ae9a1f4SJuan QuintelaEOF 454352166aa0SJuan Quintelaif compile_prog "" "" ; then 45446ae9a1f4SJuan Quintela byteswap_h=yes 45456ae9a1f4SJuan Quintelafi 45466ae9a1f4SJuan Quintela 454775f13596SStefan Weil# Search for bswap32 function 45486ae9a1f4SJuan Quintelabswap_h=no 45496ae9a1f4SJuan Quintelacat > $TMPC << EOF 45506ae9a1f4SJuan Quintela#include <sys/endian.h> 45516ae9a1f4SJuan Quintela#include <sys/types.h> 45526ae9a1f4SJuan Quintela#include <machine/bswap.h> 45536ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 45546ae9a1f4SJuan QuintelaEOF 455552166aa0SJuan Quintelaif compile_prog "" "" ; then 45566ae9a1f4SJuan Quintela bswap_h=yes 45576ae9a1f4SJuan Quintelafi 45586ae9a1f4SJuan Quintela 4559da93a1fdSaliguori########################################## 4560e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 4561c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 4562e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 45633c33ea96SPaolo Bonzini libiscsi="yes" 4564ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 4565ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 4566c589b249SRonnie Sahlberg else 4567c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 4568e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 4569c589b249SRonnie Sahlberg fi 4570c589b249SRonnie Sahlberg libiscsi="no" 4571c589b249SRonnie Sahlberg fi 4572c589b249SRonnie Sahlbergfi 4573c589b249SRonnie Sahlberg 4574c589b249SRonnie Sahlberg########################################## 45758bacde8dSNatanael Copa# Do we need libm 45768bacde8dSNatanael Copacat > $TMPC << EOF 45778bacde8dSNatanael Copa#include <math.h> 4578f80ea986SAlexey Kardashevskiyint main(int argc, char **argv) { return isnan(sin((double)argc)); } 45798bacde8dSNatanael CopaEOF 45808bacde8dSNatanael Copaif compile_prog "" "" ; then 45818bacde8dSNatanael Copa : 45828bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 45838bacde8dSNatanael Copa LIBS="-lm $LIBS" 45848bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 45858bacde8dSNatanael Copaelse 458676ad07a4SPeter Maydell error_exit "libm check failed" 45878bacde8dSNatanael Copafi 45888bacde8dSNatanael Copa 45898bacde8dSNatanael Copa########################################## 4590da93a1fdSaliguori# Do we need librt 45918bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 45928bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 45938bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 45948bacde8dSNatanael Copa# function in addition. 4595da93a1fdSaliguoricat > $TMPC <<EOF 4596da93a1fdSaliguori#include <signal.h> 4597da93a1fdSaliguori#include <time.h> 45988bacde8dSNatanael Copaint main(void) { 45998bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 46008bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 46018bacde8dSNatanael Copa} 4602da93a1fdSaliguoriEOF 4603da93a1fdSaliguori 460452166aa0SJuan Quintelaif compile_prog "" "" ; then 460507ffa4bdSJuan Quintela : 46068bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 460718e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 460818e588b1SRick Liu LIBS="$LIBS -lrt" 460918e588b1SRick Liu libs_qga="$libs_qga -lrt" 4610da93a1fdSaliguorifi 4611da93a1fdSaliguori 4612d99e97e6SThomas Huth# Check whether we need to link libutil for openpty() 4613d99e97e6SThomas Huthcat > $TMPC << EOF 4614d99e97e6SThomas Huthextern int openpty(int *am, int *as, char *name, void *termp, void *winp); 4615d99e97e6SThomas Huthint main(void) { return openpty(0, 0, 0, 0, 0); } 4616d99e97e6SThomas HuthEOF 4617d99e97e6SThomas Huth 4618d99e97e6SThomas Huthif ! compile_prog "" "" ; then 4619d99e97e6SThomas Huth if compile_prog "" "-lutil" ; then 46206362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 4621d99e97e6SThomas Huth libs_tools="-lutil $libs_tools" 4622d99e97e6SThomas Huth fi 46236362a53fSJuan Quintelafi 46246362a53fSJuan Quintela 4625de5071c5SBlue Swirl########################################## 4626cd4ec0b4SGerd Hoffmann# spice probe 4627cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 4628cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 4629cd4ec0b4SGerd Hoffmann#include <spice.h> 4630cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 4631cd4ec0b4SGerd HoffmannEOF 4632710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 4633710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 46341b63665cSMarc-André Lureau if $pkg_config --atleast-version=0.12.5 spice-server && \ 463565d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 4636cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 4637cd4ec0b4SGerd Hoffmann spice="yes" 4638cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 4639cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 46402e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 46412e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 4642cd4ec0b4SGerd Hoffmann else 4643cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 46448efc9363SHu Tao feature_not_found "spice" \ 46451b63665cSMarc-André Lureau "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" 4646cd4ec0b4SGerd Hoffmann fi 4647cd4ec0b4SGerd Hoffmann spice="no" 4648cd4ec0b4SGerd Hoffmann fi 4649cd4ec0b4SGerd Hoffmannfi 4650cd4ec0b4SGerd Hoffmann 46517b02f544SMarc-André Lureau# check for smartcard support 46527b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 46530f5c642dSMichal Privoznik if $pkg_config --atleast-version=2.5.1 libcacard; then 46547b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 46557b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 46567b02f544SMarc-André Lureau smartcard="yes" 4657111a38b0SRobert Relyea else 46587b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 46597b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 4660111a38b0SRobert Relyea fi 46617b02f544SMarc-André Lureau smartcard="no" 4662111a38b0SRobert Relyea fi 4663111a38b0SRobert Relyeafi 4664111a38b0SRobert Relyea 46652b2325ffSGerd Hoffmann# check for libusb 46662b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 466765d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 46682b2325ffSGerd Hoffmann libusb="yes" 4669ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 4670ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 46712b2325ffSGerd Hoffmann else 46722b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 46738efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 46742b2325ffSGerd Hoffmann fi 46752b2325ffSGerd Hoffmann libusb="no" 46762b2325ffSGerd Hoffmann fi 46772b2325ffSGerd Hoffmannfi 46782b2325ffSGerd Hoffmann 467969354a83SHans de Goede# check for usbredirparser for usb network redirection support 468069354a83SHans de Goedeif test "$usb_redir" != "no" ; then 468165d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 468269354a83SHans de Goede usb_redir="yes" 4683ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 4684ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 468569354a83SHans de Goede else 468669354a83SHans de Goede if test "$usb_redir" = "yes"; then 468721684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 468869354a83SHans de Goede fi 468969354a83SHans de Goede usb_redir="no" 469069354a83SHans de Goede fi 469169354a83SHans de Goedefi 469269354a83SHans de Goede 4693cd4ec0b4SGerd Hoffmann########################################## 4694d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 4695d9840e25STomoki Sekiyama 4696e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 4697e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 4698d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 4699690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 4700d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 4701d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 4702690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 4703d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 4704d9840e25STomoki Sekiyama ;; 4705690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 4706d9840e25STomoki Sekiyama esac 4707d9840e25STomoki Sekiyama cat > $TMPC << EOF 4708d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 4709d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 4710d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 4711d9840e25STomoki SekiyamaEOF 4712d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 4713d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 4714d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 4715315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 4716f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 4717d9840e25STomoki Sekiyama else 4718d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 4719d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 4720d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 4721d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 4722d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 4723d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 4724d9840e25STomoki Sekiyama feature_not_found "VSS support" 4725d9840e25STomoki Sekiyama fi 4726d9840e25STomoki Sekiyama guest_agent_with_vss="no" 4727d9840e25STomoki Sekiyama fi 4728d9840e25STomoki Sekiyamafi 4729d9840e25STomoki Sekiyama 4730d9840e25STomoki Sekiyama########################################## 4731d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 4732d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 4733d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 4734d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 4735d9840e25STomoki Sekiyama 4736e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 4737e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 4738d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 4739d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 4740d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 4741d9840e25STomoki Sekiyama if test -n "$programfiles"; then 4742d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 4743d9840e25STomoki Sekiyama else 4744d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 4745d9840e25STomoki Sekiyama fi 4746d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 4747d9840e25STomoki Sekiyama win_sdk="" 4748d9840e25STomoki Sekiyama fi 4749d9840e25STomoki Sekiyamafi 4750d9840e25STomoki Sekiyama 4751d9840e25STomoki Sekiyama########################################## 475250cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 4753e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 475450cbebb9SMichael Roth cat > $TMPC << EOF 475550cbebb9SMichael Roth#include <windows.h> 475650cbebb9SMichael Roth#include <ntddscsi.h> 475750cbebb9SMichael Rothint main(void) { 475850cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 475950cbebb9SMichael Roth#error Missing required ioctl definitions 476050cbebb9SMichael Roth#endif 476150cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 476250cbebb9SMichael Roth return addr.Lun; 476350cbebb9SMichael Roth} 476450cbebb9SMichael RothEOF 476550cbebb9SMichael Roth if compile_prog "" "" ; then 476650cbebb9SMichael Roth guest_agent_ntddscsi=yes 4767c54e1eb4SMichael Roth libs_qga="-lsetupapi $libs_qga" 476850cbebb9SMichael Roth fi 476950cbebb9SMichael Rothfi 477050cbebb9SMichael Roth 477150cbebb9SMichael Roth########################################## 47729d9e1521SGerd Hoffmann# virgl renderer probe 47739d9e1521SGerd Hoffmann 47749d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 47759d9e1521SGerd Hoffmann cat > $TMPC << EOF 47769d9e1521SGerd Hoffmann#include <virglrenderer.h> 47779d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 47789d9e1521SGerd HoffmannEOF 47799d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 47809d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 478147479c55SMarc-André Lureau virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 47829d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 47839d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 47849d9e1521SGerd Hoffmann virglrenderer="yes" 47859d9e1521SGerd Hoffmann else 47869d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 47879d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 47889d9e1521SGerd Hoffmann fi 47899d9e1521SGerd Hoffmann virglrenderer="no" 47909d9e1521SGerd Hoffmann fi 47919d9e1521SGerd Hoffmannfi 47929d9e1521SGerd Hoffmann 47939d9e1521SGerd Hoffmann########################################## 47948ca80760SRichard Henderson# capstone 47958ca80760SRichard Henderson 4796e219c499SRichard Hendersoncase "$capstone" in 4797e219c499SRichard Henderson "" | yes) 47988ca80760SRichard Henderson if $pkg_config capstone; then 4799e219c499SRichard Henderson capstone=system 4800e633a5c6SEric Blake elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 4801e219c499SRichard Henderson capstone=git 4802e219c499SRichard Henderson elif test -e "${source_path}/capstone/Makefile" ; then 4803e219c499SRichard Henderson capstone=internal 4804e219c499SRichard Henderson elif test -z "$capstone" ; then 4805e219c499SRichard Henderson capstone=no 4806e219c499SRichard Henderson else 4807e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel or git submodule" 4808e219c499SRichard Henderson fi 4809e219c499SRichard Henderson ;; 4810e219c499SRichard Henderson 4811e219c499SRichard Henderson system) 4812e219c499SRichard Henderson if ! $pkg_config capstone; then 4813e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel" 4814e219c499SRichard Henderson fi 4815e219c499SRichard Henderson ;; 4816e219c499SRichard Hendersonesac 4817e219c499SRichard Henderson 4818e219c499SRichard Hendersoncase "$capstone" in 4819e219c499SRichard Henderson git | internal) 4820e219c499SRichard Henderson if test "$capstone" = git; then 4821e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 4822e219c499SRichard Henderson fi 4823e219c499SRichard Henderson mkdir -p capstone 4824e219c499SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" 4825e219c499SRichard Henderson if test "$mingw32" = "yes"; then 4826e219c499SRichard Henderson LIBCAPSTONE=capstone.lib 4827e219c499SRichard Henderson else 4828e219c499SRichard Henderson LIBCAPSTONE=libcapstone.a 4829e219c499SRichard Henderson fi 4830e219c499SRichard Henderson LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS" 4831e219c499SRichard Henderson ;; 4832e219c499SRichard Henderson 4833e219c499SRichard Henderson system) 48348ca80760SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" 48358ca80760SRichard Henderson LIBS="$($pkg_config --libs capstone) $LIBS" 4836e219c499SRichard Henderson ;; 4837e219c499SRichard Henderson 4838e219c499SRichard Henderson no) 4839e219c499SRichard Henderson ;; 4840e219c499SRichard Henderson *) 4841e219c499SRichard Henderson error_exit "Unknown state for capstone: $capstone" 4842e219c499SRichard Henderson ;; 4843e219c499SRichard Hendersonesac 48448ca80760SRichard Henderson 48458ca80760SRichard Henderson########################################## 48465f6b9e8fSBlue Swirl# check if we have fdatasync 48475f6b9e8fSBlue Swirl 48485f6b9e8fSBlue Swirlfdatasync=no 48495f6b9e8fSBlue Swirlcat > $TMPC << EOF 48505f6b9e8fSBlue Swirl#include <unistd.h> 4851d1722a27SAlexandre Raymondint main(void) { 4852d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 4853d1722a27SAlexandre Raymondreturn fdatasync(0); 4854d1722a27SAlexandre Raymond#else 4855e172fe11SStefan Weil#error Not supported 4856d1722a27SAlexandre Raymond#endif 4857d1722a27SAlexandre Raymond} 48585f6b9e8fSBlue SwirlEOF 48595f6b9e8fSBlue Swirlif compile_prog "" "" ; then 48605f6b9e8fSBlue Swirl fdatasync=yes 48615f6b9e8fSBlue Swirlfi 48625f6b9e8fSBlue Swirl 486394a420b1SStefan Hajnoczi########################################## 4864e78815a5SAndreas Färber# check if we have madvise 4865e78815a5SAndreas Färber 4866e78815a5SAndreas Färbermadvise=no 4867e78815a5SAndreas Färbercat > $TMPC << EOF 4868e78815a5SAndreas Färber#include <sys/types.h> 4869e78815a5SAndreas Färber#include <sys/mman.h> 4870832ce9c2SScott Wood#include <stddef.h> 4871e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 4872e78815a5SAndreas FärberEOF 4873e78815a5SAndreas Färberif compile_prog "" "" ; then 4874e78815a5SAndreas Färber madvise=yes 4875e78815a5SAndreas Färberfi 4876e78815a5SAndreas Färber 4877e78815a5SAndreas Färber########################################## 4878e78815a5SAndreas Färber# check if we have posix_madvise 4879e78815a5SAndreas Färber 4880e78815a5SAndreas Färberposix_madvise=no 4881e78815a5SAndreas Färbercat > $TMPC << EOF 4882e78815a5SAndreas Färber#include <sys/mman.h> 4883832ce9c2SScott Wood#include <stddef.h> 4884e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 4885e78815a5SAndreas FärberEOF 4886e78815a5SAndreas Färberif compile_prog "" "" ; then 4887e78815a5SAndreas Färber posix_madvise=yes 4888e78815a5SAndreas Färberfi 4889e78815a5SAndreas Färber 4890e78815a5SAndreas Färber########################################## 48919bc5a719SAndreas Gustafsson# check if we have posix_memalign() 48929bc5a719SAndreas Gustafsson 48939bc5a719SAndreas Gustafssonposix_memalign=no 48949bc5a719SAndreas Gustafssoncat > $TMPC << EOF 48959bc5a719SAndreas Gustafsson#include <stdlib.h> 48969bc5a719SAndreas Gustafssonint main(void) { 48979bc5a719SAndreas Gustafsson void *p; 48989bc5a719SAndreas Gustafsson return posix_memalign(&p, 8, 8); 48999bc5a719SAndreas Gustafsson} 49009bc5a719SAndreas GustafssonEOF 49019bc5a719SAndreas Gustafssonif compile_prog "" "" ; then 49029bc5a719SAndreas Gustafsson posix_memalign=yes 49039bc5a719SAndreas Gustafssonfi 49049bc5a719SAndreas Gustafsson 49059bc5a719SAndreas Gustafsson########################################## 49060a852417SPaul Durrant# check if we have posix_syslog 49070a852417SPaul Durrant 49080a852417SPaul Durrantposix_syslog=no 49090a852417SPaul Durrantcat > $TMPC << EOF 49100a852417SPaul Durrant#include <syslog.h> 49110a852417SPaul Durrantint main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 49120a852417SPaul DurrantEOF 49130a852417SPaul Durrantif compile_prog "" "" ; then 49140a852417SPaul Durrant posix_syslog=yes 49150a852417SPaul Durrantfi 49160a852417SPaul Durrant 49170a852417SPaul Durrant########################################## 4918401bc051SPeter Maydell# check if we have sem_timedwait 4919401bc051SPeter Maydell 4920401bc051SPeter Maydellsem_timedwait=no 4921401bc051SPeter Maydellcat > $TMPC << EOF 4922401bc051SPeter Maydell#include <semaphore.h> 4923401bc051SPeter Maydellint main(void) { return sem_timedwait(0, 0); } 4924401bc051SPeter MaydellEOF 4925401bc051SPeter Maydellif compile_prog "" "" ; then 4926401bc051SPeter Maydell sem_timedwait=yes 4927401bc051SPeter Maydellfi 4928401bc051SPeter Maydell 4929401bc051SPeter Maydell########################################## 49305c99fa37SKeno Fischer# check if we have strchrnul 49315c99fa37SKeno Fischer 49325c99fa37SKeno Fischerstrchrnul=no 49335c99fa37SKeno Fischercat > $TMPC << EOF 49345c99fa37SKeno Fischer#include <string.h> 49355c99fa37SKeno Fischerint main(void); 49365c99fa37SKeno Fischer// Use a haystack that the compiler shouldn't be able to constant fold 49375c99fa37SKeno Fischerchar *haystack = (char*)&main; 49385c99fa37SKeno Fischerint main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 49395c99fa37SKeno FischerEOF 49405c99fa37SKeno Fischerif compile_prog "" "" ; then 49415c99fa37SKeno Fischer strchrnul=yes 49425c99fa37SKeno Fischerfi 49435c99fa37SKeno Fischer 49445c99fa37SKeno Fischer########################################## 494594a420b1SStefan Hajnoczi# check if trace backend exists 494694a420b1SStefan Hajnoczi 49475b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 494894a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 49495b808275SLluís Vilanova error_exit "invalid trace backends" \ 49505b808275SLluís Vilanova "Please choose supported trace backends." 495194a420b1SStefan Hajnoczifi 495294a420b1SStefan Hajnoczi 49537e24e92aSStefan Hajnoczi########################################## 49547e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 49555b808275SLluís Vilanovaif have_backend "ust"; then 49567e24e92aSStefan Hajnoczi cat > $TMPC << EOF 4957bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 49587e24e92aSStefan Hajnocziint main(void) { return 0; } 49597e24e92aSStefan HajnocziEOF 4960c79ed23dSFrancis Deslauriers if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 4961bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 496289138857SStefan Weil lttng_ust_libs=$($pkg_config --libs lttng-ust) 49637e24e92aSStefan Hajnoczi else 4964c79ed23dSFrancis Deslauriers lttng_ust_libs="-llttng-ust -ldl" 4965bf15f63cSMohamad Gebai fi 4966bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 496789138857SStefan Weil urcu_bp_libs=$($pkg_config --libs liburcu-bp) 4968bf15f63cSMohamad Gebai else 4969bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 4970bf15f63cSMohamad Gebai fi 4971bf15f63cSMohamad Gebai 4972bf15f63cSMohamad Gebai LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 4973bf15f63cSMohamad Gebai libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 4974bf15f63cSMohamad Gebai else 4975bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 49767e24e92aSStefan Hajnoczi fi 49777e24e92aSStefan Hajnoczifi 4978b3d08c02SDaniel P. Berrange 4979b3d08c02SDaniel P. Berrange########################################## 4980b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 49815b808275SLluís Vilanovaif have_backend "dtrace"; then 4982b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 498376ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 4984b3d08c02SDaniel P. Berrange fi 4985c276b17dSDaniel P. Berrange trace_backend_stap="no" 4986c276b17dSDaniel P. Berrange if has 'stap' ; then 4987c276b17dSDaniel P. Berrange trace_backend_stap="yes" 4988c276b17dSDaniel P. Berrange fi 4989b3d08c02SDaniel P. Berrangefi 4990b3d08c02SDaniel P. Berrange 49917e24e92aSStefan Hajnoczi########################################## 4992519175a2SAlex Barcelo# check and set a backend for coroutine 4993d0e2fce5SAneesh Kumar K.V 49947c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 499533c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 499633c53c54SDaniel P. Berrange# specific one. 49977c2acc70SPeter Maydell 49987c2acc70SPeter Maydellucontext_works=no 4999d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 5000d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 5001d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 5002cdf84806SPeter Maydell#ifdef __stub_makecontext 5003cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 5004cdf84806SPeter Maydell#endif 500575cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 5006d0e2fce5SAneesh Kumar K.VEOF 5007d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 50087c2acc70SPeter Maydell ucontext_works=yes 5009d0e2fce5SAneesh Kumar K.V fi 5010519175a2SAlex Barcelofi 50117c2acc70SPeter Maydell 50127c2acc70SPeter Maydellif test "$coroutine" = ""; then 50137c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 50147c2acc70SPeter Maydell coroutine=win32 50157c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 50167c2acc70SPeter Maydell coroutine=ucontext 5017519175a2SAlex Barcelo else 50187c2acc70SPeter Maydell coroutine=sigaltstack 50197c2acc70SPeter Maydell fi 50207c2acc70SPeter Maydellelse 50217c2acc70SPeter Maydell case $coroutine in 50227c2acc70SPeter Maydell windows) 50237c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 50247c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 50257c2acc70SPeter Maydell fi 50267c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 50277c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 50287c2acc70SPeter Maydell coroutine=win32 50297c2acc70SPeter Maydell ;; 50307c2acc70SPeter Maydell ucontext) 50317c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 50327c2acc70SPeter Maydell feature_not_found "ucontext" 50337c2acc70SPeter Maydell fi 50347c2acc70SPeter Maydell ;; 503533c53c54SDaniel P. Berrange sigaltstack) 50367c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 50377c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 50387c2acc70SPeter Maydell fi 50397c2acc70SPeter Maydell ;; 50407c2acc70SPeter Maydell *) 504176ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 50427c2acc70SPeter Maydell ;; 50437c2acc70SPeter Maydell esac 5044d0e2fce5SAneesh Kumar K.Vfi 5045d0e2fce5SAneesh Kumar K.V 504670c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 504770c60c08SStefan Hajnoczi coroutine_pool=yes 504870c60c08SStefan Hajnoczifi 504970c60c08SStefan Hajnoczi 50507d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 50517d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 50527d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 50537d992e4dSPeter Lieven coroutine_pool=no 50547d992e4dSPeter Lieven fi 50557d992e4dSPeter Lievenfi 50567d992e4dSPeter Lieven 50577d992e4dSPeter Lieven 5058d0e2fce5SAneesh Kumar K.V########################################## 5059d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 5060d2042378SAneesh Kumar K.V 50614e1797f9SStefan Weilopen_by_handle_at=no 5062d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 5063d2042378SAneesh Kumar K.V#include <fcntl.h> 5064acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 5065acc55ba8SStefan Weil# error missing definition 5066acc55ba8SStefan Weil#else 506775cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 5068acc55ba8SStefan Weil#endif 5069d2042378SAneesh Kumar K.VEOF 5070d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 5071d2042378SAneesh Kumar K.V open_by_handle_at=yes 5072d2042378SAneesh Kumar K.Vfi 5073d2042378SAneesh Kumar K.V 5074e06a765eSHarsh Prateek Bora######################################## 5075e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 5076e06a765eSHarsh Prateek Bora 5077e06a765eSHarsh Prateek Boralinux_magic_h=no 5078e06a765eSHarsh Prateek Boracat > $TMPC << EOF 5079e06a765eSHarsh Prateek Bora#include <linux/magic.h> 5080e06a765eSHarsh Prateek Boraint main(void) { 508175cafad7SStefan Weil return 0; 5082e06a765eSHarsh Prateek Bora} 5083e06a765eSHarsh Prateek BoraEOF 5084e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 5085e06a765eSHarsh Prateek Bora linux_magic_h=yes 5086e06a765eSHarsh Prateek Borafi 5087e06a765eSHarsh Prateek Bora 50888ab1bf12SLuiz Capitulino######################################## 5089c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed 5090c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries). 5091c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is 5092c95e3080SKevin Wolf# only a warning. 5093c95e3080SKevin Wolf# 5094c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that 5095c95e3080SKevin Wolf# the build doesn't fail anyway. 5096c95e3080SKevin Wolf 509706d71fa1SPeter Maydellpragma_disable_unused_but_set=no 509806d71fa1SPeter Maydellcat > $TMPC << EOF 5099e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push 5100c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes" 5101e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop 5102c95e3080SKevin Wolf 510306d71fa1SPeter Maydellint main(void) { 510406d71fa1SPeter Maydell return 0; 510506d71fa1SPeter Maydell} 510606d71fa1SPeter MaydellEOF 510706d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 5108cc6e3ca9SGerd Hoffmann pragma_diagnostic_available=yes 5109c95e3080SKevin Wolfelse 5110c95e3080SKevin Wolf werror=no 511106d71fa1SPeter Maydellfi 511206d71fa1SPeter Maydell 511306d71fa1SPeter Maydell######################################## 5114541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 51153f4349dcSKevin Wolf 51163f4349dcSKevin Wolfvalgrind_h=no 51173f4349dcSKevin Wolfcat > $TMPC << EOF 51183f4349dcSKevin Wolf#include <valgrind/valgrind.h> 51193f4349dcSKevin Wolfint main(void) { 51203f4349dcSKevin Wolf return 0; 51213f4349dcSKevin Wolf} 51223f4349dcSKevin WolfEOF 51233f4349dcSKevin Wolfif compile_prog "" "" ; then 51243f4349dcSKevin Wolf valgrind_h=yes 51253f4349dcSKevin Wolffi 51263f4349dcSKevin Wolf 51273f4349dcSKevin Wolf######################################## 51288ab1bf12SLuiz Capitulino# check if environ is declared 51298ab1bf12SLuiz Capitulino 51308ab1bf12SLuiz Capitulinohas_environ=no 51318ab1bf12SLuiz Capitulinocat > $TMPC << EOF 51328ab1bf12SLuiz Capitulino#include <unistd.h> 51338ab1bf12SLuiz Capitulinoint main(void) { 5134c075a723SBlue Swirl environ = 0; 51358ab1bf12SLuiz Capitulino return 0; 51368ab1bf12SLuiz Capitulino} 51378ab1bf12SLuiz CapitulinoEOF 51388ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 51398ab1bf12SLuiz Capitulino has_environ=yes 51408ab1bf12SLuiz Capitulinofi 51418ab1bf12SLuiz Capitulino 514276a347e1SRichard Henderson######################################## 514376a347e1SRichard Henderson# check if cpuid.h is usable. 514476a347e1SRichard Henderson 514576a347e1SRichard Hendersoncat > $TMPC << EOF 514676a347e1SRichard Henderson#include <cpuid.h> 514776a347e1SRichard Hendersonint main(void) { 5148774d566cSPeter Maydell unsigned a, b, c, d; 5149774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 5150774d566cSPeter Maydell 5151774d566cSPeter Maydell if (max >= 1) { 5152774d566cSPeter Maydell __cpuid(1, a, b, c, d); 5153774d566cSPeter Maydell } 5154774d566cSPeter Maydell 5155774d566cSPeter Maydell if (max >= 7) { 5156774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 5157774d566cSPeter Maydell } 5158774d566cSPeter Maydell 515976a347e1SRichard Henderson return 0; 516076a347e1SRichard Henderson} 516176a347e1SRichard HendersonEOF 516276a347e1SRichard Hendersonif compile_prog "" "" ; then 516376a347e1SRichard Henderson cpuid_h=yes 516476a347e1SRichard Hendersonfi 516576a347e1SRichard Henderson 51665dd89908SRichard Henderson########################################## 51675dd89908SRichard Henderson# avx2 optimization requirement check 51685dd89908SRichard Henderson# 51695dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 51705dd89908SRichard Henderson# since we won't be able to select the new routines. 51715dd89908SRichard Henderson 5172e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 51735dd89908SRichard Henderson cat > $TMPC << EOF 51745dd89908SRichard Henderson#pragma GCC push_options 51755dd89908SRichard Henderson#pragma GCC target("avx2") 51765dd89908SRichard Henderson#include <cpuid.h> 51775dd89908SRichard Henderson#include <immintrin.h> 51785dd89908SRichard Hendersonstatic int bar(void *a) { 51795dd89908SRichard Henderson __m256i x = *(__m256i *)a; 51805dd89908SRichard Henderson return _mm256_testz_si256(x, x); 51815dd89908SRichard Henderson} 51825dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 51835dd89908SRichard HendersonEOF 51845dd89908SRichard Henderson if compile_object "" ; then 51855dd89908SRichard Henderson avx2_opt="yes" 518686583a07SLiam Merwick else 518786583a07SLiam Merwick avx2_opt="no" 51885dd89908SRichard Henderson fi 51895dd89908SRichard Hendersonfi 51905dd89908SRichard Henderson 5191f540166bSRichard Henderson######################################## 5192f540166bSRichard Henderson# check if __[u]int128_t is usable. 5193f540166bSRichard Henderson 5194f540166bSRichard Hendersonint128=no 5195f540166bSRichard Hendersoncat > $TMPC << EOF 5196f540166bSRichard Henderson__int128_t a; 5197f540166bSRichard Henderson__uint128_t b; 5198f540166bSRichard Hendersonint main (void) { 5199f540166bSRichard Henderson a = a + b; 5200f540166bSRichard Henderson b = a * b; 5201464e3671SPeter Maydell a = a * a; 5202f540166bSRichard Henderson return 0; 5203f540166bSRichard Henderson} 5204f540166bSRichard HendersonEOF 5205f540166bSRichard Hendersonif compile_prog "" "" ; then 5206f540166bSRichard Henderson int128=yes 5207f540166bSRichard Hendersonfi 520876a347e1SRichard Henderson 52097ebee43eSRichard Henderson######################################### 52107ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 52117ebee43eSRichard Henderson 52127ebee43eSRichard Hendersonatomic128=no 52137ebee43eSRichard Hendersonif test "$int128" = "yes"; then 52147ebee43eSRichard Henderson cat > $TMPC << EOF 52157ebee43eSRichard Hendersonint main(void) 52167ebee43eSRichard Henderson{ 52177ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 52187ebee43eSRichard Henderson y = __atomic_load_16(&x, 0); 52197ebee43eSRichard Henderson __atomic_store_16(&x, y, 0); 52207ebee43eSRichard Henderson __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 52217ebee43eSRichard Henderson return 0; 52227ebee43eSRichard Henderson} 52237ebee43eSRichard HendersonEOF 52247ebee43eSRichard Henderson if compile_prog "" "" ; then 52257ebee43eSRichard Henderson atomic128=yes 52267ebee43eSRichard Henderson fi 52277ebee43eSRichard Hendersonfi 52287ebee43eSRichard Henderson 5229e6cd4bb5SRichard Hendersoncmpxchg128=no 5230e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 5231e6cd4bb5SRichard Henderson cat > $TMPC << EOF 5232e6cd4bb5SRichard Hendersonint main(void) 5233e6cd4bb5SRichard Henderson{ 5234e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 5235e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 5236e6cd4bb5SRichard Henderson return 0; 5237e6cd4bb5SRichard Henderson} 5238e6cd4bb5SRichard HendersonEOF 5239e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 5240e6cd4bb5SRichard Henderson cmpxchg128=yes 5241e6cd4bb5SRichard Henderson fi 5242e6cd4bb5SRichard Hendersonfi 5243e6cd4bb5SRichard Henderson 5244df79b996SRichard Henderson######################################### 5245df79b996SRichard Henderson# See if 64-bit atomic operations are supported. 5246df79b996SRichard Henderson# Note that without __atomic builtins, we can only 5247df79b996SRichard Henderson# assume atomic loads/stores max at pointer size. 5248df79b996SRichard Henderson 5249df79b996SRichard Hendersoncat > $TMPC << EOF 5250df79b996SRichard Henderson#include <stdint.h> 5251df79b996SRichard Hendersonint main(void) 5252df79b996SRichard Henderson{ 5253df79b996SRichard Henderson uint64_t x = 0, y = 0; 5254df79b996SRichard Henderson#ifdef __ATOMIC_RELAXED 5255df79b996SRichard Henderson y = __atomic_load_8(&x, 0); 5256df79b996SRichard Henderson __atomic_store_8(&x, y, 0); 5257df79b996SRichard Henderson __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); 5258df79b996SRichard Henderson __atomic_exchange_8(&x, y, 0); 5259df79b996SRichard Henderson __atomic_fetch_add_8(&x, y, 0); 5260df79b996SRichard Henderson#else 5261df79b996SRichard Henderson typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5262df79b996SRichard Henderson __sync_lock_test_and_set(&x, y); 5263df79b996SRichard Henderson __sync_val_compare_and_swap(&x, y, 0); 5264df79b996SRichard Henderson __sync_fetch_and_add(&x, y); 5265df79b996SRichard Henderson#endif 5266df79b996SRichard Henderson return 0; 5267df79b996SRichard Henderson} 5268df79b996SRichard HendersonEOF 5269df79b996SRichard Hendersonif compile_prog "" "" ; then 5270df79b996SRichard Henderson atomic64=yes 5271df79b996SRichard Hendersonfi 5272df79b996SRichard Henderson 52731e6e9acaSRichard Henderson######################################## 5274db432672SRichard Henderson# See if 16-byte vector operations are supported. 5275db432672SRichard Henderson# Even without a vector unit the compiler may expand these. 5276db432672SRichard Henderson# There is a bug in old GCC for PPC that crashes here. 5277db432672SRichard Henderson# Unfortunately it's the system compiler for Centos 7. 5278db432672SRichard Henderson 5279db432672SRichard Hendersoncat > $TMPC << EOF 5280db432672SRichard Hendersontypedef unsigned char U1 __attribute__((vector_size(16))); 5281db432672SRichard Hendersontypedef unsigned short U2 __attribute__((vector_size(16))); 5282db432672SRichard Hendersontypedef unsigned int U4 __attribute__((vector_size(16))); 5283db432672SRichard Hendersontypedef unsigned long long U8 __attribute__((vector_size(16))); 5284db432672SRichard Hendersontypedef signed char S1 __attribute__((vector_size(16))); 5285db432672SRichard Hendersontypedef signed short S2 __attribute__((vector_size(16))); 5286db432672SRichard Hendersontypedef signed int S4 __attribute__((vector_size(16))); 5287db432672SRichard Hendersontypedef signed long long S8 __attribute__((vector_size(16))); 5288db432672SRichard Hendersonstatic U1 a1, b1; 5289db432672SRichard Hendersonstatic U2 a2, b2; 5290db432672SRichard Hendersonstatic U4 a4, b4; 5291db432672SRichard Hendersonstatic U8 a8, b8; 5292db432672SRichard Hendersonstatic S1 c1; 5293db432672SRichard Hendersonstatic S2 c2; 5294db432672SRichard Hendersonstatic S4 c4; 5295db432672SRichard Hendersonstatic S8 c8; 5296db432672SRichard Hendersonstatic int i; 529774912f6dSLaurent Viviervoid helper(void *d, void *a, int shift, int i); 529874912f6dSLaurent Viviervoid helper(void *d, void *a, int shift, int i) 529974912f6dSLaurent Vivier{ 530074912f6dSLaurent Vivier *(U1 *)(d + i) = *(U1 *)(a + i) << shift; 530174912f6dSLaurent Vivier *(U2 *)(d + i) = *(U2 *)(a + i) << shift; 530274912f6dSLaurent Vivier *(U4 *)(d + i) = *(U4 *)(a + i) << shift; 530374912f6dSLaurent Vivier *(U8 *)(d + i) = *(U8 *)(a + i) << shift; 530474912f6dSLaurent Vivier} 5305db432672SRichard Hendersonint main(void) 5306db432672SRichard Henderson{ 5307db432672SRichard Henderson a1 += b1; a2 += b2; a4 += b4; a8 += b8; 5308db432672SRichard Henderson a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8; 5309db432672SRichard Henderson a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8; 5310db432672SRichard Henderson a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8; 5311db432672SRichard Henderson a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8; 5312db432672SRichard Henderson a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8; 5313db432672SRichard Henderson a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i; 5314db432672SRichard Henderson a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i; 5315db432672SRichard Henderson c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i; 5316db432672SRichard Henderson return 0; 5317db432672SRichard Henderson} 5318db432672SRichard HendersonEOF 5319db432672SRichard Henderson 5320db432672SRichard Hendersonvector16=no 5321db432672SRichard Hendersonif compile_prog "" "" ; then 5322db432672SRichard Henderson vector16=yes 5323db432672SRichard Hendersonfi 5324db432672SRichard Henderson 5325db432672SRichard Henderson######################################## 53261e6e9acaSRichard Henderson# check if getauxval is available. 53271e6e9acaSRichard Henderson 53281e6e9acaSRichard Hendersongetauxval=no 53291e6e9acaSRichard Hendersoncat > $TMPC << EOF 53301e6e9acaSRichard Henderson#include <sys/auxv.h> 53311e6e9acaSRichard Hendersonint main(void) { 53321e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 53331e6e9acaSRichard Henderson} 53341e6e9acaSRichard HendersonEOF 53351e6e9acaSRichard Hendersonif compile_prog "" "" ; then 53361e6e9acaSRichard Henderson getauxval=yes 53371e6e9acaSRichard Hendersonfi 53381e6e9acaSRichard Henderson 5339fd0e6053SJohn Snow######################################## 5340fd0e6053SJohn Snow# check if ccache is interfering with 5341fd0e6053SJohn Snow# semantic analysis of macros 5342fd0e6053SJohn Snow 53435e4dfd3dSJohn Snowunset CCACHE_CPP2 5344fd0e6053SJohn Snowccache_cpp2=no 5345fd0e6053SJohn Snowcat > $TMPC << EOF 5346fd0e6053SJohn Snowstatic const int Z = 1; 5347fd0e6053SJohn Snow#define fn() ({ Z; }) 5348fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 5349fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 5350fd0e6053SJohn Snow#define ID(X) (X) 5351fd0e6053SJohn Snowint main(int argc, char *argv[]) 5352fd0e6053SJohn Snow{ 5353fd0e6053SJohn Snow int x = 0, y = 0; 5354fd0e6053SJohn Snow x = ID(x); 5355fd0e6053SJohn Snow x = fn(); 5356fd0e6053SJohn Snow fn(); 5357fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 5358fd0e6053SJohn Snow if (TAUT(Z)) return 0; 5359fd0e6053SJohn Snow return 0; 5360fd0e6053SJohn Snow} 5361fd0e6053SJohn SnowEOF 5362fd0e6053SJohn Snow 5363fd0e6053SJohn Snowif ! compile_object "-Werror"; then 5364fd0e6053SJohn Snow ccache_cpp2=yes 5365fd0e6053SJohn Snowfi 5366fd0e6053SJohn Snow 5367b553a042SJohn Snow################################################# 5368b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 5369b553a042SJohn Snow 5370b553a042SJohn Snowif test "$fortify_source" != "no"; then 5371b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5372b553a042SJohn Snow fortify_source="no"; 5373e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 5374cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5375b553a042SJohn Snow fortify_source="no"; 5376b553a042SJohn Snow else 5377b553a042SJohn Snow fortify_source="yes" 5378b553a042SJohn Snow fi 5379b553a042SJohn Snowfi 5380b553a042SJohn Snow 53811efad060SFam Zheng############################################### 53821efad060SFam Zheng# Check if copy_file_range is provided by glibc 53831efad060SFam Zhenghave_copy_file_range=no 53841efad060SFam Zhengcat > $TMPC << EOF 53851efad060SFam Zheng#include <unistd.h> 53861efad060SFam Zhengint main(void) { 53871efad060SFam Zheng copy_file_range(0, NULL, 0, NULL, 0, 0); 53881efad060SFam Zheng return 0; 53891efad060SFam Zheng} 53901efad060SFam ZhengEOF 53911efad060SFam Zhengif compile_prog "" "" ; then 53921efad060SFam Zheng have_copy_file_range=yes 53931efad060SFam Zhengfi 53941efad060SFam Zheng 5395d2042378SAneesh Kumar K.V########################################## 5396277abf15SJan Vesely# check if struct fsxattr is available via linux/fs.h 5397277abf15SJan Vesely 5398277abf15SJan Veselyhave_fsxattr=no 5399277abf15SJan Veselycat > $TMPC << EOF 5400277abf15SJan Vesely#include <linux/fs.h> 5401277abf15SJan Veselystruct fsxattr foo; 5402277abf15SJan Veselyint main(void) { 5403277abf15SJan Vesely return 0; 5404277abf15SJan Vesely} 5405277abf15SJan VeselyEOF 5406277abf15SJan Veselyif compile_prog "" "" ; then 5407277abf15SJan Vesely have_fsxattr=yes 5408277abf15SJan Veselyfi 5409277abf15SJan Vesely 5410b66e10e4SPeter Maydell########################################## 5411a40161cbSPaolo Bonzini# check for usable membarrier system call 5412a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 5413a40161cbSPaolo Bonzini have_membarrier=no 5414a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 5415a40161cbSPaolo Bonzini have_membarrier=yes 5416a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 5417a40161cbSPaolo Bonzini cat > $TMPC << EOF 5418a40161cbSPaolo Bonzini #include <linux/membarrier.h> 5419a40161cbSPaolo Bonzini #include <sys/syscall.h> 5420a40161cbSPaolo Bonzini #include <unistd.h> 5421a40161cbSPaolo Bonzini #include <stdlib.h> 5422a40161cbSPaolo Bonzini int main(void) { 5423a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5424a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5425a40161cbSPaolo Bonzini exit(0); 5426a40161cbSPaolo Bonzini } 5427a40161cbSPaolo BonziniEOF 5428a40161cbSPaolo Bonzini if compile_prog "" "" ; then 5429a40161cbSPaolo Bonzini have_membarrier=yes 5430a40161cbSPaolo Bonzini fi 5431a40161cbSPaolo Bonzini fi 5432a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 5433a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 5434a40161cbSPaolo Bonzini fi 5435a40161cbSPaolo Bonzinielse 5436a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 5437a40161cbSPaolo Bonzini # work on Wine. 5438a40161cbSPaolo Bonzini membarrier=no 5439a40161cbSPaolo Bonzinifi 5440a40161cbSPaolo Bonzini 5441a40161cbSPaolo Bonzini########################################## 5442b66e10e4SPeter Maydell# check if rtnetlink.h exists and is useful 5443575b22b1SLaurent Vivierhave_rtnetlink=no 5444575b22b1SLaurent Viviercat > $TMPC << EOF 5445575b22b1SLaurent Vivier#include <linux/rtnetlink.h> 5446575b22b1SLaurent Vivierint main(void) { 5447575b22b1SLaurent Vivier return IFLA_PROTO_DOWN; 5448575b22b1SLaurent Vivier} 5449575b22b1SLaurent VivierEOF 5450575b22b1SLaurent Vivierif compile_prog "" "" ; then 5451575b22b1SLaurent Vivier have_rtnetlink=yes 5452575b22b1SLaurent Vivierfi 5453575b22b1SLaurent Vivier 54546a02c806SStefan Hajnoczi########################################## 54556a02c806SStefan Hajnoczi# check for usable AF_VSOCK environment 54566a02c806SStefan Hajnoczihave_af_vsock=no 54576a02c806SStefan Hajnoczicat > $TMPC << EOF 54586a02c806SStefan Hajnoczi#include <errno.h> 54596a02c806SStefan Hajnoczi#include <sys/types.h> 54606a02c806SStefan Hajnoczi#include <sys/socket.h> 54616a02c806SStefan Hajnoczi#if !defined(AF_VSOCK) 54626a02c806SStefan Hajnoczi# error missing AF_VSOCK flag 54636a02c806SStefan Hajnoczi#endif 54646a02c806SStefan Hajnoczi#include <linux/vm_sockets.h> 54656a02c806SStefan Hajnocziint main(void) { 54666a02c806SStefan Hajnoczi int sock, ret; 54676a02c806SStefan Hajnoczi struct sockaddr_vm svm; 54686a02c806SStefan Hajnoczi socklen_t len = sizeof(svm); 54696a02c806SStefan Hajnoczi sock = socket(AF_VSOCK, SOCK_STREAM, 0); 54706a02c806SStefan Hajnoczi ret = getpeername(sock, (struct sockaddr *)&svm, &len); 54716a02c806SStefan Hajnoczi if ((ret == -1) && (errno == ENOTCONN)) { 54726a02c806SStefan Hajnoczi return 0; 54736a02c806SStefan Hajnoczi } 54746a02c806SStefan Hajnoczi return -1; 54756a02c806SStefan Hajnoczi} 54766a02c806SStefan HajnocziEOF 54776a02c806SStefan Hajnocziif compile_prog "" "" ; then 54786a02c806SStefan Hajnoczi have_af_vsock=yes 54796a02c806SStefan Hajnoczifi 54806a02c806SStefan Hajnoczi 5481f0d92b56SLongpeng(Mike)########################################## 5482f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 5483f0d92b56SLongpeng(Mike)hava_afalg=no 5484f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 5485f0d92b56SLongpeng(Mike)#include <errno.h> 5486f0d92b56SLongpeng(Mike)#include <sys/types.h> 5487f0d92b56SLongpeng(Mike)#include <sys/socket.h> 5488f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 5489f0d92b56SLongpeng(Mike)int main(void) { 5490f0d92b56SLongpeng(Mike) int sock; 5491f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 5492f0d92b56SLongpeng(Mike) return sock; 5493f0d92b56SLongpeng(Mike)} 5494f0d92b56SLongpeng(Mike)EOF 5495f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 5496f0d92b56SLongpeng(Mike) have_afalg=yes 5497f0d92b56SLongpeng(Mike)fi 5498f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 5499f0d92b56SLongpeng(Mike)then 5500f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 5501f0d92b56SLongpeng(Mike) then 5502f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 5503f0d92b56SLongpeng(Mike) fi 5504f0d92b56SLongpeng(Mike)fi 5505f0d92b56SLongpeng(Mike) 5506f0d92b56SLongpeng(Mike) 55076969ec6cSJames Clarke################################################# 5508c97d6d2cSSergio Andres Gomez Del Real# Check to see if we have the Hypervisor framework 5509d2d08522SPeter Maydellif [ "$darwin" = "yes" ] ; then 5510c97d6d2cSSergio Andres Gomez Del Real cat > $TMPC << EOF 5511c97d6d2cSSergio Andres Gomez Del Real#include <Hypervisor/hv.h> 5512c97d6d2cSSergio Andres Gomez Del Realint main() { return 0;} 5513c97d6d2cSSergio Andres Gomez Del RealEOF 5514c97d6d2cSSergio Andres Gomez Del Real if ! compile_object ""; then 5515c97d6d2cSSergio Andres Gomez Del Real hvf='no' 5516c97d6d2cSSergio Andres Gomez Del Real else 5517c97d6d2cSSergio Andres Gomez Del Real hvf='yes' 5518c97d6d2cSSergio Andres Gomez Del Real LDFLAGS="-framework Hypervisor $LDFLAGS" 5519c97d6d2cSSergio Andres Gomez Del Real fi 5520c97d6d2cSSergio Andres Gomez Del Realfi 5521c97d6d2cSSergio Andres Gomez Del Real 5522c97d6d2cSSergio Andres Gomez Del Real################################################# 55236969ec6cSJames Clarke# Sparc implicitly links with --relax, which is 55246969ec6cSJames Clarke# incompatible with -r, so --no-relax should be 55256969ec6cSJames Clarke# given. It does no harm to give it on other 55266969ec6cSJames Clarke# platforms too. 55276969ec6cSJames Clarke 55286969ec6cSJames Clarke# Note: the prototype is needed since QEMU_CFLAGS 55296969ec6cSJames Clarke# contains -Wmissing-prototypes 55306969ec6cSJames Clarkecat > $TMPC << EOF 55316969ec6cSJames Clarkeextern int foo(void); 55326969ec6cSJames Clarkeint foo(void) { return 0; } 55336969ec6cSJames ClarkeEOF 55346969ec6cSJames Clarkeif ! compile_object ""; then 55356969ec6cSJames Clarke error_exit "Failed to compile object file for LD_REL_FLAGS test" 55366969ec6cSJames Clarkefi 55377ecf44a5SPaolo Bonzinifor i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do 55387ecf44a5SPaolo Bonzini if do_cc -nostdlib $i -o $TMPMO $TMPO; then 55397ecf44a5SPaolo Bonzini LD_REL_FLAGS=$i 55407ecf44a5SPaolo Bonzini break 55417ecf44a5SPaolo Bonzini fi 55427ecf44a5SPaolo Bonzinidone 55437ecf44a5SPaolo Bonziniif test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then 55447ecf44a5SPaolo Bonzini feature_not_found "modules" "Cannot find how to build relocatable objects" 55456969ec6cSJames Clarkefi 55466969ec6cSJames Clarke 5547277abf15SJan Vesely########################################## 55484d04351fSChristopher Covington# check for sysmacros.h 55494d04351fSChristopher Covington 55504d04351fSChristopher Covingtonhave_sysmacros=no 55514d04351fSChristopher Covingtoncat > $TMPC << EOF 55524d04351fSChristopher Covington#include <sys/sysmacros.h> 55534d04351fSChristopher Covingtonint main(void) { 55544d04351fSChristopher Covington return makedev(0, 0); 55554d04351fSChristopher Covington} 55564d04351fSChristopher CovingtonEOF 55574d04351fSChristopher Covingtonif compile_prog "" "" ; then 55584d04351fSChristopher Covington have_sysmacros=yes 55594d04351fSChristopher Covingtonfi 55604d04351fSChristopher Covington 55614d04351fSChristopher Covington########################################## 5562da92c3ffSAshish Mittal# Veritas HyperScale block driver VxHS 5563da92c3ffSAshish Mittal# Check if libvxhs is installed 5564da92c3ffSAshish Mittal 5565da92c3ffSAshish Mittalif test "$vxhs" != "no" ; then 5566da92c3ffSAshish Mittal cat > $TMPC <<EOF 5567da92c3ffSAshish Mittal#include <stdint.h> 5568da92c3ffSAshish Mittal#include <qnio/qnio_api.h> 5569da92c3ffSAshish Mittal 5570da92c3ffSAshish Mittalvoid *vxhs_callback; 5571da92c3ffSAshish Mittal 5572da92c3ffSAshish Mittalint main(void) { 5573da92c3ffSAshish Mittal iio_init(QNIO_VERSION, vxhs_callback); 5574da92c3ffSAshish Mittal return 0; 5575da92c3ffSAshish Mittal} 5576da92c3ffSAshish MittalEOF 5577da92c3ffSAshish Mittal vxhs_libs="-lvxhs -lssl" 5578da92c3ffSAshish Mittal if compile_prog "" "$vxhs_libs" ; then 5579da92c3ffSAshish Mittal vxhs=yes 5580da92c3ffSAshish Mittal else 5581da92c3ffSAshish Mittal if test "$vxhs" = "yes" ; then 5582da92c3ffSAshish Mittal feature_not_found "vxhs block device" "Install libvxhs See github" 5583da92c3ffSAshish Mittal fi 5584da92c3ffSAshish Mittal vxhs=no 5585da92c3ffSAshish Mittal fi 5586da92c3ffSAshish Mittalfi 5587da92c3ffSAshish Mittal 5588da92c3ffSAshish Mittal########################################## 558949e00a18SAndreas Grapentin# check for _Static_assert() 559049e00a18SAndreas Grapentin 559149e00a18SAndreas Grapentinhave_static_assert=no 559249e00a18SAndreas Grapentincat > $TMPC << EOF 559349e00a18SAndreas Grapentin_Static_assert(1, "success"); 559449e00a18SAndreas Grapentinint main(void) { 559549e00a18SAndreas Grapentin return 0; 559649e00a18SAndreas Grapentin} 559749e00a18SAndreas GrapentinEOF 559849e00a18SAndreas Grapentinif compile_prog "" "" ; then 559949e00a18SAndreas Grapentin have_static_assert=yes 560049e00a18SAndreas Grapentinfi 560149e00a18SAndreas Grapentin 560249e00a18SAndreas Grapentin########################################## 5603e674605fSTomáš Golembiovský# check for utmpx.h, it is missing e.g. on OpenBSD 5604e674605fSTomáš Golembiovský 5605e674605fSTomáš Golembiovskýhave_utmpx=no 5606e674605fSTomáš Golembiovskýcat > $TMPC << EOF 5607e674605fSTomáš Golembiovský#include <utmpx.h> 5608e674605fSTomáš Golembiovskýstruct utmpx user_info; 5609e674605fSTomáš Golembiovskýint main(void) { 5610e674605fSTomáš Golembiovský return 0; 5611e674605fSTomáš Golembiovský} 5612e674605fSTomáš GolembiovskýEOF 5613e674605fSTomáš Golembiovskýif compile_prog "" "" ; then 5614e674605fSTomáš Golembiovský have_utmpx=yes 5615e674605fSTomáš Golembiovskýfi 5616e674605fSTomáš Golembiovský 5617e674605fSTomáš Golembiovský########################################## 5618247724cbSMarc-André Lureau# checks for sanitizers 5619247724cbSMarc-André Lureau 5620247724cbSMarc-André Lureauhave_asan=no 5621247724cbSMarc-André Lureauhave_ubsan=no 5622d83414e1SMarc-André Lureauhave_asan_iface_h=no 5623d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 5624247724cbSMarc-André Lureau 5625247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 5626b9f44da2SMarc-André Lureau write_c_skeleton 5627247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 5628247724cbSMarc-André Lureau have_asan=yes 5629247724cbSMarc-André Lureau fi 5630b9f44da2SMarc-André Lureau 5631b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 5632b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 5633b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 5634b9f44da2SMarc-André Lureau cat > $TMPC << EOF 5635b9f44da2SMarc-André Lureau#include <stdlib.h> 5636b9f44da2SMarc-André Lureauint main(void) { 5637b9f44da2SMarc-André Lureau void *tmp = malloc(10); 5638b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 5639b9f44da2SMarc-André Lureau} 5640b9f44da2SMarc-André LureauEOF 5641247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 5642247724cbSMarc-André Lureau have_ubsan=yes 5643247724cbSMarc-André Lureau fi 5644d83414e1SMarc-André Lureau 5645d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 5646d83414e1SMarc-André Lureau have_asan_iface_h=yes 5647d83414e1SMarc-André Lureau fi 5648d83414e1SMarc-André Lureau 5649d83414e1SMarc-André Lureau cat > $TMPC << EOF 5650d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 5651d83414e1SMarc-André Lureauint main(void) { 5652d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 5653d83414e1SMarc-André Lureau return 0; 5654d83414e1SMarc-André Lureau} 5655d83414e1SMarc-André LureauEOF 5656d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 5657d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 5658d83414e1SMarc-André Lureau fi 5659247724cbSMarc-André Lureaufi 5660247724cbSMarc-André Lureau 5661247724cbSMarc-André Lureau########################################## 566251a12b51SAlex Bennée# Docker and cross-compiler support 566351a12b51SAlex Bennée# 566451a12b51SAlex Bennée# This is specifically for building test 566551a12b51SAlex Bennée# cases for foreign architectures, not 566651a12b51SAlex Bennée# cross-compiling QEMU itself. 566751a12b51SAlex Bennée 566851a12b51SAlex Bennéeif has "docker"; then 566951a12b51SAlex Bennée docker=$($python $source_path/tests/docker/docker.py probe) 567051a12b51SAlex Bennéefi 567151a12b51SAlex Bennée 567251a12b51SAlex Bennée########################################## 567317824406SJunyan He# check for libpmem 567417824406SJunyan He 567517824406SJunyan Heif test "$libpmem" != "no"; then 567617824406SJunyan He if $pkg_config --exists "libpmem"; then 567717824406SJunyan He libpmem="yes" 567817824406SJunyan He libpmem_libs=$($pkg_config --libs libpmem) 567917824406SJunyan He libpmem_cflags=$($pkg_config --cflags libpmem) 568017824406SJunyan He libs_softmmu="$libs_softmmu $libpmem_libs" 568117824406SJunyan He QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" 568217824406SJunyan He else 568317824406SJunyan He if test "$libpmem" = "yes" ; then 568417824406SJunyan He feature_not_found "libpmem" "Install nvml or pmdk" 568517824406SJunyan He fi 568617824406SJunyan He libpmem="no" 568717824406SJunyan He fi 568817824406SJunyan Hefi 568917824406SJunyan He 569017824406SJunyan He########################################## 5691e86ecd4bSJuan Quintela# End of CC checks 5692e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 5693e86ecd4bSJuan Quintela 5694d83414e1SMarc-André Lureauwrite_c_skeleton 5695d83414e1SMarc-André Lureau 56961d728c39SBlue Swirlif test "$gcov" = "yes" ; then 56971d728c39SBlue Swirl CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" 56981d728c39SBlue Swirl LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" 5699b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 5700e600cdf3SMichal Privoznik CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" 570148e56d50SPaolo Bonzinielif test "$debug" = "no"; then 5702ce278618SPeter Maydell CFLAGS="-O2 $CFLAGS" 5703e86ecd4bSJuan Quintelafi 5704a316e378SJuan Quintela 5705247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 5706247724cbSMarc-André Lureau CFLAGS="-fsanitize=address $CFLAGS" 5707d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 5708d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 5709d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5710d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 5711d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 5712d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5713d83414e1SMarc-André Lureau fi 5714247724cbSMarc-André Lureaufi 5715247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 5716247724cbSMarc-André Lureau CFLAGS="-fsanitize=undefined $CFLAGS" 5717247724cbSMarc-André Lureaufi 5718247724cbSMarc-André Lureau 57196542aa9cSPeter Lieven########################################## 57206542aa9cSPeter Lieven# Do we have libnfs 57216542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 5722b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 57236542aa9cSPeter Lieven libnfs="yes" 57246542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 57256542aa9cSPeter Lieven else 57266542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 57278efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 57286542aa9cSPeter Lieven fi 57296542aa9cSPeter Lieven libnfs="no" 57306542aa9cSPeter Lieven fi 57316542aa9cSPeter Lievenfi 57321d728c39SBlue Swirl 57333efac6ebSTomáš Golembiovský########################################## 57343efac6ebSTomáš Golembiovský# Do we have libudev 57353efac6ebSTomáš Golembiovskýif test "$libudev" != "no" ; then 57363efac6ebSTomáš Golembiovský if $pkg_config libudev && test "$static" != "yes"; then 57373efac6ebSTomáš Golembiovský libudev="yes" 57383efac6ebSTomáš Golembiovský libudev_libs=$($pkg_config --libs libudev) 57393efac6ebSTomáš Golembiovský else 57403efac6ebSTomáš Golembiovský libudev="no" 57413efac6ebSTomáš Golembiovský fi 57423efac6ebSTomáš Golembiovskýfi 57433efac6ebSTomáš Golembiovský 57446ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 57456ca026cbSPeter Maydellif test "$werror" = "yes"; then 57466ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 57476ca026cbSPeter Maydellfi 57486ca026cbSPeter Maydell 5749e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 5750e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 57511156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 5752e86ecd4bSJuan Quintela fi 5753e86ecd4bSJuan Quintelafi 5754e86ecd4bSJuan Quintela 575594dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 575694dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 575794dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 575894dd53c5SGerd Hoffmannelse 575994dd53c5SGerd Hoffmann POD2MAN="pod2man" 576094dd53c5SGerd Hoffmannfi 576194dd53c5SGerd Hoffmann 5762952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 5763952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 5764952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 5765e9a3591fSChristian Borntraeger if ld_has $flag ; then 5766952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 5767952afb71SBlue Swirl fi 5768952afb71SBlue Swirl done 5769952afb71SBlue Swirlfi 5770952afb71SBlue Swirl 577110ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 5772e26110cfSFam Zhengqemu_moddir=$libdir$confsuffix 5773528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 5774834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 5775a8260d38SDaniel P. Berrangéqemu_icondir="$datadir/icons" 577667ea9546SDaniel P. Berrangéqemu_desktopdir="$datadir/applications" 57775a67135aSbellard 5778e0580342SKamil Rytarowski# We can only support ivshmem if we have eventfd 5779e0580342SKamil Rytarowskiif [ "$eventfd" = "yes" ]; then 5780e0580342SKamil Rytarowski ivshmem=yes 5781e0580342SKamil Rytarowskifi 5782e0580342SKamil Rytarowski 57834b1c11fdSDaniel P. Berrangetools="" 57844b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 578572d277a7SGerd Hoffmann tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools" 57864b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 57874b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 5788b1449edbSKamil Rytarowski fi 5789b1449edbSKamil Rytarowski if [ "$ivshmem" = "yes" ]; then 5790a75eb03bSDavid Marchand tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" 57914b1c11fdSDaniel P. Berrange fi 57921b9d35f3SViktor Prutyanov if [ "$curl" = "yes" ]; then 57931b9d35f3SViktor Prutyanov tools="elf2dmp\$(EXESUF) $tools" 57943fa2d384SViktor Prutyanov fi 57954b1c11fdSDaniel P. Berrangefi 57964b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 5797b855f8d1SPaolo Bonzini if test "$linux" = yes; then 5798b855f8d1SPaolo Bonzini if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then 5799983eef5aSMeador Inge virtfs=yes 580017bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 5801983eef5aSMeador Inge else 5802983eef5aSMeador Inge if test "$virtfs" = yes; then 5803b855f8d1SPaolo Bonzini error_exit "VirtFS requires libcap devel and libattr devel" 5804983eef5aSMeador Inge fi 580517500370SAndreas Färber virtfs=no 5806983eef5aSMeador Inge fi 5807fe8fc5aeSPaolo Bonzini if test "$mpath" != no && test "$mpathpersist" = yes ; then 5808fe8fc5aeSPaolo Bonzini mpath=yes 5809fe8fc5aeSPaolo Bonzini else 5810fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 5811fe8fc5aeSPaolo Bonzini error_exit "Multipath requires libmpathpersist devel" 5812fe8fc5aeSPaolo Bonzini fi 5813fe8fc5aeSPaolo Bonzini mpath=no 5814fe8fc5aeSPaolo Bonzini fi 5815b855f8d1SPaolo Bonzini tools="$tools scsi/qemu-pr-helper\$(EXESUF)" 5816b855f8d1SPaolo Bonzini else 5817b855f8d1SPaolo Bonzini if test "$virtfs" = yes; then 5818b855f8d1SPaolo Bonzini error_exit "VirtFS is supported only on Linux" 5819b855f8d1SPaolo Bonzini fi 5820b855f8d1SPaolo Bonzini virtfs=no 5821fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 5822fe8fc5aeSPaolo Bonzini error_exit "Multipath is supported only on Linux" 5823fe8fc5aeSPaolo Bonzini fi 5824fe8fc5aeSPaolo Bonzini mpath=no 582517bff52bSM. Mohan Kumar fi 58266a021536SGerd Hoffmann if test "$xkbcommon" = "yes"; then 58276a021536SGerd Hoffmann tools="qemu-keymap\$(EXESUF) $tools" 58286a021536SGerd Hoffmann fi 5829ff69fd8cSLaurent Vivierfi 58309d6bc27bSMichael Roth 58319d6bc27bSMichael Roth# Probe for guest agent support/options 58329d6bc27bSMichael Roth 5833e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 5834b39297aeSTomoki Sekiyama if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 5835fafcaf1dSMichael Roth tools="qemu-ga $tools" 5836e8ef31a3SMichael Tokarev guest_agent=yes 5837e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 5838e8ef31a3SMichael Tokarev guest_agent=no 5839e8ef31a3SMichael Tokarev else 5840e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 5841ca35f780SPaolo Bonzini fi 58424b1c11fdSDaniel P. Berrangefi 5843ca35f780SPaolo Bonzini 58449d6bc27bSMichael Roth# Guest agent Window MSI package 58459d6bc27bSMichael Roth 58469d6bc27bSMichael Rothif test "$guest_agent" != yes; then 58479d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 58489d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 58499d6bc27bSMichael Roth fi 58509d6bc27bSMichael Roth guest_agent_msi=no 58519d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 58529d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 58539d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 58549d6bc27bSMichael Roth fi 58559d6bc27bSMichael Roth guest_agent_msi=no 58569d6bc27bSMichael Rothelif ! has wixl; then 58579d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 58589d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 58599d6bc27bSMichael Roth fi 58609d6bc27bSMichael Roth guest_agent_msi=no 58611a34904eSMichael Rothelse 58621a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 58631a34904eSMichael Roth # disabled explicitly 58641a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 58651a34904eSMichael Roth guest_agent_msi=yes 58661a34904eSMichael Roth fi 58679d6bc27bSMichael Rothfi 58689d6bc27bSMichael Roth 58691a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 58709d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 58719d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 58729d6bc27bSMichael Roth fi 58739d6bc27bSMichael Roth 58749d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 58759d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 58769d6bc27bSMichael Roth fi 58779d6bc27bSMichael Roth 58789d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 58799d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 58809d6bc27bSMichael Roth fi 58819d6bc27bSMichael Roth 58829d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 588389138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 58849d6bc27bSMichael Roth fi 58859d6bc27bSMichael Roth 588689138857SStefan Weil QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 58879d6bc27bSMichael Roth 58889d6bc27bSMichael Roth case "$cpu" in 58899d6bc27bSMichael Roth x86_64) 58909d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 58919d6bc27bSMichael Roth ;; 58929d6bc27bSMichael Roth i386) 58939d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 58949d6bc27bSMichael Roth ;; 58959d6bc27bSMichael Roth *) 58969d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 58979d6bc27bSMichael Roth ;; 58989d6bc27bSMichael Roth esac 58999d6bc27bSMichael Rothfi 59009d6bc27bSMichael Roth 5901ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 5902ca35f780SPaolo Bonziniroms= 5903e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 5904e633a5c6SEric Blake test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 5905e633a5c6SEric Blake test "$softmmu" = yes ; then 5906e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 5907c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 5908c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 5909c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 5910e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 5911e57218b6SPeter Maydell ld_i386_emulation="$emu" 5912ca35f780SPaolo Bonzini roms="optionrom" 5913e57218b6SPeter Maydell break 5914e57218b6SPeter Maydell fi 5915e57218b6SPeter Maydell done 5916ca35f780SPaolo Bonzinifi 5917e633a5c6SEric Blakeif test "$cpu" = "ppc64" && test "$targetos" != "Darwin" ; then 591839ac8455SDavid Gibson roms="$roms spapr-rtas" 591939ac8455SDavid Gibsonfi 5920ca35f780SPaolo Bonzini 59212e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 59229933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 59232e33c3f8SThomas Huth write_c_skeleton 59242e33c3f8SThomas Huth if compile_prog "-march=z900" ""; then 59259933c305SChristian Borntraeger roms="$roms s390-ccw" 59269933c305SChristian Borntraeger fi 59272e33c3f8SThomas Huthfi 59289933c305SChristian Borntraeger 5929964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary. 593092fe2ba8SPeter Maydellif ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then 5931964c6fa1SRichard Henderson textseg_addr= 5932964c6fa1SRichard Henderson case "$cpu" in 5933479eb121SRichard Henderson arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) 5934479eb121SRichard Henderson # ??? Rationale for choosing this address 5935964c6fa1SRichard Henderson textseg_addr=0x60000000 5936964c6fa1SRichard Henderson ;; 5937964c6fa1SRichard Henderson mips) 5938479eb121SRichard Henderson # A 256M aligned address, high in the address space, with enough 5939479eb121SRichard Henderson # room for the code_gen_buffer above it before the stack. 5940479eb121SRichard Henderson textseg_addr=0x60000000 5941964c6fa1SRichard Henderson ;; 5942964c6fa1SRichard Henderson esac 5943964c6fa1SRichard Henderson if [ -n "$textseg_addr" ]; then 5944964c6fa1SRichard Henderson cat > $TMPC <<EOF 5945964c6fa1SRichard Henderson int main(void) { return 0; } 5946964c6fa1SRichard HendersonEOF 5947964c6fa1SRichard Henderson textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" 5948964c6fa1SRichard Henderson if ! compile_prog "" "$textseg_ldflags"; then 5949964c6fa1SRichard Henderson # In case ld does not support -Ttext-segment, edit the default linker 5950964c6fa1SRichard Henderson # script via sed to set the .text start addr. This is needed on FreeBSD 5951964c6fa1SRichard Henderson # at least. 595292fe2ba8SPeter Maydell if ! $ld --verbose >/dev/null 2>&1; then 595392fe2ba8SPeter Maydell error_exit \ 595492fe2ba8SPeter Maydell "We need to link the QEMU user mode binaries at a" \ 595592fe2ba8SPeter Maydell "specific text address. Unfortunately your linker" \ 595692fe2ba8SPeter Maydell "doesn't support either the -Ttext-segment option or" \ 595792fe2ba8SPeter Maydell "printing the default linker script with --verbose." \ 595892fe2ba8SPeter Maydell "If you don't want the user mode binaries, pass the" \ 595992fe2ba8SPeter Maydell "--disable-user option to configure." 596092fe2ba8SPeter Maydell fi 596192fe2ba8SPeter Maydell 5962964c6fa1SRichard Henderson $ld --verbose | sed \ 5963964c6fa1SRichard Henderson -e '1,/==================================================/d' \ 5964964c6fa1SRichard Henderson -e '/==================================================/,$d' \ 5965964c6fa1SRichard Henderson -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ 5966964c6fa1SRichard Henderson -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld 5967964c6fa1SRichard Henderson textseg_ldflags="-Wl,-T../config-host.ld" 5968964c6fa1SRichard Henderson fi 5969964c6fa1SRichard Henderson fi 5970964c6fa1SRichard Hendersonfi 5971964c6fa1SRichard Henderson 597211cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 597311cde1c8SBruno 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. 597411cde1c8SBruno Dominguezif has $cxx; then 597511cde1c8SBruno Dominguez cat > $TMPC <<EOF 597611cde1c8SBruno Dominguezint c_function(void); 597711cde1c8SBruno Dominguezint main(void) { return c_function(); } 597811cde1c8SBruno DominguezEOF 597911cde1c8SBruno Dominguez 598011cde1c8SBruno Dominguez compile_object 598111cde1c8SBruno Dominguez 598211cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 598311cde1c8SBruno Dominguezextern "C" { 598411cde1c8SBruno Dominguez int c_function(void); 598511cde1c8SBruno Dominguez} 598611cde1c8SBruno Dominguezint c_function(void) { return 42; } 598711cde1c8SBruno DominguezEOF 598811cde1c8SBruno Dominguez 598911cde1c8SBruno Dominguez update_cxxflags 599011cde1c8SBruno Dominguez 599111cde1c8SBruno Dominguez if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then 599211cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 599311cde1c8SBruno Dominguez : 599411cde1c8SBruno Dominguez else 599511cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 599611cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 599711cde1c8SBruno Dominguez cxx= 599811cde1c8SBruno Dominguez fi 599911cde1c8SBruno Dominguezelse 600011cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 600111cde1c8SBruno Dominguez cxx= 600211cde1c8SBruno Dominguezfi 600311cde1c8SBruno Dominguez 600402d34f62SCole Robinsonecho_version() { 600502d34f62SCole Robinson if test "$1" = "yes" ; then 600602d34f62SCole Robinson echo "($2)" 600702d34f62SCole Robinson fi 600802d34f62SCole Robinson} 600902d34f62SCole Robinson 601050e12060SJan Kiszka# prepend pixman and ftd flags after all config tests are done 601150e12060SJan KiszkaQEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" 60128a99e9a3SPhilippe Mathieu-DaudéQEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" 601350e12060SJan Kiszkalibs_softmmu="$pixman_libs $libs_softmmu" 60145ca9388aSGerd Hoffmann 60157d13299dSbellardecho "Install prefix $prefix" 601689138857SStefan Weilecho "BIOS directory $(eval echo $qemu_datadir)" 60173d5eecabSGerd Hoffmannecho "firmware path $(eval echo $firmwarepath)" 601889138857SStefan Weilecho "binary directory $(eval echo $bindir)" 601989138857SStefan Weilecho "library directory $(eval echo $libdir)" 602089138857SStefan Weilecho "module directory $(eval echo $qemu_moddir)" 602189138857SStefan Weilecho "libexec directory $(eval echo $libexecdir)" 602289138857SStefan Weilecho "include directory $(eval echo $includedir)" 602389138857SStefan Weilecho "config directory $(eval echo $sysconfdir)" 602411d9f695Sbellardif test "$mingw32" = "no" ; then 602589138857SStefan Weilecho "local state directory $(eval echo $local_statedir)" 602689138857SStefan Weilecho "Manual directory $(eval echo $mandir)" 602743ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 60285a699bbbSLaszlo Ersekelse 60295a699bbbSLaszlo Ersekecho "local state directory queried at runtime" 6030d9840e25STomoki Sekiyamaecho "Windows SDK $win_sdk" 603111d9f695Sbellardfi 60325a67135aSbellardecho "Source path $source_path" 6033cc84d63aSDaniel P. Berrangeecho "GIT binary $git" 6034aef45d51SDaniel P. Berrangeecho "GIT submodules $git_submodules" 60357d13299dSbellardecho "C compiler $cc" 603683469015Sbellardecho "Host C compiler $host_cc" 603783f73fceSTomoki Sekiyamaecho "C++ compiler $cxx" 60383c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 603945d285abSPeter Maydellecho "ARFLAGS $ARFLAGS" 60400c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 6041a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 60420c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 60438a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS $QEMU_LDFLAGS" 60447d13299dSbellardecho "make $make" 60456a882643Spbrookecho "install $install" 6046755ee70fSCleber Rosaecho "python $python ($python_version)" 6047e2d8830eSBradif test "$slirp" = "yes" ; then 6048e2d8830eSBrad echo "smbd $smbd" 6049e2d8830eSBradfi 605017969268SFam Zhengecho "module support $modules" 6051a98fd896Sbellardecho "host CPU $cpu" 6052de83cd02Sbellardecho "host big endian $bigendian" 605397a847bcSbellardecho "target list $target_list" 60547d13299dSbellardecho "gprof enabled $gprof" 605503b4fe7dSaliguoriecho "sparse enabled $sparse" 60561625af87Saliguoriecho "strip binaries $strip_opt" 605705c2a3e7Sbellardecho "profiler $profiler" 605843ce4dfeSbellardecho "static build $static" 60595b0753e0Sbellardif test "$darwin" = "yes" ; then 60605b0753e0Sbellard echo "Cocoa support $cocoa" 60615b0753e0Sbellardfi 606289138857SStefan Weilecho "SDL support $sdl $(echo_version $sdl $sdlversion)" 6063a442fe2fSDaniel P. Berrangéecho "SDL image support $sdl_image" 606489138857SStefan Weilecho "GTK support $gtk $(echo_version $gtk $gtk_version)" 6065925a0400SGerd Hoffmannecho "GTK GL support $gtk_gl" 606689138857SStefan Weilecho "VTE support $vte $(echo_version $vte $vteversion)" 6067a1c5e949SDaniel P. Berrangeecho "TLS priority $tls_priority" 6068ddbb0d09SDaniel P. Berrangeecho "GNUTLS support $gnutls" 606991bfcdb0SDaniel P. Berrangeecho "libgcrypt $gcrypt" 607089138857SStefan Weilecho "nettle $nettle $(echo_version $nettle $nettle_version)" 60719a2fd434SDaniel P. Berrangeecho "libtasn1 $tasn1" 60724d3b6f6eSbalrogecho "curses support $curses" 607347479c55SMarc-André Lureauecho "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)" 6074769ce76dSAlexander Grafecho "curl support $curl" 607567b915a5Sbellardecho "mingw32 support $mingw32" 60760c58ac1cSmalcecho "Audio drivers $audio_drv_list" 6077b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist" 6078b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist" 6079983eef5aSMeador Ingeecho "VirtFS support $virtfs" 6080fe8fc5aeSPaolo Bonziniecho "Multipath support $mpath" 6081821601eaSJes Sorensenecho "VNC support $vnc" 6082821601eaSJes Sorensenif test "$vnc" = "yes" ; then 60832f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 60842f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 6085efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 6086821601eaSJes Sorensenfi 60873142255cSblueswir1if test -n "$sparc_cpu"; then 60883142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 60893142255cSblueswir1fi 6090e37630caSaliguoriecho "xen support $xen" 60913996e85cSPaul Durrantif test "$xen" = "yes" ; then 60923996e85cSPaul Durrant echo "xen ctrl version $xen_ctrl_version" 60933996e85cSPaul Durrantfi 60942e4d9fb1Saurel32echo "brlapi support $brlapi" 6095a20a6f46SJuan Quintelaecho "bluez support $bluez" 6096a25dba17SJuan Quintelaecho "Documentation $docs" 609740d6444eSAvi Kivityecho "PIE $pie" 60988a16d273Sthsecho "vde support $vde" 609958952137SVincenzo Maffioneecho "netmap support $netmap" 61005c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 6101758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 610277755340Sthsecho "Install blobs $blobs" 6103b31a0277SJuan Quintelaecho "KVM support $kvm" 6104b0cb0a66SVincent Palatinecho "HAX support $hax" 6105c97d6d2cSSergio Andres Gomez Del Realecho "HVF support $hvf" 6106d661d9a4SJustin Terry (VM)echo "WHPX support $whpx" 6107b3f6ea7eSPaolo Bonziniecho "TCG support $tcg" 6108b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes" ; then 6109b3f6ea7eSPaolo Bonzini echo "TCG debug enabled $debug_tcg" 61109195b2c2SStefan Weil echo "TCG interpreter $tcg_interpreter" 6111b3f6ea7eSPaolo Bonzinifi 61125a22ab71SYang Zhongecho "malloc trim support $malloc_trim" 6113b3f6ea7eSPaolo Bonziniecho "RDMA support $rdma" 611421ab34c9SMarcel Apfelbaumecho "PVRDMA support $pvrdma" 6115f652e6afSaurel32echo "fdt support $fdt" 6116a40161cbSPaolo Bonziniecho "membarrier $membarrier" 6117ceb42de8Saliguoriecho "preadv support $preadv" 61185f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 6119e78815a5SAndreas Färberecho "madvise $madvise" 6120e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 61219bc5a719SAndreas Gustafssonecho "posix_memalign $posix_memalign" 612247e98658SCorey Bryantecho "libcap-ng support $cap_ng" 6123d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 6124042cea27SGongleiecho "vhost-crypto support $vhost_crypto" 61255e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi" 6126fc0b9b0eSStefan Hajnocziecho "vhost-vsock support $vhost_vsock" 6127e6a74868SMarc-André Lureauecho "vhost-user support $vhost_user" 61285b808275SLluís Vilanovaecho "Trace backends $trace_backends" 6129713572a7SMarc-André Lureauif have_backend "simple"; then 61309410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 6131e00e36fbSStefan Weilfi 613289138857SStefan Weilecho "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" 6133f27aaf4bSChristian Brunnerecho "rbd support $rbd" 6134dce512deSChristoph Hellwigecho "xfsctl support $xfs" 61357b02f544SMarc-André Lureauecho "smartcard support $smartcard" 61362b2325ffSGerd Hoffmannecho "libusb $libusb" 613769354a83SHans de Goedeecho "usb net redir $usb_redir" 6138da076ffeSGerd Hoffmannecho "OpenGL support $opengl" 6139014cb152SGerd Hoffmannecho "OpenGL dmabufs $opengl_dmabuf" 6140c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 61416542aa9cSPeter Lievenecho "libnfs support $libnfs" 6142d138cee9SMichael Rothecho "build guest agent $guest_agent" 6143d9840e25STomoki Sekiyamaecho "QGA VSS support $guest_agent_with_vss" 614450cbebb9SMichael Rothecho "QGA w32 disk info $guest_agent_ntddscsi" 61454c875d89SMichael Rothecho "QGA MSI support $guest_agent_msi" 6146f794573eSEduardo Otuboecho "seccomp support $seccomp" 61477c2acc70SPeter Maydellecho "coroutine backend $coroutine" 614870c60c08SStefan Hajnocziecho "coroutine pool $coroutine_pool" 61497d992e4dSPeter Lievenecho "debug stack usage $debug_stack_usage" 6150ba59fb77SPaolo Bonziniecho "mutex debugging $debug_mutex" 6151f0d92b56SLongpeng(Mike)echo "crypto afalg $crypto_afalg" 6152eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 61531d728c39SBlue Swirlecho "gcov $gcov_tool" 61541d728c39SBlue Swirlecho "gcov enabled $gcov" 6155ab214c29SStefan Bergerecho "TPM support $tpm" 61560a12ec87SRichard W.M. Jonesecho "libssh2 support $libssh2" 61573b8acc11SPaolo Bonziniecho "TPM passthrough $tpm_passthrough" 6158f4ede81eSAmarnath Valluriecho "TPM emulator $tpm_emulator" 61593556c233SPaolo Bonziniecho "QOM debugging $qom_cast_debug" 6160ed1701c6SDr. David Alan Gilbertecho "Live block migration $live_block_migration" 6161607dacd0Sqiaonuohanecho "lzo support $lzo" 6162607dacd0Sqiaonuohanecho "snappy support $snappy" 61636b383c08SPeter Wuecho "bzip2 support $bzip2" 616483bc1f97SJulio Faraccoecho "lzfse support $lzfse" 6165a99d57bbSWanlong Gaoecho "NUMA host support $numa" 6166ed279a06SKlim Kireevecho "libxml2 $libxml2" 61672847b469SFam Zhengecho "tcmalloc support $tcmalloc" 61687b01cb97SAlexandre Derumierecho "jemalloc support $jemalloc" 616999f2dbd3SLiang Liecho "avx2 optimization $avx2_opt" 6170a6b1d4c0SChanglong Xieecho "replication support $replication" 6171da92c3ffSAshish Mittalecho "VxHS block device $vxhs" 61722f740136SJeff Codyecho "bochs support $bochs" 61732f740136SJeff Codyecho "cloop support $cloop" 61742f740136SJeff Codyecho "dmg support $dmg" 61752f740136SJeff Codyecho "qcow v1 support $qcow1" 61762f740136SJeff Codyecho "vdi support $vdi" 61772f740136SJeff Codyecho "vvfat support $vvfat" 61782f740136SJeff Codyecho "qed support $qed" 61792f740136SJeff Codyecho "parallels support $parallels" 61802f740136SJeff Codyecho "sheepdog support $sheepdog" 61818ca80760SRichard Hendersonecho "capstone $capstone" 618251a12b51SAlex Bennéeecho "docker $docker" 618317824406SJunyan Heecho "libpmem support $libpmem" 61843efac6ebSTomáš Golembiovskýecho "libudev $libudev" 618567b915a5Sbellard 6186898be3e0SPeter Maydellif test "$supported_cpu" = "no"; then 6187898be3e0SPeter Maydell echo 6188898be3e0SPeter Maydell echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!" 6189898be3e0SPeter Maydell echo 6190898be3e0SPeter Maydell echo "CPU host architecture $cpu support is not currently maintained." 6191898be3e0SPeter Maydell echo "The QEMU project intends to remove support for this host CPU in" 6192898be3e0SPeter Maydell echo "a future release if nobody volunteers to maintain it and to" 6193898be3e0SPeter Maydell echo "provide a build host for our continuous integration setup." 6194898be3e0SPeter Maydell echo "configure has succeeded and you can continue to build, but" 6195898be3e0SPeter Maydell echo "if you care about QEMU on this platform you should contact" 6196898be3e0SPeter Maydell echo "us upstream at qemu-devel@nongnu.org." 6197898be3e0SPeter Maydellfi 6198898be3e0SPeter Maydell 6199898be3e0SPeter Maydellif test "$supported_os" = "no"; then 6200898be3e0SPeter Maydell echo 6201898be3e0SPeter Maydell echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!" 6202898be3e0SPeter Maydell echo 6203c50126aaSPeter Maydell echo "Host OS $targetos support is not currently maintained." 6204c50126aaSPeter Maydell echo "The QEMU project intends to remove support for this host OS in" 6205898be3e0SPeter Maydell echo "a future release if nobody volunteers to maintain it and to" 6206898be3e0SPeter Maydell echo "provide a build host for our continuous integration setup." 6207898be3e0SPeter Maydell echo "configure has succeeded and you can continue to build, but" 6208898be3e0SPeter Maydell echo "if you care about QEMU on this platform you should contact" 6209898be3e0SPeter Maydell echo "us upstream at qemu-devel@nongnu.org." 6210898be3e0SPeter Maydellfi 6211898be3e0SPeter Maydell 621298ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 621397a847bcSbellard 6214dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 6215dbd99ae3SStefan Weil 621698ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 621798ec69acSJuan Quintelaecho >> $config_host_mak 621898ec69acSJuan Quintela 6219e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 622099d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 622199d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 62223aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 62238bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 62240f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 622599d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 622699d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 622722d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 62289afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 62293d5eecabSGerd Hoffmannecho "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 62309afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 6231e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 62325a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 6233785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 62345a699bbbSLaszlo Ersekfi 6235f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 6236834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 6237a8260d38SDaniel P. Berrangéecho "qemu_icondir=$qemu_icondir" >> $config_host_mak 623867ea9546SDaniel P. Berrangéecho "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak 6239f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 6240cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 6241aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6242f62bbee5SDaniel P. Berrangeecho "GIT_UPDATE=$git_update" >> $config_host_mak 6243804edf29SJuan Quintela 624498ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 6245727e5283SPaolo Bonzini 6246f8393946Saurel32if test "$debug_tcg" = "yes" ; then 62472358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6248f8393946Saurel32fi 62491625af87Saliguoriif test "$strip_opt" = "yes" ; then 625052ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 62511625af87Saliguorifi 62527d13299dSbellardif test "$bigendian" = "yes" ; then 6253e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 625497a847bcSbellardfi 625567b915a5Sbellardif test "$mingw32" = "yes" ; then 625698ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 625789138857SStefan Weil rc_version=$(cat $source_path/VERSION) 62589fe6de94SBlue Swirl version_major=${rc_version%%.*} 62599fe6de94SBlue Swirl rc_version=${rc_version#*.} 62609fe6de94SBlue Swirl version_minor=${rc_version%%.*} 62619fe6de94SBlue Swirl rc_version=${rc_version#*.} 62629fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 62639fe6de94SBlue Swirl version_micro=0 62649fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 62659fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6266d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 6267d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6268f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6269d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6270d9840e25STomoki Sekiyama fi 627150cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 627276dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 627350cbebb9SMichael Roth fi 62741a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 62759dacf32dSYossi Hindin echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 62769dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 62779dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 62789dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 62799dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 62809dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 62819dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 62829dacf32dSYossi Hindin fi 6283210fa556Spbrookelse 628435f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 6285210fa556Spbrookfi 6286128ab2ffSblueswir1 6287dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 6288dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 6289dffcb71cSMark McLoughlinfi 6290dffcb71cSMark McLoughlin 629183fb7adfSbellardif test "$darwin" = "yes" ; then 629298ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 629383fb7adfSbellardfi 6294b29fe3edSmalc 6295ec530c81Sbellardif test "$solaris" = "yes" ; then 629698ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 6297ec530c81Sbellardfi 6298179cf400SAndreas Färberif test "$haiku" = "yes" ; then 6299179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 6300179cf400SAndreas Färberfi 630197a847bcSbellardif test "$static" = "yes" ; then 630298ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 630397a847bcSbellardfi 63041ba16968SStefan Weilif test "$profiler" = "yes" ; then 63052358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 630605c2a3e7Sbellardfi 6307c20709aaSbellardif test "$slirp" = "yes" ; then 630898ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 6309e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 6310c20709aaSbellardfi 63118a16d273Sthsif test "$vde" = "yes" ; then 631298ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 6313e2ad6f16SFam Zheng echo "VDE_LIBS=$vde_libs" >> $config_host_mak 63148a16d273Sthsfi 631558952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 631658952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 631758952137SVincenzo Maffionefi 6318015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 6319015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 6320015a33bdSGongleifi 632147e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 632247e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 632347e98658SCorey Bryantfi 63242358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 63250c58ac1cSmalcfor drv in $audio_drv_list; do 63261ef1ec2aSGerd Hoffmann def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 6327ce3dc033SGerd Hoffmann case "$drv" in 6328051c7d5cSGerd Hoffmann alsa | oss | pa | sdl) 6329ce3dc033SGerd Hoffmann echo "$def=m" >> $config_host_mak ;; 6330ce3dc033SGerd Hoffmann *) 6331ce3dc033SGerd Hoffmann echo "$def=y" >> $config_host_mak ;; 6332ce3dc033SGerd Hoffmann esac 63330c58ac1cSmalcdone 6334b1149911SFam Zhengecho "ALSA_LIBS=$alsa_libs" >> $config_host_mak 6335b1149911SFam Zhengecho "PULSE_LIBS=$pulse_libs" >> $config_host_mak 6336b1149911SFam Zhengecho "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 6337b1149911SFam Zhengecho "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 6338b1149911SFam Zhengecho "OSS_LIBS=$oss_libs" >> $config_host_mak 633967f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 634067f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 634167f86e8eSJuan Quintelafi 6342d5631638Smalcif test "$audio_win_int" = "yes" ; then 6343d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 6344d5631638Smalcfi 6345b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 6346b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 6347821601eaSJes Sorensenif test "$vnc" = "yes" ; then 6348821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 6349821601eaSJes Sorensenfi 63502f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 635198ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 63522f9606b3Saliguorifi 6353821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 63542f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 63552f6f5c7aSCorentin Charyfi 6356821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 6357efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 6358efe556adSCorentin Charyfi 63596a021536SGerd Hoffmannif test "$xkbcommon" = "yes" ; then 63606a021536SGerd Hoffmann echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak 63616a021536SGerd Hoffmann echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak 63626a021536SGerd Hoffmannfi 636376655d6dSaliguoriif test "$fnmatch" = "yes" ; then 63642358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 636576655d6dSaliguorifi 6366dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 6367dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 6368dce512deSChristoph Hellwigfi 636989138857SStefan Weilqemu_version=$(head $source_path/VERSION) 637098ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 63712358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 637298ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 63732b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 6374a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 637598ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 6376cc8ae6deSpbrookfi 637717969268SFam Zhengif test "$modules" = "yes"; then 6378e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 6379e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 638089138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 638117969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 638217969268SFam Zhengfi 6383e633a5c6SEric Blakeif test "$have_x11" = "yes" && test "$need_x11" = "yes"; then 63848781595bSGerd Hoffmann echo "CONFIG_X11=y" >> $config_host_mak 63858781595bSGerd Hoffmann echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 63868781595bSGerd Hoffmann echo "X11_LIBS=$x11_libs" >> $config_host_mak 63878781595bSGerd Hoffmannfi 63881ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 638996400a14SGerd Hoffmann echo "CONFIG_SDL=m" >> $config_host_mak 63908ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 63918ecc89f6SFam Zheng echo "SDL_LIBS=$sdl_libs" >> $config_host_mak 6392a442fe2fSDaniel P. Berrangé if test "$sdl_image" = "yes" ; then 6393a442fe2fSDaniel P. Berrangé echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak 6394a442fe2fSDaniel P. Berrangé fi 639549ecc3faSbellardfi 639649ecc3faSbellardif test "$cocoa" = "yes" ; then 639798ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 639849ecc3faSbellardfi 63994d3b6f6eSbalrogif test "$curses" = "yes" ; then 64002373f7d5SGerd Hoffmann echo "CONFIG_CURSES=m" >> $config_host_mak 64012373f7d5SGerd Hoffmann echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 64022373f7d5SGerd Hoffmann echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 6403ab4e5602SJan Kiszkafi 6404099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 64052358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 6406099d6b0fSRiku Voipiofi 640740ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 640840ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 640940ff6d7eSKevin Wolffi 64103ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 64112358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 64123ce34dfbSvibisreenivasanfi 6413c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 6414c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 6415c2882b96SRiku Voipiofi 6416751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 6417751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 6418751bcc39SMarc-André Lureaufi 6419955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 6420955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 6421955727d2SCortland Tölvafi 6422d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 6423d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 6424d0927938SUlrich Hechtfi 64253d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 64263d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 64273d4fa43eSKusanagi Kouichifi 6428b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 6429b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 6430b953f075SDenis V. Lunevfi 6431ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 6432ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 6433ed911435SKevin Wolffi 6434c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 6435c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 6436c727f47dSPeter Maydellfi 6437dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 6438dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 6439dace20dcSPeter Maydellfi 6440d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 6441d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 6442d0927938SUlrich Hechtfi 64434e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 64444e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 64454e0c6529SAlex Blighfi 6446cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 6447cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 6448cd758dd0SAlex Blighfi 64493b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 64503b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 64513b6edd16SPeter Maydellfi 64523b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 64533b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 64543b6edd16SPeter Maydellfi 6455a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 6456a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 6457a8fd1abaSPeter Maydellfi 645851834341SRiku Voipioif test "$timerfd" = "yes" ; then 645951834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 646051834341SRiku Voipiofi 64619af5c906SRiku Voipioif test "$setns" = "yes" ; then 64629af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 64639af5c906SRiku Voipiofi 646438860a03SAleksandar Markovicif test "$clock_adjtime" = "yes" ; then 646538860a03SAleksandar Markovic echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 646638860a03SAleksandar Markovicfi 64675a03cd00SAleksandar Markovicif test "$syncfs" = "yes" ; then 64685a03cd00SAleksandar Markovic echo "CONFIG_SYNCFS=y" >> $config_host_mak 64695a03cd00SAleksandar Markovicfi 64703b3f24adSaurel32if test "$inotify" = "yes" ; then 64712358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 64723b3f24adSaurel32fi 6473c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 6474c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 6475c05c7a73SRiku Voipiofi 6476401bc051SPeter Maydellif test "$sem_timedwait" = "yes" ; then 6477401bc051SPeter Maydell echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 6478401bc051SPeter Maydellfi 64795c99fa37SKeno Fischerif test "$strchrnul" = "yes" ; then 64805c99fa37SKeno Fischer echo "HAVE_STRCHRNUL=y" >> $config_host_mak 64815c99fa37SKeno Fischerfi 64826ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 64836ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 64846ae9a1f4SJuan Quintelafi 64856ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 64866ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 64876ae9a1f4SJuan Quintelafi 6488769ce76dSAlexander Grafif test "$curl" = "yes" ; then 6489d3399d7cSFam Zheng echo "CONFIG_CURL=m" >> $config_host_mak 6490b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 64916ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 6492769ce76dSAlexander Graffi 64932e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 649498ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 64958eca2889SFam Zheng echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 64962e4d9fb1Saurel32fi 6497fb599c9aSbalrogif test "$bluez" = "yes" ; then 649898ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 6499ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 6500fb599c9aSbalrogfi 6501a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 6502e0fb129cSGerd Hoffmann echo "CONFIG_GTK=m" >> $config_host_mak 6503a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 6504014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 6505925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 6506925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 6507925a0400SGerd Hoffmann fi 6508bbbf9bfbSStefan Weilfi 6509a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 6510ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 6511ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 6512ddbb0d09SDaniel P. Berrangefi 651391bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 651491bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 65151f923c70SLongpeng(Mike) if test "$gcrypt_hmac" = "yes" ; then 65161f923c70SLongpeng(Mike) echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 65171f923c70SLongpeng(Mike) fi 651862893b67SDaniel P. Berrangefi 651991bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 652091bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 6521becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 6522ed754746SDaniel P. Berrangefi 65239a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 65249a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 65259a2fd434SDaniel P. Berrangefi 6526559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 6527559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 6528559607eaSDaniel P. Berrangefi 65296b39b063SEric Blakeif test "$have_broken_size_max" = "yes" ; then 65306b39b063SEric Blake echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 65316b39b063SEric Blakefi 6532277abf15SJan Vesely 6533277abf15SJan Vesely# Work around a system header bug with some kernel/XFS header 6534277abf15SJan Vesely# versions where they both try to define 'struct fsxattr': 6535277abf15SJan Vesely# xfs headers will not try to redefine structs from linux headers 6536277abf15SJan Vesely# if this macro is set. 6537277abf15SJan Veselyif test "$have_fsxattr" = "yes" ; then 6538277abf15SJan Vesely echo "HAVE_FSXATTR=y" >> $config_host_mak 6539277abf15SJan Veselyfi 65401efad060SFam Zhengif test "$have_copy_file_range" = "yes" ; then 65411efad060SFam Zheng echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 65421efad060SFam Zhengfi 6543bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 6544bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 6545a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 6546e0fb129cSGerd Hoffmann echo "VTE_LIBS=$vte_libs" >> $config_host_mak 6547a4ccabcfSAnthony Liguorifi 65489d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 65499d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 65509d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 65519d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 65529d9e1521SGerd Hoffmannfi 6553e37630caSaliguoriif test "$xen" = "yes" ; then 65546dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 6555d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 6556e37630caSaliguorifi 65575c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 65585c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 65595c6c3a6cSChristoph Hellwigfi 6560758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 6561758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 6562758e8e38SVenkateswararao Jujjuri (JV)fi 65634f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 65644f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 65654f26f2b6SAvi Kivityfi 6566983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 6567758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 6568758e8e38SVenkateswararao Jujjuri (JV)fi 6569fe8fc5aeSPaolo Bonziniif test "$mpath" = "yes" ; then 6570fe8fc5aeSPaolo Bonzini echo "CONFIG_MPATH=y" >> $config_host_mak 65711b0578f5SMurilo Opsfelder Araujo if test "$mpathpersist_new_api" = "yes"; then 65721b0578f5SMurilo Opsfelder Araujo echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak 65731b0578f5SMurilo Opsfelder Araujo fi 6574fe8fc5aeSPaolo Bonzinifi 65755e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 65765e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 65775e9be92dSNicholas Bellingerfi 6578e633a5c6SEric Blakeif test "$vhost_net" = "yes" && test "$vhost_user" = "yes"; then 657903ce5744SNikolay Nikolaev echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak 658003ce5744SNikolay Nikolaevfi 6581042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 6582042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 6583042cea27SGongleifi 6584fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 6585fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 6586fc0b9b0eSStefan Hajnoczifi 6587e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 6588e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 6589e6a74868SMarc-André Lureaufi 659077755340Sthsif test "$blobs" = "yes" ; then 659198ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 659277755340Sthsfi 6593bf9298b9Saliguoriif test "$iovec" = "yes" ; then 65942358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 6595bf9298b9Saliguorifi 6596ceb42de8Saliguoriif test "$preadv" = "yes" ; then 65972358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 6598ceb42de8Saliguorifi 6599e3971d61SPhilippe Mathieu-Daudéif test "$fdt" != "no" ; then 66003f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 6601f652e6afSaurel32fi 6602a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 6603a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 6604a40161cbSPaolo Bonzinifi 6605dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 6606dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 6607dcc38d1cSMarcelo Tosattifi 6608d339d766SRichard W.M. Jonesif test "$optreset" = "yes" ; then 6609d339d766SRichard W.M. Jones echo "HAVE_OPTRESET=y" >> $config_host_mak 6610d339d766SRichard W.M. Jonesfi 6611b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes"; then 6612b3f6ea7eSPaolo Bonzini echo "CONFIG_TCG=y" >> $config_host_mak 66139195b2c2SStefan Weil if test "$tcg_interpreter" = "yes" ; then 66149195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 66159195b2c2SStefan Weil fi 6616b3f6ea7eSPaolo Bonzinifi 66175f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 66185f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 66195f6b9e8fSBlue Swirlfi 6620e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 6621e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 6622e78815a5SAndreas Färberfi 6623e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 6624e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 6625e78815a5SAndreas Färberfi 66269bc5a719SAndreas Gustafssonif test "$posix_memalign" = "yes" ; then 66279bc5a719SAndreas Gustafsson echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 66289bc5a719SAndreas Gustafssonfi 662997a847bcSbellard 6630cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 6631cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 6632cd4ec0b4SGerd Hoffmannfi 6633cd4ec0b4SGerd Hoffmann 66347b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 66357b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 66367b62bf5aSFam Zheng echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 66377b62bf5aSFam Zheng echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 6638111a38b0SRobert Relyeafi 6639111a38b0SRobert Relyea 66402b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 66412b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 6642b878b652SFam Zheng echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 6643b878b652SFam Zheng echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 66442b2325ffSGerd Hoffmannfi 66452b2325ffSGerd Hoffmann 664669354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 664769354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 6648cc7923fcSFam Zheng echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 6649cc7923fcSFam Zheng echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 665069354a83SHans de Goedefi 665169354a83SHans de Goede 6652da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 6653da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 6654da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 6655014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 6656014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 6657014cb152SGerd Hoffmann fi 665820ff075bSMichael Wallefi 665920ff075bSMichael Walle 66605a22ab71SYang Zhongif test "$malloc_trim" = "yes" ; then 66615a22ab71SYang Zhong echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak 66625a22ab71SYang Zhongfi 66635a22ab71SYang Zhong 666499f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 666599f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 666699f2dbd3SLiang Lifi 666799f2dbd3SLiang Li 6668607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 6669607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 6670607dacd0Sqiaonuohanfi 6671607dacd0Sqiaonuohan 6672607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 6673607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 6674607dacd0Sqiaonuohanfi 6675607dacd0Sqiaonuohan 66766b383c08SPeter Wuif test "$bzip2" = "yes" ; then 66776b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 66786b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 66796b383c08SPeter Wufi 66806b383c08SPeter Wu 668183bc1f97SJulio Faraccoif test "$lzfse" = "yes" ; then 668283bc1f97SJulio Faracco echo "CONFIG_LZFSE=y" >> $config_host_mak 668383bc1f97SJulio Faracco echo "LZFSE_LIBS=-llzfse" >> $config_host_mak 668483bc1f97SJulio Faraccofi 668583bc1f97SJulio Faracco 6686c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 6687d3399d7cSFam Zheng echo "CONFIG_LIBISCSI=m" >> $config_host_mak 66886ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 66896ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 6690c589b249SRonnie Sahlbergfi 6691c589b249SRonnie Sahlberg 66926542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 66934be4879fSColin Lord echo "CONFIG_LIBNFS=m" >> $config_host_mak 66944be4879fSColin Lord echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 66956542aa9cSPeter Lievenfi 66966542aa9cSPeter Lieven 6697f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 6698f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 6699c3883e1fSFam Zheng echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 6700c3883e1fSFam Zheng echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 6701f794573eSEduardo Otubofi 6702f794573eSEduardo Otubo 670383fb7adfSbellard# XXX: suppress that 67047d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 67052358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 67067d3505c5Sbellardfi 67077d3505c5Sbellard 67084d9310f4SDaniel P. Berrangeif test "$localtime_r" = "yes" ; then 67094d9310f4SDaniel P. Berrange echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 67104d9310f4SDaniel P. Berrangefi 67113556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 67123556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 67133556c233SPaolo Bonzinifi 6714f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 6715d3399d7cSFam Zheng echo "CONFIG_RBD=m" >> $config_host_mak 67166ebc91e5SFam Zheng echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 67176ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 6718f27aaf4bSChristian Brunnerfi 671920ff6c80SAnthony Liguori 67207c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 672170c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 672270c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 672370c60c08SStefan Hajnoczielse 672470c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 672570c60c08SStefan Hajnoczifi 6726d0e2fce5SAneesh Kumar K.V 67277d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 67287d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 67297d992e4dSPeter Lievenfi 67307d992e4dSPeter Lieven 6731f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 6732f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 6733f0d92b56SLongpeng(Mike)fi 6734f0d92b56SLongpeng(Mike) 6735d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 6736d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 6737d2042378SAneesh Kumar K.Vfi 6738d2042378SAneesh Kumar K.V 6739e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 6740e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 6741e06a765eSHarsh Prateek Borafi 6742e06a765eSHarsh Prateek Bora 6743cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then 6744cc6e3ca9SGerd Hoffmann echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 674506d71fa1SPeter Maydellfi 674606d71fa1SPeter Maydell 67473f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 67483f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 67493f4349dcSKevin Wolffi 67503f4349dcSKevin Wolf 6751d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 6752d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 6753d83414e1SMarc-André Lureaufi 6754d83414e1SMarc-André Lureau 67558ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 67568ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 67578ab1bf12SLuiz Capitulinofi 67588ab1bf12SLuiz Capitulino 675976a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 676076a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 676176a347e1SRichard Hendersonfi 676276a347e1SRichard Henderson 6763f540166bSRichard Hendersonif test "$int128" = "yes" ; then 6764f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 6765f540166bSRichard Hendersonfi 6766f540166bSRichard Henderson 67677ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 67687ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 67697ebee43eSRichard Hendersonfi 67707ebee43eSRichard Henderson 6771e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 6772e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 6773e6cd4bb5SRichard Hendersonfi 6774e6cd4bb5SRichard Henderson 6775df79b996SRichard Hendersonif test "$atomic64" = "yes" ; then 6776df79b996SRichard Henderson echo "CONFIG_ATOMIC64=y" >> $config_host_mak 6777df79b996SRichard Hendersonfi 6778df79b996SRichard Henderson 6779db432672SRichard Hendersonif test "$vector16" = "yes" ; then 6780db432672SRichard Henderson echo "CONFIG_VECTOR16=y" >> $config_host_mak 6781db432672SRichard Hendersonfi 6782db432672SRichard Henderson 67831e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 67841e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 67851e6e9acaSRichard Hendersonfi 67861e6e9acaSRichard Henderson 6787eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 6788d3399d7cSFam Zheng echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 67896ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 67906ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 6791eb100396SBharata B Raofi 6792eb100396SBharata B Rao 6793d85fa9ebSJeff Codyif test "$glusterfs_xlator_opt" = "yes" ; then 6794d85fa9ebSJeff Cody echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 6795d85fa9ebSJeff Codyfi 6796d85fa9ebSJeff Cody 67970c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 67980c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 67990c14fb47SBharata B Raofi 68000c14fb47SBharata B Rao 6801df3a429aSNiels de Vosif test "$glusterfs_fallocate" = "yes" ; then 6802df3a429aSNiels de Vos echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 6803df3a429aSNiels de Vosfi 6804df3a429aSNiels de Vos 68057c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 68067c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 68077c815372SBharata B Raofi 68087c815372SBharata B Rao 68090a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then 6810d3399d7cSFam Zheng echo "CONFIG_LIBSSH2=m" >> $config_host_mak 68116ebc91e5SFam Zheng echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak 68126ebc91e5SFam Zheng echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak 68130a12ec87SRichard W.M. Jonesfi 68140a12ec87SRichard W.M. Jones 6815ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 6816ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 6817ed1701c6SDr. David Alan Gilbertfi 6818ed1701c6SDr. David Alan Gilbert 68193b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 68203b8acc11SPaolo Bonzini echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak 6821f4ede81eSAmarnath Valluri # TPM passthrough support? 68223b8acc11SPaolo Bonzini if test "$tpm_passthrough" = "yes"; then 68233b8acc11SPaolo Bonzini echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak 68243b8acc11SPaolo Bonzini fi 6825f4ede81eSAmarnath Valluri # TPM emulator support? 6826f4ede81eSAmarnath Valluri if test "$tpm_emulator" = "yes"; then 6827f4ede81eSAmarnath Valluri echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak 6828f4ede81eSAmarnath Valluri fi 68293b8acc11SPaolo Bonzinifi 68303b8acc11SPaolo Bonzini 68315b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 68325b808275SLluís Vilanovaif have_backend "nop"; then 68336d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 683422890ab5SPrerna Saxenafi 68355b808275SLluís Vilanovaif have_backend "simple"; then 68366d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 68376d8a764eSLluís # Set the appropriate trace file. 6838953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 68399410b56cSPrerna Saxenafi 6840ed7f5f1dSPaolo Bonziniif have_backend "log"; then 6841ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 68426d8a764eSLluísfi 68435b808275SLluís Vilanovaif have_backend "ust"; then 68446d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 68456d8a764eSLluísfi 68465b808275SLluís Vilanovaif have_backend "dtrace"; then 68476d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 68486d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 68496d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 68506d8a764eSLluís fi 6851c276b17dSDaniel P. Berrangefi 68525b808275SLluís Vilanovaif have_backend "ftrace"; then 6853781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 6854781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 6855781e9545SEiichi Tsukata else 685621684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 6857781e9545SEiichi Tsukata fi 6858781e9545SEiichi Tsukatafi 68590a852417SPaul Durrantif have_backend "syslog"; then 68600a852417SPaul Durrant if test "$posix_syslog" = "yes" ; then 68610a852417SPaul Durrant echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 68620a852417SPaul Durrant else 68630a852417SPaul Durrant feature_not_found "syslog(trace backend)" "syslog not available" 68640a852417SPaul Durrant fi 68650a852417SPaul Durrantfi 68669410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 68679410b56cSPrerna Saxena 68682da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 68692da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 6870392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 68712da776dbSMichael R. Hinesfi 68722da776dbSMichael R. Hines 687321ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 687421ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 687521ab34c9SMarcel Apfelbaumfi 687621ab34c9SMarcel Apfelbaum 6877575b22b1SLaurent Vivierif test "$have_rtnetlink" = "yes" ; then 6878575b22b1SLaurent Vivier echo "CONFIG_RTNETLINK=y" >> $config_host_mak 6879575b22b1SLaurent Vivierfi 6880575b22b1SLaurent Vivier 6881ed279a06SKlim Kireevif test "$libxml2" = "yes" ; then 6882ed279a06SKlim Kireev echo "CONFIG_LIBXML2=y" >> $config_host_mak 6883ed279a06SKlim Kireev echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 6884ed279a06SKlim Kireev echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 6885ed279a06SKlim Kireevfi 6886ed279a06SKlim Kireev 6887a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 6888a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 6889a6b1d4c0SChanglong Xiefi 6890a6b1d4c0SChanglong Xie 68916a02c806SStefan Hajnocziif test "$have_af_vsock" = "yes" ; then 68926a02c806SStefan Hajnoczi echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 68936a02c806SStefan Hajnoczifi 68946a02c806SStefan Hajnoczi 68954d04351fSChristopher Covingtonif test "$have_sysmacros" = "yes" ; then 68964d04351fSChristopher Covington echo "CONFIG_SYSMACROS=y" >> $config_host_mak 68974d04351fSChristopher Covingtonfi 68984d04351fSChristopher Covington 689949e00a18SAndreas Grapentinif test "$have_static_assert" = "yes" ; then 690049e00a18SAndreas Grapentin echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 690149e00a18SAndreas Grapentinfi 690249e00a18SAndreas Grapentin 6903e674605fSTomáš Golembiovskýif test "$have_utmpx" = "yes" ; then 6904e674605fSTomáš Golembiovský echo "HAVE_UTMPX=y" >> $config_host_mak 6905e674605fSTomáš Golembiovskýfi 6906e674605fSTomáš Golembiovský 6907e0580342SKamil Rytarowskiif test "$ivshmem" = "yes" ; then 6908e0580342SKamil Rytarowski echo "CONFIG_IVSHMEM=y" >> $config_host_mak 6909e0580342SKamil Rytarowskifi 6910e219c499SRichard Hendersonif test "$capstone" != "no" ; then 69118ca80760SRichard Henderson echo "CONFIG_CAPSTONE=y" >> $config_host_mak 69128ca80760SRichard Hendersonfi 6913ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 6914ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 6915ba59fb77SPaolo Bonzinifi 6916e0580342SKamil Rytarowski 69175c312079SDr. David Alan Gilbert# Hold two types of flag: 69185c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 69195c312079SDr. David Alan Gilbert# a thread we have a handle to 6920479a5747SRoman Bolshakov# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular 69215c312079SDr. David Alan Gilbert# platform 6922479a5747SRoman Bolshakovif test "$pthread_setname_np_w_tid" = "yes" ; then 69235c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 6924479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak 6925479a5747SRoman Bolshakovelif test "$pthread_setname_np_wo_tid" = "yes" ; then 6926479a5747SRoman Bolshakov echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 6927479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak 69285c312079SDr. David Alan Gilbertfi 69295c312079SDr. David Alan Gilbert 6930da92c3ffSAshish Mittalif test "$vxhs" = "yes" ; then 6931da92c3ffSAshish Mittal echo "CONFIG_VXHS=y" >> $config_host_mak 6932da92c3ffSAshish Mittal echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak 6933da92c3ffSAshish Mittalfi 6934da92c3ffSAshish Mittal 693517824406SJunyan Heif test "$libpmem" = "yes" ; then 693617824406SJunyan He echo "CONFIG_LIBPMEM=y" >> $config_host_mak 693717824406SJunyan Hefi 693817824406SJunyan He 69392f740136SJeff Codyif test "$bochs" = "yes" ; then 69402f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 69412f740136SJeff Codyfi 69422f740136SJeff Codyif test "$cloop" = "yes" ; then 69432f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 69442f740136SJeff Codyfi 69452f740136SJeff Codyif test "$dmg" = "yes" ; then 69462f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 69472f740136SJeff Codyfi 69482f740136SJeff Codyif test "$qcow1" = "yes" ; then 69492f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 69502f740136SJeff Codyfi 69512f740136SJeff Codyif test "$vdi" = "yes" ; then 69522f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 69532f740136SJeff Codyfi 69542f740136SJeff Codyif test "$vvfat" = "yes" ; then 69552f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 69562f740136SJeff Codyfi 69572f740136SJeff Codyif test "$qed" = "yes" ; then 69582f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 69592f740136SJeff Codyfi 69602f740136SJeff Codyif test "$parallels" = "yes" ; then 69612f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 69622f740136SJeff Codyfi 69632f740136SJeff Codyif test "$sheepdog" = "yes" ; then 69642f740136SJeff Cody echo "CONFIG_SHEEPDOG=y" >> $config_host_mak 69652f740136SJeff Codyfi 69662f740136SJeff Cody 69675b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 69689edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 69695b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 69709edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 69715b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 69729edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 6973e633a5c6SEric Blakeelif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then 69749edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 697540d964b5SRichard Hendersonelif test "$ARCH" = "ppc64" ; then 69769edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" 6977e633a5c6SEric Blakeelif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then 6978c4f80543SAlistair Francis QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES" 69795b5e3037SPaolo Bonzinielse 69809edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 69815b5e3037SPaolo Bonzinifi 69829edc19c9SMichael S. TsirkinQEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES" 69835b5e3037SPaolo Bonzini 698498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 698598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 6986804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 6987804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 69881901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 69891901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 69901901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 699121655882SPaolo Bonziniecho "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 6992c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 6993755ee70fSCleber Rosaecho "PYTHON_VERSION=$python_version" >> $config_host_mak 6994804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 6995a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 6996a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_host_mak 6997a31a8642SMichael S. Tsirkinfi 6998804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 699983f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 70003c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 7001804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 700245d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 7003cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 70045f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 70053dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 7006804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 7007804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 70089f81aeb5SAlistair Francisecho "RANLIB=$ranlib" >> $config_host_mak 70094852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 70109fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 7011e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 701246eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 7013a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 701411cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 7015f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 7016e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 7017e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 701880fd48dfSChristian Borntraeger echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak 70192944d742SGerd Hoffmann echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak 7020e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 7021e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 7022e39f0062SPaolo Bonzinifi 702342da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 702442da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 702542da6041SGerd Hoffmannelse 702642da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 702742da6041SGerd Hoffmannfi 7028e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 702946eef33bSBradecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 70308a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 70316969ec6cSJames Clarkeecho "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak 7032e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 703373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 70343e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 7035409437e1SDaniel P. Berrangeecho "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 7036804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 703717969268SFam Zhengecho "DSOSUF=$DSOSUF" >> $config_host_mak 703817969268SFam Zhengecho "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 7039957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 704090246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 704190246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 704294dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 70431d728c39SBlue Swirlif test "$gcov" = "yes" ; then 70441d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 70451d728c39SBlue Swirl echo "GCOV=$gcov_tool" >> $config_host_mak 70461d728c39SBlue Swirlfi 7047804edf29SJuan Quintela 704851a12b51SAlex Bennéeif test "$docker" != "no"; then 704951a12b51SAlex Bennée echo "HAVE_USER_DOCKER=y" >> $config_host_mak 705051a12b51SAlex Bennéefi 705151a12b51SAlex Bennée 70523efac6ebSTomáš Golembiovskýif test "$libudev" != "no"; then 70533efac6ebSTomáš Golembiovský echo "CONFIG_LIBUDEV=y" >> $config_host_mak 70543efac6ebSTomáš Golembiovský echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak 70553efac6ebSTomáš Golembiovskýfi 70563efac6ebSTomáš Golembiovský 70576efd7517SPeter Maydell# use included Linux headers 70586efd7517SPeter Maydellif test "$linux" = "yes" ; then 7059a307beb6SAndreas Färber mkdir -p linux-headers 70606efd7517SPeter Maydell case "$cpu" in 7061c72b26ecSRichard Henderson i386|x86_64|x32) 706208312a63SPeter Maydell linux_arch=x86 70636efd7517SPeter Maydell ;; 7064a69dc537SThomas Huth ppc|ppc64) 706508312a63SPeter Maydell linux_arch=powerpc 70666efd7517SPeter Maydell ;; 70676efd7517SPeter Maydell s390x) 706808312a63SPeter Maydell linux_arch=s390 706908312a63SPeter Maydell ;; 70701f080313SClaudio Fontana aarch64) 70711f080313SClaudio Fontana linux_arch=arm64 70721f080313SClaudio Fontana ;; 7073222e7d11SSanjay Lal mips64) 7074222e7d11SSanjay Lal linux_arch=mips 7075222e7d11SSanjay Lal ;; 707608312a63SPeter Maydell *) 707708312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 707808312a63SPeter Maydell linux_arch="$cpu" 70796efd7517SPeter Maydell ;; 70806efd7517SPeter Maydell esac 708108312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 708208312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 708308312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 708408312a63SPeter Maydell fi 70856efd7517SPeter Maydellfi 70866efd7517SPeter Maydell 708797a847bcSbellardfor target in $target_list; do 708897a847bcSbellardtarget_dir="$target" 708925be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 709089138857SStefan Weiltarget_name=$(echo $target | cut -d '-' -f 1) 709197a847bcSbellardtarget_bigendian="no" 70921f3d3c8fSJuan Quintela 7093c1799a84SPaolo Bonzinicase "$target_name" in 7094a69dc537SThomas Huth armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 7095ea2d6a39SJuan Quintela target_bigendian=yes 7096ea2d6a39SJuan Quintela ;; 7097ea2d6a39SJuan Quintelaesac 709897a847bcSbellardtarget_softmmu="no" 7099997344f3Sbellardtarget_user_only="no" 7100831b7825Sthstarget_linux_user="no" 710184778508Sblueswir1target_bsd_user="no" 71029e407a85Spbrookcase "$target" in 7103c1799a84SPaolo Bonzini ${target_name}-softmmu) 71049e407a85Spbrook target_softmmu="yes" 71059e407a85Spbrook ;; 7106c1799a84SPaolo Bonzini ${target_name}-linux-user) 71079e407a85Spbrook target_user_only="yes" 71089e407a85Spbrook target_linux_user="yes" 71099e407a85Spbrook ;; 7110c1799a84SPaolo Bonzini ${target_name}-bsd-user) 711184778508Sblueswir1 target_user_only="yes" 711284778508Sblueswir1 target_bsd_user="yes" 711384778508Sblueswir1 ;; 71149e407a85Spbrook *) 711576ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 71169e407a85Spbrook exit 1 71179e407a85Spbrook ;; 71189e407a85Spbrookesac 7119831b7825Sths 7120d75402b5SAlex Bennéetarget_compiler="" 7121d75402b5SAlex Bennéetarget_compiler_static="" 7122716a507cSAlex Bennéetarget_compiler_cflags="" 7123d75402b5SAlex Bennée 712497a847bcSbellardmkdir -p $target_dir 712525be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 712697a847bcSbellard 7127e5fe0c52Spbrookbflt="no" 7128ca759f9eSAlex Bennéemttcg="no" 712989138857SStefan Weilinterp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") 713056aebc89Spbrookgdb_xml_files="" 71317ba1e619Saliguori 7132c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 71336acff7daSJuan QuintelaTARGET_BASE_ARCH="" 7134e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 7135e73aae67SJuan Quintela 7136c1799a84SPaolo Bonzinicase "$target_name" in 71372408a527Saurel32 i386) 71380a7fa00aSEmilio G. Cota mttcg="yes" 71397b0f97baSDoug Gale gdb_xml_files="i386-32bit.xml" 7140d75402b5SAlex Bennée target_compiler=$cross_cc_i386 7141716a507cSAlex Bennée target_compiler_cflags=$cross_cc_ccflags_i386 71422408a527Saurel32 ;; 71432408a527Saurel32 x86_64) 71446acff7daSJuan Quintela TARGET_BASE_ARCH=i386 71450a7fa00aSEmilio G. Cota mttcg="yes" 71467b0f97baSDoug Gale gdb_xml_files="i386-64bit.xml" 7147d75402b5SAlex Bennée target_compiler=$cross_cc_x86_64 71482408a527Saurel32 ;; 71492408a527Saurel32 alpha) 71505ee4f3c2SRichard Henderson mttcg="yes" 7151d75402b5SAlex Bennée target_compiler=$cross_cc_alpha 71522408a527Saurel32 ;; 71532408a527Saurel32 arm|armeb) 7154b498c8a0SJuan Quintela TARGET_ARCH=arm 7155e5fe0c52Spbrook bflt="yes" 7156ca759f9eSAlex Bennée mttcg="yes" 715756aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 7158d75402b5SAlex Bennée target_compiler=$cross_cc_arm 7159d422b2bcSAlex Bennée eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" 71602408a527Saurel32 ;; 7161722dd7beSMichael Weiser aarch64|aarch64_be) 7162722dd7beSMichael Weiser TARGET_ARCH=aarch64 71636a49fa95SAlexander Graf TARGET_BASE_ARCH=arm 71646a49fa95SAlexander Graf bflt="yes" 7165ca759f9eSAlex Bennée mttcg="yes" 71668f95ce2eSPeter Maydell gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 7167d75402b5SAlex Bennée target_compiler=$cross_cc_aarch64 7168d422b2bcSAlex Bennée eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" 71696a49fa95SAlexander Graf ;; 71702408a527Saurel32 cris) 7171d75402b5SAlex Bennée target_compiler=$cross_cc_cris 71722408a527Saurel32 ;; 717361766fe9SRichard Henderson hppa) 71747b93dab5SRichard Henderson mttcg="yes" 7175d75402b5SAlex Bennée target_compiler=$cross_cc_hppa 717661766fe9SRichard Henderson ;; 7177613a22c9SMichael Walle lm32) 7178d75402b5SAlex Bennée target_compiler=$cross_cc_lm32 7179613a22c9SMichael Walle ;; 71802408a527Saurel32 m68k) 71810938cda5Saurel32 bflt="yes" 71825a4526b2SLaurent Vivier gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml" 7183d75402b5SAlex Bennée target_compiler=$cross_cc_m68k 71842408a527Saurel32 ;; 7185877fdc12SEdgar E. Iglesias microblaze|microblazeel) 7186877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 718772b675caSEdgar E. Iglesias bflt="yes" 7188be73ef64SEdgar E. Iglesias echo "TARGET_ABI32=y" >> $config_target_mak 7189d75402b5SAlex Bennée target_compiler=$cross_cc_microblaze 719072b675caSEdgar E. Iglesias ;; 71912408a527Saurel32 mips|mipsel) 7192b498c8a0SJuan Quintela TARGET_ARCH=mips 7193d75402b5SAlex Bennée target_compiler=$cross_cc_mips 719425be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 71952408a527Saurel32 ;; 71962408a527Saurel32 mipsn32|mipsn32el) 7197597e2cecSRichard Henderson TARGET_ARCH=mips64 71986acff7daSJuan Quintela TARGET_BASE_ARCH=mips 7199d75402b5SAlex Bennée target_compiler=$cross_cc_mipsn32 720025be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 7201597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 72022408a527Saurel32 ;; 72032408a527Saurel32 mips64|mips64el) 7204b498c8a0SJuan Quintela TARGET_ARCH=mips64 72056acff7daSJuan Quintela TARGET_BASE_ARCH=mips 7206d75402b5SAlex Bennée target_compiler=$cross_cc_mips64 720725be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 72082408a527Saurel32 ;; 7209d15a9c23SAnthony Green moxie) 7210d75402b5SAlex Bennée target_compiler=$cross_cc_moxie 7211d15a9c23SAnthony Green ;; 7212e671711cSMarek Vasut nios2) 7213d75402b5SAlex Bennée target_compiler=$cross_cc_nios2 7214e671711cSMarek Vasut ;; 72154a09d0bbSRichard Henderson or1k) 7216d75402b5SAlex Bennée target_compiler=$cross_cc_or1k 7217e67db06eSJia Liu TARGET_ARCH=openrisc 7218e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 7219e67db06eSJia Liu ;; 72202408a527Saurel32 ppc) 7221c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 7222d75402b5SAlex Bennée target_compiler=$cross_cc_powerpc 72232408a527Saurel32 ;; 72242408a527Saurel32 ppc64) 72256acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 7226e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 7227f0b0685dSNikunj A Dadhania mttcg=yes 72281438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7229d75402b5SAlex Bennée target_compiler=$cross_cc_ppc64 72302408a527Saurel32 ;; 72319c35126cSDoug Kwan ppc64le) 72329c35126cSDoug Kwan TARGET_ARCH=ppc64 72339c35126cSDoug Kwan TARGET_BASE_ARCH=ppc 72349c35126cSDoug Kwan TARGET_ABI_DIR=ppc 7235f0b0685dSNikunj A Dadhania mttcg=yes 72361438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7237d75402b5SAlex Bennée target_compiler=$cross_cc_ppc64le 72389c35126cSDoug Kwan ;; 72392408a527Saurel32 ppc64abi32) 7240b498c8a0SJuan Quintela TARGET_ARCH=ppc64 72416acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 7242e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 724325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 72441438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7245d75402b5SAlex Bennée target_compiler=$cross_cc_ppc64abi32 72462408a527Saurel32 ;; 724725fa194bSMichael Clark riscv32) 724825fa194bSMichael Clark TARGET_BASE_ARCH=riscv 724925fa194bSMichael Clark TARGET_ABI_DIR=riscv 725025fa194bSMichael Clark mttcg=yes 7251d75402b5SAlex Bennée target_compiler=$cross_cc_riscv32 725225fa194bSMichael Clark ;; 725325fa194bSMichael Clark riscv64) 725425fa194bSMichael Clark TARGET_BASE_ARCH=riscv 725525fa194bSMichael Clark TARGET_ABI_DIR=riscv 725625fa194bSMichael Clark mttcg=yes 7257d75402b5SAlex Bennée target_compiler=$cross_cc_riscv64 725825fa194bSMichael Clark ;; 72592408a527Saurel32 sh4|sh4eb) 7260b498c8a0SJuan Quintela TARGET_ARCH=sh4 72614dbed897Spbrook bflt="yes" 7262d75402b5SAlex Bennée target_compiler=$cross_cc_sh4 72632408a527Saurel32 ;; 72642408a527Saurel32 sparc) 7265d75402b5SAlex Bennée target_compiler=$cross_cc_sparc 72662408a527Saurel32 ;; 72672408a527Saurel32 sparc64) 72686acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 7269d75402b5SAlex Bennée target_compiler=$cross_cc_sparc64 72702408a527Saurel32 ;; 72712408a527Saurel32 sparc32plus) 7272b498c8a0SJuan Quintela TARGET_ARCH=sparc64 72736acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 7274e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 7275d75402b5SAlex Bennée target_compiler=$cross_cc_sparc32plus 727625be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 72772408a527Saurel32 ;; 727824e804ecSAlexander Graf s390x) 727963685bc4SDavid Hildenbrand mttcg=yes 728086158a2aSChristian Borntraeger gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml" 7281d75402b5SAlex Bennée target_compiler=$cross_cc_s390x 728224e804ecSAlexander Graf ;; 7283444e06b1SChen Gang tilegx) 7284d75402b5SAlex Bennée target_compiler=$cross_cc_tilegx 7285444e06b1SChen Gang ;; 72865ecaa4edSPeter Crosthwaite tricore) 7287d75402b5SAlex Bennée target_compiler=$cross_cc_tricore 72885ecaa4edSPeter Crosthwaite ;; 7289d2fbca94SGuan Xuetao unicore32) 7290d75402b5SAlex Bennée target_compiler=$cross_cc_unicore32 7291d2fbca94SGuan Xuetao ;; 7292cfa550c6SMax Filippov xtensa|xtensaeb) 7293cfa550c6SMax Filippov TARGET_ARCH=xtensa 729402e33e9fSMax Filippov bflt="yes" 72959fb40342SMax Filippov mttcg="yes" 7296d75402b5SAlex Bennée target_compiler=$cross_cc_xtensa 7297cfa550c6SMax Filippov ;; 72982408a527Saurel32 *) 729976ad07a4SPeter Maydell error_exit "Unsupported target CPU" 73002408a527Saurel32 ;; 73012408a527Saurel32esac 73025e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 73035e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 73045e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 73055e8861a0SPaolo Bonzinifi 73065e8861a0SPaolo Bonzini 7307d75402b5SAlex Bennée# Do we have a cross compiler for this target? 7308d75402b5SAlex Bennéeif has $target_compiler; then 7309d75402b5SAlex Bennée 7310d75402b5SAlex Bennée write_c_skeleton 7311d75402b5SAlex Bennée 7312716a507cSAlex Bennée if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC -static ; then 7313d75402b5SAlex Bennée # For host systems we might get away with building without -static 7314716a507cSAlex Bennée if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC ; then 7315d75402b5SAlex Bennée target_compiler="" 7316d75402b5SAlex Bennée else 7317d75402b5SAlex Bennée enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'" 7318d75402b5SAlex Bennée target_compiler_static="n" 7319d75402b5SAlex Bennée fi 7320d75402b5SAlex Bennée else 7321d75402b5SAlex Bennée enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'" 7322d75402b5SAlex Bennée target_compiler_static="y" 7323d75402b5SAlex Bennée fi 7324d75402b5SAlex Bennéeelse 7325d75402b5SAlex Bennée target_compiler="" 7326d75402b5SAlex Bennéefi 7327d75402b5SAlex Bennée 73285e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 73295e8861a0SPaolo Bonzini 733099afc91dSDaniel P. Berrangeupper() { 733199afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 733299afc91dSDaniel P. Berrange} 733399afc91dSDaniel P. Berrange 733489138857SStefan Weiltarget_arch_name="$(upper $TARGET_ARCH)" 733525be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 7336c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 733725be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 7338e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 7339e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 7340e6e91b9cSJuan Quintelafi 734125be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 7342adfc3e91SStacey Sonif [ "$HOST_VARIANT_DIR" != "" ]; then 7343adfc3e91SStacey Son echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 7344adfc3e91SStacey Sonfi 73453b6b7550SPaolo Bonzini 73463b6b7550SPaolo Bonziniif supported_xen_target $target; then 734725be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 7348eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 7349eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 7350eb6fda0fSAnthony PERARD fi 7351432d268cSJun Nakajimafi 73523b6b7550SPaolo Bonziniif supported_kvm_target $target; then 735325be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 73541ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 7355d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 7356e6a74868SMarc-André Lureau if test "$vhost_user" = "yes" ; then 7357e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak 7358e6a74868SMarc-André Lureau fi 7359d5970055SMichael S. Tsirkin fi 7360c59249f9SJuan Quintelafi 73613b6b7550SPaolo Bonziniif supported_hax_target $target; then 7362b0cb0a66SVincent Palatin echo "CONFIG_HAX=y" >> $config_target_mak 7363b0cb0a66SVincent Palatinfi 7364c97d6d2cSSergio Andres Gomez Del Realif supported_hvf_target $target; then 7365c97d6d2cSSergio Andres Gomez Del Real echo "CONFIG_HVF=y" >> $config_target_mak 7366c97d6d2cSSergio Andres Gomez Del Realfi 7367d661d9a4SJustin Terry (VM)if supported_whpx_target $target; then 7368d661d9a4SJustin Terry (VM) echo "CONFIG_WHPX=y" >> $config_target_mak 7369d661d9a4SJustin Terry (VM)fi 7370de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 737125be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 737297a847bcSbellardfi 737397a847bcSbellardif test "$target_softmmu" = "yes" ; then 737425be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 7375ca759f9eSAlex Bennée if test "$mttcg" = "yes" ; then 7376ca759f9eSAlex Bennée echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak 7377ca759f9eSAlex Bennée fi 7378de83cd02Sbellardfi 7379997344f3Sbellardif test "$target_user_only" = "yes" ; then 738025be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 7381a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 7382997344f3Sbellardfi 7383831b7825Sthsif test "$target_linux_user" = "yes" ; then 738425be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 7385831b7825Sthsfi 738656aebc89Spbrooklist="" 738756aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 738856aebc89Spbrook for x in $gdb_xml_files; do 738956aebc89Spbrook list="$list $source_path/gdb-xml/$x" 739056aebc89Spbrook done 739125be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 73923d0f1517SJuan Quintelafi 7393de83cd02Sbellard 7394e633a5c6SEric Blakeif test "$target_user_only" = "yes" && test "$bflt" = "yes"; then 739525be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 7396e5fe0c52Spbrookfi 739784778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 739825be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 739984778508Sblueswir1fi 74005b0753e0Sbellard 7401d75402b5SAlex Bennéeif test -n "$target_compiler"; then 7402d75402b5SAlex Bennée echo "CROSS_CC_GUEST=\"$target_compiler\"" >> $config_target_mak 7403d75402b5SAlex Bennée 7404d75402b5SAlex Bennée if test -n "$target_compiler_static"; then 7405d75402b5SAlex Bennée echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak 7406d75402b5SAlex Bennée fi 7407716a507cSAlex Bennée 7408716a507cSAlex Bennée if test -n "$target_compiler_cflags"; then 7409716a507cSAlex Bennée echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak 7410d75402b5SAlex Bennée fi 7411716a507cSAlex Bennéefi 7412716a507cSAlex Bennée 7413d75402b5SAlex Bennée 74144afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 7415fa282484SJuan Quintela 74164afddb55SJuan Quintelacflags="" 7417fa282484SJuan Quintelaldflags="" 74189b8e111fSJuan Quintela 7419c765fcacSPeter Crosthwaitedisas_config() { 7420c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> $config_target_mak 7421c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak 7422c765fcacSPeter Crosthwaite} 7423c765fcacSPeter Crosthwaite 742464656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 742564656024SJuan Quintela case "$i" in 742664656024SJuan Quintela alpha) 7427c765fcacSPeter Crosthwaite disas_config "ALPHA" 742864656024SJuan Quintela ;; 742982295d8aSRichard Henderson aarch64) 743082295d8aSRichard Henderson if test -n "${cxx}"; then 7431c765fcacSPeter Crosthwaite disas_config "ARM_A64" 743282295d8aSRichard Henderson fi 743382295d8aSRichard Henderson ;; 743464656024SJuan Quintela arm) 7435c765fcacSPeter Crosthwaite disas_config "ARM" 7436999b53ecSClaudio Fontana if test -n "${cxx}"; then 7437c765fcacSPeter Crosthwaite disas_config "ARM_A64" 7438999b53ecSClaudio Fontana fi 743964656024SJuan Quintela ;; 744064656024SJuan Quintela cris) 7441c765fcacSPeter Crosthwaite disas_config "CRIS" 744264656024SJuan Quintela ;; 7443429b31a2SRichard Henderson hppa) 7444429b31a2SRichard Henderson disas_config "HPPA" 7445429b31a2SRichard Henderson ;; 7446c72b26ecSRichard Henderson i386|x86_64|x32) 7447c765fcacSPeter Crosthwaite disas_config "I386" 744864656024SJuan Quintela ;; 744979368f49SMichael Walle lm32) 7450c765fcacSPeter Crosthwaite disas_config "LM32" 745179368f49SMichael Walle ;; 745264656024SJuan Quintela m68k) 7453c765fcacSPeter Crosthwaite disas_config "M68K" 745464656024SJuan Quintela ;; 7455877fdc12SEdgar E. Iglesias microblaze*) 7456c765fcacSPeter Crosthwaite disas_config "MICROBLAZE" 745764656024SJuan Quintela ;; 745864656024SJuan Quintela mips*) 7459c765fcacSPeter Crosthwaite disas_config "MIPS" 746089a955e8SAleksandar Markovic if test -n "${cxx}"; then 746189a955e8SAleksandar Markovic disas_config "NANOMIPS" 746289a955e8SAleksandar Markovic fi 746364656024SJuan Quintela ;; 7464d15a9c23SAnthony Green moxie*) 7465c765fcacSPeter Crosthwaite disas_config "MOXIE" 7466d15a9c23SAnthony Green ;; 7467e671711cSMarek Vasut nios2) 7468e671711cSMarek Vasut disas_config "NIOS2" 7469e671711cSMarek Vasut ;; 74704a09d0bbSRichard Henderson or1k) 7471c765fcacSPeter Crosthwaite disas_config "OPENRISC" 7472e67db06eSJia Liu ;; 747364656024SJuan Quintela ppc*) 7474c765fcacSPeter Crosthwaite disas_config "PPC" 747564656024SJuan Quintela ;; 7476c4f80543SAlistair Francis riscv*) 747725fa194bSMichael Clark disas_config "RISCV" 747825fa194bSMichael Clark ;; 747924e804ecSAlexander Graf s390*) 7480c765fcacSPeter Crosthwaite disas_config "S390" 748164656024SJuan Quintela ;; 748264656024SJuan Quintela sh4) 7483c765fcacSPeter Crosthwaite disas_config "SH4" 748464656024SJuan Quintela ;; 748564656024SJuan Quintela sparc*) 7486c765fcacSPeter Crosthwaite disas_config "SPARC" 748764656024SJuan Quintela ;; 7488cfa550c6SMax Filippov xtensa*) 7489c765fcacSPeter Crosthwaite disas_config "XTENSA" 7490cfa550c6SMax Filippov ;; 749164656024SJuan Quintela esac 749264656024SJuan Quinteladone 74939195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 7494c765fcacSPeter Crosthwaite disas_config "TCI" 74959195b2c2SStefan Weilfi 749664656024SJuan Quintela 74976ee7126fSJuan Quintelacase "$ARCH" in 74986ee7126fSJuan Quintelaalpha) 74996ee7126fSJuan Quintela # Ensure there's only a single GP 75006ee7126fSJuan Quintela cflags="-msmall-data $cflags" 75016ee7126fSJuan Quintela;; 75026ee7126fSJuan Quintelaesac 75036ee7126fSJuan Quintela 7504d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 75050acf7dedSPhilippe Mathieu-Daudé echo "TARGET_GPROF=y" >> $config_target_mak 7506d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 7507d02c1db3SJuan Quintela cflags="-p $cflags" 7508d02c1db3SJuan Quintela ldflags="-p $ldflags" 7509d02c1db3SJuan Quintela fi 7510d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 7511d02c1db3SJuan Quintela ldflags="-p $ldflags" 751225be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 7513d02c1db3SJuan Quintela fi 7514d02c1db3SJuan Quintelafi 7515d02c1db3SJuan Quintela 7516e633a5c6SEric Blakeif test "$target_linux_user" = "yes" || test "$target_bsd_user" = "yes" ; then 7517964c6fa1SRichard Henderson ldflags="$ldflags $textseg_ldflags" 7518fa282484SJuan Quintelafi 7519fa282484SJuan Quintela 7520e9a3591fSChristian Borntraeger# Newer kernels on s390 check for an S390_PGSTE program header and 7521e9a3591fSChristian Borntraeger# enable the pgste page table extensions in that case. This makes 7522e9a3591fSChristian Borntraeger# the vm.allocate_pgste sysctl unnecessary. We enable this program 7523e9a3591fSChristian Borntraeger# header if 7524e9a3591fSChristian Borntraeger# - we build on s390x 7525e9a3591fSChristian Borntraeger# - we build the system emulation for s390x (qemu-system-s390x) 7526e9a3591fSChristian Borntraeger# - KVM is enabled 7527e9a3591fSChristian Borntraeger# - the linker supports --s390-pgste 7528e633a5c6SEric Blakeif test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \ 7529e633a5c6SEric Blake test "$ARCH" = "s390x" && test "$kvm" = "yes"; then 7530e9a3591fSChristian Borntraeger if ld_has --s390-pgste ; then 7531e9a3591fSChristian Borntraeger ldflags="-Wl,--s390-pgste $ldflags" 7532e9a3591fSChristian Borntraeger fi 7533e9a3591fSChristian Borntraegerfi 7534e9a3591fSChristian Borntraeger 753525be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 753625be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 7537fa282484SJuan Quintela 753897a847bcSbellarddone # for target in $targets 75397d13299dSbellard 7540d75402b5SAlex Bennéeif test -n "$enabled_cross_compilers"; then 7541d75402b5SAlex Bennée echo 7542d75402b5SAlex Bennée echo "NOTE: cross-compilers enabled: $enabled_cross_compilers" 7543d75402b5SAlex Bennéefi 7544d75402b5SAlex Bennée 7545e3971d61SPhilippe Mathieu-Daudéif [ "$fdt" = "git" ]; then 7546a540f158SPeter Crosthwaite echo "config-host.h: subdir-dtc" >> $config_host_mak 7547a540f158SPeter Crosthwaitefi 7548e219c499SRichard Hendersonif [ "$capstone" = "git" -o "$capstone" = "internal" ]; then 7549e219c499SRichard Henderson echo "config-host.h: subdir-capstone" >> $config_host_mak 7550e219c499SRichard Hendersonfi 7551e219c499SRichard Hendersonif test -n "$LIBCAPSTONE"; then 7552e219c499SRichard Henderson echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak 7553e219c499SRichard Hendersonfi 7554a540f158SPeter Crosthwaite 7555a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 7556a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 7557a99d57bbSWanlong Gaofi 7558a99d57bbSWanlong Gao 7559fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 7560fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 7561fd0e6053SJohn Snowfi 7562fd0e6053SJohn Snow 7563e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 7564e29e5c6eSPeter Maydell# DIRS are directories which we simply mkdir in the build tree; 7565e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 7566e29e5c6eSPeter Maydell# (these can be both files and directories). 7567e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 7568e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 7569e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 7570e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 7571e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 7572e29e5c6eSPeter Maydell# directory and symlink the directory instead. 7573b1fb9a63SFam ZhengDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" 75743ac1f813SEmilio G. CotaDIRS="$DIRS tests/fp" 7575b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 75769933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" 75772d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 7578e29e5c6eSPeter MaydellLINKS="Makefile tests/tcg/Makefile qdict-test-data.txt" 7579e29e5c6eSPeter MaydellLINKS="$LINKS tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 7580e29e5c6eSPeter MaydellLINKS="$LINKS tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" 7581e29e5c6eSPeter MaydellLINKS="$LINKS tests/fp/Makefile" 7582e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" 7583e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/spapr-rtas/Makefile" 7584e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 7585e29e5c6eSPeter MaydellLINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" 7586e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 7587e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 758839950353SPeter MaydellLINKS="$LINKS tests/acceptance tests/data" 758939950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 7590753d11f2SRichard Hendersonfor bios_file in \ 7591753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 7592225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 75935acc2ec0SGerd Hoffmann $source_path/pc-bios/*.aml \ 7594753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 7595753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 7596e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 7597753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 75984e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 7599753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 7600753d11f2SRichard Hendersondo 7601e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 76027ea78b74SJan Kiszkadone 7603d1807a4fSPaolo Bonzinimkdir -p $DIRS 7604e29e5c6eSPeter Maydellfor f in $LINKS ; do 7605cab00a5aSMichael S. Tsirkin if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then 7606f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 7607f9245e10SPeter Maydell fi 76087d13299dSbellarddone 76091ad2134fSPaul Brook 7610c34ebfdcSAnthony Liguori# temporary config to build submodules 76112d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 7612c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 761337116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 7614c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 7615cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 76165f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 7617c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 7618c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 76193dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 7620c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 7621a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 7622c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 76239f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 7624c34ebfdcSAnthony Liguoridone 7625c34ebfdcSAnthony Liguori 762676c7560aSMax Reitz# set up qemu-iotests in this build directory 762776c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 762876c7560aSMax Reitz 762976c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 763076c7560aSMax Reitzecho >> "$iotests_common_env" 763176c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 763276c7560aSMax Reitz 7633dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 7634dc655404SMichael S. Tsirkincat <<EOD >config.status 7635dc655404SMichael S. Tsirkin#!/bin/sh 7636dc655404SMichael S. Tsirkin# Generated by configure. 7637dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 7638dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 7639dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 7640dc655404SMichael S. TsirkinEOD 7641e811da7fSDaniel P. Berrangé 7642e811da7fSDaniel P. Berrangépreserve_env() { 7643e811da7fSDaniel P. Berrangé envname=$1 7644e811da7fSDaniel P. Berrangé 7645e811da7fSDaniel P. Berrangé eval envval=\$$envname 7646e811da7fSDaniel P. Berrangé 7647e811da7fSDaniel P. Berrangé if test -n "$envval" 7648e811da7fSDaniel P. Berrangé then 7649e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 7650e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 7651e811da7fSDaniel P. Berrangé else 7652e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 7653e811da7fSDaniel P. Berrangé fi 7654e811da7fSDaniel P. Berrangé} 7655e811da7fSDaniel P. Berrangé 7656e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 7657e811da7fSDaniel P. Berrangé# features/build target configure will detect 7658e811da7fSDaniel P. Berrangépreserve_env AR 7659e811da7fSDaniel P. Berrangépreserve_env AS 7660e811da7fSDaniel P. Berrangépreserve_env CC 7661e811da7fSDaniel P. Berrangépreserve_env CPP 7662e811da7fSDaniel P. Berrangépreserve_env CXX 7663e811da7fSDaniel P. Berrangépreserve_env INSTALL 7664e811da7fSDaniel P. Berrangépreserve_env LD 7665e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 7666e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 7667e811da7fSDaniel P. Berrangépreserve_env MAKE 7668e811da7fSDaniel P. Berrangépreserve_env NM 7669e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 7670e811da7fSDaniel P. Berrangépreserve_env PATH 7671e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 7672e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 7673e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 7674e811da7fSDaniel P. Berrangépreserve_env PYTHON 7675e811da7fSDaniel P. Berrangépreserve_env SDL_CONFIG 7676e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 7677e811da7fSDaniel P. Berrangépreserve_env SMBD 7678e811da7fSDaniel P. Berrangépreserve_env STRIP 7679e811da7fSDaniel P. Berrangépreserve_env WINDRES 7680e811da7fSDaniel P. Berrangé 7681dc655404SMichael S. Tsirkinprintf "exec" >>config.status 7682dc655404SMichael S. Tsirkinprintf " '%s'" "$0" "$@" >>config.status 7683cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 7684dc655404SMichael S. Tsirkinchmod +x config.status 7685dc655404SMichael S. Tsirkin 76868cd05ab6SPeter Maydellrm -r "$TMPDIR1" 7687