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 ;; 1109c83ffd8SPeter Maydell *) 1119c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1129c83ffd8SPeter Maydell ;; 1139c83ffd8SPeter Maydell esac 1149c83ffd8SPeter Maydell done 1159c83ffd8SPeter Maydell} 1169c83ffd8SPeter Maydell 11752166aa0SJuan Quintelacompile_object() { 118fd0e6053SJohn Snow local_cflags="$1" 119fd0e6053SJohn Snow do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 12052166aa0SJuan Quintela} 12152166aa0SJuan Quintela 12252166aa0SJuan Quintelacompile_prog() { 12352166aa0SJuan Quintela local_cflags="$1" 12452166aa0SJuan Quintela local_ldflags="$2" 1258dc38a78SPeter Maydell do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags 12652166aa0SJuan Quintela} 12752166aa0SJuan Quintela 12811568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 12911568d6dSPaolo Bonzinisymlink() { 13072b8b5a1SStefan Weil rm -rf "$2" 131ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 13272b8b5a1SStefan Weil ln -s "$1" "$2" 13311568d6dSPaolo Bonzini} 13411568d6dSPaolo Bonzini 1350dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1360dba6195SLoïc Minier# executable or a builtin) 1370dba6195SLoïc Minierhas() { 1380dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1390dba6195SLoïc Minier} 1400dba6195SLoïc Minier 1410dba6195SLoïc Minier# search for an executable in PATH 1420dba6195SLoïc Minierpath_of() { 1430dba6195SLoïc Minier local_command="$1" 1440dba6195SLoïc Minier local_ifs="$IFS" 1450dba6195SLoïc Minier local_dir="" 1460dba6195SLoïc Minier 1470dba6195SLoïc Minier # pathname has a dir component? 1480dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 1490dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 1500dba6195SLoïc Minier echo "$local_command" 1510dba6195SLoïc Minier return 0 1520dba6195SLoïc Minier fi 1530dba6195SLoïc Minier fi 1540dba6195SLoïc Minier if [ -z "$local_command" ]; then 1550dba6195SLoïc Minier return 1 1560dba6195SLoïc Minier fi 1570dba6195SLoïc Minier 1580dba6195SLoïc Minier IFS=: 1590dba6195SLoïc Minier for local_dir in $PATH; do 1600dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 1610dba6195SLoïc Minier echo "$local_dir/$local_command" 1620dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1630dba6195SLoïc Minier return 0 1640dba6195SLoïc Minier fi 1650dba6195SLoïc Minier done 1660dba6195SLoïc Minier # not found 1670dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1680dba6195SLoïc Minier return 1 1690dba6195SLoïc Minier} 1700dba6195SLoïc Minier 1715b808275SLluís Vilanovahave_backend () { 1725b808275SLluís Vilanova echo "$trace_backends" | grep "$1" >/dev/null 1735b808275SLluís Vilanova} 1745b808275SLluís Vilanova 1753b6b7550SPaolo Bonziniglob() { 1763b6b7550SPaolo Bonzini eval test -z '"${1#'"$2"'}"' 1773b6b7550SPaolo Bonzini} 1783b6b7550SPaolo Bonzini 1793b6b7550SPaolo Bonzinisupported_hax_target() { 1803b6b7550SPaolo Bonzini test "$hax" = "yes" || return 1 1813b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 1823b6b7550SPaolo Bonzini case "${1%-softmmu}" in 1833b6b7550SPaolo Bonzini i386|x86_64) 1843b6b7550SPaolo Bonzini return 0 1853b6b7550SPaolo Bonzini ;; 1863b6b7550SPaolo Bonzini esac 1873b6b7550SPaolo Bonzini return 1 1883b6b7550SPaolo Bonzini} 1893b6b7550SPaolo Bonzini 1903b6b7550SPaolo Bonzinisupported_kvm_target() { 1913b6b7550SPaolo Bonzini test "$kvm" = "yes" || return 1 1923b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 1933b6b7550SPaolo Bonzini case "${1%-softmmu}:$cpu" in 1943b6b7550SPaolo Bonzini arm:arm | aarch64:aarch64 | \ 1953b6b7550SPaolo Bonzini i386:i386 | i386:x86_64 | i386:x32 | \ 1963b6b7550SPaolo Bonzini x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ 1973b6b7550SPaolo Bonzini mips:mips | mipsel:mips | \ 198a69dc537SThomas Huth ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | \ 1993b6b7550SPaolo Bonzini s390x:s390x) 2003b6b7550SPaolo Bonzini return 0 2013b6b7550SPaolo Bonzini ;; 2023b6b7550SPaolo Bonzini esac 2033b6b7550SPaolo Bonzini return 1 2043b6b7550SPaolo Bonzini} 2053b6b7550SPaolo Bonzini 2063b6b7550SPaolo Bonzinisupported_xen_target() { 2073b6b7550SPaolo Bonzini test "$xen" = "yes" || return 1 2083b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 209b5ed2e11SPaolo Bonzini # Only i386 and x86_64 provide the xenpv machine. 210b5ed2e11SPaolo Bonzini case "${1%-softmmu}" in 211b5ed2e11SPaolo Bonzini i386|x86_64) 2123b6b7550SPaolo Bonzini return 0 2133b6b7550SPaolo Bonzini ;; 2143b6b7550SPaolo Bonzini esac 2153b6b7550SPaolo Bonzini return 1 2163b6b7550SPaolo Bonzini} 2173b6b7550SPaolo Bonzini 218c97d6d2cSSergio Andres Gomez Del Realsupported_hvf_target() { 219c97d6d2cSSergio Andres Gomez Del Real test "$hvf" = "yes" || return 1 220c97d6d2cSSergio Andres Gomez Del Real glob "$1" "*-softmmu" || return 1 221c97d6d2cSSergio Andres Gomez Del Real case "${1%-softmmu}" in 222c97d6d2cSSergio Andres Gomez Del Real x86_64) 223c97d6d2cSSergio Andres Gomez Del Real return 0 224c97d6d2cSSergio Andres Gomez Del Real ;; 225c97d6d2cSSergio Andres Gomez Del Real esac 226c97d6d2cSSergio Andres Gomez Del Real return 1 227c97d6d2cSSergio Andres Gomez Del Real} 228c97d6d2cSSergio Andres Gomez Del Real 229d661d9a4SJustin Terry (VM)supported_whpx_target() { 230d661d9a4SJustin Terry (VM) test "$whpx" = "yes" || return 1 231d661d9a4SJustin Terry (VM) glob "$1" "*-softmmu" || return 1 232d661d9a4SJustin Terry (VM) case "${1%-softmmu}" in 233d661d9a4SJustin Terry (VM) i386|x86_64) 234d661d9a4SJustin Terry (VM) return 0 235d661d9a4SJustin Terry (VM) ;; 236d661d9a4SJustin Terry (VM) esac 237d661d9a4SJustin Terry (VM) return 1 238d661d9a4SJustin Terry (VM)} 239d661d9a4SJustin Terry (VM) 240d880a3baSPaolo Bonzinisupported_target() { 241d880a3baSPaolo Bonzini case "$1" in 242d880a3baSPaolo Bonzini *-softmmu) 243d880a3baSPaolo Bonzini ;; 244d880a3baSPaolo Bonzini *-linux-user) 245d880a3baSPaolo Bonzini if test "$linux" != "yes"; then 246d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a Linux host" 247d880a3baSPaolo Bonzini return 1 248d880a3baSPaolo Bonzini fi 249d880a3baSPaolo Bonzini ;; 250d880a3baSPaolo Bonzini *-bsd-user) 251d880a3baSPaolo Bonzini if test "$bsd" != "yes"; then 252d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a BSD host" 253d880a3baSPaolo Bonzini return 1 254d880a3baSPaolo Bonzini fi 255d880a3baSPaolo Bonzini ;; 256d880a3baSPaolo Bonzini *) 257d880a3baSPaolo Bonzini print_error "Invalid target name '$target'" 258d880a3baSPaolo Bonzini return 1 259d880a3baSPaolo Bonzini ;; 260d880a3baSPaolo Bonzini esac 261b3f6ea7eSPaolo Bonzini test "$tcg" = "yes" && return 0 262b3f6ea7eSPaolo Bonzini supported_kvm_target "$1" && return 0 263b3f6ea7eSPaolo Bonzini supported_xen_target "$1" && return 0 264b3f6ea7eSPaolo Bonzini supported_hax_target "$1" && return 0 265c97d6d2cSSergio Andres Gomez Del Real supported_hvf_target "$1" && return 0 266d661d9a4SJustin Terry (VM) supported_whpx_target "$1" && return 0 267b3f6ea7eSPaolo Bonzini print_error "TCG disabled, but hardware accelerator not available for '$target'" 268b3f6ea7eSPaolo Bonzini return 1 269d880a3baSPaolo Bonzini} 270d880a3baSPaolo Bonzini 271e9a3591fSChristian Borntraeger 272e9a3591fSChristian Borntraegerld_has() { 273e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 274e9a3591fSChristian Borntraeger} 275e9a3591fSChristian Borntraeger 2767d13299dSbellard# default parameters 27789138857SStefan Weilsource_path=$(dirname "$0") 2782ff6b91eSJuan Quintelacpu="" 279a31a8642SMichael S. Tsirkiniasl="iasl" 2801e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 28143ce4dfeSbellardstatic="no" 2827d13299dSbellardcross_prefix="" 2830c58ac1cSmalcaudio_drv_list="" 284b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 285b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 286e49d021eSPeter Maydellhost_cc="cc" 28773da375eSJuan Quintelalibs_softmmu="" 2883e2e0e6bSJuan Quintelalibs_tools="" 28967f86e8eSJuan Quintelaaudio_pt_int="" 290d5631638Smalcaudio_win_int="" 291957f1f99SMichael Rothlibs_qga="" 2925bc62e01SGerd Hoffmanndebug_info="yes" 29363678e17SSteven Noonanstack_protector="" 294ac0df51dSaliguori 29592712822SDaniel P. Berrangeif test -e "$source_path/.git" 29692712822SDaniel P. Berrangethen 297f62bbee5SDaniel P. Berrange git_update=yes 29892712822SDaniel P. Berrange git_submodules="ui/keycodemapdb" 2993ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 3003ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 30192712822SDaniel P. Berrangeelse 302f62bbee5SDaniel P. Berrange git_update=no 303aef45d51SDaniel P. Berrange git_submodules="" 3045c0ef67aSDaniel P. Berrangé 3055c0ef67aSDaniel P. Berrangé if ! test -f "$source_path/ui/keycodemapdb/README" 3065c0ef67aSDaniel P. Berrangé then 3075c0ef67aSDaniel P. Berrangé echo 3085c0ef67aSDaniel P. Berrangé echo "ERROR: missing file $source_path/ui/keycodemapdb/README" 3095c0ef67aSDaniel P. Berrangé echo 3105c0ef67aSDaniel P. Berrangé echo "This is not a GIT checkout but module content appears to" 3115c0ef67aSDaniel P. Berrangé echo "be missing. Do not use 'git archive' or GitHub download links" 3125c0ef67aSDaniel P. Berrangé echo "to acquire QEMU source archives. Non-GIT builds are only" 3135c0ef67aSDaniel P. Berrangé echo "supported with source archives linked from:" 3145c0ef67aSDaniel P. Berrangé echo 3155c0ef67aSDaniel P. Berrangé echo " https://www.qemu.org/download/" 3165c0ef67aSDaniel P. Berrangé echo 3175c0ef67aSDaniel P. Berrangé echo "Developers working with GIT can use scripts/archive-source.sh" 3185c0ef67aSDaniel P. Berrangé echo "if they need to create valid source archives." 3195c0ef67aSDaniel P. Berrangé echo 3205c0ef67aSDaniel P. Berrangé exit 1 3215c0ef67aSDaniel P. Berrangé fi 32292712822SDaniel P. Berrangefi 323cc84d63aSDaniel P. Berrangegit="git" 324ac0df51dSaliguori 325afb63ebdSStefan Weil# Don't accept a target_list environment variable. 326afb63ebdSStefan Weilunset target_list 327377529c0SPaolo Bonzini 328377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 329377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 330377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 331377529c0SPaolo Bonzini# unless --disable-foo is given 332377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 333377529c0SPaolo Bonzini# feature will searched for, 334377529c0SPaolo Bonzini# if not found, configure exits with error 335377529c0SPaolo Bonzini# 336377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 337377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 338377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 339377529c0SPaolo Bonzini 340377529c0SPaolo Bonzinibluez="" 341377529c0SPaolo Bonzinibrlapi="" 342377529c0SPaolo Bonzinicurl="" 343377529c0SPaolo Bonzinicurses="" 344377529c0SPaolo Bonzinidocs="" 345377529c0SPaolo Bonzinifdt="" 34658952137SVincenzo Maffionenetmap="no" 347377529c0SPaolo Bonzinisdl="" 348ee8466d0SCole Robinsonsdlabi="" 349983eef5aSMeador Ingevirtfs="" 350fe8fc5aeSPaolo Bonzinimpath="" 351821601eaSJes Sorensenvnc="yes" 352377529c0SPaolo Bonzinisparse="no" 353377529c0SPaolo Bonzinivde="" 354377529c0SPaolo Bonzinivnc_sasl="" 355377529c0SPaolo Bonzinivnc_jpeg="" 356377529c0SPaolo Bonzinivnc_png="" 3576a021536SGerd Hoffmannxkbcommon="" 358377529c0SPaolo Bonzinixen="" 359d5b93ddfSAnthony PERARDxen_ctrl_version="" 36064a7ad6fSIan Campbellxen_pv_domain_build="no" 361eb6fda0fSAnthony PERARDxen_pci_passthrough="" 362377529c0SPaolo Bonzinilinux_aio="" 36347e98658SCorey Bryantcap_ng="" 364377529c0SPaolo Bonziniattr="" 3654f26f2b6SAvi Kivitylibattr="" 366377529c0SPaolo Bonzinixfs="" 367b3f6ea7eSPaolo Bonzinitcg="yes" 368a40161cbSPaolo Bonzinimembarrier="" 369d41a75a2SBradvhost_net="no" 370042cea27SGongleivhost_crypto="no" 3715e9be92dSNicholas Bellingervhost_scsi="no" 372fc0b9b0eSStefan Hajnoczivhost_vsock="no" 373e6a74868SMarc-André Lureauvhost_user="" 374d41a75a2SBradkvm="no" 375b0cb0a66SVincent Palatinhax="no" 376c97d6d2cSSergio Andres Gomez Del Realhvf="no" 377d661d9a4SJustin Terry (VM)whpx="no" 3782da776dbSMichael R. Hinesrdma="" 37921ab34c9SMarcel Apfelbaumpvrdma="" 380377529c0SPaolo Bonzinigprof="no" 381377529c0SPaolo Bonzinidebug_tcg="no" 382377529c0SPaolo Bonzinidebug="no" 383247724cbSMarc-André Lureausanitizers="no" 384b553a042SJohn Snowfortify_source="" 385377529c0SPaolo Bonzinistrip_opt="yes" 3869195b2c2SStefan Weiltcg_interpreter="no" 387377529c0SPaolo Bonzinibigendian="no" 388377529c0SPaolo Bonzinimingw32="no" 3891d728c39SBlue Swirlgcov="no" 3901d728c39SBlue Swirlgcov_tool="gcov" 391377529c0SPaolo BonziniEXESUF="" 39217969268SFam ZhengDSOSUF=".so" 39317969268SFam ZhengLDFLAGS_SHARED="-shared" 39417969268SFam Zhengmodules="no" 395377529c0SPaolo Bonziniprefix="/usr/local" 396377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 397528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 3983d5eecabSGerd Hoffmannfirmwarepath="\${prefix}/share/qemu-firmware" 399850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 400377529c0SPaolo Bonzinibindir="\${prefix}/bin" 4013aa5d2beSAlon Levylibdir="\${prefix}/lib" 4028bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 4030f94d6daSAlon Levyincludedir="\${prefix}/include" 404377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 405785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 406377529c0SPaolo Bonziniconfsuffix="/qemu" 407377529c0SPaolo Bonzinislirp="yes" 408377529c0SPaolo Bonzinioss_lib="" 409377529c0SPaolo Bonzinibsd="no" 410377529c0SPaolo Bonzinilinux="no" 411377529c0SPaolo Bonzinisolaris="no" 412377529c0SPaolo Bonziniprofiler="no" 413377529c0SPaolo Bonzinicocoa="no" 414377529c0SPaolo Bonzinisoftmmu="yes" 415377529c0SPaolo Bonzinilinux_user="no" 416377529c0SPaolo Bonzinibsd_user="no" 417377529c0SPaolo Bonziniblobs="yes" 418377529c0SPaolo Bonzinipkgversion="" 41940d6444eSAvi Kivitypie="" 4203556c233SPaolo Bonziniqom_cast_debug="yes" 421baf86d6bSPaolo Bonzinitrace_backends="log" 422377529c0SPaolo Bonzinitrace_file="trace" 423377529c0SPaolo Bonzinispice="" 424377529c0SPaolo Bonzinirbd="" 4257b02f544SMarc-André Lureausmartcard="" 4262b2325ffSGerd Hoffmannlibusb="" 42769354a83SHans de Goedeusb_redir="" 428da076ffeSGerd Hoffmannopengl="" 429014cb152SGerd Hoffmannopengl_dmabuf="no" 4305dd89908SRichard Hendersoncpuid_h="no" 43199f2dbd3SLiang Liavx2_opt="no" 4321ece9905SAlon Levyzlib="yes" 4338ca80760SRichard Hendersoncapstone="" 434b25c9dffSStefan Weillzo="" 435b25c9dffSStefan Weilsnappy="" 4366b383c08SPeter Wubzip2="" 437e8ef31a3SMichael Tokarevguest_agent="" 438d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 43950cbebb9SMichael Rothguest_agent_ntddscsi="no" 4409dacf32dSYossi Hindinguest_agent_msi="" 441d9840e25STomoki Sekiyamavss_win32_sdk="" 442d9840e25STomoki Sekiyamawin_sdk="no" 4434b1c11fdSDaniel P. Berrangewant_tools="yes" 444c589b249SRonnie Sahlberglibiscsi="" 4456542aa9cSPeter Lievenlibnfs="" 446519175a2SAlex Barcelocoroutine="" 44770c60c08SStefan Hajnoczicoroutine_pool="" 4487d992e4dSPeter Lievendebug_stack_usage="no" 449f0d92b56SLongpeng(Mike)crypto_afalg="no" 450f794573eSEduardo Otuboseccomp="" 451eb100396SBharata B Raoglusterfs="" 452d85fa9ebSJeff Codyglusterfs_xlator_opt="no" 4530c14fb47SBharata B Raoglusterfs_discard="no" 454df3a429aSNiels de Vosglusterfs_fallocate="no" 4557c815372SBharata B Raoglusterfs_zerofill="no" 456a4ccabcfSAnthony Liguorigtk="" 457925a0400SGerd Hoffmanngtk_gl="no" 458a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 459ddbb0d09SDaniel P. Berrangegnutls="" 46091bfcdb0SDaniel P. Berrangenettle="" 46191bfcdb0SDaniel P. Berrangegcrypt="" 4621f923c70SLongpeng(Mike)gcrypt_hmac="no" 463bbbf9bfbSStefan Weilvte="" 4649d9e1521SGerd Hoffmannvirglrenderer="" 465e91c793cSCole Robinsontpm="yes" 4660a12ec87SRichard W.M. Joneslibssh2="" 467ed1701c6SDr. David Alan Gilbertlive_block_migration="yes" 468a99d57bbSWanlong Gaonuma="" 4692847b469SFam Zhengtcmalloc="no" 4707b01cb97SAlexandre Derumierjemalloc="no" 471a6b1d4c0SChanglong Xiereplication="yes" 472da92c3ffSAshish Mittalvxhs="" 473ed279a06SKlim Kireevlibxml2="" 47451a12b51SAlex Bennéedocker="no" 475ba59fb77SPaolo Bonzinidebug_mutex="no" 47617824406SJunyan Helibpmem="" 477377529c0SPaolo Bonzini 478d75402b5SAlex Bennée# cross compilers defaults, can be overridden with --cross-cc-ARCH 479d75402b5SAlex Bennéecross_cc_aarch64="aarch64-linux-gnu-gcc" 480d422b2bcSAlex Bennéecross_cc_aarch64_be="$cross_cc_aarch64" 481d422b2bcSAlex Bennéecross_cc_cflags_aarch64_be="-mbig-endian" 482d75402b5SAlex Bennéecross_cc_arm="arm-linux-gnueabihf-gcc" 483d422b2bcSAlex Bennéecross_cc_cflags_armeb="-mbig-endian" 484716a507cSAlex Bennéecross_cc_i386="i386-pc-linux-gnu-gcc" 485716a507cSAlex Bennéecross_cc_cflags_i386="" 486d75402b5SAlex Bennéecross_cc_powerpc="powerpc-linux-gnu-gcc" 487d422b2bcSAlex Bennéecross_cc_powerpc="powerpc-linux-gnu-gcc" 488d75402b5SAlex Bennée 489d75402b5SAlex Bennéeenabled_cross_compilers="" 490d75402b5SAlex Bennée 491898be3e0SPeter Maydellsupported_cpu="no" 492898be3e0SPeter Maydellsupported_os="no" 493fb59dabdSPeter Maydellbogus_os="no" 4945a22ab71SYang Zhongmalloc_trim="" 495898be3e0SPeter Maydell 496ac0df51dSaliguori# parse CC options first 497ac0df51dSaliguorifor opt do 49889138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 499ac0df51dSaliguori case "$opt" in 500ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 501ac0df51dSaliguori ;; 5023d8df640SPaolo Bonzini --cc=*) CC="$optarg" 503ac0df51dSaliguori ;; 50483f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 50583f73fceSTomoki Sekiyama ;; 506ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 507ca4deeb1SPaolo Bonzini ;; 5082ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 5092ff6b91eSJuan Quintela ;; 510de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 511e2a2ed06SJuan Quintela ;; 51211cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 51311cde1c8SBruno Dominguez ;; 514a4969e90SAlex Bennée --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" 515f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 516e2a2ed06SJuan Quintela ;; 5175bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 5185bc62e01SGerd Hoffmann ;; 5195bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 5205bc62e01SGerd Hoffmann ;; 521d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 522d75402b5SAlex Bennée ;; 523d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 524d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 525d422b2bcSAlex Bennée ;; 526d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 527d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 528d75402b5SAlex Bennée ;; 529ac0df51dSaliguori esac 530ac0df51dSaliguoridone 531ac0df51dSaliguori# OS specific 532ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 53393148aa5SStefan Weil# we can eliminate its usage altogether. 534ac0df51dSaliguori 535e49d021eSPeter Maydell# Preferred compiler: 536e49d021eSPeter Maydell# ${CC} (if set) 537e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 538e49d021eSPeter Maydell# system compiler 539e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 540e49d021eSPeter Maydell cc="$host_cc" 541e49d021eSPeter Maydellelse 542b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 543e49d021eSPeter Maydellfi 544e49d021eSPeter Maydell 54583f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 54683f73fceSTomoki Sekiyama cxx="c++" 54783f73fceSTomoki Sekiyamaelse 54883f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 54983f73fceSTomoki Sekiyamafi 55083f73fceSTomoki Sekiyama 551b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 552cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 5535f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 5543dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 555b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 556b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 5579f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 5584852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 559b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 560b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 56117884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 56217884d7bSSergei Trofimovichquery_pkg_config() { 56317884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 56417884d7bSSergei Trofimovich} 56517884d7bSSergei Trofimovichpkg_config=query_pkg_config 566b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 56747c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 568ac0df51dSaliguori 56945d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 57045d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 57145d285abSPeter Maydell 572be17dc90SMichael S. Tsirkin# default flags for all hosts 5732d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 5742d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 5752d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 5762d31515bSPeter Maydell# provides these semantics.) 5772d31515bSPeter MaydellQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 578f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 579c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 580be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 5819edc19c9SMichael S. TsirkinQEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include" 5825bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 5835bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 584be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 5855bc62e01SGerd Hoffmannfi 586be17dc90SMichael S. Tsirkin 587ca4deeb1SPaolo Bonzini# make source path absolute 58889138857SStefan Weilsource_path=$(cd "$source_path"; pwd) 589ca4deeb1SPaolo Bonzini 590cab00a5aSMichael S. Tsirkin# running configure in the source tree? 591cab00a5aSMichael S. Tsirkin# we know that's the case if configure is there. 592cab00a5aSMichael S. Tsirkinif test -f "./configure"; then 593cab00a5aSMichael S. Tsirkin pwd_is_source_path="y" 594cab00a5aSMichael S. Tsirkinelse 595cab00a5aSMichael S. Tsirkin pwd_is_source_path="n" 596cab00a5aSMichael S. Tsirkinfi 597cab00a5aSMichael S. Tsirkin 598ac0df51dSaliguoricheck_define() { 599ac0df51dSaliguoricat > $TMPC <<EOF 600ac0df51dSaliguori#if !defined($1) 601fd786e1aSPeter Maydell#error $1 not defined 602ac0df51dSaliguori#endif 603ac0df51dSaliguoriint main(void) { return 0; } 604ac0df51dSaliguoriEOF 60552166aa0SJuan Quintela compile_object 606ac0df51dSaliguori} 607ac0df51dSaliguori 608307119e7SGerd Hoffmanncheck_include() { 609307119e7SGerd Hoffmanncat > $TMPC <<EOF 610307119e7SGerd Hoffmann#include <$1> 611307119e7SGerd Hoffmannint main(void) { return 0; } 612307119e7SGerd HoffmannEOF 613307119e7SGerd Hoffmann compile_object 614307119e7SGerd Hoffmann} 615307119e7SGerd Hoffmann 61693b25869SJohn Snowwrite_c_skeleton() { 61793b25869SJohn Snow cat > $TMPC <<EOF 61893b25869SJohn Snowint main(void) { return 0; } 61993b25869SJohn SnowEOF 62093b25869SJohn Snow} 62193b25869SJohn Snow 622bbea4050SPeter Maydellif check_define __linux__ ; then 623bbea4050SPeter Maydell targetos="Linux" 624bbea4050SPeter Maydellelif check_define _WIN32 ; then 625bbea4050SPeter Maydell targetos='MINGW32' 626bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 627bbea4050SPeter Maydell targetos='OpenBSD' 628bbea4050SPeter Maydellelif check_define __sun__ ; then 629bbea4050SPeter Maydell targetos='SunOS' 630bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 631bbea4050SPeter Maydell targetos='Haiku' 632951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 633951fedfcSPeter Maydell targetos='FreeBSD' 634951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 635951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 636951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 637951fedfcSPeter Maydell targetos='DragonFly' 638951fedfcSPeter Maydellelif check_define __NetBSD__; then 639951fedfcSPeter Maydell targetos='NetBSD' 640951fedfcSPeter Maydellelif check_define __APPLE__; then 641951fedfcSPeter Maydell targetos='Darwin' 642bbea4050SPeter Maydellelse 643951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 644951fedfcSPeter Maydell # might be going to just print the --help text, or it might 645951fedfcSPeter Maydell # be the result of a missing compiler. 646951fedfcSPeter Maydell targetos='bogus' 647951fedfcSPeter Maydell bogus_os='yes' 648bbea4050SPeter Maydellfi 649bbea4050SPeter Maydell 650bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 651bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 652bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 653bbea4050SPeter Maydell# the correct CPU with the --cpu option. 654bbea4050SPeter Maydellcase $targetos in 655bbea4050SPeter MaydellDarwin) 656bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 657bbea4050SPeter Maydell # run 64-bit userspace code. 658bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 659bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 660bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 661bbea4050SPeter Maydell cpu="x86_64" 662bbea4050SPeter Maydell fi 663bbea4050SPeter Maydell ;; 664bbea4050SPeter MaydellSunOS) 66589138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 666bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 667bbea4050SPeter Maydell cpu="x86_64" 668bbea4050SPeter Maydell fi 669bbea4050SPeter Maydellesac 670bbea4050SPeter Maydell 6712ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 6722ff6b91eSJuan Quintela # command line argument 6732ff6b91eSJuan Quintela : 6742ff6b91eSJuan Quintelaelif check_define __i386__ ; then 675ac0df51dSaliguori cpu="i386" 676ac0df51dSaliguorielif check_define __x86_64__ ; then 677c72b26ecSRichard Henderson if check_define __ILP32__ ; then 678c72b26ecSRichard Henderson cpu="x32" 679c72b26ecSRichard Henderson else 680ac0df51dSaliguori cpu="x86_64" 681c72b26ecSRichard Henderson fi 6823aa9bd6cSblueswir1elif check_define __sparc__ ; then 6833aa9bd6cSblueswir1 if check_define __arch64__ ; then 6843aa9bd6cSblueswir1 cpu="sparc64" 6853aa9bd6cSblueswir1 else 6863aa9bd6cSblueswir1 cpu="sparc" 6873aa9bd6cSblueswir1 fi 688fdf7ed96Smalcelif check_define _ARCH_PPC ; then 689fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 690fdf7ed96Smalc cpu="ppc64" 691ac0df51dSaliguori else 692fdf7ed96Smalc cpu="ppc" 693fdf7ed96Smalc fi 694afa05235SAurelien Jarnoelif check_define __mips__ ; then 695afa05235SAurelien Jarno cpu="mips" 696d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 697d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 698d66ed0eaSAurelien Jarno cpu="s390x" 699d66ed0eaSAurelien Jarno else 700d66ed0eaSAurelien Jarno cpu="s390" 701d66ed0eaSAurelien Jarno fi 70221d89f84SPeter Maydellelif check_define __arm__ ; then 70321d89f84SPeter Maydell cpu="arm" 7041f080313SClaudio Fontanaelif check_define __aarch64__ ; then 7051f080313SClaudio Fontana cpu="aarch64" 706fdf7ed96Smalcelse 70789138857SStefan Weil cpu=$(uname -m) 708ac0df51dSaliguorifi 709ac0df51dSaliguori 710359bc95dSPeter MaydellARCH= 711359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 712359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 7137d13299dSbellardcase "$cpu" in 7146499fd15SPeter Maydell ppc|ppc64|s390|s390x|sparc64|x32) 715898be3e0SPeter Maydell cpu="$cpu" 716898be3e0SPeter Maydell supported_cpu="yes" 717d75402b5SAlex Bennée eval "cross_cc_${cpu}=\$host_cc" 718898be3e0SPeter Maydell ;; 7197d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 72097a847bcSbellard cpu="i386" 721898be3e0SPeter Maydell supported_cpu="yes" 722d75402b5SAlex Bennée cross_cc_i386=$host_cc 7237d13299dSbellard ;; 724aaa5fa14Saurel32 x86_64|amd64) 725aaa5fa14Saurel32 cpu="x86_64" 726898be3e0SPeter Maydell supported_cpu="yes" 727d75402b5SAlex Bennée cross_cc_x86_64=$host_cc 728aaa5fa14Saurel32 ;; 72921d89f84SPeter Maydell armv*b|armv*l|arm) 73021d89f84SPeter Maydell cpu="arm" 731898be3e0SPeter Maydell supported_cpu="yes" 732d75402b5SAlex Bennée cross_cc_arm=$host_cc 7337d13299dSbellard ;; 7341f080313SClaudio Fontana aarch64) 7351f080313SClaudio Fontana cpu="aarch64" 736898be3e0SPeter Maydell supported_cpu="yes" 737d75402b5SAlex Bennée cross_cc_aarch64=$host_cc 7381f080313SClaudio Fontana ;; 739afa05235SAurelien Jarno mips*) 740afa05235SAurelien Jarno cpu="mips" 741898be3e0SPeter Maydell supported_cpu="yes" 742d75402b5SAlex Bennée cross_cc_mips=$host_cc 743afa05235SAurelien Jarno ;; 7443142255cSblueswir1 sparc|sun4[cdmuv]) 745ae228531Sbellard cpu="sparc" 7466499fd15SPeter Maydell supported_cpu="yes" 747d75402b5SAlex Bennée cross_cc_sparc=$host_cc 748ae228531Sbellard ;; 7497d13299dSbellard *) 750359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 751359bc95dSPeter Maydell ARCH=unknown 7527d13299dSbellard ;; 7537d13299dSbellardesac 754359bc95dSPeter Maydellif test -z "$ARCH"; then 755359bc95dSPeter Maydell ARCH="$cpu" 756359bc95dSPeter Maydellfi 757e2d52ad3SJuan Quintela 7587d13299dSbellard# OS specific 7590dbfc675SJuan Quintela 760adfc3e91SStacey Son# host *BSD for user mode 761adfc3e91SStacey SonHOST_VARIANT_DIR="" 762adfc3e91SStacey Son 7637d13299dSbellardcase $targetos in 76467b915a5SbellardMINGW32*) 76567b915a5Sbellard mingw32="yes" 766b0cb0a66SVincent Palatin hax="yes" 7673cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 768307119e7SGerd Hoffmann if check_include dsound.h; then 7693cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 770307119e7SGerd Hoffmann else 771307119e7SGerd Hoffmann audio_drv_list="" 772307119e7SGerd Hoffmann fi 773898be3e0SPeter Maydell supported_os="yes" 77467b915a5Sbellard;; 7755c40d2bdSthsGNU/kFreeBSD) 776a167ba50SAurelien Jarno bsd="yes" 7770c58ac1cSmalc audio_drv_list="oss" 7780bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 7795c40d2bdSths;; 7807d3505c5SbellardFreeBSD) 7817d3505c5Sbellard bsd="yes" 7820db4a067SPaolo Bonzini make="${MAKE-gmake}" 7830c58ac1cSmalc audio_drv_list="oss" 7840bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 785f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 786f01576f1SJuergen Lock LIBS="-lutil $LIBS" 787a7764f15SEd Maste # needed for kinfo_getproc 788a7764f15SEd Maste libs_qga="-lutil $libs_qga" 78958952137SVincenzo Maffione netmap="" # enable netmap autodetect 790adfc3e91SStacey Son HOST_VARIANT_DIR="freebsd" 791898be3e0SPeter Maydell supported_os="yes" 7927d3505c5Sbellard;; 793c5e97233Sblueswir1DragonFly) 794c5e97233Sblueswir1 bsd="yes" 7950db4a067SPaolo Bonzini make="${MAKE-gmake}" 796c5e97233Sblueswir1 audio_drv_list="oss" 7970bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 798adfc3e91SStacey Son HOST_VARIANT_DIR="dragonfly" 799c5e97233Sblueswir1;; 8007d3505c5SbellardNetBSD) 8017d3505c5Sbellard bsd="yes" 8020db4a067SPaolo Bonzini make="${MAKE-gmake}" 8030c58ac1cSmalc audio_drv_list="oss" 8040bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 8058ef92a88Sblueswir1 oss_lib="-lossaudio" 806adfc3e91SStacey Son HOST_VARIANT_DIR="netbsd" 8073c2bdbc1SKamil Rytarowski supported_os="yes" 8087d3505c5Sbellard;; 8097d3505c5SbellardOpenBSD) 8107d3505c5Sbellard bsd="yes" 8110db4a067SPaolo Bonzini make="${MAKE-gmake}" 8124f6ab397SBrad Smith audio_drv_list="sdl" 8130bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 814adfc3e91SStacey Son HOST_VARIANT_DIR="openbsd" 8150a773d55SBrad Smith supported_os="yes" 8167d3505c5Sbellard;; 81783fb7adfSbellardDarwin) 81883fb7adfSbellard bsd="yes" 81983fb7adfSbellard darwin="yes" 820b0cb0a66SVincent Palatin hax="yes" 821c97d6d2cSSergio Andres Gomez Del Real hvf="yes" 82217969268SFam Zheng LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 8231b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 824a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 8250c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 8261b0f9cc2Saliguori fi 827fd677642Sths cocoa="yes" 8280c58ac1cSmalc audio_drv_list="coreaudio" 82914382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 8300c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 8317973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 832a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 833a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 834a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 835adfc3e91SStacey Son HOST_VARIANT_DIR="darwin" 836898be3e0SPeter Maydell supported_os="yes" 83783fb7adfSbellard;; 838ec530c81SbellardSunOS) 839ec530c81Sbellard solaris="yes" 8400db4a067SPaolo Bonzini make="${MAKE-gmake}" 8410db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 842e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 8436b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 8440c58ac1cSmalc audio_drv_list="oss" 8456b4d2ba1Sths fi 846c2de5c91Smalc audio_possible_drivers="oss sdl" 847d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 848d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 849d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 850d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 851a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 852560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 853560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 854560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 855ec530c81Sbellard;; 856179cf400SAndreas FärberHaiku) 857179cf400SAndreas Färber haiku="yes" 858179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 859179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 860179cf400SAndreas Färber;; 861898be3e0SPeter MaydellLinux) 8620c58ac1cSmalc audio_drv_list="oss" 8630bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 8645327cf48Sbellard linux="yes" 865831b7825Sths linux_user="yes" 866af2be207SJan Kiszka kvm="yes" 867af2be207SJan Kiszka vhost_net="yes" 868042cea27SGonglei vhost_crypto="yes" 8695e9be92dSNicholas Bellinger vhost_scsi="yes" 870fc0b9b0eSStefan Hajnoczi vhost_vsock="yes" 871a585140dSAlexey Kardashevskiy QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" 872898be3e0SPeter Maydell supported_os="yes" 873898be3e0SPeter Maydell;; 8747d13299dSbellardesac 8757d13299dSbellard 8767d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 877b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 87884778508Sblueswir1 bsd_user="yes" 8797d3505c5Sbellard fi 88008de3949SAndreas Färberfi 8817d3505c5Sbellard 8820db4a067SPaolo Bonzini: ${make=${MAKE-make}} 8830db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 88452510f8bSStefan Weil: ${python=${PYTHON-python}} 885e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 8860db4a067SPaolo Bonzini 8873c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 8883c4a4d0dSPeter Maydellif has clang; then 8893c4a4d0dSPeter Maydell objcc=clang 8903c4a4d0dSPeter Maydellelse 8913c4a4d0dSPeter Maydell objcc="$cc" 8923c4a4d0dSPeter Maydellfi 8933c4a4d0dSPeter Maydell 8943457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 8953457a3f8SJuan Quintela EXESUF=".exe" 89617969268SFam Zheng DSOSUF=".dll" 897a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 898e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 899e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 90078e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 90178e9d4adSStefan Weil QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" 902f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 90393b25869SJohn Snow write_c_skeleton; 904f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 905f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 906f7cf5d5bSStefan Weil fi 907c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 908683035deSPaolo Bonzini mandir="\${prefix}" 909528ae5b8SEduardo Habkost datadir="\${prefix}" 910850da188SEduardo Habkost qemu_docdir="\${prefix}" 911683035deSPaolo Bonzini bindir="\${prefix}" 912683035deSPaolo Bonzini sysconfdir="\${prefix}" 9135a699bbbSLaszlo Ersek local_statedir= 914683035deSPaolo Bonzini confsuffix="" 915105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 9163457a3f8SJuan Quintelafi 9173457a3f8SJuan Quintela 918487fefdbSAnthony Liguoriwerror="" 91985aa5189Sbellard 9207d13299dSbellardfor opt do 92189138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 9227d13299dSbellard case "$opt" in 9232efc3265Sbellard --help|-h) show_help=yes 9242efc3265Sbellard ;; 92599123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 92699123e13SMike Frysinger ;; 927b1a550a0Spbrook --prefix=*) prefix="$optarg" 9287d13299dSbellard ;; 929b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 93032ce6337Sbellard ;; 931ca4deeb1SPaolo Bonzini --source-path=*) 9327d13299dSbellard ;; 933ac0df51dSaliguori --cross-prefix=*) 9347d13299dSbellard ;; 935ac0df51dSaliguori --cc=*) 9367d13299dSbellard ;; 937b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 93883469015Sbellard ;; 93983f73fceSTomoki Sekiyama --cxx=*) 94083f73fceSTomoki Sekiyama ;; 941e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 942e007dbecSMichael S. Tsirkin ;; 9433c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 9443c4a4d0dSPeter Maydell ;; 945b1a550a0Spbrook --make=*) make="$optarg" 9467d13299dSbellard ;; 9476a882643Spbrook --install=*) install="$optarg" 9486a882643Spbrook ;; 949c886edfbSBlue Swirl --python=*) python="$optarg" 950c886edfbSBlue Swirl ;; 9511d728c39SBlue Swirl --gcov=*) gcov_tool="$optarg" 9521d728c39SBlue Swirl ;; 953e2d8830eSBrad --smbd=*) smbd="$optarg" 954e2d8830eSBrad ;; 955e2a2ed06SJuan Quintela --extra-cflags=*) 9567d13299dSbellard ;; 95711cde1c8SBruno Dominguez --extra-cxxflags=*) 95811cde1c8SBruno Dominguez ;; 959e2a2ed06SJuan Quintela --extra-ldflags=*) 9607d13299dSbellard ;; 9615bc62e01SGerd Hoffmann --enable-debug-info) 9625bc62e01SGerd Hoffmann ;; 9635bc62e01SGerd Hoffmann --disable-debug-info) 9645bc62e01SGerd Hoffmann ;; 965d75402b5SAlex Bennée --cross-cc-*) 966d75402b5SAlex Bennée ;; 96717969268SFam Zheng --enable-modules) 96817969268SFam Zheng modules="yes" 96917969268SFam Zheng ;; 9703aa88b31SStefan Hajnoczi --disable-modules) 9713aa88b31SStefan Hajnoczi modules="no" 9723aa88b31SStefan Hajnoczi ;; 9732ff6b91eSJuan Quintela --cpu=*) 9747d13299dSbellard ;; 975b1a550a0Spbrook --target-list=*) target_list="$optarg" 976de83cd02Sbellard ;; 9775b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 9785b808275SLluís Vilanova ;; 9795b808275SLluís Vilanova # XXX: backwards compatibility 9805b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 98194a420b1SStefan Hajnoczi ;; 98274242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 9839410b56cSPrerna Saxena ;; 9847d13299dSbellard --enable-gprof) gprof="yes" 9857d13299dSbellard ;; 9861d728c39SBlue Swirl --enable-gcov) gcov="yes" 9871d728c39SBlue Swirl ;; 98879427693SLoïc Minier --static) 98979427693SLoïc Minier static="yes" 99079427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 99117884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 99243ce4dfeSbellard ;; 9930b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 9940b24e75fSPaolo Bonzini ;; 9950b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 9960b24e75fSPaolo Bonzini ;; 9973aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 9983aa5d2beSAlon Levy ;; 9998bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 10008bf188aaSMichael Tokarev ;; 10010f94d6daSAlon Levy --includedir=*) includedir="$optarg" 10020f94d6daSAlon Levy ;; 1003528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 10040b24e75fSPaolo Bonzini ;; 1005023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 1006023d3d67SEduardo Habkost ;; 1007850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 10080b24e75fSPaolo Bonzini ;; 1009ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 101007381cc1SAnthony Liguori ;; 1011785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 1012785c23aeSLuiz Capitulino ;; 10133d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 10143d5eecabSGerd Hoffmann ;; 1015181ce1d0SOlaf Hering --host=*|--build=*|\ 1016181ce1d0SOlaf Hering --disable-dependency-tracking|\ 1017785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 1018023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 1019023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 1020023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 1021023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 1022023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 1023023ddd74SMax Filippov # lots of directory switches by default. 1024023ddd74SMax Filippov ;; 102597a847bcSbellard --disable-sdl) sdl="no" 102697a847bcSbellard ;; 1027c4198157SJuan Quintela --enable-sdl) sdl="yes" 1028c4198157SJuan Quintela ;; 102947c03744SDave Airlie --with-sdlabi=*) sdlabi="$optarg" 103047c03744SDave Airlie ;; 10313556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 10323556c233SPaolo Bonzini ;; 10333556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 10343556c233SPaolo Bonzini ;; 1035983eef5aSMeador Inge --disable-virtfs) virtfs="no" 1036983eef5aSMeador Inge ;; 1037983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 1038983eef5aSMeador Inge ;; 1039fe8fc5aeSPaolo Bonzini --disable-mpath) mpath="no" 1040fe8fc5aeSPaolo Bonzini ;; 1041fe8fc5aeSPaolo Bonzini --enable-mpath) mpath="yes" 1042fe8fc5aeSPaolo Bonzini ;; 1043821601eaSJes Sorensen --disable-vnc) vnc="no" 1044821601eaSJes Sorensen ;; 1045821601eaSJes Sorensen --enable-vnc) vnc="yes" 1046821601eaSJes Sorensen ;; 10472f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 10482f6a1ab0Sblueswir1 ;; 10490c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 10500c58ac1cSmalc ;; 105189138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1052b64ec4e4SFam Zheng ;; 105389138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1054eb852011SMarkus Armbruster ;; 1055f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 1056f8393946Saurel32 ;; 1057f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 1058f8393946Saurel32 ;; 1059f3d08ee6SPaul Brook --enable-debug) 1060f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 1061f3d08ee6SPaul Brook debug_tcg="yes" 10621fcc6d42SPeter Xu debug_mutex="yes" 1063f3d08ee6SPaul Brook debug="yes" 1064f3d08ee6SPaul Brook strip_opt="no" 1065b553a042SJohn Snow fortify_source="no" 1066f3d08ee6SPaul Brook ;; 1067247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1068247724cbSMarc-André Lureau ;; 1069247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1070247724cbSMarc-André Lureau ;; 107103b4fe7dSaliguori --enable-sparse) sparse="yes" 107203b4fe7dSaliguori ;; 107303b4fe7dSaliguori --disable-sparse) sparse="no" 107403b4fe7dSaliguori ;; 10751625af87Saliguori --disable-strip) strip_opt="no" 10761625af87Saliguori ;; 10772f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 10782f9606b3Saliguori ;; 1079ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 1080ea784e3bSJuan Quintela ;; 10812f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 10822f6f5c7aSCorentin Chary ;; 10832f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 10842f6f5c7aSCorentin Chary ;; 1085efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 1086efe556adSCorentin Chary ;; 1087efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 1088efe556adSCorentin Chary ;; 1089443f1376Sbellard --disable-slirp) slirp="no" 1090c20709aaSbellard ;; 1091e0e6c8c0Saliguori --disable-vde) vde="no" 10928a16d273Sths ;; 1093dfb278bdSJuan Quintela --enable-vde) vde="yes" 1094dfb278bdSJuan Quintela ;; 109558952137SVincenzo Maffione --disable-netmap) netmap="no" 109658952137SVincenzo Maffione ;; 109758952137SVincenzo Maffione --enable-netmap) netmap="yes" 109858952137SVincenzo Maffione ;; 1099e37630caSaliguori --disable-xen) xen="no" 1100e37630caSaliguori ;; 1101fc321b4bSJuan Quintela --enable-xen) xen="yes" 1102fc321b4bSJuan Quintela ;; 1103eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 1104eb6fda0fSAnthony PERARD ;; 1105eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 1106eb6fda0fSAnthony PERARD ;; 110764a7ad6fSIan Campbell --disable-xen-pv-domain-build) xen_pv_domain_build="no" 110864a7ad6fSIan Campbell ;; 110964a7ad6fSIan Campbell --enable-xen-pv-domain-build) xen_pv_domain_build="yes" 111064a7ad6fSIan Campbell ;; 11112e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 11122e4d9fb1Saurel32 ;; 11134ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 11144ffcedb6SJuan Quintela ;; 1115fb599c9aSbalrog --disable-bluez) bluez="no" 1116fb599c9aSbalrog ;; 1117a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 1118a20a6f46SJuan Quintela ;; 11197ba1e619Saliguori --disable-kvm) kvm="no" 11207ba1e619Saliguori ;; 1121b31a0277SJuan Quintela --enable-kvm) kvm="yes" 1122b31a0277SJuan Quintela ;; 1123b0cb0a66SVincent Palatin --disable-hax) hax="no" 1124180fb750Szhanghailiang ;; 1125b0cb0a66SVincent Palatin --enable-hax) hax="yes" 1126180fb750Szhanghailiang ;; 1127c97d6d2cSSergio Andres Gomez Del Real --disable-hvf) hvf="no" 1128c97d6d2cSSergio Andres Gomez Del Real ;; 1129c97d6d2cSSergio Andres Gomez Del Real --enable-hvf) hvf="yes" 1130c97d6d2cSSergio Andres Gomez Del Real ;; 1131d661d9a4SJustin Terry (VM) --disable-whpx) whpx="no" 1132d661d9a4SJustin Terry (VM) ;; 1133d661d9a4SJustin Terry (VM) --enable-whpx) whpx="yes" 1134d661d9a4SJustin Terry (VM) ;; 11359195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 11369195b2c2SStefan Weil ;; 11379195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 11389195b2c2SStefan Weil ;; 113947e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 114047e98658SCorey Bryant ;; 114147e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 114247e98658SCorey Bryant ;; 1143b3f6ea7eSPaolo Bonzini --disable-tcg) tcg="no" 1144b3f6ea7eSPaolo Bonzini ;; 1145b3f6ea7eSPaolo Bonzini --enable-tcg) tcg="yes" 1146b3f6ea7eSPaolo Bonzini ;; 11475a22ab71SYang Zhong --disable-malloc-trim) malloc_trim="no" 11485a22ab71SYang Zhong ;; 11495a22ab71SYang Zhong --enable-malloc-trim) malloc_trim="yes" 11505a22ab71SYang Zhong ;; 1151cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1152cd4ec0b4SGerd Hoffmann ;; 1153cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 1154cd4ec0b4SGerd Hoffmann ;; 1155c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 1156c589b249SRonnie Sahlberg ;; 1157c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 1158c589b249SRonnie Sahlberg ;; 11596542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 11606542aa9cSPeter Lieven ;; 11616542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 11626542aa9cSPeter Lieven ;; 116305c2a3e7Sbellard --enable-profiler) profiler="yes" 116405c2a3e7Sbellard ;; 116514821030SPavel Borzenkov --disable-cocoa) cocoa="no" 116614821030SPavel Borzenkov ;; 1167c2de5c91Smalc --enable-cocoa) 1168c2de5c91Smalc cocoa="yes" ; 116989138857SStefan Weil audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 11705b0753e0Sbellard ;; 1171cad25d69Spbrook --disable-system) softmmu="no" 11720a8e90f4Spbrook ;; 1173cad25d69Spbrook --enable-system) softmmu="yes" 11740a8e90f4Spbrook ;; 11750953a80fSZachary Amsden --disable-user) 11760953a80fSZachary Amsden linux_user="no" ; 11770953a80fSZachary Amsden bsd_user="no" ; 11780953a80fSZachary Amsden ;; 11790953a80fSZachary Amsden --enable-user) ;; 1180831b7825Sths --disable-linux-user) linux_user="no" 11810a8e90f4Spbrook ;; 1182831b7825Sths --enable-linux-user) linux_user="yes" 1183831b7825Sths ;; 118484778508Sblueswir1 --disable-bsd-user) bsd_user="no" 118584778508Sblueswir1 ;; 118684778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 118784778508Sblueswir1 ;; 118840d6444eSAvi Kivity --enable-pie) pie="yes" 118934005a00SKirill A. Shutemov ;; 119040d6444eSAvi Kivity --disable-pie) pie="no" 119134005a00SKirill A. Shutemov ;; 119285aa5189Sbellard --enable-werror) werror="yes" 119385aa5189Sbellard ;; 119485aa5189Sbellard --disable-werror) werror="no" 119585aa5189Sbellard ;; 119663678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 119763678e17SSteven Noonan ;; 119863678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 119963678e17SSteven Noonan ;; 12004d3b6f6eSbalrog --disable-curses) curses="no" 12014d3b6f6eSbalrog ;; 1202c584a6d0SJuan Quintela --enable-curses) curses="yes" 1203c584a6d0SJuan Quintela ;; 1204769ce76dSAlexander Graf --disable-curl) curl="no" 1205769ce76dSAlexander Graf ;; 1206788c8196SJuan Quintela --enable-curl) curl="yes" 1207788c8196SJuan Quintela ;; 12082df87df7SJuan Quintela --disable-fdt) fdt="no" 12092df87df7SJuan Quintela ;; 12102df87df7SJuan Quintela --enable-fdt) fdt="yes" 12112df87df7SJuan Quintela ;; 12125c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 12135c6c3a6cSChristoph Hellwig ;; 12145c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 12155c6c3a6cSChristoph Hellwig ;; 1216758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 1217758e8e38SVenkateswararao Jujjuri (JV) ;; 1218758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 1219758e8e38SVenkateswararao Jujjuri (JV) ;; 1220a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1221a40161cbSPaolo Bonzini ;; 1222a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1223a40161cbSPaolo Bonzini ;; 122477755340Sths --disable-blobs) blobs="no" 122577755340Sths ;; 12267e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 12274a19f1ecSpbrook ;; 1228519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1229519175a2SAlex Barcelo ;; 123070c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 123170c60c08SStefan Hajnoczi ;; 123270c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 123370c60c08SStefan Hajnoczi ;; 12347d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 12357d992e4dSPeter Lieven ;; 1236f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1237f0d92b56SLongpeng(Mike) ;; 1238f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1239f0d92b56SLongpeng(Mike) ;; 1240a25dba17SJuan Quintela --disable-docs) docs="no" 124170ec5dc0SAnthony Liguori ;; 1242a25dba17SJuan Quintela --enable-docs) docs="yes" 124383a3ab8bSJuan Quintela ;; 1244d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1245d5970055SMichael S. Tsirkin ;; 1246d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1247d5970055SMichael S. Tsirkin ;; 1248042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1249042cea27SGonglei ;; 1250042cea27SGonglei --enable-vhost-crypto) 1251042cea27SGonglei vhost_crypto="yes" 1252042cea27SGonglei if test "$mingw32" = "yes"; then 1253042cea27SGonglei error_exit "vhost-crypto isn't available on win32" 1254042cea27SGonglei fi 1255042cea27SGonglei ;; 12565e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 12575e9be92dSNicholas Bellinger ;; 12585e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 12595e9be92dSNicholas Bellinger ;; 1260fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1261fc0b9b0eSStefan Hajnoczi ;; 1262fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1263fc0b9b0eSStefan Hajnoczi ;; 1264da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 126520ff075bSMichael Walle ;; 1266da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 126720ff075bSMichael Walle ;; 1268f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1269f27aaf4bSChristian Brunner ;; 1270f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1271f27aaf4bSChristian Brunner ;; 12728c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 12738c84cf11SSergei Trofimovich ;; 12748c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 12758c84cf11SSergei Trofimovich ;; 12767b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1277111a38b0SRobert Relyea ;; 12787b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1279111a38b0SRobert Relyea ;; 12802b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 12812b2325ffSGerd Hoffmann ;; 12822b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 12832b2325ffSGerd Hoffmann ;; 128469354a83SHans de Goede --disable-usb-redir) usb_redir="no" 128569354a83SHans de Goede ;; 128669354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 128769354a83SHans de Goede ;; 12881ece9905SAlon Levy --disable-zlib-test) zlib="no" 12891ece9905SAlon Levy ;; 1290b25c9dffSStefan Weil --disable-lzo) lzo="no" 1291b25c9dffSStefan Weil ;; 1292607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1293607dacd0Sqiaonuohan ;; 1294b25c9dffSStefan Weil --disable-snappy) snappy="no" 1295b25c9dffSStefan Weil ;; 1296607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1297607dacd0Sqiaonuohan ;; 12986b383c08SPeter Wu --disable-bzip2) bzip2="no" 12996b383c08SPeter Wu ;; 13006b383c08SPeter Wu --enable-bzip2) bzip2="yes" 13016b383c08SPeter Wu ;; 1302d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1303d138cee9SMichael Roth ;; 1304d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1305d138cee9SMichael Roth ;; 13069dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 13079dacf32dSYossi Hindin ;; 13089dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 13099dacf32dSYossi Hindin ;; 1310d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1311d9840e25STomoki Sekiyama ;; 1312d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1313d9840e25STomoki Sekiyama ;; 1314d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1315d9840e25STomoki Sekiyama ;; 1316d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1317d9840e25STomoki Sekiyama ;; 1318d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1319d9840e25STomoki Sekiyama ;; 1320d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1321d9840e25STomoki Sekiyama ;; 13224b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 13234b1c11fdSDaniel P. Berrange ;; 13244b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 13254b1c11fdSDaniel P. Berrange ;; 1326f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1327f794573eSEduardo Otubo ;; 1328f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1329f794573eSEduardo Otubo ;; 1330eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1331eb100396SBharata B Rao ;; 1332eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1333eb100396SBharata B Rao ;; 133452b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 133552b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1336583f6e7bSStefan Hajnoczi ;; 1337cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1338cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1339cb6414dfSFam Zheng ;; 1340315d3184SFam Zheng --enable-uuid|--disable-uuid) 1341315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1342315d3184SFam Zheng ;; 1343a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1344a4ccabcfSAnthony Liguori ;; 1345a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1346a4ccabcfSAnthony Liguori ;; 1347a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1348a1c5e949SDaniel P. Berrange ;; 1349ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1350ddbb0d09SDaniel P. Berrange ;; 1351ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1352ddbb0d09SDaniel P. Berrange ;; 135391bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 135491bfcdb0SDaniel P. Berrange ;; 135591bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 135691bfcdb0SDaniel P. Berrange ;; 135791bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 135891bfcdb0SDaniel P. Berrange ;; 135991bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 136091bfcdb0SDaniel P. Berrange ;; 13612da776dbSMichael R. Hines --enable-rdma) rdma="yes" 13622da776dbSMichael R. Hines ;; 13632da776dbSMichael R. Hines --disable-rdma) rdma="no" 13642da776dbSMichael R. Hines ;; 136521ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 136621ab34c9SMarcel Apfelbaum ;; 136721ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 136821ab34c9SMarcel Apfelbaum ;; 1369bbbf9bfbSStefan Weil --disable-vte) vte="no" 1370bbbf9bfbSStefan Weil ;; 1371bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1372bbbf9bfbSStefan Weil ;; 13739d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 13749d9e1521SGerd Hoffmann ;; 13759d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 13769d9e1521SGerd Hoffmann ;; 1377e91c793cSCole Robinson --disable-tpm) tpm="no" 1378e91c793cSCole Robinson ;; 1379ab214c29SStefan Berger --enable-tpm) tpm="yes" 1380ab214c29SStefan Berger ;; 13810a12ec87SRichard W.M. Jones --disable-libssh2) libssh2="no" 13820a12ec87SRichard W.M. Jones ;; 13830a12ec87SRichard W.M. Jones --enable-libssh2) libssh2="yes" 13840a12ec87SRichard W.M. Jones ;; 1385ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1386ed1701c6SDr. David Alan Gilbert ;; 1387ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1388ed1701c6SDr. David Alan Gilbert ;; 1389a99d57bbSWanlong Gao --disable-numa) numa="no" 1390a99d57bbSWanlong Gao ;; 1391a99d57bbSWanlong Gao --enable-numa) numa="yes" 1392a99d57bbSWanlong Gao ;; 1393ed279a06SKlim Kireev --disable-libxml2) libxml2="no" 1394ed279a06SKlim Kireev ;; 1395ed279a06SKlim Kireev --enable-libxml2) libxml2="yes" 1396ed279a06SKlim Kireev ;; 13972847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 13982847b469SFam Zheng ;; 13992847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 14002847b469SFam Zheng ;; 14017b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 14027b01cb97SAlexandre Derumier ;; 14037b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 14047b01cb97SAlexandre Derumier ;; 1405a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1406a6b1d4c0SChanglong Xie ;; 1407a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1408a6b1d4c0SChanglong Xie ;; 1409da92c3ffSAshish Mittal --disable-vxhs) vxhs="no" 1410da92c3ffSAshish Mittal ;; 1411da92c3ffSAshish Mittal --enable-vxhs) vxhs="yes" 1412da92c3ffSAshish Mittal ;; 1413e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1414e6a74868SMarc-André Lureau ;; 1415e6a74868SMarc-André Lureau --enable-vhost-user) 1416e6a74868SMarc-André Lureau vhost_user="yes" 1417e6a74868SMarc-André Lureau if test "$mingw32" = "yes"; then 1418e6a74868SMarc-André Lureau error_exit "vhost-user isn't available on win32" 1419e6a74868SMarc-André Lureau fi 1420e6a74868SMarc-André Lureau ;; 14218ca80760SRichard Henderson --disable-capstone) capstone="no" 14228ca80760SRichard Henderson ;; 14238ca80760SRichard Henderson --enable-capstone) capstone="yes" 14248ca80760SRichard Henderson ;; 1425e219c499SRichard Henderson --enable-capstone=git) capstone="git" 1426e219c499SRichard Henderson ;; 1427e219c499SRichard Henderson --enable-capstone=system) capstone="system" 1428e219c499SRichard Henderson ;; 1429cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1430cc84d63aSDaniel P. Berrange ;; 1431f62bbee5SDaniel P. Berrange --enable-git-update) git_update=yes 1432f62bbee5SDaniel P. Berrange ;; 1433f62bbee5SDaniel P. Berrange --disable-git-update) git_update=no 1434f62bbee5SDaniel P. Berrange ;; 1435ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1436ba59fb77SPaolo Bonzini ;; 1437ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1438ba59fb77SPaolo Bonzini ;; 143917824406SJunyan He --enable-libpmem) libpmem=yes 144017824406SJunyan He ;; 144117824406SJunyan He --disable-libpmem) libpmem=no 144217824406SJunyan He ;; 14432d2ad6d0SFam Zheng *) 14442d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 14452d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 14462d2ad6d0SFam Zheng exit 1 14477f1559c6Sbalrog ;; 14487d13299dSbellard esac 14497d13299dSbellarddone 14507d13299dSbellard 1451e6a74868SMarc-André Lureauif test "$vhost_user" = ""; then 1452e6a74868SMarc-André Lureau if test "$mingw32" = "yes"; then 1453e6a74868SMarc-André Lureau vhost_user="no" 1454e6a74868SMarc-André Lureau else 1455e6a74868SMarc-André Lureau vhost_user="yes" 1456e6a74868SMarc-André Lureau fi 1457e6a74868SMarc-André Lureaufi 1458e6a74868SMarc-André Lureau 145940293e58Sbellardcase "$cpu" in 1460e3608d66SRichard Henderson ppc) 1461e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1462e3608d66SRichard Henderson LDFLAGS="-m32 $LDFLAGS" 146313a5abe2SAlex Bennée cross_cc_powerpc=$cc 146413a5abe2SAlex Bennée cross_cc_cflags_powerpc=$CPU_CFLAGS 1465e3608d66SRichard Henderson ;; 1466e3608d66SRichard Henderson ppc64) 1467e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1468e3608d66SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 146913a5abe2SAlex Bennée cross_cc_ppc64=$cc 147013a5abe2SAlex Bennée cross_cc_cflags_ppc64=$CPU_CFLAGS 1471e3608d66SRichard Henderson ;; 14729b9c37c3SRichard Henderson sparc) 1473f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1474f1079bb8SRichard Henderson LDFLAGS="-m32 -mv8plus $LDFLAGS" 147513a5abe2SAlex Bennée cross_cc_sparc=$cc 147613a5abe2SAlex Bennée cross_cc_cflags_sparc=$CPU_CFLAGS 14773142255cSblueswir1 ;; 1478ed968ff1SJuan Quintela sparc64) 147979f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1480f1079bb8SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 148113a5abe2SAlex Bennée cross_cc_sparc64=$cc 148213a5abe2SAlex Bennée cross_cc_cflags_sparc64=$CPU_CFLAGS 14833142255cSblueswir1 ;; 148476d83bdeSths s390) 1485061cdd81SRichard Henderson CPU_CFLAGS="-m31" 148628d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 148713a5abe2SAlex Bennée cross_cc_s390=$cc 148813a5abe2SAlex Bennée cross_cc_cflags_s390=$CPU_CFLAGS 148928d7cc49SRichard Henderson ;; 149028d7cc49SRichard Henderson s390x) 1491061cdd81SRichard Henderson CPU_CFLAGS="-m64" 149228d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 149313a5abe2SAlex Bennée cross_cc_s390x=$cc 149413a5abe2SAlex Bennée cross_cc_cflags_s390x=$CPU_CFLAGS 149576d83bdeSths ;; 149640293e58Sbellard i386) 149779f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 14980c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 1499716a507cSAlex Bennée cross_cc_i386=$cc 1500716a507cSAlex Bennée cross_cc_cflags_i386=$CPU_CFLAGS 150140293e58Sbellard ;; 150240293e58Sbellard x86_64) 15037ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 15047ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 15057ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 15067ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 15070c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 1508716a507cSAlex Bennée cross_cc_x86_64=$cc 1509716a507cSAlex Bennée cross_cc_cflags_x86_64=$CPU_CFLAGS 1510379f6698SPaul Brook ;; 1511c72b26ecSRichard Henderson x32) 1512c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1513c72b26ecSRichard Henderson LDFLAGS="-mx32 $LDFLAGS" 1514716a507cSAlex Bennée cross_cc_i386=$cc 151513a5abe2SAlex Bennée cross_cc_cflags_i386=$CPU_CFLAGS 1516c72b26ecSRichard Henderson ;; 151730163d89SPeter Maydell # No special flags required for other host CPUs 15183142255cSblueswir1esac 15193142255cSblueswir1 152079f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 152179f3b12fSPeter Crosthwaite 1522affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1523affc88ccSPeter Maydell# support, even if we're using TCI. 1524affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1525affc88ccSPeter Maydell bsd_user="no" 1526affc88ccSPeter Maydell linux_user="no" 1527affc88ccSPeter Maydellfi 1528affc88ccSPeter Maydell 152960e0df25SPeter Maydelldefault_target_list="" 153060e0df25SPeter Maydell 15316e92f823SPeter Maydellmak_wilds="" 15326e92f823SPeter Maydell 153360e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 15346e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 153560e0df25SPeter Maydellfi 153660e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 15376e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 153860e0df25SPeter Maydellfi 153960e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 15406e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 154160e0df25SPeter Maydellfi 154260e0df25SPeter Maydell 15436e92f823SPeter Maydellfor config in $mak_wilds; do 15446e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 15456e92f823SPeter Maydelldone 15466e92f823SPeter Maydell 1547c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 154864a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1549c53eeaf7SStefan Hajnoczi 1550af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1551af5db58eSpbrookcat << EOF 1552af5db58eSpbrook 1553af5db58eSpbrookUsage: configure [options] 1554af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1555af5db58eSpbrook 155608fb77edSStefan WeilStandard options: 155708fb77edSStefan Weil --help print this message 155808fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 155908fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 156008fb77edSStefan Weil use %M for cpu name [$interp_prefix] 156108fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 156208fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 156308fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 156408fb77edSStefan Weil 156508fb77edSStefan WeilAdvanced options (experts only): 156608fb77edSStefan Weil --source-path=PATH path of source code [$source_path] 156708fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 156808fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 156908fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 157008fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 157108fb77edSStefan Weil build time 157208fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 157308fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 157408fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 157511cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 157608fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1577d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1578d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 157908fb77edSStefan Weil --make=MAKE use specified make [$make] 158008fb77edSStefan Weil --install=INSTALL use specified install [$install] 158108fb77edSStefan Weil --python=PYTHON use specified python [$python] 158208fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1583db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 158408fb77edSStefan Weil --static enable static build [$static] 158508fb77edSStefan Weil --mandir=PATH install man pages in PATH 158608fb77edSStefan Weil --datadir=PATH install firmware in PATH$confsuffix 158708fb77edSStefan Weil --docdir=PATH install documentation in PATH$confsuffix 158808fb77edSStefan Weil --bindir=PATH install binaries in PATH 158908fb77edSStefan Weil --libdir=PATH install libraries in PATH 1590db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 159108fb77edSStefan Weil --sysconfdir=PATH install config in PATH$confsuffix 159208fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 15933d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 1594e26110cfSFam Zheng --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 1595db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 159608fb77edSStefan Weil --enable-debug enable common debug build options 1597247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 159808fb77edSStefan Weil --disable-strip disable stripping binaries 159908fb77edSStefan Weil --disable-werror disable compilation abort on warning 160063678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 160108fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 160208fb77edSStefan Weil Available drivers: $audio_possible_drivers 160308fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 160408fb77edSStefan Weil --block-drv-rw-whitelist=L 160508fb77edSStefan Weil set block driver read-write whitelist 160608fb77edSStefan Weil (affects only QEMU, not qemu-img) 160708fb77edSStefan Weil --block-drv-ro-whitelist=L 160808fb77edSStefan Weil set block driver read-only whitelist 160908fb77edSStefan Weil (affects only QEMU, not qemu-img) 16105b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1611c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 161208fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 161308fb77edSStefan Weil Default:trace-<pid> 1614c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1615c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 16165a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1617c23f23b9SMichael Tokarev --oss-lib path to OSS library 1618c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 161908fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 162033c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 162108fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 162208fb77edSStefan Weil --gcov=GCOV use specified gcov [$gcov_tool] 1623c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1624c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1625c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1626a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1627c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1628c12d66aaSLin Ma --enable-profiler profiler support 1629c12d66aaSLin Ma --enable-xen-pv-domain-build 1630c12d66aaSLin Ma xen pv domain builder 1631c12d66aaSLin Ma --enable-debug-stack-usage 1632c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 1633c23f23b9SMichael Tokarev 1634c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1635c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1636c23f23b9SMichael Tokarev 1637c23f23b9SMichael Tokarev system all system emulation targets 1638c23f23b9SMichael Tokarev user supported user emulation targets 1639c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1640c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1641c23f23b9SMichael Tokarev docs build documentation 1642c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1643c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1644c23f23b9SMichael Tokarev pie Position Independent Executables 1645c23f23b9SMichael Tokarev modules modules support 1646c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1647c23f23b9SMichael Tokarev debug-info debugging information 1648c23f23b9SMichael Tokarev sparse sparse checker 1649c23f23b9SMichael Tokarev 1650ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 165191bfcdb0SDaniel P. Berrange nettle nettle cryptography support 165291bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 1653c23f23b9SMichael Tokarev sdl SDL UI 1654c23f23b9SMichael Tokarev --with-sdlabi select preferred SDL ABI 1.2 or 2.0 1655c23f23b9SMichael Tokarev gtk gtk UI 1656c23f23b9SMichael Tokarev vte vte support for the gtk UI 1657c23f23b9SMichael Tokarev curses curses UI 1658c23f23b9SMichael Tokarev vnc VNC UI support 1659c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1660c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1661c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1662c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1663c23f23b9SMichael Tokarev virtfs VirtFS 1664fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1665c23f23b9SMichael Tokarev xen xen backend driver support 166670c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1667c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1668c23f23b9SMichael Tokarev curl curl connectivity 1669a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1670c23f23b9SMichael Tokarev fdt fdt device tree 1671c23f23b9SMichael Tokarev bluez bluez stack connectivity 1672c23f23b9SMichael Tokarev kvm KVM acceleration support 1673b0cb0a66SVincent Palatin hax HAX acceleration support 1674c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 1675d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 167621ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 167721ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1678c23f23b9SMichael Tokarev vde support for vde network 1679c23f23b9SMichael Tokarev netmap support for netmap network 1680c23f23b9SMichael Tokarev linux-aio Linux AIO support 1681c23f23b9SMichael Tokarev cap-ng libcap-ng support 1682c23f23b9SMichael Tokarev attr attr and xattr support 1683c23f23b9SMichael Tokarev vhost-net vhost-net acceleration support 1684042cea27SGonglei vhost-crypto vhost-crypto acceleration support 1685c23f23b9SMichael Tokarev spice spice 1686c23f23b9SMichael Tokarev rbd rados block device (rbd) 1687c23f23b9SMichael Tokarev libiscsi iscsi support 1688c23f23b9SMichael Tokarev libnfs nfs support 16897b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 1690c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1691ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1692c23f23b9SMichael Tokarev usb-redir usb network redirection support 1693c23f23b9SMichael Tokarev lzo support of lzo compression library 1694c23f23b9SMichael Tokarev snappy support of snappy compression library 1695c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1696c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 1697c23f23b9SMichael Tokarev seccomp seccomp support 1698c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1699c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1700c23f23b9SMichael Tokarev tpm TPM support 1701c23f23b9SMichael Tokarev libssh2 ssh block device support 1702c23f23b9SMichael Tokarev numa libnuma support 1703ed279a06SKlim Kireev libxml2 for Parallels image format 1704c23f23b9SMichael Tokarev tcmalloc tcmalloc support 17057b01cb97SAlexandre Derumier jemalloc jemalloc support 1706a6b1d4c0SChanglong Xie replication replication support 1707c12d66aaSLin Ma vhost-vsock virtio sockets device support 1708c12d66aaSLin Ma opengl opengl support 1709c12d66aaSLin Ma virglrenderer virgl rendering support 1710c12d66aaSLin Ma xfsctl xfsctl support 1711c12d66aaSLin Ma qom-cast-debug cast debugging support 1712c12d66aaSLin Ma tools build qemu-io, qemu-nbd and qemu-image tools 1713da92c3ffSAshish Mittal vxhs Veritas HyperScale vDisk backend support 1714f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 1715e6a74868SMarc-André Lureau vhost-user vhost-user support 17168ca80760SRichard Henderson capstone capstone disassembler support 1717ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 171817824406SJunyan He libpmem libpmem support 171908fb77edSStefan Weil 172008fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1721af5db58eSpbrookEOF 17222d2ad6d0SFam Zhengexit 0 1723af5db58eSpbrookfi 1724af5db58eSpbrook 1725c53eeaf7SStefan Hajnocziif ! has $python; then 1726c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1727c53eeaf7SStefan Hajnoczifi 1728c53eeaf7SStefan Hajnoczi 1729c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1730c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 17317f2b5544SEduardo Habkostif ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then 17327f2b5544SEduardo Habkost error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \ 1733c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1734c53eeaf7SStefan Hajnoczifi 1735c53eeaf7SStefan Hajnoczi 1736c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1737c53eeaf7SStefan Hajnoczipython="$python -B" 1738c53eeaf7SStefan Hajnoczi 17399aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 17409aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 17419aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 17429aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 17439aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 17449aae6e54SDaniel Henrique Barbozaif compile_object ; then 17459aae6e54SDaniel Henrique Barboza : C compiler works ok 17469aae6e54SDaniel Henrique Barbozaelse 17479aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 17489aae6e54SDaniel Henrique Barbozafi 17499aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 17509aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 17519aae6e54SDaniel Henrique Barbozafi 17529aae6e54SDaniel Henrique Barboza 1753359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1754359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1755359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1756359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1757359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1758359bc95dSPeter Maydell else 175976ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1760359bc95dSPeter Maydell fi 1761359bc95dSPeter Maydellfi 1762359bc95dSPeter Maydell 17639c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 17649c83ffd8SPeter Maydell# by default. Only enable by default for git builds 17659c83ffd8SPeter Maydellif test -z "$werror" ; then 17669c83ffd8SPeter Maydell if test -d "$source_path/.git" -a \ 1767e4650c81SThomas Huth \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then 17689c83ffd8SPeter Maydell werror="yes" 17699c83ffd8SPeter Maydell else 17709c83ffd8SPeter Maydell werror="no" 17719c83ffd8SPeter Maydell fi 17729c83ffd8SPeter Maydellfi 17739c83ffd8SPeter Maydell 1774fb59dabdSPeter Maydellif test "$bogus_os" = "yes"; then 1775fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1776fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1777fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1778fb59dabdSPeter Maydell # host OS we should stop now. 1779951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1780fb59dabdSPeter Maydellfi 1781fb59dabdSPeter Maydell 17828d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 17838d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 1784ac7568bdSDaniel P. Berrangegcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1785435405acSPranith Kumargcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" 1786b98fcfd8SPaolo Bonzinigcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" 178771429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags" 17880e39c4aaSGerd Hoffmanngcc_flags="-Wno-error=address-of-packed-member $gcc_flags" 17896ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 17906ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 17916ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 17926ca026cbSPeter Maydell# so it's too error prone. 179393b25869SJohn Snow 179493b25869SJohn Snowcc_has_warning_flag() { 179593b25869SJohn Snow write_c_skeleton; 179693b25869SJohn Snow 1797a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1798a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1799a1d29d6cSPeter Maydell # warning options). 180093b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 180193b25869SJohn Snow compile_prog "-Werror $optflag" "" 180293b25869SJohn Snow} 180393b25869SJohn Snow 180493b25869SJohn Snowfor flag in $gcc_flags; do 180593b25869SJohn Snow if cc_has_warning_flag $flag ; then 18068d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 18078d05095cSPaolo Bonzini fi 18088d05095cSPaolo Bonzinidone 18098d05095cSPaolo Bonzini 181063678e17SSteven Noonanif test "$stack_protector" != "no"; then 1811fccd35a0SRodrigo Rebello cat > $TMPC << EOF 1812fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 1813fccd35a0SRodrigo Rebello{ 1814fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 1815fccd35a0SRodrigo Rebello while (*c) { 1816fccd35a0SRodrigo Rebello *p++ = *c++; 1817fccd35a0SRodrigo Rebello } 1818fccd35a0SRodrigo Rebello return 0; 1819fccd35a0SRodrigo Rebello} 1820fccd35a0SRodrigo RebelloEOF 182163678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 18223b463a3fSMiroslav Rezanina sp_on=0 182363678e17SSteven Noonan for flag in $gcc_flags; do 1824590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 1825590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 1826590e5dd9SPeter Maydell if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && 1827590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 182863678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 18293b463a3fSMiroslav Rezanina sp_on=1 183063678e17SSteven Noonan break 183163678e17SSteven Noonan fi 183263678e17SSteven Noonan done 18333b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 18343b463a3fSMiroslav Rezanina if test $sp_on = 0; then 18353b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 18363b463a3fSMiroslav Rezanina fi 18373b463a3fSMiroslav Rezanina fi 183837746c5eSMarc-André Lureaufi 183937746c5eSMarc-André Lureau 184020bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 184120bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 184220bc94a2SPaolo Bonzinicat > $TMPC << EOF 184320bc94a2SPaolo Bonzinistruct { 184420bc94a2SPaolo Bonzini int a[2]; 184520bc94a2SPaolo Bonzini} x = {0}; 184620bc94a2SPaolo BonziniEOF 184720bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 184820bc94a2SPaolo Bonzini : 184920bc94a2SPaolo Bonzinielse 185020bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 185120bc94a2SPaolo Bonzinifi 185220bc94a2SPaolo Bonzini 1853cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1854cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1855cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1856cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1857cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1858cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1859cbdd1999SPaolo Bonziniint main(void) { return 0; } 1860cbdd1999SPaolo Bonzini#else 1861cbdd1999SPaolo Bonzini#error No bug in this compiler. 1862cbdd1999SPaolo Bonzini#endif 1863cbdd1999SPaolo BonziniEOF 1864cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1865cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1866cbdd1999SPaolo Bonzinifi 1867cbdd1999SPaolo Bonzini 186840d6444eSAvi Kivityif test "$static" = "yes" ; then 1869aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1870aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1871aa0d1f44SPaolo Bonzini fi 187240d6444eSAvi Kivity if test "$pie" = "yes" ; then 187376ad07a4SPeter Maydell error_exit "static and pie are mutually incompatible" 187440d6444eSAvi Kivity else 187540d6444eSAvi Kivity pie="no" 187640d6444eSAvi Kivity fi 187740d6444eSAvi Kivityfi 187840d6444eSAvi Kivity 1879768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 1880768b7855SEmilio G. Cota cat > $TMPC << EOF 1881768b7855SEmilio G. Cotastatic __thread int tls_var; 1882768b7855SEmilio G. Cotaint main(void) { return tls_var; } 1883768b7855SEmilio G. CotaEOF 1884768b7855SEmilio G. Cota 1885768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 1886768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 1887768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 1888768b7855SEmilio G. Cotafi 1889768b7855SEmilio G. Cota 189040d6444eSAvi Kivityif test "$pie" = ""; then 189140d6444eSAvi Kivity case "$cpu-$targetos" in 1892c72b26ecSRichard Henderson i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) 189340d6444eSAvi Kivity ;; 189440d6444eSAvi Kivity *) 189540d6444eSAvi Kivity pie="no" 189640d6444eSAvi Kivity ;; 189740d6444eSAvi Kivity esac 189840d6444eSAvi Kivityfi 189940d6444eSAvi Kivity 190040d6444eSAvi Kivityif test "$pie" != "no" ; then 190140d6444eSAvi Kivity cat > $TMPC << EOF 190221d4a791SAvi Kivity 190321d4a791SAvi Kivity#ifdef __linux__ 190421d4a791SAvi Kivity# define THREAD __thread 190521d4a791SAvi Kivity#else 190621d4a791SAvi Kivity# define THREAD 190721d4a791SAvi Kivity#endif 190821d4a791SAvi Kivity 190921d4a791SAvi Kivitystatic THREAD int tls_var; 191021d4a791SAvi Kivity 191121d4a791SAvi Kivityint main(void) { return tls_var; } 191221d4a791SAvi Kivity 191340d6444eSAvi KivityEOF 191440d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 191540d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 191640d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 191740d6444eSAvi Kivity pie="yes" 191840d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 191940d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 192040d6444eSAvi Kivity fi 192140d6444eSAvi Kivity else 192240d6444eSAvi Kivity if test "$pie" = "yes"; then 192376ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 192440d6444eSAvi Kivity else 192540d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 192640d6444eSAvi Kivity pie="no" 192740d6444eSAvi Kivity fi 192840d6444eSAvi Kivity fi 192946eef33bSBrad 1930e4a7b344SStefan Hajnoczi if compile_prog "-Werror -fno-pie" "-nopie"; then 193146eef33bSBrad CFLAGS_NOPIE="-fno-pie" 193246eef33bSBrad LDFLAGS_NOPIE="-nopie" 193346eef33bSBrad fi 193440d6444eSAvi Kivityfi 193540d6444eSAvi Kivity 193609dada40SPaolo Bonzini########################################## 193709dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 193809dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 193909dada40SPaolo Bonzini# specification is necessary 194009dada40SPaolo Bonzini 194109dada40SPaolo Bonziniif test "$cpu" = "i386"; then 194209dada40SPaolo Bonzini cat > $TMPC << EOF 194309dada40SPaolo Bonzinistatic int sfaa(int *ptr) 194409dada40SPaolo Bonzini{ 194509dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 194609dada40SPaolo Bonzini} 194709dada40SPaolo Bonzini 194809dada40SPaolo Bonziniint main(void) 194909dada40SPaolo Bonzini{ 195009dada40SPaolo Bonzini int val = 42; 19511405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 195209dada40SPaolo Bonzini sfaa(&val); 195309dada40SPaolo Bonzini return val; 195409dada40SPaolo Bonzini} 195509dada40SPaolo BonziniEOF 195609dada40SPaolo Bonzini if ! compile_prog "" "" ; then 195709dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 195809dada40SPaolo Bonzini fi 195909dada40SPaolo Bonzinifi 196009dada40SPaolo Bonzini 196109dada40SPaolo Bonzini######################################### 1962ec530c81Sbellard# Solaris specific configure tool chain decisions 196309dada40SPaolo Bonzini 1964ec530c81Sbellardif test "$solaris" = "yes" ; then 19656792aa11SLoïc Minier if has $install; then 19666792aa11SLoïc Minier : 19676792aa11SLoïc Minier else 196876ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 196976ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 197076ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1971ec530c81Sbellard fi 197289138857SStefan Weil if test "$(path_of $install)" = "/usr/sbin/install" ; then 197376ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 197476ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 197576ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1976ec530c81Sbellard fi 19776792aa11SLoïc Minier if has ar; then 19786792aa11SLoïc Minier : 19796792aa11SLoïc Minier else 1980ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 198176ad07a4SPeter Maydell error_exit "No path includes ar" \ 198276ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 1983ec530c81Sbellard fi 198476ad07a4SPeter Maydell error_exit "No path includes ar" 1985ec530c81Sbellard fi 1986ec530c81Sbellardfi 1987ec530c81Sbellard 1988afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1989d880a3baSPaolo Bonzini for target in $default_target_list; do 1990d880a3baSPaolo Bonzini supported_target $target 2>/dev/null && \ 1991d880a3baSPaolo Bonzini target_list="$target_list $target" 1992d880a3baSPaolo Bonzini done 1993d880a3baSPaolo Bonzini target_list="${target_list# }" 1994121afa9eSAnthony Liguorielse 199589138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 1996d880a3baSPaolo Bonzini for target in $target_list; do 199725b48338SPeter Maydell # Check that we recognised the target name; this allows a more 199825b48338SPeter Maydell # friendly error message than if we let it fall through. 199925b48338SPeter Maydell case " $default_target_list " in 200025b48338SPeter Maydell *" $target "*) 200125b48338SPeter Maydell ;; 200225b48338SPeter Maydell *) 200325b48338SPeter Maydell error_exit "Unknown target name '$target'" 200425b48338SPeter Maydell ;; 200525b48338SPeter Maydell esac 2006d880a3baSPaolo Bonzini supported_target $target || exit 1 200725b48338SPeter Maydell done 2008d880a3baSPaolo Bonzinifi 200925b48338SPeter Maydell 2010f55fe278SPaolo Bonzini# see if system emulation was really requested 2011f55fe278SPaolo Bonzinicase " $target_list " in 2012f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 2013f55fe278SPaolo Bonzini ;; 2014f55fe278SPaolo Bonzini *) softmmu=no 2015f55fe278SPaolo Bonzini ;; 2016f55fe278SPaolo Bonziniesac 20175327cf48Sbellard 2018249247c9SJuan Quintelafeature_not_found() { 2019249247c9SJuan Quintela feature=$1 202021684af0SStewart Smith remedy=$2 2021249247c9SJuan Quintela 202276ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 202321684af0SStewart Smith "configure was not able to find it." \ 202421684af0SStewart Smith "$remedy" 2025249247c9SJuan Quintela} 2026249247c9SJuan Quintela 20277d13299dSbellard# --- 20287d13299dSbellard# big/little endian test 20297d13299dSbellardcat > $TMPC << EOF 203061cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 203161cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 203261cc919fSMike Frysingerextern int foo(short *, short *); 203361cc919fSMike Frysingerint main(int argc, char *argv[]) { 203461cc919fSMike Frysinger return foo(big_endian, little_endian); 20357d13299dSbellard} 20367d13299dSbellardEOF 20377d13299dSbellard 203861cc919fSMike Frysingerif compile_object ; then 203912f15c91SAlice Frosi if strings -a $TMPO | grep -q BiGeNdIaN ; then 204061cc919fSMike Frysinger bigendian="yes" 204112f15c91SAlice Frosi elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 204261cc919fSMike Frysinger bigendian="no" 20437d13299dSbellard else 20447d13299dSbellard echo big/little test failed 20457d13299dSbellard fi 20467d13299dSbellardelse 204761cc919fSMike Frysinger echo big/little test failed 20487d13299dSbellardfi 20497d13299dSbellard 2050b0a47e79SJuan Quintela########################################## 2051a30878e7SPeter Maydell# cocoa implies not SDL or GTK 2052a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 2053a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 2054a30878e7SPeter Maydellif test "$cocoa" = "yes"; then 2055a30878e7SPeter Maydell if test "$sdl" = "yes"; then 2056a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2057a30878e7SPeter Maydell fi 2058a30878e7SPeter Maydell if test "$gtk" = "yes"; then 2059a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2060a30878e7SPeter Maydell fi 2061a30878e7SPeter Maydell gtk=no 2062a30878e7SPeter Maydell sdl=no 2063a30878e7SPeter Maydellfi 2064a30878e7SPeter Maydell 20656b39b063SEric Blake# Some versions of Mac OS X incorrectly define SIZE_MAX 20666b39b063SEric Blakecat > $TMPC << EOF 20676b39b063SEric Blake#include <stdint.h> 20686b39b063SEric Blake#include <stdio.h> 20696b39b063SEric Blakeint main(int argc, char *argv[]) { 20706b39b063SEric Blake return printf("%zu", SIZE_MAX); 20716b39b063SEric Blake} 20726b39b063SEric BlakeEOF 20736b39b063SEric Blakehave_broken_size_max=no 20746b39b063SEric Blakeif ! compile_object -Werror ; then 20756b39b063SEric Blake have_broken_size_max=yes 20766b39b063SEric Blakefi 20776b39b063SEric Blake 2078a30878e7SPeter Maydell########################################## 2079015a33bdSGonglei# L2TPV3 probe 2080015a33bdSGonglei 2081015a33bdSGongleicat > $TMPC <<EOF 2082015a33bdSGonglei#include <sys/socket.h> 2083bff6cb72SMichael Tokarev#include <linux/ip.h> 2084015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2085015a33bdSGongleiEOF 2086015a33bdSGongleiif compile_prog "" "" ; then 2087015a33bdSGonglei l2tpv3=yes 2088015a33bdSGongleielse 2089015a33bdSGonglei l2tpv3=no 2090015a33bdSGongleifi 2091015a33bdSGonglei 2092015a33bdSGonglei########################################## 20934d9310f4SDaniel P. Berrange# MinGW / Mingw-w64 localtime_r/gmtime_r check 20944d9310f4SDaniel P. Berrange 20954d9310f4SDaniel P. Berrangeif test "$mingw32" = "yes"; then 20964d9310f4SDaniel P. Berrange # Some versions of MinGW / Mingw-w64 lack localtime_r 20974d9310f4SDaniel P. Berrange # and gmtime_r entirely. 20984d9310f4SDaniel P. Berrange # 20994d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 define a macro for 21004d9310f4SDaniel P. Berrange # localtime_r/gmtime_r. 21014d9310f4SDaniel P. Berrange # 21024d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 will define functions 21034d9310f4SDaniel P. Berrange # for localtime_r/gmtime_r, but only if you have 21044d9310f4SDaniel P. Berrange # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 21054d9310f4SDaniel P. Berrange # though, unistd.h and pthread.h both define 21064d9310f4SDaniel P. Berrange # that for you. 21074d9310f4SDaniel P. Berrange # 21084d9310f4SDaniel P. Berrange # So this #undef localtime_r and #include <unistd.h> 21094d9310f4SDaniel P. Berrange # are not in fact redundant. 21104d9310f4SDaniel P. Berrangecat > $TMPC << EOF 21114d9310f4SDaniel P. Berrange#include <unistd.h> 21124d9310f4SDaniel P. Berrange#include <time.h> 21134d9310f4SDaniel P. Berrange#undef localtime_r 21144d9310f4SDaniel P. Berrangeint main(void) { localtime_r(NULL, NULL); return 0; } 21154d9310f4SDaniel P. BerrangeEOF 21164d9310f4SDaniel P. Berrange if compile_prog "" "" ; then 21174d9310f4SDaniel P. Berrange localtime_r="yes" 21184d9310f4SDaniel P. Berrange else 21194d9310f4SDaniel P. Berrange localtime_r="no" 21204d9310f4SDaniel P. Berrange fi 21214d9310f4SDaniel P. Berrangefi 21224d9310f4SDaniel P. Berrange 21234d9310f4SDaniel P. Berrange########################################## 2124779ab5e3SStefan Weil# pkg-config probe 2125779ab5e3SStefan Weil 2126779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 212776ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2128779ab5e3SStefan Weilfi 2129779ab5e3SStefan Weil 2130779ab5e3SStefan Weil########################################## 2131b0a47e79SJuan Quintela# NPTL probe 2132b0a47e79SJuan Quintela 213324cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2134bd0c5661Spbrook cat > $TMPC <<EOF 2135bd0c5661Spbrook#include <sched.h> 213630813ceaSpbrook#include <linux/futex.h> 2137182eacc0SStefan Weilint main(void) { 2138bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2139bd0c5661Spbrook#error bork 2140bd0c5661Spbrook#endif 2141182eacc0SStefan Weil return 0; 2142bd0c5661Spbrook} 2143bd0c5661SpbrookEOF 214424cb36a6SPeter Maydell if ! compile_object ; then 214521684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2146b0a47e79SJuan Quintela fi 2147bd0c5661Spbrookfi 2148bd0c5661Spbrook 214999f2dbd3SLiang Li######################################### 2150ac62922eSbalrog# zlib check 2151ac62922eSbalrog 21521ece9905SAlon Levyif test "$zlib" != "no" ; then 2153ac62922eSbalrog cat > $TMPC << EOF 2154ac62922eSbalrog#include <zlib.h> 2155ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 2156ac62922eSbalrogEOF 215752166aa0SJuan Quintela if compile_prog "" "-lz" ; then 2158ac62922eSbalrog : 2159ac62922eSbalrog else 216076ad07a4SPeter Maydell error_exit "zlib check failed" \ 216176ad07a4SPeter Maydell "Make sure to have the zlib libs and headers installed." 2162ac62922eSbalrog fi 21631ece9905SAlon Levyfi 2164eb0ecd5aSWill NewtonLIBS="$LIBS -lz" 2165ac62922eSbalrog 2166ac62922eSbalrog########################################## 2167607dacd0Sqiaonuohan# lzo check 2168607dacd0Sqiaonuohan 2169607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 2170607dacd0Sqiaonuohan cat > $TMPC << EOF 2171607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 2172607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 2173607dacd0SqiaonuohanEOF 2174607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 2175607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -llzo2" 2176b25c9dffSStefan Weil lzo="yes" 2177b25c9dffSStefan Weil else 2178b25c9dffSStefan Weil if test "$lzo" = "yes"; then 2179b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 2180b25c9dffSStefan Weil fi 2181b25c9dffSStefan Weil lzo="no" 2182b25c9dffSStefan Weil fi 2183607dacd0Sqiaonuohanfi 2184607dacd0Sqiaonuohan 2185607dacd0Sqiaonuohan########################################## 2186607dacd0Sqiaonuohan# snappy check 2187607dacd0Sqiaonuohan 2188607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 2189607dacd0Sqiaonuohan cat > $TMPC << EOF 2190607dacd0Sqiaonuohan#include <snappy-c.h> 2191607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 2192607dacd0SqiaonuohanEOF 2193607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 2194607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -lsnappy" 2195b25c9dffSStefan Weil snappy="yes" 2196b25c9dffSStefan Weil else 2197b25c9dffSStefan Weil if test "$snappy" = "yes"; then 2198b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 2199b25c9dffSStefan Weil fi 2200b25c9dffSStefan Weil snappy="no" 2201b25c9dffSStefan Weil fi 2202607dacd0Sqiaonuohanfi 2203607dacd0Sqiaonuohan 2204607dacd0Sqiaonuohan########################################## 22056b383c08SPeter Wu# bzip2 check 22066b383c08SPeter Wu 22076b383c08SPeter Wuif test "$bzip2" != "no" ; then 22086b383c08SPeter Wu cat > $TMPC << EOF 22096b383c08SPeter Wu#include <bzlib.h> 22106b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 22116b383c08SPeter WuEOF 22126b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 22136b383c08SPeter Wu bzip2="yes" 22146b383c08SPeter Wu else 22156b383c08SPeter Wu if test "$bzip2" = "yes"; then 22166b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 22176b383c08SPeter Wu fi 22186b383c08SPeter Wu bzip2="no" 22196b383c08SPeter Wu fi 22206b383c08SPeter Wufi 22216b383c08SPeter Wu 22226b383c08SPeter Wu########################################## 2223f794573eSEduardo Otubo# libseccomp check 2224f794573eSEduardo Otubo 2225d0699bd3SMarc-André Lureaulibseccomp_minver="2.2.0" 2226f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 2227693e5910SAndrew Jones case "$cpu" in 2228d0699bd3SMarc-André Lureau i386|x86_64|mips) 22295ce43972SJames Hogan ;; 2230693e5910SAndrew Jones arm|aarch64) 2231693e5910SAndrew Jones libseccomp_minver="2.2.3" 2232693e5910SAndrew Jones ;; 22333aa35fcfSThomas Huth ppc|ppc64|s390x) 22343e684455SMichael Strosaker libseccomp_minver="2.3.0" 22353e684455SMichael Strosaker ;; 2236693e5910SAndrew Jones *) 2237693e5910SAndrew Jones libseccomp_minver="" 2238693e5910SAndrew Jones ;; 2239693e5910SAndrew Jones esac 2240693e5910SAndrew Jones 2241693e5910SAndrew Jones if test "$libseccomp_minver" != "" && 2242693e5910SAndrew Jones $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2243c3883e1fSFam Zheng seccomp_cflags="$($pkg_config --cflags libseccomp)" 2244c3883e1fSFam Zheng seccomp_libs="$($pkg_config --libs libseccomp)" 2245f794573eSEduardo Otubo seccomp="yes" 2246f794573eSEduardo Otubo else 2247f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 2248693e5910SAndrew Jones if test "$libseccomp_minver" != "" ; then 2249693e5910SAndrew Jones feature_not_found "libseccomp" \ 2250693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 2251693e5910SAndrew Jones else 2252693e5910SAndrew Jones feature_not_found "libseccomp" \ 2253693e5910SAndrew Jones "libseccomp is not supported for host cpu $cpu" 2254693e5910SAndrew Jones fi 2255896848f0SEduardo Otubo fi 2256e84d5956SYann E. MORIN seccomp="no" 2257f794573eSEduardo Otubo fi 2258f794573eSEduardo Otubofi 2259f794573eSEduardo Otubo########################################## 2260e37630caSaliguori# xen probe 2261e37630caSaliguori 2262fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 2263c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2264c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2265c1cdd9d5SJuergen Gross # to obtain all needed flags. 2266c1cdd9d5SJuergen Gross 2267c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2268c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2269c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2270c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2271c1cdd9d5SJuergen Gross xen=yes 2272c1cdd9d5SJuergen Gross xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2273c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 227458ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 227558ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 227658ea9a7aSAnthony PERARD fi 2277c1cdd9d5SJuergen Gross QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" 2278c1cdd9d5SJuergen Gross libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" 2279c1cdd9d5SJuergen Gross LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS" 2280c1cdd9d5SJuergen Gross else 2281c1cdd9d5SJuergen Gross 2282b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 2283d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2284d5b93ddfSAnthony PERARD 228550ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 228650ced5b3SStefan Weil # If no, we are done and there is no Xen support. 228750ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 228850ced5b3SStefan Weil 228950ced5b3SStefan Weil # Xen (any) 229050ced5b3SStefan Weil cat > $TMPC <<EOF 229150ced5b3SStefan Weil#include <xenctrl.h> 229250ced5b3SStefan Weilint main(void) { 229350ced5b3SStefan Weil return 0; 229450ced5b3SStefan Weil} 229550ced5b3SStefan WeilEOF 229650ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 229750ced5b3SStefan Weil # Xen not found 229850ced5b3SStefan Weil if test "$xen" = "yes" ; then 229921684af0SStewart Smith feature_not_found "xen" "Install xen devel" 230050ced5b3SStefan Weil fi 230150ced5b3SStefan Weil xen=no 230250ced5b3SStefan Weil 2303d5b93ddfSAnthony PERARD # Xen unstable 230469deef08SPeter Maydell elif 230569deef08SPeter Maydell cat > $TMPC <<EOF && 23062cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 23072cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 23082cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2309d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 23102cbf8903SRoss Lagerwallint main(void) { 23112cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2312d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 23132cbf8903SRoss Lagerwall 23142cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 23152cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 23162cbf8903SRoss Lagerwall 2317d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2318d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2319d3c49ebbSPaul Durrant 23202cbf8903SRoss Lagerwall return 0; 23212cbf8903SRoss Lagerwall} 23222cbf8903SRoss LagerwallEOF 23232cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 23242cbf8903SRoss Lagerwall then 23252cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 23262cbf8903SRoss Lagerwall xen_ctrl_version=41100 23272cbf8903SRoss Lagerwall xen=yes 23282cbf8903SRoss Lagerwall elif 23292cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 23305ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 23315ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 233258ea9a7aSAnthony PERARD#include <xentoolcore.h> 23335ba3d756SIgor Druzhininint main(void) { 23345ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 23355ba3d756SIgor Druzhinin 23365ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 23375ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 233858ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 23395ba3d756SIgor Druzhinin 23405ba3d756SIgor Druzhinin return 0; 23415ba3d756SIgor Druzhinin} 23425ba3d756SIgor DruzhininEOF 234358ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 23445ba3d756SIgor Druzhinin then 234558ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 23465ba3d756SIgor Druzhinin xen_ctrl_version=41000 23475ba3d756SIgor Druzhinin xen=yes 23485ba3d756SIgor Druzhinin elif 23495ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2350da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2351da8090ccSPaul Durrant#define __XEN_TOOLS__ 2352da8090ccSPaul Durrant#include <xendevicemodel.h> 2353da8090ccSPaul Durrantint main(void) { 2354da8090ccSPaul Durrant xendevicemodel_handle *xd; 2355da8090ccSPaul Durrant 2356da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2357da8090ccSPaul Durrant xendevicemodel_close(xd); 2358da8090ccSPaul Durrant 2359da8090ccSPaul Durrant return 0; 2360da8090ccSPaul Durrant} 2361da8090ccSPaul DurrantEOF 2362da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2363da8090ccSPaul Durrant then 2364da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2365f1167ee6SJuergen Gross xen_ctrl_version=40900 2366da8090ccSPaul Durrant xen=yes 2367da8090ccSPaul Durrant elif 2368da8090ccSPaul Durrant cat > $TMPC <<EOF && 23695eeb39c2SIan Campbell/* 23705eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 23715eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2372b6eb9b45SPaulina Szubarczyk * 2373b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2374b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2375b6eb9b45SPaulina Szubarczyk */ 2376b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2377b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2378b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2379b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2380b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2381b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2382b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2383b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2384b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2385b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2386b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2387b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2388b6eb9b45SPaulina Szubarczyk#endif 2389b6eb9b45SPaulina Szubarczykint main(void) { 2390b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2391b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2392b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2393b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2394b6eb9b45SPaulina Szubarczyk xen_domain_handle_t handle; 2395b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2396b6eb9b45SPaulina Szubarczyk 2397b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2398b6eb9b45SPaulina Szubarczyk 2399b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2400b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2401b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2402b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2403b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2404b6eb9b45SPaulina Szubarczyk xc_domain_create(xc, 0, handle, 0, NULL, NULL); 2405b6eb9b45SPaulina Szubarczyk 2406b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2407b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2408b6eb9b45SPaulina Szubarczyk 2409b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2410b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2411b6eb9b45SPaulina Szubarczyk 2412b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2413b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2414b6eb9b45SPaulina Szubarczyk 2415b6eb9b45SPaulina Szubarczyk return 0; 2416b6eb9b45SPaulina Szubarczyk} 2417b6eb9b45SPaulina SzubarczykEOF 2418b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2419b6eb9b45SPaulina Szubarczyk then 2420f1167ee6SJuergen Gross xen_ctrl_version=40800 2421b6eb9b45SPaulina Szubarczyk xen=yes 2422b6eb9b45SPaulina Szubarczyk elif 2423b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2424b6eb9b45SPaulina Szubarczyk/* 2425b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2426b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 24275eeb39c2SIan Campbell */ 24285eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 24295eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 24305eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 24315eeb39c2SIan Campbell#include <xenctrl.h> 24325eeb39c2SIan Campbell#include <xenstore.h> 24335eeb39c2SIan Campbell#include <xenevtchn.h> 24345eeb39c2SIan Campbell#include <xengnttab.h> 24355eeb39c2SIan Campbell#include <xenforeignmemory.h> 24365eeb39c2SIan Campbell#include <stdint.h> 24375eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 24385eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 24395eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 24405eeb39c2SIan Campbell#endif 24415eeb39c2SIan Campbellint main(void) { 24425eeb39c2SIan Campbell xc_interface *xc = NULL; 24435eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 24445eeb39c2SIan Campbell xenevtchn_handle *xe; 24455eeb39c2SIan Campbell xengnttab_handle *xg; 24465eeb39c2SIan Campbell xen_domain_handle_t handle; 24475eeb39c2SIan Campbell 24485eeb39c2SIan Campbell xs_daemon_open(); 24495eeb39c2SIan Campbell 24505eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 24515eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 24525eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 24535eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 24545eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 24555eeb39c2SIan Campbell xc_domain_create(xc, 0, handle, 0, NULL, NULL); 24565eeb39c2SIan Campbell 24575eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 24585eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 24595eeb39c2SIan Campbell 24605eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 24615eeb39c2SIan Campbell xenevtchn_fd(xe); 24625eeb39c2SIan Campbell 24635eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 24645eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 24655eeb39c2SIan Campbell 24665eeb39c2SIan Campbell return 0; 24675eeb39c2SIan Campbell} 24685eeb39c2SIan CampbellEOF 24695eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 24705eeb39c2SIan Campbell then 2471f1167ee6SJuergen Gross xen_ctrl_version=40701 24725eeb39c2SIan Campbell xen=yes 24735eeb39c2SIan Campbell elif 24745eeb39c2SIan Campbell cat > $TMPC <<EOF && 2475e37630caSaliguori#include <xenctrl.h> 2476cdadde39SRoger Pau Monne#include <stdint.h> 2477cdadde39SRoger Pau Monneint main(void) { 2478cdadde39SRoger Pau Monne xc_interface *xc = NULL; 2479cdadde39SRoger Pau Monne xen_domain_handle_t handle; 2480cdadde39SRoger Pau Monne xc_domain_create(xc, 0, handle, 0, NULL, NULL); 2481cdadde39SRoger Pau Monne return 0; 2482cdadde39SRoger Pau Monne} 2483cdadde39SRoger Pau MonneEOF 2484cdadde39SRoger Pau Monne compile_prog "" "$xen_libs" 2485cdadde39SRoger Pau Monne then 2486f1167ee6SJuergen Gross xen_ctrl_version=40700 2487cdadde39SRoger Pau Monne xen=yes 2488cdadde39SRoger Pau Monne 2489cdadde39SRoger Pau Monne # Xen 4.6 2490cdadde39SRoger Pau Monne elif 2491cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2492cdadde39SRoger Pau Monne#include <xenctrl.h> 2493e108a3c1SAnthony PERARD#include <xenstore.h> 2494d5b93ddfSAnthony PERARD#include <stdint.h> 2495d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2496d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2497d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2498d5b93ddfSAnthony PERARD#endif 2499d5b93ddfSAnthony PERARDint main(void) { 2500d5b93ddfSAnthony PERARD xc_interface *xc; 2501d5b93ddfSAnthony PERARD xs_daemon_open(); 2502d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2503d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2504d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2505b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 25068688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2507d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 250820a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2509d8b441a3SJan Beulich return 0; 2510d8b441a3SJan Beulich} 2511d8b441a3SJan BeulichEOF 2512d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2513d8b441a3SJan Beulich then 2514f1167ee6SJuergen Gross xen_ctrl_version=40600 2515d8b441a3SJan Beulich xen=yes 2516d8b441a3SJan Beulich 2517d8b441a3SJan Beulich # Xen 4.5 2518d8b441a3SJan Beulich elif 2519d8b441a3SJan Beulich cat > $TMPC <<EOF && 2520d8b441a3SJan Beulich#include <xenctrl.h> 2521d8b441a3SJan Beulich#include <xenstore.h> 2522d8b441a3SJan Beulich#include <stdint.h> 2523d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2524d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2525d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2526d8b441a3SJan Beulich#endif 2527d8b441a3SJan Beulichint main(void) { 2528d8b441a3SJan Beulich xc_interface *xc; 2529d8b441a3SJan Beulich xs_daemon_open(); 2530d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2531d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2532d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2533d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2534d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 25353996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 25363996e85cSPaul Durrant return 0; 25373996e85cSPaul Durrant} 25383996e85cSPaul DurrantEOF 25393996e85cSPaul Durrant compile_prog "" "$xen_libs" 25403996e85cSPaul Durrant then 2541f1167ee6SJuergen Gross xen_ctrl_version=40500 25423996e85cSPaul Durrant xen=yes 25433996e85cSPaul Durrant 25443996e85cSPaul Durrant elif 25453996e85cSPaul Durrant cat > $TMPC <<EOF && 25463996e85cSPaul Durrant#include <xenctrl.h> 25473996e85cSPaul Durrant#include <xenstore.h> 25483996e85cSPaul Durrant#include <stdint.h> 25493996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 25503996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 25513996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 25523996e85cSPaul Durrant#endif 25533996e85cSPaul Durrantint main(void) { 25543996e85cSPaul Durrant xc_interface *xc; 25553996e85cSPaul Durrant xs_daemon_open(); 25563996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 25573996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 25583996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 25593996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 25603996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 25618688e065SStefano Stabellini return 0; 25628688e065SStefano Stabellini} 25638688e065SStefano StabelliniEOF 25648688e065SStefano Stabellini compile_prog "" "$xen_libs" 256569deef08SPeter Maydell then 2566f1167ee6SJuergen Gross xen_ctrl_version=40200 25678688e065SStefano Stabellini xen=yes 25688688e065SStefano Stabellini 2569e37630caSaliguori else 2570fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 2571edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2572edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2573fc321b4bSJuan Quintela fi 2574fc321b4bSJuan Quintela xen=no 2575e37630caSaliguori fi 2576d5b93ddfSAnthony PERARD 2577d5b93ddfSAnthony PERARD if test "$xen" = yes; then 2578f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 25795eeb39c2SIan Campbell libs_softmmu="$xen_stable_libs $libs_softmmu" 25805eeb39c2SIan Campbell fi 2581d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 2582d5b93ddfSAnthony PERARD fi 2583e37630caSaliguori fi 2584c1cdd9d5SJuergen Grossfi 2585e37630caSaliguori 2586eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 2587edfb07edSIan Campbell if test "$xen" = "yes" && test "$linux" = "yes"; then 2588eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 2589eb6fda0fSAnthony PERARD else 2590eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 259176ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 259276ad07a4SPeter Maydell " but this feature requires /sys from Linux" 2593eb6fda0fSAnthony PERARD fi 2594eb6fda0fSAnthony PERARD xen_pci_passthrough=no 2595eb6fda0fSAnthony PERARD fi 2596eb6fda0fSAnthony PERARDfi 2597eb6fda0fSAnthony PERARD 259864a7ad6fSIan Campbellif test "$xen_pv_domain_build" = "yes" && 259964a7ad6fSIan Campbell test "$xen" != "yes"; then 260064a7ad6fSIan Campbell error_exit "User requested Xen PV domain builder support" \ 260164a7ad6fSIan Campbell "which requires Xen support." 260264a7ad6fSIan Campbellfi 260364a7ad6fSIan Campbell 2604e37630caSaliguori########################################## 2605d661d9a4SJustin Terry (VM)# Windows Hypervisor Platform accelerator (WHPX) check 2606d661d9a4SJustin Terry (VM)if test "$whpx" != "no" ; then 2607327fccb2SLucian Petrut if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then 2608d661d9a4SJustin Terry (VM) whpx="yes" 2609d661d9a4SJustin Terry (VM) else 2610d661d9a4SJustin Terry (VM) if test "$whpx" = "yes"; then 261153537bb1SJustin Terry (VM) via Qemu-devel feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" 2612d661d9a4SJustin Terry (VM) fi 2613d661d9a4SJustin Terry (VM) whpx="no" 2614d661d9a4SJustin Terry (VM) fi 2615d661d9a4SJustin Terry (VM)fi 2616d661d9a4SJustin Terry (VM) 2617d661d9a4SJustin Terry (VM)########################################## 2618dfffc653SJuan Quintela# Sparse probe 2619dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 26200dba6195SLoïc Minier if has cgcc; then 2621dfffc653SJuan Quintela sparse=yes 2622dfffc653SJuan Quintela else 2623dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 262421684af0SStewart Smith feature_not_found "sparse" "Install sparse binary" 2625dfffc653SJuan Quintela fi 2626dfffc653SJuan Quintela sparse=no 2627dfffc653SJuan Quintela fi 2628dfffc653SJuan Quintelafi 2629dfffc653SJuan Quintela 2630dfffc653SJuan Quintela########################################## 2631f676c67eSJeremy White# X11 probe 2632f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 26338781595bSGerd Hoffmann have_x11=yes 263489138857SStefan Weil x11_cflags=$($pkg_config --cflags x11) 263589138857SStefan Weil x11_libs=$($pkg_config --libs x11) 2636f676c67eSJeremy Whitefi 2637f676c67eSJeremy White 2638f676c67eSJeremy White########################################## 2639a4ccabcfSAnthony Liguori# GTK probe 2640a4ccabcfSAnthony Liguori 26415a464e6cSPeter Xuif test "$gtk" != "no"; then 264289d85cdeSDaniel P. Berrangé gtkpackage="gtk+-3.0" 264389d85cdeSDaniel P. Berrangé gtkx11package="gtk+-x11-3.0" 264458296cb6SDaniel P. Berrangé gtkversion="3.14.0" 2645bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 264689138857SStefan Weil gtk_cflags=$($pkg_config --cflags $gtkpackage) 264789138857SStefan Weil gtk_libs=$($pkg_config --libs $gtkpackage) 264889138857SStefan Weil gtk_version=$($pkg_config --modversion $gtkpackage) 26490a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 26508781595bSGerd Hoffmann need_x11=yes 2651f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 2652f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 26530a337ed0SGerd Hoffmann fi 2654bbbf9bfbSStefan Weil gtk="yes" 2655bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 26565fe309ffSGerd Hoffmann feature_not_found "gtk" "Install gtk3-devel" 2657bbbf9bfbSStefan Weil else 2658bbbf9bfbSStefan Weil gtk="no" 2659bbbf9bfbSStefan Weil fi 2660bbbf9bfbSStefan Weilfi 2661bbbf9bfbSStefan Weil 2662ddbb0d09SDaniel P. Berrange 2663ddbb0d09SDaniel P. Berrange########################################## 2664ddbb0d09SDaniel P. Berrange# GNUTLS probe 2665ddbb0d09SDaniel P. Berrange 2666ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 2667a0722409SDaniel P. Berrangé if $pkg_config --exists "gnutls >= 3.1.18"; then 266889138857SStefan Weil gnutls_cflags=$($pkg_config --cflags gnutls) 266989138857SStefan Weil gnutls_libs=$($pkg_config --libs gnutls) 2670ddbb0d09SDaniel P. Berrange libs_softmmu="$gnutls_libs $libs_softmmu" 2671ddbb0d09SDaniel P. Berrange libs_tools="$gnutls_libs $libs_tools" 2672ddbb0d09SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 2673ddbb0d09SDaniel P. Berrange gnutls="yes" 2674ddbb0d09SDaniel P. Berrange elif test "$gnutls" = "yes"; then 2675a0722409SDaniel P. Berrangé feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 2676ddbb0d09SDaniel P. Berrange else 2677ddbb0d09SDaniel P. Berrange gnutls="no" 2678ddbb0d09SDaniel P. Berrange fi 2679ddbb0d09SDaniel P. Berrangefi 2680ddbb0d09SDaniel P. Berrange 268191bfcdb0SDaniel P. Berrange 268291bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 268391bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 2684a0722409SDaniel P. Berrangé# explicitly 268591bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 268691bfcdb0SDaniel P. Berrangethen 2687a0722409SDaniel P. Berrangé if test "$nettle" = "yes" 268891bfcdb0SDaniel P. Berrange then 268991bfcdb0SDaniel P. Berrange gcrypt="no" 269091bfcdb0SDaniel P. Berrange fi 269191bfcdb0SDaniel P. Berrangefi 269291bfcdb0SDaniel P. Berrange 269391bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 269491bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 2695a0722409SDaniel P. Berrangé# explicitly 269691bfcdb0SDaniel P. Berrangeif test -z "$nettle" 269791bfcdb0SDaniel P. Berrangethen 2698a0722409SDaniel P. Berrangé if test "$gcrypt" = "yes" 269991bfcdb0SDaniel P. Berrange then 270091bfcdb0SDaniel P. Berrange nettle="no" 270191bfcdb0SDaniel P. Berrange fi 270291bfcdb0SDaniel P. Berrangefi 270391bfcdb0SDaniel P. Berrange 2704dea7a64eSDaniel P. Berrangéhas_libgcrypt() { 270591bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 270691bfcdb0SDaniel P. Berrange then 270791bfcdb0SDaniel P. Berrange return 1 270891bfcdb0SDaniel P. Berrange fi 270991bfcdb0SDaniel P. Berrange 271091bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 271191bfcdb0SDaniel P. Berrange then 271289138857SStefan Weil host=$(libgcrypt-config --host) 271391bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 271491bfcdb0SDaniel P. Berrange then 271591bfcdb0SDaniel P. Berrange return 1 271691bfcdb0SDaniel P. Berrange fi 271791bfcdb0SDaniel P. Berrange fi 271891bfcdb0SDaniel P. Berrange 2719dea7a64eSDaniel P. Berrangé maj=`libgcrypt-config --version | awk -F . '{print $1}'` 2720dea7a64eSDaniel P. Berrangé min=`libgcrypt-config --version | awk -F . '{print $2}'` 2721dea7a64eSDaniel P. Berrangé 2722dea7a64eSDaniel P. Berrangé if test $maj != 1 || test $min -lt 5 2723dea7a64eSDaniel P. Berrangé then 2724dea7a64eSDaniel P. Berrangé return 1 2725dea7a64eSDaniel P. Berrangé fi 2726dea7a64eSDaniel P. Berrangé 272791bfcdb0SDaniel P. Berrange return 0 272891bfcdb0SDaniel P. Berrange} 272991bfcdb0SDaniel P. Berrange 2730a0722409SDaniel P. Berrangé 2731a0722409SDaniel P. Berrangéif test "$nettle" != "no"; then 2732*64dd2f3bSDaniel P. Berrangé if $pkg_config --exists "nettle >= 2.7.1"; then 2733a0722409SDaniel P. Berrangé nettle_cflags=$($pkg_config --cflags nettle) 2734a0722409SDaniel P. Berrangé nettle_libs=$($pkg_config --libs nettle) 2735a0722409SDaniel P. Berrangé nettle_version=$($pkg_config --modversion nettle) 2736a0722409SDaniel P. Berrangé libs_softmmu="$nettle_libs $libs_softmmu" 2737a0722409SDaniel P. Berrangé libs_tools="$nettle_libs $libs_tools" 2738a0722409SDaniel P. Berrangé QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 2739a0722409SDaniel P. Berrangé nettle="yes" 2740a0722409SDaniel P. Berrangé 2741a0722409SDaniel P. Berrangé if test -z "$gcrypt"; then 2742a0722409SDaniel P. Berrangé gcrypt="no" 2743a0722409SDaniel P. Berrangé fi 2744a0722409SDaniel P. Berrangé else 2745a0722409SDaniel P. Berrangé if test "$nettle" = "yes"; then 2746*64dd2f3bSDaniel P. Berrangé feature_not_found "nettle" "Install nettle devel >= 2.7.1" 2747a0722409SDaniel P. Berrangé else 2748a0722409SDaniel P. Berrangé nettle="no" 2749a0722409SDaniel P. Berrangé fi 2750a0722409SDaniel P. Berrangé fi 2751a0722409SDaniel P. Berrangéfi 2752a0722409SDaniel P. Berrangé 275391bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 2754dea7a64eSDaniel P. Berrangé if has_libgcrypt; then 275589138857SStefan Weil gcrypt_cflags=$(libgcrypt-config --cflags) 275689138857SStefan Weil gcrypt_libs=$(libgcrypt-config --libs) 275791bfcdb0SDaniel P. Berrange # Debian has remove -lgpg-error from libgcrypt-config 275891bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 275991bfcdb0SDaniel P. Berrange # turn breaks static builds... 276091bfcdb0SDaniel P. Berrange if test "$static" = "yes" 276191bfcdb0SDaniel P. Berrange then 276291bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 276391bfcdb0SDaniel P. Berrange fi 276462893b67SDaniel P. Berrange libs_softmmu="$gcrypt_libs $libs_softmmu" 276562893b67SDaniel P. Berrange libs_tools="$gcrypt_libs $libs_tools" 276662893b67SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 276791bfcdb0SDaniel P. Berrange gcrypt="yes" 276837788f25SDaniel P. Berrange 276937788f25SDaniel P. Berrange cat > $TMPC << EOF 277037788f25SDaniel P. Berrange#include <gcrypt.h> 277137788f25SDaniel P. Berrangeint main(void) { 27721f923c70SLongpeng(Mike) gcry_mac_hd_t handle; 27731f923c70SLongpeng(Mike) gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 27741f923c70SLongpeng(Mike) GCRY_MAC_FLAG_SECURE, NULL); 27751f923c70SLongpeng(Mike) return 0; 27761f923c70SLongpeng(Mike)} 27771f923c70SLongpeng(Mike)EOF 27781f923c70SLongpeng(Mike) if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 27791f923c70SLongpeng(Mike) gcrypt_hmac=yes 27801f923c70SLongpeng(Mike) fi 278162893b67SDaniel P. Berrange else 278291bfcdb0SDaniel P. Berrange if test "$gcrypt" = "yes"; then 2783dea7a64eSDaniel P. Berrangé feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 278491bfcdb0SDaniel P. Berrange else 278591bfcdb0SDaniel P. Berrange gcrypt="no" 278691bfcdb0SDaniel P. Berrange fi 278762893b67SDaniel P. Berrange fi 278862893b67SDaniel P. Berrangefi 278962893b67SDaniel P. Berrange 2790ddbb0d09SDaniel P. Berrange 279191bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 279291bfcdb0SDaniel P. Berrangethen 279391bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 279491bfcdb0SDaniel P. Berrangefi 2795ed754746SDaniel P. Berrange 27969a2fd434SDaniel P. Berrange########################################## 27979a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 27989a2fd434SDaniel P. Berrange 27999a2fd434SDaniel P. Berrangetasn1=yes 280090246037SDaniel P. Berrangetasn1_cflags="" 280190246037SDaniel P. Berrangetasn1_libs="" 28029a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 280389138857SStefan Weil tasn1_cflags=$($pkg_config --cflags libtasn1) 280489138857SStefan Weil tasn1_libs=$($pkg_config --libs libtasn1) 28059a2fd434SDaniel P. Berrangeelse 28069a2fd434SDaniel P. Berrange tasn1=no 28079a2fd434SDaniel P. Berrangefi 28089a2fd434SDaniel P. Berrange 2809ed754746SDaniel P. Berrange 2810bbbf9bfbSStefan Weil########################################## 2811559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 2812559607eaSDaniel P. Berrange 2813559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 2814559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 2815559607eaSDaniel P. Berrange have_ifaddrs_h=no 2816559607eaSDaniel P. Berrangefi 2817559607eaSDaniel P. Berrange 2818559607eaSDaniel P. Berrange########################################## 2819bbbf9bfbSStefan Weil# VTE probe 2820bbbf9bfbSStefan Weil 2821bbbf9bfbSStefan Weilif test "$vte" != "no"; then 2822c6feff9eSCole Robinson vteminversion="0.32.0" 2823c6feff9eSCole Robinson if $pkg_config --exists "vte-2.91"; then 2824c6feff9eSCole Robinson vtepackage="vte-2.91" 2825c6feff9eSCole Robinson else 2826528de90aSDaniel P. Berrange vtepackage="vte-2.90" 2827c6feff9eSCole Robinson fi 2828c6feff9eSCole Robinson if $pkg_config --exists "$vtepackage >= $vteminversion"; then 282989138857SStefan Weil vte_cflags=$($pkg_config --cflags $vtepackage) 283089138857SStefan Weil vte_libs=$($pkg_config --libs $vtepackage) 283189138857SStefan Weil vteversion=$($pkg_config --modversion $vtepackage) 2832bbbf9bfbSStefan Weil vte="yes" 2833bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 2834c6feff9eSCole Robinson feature_not_found "vte" "Install libvte-2.90/2.91 devel" 28359e04c683SStefan Weil else 2836bbbf9bfbSStefan Weil vte="no" 2837a4ccabcfSAnthony Liguori fi 2838a4ccabcfSAnthony Liguorifi 2839a4ccabcfSAnthony Liguori 2840a4ccabcfSAnthony Liguori########################################## 284111d9f695Sbellard# SDL probe 284211d9f695Sbellard 28433ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 28443ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 284547c03744SDave Airlie 2846c6093a05SPeter Xusdl_probe () 2847c6093a05SPeter Xu{ 2848c6093a05SPeter Xu sdl_too_old=no 2849ee8466d0SCole Robinson if test "$sdlabi" = ""; then 28508f4ea9cdSGerd Hoffmann if $pkg_config --exists "sdl2"; then 2851ee8466d0SCole Robinson sdlabi=2.0 28528f4ea9cdSGerd Hoffmann elif $pkg_config --exists "sdl"; then 2853ee8466d0SCole Robinson sdlabi=1.2 28548f4ea9cdSGerd Hoffmann else 28558f4ea9cdSGerd Hoffmann sdlabi=2.0 2856ee8466d0SCole Robinson fi 2857ee8466d0SCole Robinson fi 2858ee8466d0SCole Robinson 285947c03744SDave Airlie if test $sdlabi = "2.0"; then 286047c03744SDave Airlie sdl_config=$sdl2_config 286147c03744SDave Airlie sdlname=sdl2 286247c03744SDave Airlie sdlconfigname=sdl2_config 2863e07047cfSCole Robinson elif test $sdlabi = "1.2"; then 286447c03744SDave Airlie sdlname=sdl 286547c03744SDave Airlie sdlconfigname=sdl_config 2866e07047cfSCole Robinson else 2867e07047cfSCole Robinson error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" 28683ec87ffeSPaolo Bonzini fi 28693ec87ffeSPaolo Bonzini 287089138857SStefan Weil if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then 287147c03744SDave Airlie sdl_config=$sdlconfigname 287247c03744SDave Airlie fi 287347c03744SDave Airlie 287447c03744SDave Airlie if $pkg_config $sdlname --exists; then 287547c03744SDave Airlie sdlconfig="$pkg_config $sdlname" 287689138857SStefan Weil sdlversion=$($sdlconfig --modversion 2>/dev/null) 28773ec87ffeSPaolo Bonzini elif has ${sdl_config}; then 28783ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 287989138857SStefan Weil sdlversion=$($sdlconfig --version) 2880a0dfd8a4SLoïc Minier else 2881a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 28828f4ea9cdSGerd Hoffmann feature_not_found "sdl" "Install SDL2-devel" 2883a0dfd8a4SLoïc Minier fi 2884a0dfd8a4SLoïc Minier sdl=no 2885c6093a05SPeter Xu # no need to do the rest 2886c6093a05SPeter Xu return 28879316f803SPaolo Bonzini fi 288829e5badaSScott Wood if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 28893ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 28903ec87ffeSPaolo Bonzini fi 289111d9f695Sbellard 289211d9f695Sbellard cat > $TMPC << EOF 289311d9f695Sbellard#include <SDL.h> 289411d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 289511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 289611d9f695SbellardEOF 289789138857SStefan Weil sdl_cflags=$($sdlconfig --cflags 2>/dev/null) 28982ca5c430SGerd Hoffmann sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug 289974f42e18STeLeMan if test "$static" = "yes" ; then 29005f37e6d4SThomas Huth if $pkg_config $sdlname --exists; then 29015f37e6d4SThomas Huth sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null) 29025f37e6d4SThomas Huth else 290389138857SStefan Weil sdl_libs=$($sdlconfig --static-libs 2>/dev/null) 29045f37e6d4SThomas Huth fi 290574f42e18STeLeMan else 290689138857SStefan Weil sdl_libs=$($sdlconfig --libs 2>/dev/null) 290774f42e18STeLeMan fi 290852166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 290989138857SStefan Weil if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then 291011d9f695Sbellard sdl_too_old=yes 291111d9f695Sbellard else 291211d9f695Sbellard sdl=yes 291311d9f695Sbellard fi 29147c1f25b4Sbellard 291567c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 29161ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 291767c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 291889138857SStefan Weil sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" 291989138857SStefan Weil sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" 292011d9f695Sbellard fi 292152166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 29221ac88f28SJuan Quintela : 29231ac88f28SJuan Quintela else 29241ac88f28SJuan Quintela sdl=no 29257c1f25b4Sbellard fi 29267c1f25b4Sbellard fi # static link 2927c4198157SJuan Quintela else # sdl not found 2928c4198157SJuan Quintela if test "$sdl" = "yes" ; then 292921684af0SStewart Smith feature_not_found "sdl" "Install SDL devel" 2930c4198157SJuan Quintela fi 2931c4198157SJuan Quintela sdl=no 29327c1f25b4Sbellard fi # sdl compile test 2933c6093a05SPeter Xu} 2934c6093a05SPeter Xu 2935c6093a05SPeter Xuif test "$sdl" != "no" ; then 2936c6093a05SPeter Xu sdl_probe 2937fd677642Sthsfi 293811d9f695Sbellard 29395368a422Saliguoriif test "$sdl" = "yes" ; then 29405368a422Saliguori cat > $TMPC <<EOF 29415368a422Saliguori#include <SDL.h> 29425368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 29435368a422Saliguori#include <X11/XKBlib.h> 29445368a422Saliguori#else 29455368a422Saliguori#error No x11 support 29465368a422Saliguori#endif 29475368a422Saliguoriint main(void) { return 0; } 29485368a422SaliguoriEOF 2949f676c67eSJeremy White if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then 29508781595bSGerd Hoffmann need_x11=yes 2951f676c67eSJeremy White sdl_cflags="$sdl_cflags $x11_cflags" 2952f676c67eSJeremy White sdl_libs="$sdl_libs $x11_libs" 29535368a422Saliguori fi 29545368a422Saliguorifi 29555368a422Saliguori 29568f28f3fbSths########################################## 29572da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 29582da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 29592da776dbSMichael R. Hines cat > $TMPC <<EOF 29602da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 29612da776dbSMichael R. Hinesint main(void) { return 0; } 29622da776dbSMichael R. HinesEOF 2963ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 29642da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 29652da776dbSMichael R. Hines rdma="yes" 2966ef6d4ccdSYuval Shaia libs_softmmu="$libs_softmmu $rdma_libs" 29672da776dbSMichael R. Hines else 29682da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 29692da776dbSMichael R. Hines error_exit \ 2970ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 29712da776dbSMichael R. Hines " Your options:" \ 2972ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 29732da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 29742da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 29752da776dbSMichael R. Hines fi 29762da776dbSMichael R. Hines rdma="no" 29772da776dbSMichael R. Hines fi 29782da776dbSMichael R. Hinesfi 29792da776dbSMichael R. Hines 298021ab34c9SMarcel Apfelbaum########################################## 298121ab34c9SMarcel Apfelbaum# PVRDMA detection 298221ab34c9SMarcel Apfelbaum 298321ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 298421ab34c9SMarcel Apfelbaum#include <sys/mman.h> 298521ab34c9SMarcel Apfelbaum 298621ab34c9SMarcel Apfelbaumint 298721ab34c9SMarcel Apfelbaummain(void) 298821ab34c9SMarcel Apfelbaum{ 298921ab34c9SMarcel Apfelbaum char buf = 0; 299021ab34c9SMarcel Apfelbaum void *addr = &buf; 299121ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 299221ab34c9SMarcel Apfelbaum 299321ab34c9SMarcel Apfelbaum return 0; 299421ab34c9SMarcel Apfelbaum} 299521ab34c9SMarcel ApfelbaumEOF 299621ab34c9SMarcel Apfelbaum 299721ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 299821ab34c9SMarcel Apfelbaum case "$pvrdma" in 299921ab34c9SMarcel Apfelbaum "") 300021ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 300121ab34c9SMarcel Apfelbaum pvrdma="yes" 300221ab34c9SMarcel Apfelbaum else 300321ab34c9SMarcel Apfelbaum pvrdma="no" 300421ab34c9SMarcel Apfelbaum fi 300521ab34c9SMarcel Apfelbaum ;; 300621ab34c9SMarcel Apfelbaum "yes") 300721ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 300821ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 300921ab34c9SMarcel Apfelbaum fi 301021ab34c9SMarcel Apfelbaum pvrdma="yes" 301121ab34c9SMarcel Apfelbaum ;; 301221ab34c9SMarcel Apfelbaum "no") 301321ab34c9SMarcel Apfelbaum pvrdma="no" 301421ab34c9SMarcel Apfelbaum ;; 301521ab34c9SMarcel Apfelbaum esac 301621ab34c9SMarcel Apfelbaumelse 301721ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 301821ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 301921ab34c9SMarcel Apfelbaum fi 302021ab34c9SMarcel Apfelbaum pvrdma="no" 302121ab34c9SMarcel Apfelbaumfi 302295c6bff3SBenoît Canet 302395c6bff3SBenoît Canet########################################## 30242f9606b3Saliguori# VNC SASL detection 3025821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 30262f9606b3Saliguori cat > $TMPC <<EOF 30272f9606b3Saliguori#include <sasl/sasl.h> 30282f9606b3Saliguori#include <stdio.h> 30292f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 30302f9606b3SaliguoriEOF 30312f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 30322f9606b3Saliguori vnc_sasl_cflags="" 30332f9606b3Saliguori vnc_sasl_libs="-lsasl2" 303452166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 3035ea784e3bSJuan Quintela vnc_sasl=yes 3036fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 3037ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 30382f9606b3Saliguori else 3039ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 304021684af0SStewart Smith feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 3041ea784e3bSJuan Quintela fi 3042ea784e3bSJuan Quintela vnc_sasl=no 30432f9606b3Saliguori fi 30442f9606b3Saliguorifi 30452f9606b3Saliguori 30462f9606b3Saliguori########################################## 30472f6f5c7aSCorentin Chary# VNC JPEG detection 3048821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 30492f6f5c7aSCorentin Charycat > $TMPC <<EOF 30502f6f5c7aSCorentin Chary#include <stdio.h> 30512f6f5c7aSCorentin Chary#include <jpeglib.h> 30522f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 30532f6f5c7aSCorentin CharyEOF 30542f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 30552f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 30562f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 30572f6f5c7aSCorentin Chary vnc_jpeg=yes 30582f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 3059ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 30602f6f5c7aSCorentin Chary else 30612f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 306221684af0SStewart Smith feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 30632f6f5c7aSCorentin Chary fi 30642f6f5c7aSCorentin Chary vnc_jpeg=no 30652f6f5c7aSCorentin Chary fi 30662f6f5c7aSCorentin Charyfi 30672f6f5c7aSCorentin Chary 30682f6f5c7aSCorentin Chary########################################## 3069efe556adSCorentin Chary# VNC PNG detection 3070821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 3071efe556adSCorentin Charycat > $TMPC <<EOF 3072efe556adSCorentin Chary//#include <stdio.h> 3073efe556adSCorentin Chary#include <png.h> 3074832ce9c2SScott Wood#include <stddef.h> 3075efe556adSCorentin Charyint main(void) { 3076efe556adSCorentin Chary png_structp png_ptr; 3077efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 30787edc3fedSPeter Maydell return png_ptr != 0; 3079efe556adSCorentin Chary} 3080efe556adSCorentin CharyEOF 308165d5d3f9SStefan Weil if $pkg_config libpng --exists; then 308289138857SStefan Weil vnc_png_cflags=$($pkg_config libpng --cflags) 308389138857SStefan Weil vnc_png_libs=$($pkg_config libpng --libs) 30849af8025eSBrad else 3085efe556adSCorentin Chary vnc_png_cflags="" 3086efe556adSCorentin Chary vnc_png_libs="-lpng" 30879af8025eSBrad fi 3088efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 3089efe556adSCorentin Chary vnc_png=yes 3090efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 30919af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 3092efe556adSCorentin Chary else 3093efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 309421684af0SStewart Smith feature_not_found "vnc-png" "Install libpng devel" 3095efe556adSCorentin Chary fi 3096efe556adSCorentin Chary vnc_png=no 3097efe556adSCorentin Chary fi 3098efe556adSCorentin Charyfi 3099efe556adSCorentin Chary 3100efe556adSCorentin Chary########################################## 31016a021536SGerd Hoffmann# xkbcommon probe 31026a021536SGerd Hoffmannif test "$xkbcommon" != "no" ; then 31036a021536SGerd Hoffmann if $pkg_config xkbcommon --exists; then 31046a021536SGerd Hoffmann xkbcommon_cflags=$($pkg_config xkbcommon --cflags) 31056a021536SGerd Hoffmann xkbcommon_libs=$($pkg_config xkbcommon --libs) 31066a021536SGerd Hoffmann xkbcommon=yes 31076a021536SGerd Hoffmann else 31086a021536SGerd Hoffmann if test "$xkbcommon" = "yes" ; then 31096a021536SGerd Hoffmann feature_not_found "xkbcommon" "Install libxkbcommon-devel" 31106a021536SGerd Hoffmann fi 31116a021536SGerd Hoffmann xkbcommon=no 31126a021536SGerd Hoffmann fi 31136a021536SGerd Hoffmannfi 31146a021536SGerd Hoffmann 31156a021536SGerd Hoffmann########################################## 311676655d6dSaliguori# fnmatch() probe, used for ACL routines 311776655d6dSaliguorifnmatch="no" 311876655d6dSaliguoricat > $TMPC << EOF 311976655d6dSaliguori#include <fnmatch.h> 312076655d6dSaliguoriint main(void) 312176655d6dSaliguori{ 312276655d6dSaliguori fnmatch("foo", "foo", 0); 312376655d6dSaliguori return 0; 312476655d6dSaliguori} 312576655d6dSaliguoriEOF 312652166aa0SJuan Quintelaif compile_prog "" "" ; then 312776655d6dSaliguori fnmatch="yes" 312876655d6dSaliguorifi 312976655d6dSaliguori 313076655d6dSaliguori########################################## 3131c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 3132dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 3133dce512deSChristoph Hellwig cat > $TMPC << EOF 3134ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 3135dce512deSChristoph Hellwig#include <xfs/xfs.h> 3136dce512deSChristoph Hellwigint main(void) 3137dce512deSChristoph Hellwig{ 3138dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 3139dce512deSChristoph Hellwig return 0; 3140dce512deSChristoph Hellwig} 3141dce512deSChristoph HellwigEOF 3142dce512deSChristoph Hellwig if compile_prog "" "" ; then 3143dce512deSChristoph Hellwig xfs="yes" 3144dce512deSChristoph Hellwig else 3145dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 314621684af0SStewart Smith feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 3147dce512deSChristoph Hellwig fi 3148dce512deSChristoph Hellwig xfs=no 3149dce512deSChristoph Hellwig fi 3150dce512deSChristoph Hellwigfi 3151dce512deSChristoph Hellwig 3152dce512deSChristoph Hellwig########################################## 31538a16d273Sths# vde libraries probe 3154dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 31554baae0acSJuan Quintela vde_libs="-lvdeplug" 31568a16d273Sths cat > $TMPC << EOF 31578a16d273Sths#include <libvdeplug.h> 31584a7f0e06Spbrookint main(void) 31594a7f0e06Spbrook{ 31604a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 3161fea08e08SPeter Maydell char s[] = ""; 3162fea08e08SPeter Maydell vde_open(s, s, &a); 31634a7f0e06Spbrook return 0; 31644a7f0e06Spbrook} 31658a16d273SthsEOF 316652166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 31674baae0acSJuan Quintela vde=yes 3168dfb278bdSJuan Quintela else 3169dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 317021684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3171dfb278bdSJuan Quintela fi 3172dfb278bdSJuan Quintela vde=no 31738a16d273Sths fi 31748a16d273Sthsfi 31758a16d273Sths 31768a16d273Sths########################################## 31770a985b37SVincenzo Maffione# netmap support probe 31780a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 31790a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 31800a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 31810a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 31820a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 318358952137SVincenzo Maffioneif test "$netmap" != "no" ; then 318458952137SVincenzo Maffione cat > $TMPC << EOF 318558952137SVincenzo Maffione#include <inttypes.h> 318658952137SVincenzo Maffione#include <net/if.h> 318758952137SVincenzo Maffione#include <net/netmap.h> 318858952137SVincenzo Maffione#include <net/netmap_user.h> 31890a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 31900a985b37SVincenzo Maffione#error 31910a985b37SVincenzo Maffione#endif 319258952137SVincenzo Maffioneint main(void) { return 0; } 319358952137SVincenzo MaffioneEOF 319458952137SVincenzo Maffione if compile_prog "" "" ; then 319558952137SVincenzo Maffione netmap=yes 319658952137SVincenzo Maffione else 319758952137SVincenzo Maffione if test "$netmap" = "yes" ; then 319858952137SVincenzo Maffione feature_not_found "netmap" 319958952137SVincenzo Maffione fi 320058952137SVincenzo Maffione netmap=no 320158952137SVincenzo Maffione fi 320258952137SVincenzo Maffionefi 320358952137SVincenzo Maffione 320458952137SVincenzo Maffione########################################## 320547e98658SCorey Bryant# libcap-ng library probe 320647e98658SCorey Bryantif test "$cap_ng" != "no" ; then 320747e98658SCorey Bryant cap_libs="-lcap-ng" 320847e98658SCorey Bryant cat > $TMPC << EOF 320947e98658SCorey Bryant#include <cap-ng.h> 321047e98658SCorey Bryantint main(void) 321147e98658SCorey Bryant{ 321247e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 321347e98658SCorey Bryant return 0; 321447e98658SCorey Bryant} 321547e98658SCorey BryantEOF 321647e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 321747e98658SCorey Bryant cap_ng=yes 321847e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 321947e98658SCorey Bryant else 322047e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 322121684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 322247e98658SCorey Bryant fi 322347e98658SCorey Bryant cap_ng=no 322447e98658SCorey Bryant fi 322547e98658SCorey Bryantfi 322647e98658SCorey Bryant 322747e98658SCorey Bryant########################################## 3228c2de5c91Smalc# Sound support libraries probe 32298f28f3fbSths 3230c2de5c91Smalcaudio_drv_probe() 3231c2de5c91Smalc{ 3232c2de5c91Smalc drv=$1 3233c2de5c91Smalc hdr=$2 3234c2de5c91Smalc lib=$3 3235c2de5c91Smalc exp=$4 3236c2de5c91Smalc cfl=$5 32378f28f3fbSths cat > $TMPC << EOF 3238c2de5c91Smalc#include <$hdr> 3239c2de5c91Smalcint main(void) { $exp } 32408f28f3fbSthsEOF 324152166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 32428f28f3fbSths : 32438f28f3fbSths else 324476ad07a4SPeter Maydell error_exit "$drv check failed" \ 324576ad07a4SPeter Maydell "Make sure to have the $drv libs and headers installed." 32468f28f3fbSths fi 3247c2de5c91Smalc} 3248c2de5c91Smalc 324989138857SStefan Weilaudio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3250c2de5c91Smalcfor drv in $audio_drv_list; do 3251c2de5c91Smalc case $drv in 3252c2de5c91Smalc alsa) 3253c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 3254e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 3255b1149911SFam Zheng alsa_libs="-lasound" 3256c2de5c91Smalc ;; 3257c2de5c91Smalc 3258b8e59f18Smalc pa) 3259e58ff62dSPeter Krempa audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \ 3260e58ff62dSPeter Krempa "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;" 3261b1149911SFam Zheng pulse_libs="-lpulse" 326267f86e8eSJuan Quintela audio_pt_int="yes" 3263b8e59f18Smalc ;; 3264b8e59f18Smalc 3265373967b2SGerd Hoffmann sdl) 3266373967b2SGerd Hoffmann if test "$sdl" = "no"; then 3267373967b2SGerd Hoffmann error_exit "sdl not found or disabled, can not use sdl audio driver" 3268373967b2SGerd Hoffmann fi 3269373967b2SGerd Hoffmann ;; 3270373967b2SGerd Hoffmann 3271997e690aSJuan Quintela coreaudio) 3272b1149911SFam Zheng coreaudio_libs="-framework CoreAudio" 3273997e690aSJuan Quintela ;; 3274997e690aSJuan Quintela 3275a4bf6780SJuan Quintela dsound) 3276b1149911SFam Zheng dsound_libs="-lole32 -ldxguid" 3277d5631638Smalc audio_win_int="yes" 3278a4bf6780SJuan Quintela ;; 3279a4bf6780SJuan Quintela 3280a4bf6780SJuan Quintela oss) 3281b1149911SFam Zheng oss_libs="$oss_lib" 3282a4bf6780SJuan Quintela ;; 3283a4bf6780SJuan Quintela 3284373967b2SGerd Hoffmann wav) 3285373967b2SGerd Hoffmann # XXX: Probes for CoreAudio, DirectSound 32862f6a1ab0Sblueswir1 ;; 32872f6a1ab0Sblueswir1 3288e4c63a6aSmalc *) 32891c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 329076ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 329176ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 3292e4c63a6aSmalc } 3293e4c63a6aSmalc ;; 3294c2de5c91Smalc esac 3295c2de5c91Smalcdone 32968f28f3fbSths 32974d3b6f6eSbalrog########################################## 32982e4d9fb1Saurel32# BrlAPI probe 32992e4d9fb1Saurel32 33004ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 3301eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 33022e4d9fb1Saurel32 cat > $TMPC << EOF 33032e4d9fb1Saurel32#include <brlapi.h> 3304832ce9c2SScott Wood#include <stddef.h> 33052e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 33062e4d9fb1Saurel32EOF 330752166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 33082e4d9fb1Saurel32 brlapi=yes 33094ffcedb6SJuan Quintela else 33104ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 331121684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 33124ffcedb6SJuan Quintela fi 33134ffcedb6SJuan Quintela brlapi=no 3314eb82284fSJuan Quintela fi 3315eb82284fSJuan Quintelafi 33162e4d9fb1Saurel32 33172e4d9fb1Saurel32########################################## 33184d3b6f6eSbalrog# curses probe 3319a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 3320e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 33218ddc5bf9SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 33228ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3323e095e2f3SStefan Weil else 33247c703002SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 33258ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3326e095e2f3SStefan Weil fi 3327c584a6d0SJuan Quintela curses_found=no 33284d3b6f6eSbalrog cat > $TMPC << EOF 33298ddc5bf9SSamuel Thibault#include <locale.h> 33304d3b6f6eSbalrog#include <curses.h> 33318ddc5bf9SSamuel Thibault#include <wchar.h> 3332ef9a2524SStefan Weilint main(void) { 33338ddc5bf9SSamuel Thibault wchar_t wch = L'w'; 33348ddc5bf9SSamuel Thibault setlocale(LC_ALL, ""); 3335ef9a2524SStefan Weil resize_term(0, 0); 33368ddc5bf9SSamuel Thibault addwstr(L"wide chars\n"); 33378ddc5bf9SSamuel Thibault addnwstr(&wch, 1); 33387c703002SSamuel Thibault add_wch(WACS_DEGREE); 3339271f37abSKamil Rytarowski return 0; 3340ef9a2524SStefan Weil} 33414d3b6f6eSbalrogEOF 3342ecbe251fSVadim Evard IFS=: 33438ddc5bf9SSamuel Thibault for curses_inc in $curses_inc_list; do 3344b01a4fd3SPeter Maydell # Make sure we get the wide character prototypes 3345b01a4fd3SPeter Maydell curses_inc="-DNCURSES_WIDECHAR $curses_inc" 33467c703002SSamuel Thibault IFS=: 33478ddc5bf9SSamuel Thibault for curses_lib in $curses_lib_list; do 3348ecbe251fSVadim Evard unset IFS 33498ddc5bf9SSamuel Thibault if compile_prog "$curses_inc" "$curses_lib" ; then 3350c584a6d0SJuan Quintela curses_found=yes 33514f78ef9aSJuan Quintela break 33524d3b6f6eSbalrog fi 33534f78ef9aSJuan Quintela done 33547c703002SSamuel Thibault if test "$curses_found" = yes ; then 33557c703002SSamuel Thibault break 33567c703002SSamuel Thibault fi 33578ddc5bf9SSamuel Thibault done 3358ecbe251fSVadim Evard unset IFS 3359c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 3360c584a6d0SJuan Quintela curses=yes 3361c584a6d0SJuan Quintela else 3362c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 336321684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 3364c584a6d0SJuan Quintela fi 3365c584a6d0SJuan Quintela curses=no 3366c584a6d0SJuan Quintela fi 33674f78ef9aSJuan Quintelafi 33684d3b6f6eSbalrog 3369414f0dabSblueswir1########################################## 3370769ce76dSAlexander Graf# curl probe 3371a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 337265d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 3373a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 33744e2b0658SPaolo Bonzini else 33754e2b0658SPaolo Bonzini curlconfig=curl-config 33764e2b0658SPaolo Bonzini fi 3377769ce76dSAlexander Graf cat > $TMPC << EOF 3378769ce76dSAlexander Graf#include <curl/curl.h> 33790b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3380769ce76dSAlexander GrafEOF 338189138857SStefan Weil curl_cflags=$($curlconfig --cflags 2>/dev/null) 338289138857SStefan Weil curl_libs=$($curlconfig --libs 2>/dev/null) 3383b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 3384769ce76dSAlexander Graf curl=yes 3385788c8196SJuan Quintela else 3386788c8196SJuan Quintela if test "$curl" = "yes" ; then 338721684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 3388788c8196SJuan Quintela fi 3389788c8196SJuan Quintela curl=no 3390769ce76dSAlexander Graf fi 3391769ce76dSAlexander Graffi # test "$curl" 3392769ce76dSAlexander Graf 3393769ce76dSAlexander Graf########################################## 3394fb599c9aSbalrog# bluez support probe 3395a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 3396e820e3f4Sbalrog cat > $TMPC << EOF 3397e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 3398e820e3f4Sbalrogint main(void) { return bt_error(0); } 3399e820e3f4SbalrogEOF 340089138857SStefan Weil bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null) 340189138857SStefan Weil bluez_libs=$($pkg_config --libs bluez 2>/dev/null) 340252166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 3403a20a6f46SJuan Quintela bluez=yes 3404e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 3405e820e3f4Sbalrog else 3406a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 340721684af0SStewart Smith feature_not_found "bluez" "Install bluez-libs/libbluetooth devel" 3408a20a6f46SJuan Quintela fi 3409e820e3f4Sbalrog bluez="no" 3410e820e3f4Sbalrog fi 3411fb599c9aSbalrogfi 3412fb599c9aSbalrog 3413fb599c9aSbalrog########################################## 3414e18df141SAnthony Liguori# glib support probe 3415a52d28afSPaolo Bonzini 3416e7b3af81SDaniel P. Berrangéglib_req_ver=2.40 3417aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 3418aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 3419a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 3420aa0d1f44SPaolo Bonzinifi 3421e26110cfSFam Zheng 34224eaf7202SSameeh Jubran# This workaround is required due to a bug in pkg-config file for glib as it 34234eaf7202SSameeh Jubran# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 34244eaf7202SSameeh Jubran 34254eaf7202SSameeh Jubranif test "$static" = yes -a "$mingw32" = yes; then 34264eaf7202SSameeh Jubran QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" 34274eaf7202SSameeh Jubranfi 34284eaf7202SSameeh Jubran 3429aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 3430e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 343189138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 343289138857SStefan Weil glib_libs=$($pkg_config --libs $i) 34334a058899SMarc-André Lureau QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" 343414015304SAnthony Liguori LIBS="$glib_libs $LIBS" 3435957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 3436e18df141SAnthony Liguori else 3437e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3438e26110cfSFam Zheng fi 3439e26110cfSFam Zhengdone 3440e26110cfSFam Zheng 3441977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 3442977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 3443977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 3444977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 3445977a82abSDaniel P. Berrangecat > $TMPC <<EOF 3446977a82abSDaniel P. Berrange#include <glib.h> 3447977a82abSDaniel P. Berrange#include <unistd.h> 3448977a82abSDaniel P. Berrange 3449977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 3450977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3451977a82abSDaniel P. Berrange 3452977a82abSDaniel P. Berrangeint main(void) { 3453977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3454977a82abSDaniel P. Berrange return 0; 3455977a82abSDaniel P. Berrange} 3456977a82abSDaniel P. BerrangeEOF 3457977a82abSDaniel P. Berrange 34585919e032SStefan Weilif ! compile_prog "$CFLAGS" "$LIBS" ; then 3459977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3460977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 3461977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 3462977a82abSDaniel P. Berrange "build target" 3463977a82abSDaniel P. Berrangefi 3464977a82abSDaniel P. Berrange 3465bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3466bbbf2e04SJohn Snowcat > $TMPC << EOF 3467bbbf2e04SJohn Snow#include <glib.h> 3468bbbf2e04SJohn Snowint main(void) { return 0; } 3469bbbf2e04SJohn SnowEOF 3470bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3471bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 3472bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 3473bbbf2e04SJohn Snow CFLAGS="-Wno-unknown-attributes $CFLAGS" 3474bbbf2e04SJohn Snow fi 3475bbbf2e04SJohn Snowfi 3476bbbf2e04SJohn Snow 3477e26110cfSFam Zheng########################################## 3478e26110cfSFam Zheng# SHA command probe for modules 3479e26110cfSFam Zhengif test "$modules" = yes; then 3480e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 3481e26110cfSFam Zheng for c in $shacmd_probe; do 34828ccefb91SFam Zheng if has $c; then 3483e26110cfSFam Zheng shacmd="$c" 3484e26110cfSFam Zheng break 3485e26110cfSFam Zheng fi 3486e26110cfSFam Zheng done 3487e26110cfSFam Zheng if test "$shacmd" = ""; then 3488e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3489e26110cfSFam Zheng fi 3490e18df141SAnthony Liguorifi 3491e18df141SAnthony Liguori 3492e18df141SAnthony Liguori########################################## 3493e2134eb9SGerd Hoffmann# pixman support probe 3494e2134eb9SGerd Hoffmann 349574880fe2SRobert Schieleif test "$want_tools" = "no" -a "$softmmu" = "no"; then 349674880fe2SRobert Schiele pixman_cflags= 349774880fe2SRobert Schiele pixman_libs= 349835c4e86cSGerd Hoffmannelif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then 349989138857SStefan Weil pixman_cflags=$($pkg_config --cflags pixman-1) 350089138857SStefan Weil pixman_libs=$($pkg_config --libs pixman-1) 3501e2134eb9SGerd Hoffmannelse 3502c12b6d70SGerd Hoffmann error_exit "pixman >= 0.21.8 not present." \ 3503c12b6d70SGerd Hoffmann "Please install the pixman devel package." 3504e2134eb9SGerd Hoffmannfi 3505e2134eb9SGerd Hoffmann 3506e2134eb9SGerd Hoffmann########################################## 3507fe8fc5aeSPaolo Bonzini# libmpathpersist probe 3508fe8fc5aeSPaolo Bonzini 3509fe8fc5aeSPaolo Bonziniif test "$mpath" != "no" ; then 35101b0578f5SMurilo Opsfelder Araujo # probe for the new API 3511fe8fc5aeSPaolo Bonzini cat > $TMPC <<EOF 3512fe8fc5aeSPaolo Bonzini#include <libudev.h> 3513fe8fc5aeSPaolo Bonzini#include <mpath_persist.h> 3514fe8fc5aeSPaolo Bonziniunsigned mpath_mx_alloc_len = 1024; 3515fe8fc5aeSPaolo Bonziniint logsink; 3516b3f1c8c4SPaolo Bonzinistatic struct config *multipath_conf; 3517b3f1c8c4SPaolo Bonziniextern struct udev *udev; 3518b3f1c8c4SPaolo Bonziniextern struct config *get_multipath_config(void); 3519b3f1c8c4SPaolo Bonziniextern void put_multipath_config(struct config *conf); 3520b3f1c8c4SPaolo Bonzinistruct udev *udev; 3521b3f1c8c4SPaolo Bonzinistruct config *get_multipath_config(void) { return multipath_conf; } 3522b3f1c8c4SPaolo Bonzinivoid put_multipath_config(struct config *conf) { } 3523b3f1c8c4SPaolo Bonzini 3524fe8fc5aeSPaolo Bonziniint main(void) { 3525b3f1c8c4SPaolo Bonzini udev = udev_new(); 3526b3f1c8c4SPaolo Bonzini multipath_conf = mpath_lib_init(); 3527fe8fc5aeSPaolo Bonzini return 0; 3528fe8fc5aeSPaolo Bonzini} 3529fe8fc5aeSPaolo BonziniEOF 3530fe8fc5aeSPaolo Bonzini if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 3531fe8fc5aeSPaolo Bonzini mpathpersist=yes 35321b0578f5SMurilo Opsfelder Araujo mpathpersist_new_api=yes 35331b0578f5SMurilo Opsfelder Araujo else 35341b0578f5SMurilo Opsfelder Araujo # probe for the old API 35351b0578f5SMurilo Opsfelder Araujo cat > $TMPC <<EOF 35361b0578f5SMurilo Opsfelder Araujo#include <libudev.h> 35371b0578f5SMurilo Opsfelder Araujo#include <mpath_persist.h> 35381b0578f5SMurilo Opsfelder Araujounsigned mpath_mx_alloc_len = 1024; 35391b0578f5SMurilo Opsfelder Araujoint logsink; 35401b0578f5SMurilo Opsfelder Araujoint main(void) { 35411b0578f5SMurilo Opsfelder Araujo struct udev *udev = udev_new(); 35421b0578f5SMurilo Opsfelder Araujo mpath_lib_init(udev); 35431b0578f5SMurilo Opsfelder Araujo return 0; 35441b0578f5SMurilo Opsfelder Araujo} 35451b0578f5SMurilo Opsfelder AraujoEOF 35461b0578f5SMurilo Opsfelder Araujo if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 35471b0578f5SMurilo Opsfelder Araujo mpathpersist=yes 35481b0578f5SMurilo Opsfelder Araujo mpathpersist_new_api=no 3549fe8fc5aeSPaolo Bonzini else 3550fe8fc5aeSPaolo Bonzini mpathpersist=no 3551fe8fc5aeSPaolo Bonzini fi 35521b0578f5SMurilo Opsfelder Araujo fi 3553fe8fc5aeSPaolo Bonzinielse 3554fe8fc5aeSPaolo Bonzini mpathpersist=no 3555fe8fc5aeSPaolo Bonzinifi 3556fe8fc5aeSPaolo Bonzini 3557fe8fc5aeSPaolo Bonzini########################################## 355817bff52bSM. Mohan Kumar# libcap probe 355917bff52bSM. Mohan Kumar 356017bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 356117bff52bSM. Mohan Kumar cat > $TMPC <<EOF 356217bff52bSM. Mohan Kumar#include <stdio.h> 356317bff52bSM. Mohan Kumar#include <sys/capability.h> 3564cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 356517bff52bSM. Mohan KumarEOF 356617bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 356717bff52bSM. Mohan Kumar cap=yes 356817bff52bSM. Mohan Kumar else 356917bff52bSM. Mohan Kumar cap=no 357017bff52bSM. Mohan Kumar fi 357117bff52bSM. Mohan Kumarfi 357217bff52bSM. Mohan Kumar 357317bff52bSM. Mohan Kumar########################################## 3574e5d355d1Saliguori# pthread probe 35754b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 35763c529d93Saliguori 3577e5d355d1Saliguoripthread=no 3578414f0dabSblueswir1cat > $TMPC << EOF 35793c529d93Saliguori#include <pthread.h> 35807a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 35817a42bbe4SStefan Weilint main(void) { 35827a42bbe4SStefan Weil pthread_t thread; 35837a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 35847a42bbe4SStefan Weil return 0; 35857a42bbe4SStefan Weil} 3586414f0dabSblueswir1EOF 3587bd00d539SAndreas Färberif compile_prog "" "" ; then 3588bd00d539SAndreas Färber pthread=yes 3589bd00d539SAndreas Färberelse 3590de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 359152166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 3592e5d355d1Saliguori pthread=yes 3593e3c56761SPeter Portante found=no 3594e3c56761SPeter Portante for lib_entry in $LIBS; do 3595e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 3596e3c56761SPeter Portante found=yes 3597e3c56761SPeter Portante break 3598e3c56761SPeter Portante fi 3599e3c56761SPeter Portante done 3600e3c56761SPeter Portante if test "$found" = "no"; then 36015572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 360214ab3aa7SMarc-André Lureau libs_qga="$pthread_lib $libs_qga" 3603e3c56761SPeter Portante fi 3604409437e1SDaniel P. Berrange PTHREAD_LIB="$pthread_lib" 3605de65fe0fSSebastian Herbszt break 3606414f0dabSblueswir1 fi 3607de65fe0fSSebastian Herbszt done 3608bd00d539SAndreas Färberfi 3609414f0dabSblueswir1 36104617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 361176ad07a4SPeter Maydell error_exit "pthread check failed" \ 361276ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 3613e5d355d1Saliguorifi 3614e5d355d1Saliguori 36155c312079SDr. David Alan Gilbert# check for pthread_setname_np 36165c312079SDr. David Alan Gilbertpthread_setname_np=no 36175c312079SDr. David Alan Gilbertcat > $TMPC << EOF 36185c312079SDr. David Alan Gilbert#include <pthread.h> 36195c312079SDr. David Alan Gilbert 36205c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 36215c312079SDr. David Alan Gilbertint main(void) 36225c312079SDr. David Alan Gilbert{ 36235c312079SDr. David Alan Gilbert pthread_t thread; 36245c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 36255c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 36265c312079SDr. David Alan Gilbert return 0; 36275c312079SDr. David Alan Gilbert} 36285c312079SDr. David Alan GilbertEOF 36295c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 36305c312079SDr. David Alan Gilbert pthread_setname_np=yes 36315c312079SDr. David Alan Gilbertfi 36325c312079SDr. David Alan Gilbert 3633bf9298b9Saliguori########################################## 3634f27aaf4bSChristian Brunner# rbd probe 3635f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 3636f27aaf4bSChristian Brunner cat > $TMPC <<EOF 3637f27aaf4bSChristian Brunner#include <stdio.h> 3638ad32e9c0SJosh Durgin#include <rbd/librbd.h> 3639f27aaf4bSChristian Brunnerint main(void) { 3640ad32e9c0SJosh Durgin rados_t cluster; 3641ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 3642f27aaf4bSChristian Brunner return 0; 3643f27aaf4bSChristian Brunner} 3644f27aaf4bSChristian BrunnerEOF 3645ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 3646f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 3647f27aaf4bSChristian Brunner rbd=yes 3648f27aaf4bSChristian Brunner else 3649f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 365021684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 3651f27aaf4bSChristian Brunner fi 3652f27aaf4bSChristian Brunner rbd=no 3653f27aaf4bSChristian Brunner fi 3654f27aaf4bSChristian Brunnerfi 3655f27aaf4bSChristian Brunner 3656f27aaf4bSChristian Brunner########################################## 36570a12ec87SRichard W.M. Jones# libssh2 probe 36584fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8 36590a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then 366065d5d3f9SStefan Weil if $pkg_config --atleast-version=$min_libssh2_version libssh2; then 366189138857SStefan Weil libssh2_cflags=$($pkg_config libssh2 --cflags) 366289138857SStefan Weil libssh2_libs=$($pkg_config libssh2 --libs) 36630a12ec87SRichard W.M. Jones libssh2=yes 36640a12ec87SRichard W.M. Jones else 36650a12ec87SRichard W.M. Jones if test "$libssh2" = "yes" ; then 36664fc16838SRichard W.M. Jones error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" 36670a12ec87SRichard W.M. Jones fi 36680a12ec87SRichard W.M. Jones libssh2=no 36690a12ec87SRichard W.M. Jones fi 36700a12ec87SRichard W.M. Jonesfi 36710a12ec87SRichard W.M. Jones 36720a12ec87SRichard W.M. Jones########################################## 36739a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe 36749a2d462eSRichard W.M. Jones 36759a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then 36769a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 36779a2d462eSRichard W.M. Jones#include <stdio.h> 36789a2d462eSRichard W.M. Jones#include <libssh2.h> 36799a2d462eSRichard W.M. Jones#include <libssh2_sftp.h> 36809a2d462eSRichard W.M. Jonesint main(void) { 36819a2d462eSRichard W.M. Jones LIBSSH2_SESSION *session; 36829a2d462eSRichard W.M. Jones LIBSSH2_SFTP *sftp; 36839a2d462eSRichard W.M. Jones LIBSSH2_SFTP_HANDLE *sftp_handle; 36849a2d462eSRichard W.M. Jones session = libssh2_session_init (); 36859a2d462eSRichard W.M. Jones sftp = libssh2_sftp_init (session); 36869a2d462eSRichard W.M. Jones sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); 36879a2d462eSRichard W.M. Jones libssh2_sftp_fsync (sftp_handle); 36889a2d462eSRichard W.M. Jones return 0; 36899a2d462eSRichard W.M. Jones} 36909a2d462eSRichard W.M. JonesEOF 36919a2d462eSRichard W.M. Jones # libssh2_cflags/libssh2_libs defined in previous test. 36929a2d462eSRichard W.M. Jones if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then 36939a2d462eSRichard W.M. Jones QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" 36949a2d462eSRichard W.M. Jones fi 36959a2d462eSRichard W.M. Jonesfi 36969a2d462eSRichard W.M. Jones 36979a2d462eSRichard W.M. Jones########################################## 36985c6c3a6cSChristoph Hellwig# linux-aio probe 36995c6c3a6cSChristoph Hellwig 37005c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 37015c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 37025c6c3a6cSChristoph Hellwig#include <libaio.h> 37035c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 3704832ce9c2SScott Wood#include <stddef.h> 37055c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 37065c6c3a6cSChristoph HellwigEOF 37075c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 37085c6c3a6cSChristoph Hellwig linux_aio=yes 37095c6c3a6cSChristoph Hellwig else 37105c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 371121684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 37125c6c3a6cSChristoph Hellwig fi 37133cfcae3cSLuiz Capitulino linux_aio=no 37145c6c3a6cSChristoph Hellwig fi 37155c6c3a6cSChristoph Hellwigfi 37165c6c3a6cSChristoph Hellwig 37175c6c3a6cSChristoph Hellwig########################################## 37183b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux 37193b8acc11SPaolo Bonzini 37203b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then 37213b8acc11SPaolo Bonzini tpm_passthrough=$tpm 37223b8acc11SPaolo Bonzinielse 37233b8acc11SPaolo Bonzini tpm_passthrough=no 37243b8acc11SPaolo Bonzinifi 37253b8acc11SPaolo Bonzini 3726f4ede81eSAmarnath Valluri# TPM emulator is for all posix systems 3727f4ede81eSAmarnath Valluriif test "$mingw32" != "yes"; then 3728f4ede81eSAmarnath Valluri tpm_emulator=$tpm 3729f4ede81eSAmarnath Vallurielse 3730f4ede81eSAmarnath Valluri tpm_emulator=no 3731f4ede81eSAmarnath Vallurifi 37323b8acc11SPaolo Bonzini########################################## 3733758e8e38SVenkateswararao Jujjuri (JV)# attr probe 3734758e8e38SVenkateswararao Jujjuri (JV) 3735758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 3736758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 3737758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 3738758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 3739f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 3740f2338fb4SPavel Borzenkov#include <attr/xattr.h> 3741f2338fb4SPavel Borzenkov#else 37424f26f2b6SAvi Kivity#include <sys/xattr.h> 3743f2338fb4SPavel Borzenkov#endif 3744758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 3745758e8e38SVenkateswararao Jujjuri (JV)EOF 37464f26f2b6SAvi Kivity if compile_prog "" "" ; then 37474f26f2b6SAvi Kivity attr=yes 37484f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 3749f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 3750758e8e38SVenkateswararao Jujjuri (JV) attr=yes 3751758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 37524f26f2b6SAvi Kivity libattr=yes 3753758e8e38SVenkateswararao Jujjuri (JV) else 3754758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 375521684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 3756758e8e38SVenkateswararao Jujjuri (JV) fi 3757758e8e38SVenkateswararao Jujjuri (JV) attr=no 3758758e8e38SVenkateswararao Jujjuri (JV) fi 3759758e8e38SVenkateswararao Jujjuri (JV)fi 3760758e8e38SVenkateswararao Jujjuri (JV) 3761758e8e38SVenkateswararao Jujjuri (JV)########################################## 3762bf9298b9Saliguori# iovec probe 3763bf9298b9Saliguoricat > $TMPC <<EOF 3764db34f0b3Sblueswir1#include <sys/types.h> 3765bf9298b9Saliguori#include <sys/uio.h> 3766db34f0b3Sblueswir1#include <unistd.h> 3767f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 3768bf9298b9SaliguoriEOF 3769bf9298b9Saliguoriiovec=no 377052166aa0SJuan Quintelaif compile_prog "" "" ; then 3771bf9298b9Saliguori iovec=yes 3772bf9298b9Saliguorifi 3773bf9298b9Saliguori 3774f652e6afSaurel32########################################## 3775ceb42de8Saliguori# preadv probe 3776ceb42de8Saliguoricat > $TMPC <<EOF 3777ceb42de8Saliguori#include <sys/types.h> 3778ceb42de8Saliguori#include <sys/uio.h> 3779ceb42de8Saliguori#include <unistd.h> 3780c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 3781ceb42de8SaliguoriEOF 3782ceb42de8Saliguoripreadv=no 378352166aa0SJuan Quintelaif compile_prog "" "" ; then 3784ceb42de8Saliguori preadv=yes 3785ceb42de8Saliguorifi 3786ceb42de8Saliguori 3787ceb42de8Saliguori########################################## 3788f652e6afSaurel32# fdt probe 3789e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 3790e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 3791e169e1e1SPeter Maydellfdt_required=no 3792e169e1e1SPeter Maydellfor target in $target_list; do 3793e169e1e1SPeter Maydell case $target in 3794a666409fSKONRAD Frederic aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu) 3795e169e1e1SPeter Maydell fdt_required=yes 3796e169e1e1SPeter Maydell ;; 3797e169e1e1SPeter Maydell esac 3798e169e1e1SPeter Maydelldone 3799e169e1e1SPeter Maydell 3800e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 3801e169e1e1SPeter Maydell if test "$fdt" = "no"; then 3802e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 3803e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 3804e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 3805e169e1e1SPeter Maydell fi 3806e169e1e1SPeter Maydell fdt=yes 3807e169e1e1SPeter Maydellfi 3808e169e1e1SPeter Maydell 38092df87df7SJuan Quintelaif test "$fdt" != "no" ; then 3810b41af4baSJuan Quintela fdt_libs="-lfdt" 381196ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 38126e85fce0SPaul Burton # and test for required functions to make sure we are on a version >= 1.4.2 3813f652e6afSaurel32 cat > $TMPC << EOF 381431ce0adbSThomas Huth#include <libfdt.h> 381596ce6545SPeter Crosthwaite#include <libfdt_env.h> 38166e85fce0SPaul Burtonint main(void) { fdt_first_subnode(0, 0); return 0; } 3817f652e6afSaurel32EOF 381852166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 3819a540f158SPeter Crosthwaite # system DTC is good - use it 3820e3971d61SPhilippe Mathieu-Daudé fdt=system 3821aef45d51SDaniel P. Berrange else 3822aef45d51SDaniel P. Berrange # have GIT checkout, so activate dtc submodule 3823aef45d51SDaniel P. Berrange if test -e "${source_path}/.git" ; then 3824aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 3825aef45d51SDaniel P. Berrange fi 3826aef45d51SDaniel P. Berrange if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then 3827e3971d61SPhilippe Mathieu-Daudé fdt=git 3828a540f158SPeter Crosthwaite mkdir -p dtc 3829cab00a5aSMichael S. Tsirkin if [ "$pwd_is_source_path" != "y" ] ; then 3830a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 3831a540f158SPeter Crosthwaite symlink "$source_path/dtc/scripts" "dtc/scripts" 38322df87df7SJuan Quintela fi 3833a540f158SPeter Crosthwaite fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 38348a99e9a3SPhilippe Mathieu-Daudé fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" 38358a99e9a3SPhilippe Mathieu-Daudé fdt_libs="$fdt_libs" 3836a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 3837aef45d51SDaniel P. Berrange # Not a git build & no libfdt found, prompt for system install 3838aef45d51SDaniel P. Berrange error_exit "DTC (libfdt) version >= 1.4.2 not present." \ 3839aef45d51SDaniel P. Berrange "Please install the DTC (libfdt) devel package" 3840a540f158SPeter Crosthwaite else 3841a540f158SPeter Crosthwaite # don't have and don't want 3842de3a354aSMichael Walle fdt_libs= 38432df87df7SJuan Quintela fdt=no 3844f652e6afSaurel32 fi 3845f652e6afSaurel32 fi 3846aef45d51SDaniel P. Berrangefi 3847f652e6afSaurel32 3848a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 3849a540f158SPeter Crosthwaite 385020ff075bSMichael Walle########################################## 3851fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 3852b1546f32SGerd Hoffmann 3853da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 38544939a1dfSMichael Tokarev opengl_pkgs="epoxy gbm" 38555f9b1e35SGerd Hoffmann if $pkg_config $opengl_pkgs; then 38565f9b1e35SGerd Hoffmann opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 38575f9b1e35SGerd Hoffmann opengl_libs="$($pkg_config --libs $opengl_pkgs)" 3858da076ffeSGerd Hoffmann opengl=yes 3859925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 3860925a0400SGerd Hoffmann gtk_gl="yes" 3861925a0400SGerd Hoffmann fi 3862cc720a5dSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" 386320ff075bSMichael Walle else 3864da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3865dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 386620ff075bSMichael Walle fi 3867f676c67eSJeremy White opengl_cflags="" 3868da076ffeSGerd Hoffmann opengl_libs="" 3869da076ffeSGerd Hoffmann opengl=no 387020ff075bSMichael Walle fi 387120ff075bSMichael Wallefi 387220ff075bSMichael Walle 3873014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 3874014cb152SGerd Hoffmann cat > $TMPC << EOF 3875014cb152SGerd Hoffmann#include <epoxy/egl.h> 3876014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 3877014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 3878014cb152SGerd Hoffmann#endif 3879014cb152SGerd Hoffmannint main(void) { return 0; } 3880014cb152SGerd HoffmannEOF 3881014cb152SGerd Hoffmann if compile_prog "" "" ; then 3882014cb152SGerd Hoffmann opengl_dmabuf=yes 3883014cb152SGerd Hoffmann fi 3884014cb152SGerd Hoffmannfi 3885c9a12e75SChrysostomos Nanakos 3886ed279a06SKlim Kireev########################################## 3887ed279a06SKlim Kireev# libxml2 probe 3888ed279a06SKlim Kireevif test "$libxml2" != "no" ; then 3889ed279a06SKlim Kireev if $pkg_config --exists libxml-2.0; then 3890ed279a06SKlim Kireev libxml2="yes" 3891ed279a06SKlim Kireev libxml2_cflags=$($pkg_config --cflags libxml-2.0) 3892ed279a06SKlim Kireev libxml2_libs=$($pkg_config --libs libxml-2.0) 3893ed279a06SKlim Kireev else 3894ed279a06SKlim Kireev if test "$libxml2" = "yes"; then 3895ed279a06SKlim Kireev feature_not_found "libxml2" "Install libxml2 devel" 3896ed279a06SKlim Kireev fi 3897ed279a06SKlim Kireev libxml2="no" 3898ed279a06SKlim Kireev fi 3899ed279a06SKlim Kireevfi 3900c9a12e75SChrysostomos Nanakos 3901eb100396SBharata B Rao########################################## 3902eb100396SBharata B Rao# glusterfs probe 3903eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 390465d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 3905e01bee08SBharata B Rao glusterfs="yes" 390689138857SStefan Weil glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 390789138857SStefan Weil glusterfs_libs=$($pkg_config --libs glusterfs-api) 3908d85fa9ebSJeff Cody if $pkg_config --atleast-version=4 glusterfs-api; then 3909d85fa9ebSJeff Cody glusterfs_xlator_opt="yes" 3910d85fa9ebSJeff Cody fi 391165d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 39120c14fb47SBharata B Rao glusterfs_discard="yes" 39130c14fb47SBharata B Rao fi 39147c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 3915df3a429aSNiels de Vos glusterfs_fallocate="yes" 39167c815372SBharata B Rao glusterfs_zerofill="yes" 39177c815372SBharata B Rao fi 3918eb100396SBharata B Rao else 3919eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 39208efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 39218efc9363SHu Tao "Install glusterfs-api devel >= 3" 3922eb100396SBharata B Rao fi 3923e01bee08SBharata B Rao glusterfs="no" 3924eb100396SBharata B Rao fi 3925eb100396SBharata B Raofi 3926eb100396SBharata B Rao 392739386ac7Saurel32# Check for inotify functions when we are building linux-user 39283b3f24adSaurel32# emulator. This is done because older glibc versions don't 39293b3f24adSaurel32# have syscall stubs for these implemented. In that case we 39303b3f24adSaurel32# don't provide them even if kernel supports them. 39313b3f24adSaurel32# 39323b3f24adSaurel32inotify=no 39333b3f24adSaurel32cat > $TMPC << EOF 39343b3f24adSaurel32#include <sys/inotify.h> 39353b3f24adSaurel32 39363b3f24adSaurel32int 39373b3f24adSaurel32main(void) 39383b3f24adSaurel32{ 39393b3f24adSaurel32 /* try to start inotify */ 39408690e420Saurel32 return inotify_init(); 39413b3f24adSaurel32} 39423b3f24adSaurel32EOF 394352166aa0SJuan Quintelaif compile_prog "" "" ; then 39443b3f24adSaurel32 inotify=yes 39453b3f24adSaurel32fi 39463b3f24adSaurel32 3947c05c7a73SRiku Voipioinotify1=no 3948c05c7a73SRiku Voipiocat > $TMPC << EOF 3949c05c7a73SRiku Voipio#include <sys/inotify.h> 3950c05c7a73SRiku Voipio 3951c05c7a73SRiku Voipioint 3952c05c7a73SRiku Voipiomain(void) 3953c05c7a73SRiku Voipio{ 3954c05c7a73SRiku Voipio /* try to start inotify */ 3955c05c7a73SRiku Voipio return inotify_init1(0); 3956c05c7a73SRiku Voipio} 3957c05c7a73SRiku VoipioEOF 3958c05c7a73SRiku Voipioif compile_prog "" "" ; then 3959c05c7a73SRiku Voipio inotify1=yes 3960c05c7a73SRiku Voipiofi 3961c05c7a73SRiku Voipio 3962099d6b0fSRiku Voipio# check if pipe2 is there 3963099d6b0fSRiku Voipiopipe2=no 3964099d6b0fSRiku Voipiocat > $TMPC << EOF 3965099d6b0fSRiku Voipio#include <unistd.h> 3966099d6b0fSRiku Voipio#include <fcntl.h> 3967099d6b0fSRiku Voipio 3968099d6b0fSRiku Voipioint main(void) 3969099d6b0fSRiku Voipio{ 3970099d6b0fSRiku Voipio int pipefd[2]; 39719bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 3972099d6b0fSRiku Voipio} 3973099d6b0fSRiku VoipioEOF 397452166aa0SJuan Quintelaif compile_prog "" "" ; then 3975099d6b0fSRiku Voipio pipe2=yes 3976099d6b0fSRiku Voipiofi 3977099d6b0fSRiku Voipio 397840ff6d7eSKevin Wolf# check if accept4 is there 397940ff6d7eSKevin Wolfaccept4=no 398040ff6d7eSKevin Wolfcat > $TMPC << EOF 398140ff6d7eSKevin Wolf#include <sys/socket.h> 398240ff6d7eSKevin Wolf#include <stddef.h> 398340ff6d7eSKevin Wolf 398440ff6d7eSKevin Wolfint main(void) 398540ff6d7eSKevin Wolf{ 398640ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 398740ff6d7eSKevin Wolf return 0; 398840ff6d7eSKevin Wolf} 398940ff6d7eSKevin WolfEOF 399040ff6d7eSKevin Wolfif compile_prog "" "" ; then 399140ff6d7eSKevin Wolf accept4=yes 399240ff6d7eSKevin Wolffi 399340ff6d7eSKevin Wolf 39943ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 39953ce34dfbSvibisreenivasansplice=no 39963ce34dfbSvibisreenivasancat > $TMPC << EOF 39973ce34dfbSvibisreenivasan#include <unistd.h> 39983ce34dfbSvibisreenivasan#include <fcntl.h> 39993ce34dfbSvibisreenivasan#include <limits.h> 40003ce34dfbSvibisreenivasan 40013ce34dfbSvibisreenivasanint main(void) 40023ce34dfbSvibisreenivasan{ 400366ea0f22SStefan Weil int len, fd = 0; 40043ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 40053ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 40063ce34dfbSvibisreenivasan return 0; 40073ce34dfbSvibisreenivasan} 40083ce34dfbSvibisreenivasanEOF 400952166aa0SJuan Quintelaif compile_prog "" "" ; then 40103ce34dfbSvibisreenivasan splice=yes 40113ce34dfbSvibisreenivasanfi 40123ce34dfbSvibisreenivasan 4013dcc38d1cSMarcelo Tosatti########################################## 4014a99d57bbSWanlong Gao# libnuma probe 4015a99d57bbSWanlong Gao 4016a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 4017a99d57bbSWanlong Gao cat > $TMPC << EOF 4018a99d57bbSWanlong Gao#include <numa.h> 4019a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 4020a99d57bbSWanlong GaoEOF 4021a99d57bbSWanlong Gao 4022a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 4023a99d57bbSWanlong Gao numa=yes 4024a99d57bbSWanlong Gao libs_softmmu="-lnuma $libs_softmmu" 4025a99d57bbSWanlong Gao else 4026a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 4027a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 4028a99d57bbSWanlong Gao fi 4029a99d57bbSWanlong Gao numa=no 4030a99d57bbSWanlong Gao fi 4031a99d57bbSWanlong Gaofi 4032a99d57bbSWanlong Gao 40337b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 40347b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 40357b01cb97SAlexandre Derumier exit 1 40367b01cb97SAlexandre Derumierfi 40377b01cb97SAlexandre Derumier 40385a22ab71SYang Zhong# Even if malloc_trim() is available, these non-libc memory allocators 40395a22ab71SYang Zhong# do not support it. 40405a22ab71SYang Zhongif test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then 40415a22ab71SYang Zhong if test "$malloc_trim" = "yes" ; then 40425a22ab71SYang Zhong echo "Disabling malloc_trim with non-libc memory allocator" 40435a22ab71SYang Zhong fi 40445a22ab71SYang Zhong malloc_trim="no" 40455a22ab71SYang Zhongfi 40465a22ab71SYang Zhong 40475a22ab71SYang Zhong####################################### 40485a22ab71SYang Zhong# malloc_trim 40495a22ab71SYang Zhong 40505a22ab71SYang Zhongif test "$malloc_trim" != "no" ; then 40515a22ab71SYang Zhong cat > $TMPC << EOF 40525a22ab71SYang Zhong#include <malloc.h> 40535a22ab71SYang Zhongint main(void) { malloc_trim(0); return 0; } 40545a22ab71SYang ZhongEOF 40555a22ab71SYang Zhong if compile_prog "" "" ; then 40565a22ab71SYang Zhong malloc_trim="yes" 40575a22ab71SYang Zhong else 40585a22ab71SYang Zhong malloc_trim="no" 40595a22ab71SYang Zhong fi 40605a22ab71SYang Zhongfi 40615a22ab71SYang Zhong 4062a99d57bbSWanlong Gao########################################## 40632847b469SFam Zheng# tcmalloc probe 40642847b469SFam Zheng 40652847b469SFam Zhengif test "$tcmalloc" = "yes" ; then 40662847b469SFam Zheng cat > $TMPC << EOF 40672847b469SFam Zheng#include <stdlib.h> 40682847b469SFam Zhengint main(void) { malloc(1); return 0; } 40692847b469SFam ZhengEOF 40702847b469SFam Zheng 40712847b469SFam Zheng if compile_prog "" "-ltcmalloc" ; then 40722847b469SFam Zheng LIBS="-ltcmalloc $LIBS" 40732847b469SFam Zheng else 40742847b469SFam Zheng feature_not_found "tcmalloc" "install gperftools devel" 40752847b469SFam Zheng fi 40762847b469SFam Zhengfi 40772847b469SFam Zheng 40782847b469SFam Zheng########################################## 40797b01cb97SAlexandre Derumier# jemalloc probe 40807b01cb97SAlexandre Derumier 40817b01cb97SAlexandre Derumierif test "$jemalloc" = "yes" ; then 40827b01cb97SAlexandre Derumier cat > $TMPC << EOF 40837b01cb97SAlexandre Derumier#include <stdlib.h> 40847b01cb97SAlexandre Derumierint main(void) { malloc(1); return 0; } 40857b01cb97SAlexandre DerumierEOF 40867b01cb97SAlexandre Derumier 40877b01cb97SAlexandre Derumier if compile_prog "" "-ljemalloc" ; then 40887b01cb97SAlexandre Derumier LIBS="-ljemalloc $LIBS" 40897b01cb97SAlexandre Derumier else 40907b01cb97SAlexandre Derumier feature_not_found "jemalloc" "install jemalloc devel" 40917b01cb97SAlexandre Derumier fi 40927b01cb97SAlexandre Derumierfi 40937b01cb97SAlexandre Derumier 40947b01cb97SAlexandre Derumier########################################## 4095dcc38d1cSMarcelo Tosatti# signalfd probe 4096dcc38d1cSMarcelo Tosattisignalfd="no" 4097dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 4098dcc38d1cSMarcelo Tosatti#include <unistd.h> 4099dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 4100dcc38d1cSMarcelo Tosatti#include <signal.h> 4101dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4102dcc38d1cSMarcelo TosattiEOF 4103dcc38d1cSMarcelo Tosatti 4104dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 4105dcc38d1cSMarcelo Tosatti signalfd=yes 4106dcc38d1cSMarcelo Tosattifi 4107dcc38d1cSMarcelo Tosatti 4108c2882b96SRiku Voipio# check if eventfd is supported 4109c2882b96SRiku Voipioeventfd=no 4110c2882b96SRiku Voipiocat > $TMPC << EOF 4111c2882b96SRiku Voipio#include <sys/eventfd.h> 4112c2882b96SRiku Voipio 4113c2882b96SRiku Voipioint main(void) 4114c2882b96SRiku Voipio{ 411555cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4116c2882b96SRiku Voipio} 4117c2882b96SRiku VoipioEOF 4118c2882b96SRiku Voipioif compile_prog "" "" ; then 4119c2882b96SRiku Voipio eventfd=yes 4120c2882b96SRiku Voipiofi 4121c2882b96SRiku Voipio 4122751bcc39SMarc-André Lureau# check if memfd is supported 4123751bcc39SMarc-André Lureaumemfd=no 4124751bcc39SMarc-André Lureaucat > $TMPC << EOF 412575e5b70eSPaolo Bonzini#include <sys/mman.h> 4126751bcc39SMarc-André Lureau 4127751bcc39SMarc-André Lureauint main(void) 4128751bcc39SMarc-André Lureau{ 4129751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 4130751bcc39SMarc-André Lureau} 4131751bcc39SMarc-André LureauEOF 4132751bcc39SMarc-André Lureauif compile_prog "" "" ; then 4133751bcc39SMarc-André Lureau memfd=yes 4134751bcc39SMarc-André Lureaufi 4135751bcc39SMarc-André Lureau 4136751bcc39SMarc-André Lureau 4137751bcc39SMarc-André Lureau 4138d0927938SUlrich Hecht# check for fallocate 4139d0927938SUlrich Hechtfallocate=no 4140d0927938SUlrich Hechtcat > $TMPC << EOF 4141d0927938SUlrich Hecht#include <fcntl.h> 4142d0927938SUlrich Hecht 4143d0927938SUlrich Hechtint main(void) 4144d0927938SUlrich Hecht{ 4145d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 4146d0927938SUlrich Hecht return 0; 4147d0927938SUlrich Hecht} 4148d0927938SUlrich HechtEOF 41498fb03151SPeter Maydellif compile_prog "" "" ; then 4150d0927938SUlrich Hecht fallocate=yes 4151d0927938SUlrich Hechtfi 4152d0927938SUlrich Hecht 41533d4fa43eSKusanagi Kouichi# check for fallocate hole punching 41543d4fa43eSKusanagi Kouichifallocate_punch_hole=no 41553d4fa43eSKusanagi Kouichicat > $TMPC << EOF 41563d4fa43eSKusanagi Kouichi#include <fcntl.h> 41573d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 41583d4fa43eSKusanagi Kouichi 41593d4fa43eSKusanagi Kouichiint main(void) 41603d4fa43eSKusanagi Kouichi{ 41613d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 41623d4fa43eSKusanagi Kouichi return 0; 41633d4fa43eSKusanagi Kouichi} 41643d4fa43eSKusanagi KouichiEOF 41653d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 41663d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 41673d4fa43eSKusanagi Kouichifi 41683d4fa43eSKusanagi Kouichi 4169b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 4170b953f075SDenis V. Lunevfallocate_zero_range=no 4171b953f075SDenis V. Lunevcat > $TMPC << EOF 4172b953f075SDenis V. Lunev#include <fcntl.h> 4173b953f075SDenis V. Lunev#include <linux/falloc.h> 4174b953f075SDenis V. Lunev 4175b953f075SDenis V. Lunevint main(void) 4176b953f075SDenis V. Lunev{ 4177b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4178b953f075SDenis V. Lunev return 0; 4179b953f075SDenis V. Lunev} 4180b953f075SDenis V. LunevEOF 4181b953f075SDenis V. Lunevif compile_prog "" "" ; then 4182b953f075SDenis V. Lunev fallocate_zero_range=yes 4183b953f075SDenis V. Lunevfi 4184b953f075SDenis V. Lunev 4185ed911435SKevin Wolf# check for posix_fallocate 4186ed911435SKevin Wolfposix_fallocate=no 4187ed911435SKevin Wolfcat > $TMPC << EOF 4188ed911435SKevin Wolf#include <fcntl.h> 4189ed911435SKevin Wolf 4190ed911435SKevin Wolfint main(void) 4191ed911435SKevin Wolf{ 4192ed911435SKevin Wolf posix_fallocate(0, 0, 0); 4193ed911435SKevin Wolf return 0; 4194ed911435SKevin Wolf} 4195ed911435SKevin WolfEOF 4196ed911435SKevin Wolfif compile_prog "" "" ; then 4197ed911435SKevin Wolf posix_fallocate=yes 4198ed911435SKevin Wolffi 4199ed911435SKevin Wolf 4200c727f47dSPeter Maydell# check for sync_file_range 4201c727f47dSPeter Maydellsync_file_range=no 4202c727f47dSPeter Maydellcat > $TMPC << EOF 4203c727f47dSPeter Maydell#include <fcntl.h> 4204c727f47dSPeter Maydell 4205c727f47dSPeter Maydellint main(void) 4206c727f47dSPeter Maydell{ 4207c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 4208c727f47dSPeter Maydell return 0; 4209c727f47dSPeter Maydell} 4210c727f47dSPeter MaydellEOF 42118fb03151SPeter Maydellif compile_prog "" "" ; then 4212c727f47dSPeter Maydell sync_file_range=yes 4213c727f47dSPeter Maydellfi 4214c727f47dSPeter Maydell 4215dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 4216dace20dcSPeter Maydellfiemap=no 4217dace20dcSPeter Maydellcat > $TMPC << EOF 4218dace20dcSPeter Maydell#include <sys/ioctl.h> 4219dace20dcSPeter Maydell#include <linux/fs.h> 4220dace20dcSPeter Maydell#include <linux/fiemap.h> 4221dace20dcSPeter Maydell 4222dace20dcSPeter Maydellint main(void) 4223dace20dcSPeter Maydell{ 4224dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 4225dace20dcSPeter Maydell return 0; 4226dace20dcSPeter Maydell} 4227dace20dcSPeter MaydellEOF 42288fb03151SPeter Maydellif compile_prog "" "" ; then 4229dace20dcSPeter Maydell fiemap=yes 4230dace20dcSPeter Maydellfi 4231dace20dcSPeter Maydell 4232d0927938SUlrich Hecht# check for dup3 4233d0927938SUlrich Hechtdup3=no 4234d0927938SUlrich Hechtcat > $TMPC << EOF 4235d0927938SUlrich Hecht#include <unistd.h> 4236d0927938SUlrich Hecht 4237d0927938SUlrich Hechtint main(void) 4238d0927938SUlrich Hecht{ 4239d0927938SUlrich Hecht dup3(0, 0, 0); 4240d0927938SUlrich Hecht return 0; 4241d0927938SUlrich Hecht} 4242d0927938SUlrich HechtEOF 424378f5d726SJan Kiszkaif compile_prog "" "" ; then 4244d0927938SUlrich Hecht dup3=yes 4245d0927938SUlrich Hechtfi 4246d0927938SUlrich Hecht 42474e0c6529SAlex Bligh# check for ppoll support 42484e0c6529SAlex Blighppoll=no 42494e0c6529SAlex Blighcat > $TMPC << EOF 42504e0c6529SAlex Bligh#include <poll.h> 42514e0c6529SAlex Bligh 42524e0c6529SAlex Blighint main(void) 42534e0c6529SAlex Bligh{ 42544e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 42554e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 42564e0c6529SAlex Bligh return 0; 42574e0c6529SAlex Bligh} 42584e0c6529SAlex BlighEOF 42594e0c6529SAlex Blighif compile_prog "" "" ; then 42604e0c6529SAlex Bligh ppoll=yes 42614e0c6529SAlex Blighfi 42624e0c6529SAlex Bligh 4263cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 4264cd758dd0SAlex Blighprctl_pr_set_timerslack=no 4265cd758dd0SAlex Blighcat > $TMPC << EOF 4266cd758dd0SAlex Bligh#include <sys/prctl.h> 4267cd758dd0SAlex Bligh 4268cd758dd0SAlex Blighint main(void) 4269cd758dd0SAlex Bligh{ 4270cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4271cd758dd0SAlex Bligh return 0; 4272cd758dd0SAlex Bligh} 4273cd758dd0SAlex BlighEOF 4274cd758dd0SAlex Blighif compile_prog "" "" ; then 4275cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 4276cd758dd0SAlex Blighfi 4277cd758dd0SAlex Bligh 42783b6edd16SPeter Maydell# check for epoll support 42793b6edd16SPeter Maydellepoll=no 42803b6edd16SPeter Maydellcat > $TMPC << EOF 42813b6edd16SPeter Maydell#include <sys/epoll.h> 42823b6edd16SPeter Maydell 42833b6edd16SPeter Maydellint main(void) 42843b6edd16SPeter Maydell{ 42853b6edd16SPeter Maydell epoll_create(0); 42863b6edd16SPeter Maydell return 0; 42873b6edd16SPeter Maydell} 42883b6edd16SPeter MaydellEOF 42898fb03151SPeter Maydellif compile_prog "" "" ; then 42903b6edd16SPeter Maydell epoll=yes 42913b6edd16SPeter Maydellfi 42923b6edd16SPeter Maydell 4293227f0214SPeter Maydell# epoll_create1 is a later addition 4294227f0214SPeter Maydell# so we must check separately for its presence 42953b6edd16SPeter Maydellepoll_create1=no 42963b6edd16SPeter Maydellcat > $TMPC << EOF 42973b6edd16SPeter Maydell#include <sys/epoll.h> 42983b6edd16SPeter Maydell 42993b6edd16SPeter Maydellint main(void) 43003b6edd16SPeter Maydell{ 430119e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 430219e83f6bSPeter Maydell * a function being called. This is necessary so that on 430319e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 430419e83f6bSPeter Maydell * the library but not declared in the header file we will 430519e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 430619e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 430719e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 430819e83f6bSPeter Maydell */ 4309c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 43103b6edd16SPeter Maydell} 43113b6edd16SPeter MaydellEOF 43128fb03151SPeter Maydellif compile_prog "" "" ; then 43133b6edd16SPeter Maydell epoll_create1=yes 43143b6edd16SPeter Maydellfi 43153b6edd16SPeter Maydell 4316a8fd1abaSPeter Maydell# check for sendfile support 4317a8fd1abaSPeter Maydellsendfile=no 4318a8fd1abaSPeter Maydellcat > $TMPC << EOF 4319a8fd1abaSPeter Maydell#include <sys/sendfile.h> 4320a8fd1abaSPeter Maydell 4321a8fd1abaSPeter Maydellint main(void) 4322a8fd1abaSPeter Maydell{ 4323a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 4324a8fd1abaSPeter Maydell} 4325a8fd1abaSPeter MaydellEOF 4326a8fd1abaSPeter Maydellif compile_prog "" "" ; then 4327a8fd1abaSPeter Maydell sendfile=yes 4328a8fd1abaSPeter Maydellfi 4329a8fd1abaSPeter Maydell 433051834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 433151834341SRiku Voipiotimerfd=no 433251834341SRiku Voipiocat > $TMPC << EOF 433351834341SRiku Voipio#include <sys/timerfd.h> 433451834341SRiku Voipio 433551834341SRiku Voipioint main(void) 433651834341SRiku Voipio{ 433751834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 433851834341SRiku Voipio} 433951834341SRiku VoipioEOF 434051834341SRiku Voipioif compile_prog "" "" ; then 434151834341SRiku Voipio timerfd=yes 434251834341SRiku Voipiofi 434351834341SRiku Voipio 43449af5c906SRiku Voipio# check for setns and unshare support 43459af5c906SRiku Voipiosetns=no 43469af5c906SRiku Voipiocat > $TMPC << EOF 43479af5c906SRiku Voipio#include <sched.h> 43489af5c906SRiku Voipio 43499af5c906SRiku Voipioint main(void) 43509af5c906SRiku Voipio{ 43519af5c906SRiku Voipio int ret; 43529af5c906SRiku Voipio ret = setns(0, 0); 43539af5c906SRiku Voipio ret = unshare(0); 43549af5c906SRiku Voipio return ret; 43559af5c906SRiku Voipio} 43569af5c906SRiku VoipioEOF 43579af5c906SRiku Voipioif compile_prog "" "" ; then 43589af5c906SRiku Voipio setns=yes 43599af5c906SRiku Voipiofi 43609af5c906SRiku Voipio 436138860a03SAleksandar Markovic# clock_adjtime probe 436238860a03SAleksandar Markovicclock_adjtime=no 436338860a03SAleksandar Markoviccat > $TMPC <<EOF 436438860a03SAleksandar Markovic#include <time.h> 436538860a03SAleksandar Markovic 436638860a03SAleksandar Markovicint main(void) 436738860a03SAleksandar Markovic{ 436838860a03SAleksandar Markovic return clock_adjtime(0, 0); 436938860a03SAleksandar Markovic} 437038860a03SAleksandar MarkovicEOF 437138860a03SAleksandar Markovicclock_adjtime=no 437238860a03SAleksandar Markovicif compile_prog "" "" ; then 437338860a03SAleksandar Markovic clock_adjtime=yes 437438860a03SAleksandar Markovicfi 437538860a03SAleksandar Markovic 43765a03cd00SAleksandar Markovic# syncfs probe 43775a03cd00SAleksandar Markovicsyncfs=no 43785a03cd00SAleksandar Markoviccat > $TMPC <<EOF 43795a03cd00SAleksandar Markovic#include <unistd.h> 43805a03cd00SAleksandar Markovic 43815a03cd00SAleksandar Markovicint main(void) 43825a03cd00SAleksandar Markovic{ 43835a03cd00SAleksandar Markovic return syncfs(0); 43845a03cd00SAleksandar Markovic} 43855a03cd00SAleksandar MarkovicEOF 43865a03cd00SAleksandar Markovicsyncfs=no 43875a03cd00SAleksandar Markovicif compile_prog "" "" ; then 43885a03cd00SAleksandar Markovic syncfs=yes 43895a03cd00SAleksandar Markovicfi 43905a03cd00SAleksandar Markovic 4391cc8ae6deSpbrook# Check if tools are available to build documentation. 4392a25dba17SJuan Quintelaif test "$docs" != "no" ; then 439301668d98SStefan Weil if has makeinfo && has pod2man; then 4394a25dba17SJuan Quintela docs=yes 439583a3ab8bSJuan Quintela else 4396a25dba17SJuan Quintela if test "$docs" = "yes" ; then 439721684af0SStewart Smith feature_not_found "docs" "Install texinfo and Perl/perl-podlators" 439883a3ab8bSJuan Quintela fi 4399a25dba17SJuan Quintela docs=no 440083a3ab8bSJuan Quintela fi 4401cc8ae6deSpbrookfi 4402cc8ae6deSpbrook 4403f514f41cSStefan Weil# Search for bswap_32 function 44046ae9a1f4SJuan Quintelabyteswap_h=no 44056ae9a1f4SJuan Quintelacat > $TMPC << EOF 44066ae9a1f4SJuan Quintela#include <byteswap.h> 44076ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 44086ae9a1f4SJuan QuintelaEOF 440952166aa0SJuan Quintelaif compile_prog "" "" ; then 44106ae9a1f4SJuan Quintela byteswap_h=yes 44116ae9a1f4SJuan Quintelafi 44126ae9a1f4SJuan Quintela 441375f13596SStefan Weil# Search for bswap32 function 44146ae9a1f4SJuan Quintelabswap_h=no 44156ae9a1f4SJuan Quintelacat > $TMPC << EOF 44166ae9a1f4SJuan Quintela#include <sys/endian.h> 44176ae9a1f4SJuan Quintela#include <sys/types.h> 44186ae9a1f4SJuan Quintela#include <machine/bswap.h> 44196ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 44206ae9a1f4SJuan QuintelaEOF 442152166aa0SJuan Quintelaif compile_prog "" "" ; then 44226ae9a1f4SJuan Quintela bswap_h=yes 44236ae9a1f4SJuan Quintelafi 44246ae9a1f4SJuan Quintela 4425da93a1fdSaliguori########################################## 4426e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 4427c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 4428e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 44293c33ea96SPaolo Bonzini libiscsi="yes" 4430ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 4431ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 4432c589b249SRonnie Sahlberg else 4433c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 4434e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 4435c589b249SRonnie Sahlberg fi 4436c589b249SRonnie Sahlberg libiscsi="no" 4437c589b249SRonnie Sahlberg fi 4438c589b249SRonnie Sahlbergfi 4439c589b249SRonnie Sahlberg 4440c589b249SRonnie Sahlberg########################################## 44418bacde8dSNatanael Copa# Do we need libm 44428bacde8dSNatanael Copacat > $TMPC << EOF 44438bacde8dSNatanael Copa#include <math.h> 4444f80ea986SAlexey Kardashevskiyint main(int argc, char **argv) { return isnan(sin((double)argc)); } 44458bacde8dSNatanael CopaEOF 44468bacde8dSNatanael Copaif compile_prog "" "" ; then 44478bacde8dSNatanael Copa : 44488bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 44498bacde8dSNatanael Copa LIBS="-lm $LIBS" 44508bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 44518bacde8dSNatanael Copaelse 445276ad07a4SPeter Maydell error_exit "libm check failed" 44538bacde8dSNatanael Copafi 44548bacde8dSNatanael Copa 44558bacde8dSNatanael Copa########################################## 4456da93a1fdSaliguori# Do we need librt 44578bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 44588bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 44598bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 44608bacde8dSNatanael Copa# function in addition. 4461da93a1fdSaliguoricat > $TMPC <<EOF 4462da93a1fdSaliguori#include <signal.h> 4463da93a1fdSaliguori#include <time.h> 44648bacde8dSNatanael Copaint main(void) { 44658bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 44668bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 44678bacde8dSNatanael Copa} 4468da93a1fdSaliguoriEOF 4469da93a1fdSaliguori 447052166aa0SJuan Quintelaif compile_prog "" "" ; then 447107ffa4bdSJuan Quintela : 44728bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 447318e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 447418e588b1SRick Liu LIBS="$LIBS -lrt" 447518e588b1SRick Liu libs_qga="$libs_qga -lrt" 4476da93a1fdSaliguorifi 4477da93a1fdSaliguori 447831ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 447978723752SPeter Maydell "$haiku" != "yes" ; then 44806362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 44816362a53fSJuan Quintelafi 44826362a53fSJuan Quintela 4483de5071c5SBlue Swirl########################################## 4484cd4ec0b4SGerd Hoffmann# spice probe 4485cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 4486cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 4487cd4ec0b4SGerd Hoffmann#include <spice.h> 4488cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 4489cd4ec0b4SGerd HoffmannEOF 4490710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 4491710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 449265d5d3f9SStefan Weil if $pkg_config --atleast-version=0.12.0 spice-server && \ 449365d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 4494cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 4495cd4ec0b4SGerd Hoffmann spice="yes" 4496cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 4497cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 44982e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 44992e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 4500cd4ec0b4SGerd Hoffmann else 4501cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 45028efc9363SHu Tao feature_not_found "spice" \ 45038efc9363SHu Tao "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel" 4504cd4ec0b4SGerd Hoffmann fi 4505cd4ec0b4SGerd Hoffmann spice="no" 4506cd4ec0b4SGerd Hoffmann fi 4507cd4ec0b4SGerd Hoffmannfi 4508cd4ec0b4SGerd Hoffmann 45097b02f544SMarc-André Lureau# check for smartcard support 45107b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 45110f5c642dSMichal Privoznik if $pkg_config --atleast-version=2.5.1 libcacard; then 45127b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 45137b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 45147b02f544SMarc-André Lureau smartcard="yes" 4515111a38b0SRobert Relyea else 45167b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 45177b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 4518111a38b0SRobert Relyea fi 45197b02f544SMarc-André Lureau smartcard="no" 4520111a38b0SRobert Relyea fi 4521111a38b0SRobert Relyeafi 4522111a38b0SRobert Relyea 45232b2325ffSGerd Hoffmann# check for libusb 45242b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 452565d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 45262b2325ffSGerd Hoffmann libusb="yes" 4527ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 4528ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 45292b2325ffSGerd Hoffmann else 45302b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 45318efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 45322b2325ffSGerd Hoffmann fi 45332b2325ffSGerd Hoffmann libusb="no" 45342b2325ffSGerd Hoffmann fi 45352b2325ffSGerd Hoffmannfi 45362b2325ffSGerd Hoffmann 453769354a83SHans de Goede# check for usbredirparser for usb network redirection support 453869354a83SHans de Goedeif test "$usb_redir" != "no" ; then 453965d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 454069354a83SHans de Goede usb_redir="yes" 4541ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 4542ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 454369354a83SHans de Goede else 454469354a83SHans de Goede if test "$usb_redir" = "yes"; then 454521684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 454669354a83SHans de Goede fi 454769354a83SHans de Goede usb_redir="no" 454869354a83SHans de Goede fi 454969354a83SHans de Goedefi 455069354a83SHans de Goede 4551cd4ec0b4SGerd Hoffmann########################################## 4552d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 4553d9840e25STomoki Sekiyama 4554d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then 4555d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 4556690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 4557d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 4558d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 4559690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 4560d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 4561d9840e25STomoki Sekiyama ;; 4562690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 4563d9840e25STomoki Sekiyama esac 4564d9840e25STomoki Sekiyama cat > $TMPC << EOF 4565d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 4566d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 4567d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 4568d9840e25STomoki SekiyamaEOF 4569d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 4570d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 4571d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 4572315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 4573f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 4574d9840e25STomoki Sekiyama else 4575d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 4576d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 4577d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 4578d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 4579d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 4580d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 4581d9840e25STomoki Sekiyama feature_not_found "VSS support" 4582d9840e25STomoki Sekiyama fi 4583d9840e25STomoki Sekiyama guest_agent_with_vss="no" 4584d9840e25STomoki Sekiyama fi 4585d9840e25STomoki Sekiyamafi 4586d9840e25STomoki Sekiyama 4587d9840e25STomoki Sekiyama########################################## 4588d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 4589d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 4590d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 4591d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 4592d9840e25STomoki Sekiyama 4593d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then 4594d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 4595d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 4596d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 4597d9840e25STomoki Sekiyama if test -n "$programfiles"; then 4598d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 4599d9840e25STomoki Sekiyama else 4600d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 4601d9840e25STomoki Sekiyama fi 4602d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 4603d9840e25STomoki Sekiyama win_sdk="" 4604d9840e25STomoki Sekiyama fi 4605d9840e25STomoki Sekiyamafi 4606d9840e25STomoki Sekiyama 4607d9840e25STomoki Sekiyama########################################## 460850cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 460950cbebb9SMichael Rothif test "$mingw32" = "yes" -a "$guest_agent" != "no"; then 461050cbebb9SMichael Roth cat > $TMPC << EOF 461150cbebb9SMichael Roth#include <windows.h> 461250cbebb9SMichael Roth#include <ntddscsi.h> 461350cbebb9SMichael Rothint main(void) { 461450cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 461550cbebb9SMichael Roth#error Missing required ioctl definitions 461650cbebb9SMichael Roth#endif 461750cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 461850cbebb9SMichael Roth return addr.Lun; 461950cbebb9SMichael Roth} 462050cbebb9SMichael RothEOF 462150cbebb9SMichael Roth if compile_prog "" "" ; then 462250cbebb9SMichael Roth guest_agent_ntddscsi=yes 4623c54e1eb4SMichael Roth libs_qga="-lsetupapi $libs_qga" 462450cbebb9SMichael Roth fi 462550cbebb9SMichael Rothfi 462650cbebb9SMichael Roth 462750cbebb9SMichael Roth########################################## 46289d9e1521SGerd Hoffmann# virgl renderer probe 46299d9e1521SGerd Hoffmann 46309d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 46319d9e1521SGerd Hoffmann cat > $TMPC << EOF 46329d9e1521SGerd Hoffmann#include <virglrenderer.h> 46339d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 46349d9e1521SGerd HoffmannEOF 46359d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 46369d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 463747479c55SMarc-André Lureau virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 46389d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 46399d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 46409d9e1521SGerd Hoffmann virglrenderer="yes" 46419d9e1521SGerd Hoffmann else 46429d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 46439d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 46449d9e1521SGerd Hoffmann fi 46459d9e1521SGerd Hoffmann virglrenderer="no" 46469d9e1521SGerd Hoffmann fi 46479d9e1521SGerd Hoffmannfi 46489d9e1521SGerd Hoffmann 46499d9e1521SGerd Hoffmann########################################## 46508ca80760SRichard Henderson# capstone 46518ca80760SRichard Henderson 4652e219c499SRichard Hendersoncase "$capstone" in 4653e219c499SRichard Henderson "" | yes) 46548ca80760SRichard Henderson if $pkg_config capstone; then 4655e219c499SRichard Henderson capstone=system 4656123ac0bbSAlexey Kardashevskiy elif test -e "${source_path}/.git" -a $git_update = 'yes' ; then 4657e219c499SRichard Henderson capstone=git 4658e219c499SRichard Henderson elif test -e "${source_path}/capstone/Makefile" ; then 4659e219c499SRichard Henderson capstone=internal 4660e219c499SRichard Henderson elif test -z "$capstone" ; then 4661e219c499SRichard Henderson capstone=no 4662e219c499SRichard Henderson else 4663e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel or git submodule" 4664e219c499SRichard Henderson fi 4665e219c499SRichard Henderson ;; 4666e219c499SRichard Henderson 4667e219c499SRichard Henderson system) 4668e219c499SRichard Henderson if ! $pkg_config capstone; then 4669e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel" 4670e219c499SRichard Henderson fi 4671e219c499SRichard Henderson ;; 4672e219c499SRichard Hendersonesac 4673e219c499SRichard Henderson 4674e219c499SRichard Hendersoncase "$capstone" in 4675e219c499SRichard Henderson git | internal) 4676e219c499SRichard Henderson if test "$capstone" = git; then 4677e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 4678e219c499SRichard Henderson fi 4679e219c499SRichard Henderson mkdir -p capstone 4680e219c499SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" 4681e219c499SRichard Henderson if test "$mingw32" = "yes"; then 4682e219c499SRichard Henderson LIBCAPSTONE=capstone.lib 4683e219c499SRichard Henderson else 4684e219c499SRichard Henderson LIBCAPSTONE=libcapstone.a 4685e219c499SRichard Henderson fi 4686e219c499SRichard Henderson LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS" 4687e219c499SRichard Henderson ;; 4688e219c499SRichard Henderson 4689e219c499SRichard Henderson system) 46908ca80760SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" 46918ca80760SRichard Henderson LIBS="$($pkg_config --libs capstone) $LIBS" 4692e219c499SRichard Henderson ;; 4693e219c499SRichard Henderson 4694e219c499SRichard Henderson no) 4695e219c499SRichard Henderson ;; 4696e219c499SRichard Henderson *) 4697e219c499SRichard Henderson error_exit "Unknown state for capstone: $capstone" 4698e219c499SRichard Henderson ;; 4699e219c499SRichard Hendersonesac 47008ca80760SRichard Henderson 47018ca80760SRichard Henderson########################################## 47025f6b9e8fSBlue Swirl# check if we have fdatasync 47035f6b9e8fSBlue Swirl 47045f6b9e8fSBlue Swirlfdatasync=no 47055f6b9e8fSBlue Swirlcat > $TMPC << EOF 47065f6b9e8fSBlue Swirl#include <unistd.h> 4707d1722a27SAlexandre Raymondint main(void) { 4708d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 4709d1722a27SAlexandre Raymondreturn fdatasync(0); 4710d1722a27SAlexandre Raymond#else 4711e172fe11SStefan Weil#error Not supported 4712d1722a27SAlexandre Raymond#endif 4713d1722a27SAlexandre Raymond} 47145f6b9e8fSBlue SwirlEOF 47155f6b9e8fSBlue Swirlif compile_prog "" "" ; then 47165f6b9e8fSBlue Swirl fdatasync=yes 47175f6b9e8fSBlue Swirlfi 47185f6b9e8fSBlue Swirl 471994a420b1SStefan Hajnoczi########################################## 4720e78815a5SAndreas Färber# check if we have madvise 4721e78815a5SAndreas Färber 4722e78815a5SAndreas Färbermadvise=no 4723e78815a5SAndreas Färbercat > $TMPC << EOF 4724e78815a5SAndreas Färber#include <sys/types.h> 4725e78815a5SAndreas Färber#include <sys/mman.h> 4726832ce9c2SScott Wood#include <stddef.h> 4727e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 4728e78815a5SAndreas FärberEOF 4729e78815a5SAndreas Färberif compile_prog "" "" ; then 4730e78815a5SAndreas Färber madvise=yes 4731e78815a5SAndreas Färberfi 4732e78815a5SAndreas Färber 4733e78815a5SAndreas Färber########################################## 4734e78815a5SAndreas Färber# check if we have posix_madvise 4735e78815a5SAndreas Färber 4736e78815a5SAndreas Färberposix_madvise=no 4737e78815a5SAndreas Färbercat > $TMPC << EOF 4738e78815a5SAndreas Färber#include <sys/mman.h> 4739832ce9c2SScott Wood#include <stddef.h> 4740e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 4741e78815a5SAndreas FärberEOF 4742e78815a5SAndreas Färberif compile_prog "" "" ; then 4743e78815a5SAndreas Färber posix_madvise=yes 4744e78815a5SAndreas Färberfi 4745e78815a5SAndreas Färber 4746e78815a5SAndreas Färber########################################## 47479bc5a719SAndreas Gustafsson# check if we have posix_memalign() 47489bc5a719SAndreas Gustafsson 47499bc5a719SAndreas Gustafssonposix_memalign=no 47509bc5a719SAndreas Gustafssoncat > $TMPC << EOF 47519bc5a719SAndreas Gustafsson#include <stdlib.h> 47529bc5a719SAndreas Gustafssonint main(void) { 47539bc5a719SAndreas Gustafsson void *p; 47549bc5a719SAndreas Gustafsson return posix_memalign(&p, 8, 8); 47559bc5a719SAndreas Gustafsson} 47569bc5a719SAndreas GustafssonEOF 47579bc5a719SAndreas Gustafssonif compile_prog "" "" ; then 47589bc5a719SAndreas Gustafsson posix_memalign=yes 47599bc5a719SAndreas Gustafssonfi 47609bc5a719SAndreas Gustafsson 47619bc5a719SAndreas Gustafsson########################################## 47620a852417SPaul Durrant# check if we have posix_syslog 47630a852417SPaul Durrant 47640a852417SPaul Durrantposix_syslog=no 47650a852417SPaul Durrantcat > $TMPC << EOF 47660a852417SPaul Durrant#include <syslog.h> 47670a852417SPaul Durrantint main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 47680a852417SPaul DurrantEOF 47690a852417SPaul Durrantif compile_prog "" "" ; then 47700a852417SPaul Durrant posix_syslog=yes 47710a852417SPaul Durrantfi 47720a852417SPaul Durrant 47730a852417SPaul Durrant########################################## 4774401bc051SPeter Maydell# check if we have sem_timedwait 4775401bc051SPeter Maydell 4776401bc051SPeter Maydellsem_timedwait=no 4777401bc051SPeter Maydellcat > $TMPC << EOF 4778401bc051SPeter Maydell#include <semaphore.h> 4779401bc051SPeter Maydellint main(void) { return sem_timedwait(0, 0); } 4780401bc051SPeter MaydellEOF 4781401bc051SPeter Maydellif compile_prog "" "" ; then 4782401bc051SPeter Maydell sem_timedwait=yes 4783401bc051SPeter Maydellfi 4784401bc051SPeter Maydell 4785401bc051SPeter Maydell########################################## 47865c99fa37SKeno Fischer# check if we have strchrnul 47875c99fa37SKeno Fischer 47885c99fa37SKeno Fischerstrchrnul=no 47895c99fa37SKeno Fischercat > $TMPC << EOF 47905c99fa37SKeno Fischer#include <string.h> 47915c99fa37SKeno Fischerint main(void); 47925c99fa37SKeno Fischer// Use a haystack that the compiler shouldn't be able to constant fold 47935c99fa37SKeno Fischerchar *haystack = (char*)&main; 47945c99fa37SKeno Fischerint main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 47955c99fa37SKeno FischerEOF 47965c99fa37SKeno Fischerif compile_prog "" "" ; then 47975c99fa37SKeno Fischer strchrnul=yes 47985c99fa37SKeno Fischerfi 47995c99fa37SKeno Fischer 48005c99fa37SKeno Fischer########################################## 480194a420b1SStefan Hajnoczi# check if trace backend exists 480294a420b1SStefan Hajnoczi 48035b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 480494a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 48055b808275SLluís Vilanova error_exit "invalid trace backends" \ 48065b808275SLluís Vilanova "Please choose supported trace backends." 480794a420b1SStefan Hajnoczifi 480894a420b1SStefan Hajnoczi 48097e24e92aSStefan Hajnoczi########################################## 48107e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 48115b808275SLluís Vilanovaif have_backend "ust"; then 48127e24e92aSStefan Hajnoczi cat > $TMPC << EOF 4813bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 48147e24e92aSStefan Hajnocziint main(void) { return 0; } 48157e24e92aSStefan HajnocziEOF 4816c79ed23dSFrancis Deslauriers if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 4817bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 481889138857SStefan Weil lttng_ust_libs=$($pkg_config --libs lttng-ust) 48197e24e92aSStefan Hajnoczi else 4820c79ed23dSFrancis Deslauriers lttng_ust_libs="-llttng-ust -ldl" 4821bf15f63cSMohamad Gebai fi 4822bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 482389138857SStefan Weil urcu_bp_libs=$($pkg_config --libs liburcu-bp) 4824bf15f63cSMohamad Gebai else 4825bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 4826bf15f63cSMohamad Gebai fi 4827bf15f63cSMohamad Gebai 4828bf15f63cSMohamad Gebai LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 4829bf15f63cSMohamad Gebai libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 4830bf15f63cSMohamad Gebai else 4831bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 48327e24e92aSStefan Hajnoczi fi 48337e24e92aSStefan Hajnoczifi 4834b3d08c02SDaniel P. Berrange 4835b3d08c02SDaniel P. Berrange########################################## 4836b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 48375b808275SLluís Vilanovaif have_backend "dtrace"; then 4838b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 483976ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 4840b3d08c02SDaniel P. Berrange fi 4841c276b17dSDaniel P. Berrange trace_backend_stap="no" 4842c276b17dSDaniel P. Berrange if has 'stap' ; then 4843c276b17dSDaniel P. Berrange trace_backend_stap="yes" 4844c276b17dSDaniel P. Berrange fi 4845b3d08c02SDaniel P. Berrangefi 4846b3d08c02SDaniel P. Berrange 48477e24e92aSStefan Hajnoczi########################################## 4848519175a2SAlex Barcelo# check and set a backend for coroutine 4849d0e2fce5SAneesh Kumar K.V 48507c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 485133c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 485233c53c54SDaniel P. Berrange# specific one. 48537c2acc70SPeter Maydell 48547c2acc70SPeter Maydellucontext_works=no 4855d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 4856d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 4857d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 4858cdf84806SPeter Maydell#ifdef __stub_makecontext 4859cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 4860cdf84806SPeter Maydell#endif 486175cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 4862d0e2fce5SAneesh Kumar K.VEOF 4863d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 48647c2acc70SPeter Maydell ucontext_works=yes 4865d0e2fce5SAneesh Kumar K.V fi 4866519175a2SAlex Barcelofi 48677c2acc70SPeter Maydell 48687c2acc70SPeter Maydellif test "$coroutine" = ""; then 48697c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 48707c2acc70SPeter Maydell coroutine=win32 48717c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 48727c2acc70SPeter Maydell coroutine=ucontext 4873519175a2SAlex Barcelo else 48747c2acc70SPeter Maydell coroutine=sigaltstack 48757c2acc70SPeter Maydell fi 48767c2acc70SPeter Maydellelse 48777c2acc70SPeter Maydell case $coroutine in 48787c2acc70SPeter Maydell windows) 48797c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 48807c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 48817c2acc70SPeter Maydell fi 48827c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 48837c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 48847c2acc70SPeter Maydell coroutine=win32 48857c2acc70SPeter Maydell ;; 48867c2acc70SPeter Maydell ucontext) 48877c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 48887c2acc70SPeter Maydell feature_not_found "ucontext" 48897c2acc70SPeter Maydell fi 48907c2acc70SPeter Maydell ;; 489133c53c54SDaniel P. Berrange sigaltstack) 48927c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 48937c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 48947c2acc70SPeter Maydell fi 48957c2acc70SPeter Maydell ;; 48967c2acc70SPeter Maydell *) 489776ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 48987c2acc70SPeter Maydell ;; 48997c2acc70SPeter Maydell esac 4900d0e2fce5SAneesh Kumar K.Vfi 4901d0e2fce5SAneesh Kumar K.V 490270c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 490370c60c08SStefan Hajnoczi coroutine_pool=yes 490470c60c08SStefan Hajnoczifi 490570c60c08SStefan Hajnoczi 49067d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 49077d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 49087d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 49097d992e4dSPeter Lieven coroutine_pool=no 49107d992e4dSPeter Lieven fi 49117d992e4dSPeter Lievenfi 49127d992e4dSPeter Lieven 49137d992e4dSPeter Lieven 4914d0e2fce5SAneesh Kumar K.V########################################## 4915d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 4916d2042378SAneesh Kumar K.V 49174e1797f9SStefan Weilopen_by_handle_at=no 4918d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 4919d2042378SAneesh Kumar K.V#include <fcntl.h> 4920acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 4921acc55ba8SStefan Weil# error missing definition 4922acc55ba8SStefan Weil#else 492375cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 4924acc55ba8SStefan Weil#endif 4925d2042378SAneesh Kumar K.VEOF 4926d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 4927d2042378SAneesh Kumar K.V open_by_handle_at=yes 4928d2042378SAneesh Kumar K.Vfi 4929d2042378SAneesh Kumar K.V 4930e06a765eSHarsh Prateek Bora######################################## 4931e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 4932e06a765eSHarsh Prateek Bora 4933e06a765eSHarsh Prateek Boralinux_magic_h=no 4934e06a765eSHarsh Prateek Boracat > $TMPC << EOF 4935e06a765eSHarsh Prateek Bora#include <linux/magic.h> 4936e06a765eSHarsh Prateek Boraint main(void) { 493775cafad7SStefan Weil return 0; 4938e06a765eSHarsh Prateek Bora} 4939e06a765eSHarsh Prateek BoraEOF 4940e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 4941e06a765eSHarsh Prateek Bora linux_magic_h=yes 4942e06a765eSHarsh Prateek Borafi 4943e06a765eSHarsh Prateek Bora 49448ab1bf12SLuiz Capitulino######################################## 4945c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed 4946c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries). 4947c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is 4948c95e3080SKevin Wolf# only a warning. 4949c95e3080SKevin Wolf# 4950c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that 4951c95e3080SKevin Wolf# the build doesn't fail anyway. 4952c95e3080SKevin Wolf 495306d71fa1SPeter Maydellpragma_disable_unused_but_set=no 495406d71fa1SPeter Maydellcat > $TMPC << EOF 4955e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push 4956c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes" 4957e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop 4958c95e3080SKevin Wolf 495906d71fa1SPeter Maydellint main(void) { 496006d71fa1SPeter Maydell return 0; 496106d71fa1SPeter Maydell} 496206d71fa1SPeter MaydellEOF 496306d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 4964cc6e3ca9SGerd Hoffmann pragma_diagnostic_available=yes 4965c95e3080SKevin Wolfelse 4966c95e3080SKevin Wolf werror=no 496706d71fa1SPeter Maydellfi 496806d71fa1SPeter Maydell 496906d71fa1SPeter Maydell######################################## 4970541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 49713f4349dcSKevin Wolf 49723f4349dcSKevin Wolfvalgrind_h=no 49733f4349dcSKevin Wolfcat > $TMPC << EOF 49743f4349dcSKevin Wolf#include <valgrind/valgrind.h> 49753f4349dcSKevin Wolfint main(void) { 49763f4349dcSKevin Wolf return 0; 49773f4349dcSKevin Wolf} 49783f4349dcSKevin WolfEOF 49793f4349dcSKevin Wolfif compile_prog "" "" ; then 49803f4349dcSKevin Wolf valgrind_h=yes 49813f4349dcSKevin Wolffi 49823f4349dcSKevin Wolf 49833f4349dcSKevin Wolf######################################## 49848ab1bf12SLuiz Capitulino# check if environ is declared 49858ab1bf12SLuiz Capitulino 49868ab1bf12SLuiz Capitulinohas_environ=no 49878ab1bf12SLuiz Capitulinocat > $TMPC << EOF 49888ab1bf12SLuiz Capitulino#include <unistd.h> 49898ab1bf12SLuiz Capitulinoint main(void) { 4990c075a723SBlue Swirl environ = 0; 49918ab1bf12SLuiz Capitulino return 0; 49928ab1bf12SLuiz Capitulino} 49938ab1bf12SLuiz CapitulinoEOF 49948ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 49958ab1bf12SLuiz Capitulino has_environ=yes 49968ab1bf12SLuiz Capitulinofi 49978ab1bf12SLuiz Capitulino 499876a347e1SRichard Henderson######################################## 499976a347e1SRichard Henderson# check if cpuid.h is usable. 500076a347e1SRichard Henderson 500176a347e1SRichard Hendersoncat > $TMPC << EOF 500276a347e1SRichard Henderson#include <cpuid.h> 500376a347e1SRichard Hendersonint main(void) { 5004774d566cSPeter Maydell unsigned a, b, c, d; 5005774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 5006774d566cSPeter Maydell 5007774d566cSPeter Maydell if (max >= 1) { 5008774d566cSPeter Maydell __cpuid(1, a, b, c, d); 5009774d566cSPeter Maydell } 5010774d566cSPeter Maydell 5011774d566cSPeter Maydell if (max >= 7) { 5012774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 5013774d566cSPeter Maydell } 5014774d566cSPeter Maydell 501576a347e1SRichard Henderson return 0; 501676a347e1SRichard Henderson} 501776a347e1SRichard HendersonEOF 501876a347e1SRichard Hendersonif compile_prog "" "" ; then 501976a347e1SRichard Henderson cpuid_h=yes 502076a347e1SRichard Hendersonfi 502176a347e1SRichard Henderson 50225dd89908SRichard Henderson########################################## 50235dd89908SRichard Henderson# avx2 optimization requirement check 50245dd89908SRichard Henderson# 50255dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 50265dd89908SRichard Henderson# since we won't be able to select the new routines. 50275dd89908SRichard Henderson 50285dd89908SRichard Hendersonif test $cpuid_h = yes; then 50295dd89908SRichard Henderson cat > $TMPC << EOF 50305dd89908SRichard Henderson#pragma GCC push_options 50315dd89908SRichard Henderson#pragma GCC target("avx2") 50325dd89908SRichard Henderson#include <cpuid.h> 50335dd89908SRichard Henderson#include <immintrin.h> 50345dd89908SRichard Hendersonstatic int bar(void *a) { 50355dd89908SRichard Henderson __m256i x = *(__m256i *)a; 50365dd89908SRichard Henderson return _mm256_testz_si256(x, x); 50375dd89908SRichard Henderson} 50385dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 50395dd89908SRichard HendersonEOF 50405dd89908SRichard Henderson if compile_object "" ; then 50415dd89908SRichard Henderson avx2_opt="yes" 50425dd89908SRichard Henderson fi 50435dd89908SRichard Hendersonfi 50445dd89908SRichard Henderson 5045f540166bSRichard Henderson######################################## 5046f540166bSRichard Henderson# check if __[u]int128_t is usable. 5047f540166bSRichard Henderson 5048f540166bSRichard Hendersonint128=no 5049f540166bSRichard Hendersoncat > $TMPC << EOF 5050a00f66abSStefan Weil#if defined(__clang_major__) && defined(__clang_minor__) 5051a00f66abSStefan Weil# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2)) 5052a00f66abSStefan Weil# error __int128_t does not work in CLANG before 3.2 5053a00f66abSStefan Weil# endif 5054a00f66abSStefan Weil#endif 5055f540166bSRichard Henderson__int128_t a; 5056f540166bSRichard Henderson__uint128_t b; 5057f540166bSRichard Hendersonint main (void) { 5058f540166bSRichard Henderson a = a + b; 5059f540166bSRichard Henderson b = a * b; 5060464e3671SPeter Maydell a = a * a; 5061f540166bSRichard Henderson return 0; 5062f540166bSRichard Henderson} 5063f540166bSRichard HendersonEOF 5064f540166bSRichard Hendersonif compile_prog "" "" ; then 5065f540166bSRichard Henderson int128=yes 5066f540166bSRichard Hendersonfi 506776a347e1SRichard Henderson 50687ebee43eSRichard Henderson######################################### 50697ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 50707ebee43eSRichard Henderson 50717ebee43eSRichard Hendersonatomic128=no 50727ebee43eSRichard Hendersonif test "$int128" = "yes"; then 50737ebee43eSRichard Henderson cat > $TMPC << EOF 50747ebee43eSRichard Hendersonint main(void) 50757ebee43eSRichard Henderson{ 50767ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 50777ebee43eSRichard Henderson y = __atomic_load_16(&x, 0); 50787ebee43eSRichard Henderson __atomic_store_16(&x, y, 0); 50797ebee43eSRichard Henderson __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 50807ebee43eSRichard Henderson return 0; 50817ebee43eSRichard Henderson} 50827ebee43eSRichard HendersonEOF 50837ebee43eSRichard Henderson if compile_prog "" "" ; then 50847ebee43eSRichard Henderson atomic128=yes 50857ebee43eSRichard Henderson fi 50867ebee43eSRichard Hendersonfi 50877ebee43eSRichard Henderson 5088df79b996SRichard Henderson######################################### 5089df79b996SRichard Henderson# See if 64-bit atomic operations are supported. 5090df79b996SRichard Henderson# Note that without __atomic builtins, we can only 5091df79b996SRichard Henderson# assume atomic loads/stores max at pointer size. 5092df79b996SRichard Henderson 5093df79b996SRichard Hendersoncat > $TMPC << EOF 5094df79b996SRichard Henderson#include <stdint.h> 5095df79b996SRichard Hendersonint main(void) 5096df79b996SRichard Henderson{ 5097df79b996SRichard Henderson uint64_t x = 0, y = 0; 5098df79b996SRichard Henderson#ifdef __ATOMIC_RELAXED 5099df79b996SRichard Henderson y = __atomic_load_8(&x, 0); 5100df79b996SRichard Henderson __atomic_store_8(&x, y, 0); 5101df79b996SRichard Henderson __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); 5102df79b996SRichard Henderson __atomic_exchange_8(&x, y, 0); 5103df79b996SRichard Henderson __atomic_fetch_add_8(&x, y, 0); 5104df79b996SRichard Henderson#else 5105df79b996SRichard Henderson typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5106df79b996SRichard Henderson __sync_lock_test_and_set(&x, y); 5107df79b996SRichard Henderson __sync_val_compare_and_swap(&x, y, 0); 5108df79b996SRichard Henderson __sync_fetch_and_add(&x, y); 5109df79b996SRichard Henderson#endif 5110df79b996SRichard Henderson return 0; 5111df79b996SRichard Henderson} 5112df79b996SRichard HendersonEOF 5113df79b996SRichard Hendersonif compile_prog "" "" ; then 5114df79b996SRichard Henderson atomic64=yes 5115df79b996SRichard Hendersonfi 5116df79b996SRichard Henderson 51171e6e9acaSRichard Henderson######################################## 5118db432672SRichard Henderson# See if 16-byte vector operations are supported. 5119db432672SRichard Henderson# Even without a vector unit the compiler may expand these. 5120db432672SRichard Henderson# There is a bug in old GCC for PPC that crashes here. 5121db432672SRichard Henderson# Unfortunately it's the system compiler for Centos 7. 5122db432672SRichard Henderson 5123db432672SRichard Hendersoncat > $TMPC << EOF 5124db432672SRichard Hendersontypedef unsigned char U1 __attribute__((vector_size(16))); 5125db432672SRichard Hendersontypedef unsigned short U2 __attribute__((vector_size(16))); 5126db432672SRichard Hendersontypedef unsigned int U4 __attribute__((vector_size(16))); 5127db432672SRichard Hendersontypedef unsigned long long U8 __attribute__((vector_size(16))); 5128db432672SRichard Hendersontypedef signed char S1 __attribute__((vector_size(16))); 5129db432672SRichard Hendersontypedef signed short S2 __attribute__((vector_size(16))); 5130db432672SRichard Hendersontypedef signed int S4 __attribute__((vector_size(16))); 5131db432672SRichard Hendersontypedef signed long long S8 __attribute__((vector_size(16))); 5132db432672SRichard Hendersonstatic U1 a1, b1; 5133db432672SRichard Hendersonstatic U2 a2, b2; 5134db432672SRichard Hendersonstatic U4 a4, b4; 5135db432672SRichard Hendersonstatic U8 a8, b8; 5136db432672SRichard Hendersonstatic S1 c1; 5137db432672SRichard Hendersonstatic S2 c2; 5138db432672SRichard Hendersonstatic S4 c4; 5139db432672SRichard Hendersonstatic S8 c8; 5140db432672SRichard Hendersonstatic int i; 514174912f6dSLaurent Viviervoid helper(void *d, void *a, int shift, int i); 514274912f6dSLaurent Viviervoid helper(void *d, void *a, int shift, int i) 514374912f6dSLaurent Vivier{ 514474912f6dSLaurent Vivier *(U1 *)(d + i) = *(U1 *)(a + i) << shift; 514574912f6dSLaurent Vivier *(U2 *)(d + i) = *(U2 *)(a + i) << shift; 514674912f6dSLaurent Vivier *(U4 *)(d + i) = *(U4 *)(a + i) << shift; 514774912f6dSLaurent Vivier *(U8 *)(d + i) = *(U8 *)(a + i) << shift; 514874912f6dSLaurent Vivier} 5149db432672SRichard Hendersonint main(void) 5150db432672SRichard Henderson{ 5151db432672SRichard Henderson a1 += b1; a2 += b2; a4 += b4; a8 += b8; 5152db432672SRichard Henderson a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8; 5153db432672SRichard Henderson a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8; 5154db432672SRichard Henderson a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8; 5155db432672SRichard Henderson a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8; 5156db432672SRichard Henderson a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8; 5157db432672SRichard Henderson a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i; 5158db432672SRichard Henderson a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i; 5159db432672SRichard Henderson c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i; 5160db432672SRichard Henderson return 0; 5161db432672SRichard Henderson} 5162db432672SRichard HendersonEOF 5163db432672SRichard Henderson 5164db432672SRichard Hendersonvector16=no 5165db432672SRichard Hendersonif compile_prog "" "" ; then 5166db432672SRichard Henderson vector16=yes 5167db432672SRichard Hendersonfi 5168db432672SRichard Henderson 5169db432672SRichard Henderson######################################## 51701e6e9acaSRichard Henderson# check if getauxval is available. 51711e6e9acaSRichard Henderson 51721e6e9acaSRichard Hendersongetauxval=no 51731e6e9acaSRichard Hendersoncat > $TMPC << EOF 51741e6e9acaSRichard Henderson#include <sys/auxv.h> 51751e6e9acaSRichard Hendersonint main(void) { 51761e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 51771e6e9acaSRichard Henderson} 51781e6e9acaSRichard HendersonEOF 51791e6e9acaSRichard Hendersonif compile_prog "" "" ; then 51801e6e9acaSRichard Henderson getauxval=yes 51811e6e9acaSRichard Hendersonfi 51821e6e9acaSRichard Henderson 5183fd0e6053SJohn Snow######################################## 5184fd0e6053SJohn Snow# check if ccache is interfering with 5185fd0e6053SJohn Snow# semantic analysis of macros 5186fd0e6053SJohn Snow 51875e4dfd3dSJohn Snowunset CCACHE_CPP2 5188fd0e6053SJohn Snowccache_cpp2=no 5189fd0e6053SJohn Snowcat > $TMPC << EOF 5190fd0e6053SJohn Snowstatic const int Z = 1; 5191fd0e6053SJohn Snow#define fn() ({ Z; }) 5192fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 5193fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 5194fd0e6053SJohn Snow#define ID(X) (X) 5195fd0e6053SJohn Snowint main(int argc, char *argv[]) 5196fd0e6053SJohn Snow{ 5197fd0e6053SJohn Snow int x = 0, y = 0; 5198fd0e6053SJohn Snow x = ID(x); 5199fd0e6053SJohn Snow x = fn(); 5200fd0e6053SJohn Snow fn(); 5201fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 5202fd0e6053SJohn Snow if (TAUT(Z)) return 0; 5203fd0e6053SJohn Snow return 0; 5204fd0e6053SJohn Snow} 5205fd0e6053SJohn SnowEOF 5206fd0e6053SJohn Snow 5207fd0e6053SJohn Snowif ! compile_object "-Werror"; then 5208fd0e6053SJohn Snow ccache_cpp2=yes 5209fd0e6053SJohn Snowfi 5210fd0e6053SJohn Snow 5211b553a042SJohn Snow################################################# 5212b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 5213b553a042SJohn Snow 5214b553a042SJohn Snowif test "$fortify_source" != "no"; then 5215b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5216b553a042SJohn Snow fortify_source="no"; 5217e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 5218cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5219b553a042SJohn Snow fortify_source="no"; 5220b553a042SJohn Snow else 5221b553a042SJohn Snow fortify_source="yes" 5222b553a042SJohn Snow fi 5223b553a042SJohn Snowfi 5224b553a042SJohn Snow 52251efad060SFam Zheng############################################### 52261efad060SFam Zheng# Check if copy_file_range is provided by glibc 52271efad060SFam Zhenghave_copy_file_range=no 52281efad060SFam Zhengcat > $TMPC << EOF 52291efad060SFam Zheng#include <unistd.h> 52301efad060SFam Zhengint main(void) { 52311efad060SFam Zheng copy_file_range(0, NULL, 0, NULL, 0, 0); 52321efad060SFam Zheng return 0; 52331efad060SFam Zheng} 52341efad060SFam ZhengEOF 52351efad060SFam Zhengif compile_prog "" "" ; then 52361efad060SFam Zheng have_copy_file_range=yes 52371efad060SFam Zhengfi 52381efad060SFam Zheng 5239d2042378SAneesh Kumar K.V########################################## 5240277abf15SJan Vesely# check if struct fsxattr is available via linux/fs.h 5241277abf15SJan Vesely 5242277abf15SJan Veselyhave_fsxattr=no 5243277abf15SJan Veselycat > $TMPC << EOF 5244277abf15SJan Vesely#include <linux/fs.h> 5245277abf15SJan Veselystruct fsxattr foo; 5246277abf15SJan Veselyint main(void) { 5247277abf15SJan Vesely return 0; 5248277abf15SJan Vesely} 5249277abf15SJan VeselyEOF 5250277abf15SJan Veselyif compile_prog "" "" ; then 5251277abf15SJan Vesely have_fsxattr=yes 5252277abf15SJan Veselyfi 5253277abf15SJan Vesely 5254b66e10e4SPeter Maydell########################################## 5255a40161cbSPaolo Bonzini# check for usable membarrier system call 5256a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 5257a40161cbSPaolo Bonzini have_membarrier=no 5258a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 5259a40161cbSPaolo Bonzini have_membarrier=yes 5260a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 5261a40161cbSPaolo Bonzini cat > $TMPC << EOF 5262a40161cbSPaolo Bonzini #include <linux/membarrier.h> 5263a40161cbSPaolo Bonzini #include <sys/syscall.h> 5264a40161cbSPaolo Bonzini #include <unistd.h> 5265a40161cbSPaolo Bonzini #include <stdlib.h> 5266a40161cbSPaolo Bonzini int main(void) { 5267a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5268a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5269a40161cbSPaolo Bonzini exit(0); 5270a40161cbSPaolo Bonzini } 5271a40161cbSPaolo BonziniEOF 5272a40161cbSPaolo Bonzini if compile_prog "" "" ; then 5273a40161cbSPaolo Bonzini have_membarrier=yes 5274a40161cbSPaolo Bonzini fi 5275a40161cbSPaolo Bonzini fi 5276a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 5277a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 5278a40161cbSPaolo Bonzini fi 5279a40161cbSPaolo Bonzinielse 5280a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 5281a40161cbSPaolo Bonzini # work on Wine. 5282a40161cbSPaolo Bonzini membarrier=no 5283a40161cbSPaolo Bonzinifi 5284a40161cbSPaolo Bonzini 5285a40161cbSPaolo Bonzini########################################## 5286b66e10e4SPeter Maydell# check if rtnetlink.h exists and is useful 5287575b22b1SLaurent Vivierhave_rtnetlink=no 5288575b22b1SLaurent Viviercat > $TMPC << EOF 5289575b22b1SLaurent Vivier#include <linux/rtnetlink.h> 5290575b22b1SLaurent Vivierint main(void) { 5291575b22b1SLaurent Vivier return IFLA_PROTO_DOWN; 5292575b22b1SLaurent Vivier} 5293575b22b1SLaurent VivierEOF 5294575b22b1SLaurent Vivierif compile_prog "" "" ; then 5295575b22b1SLaurent Vivier have_rtnetlink=yes 5296575b22b1SLaurent Vivierfi 5297575b22b1SLaurent Vivier 52986a02c806SStefan Hajnoczi########################################## 52996a02c806SStefan Hajnoczi# check for usable AF_VSOCK environment 53006a02c806SStefan Hajnoczihave_af_vsock=no 53016a02c806SStefan Hajnoczicat > $TMPC << EOF 53026a02c806SStefan Hajnoczi#include <errno.h> 53036a02c806SStefan Hajnoczi#include <sys/types.h> 53046a02c806SStefan Hajnoczi#include <sys/socket.h> 53056a02c806SStefan Hajnoczi#if !defined(AF_VSOCK) 53066a02c806SStefan Hajnoczi# error missing AF_VSOCK flag 53076a02c806SStefan Hajnoczi#endif 53086a02c806SStefan Hajnoczi#include <linux/vm_sockets.h> 53096a02c806SStefan Hajnocziint main(void) { 53106a02c806SStefan Hajnoczi int sock, ret; 53116a02c806SStefan Hajnoczi struct sockaddr_vm svm; 53126a02c806SStefan Hajnoczi socklen_t len = sizeof(svm); 53136a02c806SStefan Hajnoczi sock = socket(AF_VSOCK, SOCK_STREAM, 0); 53146a02c806SStefan Hajnoczi ret = getpeername(sock, (struct sockaddr *)&svm, &len); 53156a02c806SStefan Hajnoczi if ((ret == -1) && (errno == ENOTCONN)) { 53166a02c806SStefan Hajnoczi return 0; 53176a02c806SStefan Hajnoczi } 53186a02c806SStefan Hajnoczi return -1; 53196a02c806SStefan Hajnoczi} 53206a02c806SStefan HajnocziEOF 53216a02c806SStefan Hajnocziif compile_prog "" "" ; then 53226a02c806SStefan Hajnoczi have_af_vsock=yes 53236a02c806SStefan Hajnoczifi 53246a02c806SStefan Hajnoczi 5325f0d92b56SLongpeng(Mike)########################################## 5326f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 5327f0d92b56SLongpeng(Mike)hava_afalg=no 5328f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 5329f0d92b56SLongpeng(Mike)#include <errno.h> 5330f0d92b56SLongpeng(Mike)#include <sys/types.h> 5331f0d92b56SLongpeng(Mike)#include <sys/socket.h> 5332f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 5333f0d92b56SLongpeng(Mike)int main(void) { 5334f0d92b56SLongpeng(Mike) int sock; 5335f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 5336f0d92b56SLongpeng(Mike) return sock; 5337f0d92b56SLongpeng(Mike)} 5338f0d92b56SLongpeng(Mike)EOF 5339f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 5340f0d92b56SLongpeng(Mike) have_afalg=yes 5341f0d92b56SLongpeng(Mike)fi 5342f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 5343f0d92b56SLongpeng(Mike)then 5344f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 5345f0d92b56SLongpeng(Mike) then 5346f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 5347f0d92b56SLongpeng(Mike) fi 5348f0d92b56SLongpeng(Mike)fi 5349f0d92b56SLongpeng(Mike) 5350f0d92b56SLongpeng(Mike) 53516969ec6cSJames Clarke################################################# 5352c97d6d2cSSergio Andres Gomez Del Real# Check to see if we have the Hypervisor framework 5353d2d08522SPeter Maydellif [ "$darwin" = "yes" ] ; then 5354c97d6d2cSSergio Andres Gomez Del Real cat > $TMPC << EOF 5355c97d6d2cSSergio Andres Gomez Del Real#include <Hypervisor/hv.h> 5356c97d6d2cSSergio Andres Gomez Del Realint main() { return 0;} 5357c97d6d2cSSergio Andres Gomez Del RealEOF 5358c97d6d2cSSergio Andres Gomez Del Real if ! compile_object ""; then 5359c97d6d2cSSergio Andres Gomez Del Real hvf='no' 5360c97d6d2cSSergio Andres Gomez Del Real else 5361c97d6d2cSSergio Andres Gomez Del Real hvf='yes' 5362c97d6d2cSSergio Andres Gomez Del Real LDFLAGS="-framework Hypervisor $LDFLAGS" 5363c97d6d2cSSergio Andres Gomez Del Real fi 5364c97d6d2cSSergio Andres Gomez Del Realfi 5365c97d6d2cSSergio Andres Gomez Del Real 5366c97d6d2cSSergio Andres Gomez Del Real################################################# 53676969ec6cSJames Clarke# Sparc implicitly links with --relax, which is 53686969ec6cSJames Clarke# incompatible with -r, so --no-relax should be 53696969ec6cSJames Clarke# given. It does no harm to give it on other 53706969ec6cSJames Clarke# platforms too. 53716969ec6cSJames Clarke 53726969ec6cSJames Clarke# Note: the prototype is needed since QEMU_CFLAGS 53736969ec6cSJames Clarke# contains -Wmissing-prototypes 53746969ec6cSJames Clarkecat > $TMPC << EOF 53756969ec6cSJames Clarkeextern int foo(void); 53766969ec6cSJames Clarkeint foo(void) { return 0; } 53776969ec6cSJames ClarkeEOF 53786969ec6cSJames Clarkeif ! compile_object ""; then 53796969ec6cSJames Clarke error_exit "Failed to compile object file for LD_REL_FLAGS test" 53806969ec6cSJames Clarkefi 53817ecf44a5SPaolo Bonzinifor i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do 53827ecf44a5SPaolo Bonzini if do_cc -nostdlib $i -o $TMPMO $TMPO; then 53837ecf44a5SPaolo Bonzini LD_REL_FLAGS=$i 53847ecf44a5SPaolo Bonzini break 53857ecf44a5SPaolo Bonzini fi 53867ecf44a5SPaolo Bonzinidone 53877ecf44a5SPaolo Bonziniif test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then 53887ecf44a5SPaolo Bonzini feature_not_found "modules" "Cannot find how to build relocatable objects" 53896969ec6cSJames Clarkefi 53906969ec6cSJames Clarke 5391277abf15SJan Vesely########################################## 53924d04351fSChristopher Covington# check for sysmacros.h 53934d04351fSChristopher Covington 53944d04351fSChristopher Covingtonhave_sysmacros=no 53954d04351fSChristopher Covingtoncat > $TMPC << EOF 53964d04351fSChristopher Covington#include <sys/sysmacros.h> 53974d04351fSChristopher Covingtonint main(void) { 53984d04351fSChristopher Covington return makedev(0, 0); 53994d04351fSChristopher Covington} 54004d04351fSChristopher CovingtonEOF 54014d04351fSChristopher Covingtonif compile_prog "" "" ; then 54024d04351fSChristopher Covington have_sysmacros=yes 54034d04351fSChristopher Covingtonfi 54044d04351fSChristopher Covington 54054d04351fSChristopher Covington########################################## 5406da92c3ffSAshish Mittal# Veritas HyperScale block driver VxHS 5407da92c3ffSAshish Mittal# Check if libvxhs is installed 5408da92c3ffSAshish Mittal 5409da92c3ffSAshish Mittalif test "$vxhs" != "no" ; then 5410da92c3ffSAshish Mittal cat > $TMPC <<EOF 5411da92c3ffSAshish Mittal#include <stdint.h> 5412da92c3ffSAshish Mittal#include <qnio/qnio_api.h> 5413da92c3ffSAshish Mittal 5414da92c3ffSAshish Mittalvoid *vxhs_callback; 5415da92c3ffSAshish Mittal 5416da92c3ffSAshish Mittalint main(void) { 5417da92c3ffSAshish Mittal iio_init(QNIO_VERSION, vxhs_callback); 5418da92c3ffSAshish Mittal return 0; 5419da92c3ffSAshish Mittal} 5420da92c3ffSAshish MittalEOF 5421da92c3ffSAshish Mittal vxhs_libs="-lvxhs -lssl" 5422da92c3ffSAshish Mittal if compile_prog "" "$vxhs_libs" ; then 5423da92c3ffSAshish Mittal vxhs=yes 5424da92c3ffSAshish Mittal else 5425da92c3ffSAshish Mittal if test "$vxhs" = "yes" ; then 5426da92c3ffSAshish Mittal feature_not_found "vxhs block device" "Install libvxhs See github" 5427da92c3ffSAshish Mittal fi 5428da92c3ffSAshish Mittal vxhs=no 5429da92c3ffSAshish Mittal fi 5430da92c3ffSAshish Mittalfi 5431da92c3ffSAshish Mittal 5432da92c3ffSAshish Mittal########################################## 543349e00a18SAndreas Grapentin# check for _Static_assert() 543449e00a18SAndreas Grapentin 543549e00a18SAndreas Grapentinhave_static_assert=no 543649e00a18SAndreas Grapentincat > $TMPC << EOF 543749e00a18SAndreas Grapentin_Static_assert(1, "success"); 543849e00a18SAndreas Grapentinint main(void) { 543949e00a18SAndreas Grapentin return 0; 544049e00a18SAndreas Grapentin} 544149e00a18SAndreas GrapentinEOF 544249e00a18SAndreas Grapentinif compile_prog "" "" ; then 544349e00a18SAndreas Grapentin have_static_assert=yes 544449e00a18SAndreas Grapentinfi 544549e00a18SAndreas Grapentin 544649e00a18SAndreas Grapentin########################################## 5447e674605fSTomáš Golembiovský# check for utmpx.h, it is missing e.g. on OpenBSD 5448e674605fSTomáš Golembiovský 5449e674605fSTomáš Golembiovskýhave_utmpx=no 5450e674605fSTomáš Golembiovskýcat > $TMPC << EOF 5451e674605fSTomáš Golembiovský#include <utmpx.h> 5452e674605fSTomáš Golembiovskýstruct utmpx user_info; 5453e674605fSTomáš Golembiovskýint main(void) { 5454e674605fSTomáš Golembiovský return 0; 5455e674605fSTomáš Golembiovský} 5456e674605fSTomáš GolembiovskýEOF 5457e674605fSTomáš Golembiovskýif compile_prog "" "" ; then 5458e674605fSTomáš Golembiovský have_utmpx=yes 5459e674605fSTomáš Golembiovskýfi 5460e674605fSTomáš Golembiovský 5461e674605fSTomáš Golembiovský########################################## 5462247724cbSMarc-André Lureau# checks for sanitizers 5463247724cbSMarc-André Lureau 5464247724cbSMarc-André Lureauhave_asan=no 5465247724cbSMarc-André Lureauhave_ubsan=no 5466d83414e1SMarc-André Lureauhave_asan_iface_h=no 5467d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 5468247724cbSMarc-André Lureau 5469247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 5470b9f44da2SMarc-André Lureau write_c_skeleton 5471247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 5472247724cbSMarc-André Lureau have_asan=yes 5473247724cbSMarc-André Lureau fi 5474b9f44da2SMarc-André Lureau 5475b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 5476b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 5477b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 5478b9f44da2SMarc-André Lureau cat > $TMPC << EOF 5479b9f44da2SMarc-André Lureau#include <stdlib.h> 5480b9f44da2SMarc-André Lureauint main(void) { 5481b9f44da2SMarc-André Lureau void *tmp = malloc(10); 5482b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 5483b9f44da2SMarc-André Lureau} 5484b9f44da2SMarc-André LureauEOF 5485247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 5486247724cbSMarc-André Lureau have_ubsan=yes 5487247724cbSMarc-André Lureau fi 5488d83414e1SMarc-André Lureau 5489d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 5490d83414e1SMarc-André Lureau have_asan_iface_h=yes 5491d83414e1SMarc-André Lureau fi 5492d83414e1SMarc-André Lureau 5493d83414e1SMarc-André Lureau cat > $TMPC << EOF 5494d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 5495d83414e1SMarc-André Lureauint main(void) { 5496d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 5497d83414e1SMarc-André Lureau return 0; 5498d83414e1SMarc-André Lureau} 5499d83414e1SMarc-André LureauEOF 5500d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 5501d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 5502d83414e1SMarc-André Lureau fi 5503247724cbSMarc-André Lureaufi 5504247724cbSMarc-André Lureau 5505247724cbSMarc-André Lureau########################################## 550651a12b51SAlex Bennée# Docker and cross-compiler support 550751a12b51SAlex Bennée# 550851a12b51SAlex Bennée# This is specifically for building test 550951a12b51SAlex Bennée# cases for foreign architectures, not 551051a12b51SAlex Bennée# cross-compiling QEMU itself. 551151a12b51SAlex Bennée 551251a12b51SAlex Bennéeif has "docker"; then 551351a12b51SAlex Bennée docker=$($python $source_path/tests/docker/docker.py probe) 551451a12b51SAlex Bennéefi 551551a12b51SAlex Bennée 551651a12b51SAlex Bennée########################################## 551717824406SJunyan He# check for libpmem 551817824406SJunyan He 551917824406SJunyan Heif test "$libpmem" != "no"; then 552017824406SJunyan He if $pkg_config --exists "libpmem"; then 552117824406SJunyan He libpmem="yes" 552217824406SJunyan He libpmem_libs=$($pkg_config --libs libpmem) 552317824406SJunyan He libpmem_cflags=$($pkg_config --cflags libpmem) 552417824406SJunyan He libs_softmmu="$libs_softmmu $libpmem_libs" 552517824406SJunyan He QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" 552617824406SJunyan He else 552717824406SJunyan He if test "$libpmem" = "yes" ; then 552817824406SJunyan He feature_not_found "libpmem" "Install nvml or pmdk" 552917824406SJunyan He fi 553017824406SJunyan He libpmem="no" 553117824406SJunyan He fi 553217824406SJunyan Hefi 553317824406SJunyan He 553417824406SJunyan He########################################## 5535e86ecd4bSJuan Quintela# End of CC checks 5536e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 5537e86ecd4bSJuan Quintela 5538d83414e1SMarc-André Lureauwrite_c_skeleton 5539d83414e1SMarc-André Lureau 55401d728c39SBlue Swirlif test "$gcov" = "yes" ; then 55411d728c39SBlue Swirl CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" 55421d728c39SBlue Swirl LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" 5543b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 5544e600cdf3SMichal Privoznik CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" 554548e56d50SPaolo Bonzinielif test "$debug" = "no"; then 5546ce278618SPeter Maydell CFLAGS="-O2 $CFLAGS" 5547e86ecd4bSJuan Quintelafi 5548a316e378SJuan Quintela 5549247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 5550247724cbSMarc-André Lureau CFLAGS="-fsanitize=address $CFLAGS" 5551d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 5552d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 5553d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5554d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 5555d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 5556d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5557d83414e1SMarc-André Lureau fi 5558247724cbSMarc-André Lureaufi 5559247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 5560247724cbSMarc-André Lureau CFLAGS="-fsanitize=undefined $CFLAGS" 5561247724cbSMarc-André Lureaufi 5562247724cbSMarc-André Lureau 55636542aa9cSPeter Lieven########################################## 55646542aa9cSPeter Lieven# Do we have libnfs 55656542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 5566b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 55676542aa9cSPeter Lieven libnfs="yes" 55686542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 55696542aa9cSPeter Lieven else 55706542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 55718efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 55726542aa9cSPeter Lieven fi 55736542aa9cSPeter Lieven libnfs="no" 55746542aa9cSPeter Lieven fi 55756542aa9cSPeter Lievenfi 55761d728c39SBlue Swirl 55776ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 55786ca026cbSPeter Maydellif test "$werror" = "yes"; then 55796ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 55806ca026cbSPeter Maydellfi 55816ca026cbSPeter Maydell 5582e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 5583e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 55841156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 5585e86ecd4bSJuan Quintela fi 5586e86ecd4bSJuan Quintelafi 5587e86ecd4bSJuan Quintela 558894dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 558994dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 559094dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 559194dd53c5SGerd Hoffmannelse 559294dd53c5SGerd Hoffmann POD2MAN="pod2man" 559394dd53c5SGerd Hoffmannfi 559494dd53c5SGerd Hoffmann 5595952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 5596952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 5597952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 5598e9a3591fSChristian Borntraeger if ld_has $flag ; then 5599952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 5600952afb71SBlue Swirl fi 5601952afb71SBlue Swirl done 5602952afb71SBlue Swirlfi 5603952afb71SBlue Swirl 560410ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 5605e26110cfSFam Zhengqemu_moddir=$libdir$confsuffix 5606528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 5607834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 56085a67135aSbellard 5609e0580342SKamil Rytarowski# We can only support ivshmem if we have eventfd 5610e0580342SKamil Rytarowskiif [ "$eventfd" = "yes" ]; then 5611e0580342SKamil Rytarowski ivshmem=yes 5612e0580342SKamil Rytarowskifi 5613e0580342SKamil Rytarowski 56144b1c11fdSDaniel P. Berrangetools="" 56154b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 561672d277a7SGerd Hoffmann tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools" 56174b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 56184b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 5619b1449edbSKamil Rytarowski fi 5620b1449edbSKamil Rytarowski if [ "$ivshmem" = "yes" ]; then 5621a75eb03bSDavid Marchand tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" 56224b1c11fdSDaniel P. Berrange fi 56233fa2d384SViktor Prutyanov if [ "$posix" = "yes" ] && [ "$curl" = "yes" ]; then 56243fa2d384SViktor Prutyanov tools="elf2dmp $tools" 56253fa2d384SViktor Prutyanov fi 56264b1c11fdSDaniel P. Berrangefi 56274b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 5628b855f8d1SPaolo Bonzini if test "$linux" = yes; then 5629b855f8d1SPaolo Bonzini if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then 5630983eef5aSMeador Inge virtfs=yes 563117bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 5632983eef5aSMeador Inge else 5633983eef5aSMeador Inge if test "$virtfs" = yes; then 5634b855f8d1SPaolo Bonzini error_exit "VirtFS requires libcap devel and libattr devel" 5635983eef5aSMeador Inge fi 563617500370SAndreas Färber virtfs=no 5637983eef5aSMeador Inge fi 5638fe8fc5aeSPaolo Bonzini if test "$mpath" != no && test "$mpathpersist" = yes ; then 5639fe8fc5aeSPaolo Bonzini mpath=yes 5640fe8fc5aeSPaolo Bonzini else 5641fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 5642fe8fc5aeSPaolo Bonzini error_exit "Multipath requires libmpathpersist devel" 5643fe8fc5aeSPaolo Bonzini fi 5644fe8fc5aeSPaolo Bonzini mpath=no 5645fe8fc5aeSPaolo Bonzini fi 5646b855f8d1SPaolo Bonzini tools="$tools scsi/qemu-pr-helper\$(EXESUF)" 5647b855f8d1SPaolo Bonzini else 5648b855f8d1SPaolo Bonzini if test "$virtfs" = yes; then 5649b855f8d1SPaolo Bonzini error_exit "VirtFS is supported only on Linux" 5650b855f8d1SPaolo Bonzini fi 5651b855f8d1SPaolo Bonzini virtfs=no 5652fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 5653fe8fc5aeSPaolo Bonzini error_exit "Multipath is supported only on Linux" 5654fe8fc5aeSPaolo Bonzini fi 5655fe8fc5aeSPaolo Bonzini mpath=no 565617bff52bSM. Mohan Kumar fi 56576a021536SGerd Hoffmann if test "$xkbcommon" = "yes"; then 56586a021536SGerd Hoffmann tools="qemu-keymap\$(EXESUF) $tools" 56596a021536SGerd Hoffmann fi 5660ff69fd8cSLaurent Vivierfi 56619d6bc27bSMichael Roth 56629d6bc27bSMichael Roth# Probe for guest agent support/options 56639d6bc27bSMichael Roth 5664e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 5665b39297aeSTomoki Sekiyama if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 5666fafcaf1dSMichael Roth tools="qemu-ga $tools" 5667e8ef31a3SMichael Tokarev guest_agent=yes 5668e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 5669e8ef31a3SMichael Tokarev guest_agent=no 5670e8ef31a3SMichael Tokarev else 5671e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 5672ca35f780SPaolo Bonzini fi 56734b1c11fdSDaniel P. Berrangefi 5674ca35f780SPaolo Bonzini 56759d6bc27bSMichael Roth# Guest agent Window MSI package 56769d6bc27bSMichael Roth 56779d6bc27bSMichael Rothif test "$guest_agent" != yes; then 56789d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 56799d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 56809d6bc27bSMichael Roth fi 56819d6bc27bSMichael Roth guest_agent_msi=no 56829d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 56839d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 56849d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 56859d6bc27bSMichael Roth fi 56869d6bc27bSMichael Roth guest_agent_msi=no 56879d6bc27bSMichael Rothelif ! has wixl; then 56889d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 56899d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 56909d6bc27bSMichael Roth fi 56919d6bc27bSMichael Roth guest_agent_msi=no 56921a34904eSMichael Rothelse 56931a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 56941a34904eSMichael Roth # disabled explicitly 56951a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 56961a34904eSMichael Roth guest_agent_msi=yes 56971a34904eSMichael Roth fi 56989d6bc27bSMichael Rothfi 56999d6bc27bSMichael Roth 57001a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 57019d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 57029d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 57039d6bc27bSMichael Roth fi 57049d6bc27bSMichael Roth 57059d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 57069d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 57079d6bc27bSMichael Roth fi 57089d6bc27bSMichael Roth 57099d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 57109d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 57119d6bc27bSMichael Roth fi 57129d6bc27bSMichael Roth 57139d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 571489138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 57159d6bc27bSMichael Roth fi 57169d6bc27bSMichael Roth 571789138857SStefan Weil QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 57189d6bc27bSMichael Roth 57199d6bc27bSMichael Roth case "$cpu" in 57209d6bc27bSMichael Roth x86_64) 57219d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 57229d6bc27bSMichael Roth ;; 57239d6bc27bSMichael Roth i386) 57249d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 57259d6bc27bSMichael Roth ;; 57269d6bc27bSMichael Roth *) 57279d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 57289d6bc27bSMichael Roth ;; 57299d6bc27bSMichael Roth esac 57309d6bc27bSMichael Rothfi 57319d6bc27bSMichael Roth 5732ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 5733ca35f780SPaolo Bonziniroms= 5734ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 5735ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 5736ca35f780SPaolo Bonzini "$softmmu" = yes ; then 5737e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 5738c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 5739c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 5740c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 5741e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 5742e57218b6SPeter Maydell ld_i386_emulation="$emu" 5743ca35f780SPaolo Bonzini roms="optionrom" 5744e57218b6SPeter Maydell break 5745e57218b6SPeter Maydell fi 5746e57218b6SPeter Maydell done 5747ca35f780SPaolo Bonzinifi 5748d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 574939ac8455SDavid Gibson roms="$roms spapr-rtas" 575039ac8455SDavid Gibsonfi 5751ca35f780SPaolo Bonzini 57529933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 57539933c305SChristian Borntraeger roms="$roms s390-ccw" 57549933c305SChristian Borntraegerfi 57559933c305SChristian Borntraeger 5756964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary. 575792fe2ba8SPeter Maydellif ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then 5758964c6fa1SRichard Henderson textseg_addr= 5759964c6fa1SRichard Henderson case "$cpu" in 5760479eb121SRichard Henderson arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) 5761479eb121SRichard Henderson # ??? Rationale for choosing this address 5762964c6fa1SRichard Henderson textseg_addr=0x60000000 5763964c6fa1SRichard Henderson ;; 5764964c6fa1SRichard Henderson mips) 5765479eb121SRichard Henderson # A 256M aligned address, high in the address space, with enough 5766479eb121SRichard Henderson # room for the code_gen_buffer above it before the stack. 5767479eb121SRichard Henderson textseg_addr=0x60000000 5768964c6fa1SRichard Henderson ;; 5769964c6fa1SRichard Henderson esac 5770964c6fa1SRichard Henderson if [ -n "$textseg_addr" ]; then 5771964c6fa1SRichard Henderson cat > $TMPC <<EOF 5772964c6fa1SRichard Henderson int main(void) { return 0; } 5773964c6fa1SRichard HendersonEOF 5774964c6fa1SRichard Henderson textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" 5775964c6fa1SRichard Henderson if ! compile_prog "" "$textseg_ldflags"; then 5776964c6fa1SRichard Henderson # In case ld does not support -Ttext-segment, edit the default linker 5777964c6fa1SRichard Henderson # script via sed to set the .text start addr. This is needed on FreeBSD 5778964c6fa1SRichard Henderson # at least. 577992fe2ba8SPeter Maydell if ! $ld --verbose >/dev/null 2>&1; then 578092fe2ba8SPeter Maydell error_exit \ 578192fe2ba8SPeter Maydell "We need to link the QEMU user mode binaries at a" \ 578292fe2ba8SPeter Maydell "specific text address. Unfortunately your linker" \ 578392fe2ba8SPeter Maydell "doesn't support either the -Ttext-segment option or" \ 578492fe2ba8SPeter Maydell "printing the default linker script with --verbose." \ 578592fe2ba8SPeter Maydell "If you don't want the user mode binaries, pass the" \ 578692fe2ba8SPeter Maydell "--disable-user option to configure." 578792fe2ba8SPeter Maydell fi 578892fe2ba8SPeter Maydell 5789964c6fa1SRichard Henderson $ld --verbose | sed \ 5790964c6fa1SRichard Henderson -e '1,/==================================================/d' \ 5791964c6fa1SRichard Henderson -e '/==================================================/,$d' \ 5792964c6fa1SRichard Henderson -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ 5793964c6fa1SRichard Henderson -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld 5794964c6fa1SRichard Henderson textseg_ldflags="-Wl,-T../config-host.ld" 5795964c6fa1SRichard Henderson fi 5796964c6fa1SRichard Henderson fi 5797964c6fa1SRichard Hendersonfi 5798964c6fa1SRichard Henderson 579911cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 580011cde1c8SBruno 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. 580111cde1c8SBruno Dominguezif has $cxx; then 580211cde1c8SBruno Dominguez cat > $TMPC <<EOF 580311cde1c8SBruno Dominguezint c_function(void); 580411cde1c8SBruno Dominguezint main(void) { return c_function(); } 580511cde1c8SBruno DominguezEOF 580611cde1c8SBruno Dominguez 580711cde1c8SBruno Dominguez compile_object 580811cde1c8SBruno Dominguez 580911cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 581011cde1c8SBruno Dominguezextern "C" { 581111cde1c8SBruno Dominguez int c_function(void); 581211cde1c8SBruno Dominguez} 581311cde1c8SBruno Dominguezint c_function(void) { return 42; } 581411cde1c8SBruno DominguezEOF 581511cde1c8SBruno Dominguez 581611cde1c8SBruno Dominguez update_cxxflags 581711cde1c8SBruno Dominguez 581811cde1c8SBruno Dominguez if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then 581911cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 582011cde1c8SBruno Dominguez : 582111cde1c8SBruno Dominguez else 582211cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 582311cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 582411cde1c8SBruno Dominguez cxx= 582511cde1c8SBruno Dominguez fi 582611cde1c8SBruno Dominguezelse 582711cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 582811cde1c8SBruno Dominguez cxx= 582911cde1c8SBruno Dominguezfi 583011cde1c8SBruno Dominguez 583102d34f62SCole Robinsonecho_version() { 583202d34f62SCole Robinson if test "$1" = "yes" ; then 583302d34f62SCole Robinson echo "($2)" 583402d34f62SCole Robinson fi 583502d34f62SCole Robinson} 583602d34f62SCole Robinson 583750e12060SJan Kiszka# prepend pixman and ftd flags after all config tests are done 583850e12060SJan KiszkaQEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" 58398a99e9a3SPhilippe Mathieu-DaudéQEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" 584050e12060SJan Kiszkalibs_softmmu="$pixman_libs $libs_softmmu" 58415ca9388aSGerd Hoffmann 58427d13299dSbellardecho "Install prefix $prefix" 584389138857SStefan Weilecho "BIOS directory $(eval echo $qemu_datadir)" 58443d5eecabSGerd Hoffmannecho "firmware path $(eval echo $firmwarepath)" 584589138857SStefan Weilecho "binary directory $(eval echo $bindir)" 584689138857SStefan Weilecho "library directory $(eval echo $libdir)" 584789138857SStefan Weilecho "module directory $(eval echo $qemu_moddir)" 584889138857SStefan Weilecho "libexec directory $(eval echo $libexecdir)" 584989138857SStefan Weilecho "include directory $(eval echo $includedir)" 585089138857SStefan Weilecho "config directory $(eval echo $sysconfdir)" 585111d9f695Sbellardif test "$mingw32" = "no" ; then 585289138857SStefan Weilecho "local state directory $(eval echo $local_statedir)" 585389138857SStefan Weilecho "Manual directory $(eval echo $mandir)" 585443ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 58555a699bbbSLaszlo Ersekelse 58565a699bbbSLaszlo Ersekecho "local state directory queried at runtime" 5857d9840e25STomoki Sekiyamaecho "Windows SDK $win_sdk" 585811d9f695Sbellardfi 58595a67135aSbellardecho "Source path $source_path" 5860cc84d63aSDaniel P. Berrangeecho "GIT binary $git" 5861aef45d51SDaniel P. Berrangeecho "GIT submodules $git_submodules" 58627d13299dSbellardecho "C compiler $cc" 586383469015Sbellardecho "Host C compiler $host_cc" 586483f73fceSTomoki Sekiyamaecho "C++ compiler $cxx" 58653c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 586645d285abSPeter Maydellecho "ARFLAGS $ARFLAGS" 58670c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 5868a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 58690c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 58708a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS $QEMU_LDFLAGS" 58717d13299dSbellardecho "make $make" 58726a882643Spbrookecho "install $install" 5873c886edfbSBlue Swirlecho "python $python" 5874e2d8830eSBradif test "$slirp" = "yes" ; then 5875e2d8830eSBrad echo "smbd $smbd" 5876e2d8830eSBradfi 587717969268SFam Zhengecho "module support $modules" 5878a98fd896Sbellardecho "host CPU $cpu" 5879de83cd02Sbellardecho "host big endian $bigendian" 588097a847bcSbellardecho "target list $target_list" 58817d13299dSbellardecho "gprof enabled $gprof" 588203b4fe7dSaliguoriecho "sparse enabled $sparse" 58831625af87Saliguoriecho "strip binaries $strip_opt" 588405c2a3e7Sbellardecho "profiler $profiler" 588543ce4dfeSbellardecho "static build $static" 58865b0753e0Sbellardif test "$darwin" = "yes" ; then 58875b0753e0Sbellard echo "Cocoa support $cocoa" 58885b0753e0Sbellardfi 588989138857SStefan Weilecho "SDL support $sdl $(echo_version $sdl $sdlversion)" 589089138857SStefan Weilecho "GTK support $gtk $(echo_version $gtk $gtk_version)" 5891925a0400SGerd Hoffmannecho "GTK GL support $gtk_gl" 589289138857SStefan Weilecho "VTE support $vte $(echo_version $vte $vteversion)" 5893a1c5e949SDaniel P. Berrangeecho "TLS priority $tls_priority" 5894ddbb0d09SDaniel P. Berrangeecho "GNUTLS support $gnutls" 589591bfcdb0SDaniel P. Berrangeecho "libgcrypt $gcrypt" 589689138857SStefan Weilecho "nettle $nettle $(echo_version $nettle $nettle_version)" 58979a2fd434SDaniel P. Berrangeecho "libtasn1 $tasn1" 58984d3b6f6eSbalrogecho "curses support $curses" 589947479c55SMarc-André Lureauecho "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)" 5900769ce76dSAlexander Grafecho "curl support $curl" 590167b915a5Sbellardecho "mingw32 support $mingw32" 59020c58ac1cSmalcecho "Audio drivers $audio_drv_list" 5903b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist" 5904b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist" 5905983eef5aSMeador Ingeecho "VirtFS support $virtfs" 5906fe8fc5aeSPaolo Bonziniecho "Multipath support $mpath" 5907821601eaSJes Sorensenecho "VNC support $vnc" 5908821601eaSJes Sorensenif test "$vnc" = "yes" ; then 59092f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 59102f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 5911efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 5912821601eaSJes Sorensenfi 59133142255cSblueswir1if test -n "$sparc_cpu"; then 59143142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 59153142255cSblueswir1fi 5916e37630caSaliguoriecho "xen support $xen" 59173996e85cSPaul Durrantif test "$xen" = "yes" ; then 59183996e85cSPaul Durrant echo "xen ctrl version $xen_ctrl_version" 591964a7ad6fSIan Campbell echo "pv dom build $xen_pv_domain_build" 59203996e85cSPaul Durrantfi 59212e4d9fb1Saurel32echo "brlapi support $brlapi" 5922a20a6f46SJuan Quintelaecho "bluez support $bluez" 5923a25dba17SJuan Quintelaecho "Documentation $docs" 592440d6444eSAvi Kivityecho "PIE $pie" 59258a16d273Sthsecho "vde support $vde" 592658952137SVincenzo Maffioneecho "netmap support $netmap" 59275c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 5928758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 592977755340Sthsecho "Install blobs $blobs" 5930b31a0277SJuan Quintelaecho "KVM support $kvm" 5931b0cb0a66SVincent Palatinecho "HAX support $hax" 5932c97d6d2cSSergio Andres Gomez Del Realecho "HVF support $hvf" 5933d661d9a4SJustin Terry (VM)echo "WHPX support $whpx" 5934b3f6ea7eSPaolo Bonziniecho "TCG support $tcg" 5935b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes" ; then 5936b3f6ea7eSPaolo Bonzini echo "TCG debug enabled $debug_tcg" 59379195b2c2SStefan Weil echo "TCG interpreter $tcg_interpreter" 5938b3f6ea7eSPaolo Bonzinifi 59395a22ab71SYang Zhongecho "malloc trim support $malloc_trim" 5940b3f6ea7eSPaolo Bonziniecho "RDMA support $rdma" 594121ab34c9SMarcel Apfelbaumecho "PVRDMA support $pvrdma" 5942f652e6afSaurel32echo "fdt support $fdt" 5943a40161cbSPaolo Bonziniecho "membarrier $membarrier" 5944ceb42de8Saliguoriecho "preadv support $preadv" 59455f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 5946e78815a5SAndreas Färberecho "madvise $madvise" 5947e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 59489bc5a719SAndreas Gustafssonecho "posix_memalign $posix_memalign" 594947e98658SCorey Bryantecho "libcap-ng support $cap_ng" 5950d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 5951042cea27SGongleiecho "vhost-crypto support $vhost_crypto" 59525e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi" 5953fc0b9b0eSStefan Hajnocziecho "vhost-vsock support $vhost_vsock" 5954e6a74868SMarc-André Lureauecho "vhost-user support $vhost_user" 59555b808275SLluís Vilanovaecho "Trace backends $trace_backends" 5956713572a7SMarc-André Lureauif have_backend "simple"; then 59579410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 5958e00e36fbSStefan Weilfi 595989138857SStefan Weilecho "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" 5960f27aaf4bSChristian Brunnerecho "rbd support $rbd" 5961dce512deSChristoph Hellwigecho "xfsctl support $xfs" 59627b02f544SMarc-André Lureauecho "smartcard support $smartcard" 59632b2325ffSGerd Hoffmannecho "libusb $libusb" 596469354a83SHans de Goedeecho "usb net redir $usb_redir" 5965da076ffeSGerd Hoffmannecho "OpenGL support $opengl" 5966014cb152SGerd Hoffmannecho "OpenGL dmabufs $opengl_dmabuf" 5967c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 59686542aa9cSPeter Lievenecho "libnfs support $libnfs" 5969d138cee9SMichael Rothecho "build guest agent $guest_agent" 5970d9840e25STomoki Sekiyamaecho "QGA VSS support $guest_agent_with_vss" 597150cbebb9SMichael Rothecho "QGA w32 disk info $guest_agent_ntddscsi" 59724c875d89SMichael Rothecho "QGA MSI support $guest_agent_msi" 5973f794573eSEduardo Otuboecho "seccomp support $seccomp" 59747c2acc70SPeter Maydellecho "coroutine backend $coroutine" 597570c60c08SStefan Hajnocziecho "coroutine pool $coroutine_pool" 59767d992e4dSPeter Lievenecho "debug stack usage $debug_stack_usage" 5977ba59fb77SPaolo Bonziniecho "mutex debugging $debug_mutex" 5978f0d92b56SLongpeng(Mike)echo "crypto afalg $crypto_afalg" 5979eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 59801d728c39SBlue Swirlecho "gcov $gcov_tool" 59811d728c39SBlue Swirlecho "gcov enabled $gcov" 5982ab214c29SStefan Bergerecho "TPM support $tpm" 59830a12ec87SRichard W.M. Jonesecho "libssh2 support $libssh2" 59843b8acc11SPaolo Bonziniecho "TPM passthrough $tpm_passthrough" 5985f4ede81eSAmarnath Valluriecho "TPM emulator $tpm_emulator" 59863556c233SPaolo Bonziniecho "QOM debugging $qom_cast_debug" 5987ed1701c6SDr. David Alan Gilbertecho "Live block migration $live_block_migration" 5988607dacd0Sqiaonuohanecho "lzo support $lzo" 5989607dacd0Sqiaonuohanecho "snappy support $snappy" 59906b383c08SPeter Wuecho "bzip2 support $bzip2" 5991a99d57bbSWanlong Gaoecho "NUMA host support $numa" 5992ed279a06SKlim Kireevecho "libxml2 $libxml2" 59932847b469SFam Zhengecho "tcmalloc support $tcmalloc" 59947b01cb97SAlexandre Derumierecho "jemalloc support $jemalloc" 599599f2dbd3SLiang Liecho "avx2 optimization $avx2_opt" 5996a6b1d4c0SChanglong Xieecho "replication support $replication" 5997da92c3ffSAshish Mittalecho "VxHS block device $vxhs" 59988ca80760SRichard Hendersonecho "capstone $capstone" 599951a12b51SAlex Bennéeecho "docker $docker" 600017824406SJunyan Heecho "libpmem support $libpmem" 600167b915a5Sbellard 60021ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 600324b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 6004e8cd23deSbellardfi 600597a847bcSbellard 6006e52c6ba3SDaniel P. Berrangeif test "$sdlabi" = "1.2"; then 6007e52c6ba3SDaniel P. Berrange echo 6008e52c6ba3SDaniel P. Berrange echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in" 6009e52c6ba3SDaniel P. Berrange echo "WARNING: future releases. Please switch to using SDL 2.0" 6010e52c6ba3SDaniel P. Berrangefi 6011e52c6ba3SDaniel P. Berrange 6012898be3e0SPeter Maydellif test "$supported_cpu" = "no"; then 6013898be3e0SPeter Maydell echo 6014898be3e0SPeter Maydell echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!" 6015898be3e0SPeter Maydell echo 6016898be3e0SPeter Maydell echo "CPU host architecture $cpu support is not currently maintained." 6017898be3e0SPeter Maydell echo "The QEMU project intends to remove support for this host CPU in" 6018898be3e0SPeter Maydell echo "a future release if nobody volunteers to maintain it and to" 6019898be3e0SPeter Maydell echo "provide a build host for our continuous integration setup." 6020898be3e0SPeter Maydell echo "configure has succeeded and you can continue to build, but" 6021898be3e0SPeter Maydell echo "if you care about QEMU on this platform you should contact" 6022898be3e0SPeter Maydell echo "us upstream at qemu-devel@nongnu.org." 6023898be3e0SPeter Maydellfi 6024898be3e0SPeter Maydell 6025898be3e0SPeter Maydellif test "$supported_os" = "no"; then 6026898be3e0SPeter Maydell echo 6027898be3e0SPeter Maydell echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!" 6028898be3e0SPeter Maydell echo 6029c50126aaSPeter Maydell echo "Host OS $targetos support is not currently maintained." 6030c50126aaSPeter Maydell echo "The QEMU project intends to remove support for this host OS in" 6031898be3e0SPeter Maydell echo "a future release if nobody volunteers to maintain it and to" 6032898be3e0SPeter Maydell echo "provide a build host for our continuous integration setup." 6033898be3e0SPeter Maydell echo "configure has succeeded and you can continue to build, but" 6034898be3e0SPeter Maydell echo "if you care about QEMU on this platform you should contact" 6035898be3e0SPeter Maydell echo "us upstream at qemu-devel@nongnu.org." 6036898be3e0SPeter Maydellfi 6037898be3e0SPeter Maydell 603898ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 603997a847bcSbellard 6040dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 6041dbd99ae3SStefan Weil 604298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 604398ec69acSJuan Quintelaecho >> $config_host_mak 604498ec69acSJuan Quintela 6045e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 604699d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 604799d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 60483aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 60498bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 60500f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 605199d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 605299d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 605322d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 60549afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 60553d5eecabSGerd Hoffmannecho "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 60569afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 6057e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 60585a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 6059785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 60605a699bbbSLaszlo Ersekfi 6061f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 6062834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 6063f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 6064cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 6065aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6066f62bbee5SDaniel P. Berrangeecho "GIT_UPDATE=$git_update" >> $config_host_mak 6067804edf29SJuan Quintela 606898ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 6069727e5283SPaolo Bonzini 6070f8393946Saurel32if test "$debug_tcg" = "yes" ; then 60712358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6072f8393946Saurel32fi 60731625af87Saliguoriif test "$strip_opt" = "yes" ; then 607452ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 60751625af87Saliguorifi 60767d13299dSbellardif test "$bigendian" = "yes" ; then 6077e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 607897a847bcSbellardfi 607967b915a5Sbellardif test "$mingw32" = "yes" ; then 608098ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 608189138857SStefan Weil rc_version=$(cat $source_path/VERSION) 60829fe6de94SBlue Swirl version_major=${rc_version%%.*} 60839fe6de94SBlue Swirl rc_version=${rc_version#*.} 60849fe6de94SBlue Swirl version_minor=${rc_version%%.*} 60859fe6de94SBlue Swirl rc_version=${rc_version#*.} 60869fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 60879fe6de94SBlue Swirl version_micro=0 60889fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 60899fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6090d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 6091d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6092f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6093d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6094d9840e25STomoki Sekiyama fi 609550cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 609650cbebb9SMichael Roth echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak 609750cbebb9SMichael Roth fi 60981a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 60999dacf32dSYossi Hindin echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 61009dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 61019dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 61029dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 61039dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 61049dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 61059dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 61069dacf32dSYossi Hindin fi 6107210fa556Spbrookelse 610835f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 6109210fa556Spbrookfi 6110128ab2ffSblueswir1 6111dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 6112dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 6113dffcb71cSMark McLoughlinfi 6114dffcb71cSMark McLoughlin 611583fb7adfSbellardif test "$darwin" = "yes" ; then 611698ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 611783fb7adfSbellardfi 6118b29fe3edSmalc 6119ec530c81Sbellardif test "$solaris" = "yes" ; then 612098ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 6121ec530c81Sbellardfi 6122179cf400SAndreas Färberif test "$haiku" = "yes" ; then 6123179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 6124179cf400SAndreas Färberfi 612597a847bcSbellardif test "$static" = "yes" ; then 612698ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 612797a847bcSbellardfi 61281ba16968SStefan Weilif test "$profiler" = "yes" ; then 61292358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 613005c2a3e7Sbellardfi 6131c20709aaSbellardif test "$slirp" = "yes" ; then 613298ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 6133e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 6134c20709aaSbellardfi 61358a16d273Sthsif test "$vde" = "yes" ; then 613698ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 6137e2ad6f16SFam Zheng echo "VDE_LIBS=$vde_libs" >> $config_host_mak 61388a16d273Sthsfi 613958952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 614058952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 614158952137SVincenzo Maffionefi 6142015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 6143015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 6144015a33bdSGongleifi 614547e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 614647e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 614747e98658SCorey Bryantfi 61482358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 61490c58ac1cSmalcfor drv in $audio_drv_list; do 61501ef1ec2aSGerd Hoffmann def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 6151ce3dc033SGerd Hoffmann case "$drv" in 6152051c7d5cSGerd Hoffmann alsa | oss | pa | sdl) 6153ce3dc033SGerd Hoffmann echo "$def=m" >> $config_host_mak ;; 6154ce3dc033SGerd Hoffmann *) 6155ce3dc033SGerd Hoffmann echo "$def=y" >> $config_host_mak ;; 6156ce3dc033SGerd Hoffmann esac 61570c58ac1cSmalcdone 6158b1149911SFam Zhengecho "ALSA_LIBS=$alsa_libs" >> $config_host_mak 6159b1149911SFam Zhengecho "PULSE_LIBS=$pulse_libs" >> $config_host_mak 6160b1149911SFam Zhengecho "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 6161b1149911SFam Zhengecho "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 6162b1149911SFam Zhengecho "OSS_LIBS=$oss_libs" >> $config_host_mak 616367f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 616467f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 616567f86e8eSJuan Quintelafi 6166d5631638Smalcif test "$audio_win_int" = "yes" ; then 6167d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 6168d5631638Smalcfi 6169b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 6170b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 6171821601eaSJes Sorensenif test "$vnc" = "yes" ; then 6172821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 6173821601eaSJes Sorensenfi 61742f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 617598ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 61762f9606b3Saliguorifi 6177821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 61782f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 61792f6f5c7aSCorentin Charyfi 6180821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 6181efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 6182efe556adSCorentin Charyfi 61836a021536SGerd Hoffmannif test "$xkbcommon" = "yes" ; then 61846a021536SGerd Hoffmann echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak 61856a021536SGerd Hoffmann echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak 61866a021536SGerd Hoffmannfi 618776655d6dSaliguoriif test "$fnmatch" = "yes" ; then 61882358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 618976655d6dSaliguorifi 6190dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 6191dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 6192dce512deSChristoph Hellwigfi 619389138857SStefan Weilqemu_version=$(head $source_path/VERSION) 619498ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 61952358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 619698ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 61972b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 6198a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 619998ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 6200cc8ae6deSpbrookfi 620117969268SFam Zhengif test "$modules" = "yes"; then 6202e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 6203e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 620489138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 620517969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 620617969268SFam Zhengfi 62078781595bSGerd Hoffmannif test "$have_x11" = "yes" -a "$need_x11" = "yes"; then 62088781595bSGerd Hoffmann echo "CONFIG_X11=y" >> $config_host_mak 62098781595bSGerd Hoffmann echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 62108781595bSGerd Hoffmann echo "X11_LIBS=$x11_libs" >> $config_host_mak 62118781595bSGerd Hoffmannfi 62121ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 621396400a14SGerd Hoffmann echo "CONFIG_SDL=m" >> $config_host_mak 6214a3f4d63dSCole Robinson echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak 62158ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 62168ecc89f6SFam Zheng echo "SDL_LIBS=$sdl_libs" >> $config_host_mak 621749ecc3faSbellardfi 621849ecc3faSbellardif test "$cocoa" = "yes" ; then 621998ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 622049ecc3faSbellardfi 62214d3b6f6eSbalrogif test "$curses" = "yes" ; then 62222373f7d5SGerd Hoffmann echo "CONFIG_CURSES=m" >> $config_host_mak 62232373f7d5SGerd Hoffmann echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 62242373f7d5SGerd Hoffmann echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 6225ab4e5602SJan Kiszkafi 6226099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 62272358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 6228099d6b0fSRiku Voipiofi 622940ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 623040ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 623140ff6d7eSKevin Wolffi 62323ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 62332358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 62343ce34dfbSvibisreenivasanfi 6235c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 6236c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 6237c2882b96SRiku Voipiofi 6238751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 6239751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 6240751bcc39SMarc-André Lureaufi 6241d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 6242d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 6243d0927938SUlrich Hechtfi 62443d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 62453d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 62463d4fa43eSKusanagi Kouichifi 6247b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 6248b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 6249b953f075SDenis V. Lunevfi 6250ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 6251ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 6252ed911435SKevin Wolffi 6253c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 6254c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 6255c727f47dSPeter Maydellfi 6256dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 6257dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 6258dace20dcSPeter Maydellfi 6259d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 6260d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 6261d0927938SUlrich Hechtfi 62624e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 62634e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 62644e0c6529SAlex Blighfi 6265cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 6266cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 6267cd758dd0SAlex Blighfi 62683b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 62693b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 62703b6edd16SPeter Maydellfi 62713b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 62723b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 62733b6edd16SPeter Maydellfi 6274a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 6275a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 6276a8fd1abaSPeter Maydellfi 627751834341SRiku Voipioif test "$timerfd" = "yes" ; then 627851834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 627951834341SRiku Voipiofi 62809af5c906SRiku Voipioif test "$setns" = "yes" ; then 62819af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 62829af5c906SRiku Voipiofi 628338860a03SAleksandar Markovicif test "$clock_adjtime" = "yes" ; then 628438860a03SAleksandar Markovic echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 628538860a03SAleksandar Markovicfi 62865a03cd00SAleksandar Markovicif test "$syncfs" = "yes" ; then 62875a03cd00SAleksandar Markovic echo "CONFIG_SYNCFS=y" >> $config_host_mak 62885a03cd00SAleksandar Markovicfi 62893b3f24adSaurel32if test "$inotify" = "yes" ; then 62902358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 62913b3f24adSaurel32fi 6292c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 6293c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 6294c05c7a73SRiku Voipiofi 6295401bc051SPeter Maydellif test "$sem_timedwait" = "yes" ; then 6296401bc051SPeter Maydell echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 6297401bc051SPeter Maydellfi 62985c99fa37SKeno Fischerif test "$strchrnul" = "yes" ; then 62995c99fa37SKeno Fischer echo "HAVE_STRCHRNUL=y" >> $config_host_mak 63005c99fa37SKeno Fischerfi 63016ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 63026ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 63036ae9a1f4SJuan Quintelafi 63046ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 63056ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 63066ae9a1f4SJuan Quintelafi 6307769ce76dSAlexander Grafif test "$curl" = "yes" ; then 6308d3399d7cSFam Zheng echo "CONFIG_CURL=m" >> $config_host_mak 6309b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 63106ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 6311769ce76dSAlexander Graffi 63122e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 631398ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 63148eca2889SFam Zheng echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 63152e4d9fb1Saurel32fi 6316fb599c9aSbalrogif test "$bluez" = "yes" ; then 631798ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 6318ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 6319fb599c9aSbalrogfi 6320a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 6321e0fb129cSGerd Hoffmann echo "CONFIG_GTK=m" >> $config_host_mak 6322a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 6323014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 6324925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 6325925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 6326925a0400SGerd Hoffmann fi 6327bbbf9bfbSStefan Weilfi 6328a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 6329ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 6330ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 6331ddbb0d09SDaniel P. Berrangefi 633291bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 633391bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 63341f923c70SLongpeng(Mike) if test "$gcrypt_hmac" = "yes" ; then 63351f923c70SLongpeng(Mike) echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 63361f923c70SLongpeng(Mike) fi 633762893b67SDaniel P. Berrangefi 633891bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 633991bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 6340becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 6341ed754746SDaniel P. Berrangefi 63429a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 63439a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 63449a2fd434SDaniel P. Berrangefi 6345559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 6346559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 6347559607eaSDaniel P. Berrangefi 63486b39b063SEric Blakeif test "$have_broken_size_max" = "yes" ; then 63496b39b063SEric Blake echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 63506b39b063SEric Blakefi 6351277abf15SJan Vesely 6352277abf15SJan Vesely# Work around a system header bug with some kernel/XFS header 6353277abf15SJan Vesely# versions where they both try to define 'struct fsxattr': 6354277abf15SJan Vesely# xfs headers will not try to redefine structs from linux headers 6355277abf15SJan Vesely# if this macro is set. 6356277abf15SJan Veselyif test "$have_fsxattr" = "yes" ; then 6357277abf15SJan Vesely echo "HAVE_FSXATTR=y" >> $config_host_mak 6358277abf15SJan Veselyfi 63591efad060SFam Zhengif test "$have_copy_file_range" = "yes" ; then 63601efad060SFam Zheng echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 63611efad060SFam Zhengfi 6362bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 6363bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 6364a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 6365e0fb129cSGerd Hoffmann echo "VTE_LIBS=$vte_libs" >> $config_host_mak 6366a4ccabcfSAnthony Liguorifi 63679d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 63689d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 63699d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 63709d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 63719d9e1521SGerd Hoffmannfi 6372e37630caSaliguoriif test "$xen" = "yes" ; then 63736dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 6374d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 637564a7ad6fSIan Campbell if test "$xen_pv_domain_build" = "yes" ; then 637664a7ad6fSIan Campbell echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak 637764a7ad6fSIan Campbell fi 6378e37630caSaliguorifi 63795c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 63805c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 63815c6c3a6cSChristoph Hellwigfi 6382758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 6383758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 6384758e8e38SVenkateswararao Jujjuri (JV)fi 63854f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 63864f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 63874f26f2b6SAvi Kivityfi 6388983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 6389758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 6390758e8e38SVenkateswararao Jujjuri (JV)fi 6391fe8fc5aeSPaolo Bonziniif test "$mpath" = "yes" ; then 6392fe8fc5aeSPaolo Bonzini echo "CONFIG_MPATH=y" >> $config_host_mak 63931b0578f5SMurilo Opsfelder Araujo if test "$mpathpersist_new_api" = "yes"; then 63941b0578f5SMurilo Opsfelder Araujo echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak 63951b0578f5SMurilo Opsfelder Araujo fi 6396fe8fc5aeSPaolo Bonzinifi 63975e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 63985e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 63995e9be92dSNicholas Bellingerfi 6400e6a74868SMarc-André Lureauif test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then 640103ce5744SNikolay Nikolaev echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak 640203ce5744SNikolay Nikolaevfi 6403042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 6404042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 6405042cea27SGongleifi 6406fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 6407fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 6408fc0b9b0eSStefan Hajnoczifi 6409e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 6410e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 6411e6a74868SMarc-André Lureaufi 641277755340Sthsif test "$blobs" = "yes" ; then 641398ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 641477755340Sthsfi 6415bf9298b9Saliguoriif test "$iovec" = "yes" ; then 64162358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 6417bf9298b9Saliguorifi 6418ceb42de8Saliguoriif test "$preadv" = "yes" ; then 64192358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 6420ceb42de8Saliguorifi 6421e3971d61SPhilippe Mathieu-Daudéif test "$fdt" != "no" ; then 64223f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 6423f652e6afSaurel32fi 6424a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 6425a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 6426a40161cbSPaolo Bonzinifi 6427dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 6428dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 6429dcc38d1cSMarcelo Tosattifi 6430b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes"; then 6431b3f6ea7eSPaolo Bonzini echo "CONFIG_TCG=y" >> $config_host_mak 64329195b2c2SStefan Weil if test "$tcg_interpreter" = "yes" ; then 64339195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 64349195b2c2SStefan Weil fi 6435b3f6ea7eSPaolo Bonzinifi 64365f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 64375f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 64385f6b9e8fSBlue Swirlfi 6439e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 6440e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 6441e78815a5SAndreas Färberfi 6442e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 6443e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 6444e78815a5SAndreas Färberfi 64459bc5a719SAndreas Gustafssonif test "$posix_memalign" = "yes" ; then 64469bc5a719SAndreas Gustafsson echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 64479bc5a719SAndreas Gustafssonfi 644897a847bcSbellard 6449cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 6450cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 6451cd4ec0b4SGerd Hoffmannfi 6452cd4ec0b4SGerd Hoffmann 64537b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 64547b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 64557b62bf5aSFam Zheng echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 64567b62bf5aSFam Zheng echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 6457111a38b0SRobert Relyeafi 6458111a38b0SRobert Relyea 64592b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 64602b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 6461b878b652SFam Zheng echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 6462b878b652SFam Zheng echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 64632b2325ffSGerd Hoffmannfi 64642b2325ffSGerd Hoffmann 646569354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 646669354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 6467cc7923fcSFam Zheng echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 6468cc7923fcSFam Zheng echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 646969354a83SHans de Goedefi 647069354a83SHans de Goede 6471da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 6472da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 6473da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 6474014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 6475014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 6476014cb152SGerd Hoffmann fi 647720ff075bSMichael Wallefi 647820ff075bSMichael Walle 64795a22ab71SYang Zhongif test "$malloc_trim" = "yes" ; then 64805a22ab71SYang Zhong echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak 64815a22ab71SYang Zhongfi 64825a22ab71SYang Zhong 648399f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 648499f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 648599f2dbd3SLiang Lifi 648699f2dbd3SLiang Li 6487607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 6488607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 6489607dacd0Sqiaonuohanfi 6490607dacd0Sqiaonuohan 6491607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 6492607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 6493607dacd0Sqiaonuohanfi 6494607dacd0Sqiaonuohan 64956b383c08SPeter Wuif test "$bzip2" = "yes" ; then 64966b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 64976b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 64986b383c08SPeter Wufi 64996b383c08SPeter Wu 6500c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 6501d3399d7cSFam Zheng echo "CONFIG_LIBISCSI=m" >> $config_host_mak 65026ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 65036ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 6504c589b249SRonnie Sahlbergfi 6505c589b249SRonnie Sahlberg 65066542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 65074be4879fSColin Lord echo "CONFIG_LIBNFS=m" >> $config_host_mak 65084be4879fSColin Lord echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 65096542aa9cSPeter Lievenfi 65106542aa9cSPeter Lieven 6511f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 6512f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 6513c3883e1fSFam Zheng echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 6514c3883e1fSFam Zheng echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 6515f794573eSEduardo Otubofi 6516f794573eSEduardo Otubo 651783fb7adfSbellard# XXX: suppress that 65187d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 65192358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 65207d3505c5Sbellardfi 65217d3505c5Sbellard 65224d9310f4SDaniel P. Berrangeif test "$localtime_r" = "yes" ; then 65234d9310f4SDaniel P. Berrange echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 65244d9310f4SDaniel P. Berrangefi 65253556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 65263556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 65273556c233SPaolo Bonzinifi 6528f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 6529d3399d7cSFam Zheng echo "CONFIG_RBD=m" >> $config_host_mak 65306ebc91e5SFam Zheng echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 65316ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 6532f27aaf4bSChristian Brunnerfi 653320ff6c80SAnthony Liguori 65347c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 653570c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 653670c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 653770c60c08SStefan Hajnoczielse 653870c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 653970c60c08SStefan Hajnoczifi 6540d0e2fce5SAneesh Kumar K.V 65417d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 65427d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 65437d992e4dSPeter Lievenfi 65447d992e4dSPeter Lieven 6545f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 6546f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 6547f0d92b56SLongpeng(Mike)fi 6548f0d92b56SLongpeng(Mike) 6549d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 6550d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 6551d2042378SAneesh Kumar K.Vfi 6552d2042378SAneesh Kumar K.V 6553e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 6554e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 6555e06a765eSHarsh Prateek Borafi 6556e06a765eSHarsh Prateek Bora 6557cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then 6558cc6e3ca9SGerd Hoffmann echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 655906d71fa1SPeter Maydellfi 656006d71fa1SPeter Maydell 65613f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 65623f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 65633f4349dcSKevin Wolffi 65643f4349dcSKevin Wolf 6565d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 6566d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 6567d83414e1SMarc-André Lureaufi 6568d83414e1SMarc-André Lureau 65698ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 65708ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 65718ab1bf12SLuiz Capitulinofi 65728ab1bf12SLuiz Capitulino 657376a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 657476a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 657576a347e1SRichard Hendersonfi 657676a347e1SRichard Henderson 6577f540166bSRichard Hendersonif test "$int128" = "yes" ; then 6578f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 6579f540166bSRichard Hendersonfi 6580f540166bSRichard Henderson 65817ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 65827ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 65837ebee43eSRichard Hendersonfi 65847ebee43eSRichard Henderson 6585df79b996SRichard Hendersonif test "$atomic64" = "yes" ; then 6586df79b996SRichard Henderson echo "CONFIG_ATOMIC64=y" >> $config_host_mak 6587df79b996SRichard Hendersonfi 6588df79b996SRichard Henderson 6589db432672SRichard Hendersonif test "$vector16" = "yes" ; then 6590db432672SRichard Henderson echo "CONFIG_VECTOR16=y" >> $config_host_mak 6591db432672SRichard Hendersonfi 6592db432672SRichard Henderson 65931e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 65941e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 65951e6e9acaSRichard Hendersonfi 65961e6e9acaSRichard Henderson 6597eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 6598d3399d7cSFam Zheng echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 65996ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 66006ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 6601eb100396SBharata B Raofi 6602eb100396SBharata B Rao 6603d85fa9ebSJeff Codyif test "$glusterfs_xlator_opt" = "yes" ; then 6604d85fa9ebSJeff Cody echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 6605d85fa9ebSJeff Codyfi 6606d85fa9ebSJeff Cody 66070c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 66080c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 66090c14fb47SBharata B Raofi 66100c14fb47SBharata B Rao 6611df3a429aSNiels de Vosif test "$glusterfs_fallocate" = "yes" ; then 6612df3a429aSNiels de Vos echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 6613df3a429aSNiels de Vosfi 6614df3a429aSNiels de Vos 66157c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 66167c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 66177c815372SBharata B Raofi 66187c815372SBharata B Rao 66190a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then 6620d3399d7cSFam Zheng echo "CONFIG_LIBSSH2=m" >> $config_host_mak 66216ebc91e5SFam Zheng echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak 66226ebc91e5SFam Zheng echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak 66230a12ec87SRichard W.M. Jonesfi 66240a12ec87SRichard W.M. Jones 6625ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 6626ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 6627ed1701c6SDr. David Alan Gilbertfi 6628ed1701c6SDr. David Alan Gilbert 66293b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 66303b8acc11SPaolo Bonzini echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak 6631f4ede81eSAmarnath Valluri # TPM passthrough support? 66323b8acc11SPaolo Bonzini if test "$tpm_passthrough" = "yes"; then 66333b8acc11SPaolo Bonzini echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak 66343b8acc11SPaolo Bonzini fi 6635f4ede81eSAmarnath Valluri # TPM emulator support? 6636f4ede81eSAmarnath Valluri if test "$tpm_emulator" = "yes"; then 6637f4ede81eSAmarnath Valluri echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak 6638f4ede81eSAmarnath Valluri fi 66393b8acc11SPaolo Bonzinifi 66403b8acc11SPaolo Bonzini 66415b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 66425b808275SLluís Vilanovaif have_backend "nop"; then 66436d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 664422890ab5SPrerna Saxenafi 66455b808275SLluís Vilanovaif have_backend "simple"; then 66466d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 66476d8a764eSLluís # Set the appropriate trace file. 6648953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 66499410b56cSPrerna Saxenafi 6650ed7f5f1dSPaolo Bonziniif have_backend "log"; then 6651ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 66526d8a764eSLluísfi 66535b808275SLluís Vilanovaif have_backend "ust"; then 66546d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 66556d8a764eSLluísfi 66565b808275SLluís Vilanovaif have_backend "dtrace"; then 66576d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 66586d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 66596d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 66606d8a764eSLluís fi 6661c276b17dSDaniel P. Berrangefi 66625b808275SLluís Vilanovaif have_backend "ftrace"; then 6663781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 6664781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 6665781e9545SEiichi Tsukata else 666621684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 6667781e9545SEiichi Tsukata fi 6668781e9545SEiichi Tsukatafi 66690a852417SPaul Durrantif have_backend "syslog"; then 66700a852417SPaul Durrant if test "$posix_syslog" = "yes" ; then 66710a852417SPaul Durrant echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 66720a852417SPaul Durrant else 66730a852417SPaul Durrant feature_not_found "syslog(trace backend)" "syslog not available" 66740a852417SPaul Durrant fi 66750a852417SPaul Durrantfi 66769410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 66779410b56cSPrerna Saxena 66782da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 66792da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 6680392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 66812da776dbSMichael R. Hinesfi 66822da776dbSMichael R. Hines 668321ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 668421ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 668521ab34c9SMarcel Apfelbaumfi 668621ab34c9SMarcel Apfelbaum 6687575b22b1SLaurent Vivierif test "$have_rtnetlink" = "yes" ; then 6688575b22b1SLaurent Vivier echo "CONFIG_RTNETLINK=y" >> $config_host_mak 6689575b22b1SLaurent Vivierfi 6690575b22b1SLaurent Vivier 6691ed279a06SKlim Kireevif test "$libxml2" = "yes" ; then 6692ed279a06SKlim Kireev echo "CONFIG_LIBXML2=y" >> $config_host_mak 6693ed279a06SKlim Kireev echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 6694ed279a06SKlim Kireev echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 6695ed279a06SKlim Kireevfi 6696ed279a06SKlim Kireev 6697a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 6698a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 6699a6b1d4c0SChanglong Xiefi 6700a6b1d4c0SChanglong Xie 67016a02c806SStefan Hajnocziif test "$have_af_vsock" = "yes" ; then 67026a02c806SStefan Hajnoczi echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 67036a02c806SStefan Hajnoczifi 67046a02c806SStefan Hajnoczi 67054d04351fSChristopher Covingtonif test "$have_sysmacros" = "yes" ; then 67064d04351fSChristopher Covington echo "CONFIG_SYSMACROS=y" >> $config_host_mak 67074d04351fSChristopher Covingtonfi 67084d04351fSChristopher Covington 670949e00a18SAndreas Grapentinif test "$have_static_assert" = "yes" ; then 671049e00a18SAndreas Grapentin echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 671149e00a18SAndreas Grapentinfi 671249e00a18SAndreas Grapentin 6713e674605fSTomáš Golembiovskýif test "$have_utmpx" = "yes" ; then 6714e674605fSTomáš Golembiovský echo "HAVE_UTMPX=y" >> $config_host_mak 6715e674605fSTomáš Golembiovskýfi 6716e674605fSTomáš Golembiovský 6717e0580342SKamil Rytarowskiif test "$ivshmem" = "yes" ; then 6718e0580342SKamil Rytarowski echo "CONFIG_IVSHMEM=y" >> $config_host_mak 6719e0580342SKamil Rytarowskifi 6720e219c499SRichard Hendersonif test "$capstone" != "no" ; then 67218ca80760SRichard Henderson echo "CONFIG_CAPSTONE=y" >> $config_host_mak 67228ca80760SRichard Hendersonfi 6723ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 6724ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 6725ba59fb77SPaolo Bonzinifi 6726e0580342SKamil Rytarowski 67275c312079SDr. David Alan Gilbert# Hold two types of flag: 67285c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 67295c312079SDr. David Alan Gilbert# a thread we have a handle to 67305c312079SDr. David Alan Gilbert# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular 67315c312079SDr. David Alan Gilbert# platform 67325c312079SDr. David Alan Gilbertif test "$pthread_setname_np" = "yes" ; then 67335c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 67345c312079SDr. David Alan Gilbert echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak 67355c312079SDr. David Alan Gilbertfi 67365c312079SDr. David Alan Gilbert 6737da92c3ffSAshish Mittalif test "$vxhs" = "yes" ; then 6738da92c3ffSAshish Mittal echo "CONFIG_VXHS=y" >> $config_host_mak 6739da92c3ffSAshish Mittal echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak 6740da92c3ffSAshish Mittalfi 6741da92c3ffSAshish Mittal 674217824406SJunyan Heif test "$libpmem" = "yes" ; then 674317824406SJunyan He echo "CONFIG_LIBPMEM=y" >> $config_host_mak 674417824406SJunyan Hefi 674517824406SJunyan He 67465b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 67479edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 67485b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 67499edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 67505b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 67519edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 6752c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then 67539edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 675440d964b5SRichard Hendersonelif test "$ARCH" = "ppc64" ; then 67559edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" 67565b5e3037SPaolo Bonzinielse 67579edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 67585b5e3037SPaolo Bonzinifi 67599edc19c9SMichael S. TsirkinQEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES" 67605b5e3037SPaolo Bonzini 676198ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 676298ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 6763804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 6764804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 67651901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 67661901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 67671901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 676821655882SPaolo Bonziniecho "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 6769c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 6770804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 6771a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 6772a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_host_mak 6773a31a8642SMichael S. Tsirkinfi 6774804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 677583f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 67763c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 6777804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 677845d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 6779cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 67805f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 67813dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 6782804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 6783804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 67849f81aeb5SAlistair Francisecho "RANLIB=$ranlib" >> $config_host_mak 67854852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 67869fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 6787e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 678846eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 6789a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 679011cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 6791f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 6792e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 6793e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 679480fd48dfSChristian Borntraeger echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak 67952944d742SGerd Hoffmann echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak 6796e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 6797e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 6798e39f0062SPaolo Bonzinifi 679942da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 680042da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 680142da6041SGerd Hoffmannelse 680242da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 680342da6041SGerd Hoffmannfi 6804e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 680546eef33bSBradecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 68068a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 68076969ec6cSJames Clarkeecho "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak 6808e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 680973da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 68103e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 6811409437e1SDaniel P. Berrangeecho "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 6812804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 681317969268SFam Zhengecho "DSOSUF=$DSOSUF" >> $config_host_mak 681417969268SFam Zhengecho "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 6815957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 681690246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 681790246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 681894dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 6819cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 68201d728c39SBlue Swirlif test "$gcov" = "yes" ; then 68211d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 68221d728c39SBlue Swirl echo "GCOV=$gcov_tool" >> $config_host_mak 68231d728c39SBlue Swirlfi 6824804edf29SJuan Quintela 682551a12b51SAlex Bennéeif test "$docker" != "no"; then 682651a12b51SAlex Bennée echo "HAVE_USER_DOCKER=y" >> $config_host_mak 682751a12b51SAlex Bennéefi 682851a12b51SAlex Bennée 68296efd7517SPeter Maydell# use included Linux headers 68306efd7517SPeter Maydellif test "$linux" = "yes" ; then 6831a307beb6SAndreas Färber mkdir -p linux-headers 68326efd7517SPeter Maydell case "$cpu" in 6833c72b26ecSRichard Henderson i386|x86_64|x32) 683408312a63SPeter Maydell linux_arch=x86 68356efd7517SPeter Maydell ;; 6836a69dc537SThomas Huth ppc|ppc64) 683708312a63SPeter Maydell linux_arch=powerpc 68386efd7517SPeter Maydell ;; 68396efd7517SPeter Maydell s390x) 684008312a63SPeter Maydell linux_arch=s390 684108312a63SPeter Maydell ;; 68421f080313SClaudio Fontana aarch64) 68431f080313SClaudio Fontana linux_arch=arm64 68441f080313SClaudio Fontana ;; 6845222e7d11SSanjay Lal mips64) 6846222e7d11SSanjay Lal linux_arch=mips 6847222e7d11SSanjay Lal ;; 684808312a63SPeter Maydell *) 684908312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 685008312a63SPeter Maydell linux_arch="$cpu" 68516efd7517SPeter Maydell ;; 68526efd7517SPeter Maydell esac 685308312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 685408312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 685508312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 685608312a63SPeter Maydell fi 68576efd7517SPeter Maydellfi 68586efd7517SPeter Maydell 685997a847bcSbellardfor target in $target_list; do 686097a847bcSbellardtarget_dir="$target" 686125be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 686289138857SStefan Weiltarget_name=$(echo $target | cut -d '-' -f 1) 686397a847bcSbellardtarget_bigendian="no" 68641f3d3c8fSJuan Quintela 6865c1799a84SPaolo Bonzinicase "$target_name" in 6866a69dc537SThomas Huth armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 6867ea2d6a39SJuan Quintela target_bigendian=yes 6868ea2d6a39SJuan Quintela ;; 6869ea2d6a39SJuan Quintelaesac 687097a847bcSbellardtarget_softmmu="no" 6871997344f3Sbellardtarget_user_only="no" 6872831b7825Sthstarget_linux_user="no" 687384778508Sblueswir1target_bsd_user="no" 68749e407a85Spbrookcase "$target" in 6875c1799a84SPaolo Bonzini ${target_name}-softmmu) 68769e407a85Spbrook target_softmmu="yes" 68779e407a85Spbrook ;; 6878c1799a84SPaolo Bonzini ${target_name}-linux-user) 68799e407a85Spbrook target_user_only="yes" 68809e407a85Spbrook target_linux_user="yes" 68819e407a85Spbrook ;; 6882c1799a84SPaolo Bonzini ${target_name}-bsd-user) 688384778508Sblueswir1 target_user_only="yes" 688484778508Sblueswir1 target_bsd_user="yes" 688584778508Sblueswir1 ;; 68869e407a85Spbrook *) 688776ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 68889e407a85Spbrook exit 1 68899e407a85Spbrook ;; 68909e407a85Spbrookesac 6891831b7825Sths 6892d75402b5SAlex Bennéetarget_compiler="" 6893d75402b5SAlex Bennéetarget_compiler_static="" 6894716a507cSAlex Bennéetarget_compiler_cflags="" 6895d75402b5SAlex Bennée 689697a847bcSbellardmkdir -p $target_dir 689725be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 689897a847bcSbellard 6899e5fe0c52Spbrookbflt="no" 6900ca759f9eSAlex Bennéemttcg="no" 690189138857SStefan Weilinterp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") 690256aebc89Spbrookgdb_xml_files="" 69037ba1e619Saliguori 6904c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 69056acff7daSJuan QuintelaTARGET_BASE_ARCH="" 6906e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 6907e73aae67SJuan Quintela 6908c1799a84SPaolo Bonzinicase "$target_name" in 69092408a527Saurel32 i386) 69100a7fa00aSEmilio G. Cota mttcg="yes" 6911b8158192SAbdallah Bouassida gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml" 6912d75402b5SAlex Bennée target_compiler=$cross_cc_i386 6913716a507cSAlex Bennée target_compiler_cflags=$cross_cc_ccflags_i386 69142408a527Saurel32 ;; 69152408a527Saurel32 x86_64) 69166acff7daSJuan Quintela TARGET_BASE_ARCH=i386 69170a7fa00aSEmilio G. Cota mttcg="yes" 6918b8158192SAbdallah Bouassida gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml" 6919d75402b5SAlex Bennée target_compiler=$cross_cc_x86_64 69202408a527Saurel32 ;; 69212408a527Saurel32 alpha) 69225ee4f3c2SRichard Henderson mttcg="yes" 6923d75402b5SAlex Bennée target_compiler=$cross_cc_alpha 69242408a527Saurel32 ;; 69252408a527Saurel32 arm|armeb) 6926b498c8a0SJuan Quintela TARGET_ARCH=arm 6927e5fe0c52Spbrook bflt="yes" 6928ca759f9eSAlex Bennée mttcg="yes" 692956aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 6930d75402b5SAlex Bennée target_compiler=$cross_cc_arm 6931d422b2bcSAlex Bennée eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" 69322408a527Saurel32 ;; 6933722dd7beSMichael Weiser aarch64|aarch64_be) 6934722dd7beSMichael Weiser TARGET_ARCH=aarch64 69356a49fa95SAlexander Graf TARGET_BASE_ARCH=arm 69366a49fa95SAlexander Graf bflt="yes" 6937ca759f9eSAlex Bennée mttcg="yes" 69388f95ce2eSPeter Maydell gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 6939d75402b5SAlex Bennée target_compiler=$cross_cc_aarch64 6940d422b2bcSAlex Bennée eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" 69416a49fa95SAlexander Graf ;; 69422408a527Saurel32 cris) 6943d75402b5SAlex Bennée target_compiler=$cross_cc_cris 69442408a527Saurel32 ;; 694561766fe9SRichard Henderson hppa) 69467b93dab5SRichard Henderson mttcg="yes" 6947d75402b5SAlex Bennée target_compiler=$cross_cc_hppa 694861766fe9SRichard Henderson ;; 6949613a22c9SMichael Walle lm32) 6950d75402b5SAlex Bennée target_compiler=$cross_cc_lm32 6951613a22c9SMichael Walle ;; 69522408a527Saurel32 m68k) 69530938cda5Saurel32 bflt="yes" 69545a4526b2SLaurent Vivier gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml" 6955d75402b5SAlex Bennée target_compiler=$cross_cc_m68k 69562408a527Saurel32 ;; 6957877fdc12SEdgar E. Iglesias microblaze|microblazeel) 6958877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 695972b675caSEdgar E. Iglesias bflt="yes" 6960be73ef64SEdgar E. Iglesias echo "TARGET_ABI32=y" >> $config_target_mak 6961d75402b5SAlex Bennée target_compiler=$cross_cc_microblaze 696272b675caSEdgar E. Iglesias ;; 69632408a527Saurel32 mips|mipsel) 6964b498c8a0SJuan Quintela TARGET_ARCH=mips 6965d75402b5SAlex Bennée target_compiler=$cross_cc_mips 696625be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 69672408a527Saurel32 ;; 69682408a527Saurel32 mipsn32|mipsn32el) 6969597e2cecSRichard Henderson TARGET_ARCH=mips64 69706acff7daSJuan Quintela TARGET_BASE_ARCH=mips 6971d75402b5SAlex Bennée target_compiler=$cross_cc_mipsn32 697225be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 6973597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 69742408a527Saurel32 ;; 69752408a527Saurel32 mips64|mips64el) 6976b498c8a0SJuan Quintela TARGET_ARCH=mips64 69776acff7daSJuan Quintela TARGET_BASE_ARCH=mips 6978d75402b5SAlex Bennée target_compiler=$cross_cc_mips64 697925be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 69802408a527Saurel32 ;; 6981d15a9c23SAnthony Green moxie) 6982d75402b5SAlex Bennée target_compiler=$cross_cc_moxie 6983d15a9c23SAnthony Green ;; 6984e671711cSMarek Vasut nios2) 6985d75402b5SAlex Bennée target_compiler=$cross_cc_nios2 6986e671711cSMarek Vasut ;; 69874a09d0bbSRichard Henderson or1k) 6988d75402b5SAlex Bennée target_compiler=$cross_cc_or1k 6989e67db06eSJia Liu TARGET_ARCH=openrisc 6990e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 6991e67db06eSJia Liu ;; 69922408a527Saurel32 ppc) 6993c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 6994d75402b5SAlex Bennée target_compiler=$cross_cc_powerpc 69952408a527Saurel32 ;; 69962408a527Saurel32 ppc64) 69976acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 6998e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 6999f0b0685dSNikunj A Dadhania mttcg=yes 70001438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7001d75402b5SAlex Bennée target_compiler=$cross_cc_ppc64 70022408a527Saurel32 ;; 70039c35126cSDoug Kwan ppc64le) 70049c35126cSDoug Kwan TARGET_ARCH=ppc64 70059c35126cSDoug Kwan TARGET_BASE_ARCH=ppc 70069c35126cSDoug Kwan TARGET_ABI_DIR=ppc 7007f0b0685dSNikunj A Dadhania mttcg=yes 70081438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7009d75402b5SAlex Bennée target_compiler=$cross_cc_ppc64le 70109c35126cSDoug Kwan ;; 70112408a527Saurel32 ppc64abi32) 7012b498c8a0SJuan Quintela TARGET_ARCH=ppc64 70136acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 7014e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 701525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 70161438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 7017d75402b5SAlex Bennée target_compiler=$cross_cc_ppc64abi32 70182408a527Saurel32 ;; 701925fa194bSMichael Clark riscv32) 702025fa194bSMichael Clark TARGET_BASE_ARCH=riscv 702125fa194bSMichael Clark TARGET_ABI_DIR=riscv 702225fa194bSMichael Clark mttcg=yes 7023d75402b5SAlex Bennée target_compiler=$cross_cc_riscv32 702425fa194bSMichael Clark ;; 702525fa194bSMichael Clark riscv64) 702625fa194bSMichael Clark TARGET_BASE_ARCH=riscv 702725fa194bSMichael Clark TARGET_ABI_DIR=riscv 702825fa194bSMichael Clark mttcg=yes 7029d75402b5SAlex Bennée target_compiler=$cross_cc_riscv64 703025fa194bSMichael Clark ;; 70312408a527Saurel32 sh4|sh4eb) 7032b498c8a0SJuan Quintela TARGET_ARCH=sh4 70334dbed897Spbrook bflt="yes" 7034d75402b5SAlex Bennée target_compiler=$cross_cc_sh4 70352408a527Saurel32 ;; 70362408a527Saurel32 sparc) 7037d75402b5SAlex Bennée target_compiler=$cross_cc_sparc 70382408a527Saurel32 ;; 70392408a527Saurel32 sparc64) 70406acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 7041d75402b5SAlex Bennée target_compiler=$cross_cc_sparc64 70422408a527Saurel32 ;; 70432408a527Saurel32 sparc32plus) 7044b498c8a0SJuan Quintela TARGET_ARCH=sparc64 70456acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 7046e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 7047d75402b5SAlex Bennée target_compiler=$cross_cc_sparc32plus 704825be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 70492408a527Saurel32 ;; 705024e804ecSAlexander Graf s390x) 705163685bc4SDavid Hildenbrand mttcg=yes 705286158a2aSChristian 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" 7053d75402b5SAlex Bennée target_compiler=$cross_cc_s390x 705424e804ecSAlexander Graf ;; 7055444e06b1SChen Gang tilegx) 7056d75402b5SAlex Bennée target_compiler=$cross_cc_tilegx 7057444e06b1SChen Gang ;; 70585ecaa4edSPeter Crosthwaite tricore) 7059d75402b5SAlex Bennée target_compiler=$cross_cc_tricore 70605ecaa4edSPeter Crosthwaite ;; 7061d2fbca94SGuan Xuetao unicore32) 7062d75402b5SAlex Bennée target_compiler=$cross_cc_unicore32 7063d2fbca94SGuan Xuetao ;; 7064cfa550c6SMax Filippov xtensa|xtensaeb) 7065cfa550c6SMax Filippov TARGET_ARCH=xtensa 70669fb40342SMax Filippov mttcg="yes" 7067d75402b5SAlex Bennée target_compiler=$cross_cc_xtensa 7068cfa550c6SMax Filippov ;; 70692408a527Saurel32 *) 707076ad07a4SPeter Maydell error_exit "Unsupported target CPU" 70712408a527Saurel32 ;; 70722408a527Saurel32esac 70735e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 70745e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 70755e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 70765e8861a0SPaolo Bonzinifi 70775e8861a0SPaolo Bonzini 7078d75402b5SAlex Bennée# Do we have a cross compiler for this target? 7079d75402b5SAlex Bennéeif has $target_compiler; then 7080d75402b5SAlex Bennée 7081d75402b5SAlex Bennée write_c_skeleton 7082d75402b5SAlex Bennée 7083716a507cSAlex Bennée if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC -static ; then 7084d75402b5SAlex Bennée # For host systems we might get away with building without -static 7085716a507cSAlex Bennée if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC ; then 7086d75402b5SAlex Bennée target_compiler="" 7087d75402b5SAlex Bennée else 7088d75402b5SAlex Bennée enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'" 7089d75402b5SAlex Bennée target_compiler_static="n" 7090d75402b5SAlex Bennée fi 7091d75402b5SAlex Bennée else 7092d75402b5SAlex Bennée enabled_cross_compilers="${enabled_cross_compilers} '${target_compiler}'" 7093d75402b5SAlex Bennée target_compiler_static="y" 7094d75402b5SAlex Bennée fi 7095d75402b5SAlex Bennéeelse 7096d75402b5SAlex Bennée target_compiler="" 7097d75402b5SAlex Bennéefi 7098d75402b5SAlex Bennée 70995e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 71005e8861a0SPaolo Bonzini 710199afc91dSDaniel P. Berrangeupper() { 710299afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 710399afc91dSDaniel P. Berrange} 710499afc91dSDaniel P. Berrange 710589138857SStefan Weiltarget_arch_name="$(upper $TARGET_ARCH)" 710625be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 7107c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 710825be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 7109e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 7110e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 7111e6e91b9cSJuan Quintelafi 711225be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 7113adfc3e91SStacey Sonif [ "$HOST_VARIANT_DIR" != "" ]; then 7114adfc3e91SStacey Son echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 7115adfc3e91SStacey Sonfi 71163b6b7550SPaolo Bonzini 71173b6b7550SPaolo Bonziniif supported_xen_target $target; then 711825be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 7119eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 7120eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 7121eb6fda0fSAnthony PERARD fi 7122432d268cSJun Nakajimafi 71233b6b7550SPaolo Bonziniif supported_kvm_target $target; then 712425be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 71251ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 7126d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 7127e6a74868SMarc-André Lureau if test "$vhost_user" = "yes" ; then 7128e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak 7129e6a74868SMarc-André Lureau fi 7130d5970055SMichael S. Tsirkin fi 7131c59249f9SJuan Quintelafi 71323b6b7550SPaolo Bonziniif supported_hax_target $target; then 7133b0cb0a66SVincent Palatin echo "CONFIG_HAX=y" >> $config_target_mak 7134b0cb0a66SVincent Palatinfi 7135c97d6d2cSSergio Andres Gomez Del Realif supported_hvf_target $target; then 7136c97d6d2cSSergio Andres Gomez Del Real echo "CONFIG_HVF=y" >> $config_target_mak 7137c97d6d2cSSergio Andres Gomez Del Realfi 7138d661d9a4SJustin Terry (VM)if supported_whpx_target $target; then 7139d661d9a4SJustin Terry (VM) echo "CONFIG_WHPX=y" >> $config_target_mak 7140d661d9a4SJustin Terry (VM)fi 7141de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 714225be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 714397a847bcSbellardfi 714497a847bcSbellardif test "$target_softmmu" = "yes" ; then 714525be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 7146ca759f9eSAlex Bennée if test "$mttcg" = "yes" ; then 7147ca759f9eSAlex Bennée echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak 7148ca759f9eSAlex Bennée fi 7149de83cd02Sbellardfi 7150997344f3Sbellardif test "$target_user_only" = "yes" ; then 715125be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 7152a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 7153997344f3Sbellardfi 7154831b7825Sthsif test "$target_linux_user" = "yes" ; then 715525be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 7156831b7825Sthsfi 715756aebc89Spbrooklist="" 715856aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 715956aebc89Spbrook for x in $gdb_xml_files; do 716056aebc89Spbrook list="$list $source_path/gdb-xml/$x" 716156aebc89Spbrook done 716225be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 71633d0f1517SJuan Quintelafi 7164de83cd02Sbellard 7165e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 716625be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 7167e5fe0c52Spbrookfi 716884778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 716925be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 717084778508Sblueswir1fi 71715b0753e0Sbellard 7172d75402b5SAlex Bennéeif test -n "$target_compiler"; then 7173d75402b5SAlex Bennée echo "CROSS_CC_GUEST=\"$target_compiler\"" >> $config_target_mak 7174d75402b5SAlex Bennée 7175d75402b5SAlex Bennée if test -n "$target_compiler_static"; then 7176d75402b5SAlex Bennée echo "CROSS_CC_GUEST_STATIC=$target_compiler_static" >> $config_target_mak 7177d75402b5SAlex Bennée fi 7178716a507cSAlex Bennée 7179716a507cSAlex Bennée if test -n "$target_compiler_cflags"; then 7180716a507cSAlex Bennée echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak 7181d75402b5SAlex Bennée fi 7182716a507cSAlex Bennéefi 7183716a507cSAlex Bennée 7184d75402b5SAlex Bennée 71854afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 7186fa282484SJuan Quintela 71874afddb55SJuan Quintelacflags="" 7188fa282484SJuan Quintelaldflags="" 71899b8e111fSJuan Quintela 7190c765fcacSPeter Crosthwaitedisas_config() { 7191c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> $config_target_mak 7192c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak 7193c765fcacSPeter Crosthwaite} 7194c765fcacSPeter Crosthwaite 719564656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 719664656024SJuan Quintela case "$i" in 719764656024SJuan Quintela alpha) 7198c765fcacSPeter Crosthwaite disas_config "ALPHA" 719964656024SJuan Quintela ;; 720082295d8aSRichard Henderson aarch64) 720182295d8aSRichard Henderson if test -n "${cxx}"; then 7202c765fcacSPeter Crosthwaite disas_config "ARM_A64" 720382295d8aSRichard Henderson fi 720482295d8aSRichard Henderson ;; 720564656024SJuan Quintela arm) 7206c765fcacSPeter Crosthwaite disas_config "ARM" 7207999b53ecSClaudio Fontana if test -n "${cxx}"; then 7208c765fcacSPeter Crosthwaite disas_config "ARM_A64" 7209999b53ecSClaudio Fontana fi 721064656024SJuan Quintela ;; 721164656024SJuan Quintela cris) 7212c765fcacSPeter Crosthwaite disas_config "CRIS" 721364656024SJuan Quintela ;; 7214429b31a2SRichard Henderson hppa) 7215429b31a2SRichard Henderson disas_config "HPPA" 7216429b31a2SRichard Henderson ;; 7217c72b26ecSRichard Henderson i386|x86_64|x32) 7218c765fcacSPeter Crosthwaite disas_config "I386" 721964656024SJuan Quintela ;; 722079368f49SMichael Walle lm32) 7221c765fcacSPeter Crosthwaite disas_config "LM32" 722279368f49SMichael Walle ;; 722364656024SJuan Quintela m68k) 7224c765fcacSPeter Crosthwaite disas_config "M68K" 722564656024SJuan Quintela ;; 7226877fdc12SEdgar E. Iglesias microblaze*) 7227c765fcacSPeter Crosthwaite disas_config "MICROBLAZE" 722864656024SJuan Quintela ;; 722964656024SJuan Quintela mips*) 7230c765fcacSPeter Crosthwaite disas_config "MIPS" 723164656024SJuan Quintela ;; 7232d15a9c23SAnthony Green moxie*) 7233c765fcacSPeter Crosthwaite disas_config "MOXIE" 7234d15a9c23SAnthony Green ;; 7235e671711cSMarek Vasut nios2) 7236e671711cSMarek Vasut disas_config "NIOS2" 7237e671711cSMarek Vasut ;; 72384a09d0bbSRichard Henderson or1k) 7239c765fcacSPeter Crosthwaite disas_config "OPENRISC" 7240e67db06eSJia Liu ;; 724164656024SJuan Quintela ppc*) 7242c765fcacSPeter Crosthwaite disas_config "PPC" 724364656024SJuan Quintela ;; 724425fa194bSMichael Clark riscv) 724525fa194bSMichael Clark disas_config "RISCV" 724625fa194bSMichael Clark ;; 724724e804ecSAlexander Graf s390*) 7248c765fcacSPeter Crosthwaite disas_config "S390" 724964656024SJuan Quintela ;; 725064656024SJuan Quintela sh4) 7251c765fcacSPeter Crosthwaite disas_config "SH4" 725264656024SJuan Quintela ;; 725364656024SJuan Quintela sparc*) 7254c765fcacSPeter Crosthwaite disas_config "SPARC" 725564656024SJuan Quintela ;; 7256cfa550c6SMax Filippov xtensa*) 7257c765fcacSPeter Crosthwaite disas_config "XTENSA" 7258cfa550c6SMax Filippov ;; 725964656024SJuan Quintela esac 726064656024SJuan Quinteladone 72619195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 7262c765fcacSPeter Crosthwaite disas_config "TCI" 72639195b2c2SStefan Weilfi 726464656024SJuan Quintela 72656ee7126fSJuan Quintelacase "$ARCH" in 72666ee7126fSJuan Quintelaalpha) 72676ee7126fSJuan Quintela # Ensure there's only a single GP 72686ee7126fSJuan Quintela cflags="-msmall-data $cflags" 72696ee7126fSJuan Quintela;; 72706ee7126fSJuan Quintelaesac 72716ee7126fSJuan Quintela 7272d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 727325be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 7274d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 7275d02c1db3SJuan Quintela cflags="-p $cflags" 7276d02c1db3SJuan Quintela ldflags="-p $ldflags" 7277d02c1db3SJuan Quintela fi 7278d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 7279d02c1db3SJuan Quintela ldflags="-p $ldflags" 728025be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 7281d02c1db3SJuan Quintela fi 7282d02c1db3SJuan Quintelafi 7283d02c1db3SJuan Quintela 72849b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 7285964c6fa1SRichard Henderson ldflags="$ldflags $textseg_ldflags" 7286fa282484SJuan Quintelafi 7287fa282484SJuan Quintela 7288e9a3591fSChristian Borntraeger# Newer kernels on s390 check for an S390_PGSTE program header and 7289e9a3591fSChristian Borntraeger# enable the pgste page table extensions in that case. This makes 7290e9a3591fSChristian Borntraeger# the vm.allocate_pgste sysctl unnecessary. We enable this program 7291e9a3591fSChristian Borntraeger# header if 7292e9a3591fSChristian Borntraeger# - we build on s390x 7293e9a3591fSChristian Borntraeger# - we build the system emulation for s390x (qemu-system-s390x) 7294e9a3591fSChristian Borntraeger# - KVM is enabled 7295e9a3591fSChristian Borntraeger# - the linker supports --s390-pgste 7296e9a3591fSChristian Borntraegerif test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then 7297e9a3591fSChristian Borntraeger if ld_has --s390-pgste ; then 7298e9a3591fSChristian Borntraeger ldflags="-Wl,--s390-pgste $ldflags" 7299e9a3591fSChristian Borntraeger fi 7300e9a3591fSChristian Borntraegerfi 7301e9a3591fSChristian Borntraeger 730225be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 730325be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 7304fa282484SJuan Quintela 730597a847bcSbellarddone # for target in $targets 73067d13299dSbellard 7307d75402b5SAlex Bennéeif test -n "$enabled_cross_compilers"; then 7308d75402b5SAlex Bennée echo 7309d75402b5SAlex Bennée echo "NOTE: cross-compilers enabled: $enabled_cross_compilers" 7310d75402b5SAlex Bennéefi 7311d75402b5SAlex Bennée 7312e3971d61SPhilippe Mathieu-Daudéif [ "$fdt" = "git" ]; then 7313a540f158SPeter Crosthwaite echo "config-host.h: subdir-dtc" >> $config_host_mak 7314a540f158SPeter Crosthwaitefi 7315e219c499SRichard Hendersonif [ "$capstone" = "git" -o "$capstone" = "internal" ]; then 7316e219c499SRichard Henderson echo "config-host.h: subdir-capstone" >> $config_host_mak 7317e219c499SRichard Hendersonfi 7318e219c499SRichard Hendersonif test -n "$LIBCAPSTONE"; then 7319e219c499SRichard Henderson echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak 7320e219c499SRichard Hendersonfi 7321a540f158SPeter Crosthwaite 7322a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 7323a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 7324a99d57bbSWanlong Gaofi 7325a99d57bbSWanlong Gao 7326fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 7327fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 7328fd0e6053SJohn Snowfi 7329fd0e6053SJohn Snow 7330d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 7331b1fb9a63SFam ZhengDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" 73323ac1f813SEmilio G. CotaDIRS="$DIRS tests/fp" 7333b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 73349933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" 73352d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 7336c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 7337c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 7338aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" 73393ac1f813SEmilio G. CotaFILES="$FILES tests/fp/Makefile" 7340ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 7341446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 73429933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile" 73432d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 73444652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp" 73453a586d2fSStefan HajnocziFILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit 7346753d11f2SRichard Hendersonfor bios_file in \ 7347753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 7348225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 73495acc2ec0SGerd Hoffmann $source_path/pc-bios/*.aml \ 7350753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 7351753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 7352e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 7353753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 73544e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 7355753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 7356753d11f2SRichard Hendersondo 735789138857SStefan Weil FILES="$FILES pc-bios/$(basename $bios_file)" 73587ea78b74SJan Kiszkadone 735989138857SStefan Weilfor test_file in $(find $source_path/tests/acpi-test-data -type f) 7360c2304b52SMarcel Apfelbaumdo 736189138857SStefan Weil FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')" 7362c2304b52SMarcel Apfelbaumdone 7363645d3cbeSSu Hangfor test_file in $(find $source_path/tests/hex-loader-check-data -type f) 7364645d3cbeSSu Hangdo 7365645d3cbeSSu Hang FILES="$FILES tests/hex-loader-check-data$(echo $test_file | sed -e 's/.*hex-loader-check-data//')" 7366645d3cbeSSu Hangdone 7367d1807a4fSPaolo Bonzinimkdir -p $DIRS 73687d13299dSbellardfor f in $FILES ; do 7369cab00a5aSMichael S. Tsirkin if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then 7370f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 7371f9245e10SPeter Maydell fi 73727d13299dSbellarddone 73731ad2134fSPaul Brook 7374c34ebfdcSAnthony Liguori# temporary config to build submodules 73752d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 7376c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 737737116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 7378c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 7379cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 73805f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 7381c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 7382c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 73833dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 7384c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 7385a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 7386c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 73879f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 7388c34ebfdcSAnthony Liguoridone 7389c34ebfdcSAnthony Liguori 7390fe31017fSMarc-André Lureau# set up tests data directory 73911b145d59SPhilippe Mathieu-Daudéfor tests_subdir in acceptance data; do 73921b145d59SPhilippe Mathieu-Daudé if [ ! -e tests/$tests_subdir ]; then 73931b145d59SPhilippe Mathieu-Daudé symlink "$source_path/tests/$tests_subdir" tests/$tests_subdir 7394fe31017fSMarc-André Lureau fi 73951b145d59SPhilippe Mathieu-Daudédone 7396fe31017fSMarc-André Lureau 739776c7560aSMax Reitz# set up qemu-iotests in this build directory 739876c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 739976c7560aSMax Reitziotests_check="tests/qemu-iotests/check" 740076c7560aSMax Reitz 740176c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 740276c7560aSMax Reitzecho >> "$iotests_common_env" 740376c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 740476c7560aSMax Reitz 740576c7560aSMax Reitzif [ ! -e "$iotests_check" ]; then 740676c7560aSMax Reitz symlink "$source_path/$iotests_check" "$iotests_check" 740776c7560aSMax Reitzfi 740876c7560aSMax Reitz 7409dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 7410dc655404SMichael S. Tsirkincat <<EOD >config.status 7411dc655404SMichael S. Tsirkin#!/bin/sh 7412dc655404SMichael S. Tsirkin# Generated by configure. 7413dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 7414dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 7415dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 7416dc655404SMichael S. TsirkinEOD 7417e811da7fSDaniel P. Berrangé 7418e811da7fSDaniel P. Berrangépreserve_env() { 7419e811da7fSDaniel P. Berrangé envname=$1 7420e811da7fSDaniel P. Berrangé 7421e811da7fSDaniel P. Berrangé eval envval=\$$envname 7422e811da7fSDaniel P. Berrangé 7423e811da7fSDaniel P. Berrangé if test -n "$envval" 7424e811da7fSDaniel P. Berrangé then 7425e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 7426e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 7427e811da7fSDaniel P. Berrangé else 7428e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 7429e811da7fSDaniel P. Berrangé fi 7430e811da7fSDaniel P. Berrangé} 7431e811da7fSDaniel P. Berrangé 7432e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 7433e811da7fSDaniel P. Berrangé# features/build target configure will detect 7434e811da7fSDaniel P. Berrangépreserve_env AR 7435e811da7fSDaniel P. Berrangépreserve_env AS 7436e811da7fSDaniel P. Berrangépreserve_env CC 7437e811da7fSDaniel P. Berrangépreserve_env CPP 7438e811da7fSDaniel P. Berrangépreserve_env CXX 7439e811da7fSDaniel P. Berrangépreserve_env INSTALL 7440e811da7fSDaniel P. Berrangépreserve_env LD 7441e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 7442e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 7443e811da7fSDaniel P. Berrangépreserve_env MAKE 7444e811da7fSDaniel P. Berrangépreserve_env NM 7445e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 7446e811da7fSDaniel P. Berrangépreserve_env PATH 7447e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 7448e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 7449e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 7450e811da7fSDaniel P. Berrangépreserve_env PYTHON 7451e811da7fSDaniel P. Berrangépreserve_env SDL_CONFIG 7452e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 7453e811da7fSDaniel P. Berrangépreserve_env SMBD 7454e811da7fSDaniel P. Berrangépreserve_env STRIP 7455e811da7fSDaniel P. Berrangépreserve_env WINDRES 7456e811da7fSDaniel P. Berrangé 7457dc655404SMichael S. Tsirkinprintf "exec" >>config.status 7458dc655404SMichael S. Tsirkinprintf " '%s'" "$0" "$@" >>config.status 7459cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 7460dc655404SMichael S. Tsirkinchmod +x config.status 7461dc655404SMichael S. Tsirkin 74628cd05ab6SPeter Maydellrm -r "$TMPDIR1" 7463