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 | \ 1983b6b7550SPaolo Bonzini ppc:ppc | ppcemb:ppc | ppc64:ppc | \ 1993b6b7550SPaolo Bonzini ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \ 2003b6b7550SPaolo Bonzini s390x:s390x) 2013b6b7550SPaolo Bonzini return 0 2023b6b7550SPaolo Bonzini ;; 2033b6b7550SPaolo Bonzini esac 2043b6b7550SPaolo Bonzini return 1 2053b6b7550SPaolo Bonzini} 2063b6b7550SPaolo Bonzini 2073b6b7550SPaolo Bonzinisupported_xen_target() { 2083b6b7550SPaolo Bonzini test "$xen" = "yes" || return 1 2093b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 210b5ed2e11SPaolo Bonzini # Only i386 and x86_64 provide the xenpv machine. 211b5ed2e11SPaolo Bonzini case "${1%-softmmu}" in 212b5ed2e11SPaolo Bonzini i386|x86_64) 2133b6b7550SPaolo Bonzini return 0 2143b6b7550SPaolo Bonzini ;; 2153b6b7550SPaolo Bonzini esac 2163b6b7550SPaolo Bonzini return 1 2173b6b7550SPaolo Bonzini} 2183b6b7550SPaolo Bonzini 219c97d6d2cSSergio Andres Gomez Del Realsupported_hvf_target() { 220c97d6d2cSSergio Andres Gomez Del Real test "$hvf" = "yes" || return 1 221c97d6d2cSSergio Andres Gomez Del Real glob "$1" "*-softmmu" || return 1 222c97d6d2cSSergio Andres Gomez Del Real case "${1%-softmmu}" in 223c97d6d2cSSergio Andres Gomez Del Real x86_64) 224c97d6d2cSSergio Andres Gomez Del Real return 0 225c97d6d2cSSergio Andres Gomez Del Real ;; 226c97d6d2cSSergio Andres Gomez Del Real esac 227c97d6d2cSSergio Andres Gomez Del Real return 1 228c97d6d2cSSergio Andres Gomez Del Real} 229c97d6d2cSSergio Andres Gomez Del Real 230d661d9a4SJustin Terry (VM)supported_whpx_target() { 231d661d9a4SJustin Terry (VM) test "$whpx" = "yes" || return 1 232d661d9a4SJustin Terry (VM) glob "$1" "*-softmmu" || return 1 233d661d9a4SJustin Terry (VM) case "${1%-softmmu}" in 234d661d9a4SJustin Terry (VM) i386|x86_64) 235d661d9a4SJustin Terry (VM) return 0 236d661d9a4SJustin Terry (VM) ;; 237d661d9a4SJustin Terry (VM) esac 238d661d9a4SJustin Terry (VM) return 1 239d661d9a4SJustin Terry (VM)} 240d661d9a4SJustin Terry (VM) 241d880a3baSPaolo Bonzinisupported_target() { 242d880a3baSPaolo Bonzini case "$1" in 243d880a3baSPaolo Bonzini *-softmmu) 244d880a3baSPaolo Bonzini ;; 245d880a3baSPaolo Bonzini *-linux-user) 246d880a3baSPaolo Bonzini if test "$linux" != "yes"; then 247d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a Linux host" 248d880a3baSPaolo Bonzini return 1 249d880a3baSPaolo Bonzini fi 250d880a3baSPaolo Bonzini ;; 251d880a3baSPaolo Bonzini *-bsd-user) 252d880a3baSPaolo Bonzini if test "$bsd" != "yes"; then 253d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a BSD host" 254d880a3baSPaolo Bonzini return 1 255d880a3baSPaolo Bonzini fi 256d880a3baSPaolo Bonzini ;; 257d880a3baSPaolo Bonzini *) 258d880a3baSPaolo Bonzini print_error "Invalid target name '$target'" 259d880a3baSPaolo Bonzini return 1 260d880a3baSPaolo Bonzini ;; 261d880a3baSPaolo Bonzini esac 262b3f6ea7eSPaolo Bonzini test "$tcg" = "yes" && return 0 263b3f6ea7eSPaolo Bonzini supported_kvm_target "$1" && return 0 264b3f6ea7eSPaolo Bonzini supported_xen_target "$1" && return 0 265b3f6ea7eSPaolo Bonzini supported_hax_target "$1" && return 0 266c97d6d2cSSergio Andres Gomez Del Real supported_hvf_target "$1" && return 0 267d661d9a4SJustin Terry (VM) supported_whpx_target "$1" && return 0 268b3f6ea7eSPaolo Bonzini print_error "TCG disabled, but hardware accelerator not available for '$target'" 269b3f6ea7eSPaolo Bonzini return 1 270d880a3baSPaolo Bonzini} 271d880a3baSPaolo Bonzini 272e9a3591fSChristian Borntraeger 273e9a3591fSChristian Borntraegerld_has() { 274e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 275e9a3591fSChristian Borntraeger} 276e9a3591fSChristian Borntraeger 2777d13299dSbellard# default parameters 27889138857SStefan Weilsource_path=$(dirname "$0") 2792ff6b91eSJuan Quintelacpu="" 280a31a8642SMichael S. Tsirkiniasl="iasl" 2811e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 28243ce4dfeSbellardstatic="no" 2837d13299dSbellardcross_prefix="" 2840c58ac1cSmalcaudio_drv_list="" 285b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 286b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 287e49d021eSPeter Maydellhost_cc="cc" 28873da375eSJuan Quintelalibs_softmmu="" 2893e2e0e6bSJuan Quintelalibs_tools="" 29067f86e8eSJuan Quintelaaudio_pt_int="" 291d5631638Smalcaudio_win_int="" 2922b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 293957f1f99SMichael Rothlibs_qga="" 2945bc62e01SGerd Hoffmanndebug_info="yes" 29563678e17SSteven Noonanstack_protector="" 296ac0df51dSaliguori 29792712822SDaniel P. Berrangeif test -e "$source_path/.git" 29892712822SDaniel P. Berrangethen 299f62bbee5SDaniel P. Berrange git_update=yes 30092712822SDaniel P. Berrange git_submodules="ui/keycodemapdb" 30192712822SDaniel P. Berrangeelse 302f62bbee5SDaniel P. Berrange git_update=no 303aef45d51SDaniel P. Berrange git_submodules="" 30492712822SDaniel P. Berrangefi 305cc84d63aSDaniel P. Berrangegit="git" 306ac0df51dSaliguori 307afb63ebdSStefan Weil# Don't accept a target_list environment variable. 308afb63ebdSStefan Weilunset target_list 309377529c0SPaolo Bonzini 310377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 311377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 312377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 313377529c0SPaolo Bonzini# unless --disable-foo is given 314377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 315377529c0SPaolo Bonzini# feature will searched for, 316377529c0SPaolo Bonzini# if not found, configure exits with error 317377529c0SPaolo Bonzini# 318377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 319377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 320377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 321377529c0SPaolo Bonzini 322377529c0SPaolo Bonzinibluez="" 323377529c0SPaolo Bonzinibrlapi="" 324377529c0SPaolo Bonzinicurl="" 325377529c0SPaolo Bonzinicurses="" 326377529c0SPaolo Bonzinidocs="" 327377529c0SPaolo Bonzinifdt="" 32858952137SVincenzo Maffionenetmap="no" 329377529c0SPaolo Bonzinisdl="" 330ee8466d0SCole Robinsonsdlabi="" 331983eef5aSMeador Ingevirtfs="" 332fe8fc5aeSPaolo Bonzinimpath="" 333821601eaSJes Sorensenvnc="yes" 334377529c0SPaolo Bonzinisparse="no" 335377529c0SPaolo Bonzinivde="" 336377529c0SPaolo Bonzinivnc_sasl="" 337377529c0SPaolo Bonzinivnc_jpeg="" 338377529c0SPaolo Bonzinivnc_png="" 3396a021536SGerd Hoffmannxkbcommon="" 340377529c0SPaolo Bonzinixen="" 341d5b93ddfSAnthony PERARDxen_ctrl_version="" 34264a7ad6fSIan Campbellxen_pv_domain_build="no" 343eb6fda0fSAnthony PERARDxen_pci_passthrough="" 344377529c0SPaolo Bonzinilinux_aio="" 34547e98658SCorey Bryantcap_ng="" 346377529c0SPaolo Bonziniattr="" 3474f26f2b6SAvi Kivitylibattr="" 348377529c0SPaolo Bonzinixfs="" 349b3f6ea7eSPaolo Bonzinitcg="yes" 350a40161cbSPaolo Bonzinimembarrier="" 351d41a75a2SBradvhost_net="no" 352042cea27SGongleivhost_crypto="no" 3535e9be92dSNicholas Bellingervhost_scsi="no" 354fc0b9b0eSStefan Hajnoczivhost_vsock="no" 355e6a74868SMarc-André Lureauvhost_user="" 356d41a75a2SBradkvm="no" 357b0cb0a66SVincent Palatinhax="no" 358c97d6d2cSSergio Andres Gomez Del Realhvf="no" 359d661d9a4SJustin Terry (VM)whpx="no" 3602da776dbSMichael R. Hinesrdma="" 361377529c0SPaolo Bonzinigprof="no" 362377529c0SPaolo Bonzinidebug_tcg="no" 363377529c0SPaolo Bonzinidebug="no" 364247724cbSMarc-André Lureausanitizers="no" 365b553a042SJohn Snowfortify_source="" 366377529c0SPaolo Bonzinistrip_opt="yes" 3679195b2c2SStefan Weiltcg_interpreter="no" 368377529c0SPaolo Bonzinibigendian="no" 369377529c0SPaolo Bonzinimingw32="no" 3701d728c39SBlue Swirlgcov="no" 3711d728c39SBlue Swirlgcov_tool="gcov" 372377529c0SPaolo BonziniEXESUF="" 37317969268SFam ZhengDSOSUF=".so" 37417969268SFam ZhengLDFLAGS_SHARED="-shared" 37517969268SFam Zhengmodules="no" 376377529c0SPaolo Bonziniprefix="/usr/local" 377377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 378528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 3793d5eecabSGerd Hoffmannfirmwarepath="\${prefix}/share/qemu-firmware" 380850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 381377529c0SPaolo Bonzinibindir="\${prefix}/bin" 3823aa5d2beSAlon Levylibdir="\${prefix}/lib" 3838bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 3840f94d6daSAlon Levyincludedir="\${prefix}/include" 385377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 386785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 387377529c0SPaolo Bonziniconfsuffix="/qemu" 388377529c0SPaolo Bonzinislirp="yes" 389377529c0SPaolo Bonzinioss_lib="" 390377529c0SPaolo Bonzinibsd="no" 391377529c0SPaolo Bonzinilinux="no" 392377529c0SPaolo Bonzinisolaris="no" 393377529c0SPaolo Bonziniprofiler="no" 394377529c0SPaolo Bonzinicocoa="no" 395377529c0SPaolo Bonzinisoftmmu="yes" 396377529c0SPaolo Bonzinilinux_user="no" 397377529c0SPaolo Bonzinibsd_user="no" 398377529c0SPaolo Bonziniblobs="yes" 399377529c0SPaolo Bonzinipkgversion="" 40040d6444eSAvi Kivitypie="" 4013556c233SPaolo Bonziniqom_cast_debug="yes" 402baf86d6bSPaolo Bonzinitrace_backends="log" 403377529c0SPaolo Bonzinitrace_file="trace" 404377529c0SPaolo Bonzinispice="" 405377529c0SPaolo Bonzinirbd="" 4067b02f544SMarc-André Lureausmartcard="" 4072b2325ffSGerd Hoffmannlibusb="" 40869354a83SHans de Goedeusb_redir="" 409da076ffeSGerd Hoffmannopengl="" 410014cb152SGerd Hoffmannopengl_dmabuf="no" 4115dd89908SRichard Hendersoncpuid_h="no" 41299f2dbd3SLiang Liavx2_opt="no" 4131ece9905SAlon Levyzlib="yes" 4148ca80760SRichard Hendersoncapstone="" 415b25c9dffSStefan Weillzo="" 416b25c9dffSStefan Weilsnappy="" 4176b383c08SPeter Wubzip2="" 418e8ef31a3SMichael Tokarevguest_agent="" 419d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 42050cbebb9SMichael Rothguest_agent_ntddscsi="no" 4219dacf32dSYossi Hindinguest_agent_msi="" 422d9840e25STomoki Sekiyamavss_win32_sdk="" 423d9840e25STomoki Sekiyamawin_sdk="no" 4244b1c11fdSDaniel P. Berrangewant_tools="yes" 425c589b249SRonnie Sahlberglibiscsi="" 4266542aa9cSPeter Lievenlibnfs="" 427519175a2SAlex Barcelocoroutine="" 42870c60c08SStefan Hajnoczicoroutine_pool="" 4297d992e4dSPeter Lievendebug_stack_usage="no" 430f0d92b56SLongpeng(Mike)crypto_afalg="no" 431f794573eSEduardo Otuboseccomp="" 432eb100396SBharata B Raoglusterfs="" 433d85fa9ebSJeff Codyglusterfs_xlator_opt="no" 4340c14fb47SBharata B Raoglusterfs_discard="no" 435df3a429aSNiels de Vosglusterfs_fallocate="no" 4367c815372SBharata B Raoglusterfs_zerofill="no" 437a4ccabcfSAnthony Liguorigtk="" 4389e04c683SStefan Weilgtkabi="" 439925a0400SGerd Hoffmanngtk_gl="no" 440a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 441ddbb0d09SDaniel P. Berrangegnutls="" 442b917da4cSDaniel P. Berrangegnutls_rnd="" 44391bfcdb0SDaniel P. Berrangenettle="" 444fff2f982SDaniel P. Berrangenettle_kdf="no" 44591bfcdb0SDaniel P. Berrangegcrypt="" 4461f923c70SLongpeng(Mike)gcrypt_hmac="no" 44737788f25SDaniel P. Berrangegcrypt_kdf="no" 448bbbf9bfbSStefan Weilvte="" 4499d9e1521SGerd Hoffmannvirglrenderer="" 450e91c793cSCole Robinsontpm="yes" 4510a12ec87SRichard W.M. Joneslibssh2="" 452ed1701c6SDr. David Alan Gilbertlive_block_migration="yes" 453a99d57bbSWanlong Gaonuma="" 4542847b469SFam Zhengtcmalloc="no" 4557b01cb97SAlexandre Derumierjemalloc="no" 456a6b1d4c0SChanglong Xiereplication="yes" 457da92c3ffSAshish Mittalvxhs="" 458ed279a06SKlim Kireevlibxml2="" 45951a12b51SAlex Bennéedocker="no" 460377529c0SPaolo Bonzini 461898be3e0SPeter Maydellsupported_cpu="no" 462898be3e0SPeter Maydellsupported_os="no" 463fb59dabdSPeter Maydellbogus_os="no" 4645a22ab71SYang Zhongmalloc_trim="" 465898be3e0SPeter Maydell 466ac0df51dSaliguori# parse CC options first 467ac0df51dSaliguorifor opt do 46889138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 469ac0df51dSaliguori case "$opt" in 470ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 471ac0df51dSaliguori ;; 4723d8df640SPaolo Bonzini --cc=*) CC="$optarg" 473ac0df51dSaliguori ;; 47483f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 47583f73fceSTomoki Sekiyama ;; 476ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 477ca4deeb1SPaolo Bonzini ;; 4782ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 4792ff6b91eSJuan Quintela ;; 480de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 481e2a2ed06SJuan Quintela ;; 48211cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 48311cde1c8SBruno Dominguez ;; 484a4969e90SAlex Bennée --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" 485f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 486e2a2ed06SJuan Quintela ;; 4875bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 4885bc62e01SGerd Hoffmann ;; 4895bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 4905bc62e01SGerd Hoffmann ;; 491ac0df51dSaliguori esac 492ac0df51dSaliguoridone 493ac0df51dSaliguori# OS specific 494ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 49593148aa5SStefan Weil# we can eliminate its usage altogether. 496ac0df51dSaliguori 497e49d021eSPeter Maydell# Preferred compiler: 498e49d021eSPeter Maydell# ${CC} (if set) 499e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 500e49d021eSPeter Maydell# system compiler 501e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 502e49d021eSPeter Maydell cc="$host_cc" 503e49d021eSPeter Maydellelse 504b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 505e49d021eSPeter Maydellfi 506e49d021eSPeter Maydell 50783f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 50883f73fceSTomoki Sekiyama cxx="c++" 50983f73fceSTomoki Sekiyamaelse 51083f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 51183f73fceSTomoki Sekiyamafi 51283f73fceSTomoki Sekiyama 513b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 514cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 5155f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 5163dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 517b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 518b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 5199f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 5204852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 521b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 522b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 52317884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 52417884d7bSSergei Trofimovichquery_pkg_config() { 52517884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 52617884d7bSSergei Trofimovich} 52717884d7bSSergei Trofimovichpkg_config=query_pkg_config 528b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 52947c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 530ac0df51dSaliguori 53145d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 53245d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 53345d285abSPeter Maydell 534be17dc90SMichael S. Tsirkin# default flags for all hosts 5352d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 5362d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 5372d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 5382d31515bSPeter Maydell# provides these semantics.) 5392d31515bSPeter MaydellQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 540f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 541c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 542be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 5439edc19c9SMichael S. TsirkinQEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include" 5445bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 5455bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 546be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 5475bc62e01SGerd Hoffmannfi 548be17dc90SMichael S. Tsirkin 549ca4deeb1SPaolo Bonzini# make source path absolute 55089138857SStefan Weilsource_path=$(cd "$source_path"; pwd) 551ca4deeb1SPaolo Bonzini 552cab00a5aSMichael S. Tsirkin# running configure in the source tree? 553cab00a5aSMichael S. Tsirkin# we know that's the case if configure is there. 554cab00a5aSMichael S. Tsirkinif test -f "./configure"; then 555cab00a5aSMichael S. Tsirkin pwd_is_source_path="y" 556cab00a5aSMichael S. Tsirkinelse 557cab00a5aSMichael S. Tsirkin pwd_is_source_path="n" 558cab00a5aSMichael S. Tsirkinfi 559cab00a5aSMichael S. Tsirkin 560ac0df51dSaliguoricheck_define() { 561ac0df51dSaliguoricat > $TMPC <<EOF 562ac0df51dSaliguori#if !defined($1) 563fd786e1aSPeter Maydell#error $1 not defined 564ac0df51dSaliguori#endif 565ac0df51dSaliguoriint main(void) { return 0; } 566ac0df51dSaliguoriEOF 56752166aa0SJuan Quintela compile_object 568ac0df51dSaliguori} 569ac0df51dSaliguori 570307119e7SGerd Hoffmanncheck_include() { 571307119e7SGerd Hoffmanncat > $TMPC <<EOF 572307119e7SGerd Hoffmann#include <$1> 573307119e7SGerd Hoffmannint main(void) { return 0; } 574307119e7SGerd HoffmannEOF 575307119e7SGerd Hoffmann compile_object 576307119e7SGerd Hoffmann} 577307119e7SGerd Hoffmann 57893b25869SJohn Snowwrite_c_skeleton() { 57993b25869SJohn Snow cat > $TMPC <<EOF 58093b25869SJohn Snowint main(void) { return 0; } 58193b25869SJohn SnowEOF 58293b25869SJohn Snow} 58393b25869SJohn Snow 584bbea4050SPeter Maydellif check_define __linux__ ; then 585bbea4050SPeter Maydell targetos="Linux" 586bbea4050SPeter Maydellelif check_define _WIN32 ; then 587bbea4050SPeter Maydell targetos='MINGW32' 588bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 589bbea4050SPeter Maydell targetos='OpenBSD' 590bbea4050SPeter Maydellelif check_define __sun__ ; then 591bbea4050SPeter Maydell targetos='SunOS' 592bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 593bbea4050SPeter Maydell targetos='Haiku' 594951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 595951fedfcSPeter Maydell targetos='FreeBSD' 596951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 597951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 598951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 599951fedfcSPeter Maydell targetos='DragonFly' 600951fedfcSPeter Maydellelif check_define __NetBSD__; then 601951fedfcSPeter Maydell targetos='NetBSD' 602951fedfcSPeter Maydellelif check_define __APPLE__; then 603951fedfcSPeter Maydell targetos='Darwin' 604bbea4050SPeter Maydellelse 605951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 606951fedfcSPeter Maydell # might be going to just print the --help text, or it might 607951fedfcSPeter Maydell # be the result of a missing compiler. 608951fedfcSPeter Maydell targetos='bogus' 609951fedfcSPeter Maydell bogus_os='yes' 610bbea4050SPeter Maydellfi 611bbea4050SPeter Maydell 612bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 613bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 614bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 615bbea4050SPeter Maydell# the correct CPU with the --cpu option. 616bbea4050SPeter Maydellcase $targetos in 617bbea4050SPeter MaydellDarwin) 618bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 619bbea4050SPeter Maydell # run 64-bit userspace code. 620bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 621bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 622bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 623bbea4050SPeter Maydell cpu="x86_64" 624bbea4050SPeter Maydell fi 625bbea4050SPeter Maydell ;; 626bbea4050SPeter MaydellSunOS) 62789138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 628bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 629bbea4050SPeter Maydell cpu="x86_64" 630bbea4050SPeter Maydell fi 631bbea4050SPeter Maydellesac 632bbea4050SPeter Maydell 6332ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 6342ff6b91eSJuan Quintela # command line argument 6352ff6b91eSJuan Quintela : 6362ff6b91eSJuan Quintelaelif check_define __i386__ ; then 637ac0df51dSaliguori cpu="i386" 638ac0df51dSaliguorielif check_define __x86_64__ ; then 639c72b26ecSRichard Henderson if check_define __ILP32__ ; then 640c72b26ecSRichard Henderson cpu="x32" 641c72b26ecSRichard Henderson else 642ac0df51dSaliguori cpu="x86_64" 643c72b26ecSRichard Henderson fi 6443aa9bd6cSblueswir1elif check_define __sparc__ ; then 6453aa9bd6cSblueswir1 if check_define __arch64__ ; then 6463aa9bd6cSblueswir1 cpu="sparc64" 6473aa9bd6cSblueswir1 else 6483aa9bd6cSblueswir1 cpu="sparc" 6493aa9bd6cSblueswir1 fi 650fdf7ed96Smalcelif check_define _ARCH_PPC ; then 651fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 652fdf7ed96Smalc cpu="ppc64" 653ac0df51dSaliguori else 654fdf7ed96Smalc cpu="ppc" 655fdf7ed96Smalc fi 656afa05235SAurelien Jarnoelif check_define __mips__ ; then 657afa05235SAurelien Jarno cpu="mips" 658d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 659d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 660d66ed0eaSAurelien Jarno cpu="s390x" 661d66ed0eaSAurelien Jarno else 662d66ed0eaSAurelien Jarno cpu="s390" 663d66ed0eaSAurelien Jarno fi 66421d89f84SPeter Maydellelif check_define __arm__ ; then 66521d89f84SPeter Maydell cpu="arm" 6661f080313SClaudio Fontanaelif check_define __aarch64__ ; then 6671f080313SClaudio Fontana cpu="aarch64" 668fdf7ed96Smalcelse 66989138857SStefan Weil cpu=$(uname -m) 670ac0df51dSaliguorifi 671ac0df51dSaliguori 672359bc95dSPeter MaydellARCH= 673359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 674359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 6757d13299dSbellardcase "$cpu" in 6766499fd15SPeter Maydell ppc|ppc64|s390|s390x|sparc64|x32) 677898be3e0SPeter Maydell cpu="$cpu" 678898be3e0SPeter Maydell supported_cpu="yes" 679898be3e0SPeter Maydell ;; 6807d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 68197a847bcSbellard cpu="i386" 682898be3e0SPeter Maydell supported_cpu="yes" 6837d13299dSbellard ;; 684aaa5fa14Saurel32 x86_64|amd64) 685aaa5fa14Saurel32 cpu="x86_64" 686898be3e0SPeter Maydell supported_cpu="yes" 687aaa5fa14Saurel32 ;; 68821d89f84SPeter Maydell armv*b|armv*l|arm) 68921d89f84SPeter Maydell cpu="arm" 690898be3e0SPeter Maydell supported_cpu="yes" 6917d13299dSbellard ;; 6921f080313SClaudio Fontana aarch64) 6931f080313SClaudio Fontana cpu="aarch64" 694898be3e0SPeter Maydell supported_cpu="yes" 6951f080313SClaudio Fontana ;; 696afa05235SAurelien Jarno mips*) 697afa05235SAurelien Jarno cpu="mips" 698898be3e0SPeter Maydell supported_cpu="yes" 699afa05235SAurelien Jarno ;; 7003142255cSblueswir1 sparc|sun4[cdmuv]) 701ae228531Sbellard cpu="sparc" 7026499fd15SPeter Maydell supported_cpu="yes" 703ae228531Sbellard ;; 7047d13299dSbellard *) 705359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 706359bc95dSPeter Maydell ARCH=unknown 7077d13299dSbellard ;; 7087d13299dSbellardesac 709359bc95dSPeter Maydellif test -z "$ARCH"; then 710359bc95dSPeter Maydell ARCH="$cpu" 711359bc95dSPeter Maydellfi 712e2d52ad3SJuan Quintela 7137d13299dSbellard# OS specific 7140dbfc675SJuan Quintela 715adfc3e91SStacey Son# host *BSD for user mode 716adfc3e91SStacey SonHOST_VARIANT_DIR="" 717adfc3e91SStacey Son 7187d13299dSbellardcase $targetos in 71967b915a5SbellardMINGW32*) 72067b915a5Sbellard mingw32="yes" 721b0cb0a66SVincent Palatin hax="yes" 7223cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 723307119e7SGerd Hoffmann if check_include dsound.h; then 7243cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 725307119e7SGerd Hoffmann else 726307119e7SGerd Hoffmann audio_drv_list="" 727307119e7SGerd Hoffmann fi 728898be3e0SPeter Maydell supported_os="yes" 72967b915a5Sbellard;; 7305c40d2bdSthsGNU/kFreeBSD) 731a167ba50SAurelien Jarno bsd="yes" 7320c58ac1cSmalc audio_drv_list="oss" 7330bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 7345c40d2bdSths;; 7357d3505c5SbellardFreeBSD) 7367d3505c5Sbellard bsd="yes" 7370db4a067SPaolo Bonzini make="${MAKE-gmake}" 7380c58ac1cSmalc audio_drv_list="oss" 7390bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 740f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 741f01576f1SJuergen Lock LIBS="-lutil $LIBS" 742a7764f15SEd Maste # needed for kinfo_getproc 743a7764f15SEd Maste libs_qga="-lutil $libs_qga" 74458952137SVincenzo Maffione netmap="" # enable netmap autodetect 745adfc3e91SStacey Son HOST_VARIANT_DIR="freebsd" 746898be3e0SPeter Maydell supported_os="yes" 7477d3505c5Sbellard;; 748c5e97233Sblueswir1DragonFly) 749c5e97233Sblueswir1 bsd="yes" 7500db4a067SPaolo Bonzini make="${MAKE-gmake}" 751c5e97233Sblueswir1 audio_drv_list="oss" 7520bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 753adfc3e91SStacey Son HOST_VARIANT_DIR="dragonfly" 754c5e97233Sblueswir1;; 7557d3505c5SbellardNetBSD) 7567d3505c5Sbellard bsd="yes" 7570db4a067SPaolo Bonzini make="${MAKE-gmake}" 7580c58ac1cSmalc audio_drv_list="oss" 7590bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 7608ef92a88Sblueswir1 oss_lib="-lossaudio" 761adfc3e91SStacey Son HOST_VARIANT_DIR="netbsd" 7623c2bdbc1SKamil Rytarowski supported_os="yes" 7637d3505c5Sbellard;; 7647d3505c5SbellardOpenBSD) 7657d3505c5Sbellard bsd="yes" 7660db4a067SPaolo Bonzini make="${MAKE-gmake}" 7674f6ab397SBrad Smith audio_drv_list="sdl" 7680bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 769adfc3e91SStacey Son HOST_VARIANT_DIR="openbsd" 7700a773d55SBrad Smith supported_os="yes" 7717d3505c5Sbellard;; 77283fb7adfSbellardDarwin) 77383fb7adfSbellard bsd="yes" 77483fb7adfSbellard darwin="yes" 775b0cb0a66SVincent Palatin hax="yes" 776c97d6d2cSSergio Andres Gomez Del Real hvf="yes" 77717969268SFam Zheng LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 7781b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 779a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 7800c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 7811b0f9cc2Saliguori fi 782fd677642Sths cocoa="yes" 7830c58ac1cSmalc audio_drv_list="coreaudio" 78414382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 7850c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 7867973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 787a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 788a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 789a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 790adfc3e91SStacey Son HOST_VARIANT_DIR="darwin" 791898be3e0SPeter Maydell supported_os="yes" 79283fb7adfSbellard;; 793ec530c81SbellardSunOS) 794ec530c81Sbellard solaris="yes" 7950db4a067SPaolo Bonzini make="${MAKE-gmake}" 7960db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 797e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 7986b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 7990c58ac1cSmalc audio_drv_list="oss" 8006b4d2ba1Sths fi 801c2de5c91Smalc audio_possible_drivers="oss sdl" 802d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 803d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 804d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 805d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 806a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 807560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 808560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 809560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 810ec530c81Sbellard;; 811179cf400SAndreas FärberHaiku) 812179cf400SAndreas Färber haiku="yes" 813179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 814179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 815179cf400SAndreas Färber;; 816898be3e0SPeter MaydellLinux) 8170c58ac1cSmalc audio_drv_list="oss" 8180bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 8195327cf48Sbellard linux="yes" 820831b7825Sths linux_user="yes" 821af2be207SJan Kiszka kvm="yes" 822af2be207SJan Kiszka vhost_net="yes" 823042cea27SGonglei vhost_crypto="yes" 8245e9be92dSNicholas Bellinger vhost_scsi="yes" 825fc0b9b0eSStefan Hajnoczi vhost_vsock="yes" 826a585140dSAlexey Kardashevskiy QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" 827898be3e0SPeter Maydell supported_os="yes" 828898be3e0SPeter Maydell;; 8297d13299dSbellardesac 8307d13299dSbellard 8317d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 832b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 83384778508Sblueswir1 bsd_user="yes" 8347d3505c5Sbellard fi 83508de3949SAndreas Färberfi 8367d3505c5Sbellard 8370db4a067SPaolo Bonzini: ${make=${MAKE-make}} 8380db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 83952510f8bSStefan Weil: ${python=${PYTHON-python}} 840e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 8410db4a067SPaolo Bonzini 8423c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 8433c4a4d0dSPeter Maydellif has clang; then 8443c4a4d0dSPeter Maydell objcc=clang 8453c4a4d0dSPeter Maydellelse 8463c4a4d0dSPeter Maydell objcc="$cc" 8473c4a4d0dSPeter Maydellfi 8483c4a4d0dSPeter Maydell 8493457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 8503457a3f8SJuan Quintela EXESUF=".exe" 85117969268SFam Zheng DSOSUF=".dll" 852a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 853e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 854e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 85578e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 85678e9d4adSStefan Weil QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" 857f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 85893b25869SJohn Snow write_c_skeleton; 859f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 860f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 861f7cf5d5bSStefan Weil fi 862c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 863683035deSPaolo Bonzini mandir="\${prefix}" 864528ae5b8SEduardo Habkost datadir="\${prefix}" 865850da188SEduardo Habkost qemu_docdir="\${prefix}" 866683035deSPaolo Bonzini bindir="\${prefix}" 867683035deSPaolo Bonzini sysconfdir="\${prefix}" 8685a699bbbSLaszlo Ersek local_statedir= 869683035deSPaolo Bonzini confsuffix="" 870105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 8713457a3f8SJuan Quintelafi 8723457a3f8SJuan Quintela 873487fefdbSAnthony Liguoriwerror="" 87485aa5189Sbellard 8757d13299dSbellardfor opt do 87689138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 8777d13299dSbellard case "$opt" in 8782efc3265Sbellard --help|-h) show_help=yes 8792efc3265Sbellard ;; 88099123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 88199123e13SMike Frysinger ;; 882b1a550a0Spbrook --prefix=*) prefix="$optarg" 8837d13299dSbellard ;; 884b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 88532ce6337Sbellard ;; 886ca4deeb1SPaolo Bonzini --source-path=*) 8877d13299dSbellard ;; 888ac0df51dSaliguori --cross-prefix=*) 8897d13299dSbellard ;; 890ac0df51dSaliguori --cc=*) 8917d13299dSbellard ;; 892b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 89383469015Sbellard ;; 89483f73fceSTomoki Sekiyama --cxx=*) 89583f73fceSTomoki Sekiyama ;; 896e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 897e007dbecSMichael S. Tsirkin ;; 8983c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 8993c4a4d0dSPeter Maydell ;; 900b1a550a0Spbrook --make=*) make="$optarg" 9017d13299dSbellard ;; 9026a882643Spbrook --install=*) install="$optarg" 9036a882643Spbrook ;; 904c886edfbSBlue Swirl --python=*) python="$optarg" 905c886edfbSBlue Swirl ;; 9061d728c39SBlue Swirl --gcov=*) gcov_tool="$optarg" 9071d728c39SBlue Swirl ;; 908e2d8830eSBrad --smbd=*) smbd="$optarg" 909e2d8830eSBrad ;; 910e2a2ed06SJuan Quintela --extra-cflags=*) 9117d13299dSbellard ;; 91211cde1c8SBruno Dominguez --extra-cxxflags=*) 91311cde1c8SBruno Dominguez ;; 914e2a2ed06SJuan Quintela --extra-ldflags=*) 9157d13299dSbellard ;; 9165bc62e01SGerd Hoffmann --enable-debug-info) 9175bc62e01SGerd Hoffmann ;; 9185bc62e01SGerd Hoffmann --disable-debug-info) 9195bc62e01SGerd Hoffmann ;; 92017969268SFam Zheng --enable-modules) 92117969268SFam Zheng modules="yes" 92217969268SFam Zheng ;; 9233aa88b31SStefan Hajnoczi --disable-modules) 9243aa88b31SStefan Hajnoczi modules="no" 9253aa88b31SStefan Hajnoczi ;; 9262ff6b91eSJuan Quintela --cpu=*) 9277d13299dSbellard ;; 928b1a550a0Spbrook --target-list=*) target_list="$optarg" 929de83cd02Sbellard ;; 9305b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 9315b808275SLluís Vilanova ;; 9325b808275SLluís Vilanova # XXX: backwards compatibility 9335b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 93494a420b1SStefan Hajnoczi ;; 93574242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 9369410b56cSPrerna Saxena ;; 9377d13299dSbellard --enable-gprof) gprof="yes" 9387d13299dSbellard ;; 9391d728c39SBlue Swirl --enable-gcov) gcov="yes" 9401d728c39SBlue Swirl ;; 94179427693SLoïc Minier --static) 94279427693SLoïc Minier static="yes" 94379427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 94417884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 94543ce4dfeSbellard ;; 9460b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 9470b24e75fSPaolo Bonzini ;; 9480b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 9490b24e75fSPaolo Bonzini ;; 9503aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 9513aa5d2beSAlon Levy ;; 9528bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 9538bf188aaSMichael Tokarev ;; 9540f94d6daSAlon Levy --includedir=*) includedir="$optarg" 9550f94d6daSAlon Levy ;; 956528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 9570b24e75fSPaolo Bonzini ;; 958023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 959023d3d67SEduardo Habkost ;; 960850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 9610b24e75fSPaolo Bonzini ;; 962ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 96307381cc1SAnthony Liguori ;; 964785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 965785c23aeSLuiz Capitulino ;; 9663d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 9673d5eecabSGerd Hoffmann ;; 968181ce1d0SOlaf Hering --host=*|--build=*|\ 969181ce1d0SOlaf Hering --disable-dependency-tracking|\ 970785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 971023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 972023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 973023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 974023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 975023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 976023ddd74SMax Filippov # lots of directory switches by default. 977023ddd74SMax Filippov ;; 97897a847bcSbellard --disable-sdl) sdl="no" 97997a847bcSbellard ;; 980c4198157SJuan Quintela --enable-sdl) sdl="yes" 981c4198157SJuan Quintela ;; 98247c03744SDave Airlie --with-sdlabi=*) sdlabi="$optarg" 98347c03744SDave Airlie ;; 9843556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 9853556c233SPaolo Bonzini ;; 9863556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 9873556c233SPaolo Bonzini ;; 988983eef5aSMeador Inge --disable-virtfs) virtfs="no" 989983eef5aSMeador Inge ;; 990983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 991983eef5aSMeador Inge ;; 992fe8fc5aeSPaolo Bonzini --disable-mpath) mpath="no" 993fe8fc5aeSPaolo Bonzini ;; 994fe8fc5aeSPaolo Bonzini --enable-mpath) mpath="yes" 995fe8fc5aeSPaolo Bonzini ;; 996821601eaSJes Sorensen --disable-vnc) vnc="no" 997821601eaSJes Sorensen ;; 998821601eaSJes Sorensen --enable-vnc) vnc="yes" 999821601eaSJes Sorensen ;; 10002f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 10012f6a1ab0Sblueswir1 ;; 10020c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 10030c58ac1cSmalc ;; 100489138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1005b64ec4e4SFam Zheng ;; 100689138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1007eb852011SMarkus Armbruster ;; 1008f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 1009f8393946Saurel32 ;; 1010f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 1011f8393946Saurel32 ;; 1012f3d08ee6SPaul Brook --enable-debug) 1013f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 1014f3d08ee6SPaul Brook debug_tcg="yes" 1015f3d08ee6SPaul Brook debug="yes" 1016f3d08ee6SPaul Brook strip_opt="no" 1017b553a042SJohn Snow fortify_source="no" 1018f3d08ee6SPaul Brook ;; 1019247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1020247724cbSMarc-André Lureau ;; 1021247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1022247724cbSMarc-André Lureau ;; 102303b4fe7dSaliguori --enable-sparse) sparse="yes" 102403b4fe7dSaliguori ;; 102503b4fe7dSaliguori --disable-sparse) sparse="no" 102603b4fe7dSaliguori ;; 10271625af87Saliguori --disable-strip) strip_opt="no" 10281625af87Saliguori ;; 10292f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 10302f9606b3Saliguori ;; 1031ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 1032ea784e3bSJuan Quintela ;; 10332f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 10342f6f5c7aSCorentin Chary ;; 10352f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 10362f6f5c7aSCorentin Chary ;; 1037efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 1038efe556adSCorentin Chary ;; 1039efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 1040efe556adSCorentin Chary ;; 1041443f1376Sbellard --disable-slirp) slirp="no" 1042c20709aaSbellard ;; 1043e0e6c8c0Saliguori --disable-vde) vde="no" 10448a16d273Sths ;; 1045dfb278bdSJuan Quintela --enable-vde) vde="yes" 1046dfb278bdSJuan Quintela ;; 104758952137SVincenzo Maffione --disable-netmap) netmap="no" 104858952137SVincenzo Maffione ;; 104958952137SVincenzo Maffione --enable-netmap) netmap="yes" 105058952137SVincenzo Maffione ;; 1051e37630caSaliguori --disable-xen) xen="no" 1052e37630caSaliguori ;; 1053fc321b4bSJuan Quintela --enable-xen) xen="yes" 1054fc321b4bSJuan Quintela ;; 1055eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 1056eb6fda0fSAnthony PERARD ;; 1057eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 1058eb6fda0fSAnthony PERARD ;; 105964a7ad6fSIan Campbell --disable-xen-pv-domain-build) xen_pv_domain_build="no" 106064a7ad6fSIan Campbell ;; 106164a7ad6fSIan Campbell --enable-xen-pv-domain-build) xen_pv_domain_build="yes" 106264a7ad6fSIan Campbell ;; 10632e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 10642e4d9fb1Saurel32 ;; 10654ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 10664ffcedb6SJuan Quintela ;; 1067fb599c9aSbalrog --disable-bluez) bluez="no" 1068fb599c9aSbalrog ;; 1069a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 1070a20a6f46SJuan Quintela ;; 10717ba1e619Saliguori --disable-kvm) kvm="no" 10727ba1e619Saliguori ;; 1073b31a0277SJuan Quintela --enable-kvm) kvm="yes" 1074b31a0277SJuan Quintela ;; 1075b0cb0a66SVincent Palatin --disable-hax) hax="no" 1076180fb750Szhanghailiang ;; 1077b0cb0a66SVincent Palatin --enable-hax) hax="yes" 1078180fb750Szhanghailiang ;; 1079c97d6d2cSSergio Andres Gomez Del Real --disable-hvf) hvf="no" 1080c97d6d2cSSergio Andres Gomez Del Real ;; 1081c97d6d2cSSergio Andres Gomez Del Real --enable-hvf) hvf="yes" 1082c97d6d2cSSergio Andres Gomez Del Real ;; 1083d661d9a4SJustin Terry (VM) --disable-whpx) whpx="no" 1084d661d9a4SJustin Terry (VM) ;; 1085d661d9a4SJustin Terry (VM) --enable-whpx) whpx="yes" 1086d661d9a4SJustin Terry (VM) ;; 10879195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 10889195b2c2SStefan Weil ;; 10899195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 10909195b2c2SStefan Weil ;; 109147e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 109247e98658SCorey Bryant ;; 109347e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 109447e98658SCorey Bryant ;; 1095b3f6ea7eSPaolo Bonzini --disable-tcg) tcg="no" 1096b3f6ea7eSPaolo Bonzini ;; 1097b3f6ea7eSPaolo Bonzini --enable-tcg) tcg="yes" 1098b3f6ea7eSPaolo Bonzini ;; 10995a22ab71SYang Zhong --disable-malloc-trim) malloc_trim="no" 11005a22ab71SYang Zhong ;; 11015a22ab71SYang Zhong --enable-malloc-trim) malloc_trim="yes" 11025a22ab71SYang Zhong ;; 1103cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1104cd4ec0b4SGerd Hoffmann ;; 1105cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 1106cd4ec0b4SGerd Hoffmann ;; 1107c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 1108c589b249SRonnie Sahlberg ;; 1109c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 1110c589b249SRonnie Sahlberg ;; 11116542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 11126542aa9cSPeter Lieven ;; 11136542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 11146542aa9cSPeter Lieven ;; 111505c2a3e7Sbellard --enable-profiler) profiler="yes" 111605c2a3e7Sbellard ;; 111714821030SPavel Borzenkov --disable-cocoa) cocoa="no" 111814821030SPavel Borzenkov ;; 1119c2de5c91Smalc --enable-cocoa) 1120c2de5c91Smalc cocoa="yes" ; 112189138857SStefan Weil audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 11225b0753e0Sbellard ;; 1123cad25d69Spbrook --disable-system) softmmu="no" 11240a8e90f4Spbrook ;; 1125cad25d69Spbrook --enable-system) softmmu="yes" 11260a8e90f4Spbrook ;; 11270953a80fSZachary Amsden --disable-user) 11280953a80fSZachary Amsden linux_user="no" ; 11290953a80fSZachary Amsden bsd_user="no" ; 11300953a80fSZachary Amsden ;; 11310953a80fSZachary Amsden --enable-user) ;; 1132831b7825Sths --disable-linux-user) linux_user="no" 11330a8e90f4Spbrook ;; 1134831b7825Sths --enable-linux-user) linux_user="yes" 1135831b7825Sths ;; 113684778508Sblueswir1 --disable-bsd-user) bsd_user="no" 113784778508Sblueswir1 ;; 113884778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 113984778508Sblueswir1 ;; 114040d6444eSAvi Kivity --enable-pie) pie="yes" 114134005a00SKirill A. Shutemov ;; 114240d6444eSAvi Kivity --disable-pie) pie="no" 114334005a00SKirill A. Shutemov ;; 114485aa5189Sbellard --enable-werror) werror="yes" 114585aa5189Sbellard ;; 114685aa5189Sbellard --disable-werror) werror="no" 114785aa5189Sbellard ;; 114863678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 114963678e17SSteven Noonan ;; 115063678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 115163678e17SSteven Noonan ;; 11524d3b6f6eSbalrog --disable-curses) curses="no" 11534d3b6f6eSbalrog ;; 1154c584a6d0SJuan Quintela --enable-curses) curses="yes" 1155c584a6d0SJuan Quintela ;; 1156769ce76dSAlexander Graf --disable-curl) curl="no" 1157769ce76dSAlexander Graf ;; 1158788c8196SJuan Quintela --enable-curl) curl="yes" 1159788c8196SJuan Quintela ;; 11602df87df7SJuan Quintela --disable-fdt) fdt="no" 11612df87df7SJuan Quintela ;; 11622df87df7SJuan Quintela --enable-fdt) fdt="yes" 11632df87df7SJuan Quintela ;; 11645c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 11655c6c3a6cSChristoph Hellwig ;; 11665c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 11675c6c3a6cSChristoph Hellwig ;; 1168758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 1169758e8e38SVenkateswararao Jujjuri (JV) ;; 1170758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 1171758e8e38SVenkateswararao Jujjuri (JV) ;; 1172a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1173a40161cbSPaolo Bonzini ;; 1174a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1175a40161cbSPaolo Bonzini ;; 117677755340Sths --disable-blobs) blobs="no" 117777755340Sths ;; 11787e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 11794a19f1ecSpbrook ;; 1180519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1181519175a2SAlex Barcelo ;; 118270c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 118370c60c08SStefan Hajnoczi ;; 118470c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 118570c60c08SStefan Hajnoczi ;; 11867d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 11877d992e4dSPeter Lieven ;; 1188f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1189f0d92b56SLongpeng(Mike) ;; 1190f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1191f0d92b56SLongpeng(Mike) ;; 1192a25dba17SJuan Quintela --disable-docs) docs="no" 119370ec5dc0SAnthony Liguori ;; 1194a25dba17SJuan Quintela --enable-docs) docs="yes" 119583a3ab8bSJuan Quintela ;; 1196d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1197d5970055SMichael S. Tsirkin ;; 1198d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1199d5970055SMichael S. Tsirkin ;; 1200042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1201042cea27SGonglei ;; 1202042cea27SGonglei --enable-vhost-crypto) 1203042cea27SGonglei vhost_crypto="yes" 1204042cea27SGonglei if test "$mingw32" = "yes"; then 1205042cea27SGonglei error_exit "vhost-crypto isn't available on win32" 1206042cea27SGonglei fi 1207042cea27SGonglei ;; 12085e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 12095e9be92dSNicholas Bellinger ;; 12105e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 12115e9be92dSNicholas Bellinger ;; 1212fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1213fc0b9b0eSStefan Hajnoczi ;; 1214fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1215fc0b9b0eSStefan Hajnoczi ;; 1216da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 121720ff075bSMichael Walle ;; 1218da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 121920ff075bSMichael Walle ;; 1220f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1221f27aaf4bSChristian Brunner ;; 1222f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1223f27aaf4bSChristian Brunner ;; 12248c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 12258c84cf11SSergei Trofimovich ;; 12268c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 12278c84cf11SSergei Trofimovich ;; 12287b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1229111a38b0SRobert Relyea ;; 12307b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1231111a38b0SRobert Relyea ;; 12322b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 12332b2325ffSGerd Hoffmann ;; 12342b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 12352b2325ffSGerd Hoffmann ;; 123669354a83SHans de Goede --disable-usb-redir) usb_redir="no" 123769354a83SHans de Goede ;; 123869354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 123969354a83SHans de Goede ;; 12401ece9905SAlon Levy --disable-zlib-test) zlib="no" 12411ece9905SAlon Levy ;; 1242b25c9dffSStefan Weil --disable-lzo) lzo="no" 1243b25c9dffSStefan Weil ;; 1244607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1245607dacd0Sqiaonuohan ;; 1246b25c9dffSStefan Weil --disable-snappy) snappy="no" 1247b25c9dffSStefan Weil ;; 1248607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1249607dacd0Sqiaonuohan ;; 12506b383c08SPeter Wu --disable-bzip2) bzip2="no" 12516b383c08SPeter Wu ;; 12526b383c08SPeter Wu --enable-bzip2) bzip2="yes" 12536b383c08SPeter Wu ;; 1254d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1255d138cee9SMichael Roth ;; 1256d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1257d138cee9SMichael Roth ;; 12589dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 12599dacf32dSYossi Hindin ;; 12609dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 12619dacf32dSYossi Hindin ;; 1262d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1263d9840e25STomoki Sekiyama ;; 1264d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1265d9840e25STomoki Sekiyama ;; 1266d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1267d9840e25STomoki Sekiyama ;; 1268d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1269d9840e25STomoki Sekiyama ;; 1270d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1271d9840e25STomoki Sekiyama ;; 1272d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1273d9840e25STomoki Sekiyama ;; 12744b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 12754b1c11fdSDaniel P. Berrange ;; 12764b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 12774b1c11fdSDaniel P. Berrange ;; 1278f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1279f794573eSEduardo Otubo ;; 1280f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1281f794573eSEduardo Otubo ;; 1282eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1283eb100396SBharata B Rao ;; 1284eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1285eb100396SBharata B Rao ;; 128652b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 128752b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1288583f6e7bSStefan Hajnoczi ;; 1289cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1290cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1291cb6414dfSFam Zheng ;; 1292315d3184SFam Zheng --enable-uuid|--disable-uuid) 1293315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1294315d3184SFam Zheng ;; 1295a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1296a4ccabcfSAnthony Liguori ;; 1297a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1298a4ccabcfSAnthony Liguori ;; 1299a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1300a1c5e949SDaniel P. Berrange ;; 1301ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1302ddbb0d09SDaniel P. Berrange ;; 1303ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1304ddbb0d09SDaniel P. Berrange ;; 130591bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 130691bfcdb0SDaniel P. Berrange ;; 130791bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 130891bfcdb0SDaniel P. Berrange ;; 130991bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 131091bfcdb0SDaniel P. Berrange ;; 131191bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 131291bfcdb0SDaniel P. Berrange ;; 13132da776dbSMichael R. Hines --enable-rdma) rdma="yes" 13142da776dbSMichael R. Hines ;; 13152da776dbSMichael R. Hines --disable-rdma) rdma="no" 13162da776dbSMichael R. Hines ;; 1317528de90aSDaniel P. Berrange --with-gtkabi=*) gtkabi="$optarg" 1318528de90aSDaniel P. Berrange ;; 1319bbbf9bfbSStefan Weil --disable-vte) vte="no" 1320bbbf9bfbSStefan Weil ;; 1321bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1322bbbf9bfbSStefan Weil ;; 13239d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 13249d9e1521SGerd Hoffmann ;; 13259d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 13269d9e1521SGerd Hoffmann ;; 1327e91c793cSCole Robinson --disable-tpm) tpm="no" 1328e91c793cSCole Robinson ;; 1329ab214c29SStefan Berger --enable-tpm) tpm="yes" 1330ab214c29SStefan Berger ;; 13310a12ec87SRichard W.M. Jones --disable-libssh2) libssh2="no" 13320a12ec87SRichard W.M. Jones ;; 13330a12ec87SRichard W.M. Jones --enable-libssh2) libssh2="yes" 13340a12ec87SRichard W.M. Jones ;; 1335ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1336ed1701c6SDr. David Alan Gilbert ;; 1337ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1338ed1701c6SDr. David Alan Gilbert ;; 1339a99d57bbSWanlong Gao --disable-numa) numa="no" 1340a99d57bbSWanlong Gao ;; 1341a99d57bbSWanlong Gao --enable-numa) numa="yes" 1342a99d57bbSWanlong Gao ;; 1343ed279a06SKlim Kireev --disable-libxml2) libxml2="no" 1344ed279a06SKlim Kireev ;; 1345ed279a06SKlim Kireev --enable-libxml2) libxml2="yes" 1346ed279a06SKlim Kireev ;; 13472847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 13482847b469SFam Zheng ;; 13492847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 13502847b469SFam Zheng ;; 13517b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 13527b01cb97SAlexandre Derumier ;; 13537b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 13547b01cb97SAlexandre Derumier ;; 1355a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1356a6b1d4c0SChanglong Xie ;; 1357a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1358a6b1d4c0SChanglong Xie ;; 1359da92c3ffSAshish Mittal --disable-vxhs) vxhs="no" 1360da92c3ffSAshish Mittal ;; 1361da92c3ffSAshish Mittal --enable-vxhs) vxhs="yes" 1362da92c3ffSAshish Mittal ;; 1363e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1364e6a74868SMarc-André Lureau ;; 1365e6a74868SMarc-André Lureau --enable-vhost-user) 1366e6a74868SMarc-André Lureau vhost_user="yes" 1367e6a74868SMarc-André Lureau if test "$mingw32" = "yes"; then 1368e6a74868SMarc-André Lureau error_exit "vhost-user isn't available on win32" 1369e6a74868SMarc-André Lureau fi 1370e6a74868SMarc-André Lureau ;; 13718ca80760SRichard Henderson --disable-capstone) capstone="no" 13728ca80760SRichard Henderson ;; 13738ca80760SRichard Henderson --enable-capstone) capstone="yes" 13748ca80760SRichard Henderson ;; 1375e219c499SRichard Henderson --enable-capstone=git) capstone="git" 1376e219c499SRichard Henderson ;; 1377e219c499SRichard Henderson --enable-capstone=system) capstone="system" 1378e219c499SRichard Henderson ;; 1379cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1380cc84d63aSDaniel P. Berrange ;; 1381f62bbee5SDaniel P. Berrange --enable-git-update) git_update=yes 1382f62bbee5SDaniel P. Berrange ;; 1383f62bbee5SDaniel P. Berrange --disable-git-update) git_update=no 1384f62bbee5SDaniel P. Berrange ;; 13852d2ad6d0SFam Zheng *) 13862d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 13872d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 13882d2ad6d0SFam Zheng exit 1 13897f1559c6Sbalrog ;; 13907d13299dSbellard esac 13917d13299dSbellarddone 13927d13299dSbellard 1393e6a74868SMarc-André Lureauif test "$vhost_user" = ""; then 1394e6a74868SMarc-André Lureau if test "$mingw32" = "yes"; then 1395e6a74868SMarc-André Lureau vhost_user="no" 1396e6a74868SMarc-André Lureau else 1397e6a74868SMarc-André Lureau vhost_user="yes" 1398e6a74868SMarc-André Lureau fi 1399e6a74868SMarc-André Lureaufi 1400e6a74868SMarc-André Lureau 140140293e58Sbellardcase "$cpu" in 1402e3608d66SRichard Henderson ppc) 1403e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1404e3608d66SRichard Henderson LDFLAGS="-m32 $LDFLAGS" 1405e3608d66SRichard Henderson ;; 1406e3608d66SRichard Henderson ppc64) 1407e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1408e3608d66SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 1409e3608d66SRichard Henderson ;; 14109b9c37c3SRichard Henderson sparc) 1411f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1412f1079bb8SRichard Henderson LDFLAGS="-m32 -mv8plus $LDFLAGS" 14133142255cSblueswir1 ;; 1414ed968ff1SJuan Quintela sparc64) 141579f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1416f1079bb8SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 14173142255cSblueswir1 ;; 141876d83bdeSths s390) 1419061cdd81SRichard Henderson CPU_CFLAGS="-m31" 142028d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 142128d7cc49SRichard Henderson ;; 142228d7cc49SRichard Henderson s390x) 1423061cdd81SRichard Henderson CPU_CFLAGS="-m64" 142428d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 142576d83bdeSths ;; 142640293e58Sbellard i386) 142779f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 14280c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 14292b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 143040293e58Sbellard ;; 143140293e58Sbellard x86_64) 14327ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 14337ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 14347ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 14357ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 14360c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 14372b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 1438379f6698SPaul Brook ;; 1439c72b26ecSRichard Henderson x32) 1440c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1441c72b26ecSRichard Henderson LDFLAGS="-mx32 $LDFLAGS" 1442c72b26ecSRichard Henderson cc_i386='$(CC) -m32' 1443c72b26ecSRichard Henderson ;; 144430163d89SPeter Maydell # No special flags required for other host CPUs 14453142255cSblueswir1esac 14463142255cSblueswir1 144779f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 144879f3b12fSPeter Crosthwaite 1449affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1450affc88ccSPeter Maydell# support, even if we're using TCI. 1451affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1452affc88ccSPeter Maydell bsd_user="no" 1453affc88ccSPeter Maydell linux_user="no" 1454affc88ccSPeter Maydellfi 1455affc88ccSPeter Maydell 145660e0df25SPeter Maydelldefault_target_list="" 145760e0df25SPeter Maydell 14586e92f823SPeter Maydellmak_wilds="" 14596e92f823SPeter Maydell 146060e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 14616e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 146260e0df25SPeter Maydellfi 146360e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 14646e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 146560e0df25SPeter Maydellfi 146660e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 14676e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 146860e0df25SPeter Maydellfi 146960e0df25SPeter Maydell 14706e92f823SPeter Maydellfor config in $mak_wilds; do 14716e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 14726e92f823SPeter Maydelldone 14736e92f823SPeter Maydell 1474c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 147564a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1476c53eeaf7SStefan Hajnoczi 1477af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1478af5db58eSpbrookcat << EOF 1479af5db58eSpbrook 1480af5db58eSpbrookUsage: configure [options] 1481af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1482af5db58eSpbrook 148308fb77edSStefan WeilStandard options: 148408fb77edSStefan Weil --help print this message 148508fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 148608fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 148708fb77edSStefan Weil use %M for cpu name [$interp_prefix] 148808fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 148908fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 149008fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 149108fb77edSStefan Weil 149208fb77edSStefan WeilAdvanced options (experts only): 149308fb77edSStefan Weil --source-path=PATH path of source code [$source_path] 149408fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 149508fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 149608fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 149708fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 149808fb77edSStefan Weil build time 149908fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 150008fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 150108fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 150211cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 150308fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 150408fb77edSStefan Weil --make=MAKE use specified make [$make] 150508fb77edSStefan Weil --install=INSTALL use specified install [$install] 150608fb77edSStefan Weil --python=PYTHON use specified python [$python] 150708fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1508db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 150908fb77edSStefan Weil --static enable static build [$static] 151008fb77edSStefan Weil --mandir=PATH install man pages in PATH 151108fb77edSStefan Weil --datadir=PATH install firmware in PATH$confsuffix 151208fb77edSStefan Weil --docdir=PATH install documentation in PATH$confsuffix 151308fb77edSStefan Weil --bindir=PATH install binaries in PATH 151408fb77edSStefan Weil --libdir=PATH install libraries in PATH 1515db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 151608fb77edSStefan Weil --sysconfdir=PATH install config in PATH$confsuffix 151708fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 15183d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 1519e26110cfSFam Zheng --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 1520db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 152108fb77edSStefan Weil --enable-debug enable common debug build options 1522247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 152308fb77edSStefan Weil --disable-strip disable stripping binaries 152408fb77edSStefan Weil --disable-werror disable compilation abort on warning 152563678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 152608fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 152708fb77edSStefan Weil Available drivers: $audio_possible_drivers 152808fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 152908fb77edSStefan Weil --block-drv-rw-whitelist=L 153008fb77edSStefan Weil set block driver read-write whitelist 153108fb77edSStefan Weil (affects only QEMU, not qemu-img) 153208fb77edSStefan Weil --block-drv-ro-whitelist=L 153308fb77edSStefan Weil set block driver read-only whitelist 153408fb77edSStefan Weil (affects only QEMU, not qemu-img) 15355b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1536c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 153708fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 153808fb77edSStefan Weil Default:trace-<pid> 1539c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1540c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 15415a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1542c23f23b9SMichael Tokarev --oss-lib path to OSS library 1543c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 154408fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 154533c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 154608fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 154708fb77edSStefan Weil --gcov=GCOV use specified gcov [$gcov_tool] 1548c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1549c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1550c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1551a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1552c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1553c12d66aaSLin Ma --enable-profiler profiler support 1554c12d66aaSLin Ma --enable-xen-pv-domain-build 1555c12d66aaSLin Ma xen pv domain builder 1556c12d66aaSLin Ma --enable-debug-stack-usage 1557c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 1558c23f23b9SMichael Tokarev 1559c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1560c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1561c23f23b9SMichael Tokarev 1562c23f23b9SMichael Tokarev system all system emulation targets 1563c23f23b9SMichael Tokarev user supported user emulation targets 1564c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1565c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1566c23f23b9SMichael Tokarev docs build documentation 1567c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1568c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1569c23f23b9SMichael Tokarev pie Position Independent Executables 1570c23f23b9SMichael Tokarev modules modules support 1571c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1572c23f23b9SMichael Tokarev debug-info debugging information 1573c23f23b9SMichael Tokarev sparse sparse checker 1574c23f23b9SMichael Tokarev 1575ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 157691bfcdb0SDaniel P. Berrange nettle nettle cryptography support 157791bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 1578c23f23b9SMichael Tokarev sdl SDL UI 1579c23f23b9SMichael Tokarev --with-sdlabi select preferred SDL ABI 1.2 or 2.0 1580c23f23b9SMichael Tokarev gtk gtk UI 1581c23f23b9SMichael Tokarev --with-gtkabi select preferred GTK ABI 2.0 or 3.0 1582c23f23b9SMichael Tokarev vte vte support for the gtk UI 1583c23f23b9SMichael Tokarev curses curses UI 1584c23f23b9SMichael Tokarev vnc VNC UI support 1585c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1586c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1587c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1588c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1589c23f23b9SMichael Tokarev virtfs VirtFS 1590fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1591c23f23b9SMichael Tokarev xen xen backend driver support 159270c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1593c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1594c23f23b9SMichael Tokarev curl curl connectivity 1595a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1596c23f23b9SMichael Tokarev fdt fdt device tree 1597c23f23b9SMichael Tokarev bluez bluez stack connectivity 1598c23f23b9SMichael Tokarev kvm KVM acceleration support 1599b0cb0a66SVincent Palatin hax HAX acceleration support 1600c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 1601d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 1602ef6d4ccdSYuval Shaia rdma Enable RDMA-based migration and PVRDMA support 1603c23f23b9SMichael Tokarev vde support for vde network 1604c23f23b9SMichael Tokarev netmap support for netmap network 1605c23f23b9SMichael Tokarev linux-aio Linux AIO support 1606c23f23b9SMichael Tokarev cap-ng libcap-ng support 1607c23f23b9SMichael Tokarev attr attr and xattr support 1608c23f23b9SMichael Tokarev vhost-net vhost-net acceleration support 1609042cea27SGonglei vhost-crypto vhost-crypto acceleration support 1610c23f23b9SMichael Tokarev spice spice 1611c23f23b9SMichael Tokarev rbd rados block device (rbd) 1612c23f23b9SMichael Tokarev libiscsi iscsi support 1613c23f23b9SMichael Tokarev libnfs nfs support 16147b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 1615c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1616ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1617c23f23b9SMichael Tokarev usb-redir usb network redirection support 1618c23f23b9SMichael Tokarev lzo support of lzo compression library 1619c23f23b9SMichael Tokarev snappy support of snappy compression library 1620c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1621c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 1622c23f23b9SMichael Tokarev seccomp seccomp support 1623c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1624c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1625c23f23b9SMichael Tokarev tpm TPM support 1626c23f23b9SMichael Tokarev libssh2 ssh block device support 1627c23f23b9SMichael Tokarev numa libnuma support 1628ed279a06SKlim Kireev libxml2 for Parallels image format 1629c23f23b9SMichael Tokarev tcmalloc tcmalloc support 16307b01cb97SAlexandre Derumier jemalloc jemalloc support 1631a6b1d4c0SChanglong Xie replication replication support 1632c12d66aaSLin Ma vhost-vsock virtio sockets device support 1633c12d66aaSLin Ma opengl opengl support 1634c12d66aaSLin Ma virglrenderer virgl rendering support 1635c12d66aaSLin Ma xfsctl xfsctl support 1636c12d66aaSLin Ma qom-cast-debug cast debugging support 1637c12d66aaSLin Ma tools build qemu-io, qemu-nbd and qemu-image tools 1638da92c3ffSAshish Mittal vxhs Veritas HyperScale vDisk backend support 1639f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 1640e6a74868SMarc-André Lureau vhost-user vhost-user support 16418ca80760SRichard Henderson capstone capstone disassembler support 164208fb77edSStefan Weil 164308fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1644af5db58eSpbrookEOF 16452d2ad6d0SFam Zhengexit 0 1646af5db58eSpbrookfi 1647af5db58eSpbrook 1648c53eeaf7SStefan Hajnocziif ! has $python; then 1649c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 1650c53eeaf7SStefan Hajnoczifi 1651c53eeaf7SStefan Hajnoczi 1652c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 1653c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 1654c21965a0SDaniel P. Berrangeif ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then 1655c21965a0SDaniel P. Berrange error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \ 1656c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 1657c53eeaf7SStefan Hajnoczifi 1658c53eeaf7SStefan Hajnoczi 1659c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 1660c53eeaf7SStefan Hajnoczipython="$python -B" 1661c53eeaf7SStefan Hajnoczi 16629aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 16639aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 16649aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 16659aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 16669aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 16679aae6e54SDaniel Henrique Barbozaif compile_object ; then 16689aae6e54SDaniel Henrique Barboza : C compiler works ok 16699aae6e54SDaniel Henrique Barbozaelse 16709aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 16719aae6e54SDaniel Henrique Barbozafi 16729aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 16739aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 16749aae6e54SDaniel Henrique Barbozafi 16759aae6e54SDaniel Henrique Barboza 1676359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1677359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1678359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1679359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1680359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1681359bc95dSPeter Maydell else 168276ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1683359bc95dSPeter Maydell fi 1684359bc95dSPeter Maydellfi 1685359bc95dSPeter Maydell 16869c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 16879c83ffd8SPeter Maydell# by default. Only enable by default for git builds 16889c83ffd8SPeter Maydellif test -z "$werror" ; then 16899c83ffd8SPeter Maydell if test -d "$source_path/.git" -a \ 1690e4650c81SThomas Huth \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then 16919c83ffd8SPeter Maydell werror="yes" 16929c83ffd8SPeter Maydell else 16939c83ffd8SPeter Maydell werror="no" 16949c83ffd8SPeter Maydell fi 16959c83ffd8SPeter Maydellfi 16969c83ffd8SPeter Maydell 1697fb59dabdSPeter Maydellif test "$bogus_os" = "yes"; then 1698fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 1699fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 1700fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 1701fb59dabdSPeter Maydell # host OS we should stop now. 1702951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 1703fb59dabdSPeter Maydellfi 1704fb59dabdSPeter Maydell 17058d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 17068d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 1707ac7568bdSDaniel P. Berrangegcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1708435405acSPranith Kumargcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" 1709b98fcfd8SPaolo Bonzinigcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" 171071429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags" 17110e39c4aaSGerd Hoffmanngcc_flags="-Wno-error=address-of-packed-member $gcc_flags" 17126ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 17136ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 17146ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 17156ca026cbSPeter Maydell# so it's too error prone. 171693b25869SJohn Snow 171793b25869SJohn Snowcc_has_warning_flag() { 171893b25869SJohn Snow write_c_skeleton; 171993b25869SJohn Snow 1720a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1721a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1722a1d29d6cSPeter Maydell # warning options). 172393b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 172493b25869SJohn Snow compile_prog "-Werror $optflag" "" 172593b25869SJohn Snow} 172693b25869SJohn Snow 172793b25869SJohn Snowfor flag in $gcc_flags; do 172893b25869SJohn Snow if cc_has_warning_flag $flag ; then 17298d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 17308d05095cSPaolo Bonzini fi 17318d05095cSPaolo Bonzinidone 17328d05095cSPaolo Bonzini 173363678e17SSteven Noonanif test "$stack_protector" != "no"; then 1734fccd35a0SRodrigo Rebello cat > $TMPC << EOF 1735fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 1736fccd35a0SRodrigo Rebello{ 1737fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 1738fccd35a0SRodrigo Rebello while (*c) { 1739fccd35a0SRodrigo Rebello *p++ = *c++; 1740fccd35a0SRodrigo Rebello } 1741fccd35a0SRodrigo Rebello return 0; 1742fccd35a0SRodrigo Rebello} 1743fccd35a0SRodrigo RebelloEOF 174463678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 17453b463a3fSMiroslav Rezanina sp_on=0 174663678e17SSteven Noonan for flag in $gcc_flags; do 1747590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 1748590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 1749590e5dd9SPeter Maydell if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && 1750590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 175163678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 17523b463a3fSMiroslav Rezanina sp_on=1 175363678e17SSteven Noonan break 175463678e17SSteven Noonan fi 175563678e17SSteven Noonan done 17563b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 17573b463a3fSMiroslav Rezanina if test $sp_on = 0; then 17583b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 17593b463a3fSMiroslav Rezanina fi 17603b463a3fSMiroslav Rezanina fi 176137746c5eSMarc-André Lureaufi 176237746c5eSMarc-André Lureau 176320bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 176420bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 176520bc94a2SPaolo Bonzinicat > $TMPC << EOF 176620bc94a2SPaolo Bonzinistruct { 176720bc94a2SPaolo Bonzini int a[2]; 176820bc94a2SPaolo Bonzini} x = {0}; 176920bc94a2SPaolo BonziniEOF 177020bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 177120bc94a2SPaolo Bonzini : 177220bc94a2SPaolo Bonzinielse 177320bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 177420bc94a2SPaolo Bonzinifi 177520bc94a2SPaolo Bonzini 1776cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1777cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1778cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1779cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1780cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1781cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1782cbdd1999SPaolo Bonziniint main(void) { return 0; } 1783cbdd1999SPaolo Bonzini#else 1784cbdd1999SPaolo Bonzini#error No bug in this compiler. 1785cbdd1999SPaolo Bonzini#endif 1786cbdd1999SPaolo BonziniEOF 1787cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1788cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1789cbdd1999SPaolo Bonzinifi 1790cbdd1999SPaolo Bonzini 179140d6444eSAvi Kivityif test "$static" = "yes" ; then 1792aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1793aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1794aa0d1f44SPaolo Bonzini fi 179540d6444eSAvi Kivity if test "$pie" = "yes" ; then 179676ad07a4SPeter Maydell error_exit "static and pie are mutually incompatible" 179740d6444eSAvi Kivity else 179840d6444eSAvi Kivity pie="no" 179940d6444eSAvi Kivity fi 180040d6444eSAvi Kivityfi 180140d6444eSAvi Kivity 1802768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 1803768b7855SEmilio G. Cota cat > $TMPC << EOF 1804768b7855SEmilio G. Cotastatic __thread int tls_var; 1805768b7855SEmilio G. Cotaint main(void) { return tls_var; } 1806768b7855SEmilio G. CotaEOF 1807768b7855SEmilio G. Cota 1808768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 1809768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 1810768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 1811768b7855SEmilio G. Cotafi 1812768b7855SEmilio G. Cota 181340d6444eSAvi Kivityif test "$pie" = ""; then 181440d6444eSAvi Kivity case "$cpu-$targetos" in 1815c72b26ecSRichard Henderson i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) 181640d6444eSAvi Kivity ;; 181740d6444eSAvi Kivity *) 181840d6444eSAvi Kivity pie="no" 181940d6444eSAvi Kivity ;; 182040d6444eSAvi Kivity esac 182140d6444eSAvi Kivityfi 182240d6444eSAvi Kivity 182340d6444eSAvi Kivityif test "$pie" != "no" ; then 182440d6444eSAvi Kivity cat > $TMPC << EOF 182521d4a791SAvi Kivity 182621d4a791SAvi Kivity#ifdef __linux__ 182721d4a791SAvi Kivity# define THREAD __thread 182821d4a791SAvi Kivity#else 182921d4a791SAvi Kivity# define THREAD 183021d4a791SAvi Kivity#endif 183121d4a791SAvi Kivity 183221d4a791SAvi Kivitystatic THREAD int tls_var; 183321d4a791SAvi Kivity 183421d4a791SAvi Kivityint main(void) { return tls_var; } 183521d4a791SAvi Kivity 183640d6444eSAvi KivityEOF 183740d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 183840d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 183940d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 184040d6444eSAvi Kivity pie="yes" 184140d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 184240d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 184340d6444eSAvi Kivity fi 184440d6444eSAvi Kivity else 184540d6444eSAvi Kivity if test "$pie" = "yes"; then 184676ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 184740d6444eSAvi Kivity else 184840d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 184940d6444eSAvi Kivity pie="no" 185040d6444eSAvi Kivity fi 185140d6444eSAvi Kivity fi 185246eef33bSBrad 1853e4a7b344SStefan Hajnoczi if compile_prog "-Werror -fno-pie" "-nopie"; then 185446eef33bSBrad CFLAGS_NOPIE="-fno-pie" 185546eef33bSBrad LDFLAGS_NOPIE="-nopie" 185646eef33bSBrad fi 185740d6444eSAvi Kivityfi 185840d6444eSAvi Kivity 185909dada40SPaolo Bonzini########################################## 186009dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 186109dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 186209dada40SPaolo Bonzini# specification is necessary 186309dada40SPaolo Bonzini 186409dada40SPaolo Bonziniif test "$cpu" = "i386"; then 186509dada40SPaolo Bonzini cat > $TMPC << EOF 186609dada40SPaolo Bonzinistatic int sfaa(int *ptr) 186709dada40SPaolo Bonzini{ 186809dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 186909dada40SPaolo Bonzini} 187009dada40SPaolo Bonzini 187109dada40SPaolo Bonziniint main(void) 187209dada40SPaolo Bonzini{ 187309dada40SPaolo Bonzini int val = 42; 18741405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 187509dada40SPaolo Bonzini sfaa(&val); 187609dada40SPaolo Bonzini return val; 187709dada40SPaolo Bonzini} 187809dada40SPaolo BonziniEOF 187909dada40SPaolo Bonzini if ! compile_prog "" "" ; then 188009dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 188109dada40SPaolo Bonzini fi 188209dada40SPaolo Bonzinifi 188309dada40SPaolo Bonzini 188409dada40SPaolo Bonzini######################################### 1885ec530c81Sbellard# Solaris specific configure tool chain decisions 188609dada40SPaolo Bonzini 1887ec530c81Sbellardif test "$solaris" = "yes" ; then 18886792aa11SLoïc Minier if has $install; then 18896792aa11SLoïc Minier : 18906792aa11SLoïc Minier else 189176ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 189276ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 189376ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1894ec530c81Sbellard fi 189589138857SStefan Weil if test "$(path_of $install)" = "/usr/sbin/install" ; then 189676ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 189776ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 189876ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1899ec530c81Sbellard fi 19006792aa11SLoïc Minier if has ar; then 19016792aa11SLoïc Minier : 19026792aa11SLoïc Minier else 1903ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 190476ad07a4SPeter Maydell error_exit "No path includes ar" \ 190576ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 1906ec530c81Sbellard fi 190776ad07a4SPeter Maydell error_exit "No path includes ar" 1908ec530c81Sbellard fi 1909ec530c81Sbellardfi 1910ec530c81Sbellard 1911afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1912d880a3baSPaolo Bonzini for target in $default_target_list; do 1913d880a3baSPaolo Bonzini supported_target $target 2>/dev/null && \ 1914d880a3baSPaolo Bonzini target_list="$target_list $target" 1915d880a3baSPaolo Bonzini done 1916d880a3baSPaolo Bonzini target_list="${target_list# }" 1917121afa9eSAnthony Liguorielse 191889138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 1919d880a3baSPaolo Bonzini for target in $target_list; do 192025b48338SPeter Maydell # Check that we recognised the target name; this allows a more 192125b48338SPeter Maydell # friendly error message than if we let it fall through. 192225b48338SPeter Maydell case " $default_target_list " in 192325b48338SPeter Maydell *" $target "*) 192425b48338SPeter Maydell ;; 192525b48338SPeter Maydell *) 192625b48338SPeter Maydell error_exit "Unknown target name '$target'" 192725b48338SPeter Maydell ;; 192825b48338SPeter Maydell esac 1929d880a3baSPaolo Bonzini supported_target $target || exit 1 193025b48338SPeter Maydell done 1931d880a3baSPaolo Bonzinifi 193225b48338SPeter Maydell 1933f55fe278SPaolo Bonzini# see if system emulation was really requested 1934f55fe278SPaolo Bonzinicase " $target_list " in 1935f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1936f55fe278SPaolo Bonzini ;; 1937f55fe278SPaolo Bonzini *) softmmu=no 1938f55fe278SPaolo Bonzini ;; 1939f55fe278SPaolo Bonziniesac 19405327cf48Sbellard 1941249247c9SJuan Quintelafeature_not_found() { 1942249247c9SJuan Quintela feature=$1 194321684af0SStewart Smith remedy=$2 1944249247c9SJuan Quintela 194576ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 194621684af0SStewart Smith "configure was not able to find it." \ 194721684af0SStewart Smith "$remedy" 1948249247c9SJuan Quintela} 1949249247c9SJuan Quintela 19507d13299dSbellard# --- 19517d13299dSbellard# big/little endian test 19527d13299dSbellardcat > $TMPC << EOF 195361cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 195461cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 195561cc919fSMike Frysingerextern int foo(short *, short *); 195661cc919fSMike Frysingerint main(int argc, char *argv[]) { 195761cc919fSMike Frysinger return foo(big_endian, little_endian); 19587d13299dSbellard} 19597d13299dSbellardEOF 19607d13299dSbellard 196161cc919fSMike Frysingerif compile_object ; then 196212f15c91SAlice Frosi if strings -a $TMPO | grep -q BiGeNdIaN ; then 196361cc919fSMike Frysinger bigendian="yes" 196412f15c91SAlice Frosi elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 196561cc919fSMike Frysinger bigendian="no" 19667d13299dSbellard else 19677d13299dSbellard echo big/little test failed 19687d13299dSbellard fi 19697d13299dSbellardelse 197061cc919fSMike Frysinger echo big/little test failed 19717d13299dSbellardfi 19727d13299dSbellard 1973b0a47e79SJuan Quintela########################################## 1974a30878e7SPeter Maydell# cocoa implies not SDL or GTK 1975a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 1976a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 1977a30878e7SPeter Maydellif test "$cocoa" = "yes"; then 1978a30878e7SPeter Maydell if test "$sdl" = "yes"; then 1979a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 1980a30878e7SPeter Maydell fi 1981a30878e7SPeter Maydell if test "$gtk" = "yes"; then 1982a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 1983a30878e7SPeter Maydell fi 1984a30878e7SPeter Maydell gtk=no 1985a30878e7SPeter Maydell sdl=no 1986a30878e7SPeter Maydellfi 1987a30878e7SPeter Maydell 19886b39b063SEric Blake# Some versions of Mac OS X incorrectly define SIZE_MAX 19896b39b063SEric Blakecat > $TMPC << EOF 19906b39b063SEric Blake#include <stdint.h> 19916b39b063SEric Blake#include <stdio.h> 19926b39b063SEric Blakeint main(int argc, char *argv[]) { 19936b39b063SEric Blake return printf("%zu", SIZE_MAX); 19946b39b063SEric Blake} 19956b39b063SEric BlakeEOF 19966b39b063SEric Blakehave_broken_size_max=no 19976b39b063SEric Blakeif ! compile_object -Werror ; then 19986b39b063SEric Blake have_broken_size_max=yes 19996b39b063SEric Blakefi 20006b39b063SEric Blake 2001a30878e7SPeter Maydell########################################## 2002015a33bdSGonglei# L2TPV3 probe 2003015a33bdSGonglei 2004015a33bdSGongleicat > $TMPC <<EOF 2005015a33bdSGonglei#include <sys/socket.h> 2006bff6cb72SMichael Tokarev#include <linux/ip.h> 2007015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2008015a33bdSGongleiEOF 2009015a33bdSGongleiif compile_prog "" "" ; then 2010015a33bdSGonglei l2tpv3=yes 2011015a33bdSGongleielse 2012015a33bdSGonglei l2tpv3=no 2013015a33bdSGongleifi 2014015a33bdSGonglei 2015015a33bdSGonglei########################################## 20164d9310f4SDaniel P. Berrange# MinGW / Mingw-w64 localtime_r/gmtime_r check 20174d9310f4SDaniel P. Berrange 20184d9310f4SDaniel P. Berrangeif test "$mingw32" = "yes"; then 20194d9310f4SDaniel P. Berrange # Some versions of MinGW / Mingw-w64 lack localtime_r 20204d9310f4SDaniel P. Berrange # and gmtime_r entirely. 20214d9310f4SDaniel P. Berrange # 20224d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 define a macro for 20234d9310f4SDaniel P. Berrange # localtime_r/gmtime_r. 20244d9310f4SDaniel P. Berrange # 20254d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 will define functions 20264d9310f4SDaniel P. Berrange # for localtime_r/gmtime_r, but only if you have 20274d9310f4SDaniel P. Berrange # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 20284d9310f4SDaniel P. Berrange # though, unistd.h and pthread.h both define 20294d9310f4SDaniel P. Berrange # that for you. 20304d9310f4SDaniel P. Berrange # 20314d9310f4SDaniel P. Berrange # So this #undef localtime_r and #include <unistd.h> 20324d9310f4SDaniel P. Berrange # are not in fact redundant. 20334d9310f4SDaniel P. Berrangecat > $TMPC << EOF 20344d9310f4SDaniel P. Berrange#include <unistd.h> 20354d9310f4SDaniel P. Berrange#include <time.h> 20364d9310f4SDaniel P. Berrange#undef localtime_r 20374d9310f4SDaniel P. Berrangeint main(void) { localtime_r(NULL, NULL); return 0; } 20384d9310f4SDaniel P. BerrangeEOF 20394d9310f4SDaniel P. Berrange if compile_prog "" "" ; then 20404d9310f4SDaniel P. Berrange localtime_r="yes" 20414d9310f4SDaniel P. Berrange else 20424d9310f4SDaniel P. Berrange localtime_r="no" 20434d9310f4SDaniel P. Berrange fi 20444d9310f4SDaniel P. Berrangefi 20454d9310f4SDaniel P. Berrange 20464d9310f4SDaniel P. Berrange########################################## 2047779ab5e3SStefan Weil# pkg-config probe 2048779ab5e3SStefan Weil 2049779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 205076ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2051779ab5e3SStefan Weilfi 2052779ab5e3SStefan Weil 2053779ab5e3SStefan Weil########################################## 2054b0a47e79SJuan Quintela# NPTL probe 2055b0a47e79SJuan Quintela 205624cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2057bd0c5661Spbrook cat > $TMPC <<EOF 2058bd0c5661Spbrook#include <sched.h> 205930813ceaSpbrook#include <linux/futex.h> 2060182eacc0SStefan Weilint main(void) { 2061bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2062bd0c5661Spbrook#error bork 2063bd0c5661Spbrook#endif 2064182eacc0SStefan Weil return 0; 2065bd0c5661Spbrook} 2066bd0c5661SpbrookEOF 206724cb36a6SPeter Maydell if ! compile_object ; then 206821684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2069b0a47e79SJuan Quintela fi 2070bd0c5661Spbrookfi 2071bd0c5661Spbrook 207299f2dbd3SLiang Li######################################### 2073ac62922eSbalrog# zlib check 2074ac62922eSbalrog 20751ece9905SAlon Levyif test "$zlib" != "no" ; then 2076ac62922eSbalrog cat > $TMPC << EOF 2077ac62922eSbalrog#include <zlib.h> 2078ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 2079ac62922eSbalrogEOF 208052166aa0SJuan Quintela if compile_prog "" "-lz" ; then 2081ac62922eSbalrog : 2082ac62922eSbalrog else 208376ad07a4SPeter Maydell error_exit "zlib check failed" \ 208476ad07a4SPeter Maydell "Make sure to have the zlib libs and headers installed." 2085ac62922eSbalrog fi 20861ece9905SAlon Levyfi 2087eb0ecd5aSWill NewtonLIBS="$LIBS -lz" 2088ac62922eSbalrog 2089ac62922eSbalrog########################################## 2090607dacd0Sqiaonuohan# lzo check 2091607dacd0Sqiaonuohan 2092607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 2093607dacd0Sqiaonuohan cat > $TMPC << EOF 2094607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 2095607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 2096607dacd0SqiaonuohanEOF 2097607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 2098607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -llzo2" 2099b25c9dffSStefan Weil lzo="yes" 2100b25c9dffSStefan Weil else 2101b25c9dffSStefan Weil if test "$lzo" = "yes"; then 2102b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 2103b25c9dffSStefan Weil fi 2104b25c9dffSStefan Weil lzo="no" 2105b25c9dffSStefan Weil fi 2106607dacd0Sqiaonuohanfi 2107607dacd0Sqiaonuohan 2108607dacd0Sqiaonuohan########################################## 2109607dacd0Sqiaonuohan# snappy check 2110607dacd0Sqiaonuohan 2111607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 2112607dacd0Sqiaonuohan cat > $TMPC << EOF 2113607dacd0Sqiaonuohan#include <snappy-c.h> 2114607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 2115607dacd0SqiaonuohanEOF 2116607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 2117607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -lsnappy" 2118b25c9dffSStefan Weil snappy="yes" 2119b25c9dffSStefan Weil else 2120b25c9dffSStefan Weil if test "$snappy" = "yes"; then 2121b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 2122b25c9dffSStefan Weil fi 2123b25c9dffSStefan Weil snappy="no" 2124b25c9dffSStefan Weil fi 2125607dacd0Sqiaonuohanfi 2126607dacd0Sqiaonuohan 2127607dacd0Sqiaonuohan########################################## 21286b383c08SPeter Wu# bzip2 check 21296b383c08SPeter Wu 21306b383c08SPeter Wuif test "$bzip2" != "no" ; then 21316b383c08SPeter Wu cat > $TMPC << EOF 21326b383c08SPeter Wu#include <bzlib.h> 21336b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 21346b383c08SPeter WuEOF 21356b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 21366b383c08SPeter Wu bzip2="yes" 21376b383c08SPeter Wu else 21386b383c08SPeter Wu if test "$bzip2" = "yes"; then 21396b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 21406b383c08SPeter Wu fi 21416b383c08SPeter Wu bzip2="no" 21426b383c08SPeter Wu fi 21436b383c08SPeter Wufi 21446b383c08SPeter Wu 21456b383c08SPeter Wu########################################## 2146f794573eSEduardo Otubo# libseccomp check 2147f794573eSEduardo Otubo 2148f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 2149693e5910SAndrew Jones case "$cpu" in 2150693e5910SAndrew Jones i386|x86_64) 2151ba060c53Sdann frazier libseccomp_minver="2.1.0" 2152693e5910SAndrew Jones ;; 21535ce43972SJames Hogan mips) 21545ce43972SJames Hogan libseccomp_minver="2.2.0" 21555ce43972SJames Hogan ;; 2156693e5910SAndrew Jones arm|aarch64) 2157693e5910SAndrew Jones libseccomp_minver="2.2.3" 2158693e5910SAndrew Jones ;; 21593aa35fcfSThomas Huth ppc|ppc64|s390x) 21603e684455SMichael Strosaker libseccomp_minver="2.3.0" 21613e684455SMichael Strosaker ;; 2162693e5910SAndrew Jones *) 2163693e5910SAndrew Jones libseccomp_minver="" 2164693e5910SAndrew Jones ;; 2165693e5910SAndrew Jones esac 2166693e5910SAndrew Jones 2167693e5910SAndrew Jones if test "$libseccomp_minver" != "" && 2168693e5910SAndrew Jones $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2169c3883e1fSFam Zheng seccomp_cflags="$($pkg_config --cflags libseccomp)" 2170c3883e1fSFam Zheng seccomp_libs="$($pkg_config --libs libseccomp)" 2171f794573eSEduardo Otubo seccomp="yes" 2172f794573eSEduardo Otubo else 2173f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 2174693e5910SAndrew Jones if test "$libseccomp_minver" != "" ; then 2175693e5910SAndrew Jones feature_not_found "libseccomp" \ 2176693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 2177693e5910SAndrew Jones else 2178693e5910SAndrew Jones feature_not_found "libseccomp" \ 2179693e5910SAndrew Jones "libseccomp is not supported for host cpu $cpu" 2180693e5910SAndrew Jones fi 2181896848f0SEduardo Otubo fi 2182e84d5956SYann E. MORIN seccomp="no" 2183f794573eSEduardo Otubo fi 2184f794573eSEduardo Otubofi 2185f794573eSEduardo Otubo########################################## 2186e37630caSaliguori# xen probe 2187e37630caSaliguori 2188fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 2189c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2190c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2191c1cdd9d5SJuergen Gross # to obtain all needed flags. 2192c1cdd9d5SJuergen Gross 2193c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2194c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2195c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2196c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2197c1cdd9d5SJuergen Gross xen=yes 2198c1cdd9d5SJuergen Gross xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2199c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 220058ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 220158ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 220258ea9a7aSAnthony PERARD fi 2203c1cdd9d5SJuergen Gross QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" 2204c1cdd9d5SJuergen Gross libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" 2205c1cdd9d5SJuergen Gross LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS" 2206c1cdd9d5SJuergen Gross else 2207c1cdd9d5SJuergen Gross 2208b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 2209d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2210d5b93ddfSAnthony PERARD 221150ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 221250ced5b3SStefan Weil # If no, we are done and there is no Xen support. 221350ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 221450ced5b3SStefan Weil 221550ced5b3SStefan Weil # Xen (any) 221650ced5b3SStefan Weil cat > $TMPC <<EOF 221750ced5b3SStefan Weil#include <xenctrl.h> 221850ced5b3SStefan Weilint main(void) { 221950ced5b3SStefan Weil return 0; 222050ced5b3SStefan Weil} 222150ced5b3SStefan WeilEOF 222250ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 222350ced5b3SStefan Weil # Xen not found 222450ced5b3SStefan Weil if test "$xen" = "yes" ; then 222521684af0SStewart Smith feature_not_found "xen" "Install xen devel" 222650ced5b3SStefan Weil fi 222750ced5b3SStefan Weil xen=no 222850ced5b3SStefan Weil 2229d5b93ddfSAnthony PERARD # Xen unstable 223069deef08SPeter Maydell elif 223169deef08SPeter Maydell cat > $TMPC <<EOF && 22322cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 22332cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 22342cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2235d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 22362cbf8903SRoss Lagerwallint main(void) { 22372cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2238d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 22392cbf8903SRoss Lagerwall 22402cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 22412cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 22422cbf8903SRoss Lagerwall 2243d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2244d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2245d3c49ebbSPaul Durrant 22462cbf8903SRoss Lagerwall return 0; 22472cbf8903SRoss Lagerwall} 22482cbf8903SRoss LagerwallEOF 22492cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 22502cbf8903SRoss Lagerwall then 22512cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 22522cbf8903SRoss Lagerwall xen_ctrl_version=41100 22532cbf8903SRoss Lagerwall xen=yes 22542cbf8903SRoss Lagerwall elif 22552cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 22565ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 22575ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 225858ea9a7aSAnthony PERARD#include <xentoolcore.h> 22595ba3d756SIgor Druzhininint main(void) { 22605ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 22615ba3d756SIgor Druzhinin 22625ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 22635ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 226458ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 22655ba3d756SIgor Druzhinin 22665ba3d756SIgor Druzhinin return 0; 22675ba3d756SIgor Druzhinin} 22685ba3d756SIgor DruzhininEOF 226958ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 22705ba3d756SIgor Druzhinin then 227158ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 22725ba3d756SIgor Druzhinin xen_ctrl_version=41000 22735ba3d756SIgor Druzhinin xen=yes 22745ba3d756SIgor Druzhinin elif 22755ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2276da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2277da8090ccSPaul Durrant#define __XEN_TOOLS__ 2278da8090ccSPaul Durrant#include <xendevicemodel.h> 2279da8090ccSPaul Durrantint main(void) { 2280da8090ccSPaul Durrant xendevicemodel_handle *xd; 2281da8090ccSPaul Durrant 2282da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2283da8090ccSPaul Durrant xendevicemodel_close(xd); 2284da8090ccSPaul Durrant 2285da8090ccSPaul Durrant return 0; 2286da8090ccSPaul Durrant} 2287da8090ccSPaul DurrantEOF 2288da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2289da8090ccSPaul Durrant then 2290da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2291f1167ee6SJuergen Gross xen_ctrl_version=40900 2292da8090ccSPaul Durrant xen=yes 2293da8090ccSPaul Durrant elif 2294da8090ccSPaul Durrant cat > $TMPC <<EOF && 22955eeb39c2SIan Campbell/* 22965eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 22975eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2298b6eb9b45SPaulina Szubarczyk * 2299b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2300b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2301b6eb9b45SPaulina Szubarczyk */ 2302b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2303b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2304b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2305b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2306b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2307b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2308b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2309b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2310b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2311b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2312b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2313b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2314b6eb9b45SPaulina Szubarczyk#endif 2315b6eb9b45SPaulina Szubarczykint main(void) { 2316b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2317b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2318b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2319b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2320b6eb9b45SPaulina Szubarczyk xen_domain_handle_t handle; 2321b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2322b6eb9b45SPaulina Szubarczyk 2323b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2324b6eb9b45SPaulina Szubarczyk 2325b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2326b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2327b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2328b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2329b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2330b6eb9b45SPaulina Szubarczyk xc_domain_create(xc, 0, handle, 0, NULL, NULL); 2331b6eb9b45SPaulina Szubarczyk 2332b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2333b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2334b6eb9b45SPaulina Szubarczyk 2335b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2336b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2337b6eb9b45SPaulina Szubarczyk 2338b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2339b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2340b6eb9b45SPaulina Szubarczyk 2341b6eb9b45SPaulina Szubarczyk return 0; 2342b6eb9b45SPaulina Szubarczyk} 2343b6eb9b45SPaulina SzubarczykEOF 2344b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2345b6eb9b45SPaulina Szubarczyk then 2346f1167ee6SJuergen Gross xen_ctrl_version=40800 2347b6eb9b45SPaulina Szubarczyk xen=yes 2348b6eb9b45SPaulina Szubarczyk elif 2349b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2350b6eb9b45SPaulina Szubarczyk/* 2351b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2352b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 23535eeb39c2SIan Campbell */ 23545eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 23555eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 23565eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 23575eeb39c2SIan Campbell#include <xenctrl.h> 23585eeb39c2SIan Campbell#include <xenstore.h> 23595eeb39c2SIan Campbell#include <xenevtchn.h> 23605eeb39c2SIan Campbell#include <xengnttab.h> 23615eeb39c2SIan Campbell#include <xenforeignmemory.h> 23625eeb39c2SIan Campbell#include <stdint.h> 23635eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 23645eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 23655eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 23665eeb39c2SIan Campbell#endif 23675eeb39c2SIan Campbellint main(void) { 23685eeb39c2SIan Campbell xc_interface *xc = NULL; 23695eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 23705eeb39c2SIan Campbell xenevtchn_handle *xe; 23715eeb39c2SIan Campbell xengnttab_handle *xg; 23725eeb39c2SIan Campbell xen_domain_handle_t handle; 23735eeb39c2SIan Campbell 23745eeb39c2SIan Campbell xs_daemon_open(); 23755eeb39c2SIan Campbell 23765eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 23775eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 23785eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 23795eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 23805eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 23815eeb39c2SIan Campbell xc_domain_create(xc, 0, handle, 0, NULL, NULL); 23825eeb39c2SIan Campbell 23835eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 23845eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 23855eeb39c2SIan Campbell 23865eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 23875eeb39c2SIan Campbell xenevtchn_fd(xe); 23885eeb39c2SIan Campbell 23895eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 23905eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 23915eeb39c2SIan Campbell 23925eeb39c2SIan Campbell return 0; 23935eeb39c2SIan Campbell} 23945eeb39c2SIan CampbellEOF 23955eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 23965eeb39c2SIan Campbell then 2397f1167ee6SJuergen Gross xen_ctrl_version=40701 23985eeb39c2SIan Campbell xen=yes 23995eeb39c2SIan Campbell elif 24005eeb39c2SIan Campbell cat > $TMPC <<EOF && 2401e37630caSaliguori#include <xenctrl.h> 2402cdadde39SRoger Pau Monne#include <stdint.h> 2403cdadde39SRoger Pau Monneint main(void) { 2404cdadde39SRoger Pau Monne xc_interface *xc = NULL; 2405cdadde39SRoger Pau Monne xen_domain_handle_t handle; 2406cdadde39SRoger Pau Monne xc_domain_create(xc, 0, handle, 0, NULL, NULL); 2407cdadde39SRoger Pau Monne return 0; 2408cdadde39SRoger Pau Monne} 2409cdadde39SRoger Pau MonneEOF 2410cdadde39SRoger Pau Monne compile_prog "" "$xen_libs" 2411cdadde39SRoger Pau Monne then 2412f1167ee6SJuergen Gross xen_ctrl_version=40700 2413cdadde39SRoger Pau Monne xen=yes 2414cdadde39SRoger Pau Monne 2415cdadde39SRoger Pau Monne # Xen 4.6 2416cdadde39SRoger Pau Monne elif 2417cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2418cdadde39SRoger Pau Monne#include <xenctrl.h> 2419e108a3c1SAnthony PERARD#include <xenstore.h> 2420d5b93ddfSAnthony PERARD#include <stdint.h> 2421d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2422d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2423d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2424d5b93ddfSAnthony PERARD#endif 2425d5b93ddfSAnthony PERARDint main(void) { 2426d5b93ddfSAnthony PERARD xc_interface *xc; 2427d5b93ddfSAnthony PERARD xs_daemon_open(); 2428d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2429d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2430d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2431b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 24328688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2433d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 243420a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2435d8b441a3SJan Beulich return 0; 2436d8b441a3SJan Beulich} 2437d8b441a3SJan BeulichEOF 2438d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2439d8b441a3SJan Beulich then 2440f1167ee6SJuergen Gross xen_ctrl_version=40600 2441d8b441a3SJan Beulich xen=yes 2442d8b441a3SJan Beulich 2443d8b441a3SJan Beulich # Xen 4.5 2444d8b441a3SJan Beulich elif 2445d8b441a3SJan Beulich cat > $TMPC <<EOF && 2446d8b441a3SJan Beulich#include <xenctrl.h> 2447d8b441a3SJan Beulich#include <xenstore.h> 2448d8b441a3SJan Beulich#include <stdint.h> 2449d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2450d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2451d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2452d8b441a3SJan Beulich#endif 2453d8b441a3SJan Beulichint main(void) { 2454d8b441a3SJan Beulich xc_interface *xc; 2455d8b441a3SJan Beulich xs_daemon_open(); 2456d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2457d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2458d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2459d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2460d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 24613996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 24623996e85cSPaul Durrant return 0; 24633996e85cSPaul Durrant} 24643996e85cSPaul DurrantEOF 24653996e85cSPaul Durrant compile_prog "" "$xen_libs" 24663996e85cSPaul Durrant then 2467f1167ee6SJuergen Gross xen_ctrl_version=40500 24683996e85cSPaul Durrant xen=yes 24693996e85cSPaul Durrant 24703996e85cSPaul Durrant elif 24713996e85cSPaul Durrant cat > $TMPC <<EOF && 24723996e85cSPaul Durrant#include <xenctrl.h> 24733996e85cSPaul Durrant#include <xenstore.h> 24743996e85cSPaul Durrant#include <stdint.h> 24753996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 24763996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 24773996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 24783996e85cSPaul Durrant#endif 24793996e85cSPaul Durrantint main(void) { 24803996e85cSPaul Durrant xc_interface *xc; 24813996e85cSPaul Durrant xs_daemon_open(); 24823996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 24833996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 24843996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 24853996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 24863996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 24878688e065SStefano Stabellini return 0; 24888688e065SStefano Stabellini} 24898688e065SStefano StabelliniEOF 24908688e065SStefano Stabellini compile_prog "" "$xen_libs" 249169deef08SPeter Maydell then 2492f1167ee6SJuergen Gross xen_ctrl_version=40200 24938688e065SStefano Stabellini xen=yes 24948688e065SStefano Stabellini 2495e37630caSaliguori else 2496fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 2497edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2498edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2499fc321b4bSJuan Quintela fi 2500fc321b4bSJuan Quintela xen=no 2501e37630caSaliguori fi 2502d5b93ddfSAnthony PERARD 2503d5b93ddfSAnthony PERARD if test "$xen" = yes; then 2504f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 25055eeb39c2SIan Campbell libs_softmmu="$xen_stable_libs $libs_softmmu" 25065eeb39c2SIan Campbell fi 2507d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 2508d5b93ddfSAnthony PERARD fi 2509e37630caSaliguori fi 2510c1cdd9d5SJuergen Grossfi 2511e37630caSaliguori 2512eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 2513edfb07edSIan Campbell if test "$xen" = "yes" && test "$linux" = "yes"; then 2514eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 2515eb6fda0fSAnthony PERARD else 2516eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 251776ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 251876ad07a4SPeter Maydell " but this feature requires /sys from Linux" 2519eb6fda0fSAnthony PERARD fi 2520eb6fda0fSAnthony PERARD xen_pci_passthrough=no 2521eb6fda0fSAnthony PERARD fi 2522eb6fda0fSAnthony PERARDfi 2523eb6fda0fSAnthony PERARD 252464a7ad6fSIan Campbellif test "$xen_pv_domain_build" = "yes" && 252564a7ad6fSIan Campbell test "$xen" != "yes"; then 252664a7ad6fSIan Campbell error_exit "User requested Xen PV domain builder support" \ 252764a7ad6fSIan Campbell "which requires Xen support." 252864a7ad6fSIan Campbellfi 252964a7ad6fSIan Campbell 2530e37630caSaliguori########################################## 2531d661d9a4SJustin Terry (VM)# Windows Hypervisor Platform accelerator (WHPX) check 2532d661d9a4SJustin Terry (VM)if test "$whpx" != "no" ; then 2533327fccb2SLucian Petrut if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then 2534d661d9a4SJustin Terry (VM) whpx="yes" 2535d661d9a4SJustin Terry (VM) else 2536d661d9a4SJustin Terry (VM) if test "$whpx" = "yes"; then 253753537bb1SJustin Terry (VM) via Qemu-devel feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" 2538d661d9a4SJustin Terry (VM) fi 2539d661d9a4SJustin Terry (VM) whpx="no" 2540d661d9a4SJustin Terry (VM) fi 2541d661d9a4SJustin Terry (VM)fi 2542d661d9a4SJustin Terry (VM) 2543d661d9a4SJustin Terry (VM)########################################## 2544dfffc653SJuan Quintela# Sparse probe 2545dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 25460dba6195SLoïc Minier if has cgcc; then 2547dfffc653SJuan Quintela sparse=yes 2548dfffc653SJuan Quintela else 2549dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 255021684af0SStewart Smith feature_not_found "sparse" "Install sparse binary" 2551dfffc653SJuan Quintela fi 2552dfffc653SJuan Quintela sparse=no 2553dfffc653SJuan Quintela fi 2554dfffc653SJuan Quintelafi 2555dfffc653SJuan Quintela 2556dfffc653SJuan Quintela########################################## 2557f676c67eSJeremy White# X11 probe 2558f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 25598781595bSGerd Hoffmann have_x11=yes 256089138857SStefan Weil x11_cflags=$($pkg_config --cflags x11) 256189138857SStefan Weil x11_libs=$($pkg_config --libs x11) 2562f676c67eSJeremy Whitefi 2563f676c67eSJeremy White 2564f676c67eSJeremy White########################################## 2565a4ccabcfSAnthony Liguori# GTK probe 2566a4ccabcfSAnthony Liguori 25675a464e6cSPeter Xuif test "$gtk" != "no"; then 25689e04c683SStefan Weil if test "$gtkabi" = ""; then 25695fe309ffSGerd Hoffmann # The GTK ABI was not specified explicitly, so try whether 3.0 is available. 25705fe309ffSGerd Hoffmann # Use 2.0 as a fallback if that is available. 25715fe309ffSGerd Hoffmann if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then 25729e04c683SStefan Weil gtkabi=3.0 25735fe309ffSGerd Hoffmann elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then 25749e04c683SStefan Weil gtkabi=2.0 25755fe309ffSGerd Hoffmann else 25765fe309ffSGerd Hoffmann gtkabi=3.0 25779e04c683SStefan Weil fi 25789e04c683SStefan Weil fi 2579528de90aSDaniel P. Berrange gtkpackage="gtk+-$gtkabi" 25800a337ed0SGerd Hoffmann gtkx11package="gtk+-x11-$gtkabi" 2581528de90aSDaniel P. Berrange if test "$gtkabi" = "3.0" ; then 2582528de90aSDaniel P. Berrange gtkversion="3.0.0" 2583bbbf9bfbSStefan Weil else 2584bbbf9bfbSStefan Weil gtkversion="2.18.0" 2585bbbf9bfbSStefan Weil fi 2586bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 258789138857SStefan Weil gtk_cflags=$($pkg_config --cflags $gtkpackage) 258889138857SStefan Weil gtk_libs=$($pkg_config --libs $gtkpackage) 258989138857SStefan Weil gtk_version=$($pkg_config --modversion $gtkpackage) 25900a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 25918781595bSGerd Hoffmann need_x11=yes 2592f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 2593f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 25940a337ed0SGerd Hoffmann fi 2595bbbf9bfbSStefan Weil gtk="yes" 2596bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 25975fe309ffSGerd Hoffmann feature_not_found "gtk" "Install gtk3-devel" 2598bbbf9bfbSStefan Weil else 2599bbbf9bfbSStefan Weil gtk="no" 2600bbbf9bfbSStefan Weil fi 2601bbbf9bfbSStefan Weilfi 2602bbbf9bfbSStefan Weil 2603ddbb0d09SDaniel P. Berrange 2604ddbb0d09SDaniel P. Berrange########################################## 2605ddbb0d09SDaniel P. Berrange# GNUTLS probe 2606ddbb0d09SDaniel P. Berrange 260737371299SPeter Maydellgnutls_works() { 260837371299SPeter Maydell # Unfortunately some distros have bad pkg-config information for gnutls 260937371299SPeter Maydell # such that it claims to exist but you get a compiler error if you try 261037371299SPeter Maydell # to use the options returned by --libs. Specifically, Ubuntu for --static 261137371299SPeter Maydell # builds doesn't work: 261237371299SPeter Maydell # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035 261337371299SPeter Maydell # 261437371299SPeter Maydell # So sanity check the cflags/libs before assuming gnutls can be used. 261537371299SPeter Maydell if ! $pkg_config --exists "gnutls"; then 261637371299SPeter Maydell return 1 261737371299SPeter Maydell fi 261837371299SPeter Maydell 261937371299SPeter Maydell write_c_skeleton 262037371299SPeter Maydell compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)" 262137371299SPeter Maydell} 262237371299SPeter Maydell 262362893b67SDaniel P. Berrangegnutls_gcrypt=no 2624ed754746SDaniel P. Berrangegnutls_nettle=no 2625ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 262637371299SPeter Maydell if gnutls_works; then 262789138857SStefan Weil gnutls_cflags=$($pkg_config --cflags gnutls) 262889138857SStefan Weil gnutls_libs=$($pkg_config --libs gnutls) 2629ddbb0d09SDaniel P. Berrange libs_softmmu="$gnutls_libs $libs_softmmu" 2630ddbb0d09SDaniel P. Berrange libs_tools="$gnutls_libs $libs_tools" 2631ddbb0d09SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 2632ddbb0d09SDaniel P. Berrange gnutls="yes" 2633ddbb0d09SDaniel P. Berrange 2634b917da4cSDaniel P. Berrange # gnutls_rnd requires >= 2.11.0 2635b917da4cSDaniel P. Berrange if $pkg_config --exists "gnutls >= 2.11.0"; then 2636b917da4cSDaniel P. Berrange gnutls_rnd="yes" 2637b917da4cSDaniel P. Berrange else 2638b917da4cSDaniel P. Berrange gnutls_rnd="no" 2639b917da4cSDaniel P. Berrange fi 2640b917da4cSDaniel P. Berrange 264162893b67SDaniel P. Berrange if $pkg_config --exists 'gnutls >= 3.0'; then 264262893b67SDaniel P. Berrange gnutls_gcrypt=no 2643ed754746SDaniel P. Berrange gnutls_nettle=yes 264462893b67SDaniel P. Berrange elif $pkg_config --exists 'gnutls >= 2.12'; then 264589138857SStefan Weil case $($pkg_config --libs --static gnutls) in 2646ed754746SDaniel P. Berrange *gcrypt*) 2647ed754746SDaniel P. Berrange gnutls_gcrypt=yes 2648ed754746SDaniel P. Berrange gnutls_nettle=no 2649ed754746SDaniel P. Berrange ;; 2650ed754746SDaniel P. Berrange *nettle*) 2651ed754746SDaniel P. Berrange gnutls_gcrypt=no 2652ed754746SDaniel P. Berrange gnutls_nettle=yes 2653ed754746SDaniel P. Berrange ;; 2654ed754746SDaniel P. Berrange *) 2655ed754746SDaniel P. Berrange gnutls_gcrypt=yes 2656ed754746SDaniel P. Berrange gnutls_nettle=no 2657ed754746SDaniel P. Berrange ;; 265862893b67SDaniel P. Berrange esac 265962893b67SDaniel P. Berrange else 266062893b67SDaniel P. Berrange gnutls_gcrypt=yes 2661ed754746SDaniel P. Berrange gnutls_nettle=no 266262893b67SDaniel P. Berrange fi 2663ddbb0d09SDaniel P. Berrange elif test "$gnutls" = "yes"; then 2664ddbb0d09SDaniel P. Berrange feature_not_found "gnutls" "Install gnutls devel" 2665ddbb0d09SDaniel P. Berrange else 2666ddbb0d09SDaniel P. Berrange gnutls="no" 2667b917da4cSDaniel P. Berrange gnutls_rnd="no" 2668ddbb0d09SDaniel P. Berrange fi 2669ddbb0d09SDaniel P. Berrangeelse 2670b917da4cSDaniel P. Berrange gnutls_rnd="no" 2671ddbb0d09SDaniel P. Berrangefi 2672ddbb0d09SDaniel P. Berrange 267391bfcdb0SDaniel P. Berrange 267491bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 267591bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 267691bfcdb0SDaniel P. Berrange# explicitly, or if gnutls links to nettle 267791bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 267891bfcdb0SDaniel P. Berrangethen 267991bfcdb0SDaniel P. Berrange if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes" 268091bfcdb0SDaniel P. Berrange then 268191bfcdb0SDaniel P. Berrange gcrypt="no" 268291bfcdb0SDaniel P. Berrange fi 268391bfcdb0SDaniel P. Berrangefi 268491bfcdb0SDaniel P. Berrange 268591bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 268691bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 268791bfcdb0SDaniel P. Berrange# explicitly, or if gnutls links to gcrypt 268891bfcdb0SDaniel P. Berrangeif test -z "$nettle" 268991bfcdb0SDaniel P. Berrangethen 269091bfcdb0SDaniel P. Berrange if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes" 269191bfcdb0SDaniel P. Berrange then 269291bfcdb0SDaniel P. Berrange nettle="no" 269391bfcdb0SDaniel P. Berrange fi 269491bfcdb0SDaniel P. Berrangefi 269591bfcdb0SDaniel P. Berrange 269691bfcdb0SDaniel P. Berrangehas_libgcrypt_config() { 269791bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 269891bfcdb0SDaniel P. Berrange then 269991bfcdb0SDaniel P. Berrange return 1 270091bfcdb0SDaniel P. Berrange fi 270191bfcdb0SDaniel P. Berrange 270291bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 270391bfcdb0SDaniel P. Berrange then 270489138857SStefan Weil host=$(libgcrypt-config --host) 270591bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 270691bfcdb0SDaniel P. Berrange then 270791bfcdb0SDaniel P. Berrange return 1 270891bfcdb0SDaniel P. Berrange fi 270991bfcdb0SDaniel P. Berrange fi 271091bfcdb0SDaniel P. Berrange 271191bfcdb0SDaniel P. Berrange return 0 271291bfcdb0SDaniel P. Berrange} 271391bfcdb0SDaniel P. Berrange 271491bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 271591bfcdb0SDaniel P. Berrange if has_libgcrypt_config; then 271689138857SStefan Weil gcrypt_cflags=$(libgcrypt-config --cflags) 271789138857SStefan Weil gcrypt_libs=$(libgcrypt-config --libs) 271891bfcdb0SDaniel P. Berrange # Debian has remove -lgpg-error from libgcrypt-config 271991bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 272091bfcdb0SDaniel P. Berrange # turn breaks static builds... 272191bfcdb0SDaniel P. Berrange if test "$static" = "yes" 272291bfcdb0SDaniel P. Berrange then 272391bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 272491bfcdb0SDaniel P. Berrange fi 272562893b67SDaniel P. Berrange libs_softmmu="$gcrypt_libs $libs_softmmu" 272662893b67SDaniel P. Berrange libs_tools="$gcrypt_libs $libs_tools" 272762893b67SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 272891bfcdb0SDaniel P. Berrange gcrypt="yes" 272991bfcdb0SDaniel P. Berrange if test -z "$nettle"; then 273091bfcdb0SDaniel P. Berrange nettle="no" 273191bfcdb0SDaniel P. Berrange fi 273237788f25SDaniel P. Berrange 273337788f25SDaniel P. Berrange cat > $TMPC << EOF 273437788f25SDaniel P. Berrange#include <gcrypt.h> 273537788f25SDaniel P. Berrangeint main(void) { 273637788f25SDaniel P. Berrange gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2, 273737788f25SDaniel P. Berrange GCRY_MD_SHA256, 273837788f25SDaniel P. Berrange NULL, 0, 0, 0, NULL); 273937788f25SDaniel P. Berrange return 0; 274037788f25SDaniel P. Berrange} 274137788f25SDaniel P. BerrangeEOF 274237788f25SDaniel P. Berrange if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 274337788f25SDaniel P. Berrange gcrypt_kdf=yes 274437788f25SDaniel P. Berrange fi 27451f923c70SLongpeng(Mike) 27461f923c70SLongpeng(Mike) cat > $TMPC << EOF 27471f923c70SLongpeng(Mike)#include <gcrypt.h> 27481f923c70SLongpeng(Mike)int main(void) { 27491f923c70SLongpeng(Mike) gcry_mac_hd_t handle; 27501f923c70SLongpeng(Mike) gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 27511f923c70SLongpeng(Mike) GCRY_MAC_FLAG_SECURE, NULL); 27521f923c70SLongpeng(Mike) return 0; 27531f923c70SLongpeng(Mike)} 27541f923c70SLongpeng(Mike)EOF 27551f923c70SLongpeng(Mike) if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 27561f923c70SLongpeng(Mike) gcrypt_hmac=yes 27571f923c70SLongpeng(Mike) fi 275862893b67SDaniel P. Berrange else 275991bfcdb0SDaniel P. Berrange if test "$gcrypt" = "yes"; then 276062893b67SDaniel P. Berrange feature_not_found "gcrypt" "Install gcrypt devel" 276191bfcdb0SDaniel P. Berrange else 276291bfcdb0SDaniel P. Berrange gcrypt="no" 276391bfcdb0SDaniel P. Berrange fi 276462893b67SDaniel P. Berrange fi 276562893b67SDaniel P. Berrangefi 276662893b67SDaniel P. Berrange 2767ddbb0d09SDaniel P. Berrange 276891bfcdb0SDaniel P. Berrangeif test "$nettle" != "no"; then 2769ed754746SDaniel P. Berrange if $pkg_config --exists "nettle"; then 277089138857SStefan Weil nettle_cflags=$($pkg_config --cflags nettle) 277189138857SStefan Weil nettle_libs=$($pkg_config --libs nettle) 277289138857SStefan Weil nettle_version=$($pkg_config --modversion nettle) 2773ed754746SDaniel P. Berrange libs_softmmu="$nettle_libs $libs_softmmu" 2774ed754746SDaniel P. Berrange libs_tools="$nettle_libs $libs_tools" 2775ed754746SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 277691bfcdb0SDaniel P. Berrange nettle="yes" 2777fff2f982SDaniel P. Berrange 2778fff2f982SDaniel P. Berrange cat > $TMPC << EOF 27799e87a691SSteven Luo#include <stddef.h> 2780fff2f982SDaniel P. Berrange#include <nettle/pbkdf2.h> 2781fff2f982SDaniel P. Berrangeint main(void) { 2782fff2f982SDaniel P. Berrange pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL); 2783fff2f982SDaniel P. Berrange return 0; 2784fff2f982SDaniel P. Berrange} 2785fff2f982SDaniel P. BerrangeEOF 2786fff2f982SDaniel P. Berrange if compile_prog "$nettle_cflags" "$nettle_libs" ; then 2787fff2f982SDaniel P. Berrange nettle_kdf=yes 2788fff2f982SDaniel P. Berrange fi 2789ed754746SDaniel P. Berrange else 279091bfcdb0SDaniel P. Berrange if test "$nettle" = "yes"; then 2791ed754746SDaniel P. Berrange feature_not_found "nettle" "Install nettle devel" 279291bfcdb0SDaniel P. Berrange else 279391bfcdb0SDaniel P. Berrange nettle="no" 2794ed754746SDaniel P. Berrange fi 2795ed754746SDaniel P. Berrange fi 279691bfcdb0SDaniel P. Berrangefi 279791bfcdb0SDaniel P. Berrange 279891bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 279991bfcdb0SDaniel P. Berrangethen 280091bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 280191bfcdb0SDaniel P. Berrangefi 2802ed754746SDaniel P. Berrange 28039a2fd434SDaniel P. Berrange########################################## 28049a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 28059a2fd434SDaniel P. Berrange 28069a2fd434SDaniel P. Berrangetasn1=yes 280790246037SDaniel P. Berrangetasn1_cflags="" 280890246037SDaniel P. Berrangetasn1_libs="" 28099a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 281089138857SStefan Weil tasn1_cflags=$($pkg_config --cflags libtasn1) 281189138857SStefan Weil tasn1_libs=$($pkg_config --libs libtasn1) 28129a2fd434SDaniel P. Berrangeelse 28139a2fd434SDaniel P. Berrange tasn1=no 28149a2fd434SDaniel P. Berrangefi 28159a2fd434SDaniel P. Berrange 2816ed754746SDaniel P. Berrange 2817bbbf9bfbSStefan Weil########################################## 2818559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 2819559607eaSDaniel P. Berrange 2820559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 2821559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 2822559607eaSDaniel P. Berrange have_ifaddrs_h=no 2823559607eaSDaniel P. Berrangefi 2824559607eaSDaniel P. Berrange 2825559607eaSDaniel P. Berrange########################################## 2826bbbf9bfbSStefan Weil# VTE probe 2827bbbf9bfbSStefan Weil 2828bbbf9bfbSStefan Weilif test "$vte" != "no"; then 2829bbbf9bfbSStefan Weil if test "$gtkabi" = "3.0"; then 2830c6feff9eSCole Robinson vteminversion="0.32.0" 2831c6feff9eSCole Robinson if $pkg_config --exists "vte-2.91"; then 2832c6feff9eSCole Robinson vtepackage="vte-2.91" 2833c6feff9eSCole Robinson else 2834528de90aSDaniel P. Berrange vtepackage="vte-2.90" 2835c6feff9eSCole Robinson fi 2836528de90aSDaniel P. Berrange else 2837528de90aSDaniel P. Berrange vtepackage="vte" 2838c6feff9eSCole Robinson vteminversion="0.24.0" 2839528de90aSDaniel P. Berrange fi 2840c6feff9eSCole Robinson if $pkg_config --exists "$vtepackage >= $vteminversion"; then 284189138857SStefan Weil vte_cflags=$($pkg_config --cflags $vtepackage) 284289138857SStefan Weil vte_libs=$($pkg_config --libs $vtepackage) 284389138857SStefan Weil vteversion=$($pkg_config --modversion $vtepackage) 2844bbbf9bfbSStefan Weil vte="yes" 2845bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 28469e04c683SStefan Weil if test "$gtkabi" = "3.0"; then 2847c6feff9eSCole Robinson feature_not_found "vte" "Install libvte-2.90/2.91 devel" 28489e04c683SStefan Weil else 28499e04c683SStefan Weil feature_not_found "vte" "Install libvte devel" 28509e04c683SStefan Weil fi 2851bbbf9bfbSStefan Weil else 2852bbbf9bfbSStefan Weil vte="no" 2853a4ccabcfSAnthony Liguori fi 2854a4ccabcfSAnthony Liguorifi 2855a4ccabcfSAnthony Liguori 2856a4ccabcfSAnthony Liguori########################################## 285711d9f695Sbellard# SDL probe 285811d9f695Sbellard 28593ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 28603ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 286147c03744SDave Airlie 2862c6093a05SPeter Xusdl_probe () 2863c6093a05SPeter Xu{ 2864c6093a05SPeter Xu sdl_too_old=no 2865ee8466d0SCole Robinson if test "$sdlabi" = ""; then 28668f4ea9cdSGerd Hoffmann if $pkg_config --exists "sdl2"; then 2867ee8466d0SCole Robinson sdlabi=2.0 28688f4ea9cdSGerd Hoffmann elif $pkg_config --exists "sdl"; then 2869ee8466d0SCole Robinson sdlabi=1.2 28708f4ea9cdSGerd Hoffmann else 28718f4ea9cdSGerd Hoffmann sdlabi=2.0 2872ee8466d0SCole Robinson fi 2873ee8466d0SCole Robinson fi 2874ee8466d0SCole Robinson 287547c03744SDave Airlie if test $sdlabi = "2.0"; then 287647c03744SDave Airlie sdl_config=$sdl2_config 287747c03744SDave Airlie sdlname=sdl2 287847c03744SDave Airlie sdlconfigname=sdl2_config 2879e07047cfSCole Robinson elif test $sdlabi = "1.2"; then 288047c03744SDave Airlie sdlname=sdl 288147c03744SDave Airlie sdlconfigname=sdl_config 2882e07047cfSCole Robinson else 2883e07047cfSCole Robinson error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" 28843ec87ffeSPaolo Bonzini fi 28853ec87ffeSPaolo Bonzini 288689138857SStefan Weil if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then 288747c03744SDave Airlie sdl_config=$sdlconfigname 288847c03744SDave Airlie fi 288947c03744SDave Airlie 289047c03744SDave Airlie if $pkg_config $sdlname --exists; then 289147c03744SDave Airlie sdlconfig="$pkg_config $sdlname" 289289138857SStefan Weil sdlversion=$($sdlconfig --modversion 2>/dev/null) 28933ec87ffeSPaolo Bonzini elif has ${sdl_config}; then 28943ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 289589138857SStefan Weil sdlversion=$($sdlconfig --version) 2896a0dfd8a4SLoïc Minier else 2897a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 28988f4ea9cdSGerd Hoffmann feature_not_found "sdl" "Install SDL2-devel" 2899a0dfd8a4SLoïc Minier fi 2900a0dfd8a4SLoïc Minier sdl=no 2901c6093a05SPeter Xu # no need to do the rest 2902c6093a05SPeter Xu return 29039316f803SPaolo Bonzini fi 290429e5badaSScott Wood if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 29053ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 29063ec87ffeSPaolo Bonzini fi 290711d9f695Sbellard 290811d9f695Sbellard cat > $TMPC << EOF 290911d9f695Sbellard#include <SDL.h> 291011d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 291111d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 291211d9f695SbellardEOF 291389138857SStefan Weil sdl_cflags=$($sdlconfig --cflags 2>/dev/null) 29142ca5c430SGerd Hoffmann sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug 291574f42e18STeLeMan if test "$static" = "yes" ; then 29165f37e6d4SThomas Huth if $pkg_config $sdlname --exists; then 29175f37e6d4SThomas Huth sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null) 29185f37e6d4SThomas Huth else 291989138857SStefan Weil sdl_libs=$($sdlconfig --static-libs 2>/dev/null) 29205f37e6d4SThomas Huth fi 292174f42e18STeLeMan else 292289138857SStefan Weil sdl_libs=$($sdlconfig --libs 2>/dev/null) 292374f42e18STeLeMan fi 292452166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 292589138857SStefan Weil if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then 292611d9f695Sbellard sdl_too_old=yes 292711d9f695Sbellard else 292811d9f695Sbellard sdl=yes 292911d9f695Sbellard fi 29307c1f25b4Sbellard 293167c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 29321ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 293367c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 293489138857SStefan Weil sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" 293589138857SStefan Weil sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" 293611d9f695Sbellard fi 293752166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 29381ac88f28SJuan Quintela : 29391ac88f28SJuan Quintela else 29401ac88f28SJuan Quintela sdl=no 29417c1f25b4Sbellard fi 29427c1f25b4Sbellard fi # static link 2943c4198157SJuan Quintela else # sdl not found 2944c4198157SJuan Quintela if test "$sdl" = "yes" ; then 294521684af0SStewart Smith feature_not_found "sdl" "Install SDL devel" 2946c4198157SJuan Quintela fi 2947c4198157SJuan Quintela sdl=no 29487c1f25b4Sbellard fi # sdl compile test 2949c6093a05SPeter Xu} 2950c6093a05SPeter Xu 2951c6093a05SPeter Xuif test "$sdl" != "no" ; then 2952c6093a05SPeter Xu sdl_probe 2953fd677642Sthsfi 295411d9f695Sbellard 29555368a422Saliguoriif test "$sdl" = "yes" ; then 29565368a422Saliguori cat > $TMPC <<EOF 29575368a422Saliguori#include <SDL.h> 29585368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 29595368a422Saliguori#include <X11/XKBlib.h> 29605368a422Saliguori#else 29615368a422Saliguori#error No x11 support 29625368a422Saliguori#endif 29635368a422Saliguoriint main(void) { return 0; } 29645368a422SaliguoriEOF 2965f676c67eSJeremy White if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then 29668781595bSGerd Hoffmann need_x11=yes 2967f676c67eSJeremy White sdl_cflags="$sdl_cflags $x11_cflags" 2968f676c67eSJeremy White sdl_libs="$sdl_libs $x11_libs" 29695368a422Saliguori fi 29705368a422Saliguorifi 29715368a422Saliguori 29728f28f3fbSths########################################## 29732da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 29742da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 29752da776dbSMichael R. Hines cat > $TMPC <<EOF 29762da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 29772da776dbSMichael R. Hinesint main(void) { return 0; } 29782da776dbSMichael R. HinesEOF 2979ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 29802da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 29812da776dbSMichael R. Hines rdma="yes" 2982ef6d4ccdSYuval Shaia libs_softmmu="$libs_softmmu $rdma_libs" 29832da776dbSMichael R. Hines else 29842da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 29852da776dbSMichael R. Hines error_exit \ 2986ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 29872da776dbSMichael R. Hines " Your options:" \ 2988ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 29892da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 29902da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 29912da776dbSMichael R. Hines fi 29922da776dbSMichael R. Hines rdma="no" 29932da776dbSMichael R. Hines fi 29942da776dbSMichael R. Hinesfi 29952da776dbSMichael R. Hines 299695c6bff3SBenoît Canet 299795c6bff3SBenoît Canet########################################## 29982f9606b3Saliguori# VNC SASL detection 2999821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 30002f9606b3Saliguori cat > $TMPC <<EOF 30012f9606b3Saliguori#include <sasl/sasl.h> 30022f9606b3Saliguori#include <stdio.h> 30032f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 30042f9606b3SaliguoriEOF 30052f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 30062f9606b3Saliguori vnc_sasl_cflags="" 30072f9606b3Saliguori vnc_sasl_libs="-lsasl2" 300852166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 3009ea784e3bSJuan Quintela vnc_sasl=yes 3010fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 3011ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 30122f9606b3Saliguori else 3013ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 301421684af0SStewart Smith feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 3015ea784e3bSJuan Quintela fi 3016ea784e3bSJuan Quintela vnc_sasl=no 30172f9606b3Saliguori fi 30182f9606b3Saliguorifi 30192f9606b3Saliguori 30202f9606b3Saliguori########################################## 30212f6f5c7aSCorentin Chary# VNC JPEG detection 3022821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 30232f6f5c7aSCorentin Charycat > $TMPC <<EOF 30242f6f5c7aSCorentin Chary#include <stdio.h> 30252f6f5c7aSCorentin Chary#include <jpeglib.h> 30262f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 30272f6f5c7aSCorentin CharyEOF 30282f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 30292f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 30302f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 30312f6f5c7aSCorentin Chary vnc_jpeg=yes 30322f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 3033ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 30342f6f5c7aSCorentin Chary else 30352f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 303621684af0SStewart Smith feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 30372f6f5c7aSCorentin Chary fi 30382f6f5c7aSCorentin Chary vnc_jpeg=no 30392f6f5c7aSCorentin Chary fi 30402f6f5c7aSCorentin Charyfi 30412f6f5c7aSCorentin Chary 30422f6f5c7aSCorentin Chary########################################## 3043efe556adSCorentin Chary# VNC PNG detection 3044821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 3045efe556adSCorentin Charycat > $TMPC <<EOF 3046efe556adSCorentin Chary//#include <stdio.h> 3047efe556adSCorentin Chary#include <png.h> 3048832ce9c2SScott Wood#include <stddef.h> 3049efe556adSCorentin Charyint main(void) { 3050efe556adSCorentin Chary png_structp png_ptr; 3051efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 30527edc3fedSPeter Maydell return png_ptr != 0; 3053efe556adSCorentin Chary} 3054efe556adSCorentin CharyEOF 305565d5d3f9SStefan Weil if $pkg_config libpng --exists; then 305689138857SStefan Weil vnc_png_cflags=$($pkg_config libpng --cflags) 305789138857SStefan Weil vnc_png_libs=$($pkg_config libpng --libs) 30589af8025eSBrad else 3059efe556adSCorentin Chary vnc_png_cflags="" 3060efe556adSCorentin Chary vnc_png_libs="-lpng" 30619af8025eSBrad fi 3062efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 3063efe556adSCorentin Chary vnc_png=yes 3064efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 30659af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 3066efe556adSCorentin Chary else 3067efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 306821684af0SStewart Smith feature_not_found "vnc-png" "Install libpng devel" 3069efe556adSCorentin Chary fi 3070efe556adSCorentin Chary vnc_png=no 3071efe556adSCorentin Chary fi 3072efe556adSCorentin Charyfi 3073efe556adSCorentin Chary 3074efe556adSCorentin Chary########################################## 30756a021536SGerd Hoffmann# xkbcommon probe 30766a021536SGerd Hoffmannif test "$xkbcommon" != "no" ; then 30776a021536SGerd Hoffmann if $pkg_config xkbcommon --exists; then 30786a021536SGerd Hoffmann xkbcommon_cflags=$($pkg_config xkbcommon --cflags) 30796a021536SGerd Hoffmann xkbcommon_libs=$($pkg_config xkbcommon --libs) 30806a021536SGerd Hoffmann xkbcommon=yes 30816a021536SGerd Hoffmann else 30826a021536SGerd Hoffmann if test "$xkbcommon" = "yes" ; then 30836a021536SGerd Hoffmann feature_not_found "xkbcommon" "Install libxkbcommon-devel" 30846a021536SGerd Hoffmann fi 30856a021536SGerd Hoffmann xkbcommon=no 30866a021536SGerd Hoffmann fi 30876a021536SGerd Hoffmannfi 30886a021536SGerd Hoffmann 30896a021536SGerd Hoffmann########################################## 309076655d6dSaliguori# fnmatch() probe, used for ACL routines 309176655d6dSaliguorifnmatch="no" 309276655d6dSaliguoricat > $TMPC << EOF 309376655d6dSaliguori#include <fnmatch.h> 309476655d6dSaliguoriint main(void) 309576655d6dSaliguori{ 309676655d6dSaliguori fnmatch("foo", "foo", 0); 309776655d6dSaliguori return 0; 309876655d6dSaliguori} 309976655d6dSaliguoriEOF 310052166aa0SJuan Quintelaif compile_prog "" "" ; then 310176655d6dSaliguori fnmatch="yes" 310276655d6dSaliguorifi 310376655d6dSaliguori 310476655d6dSaliguori########################################## 3105c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 3106dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 3107dce512deSChristoph Hellwig cat > $TMPC << EOF 3108ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 3109dce512deSChristoph Hellwig#include <xfs/xfs.h> 3110dce512deSChristoph Hellwigint main(void) 3111dce512deSChristoph Hellwig{ 3112dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 3113dce512deSChristoph Hellwig return 0; 3114dce512deSChristoph Hellwig} 3115dce512deSChristoph HellwigEOF 3116dce512deSChristoph Hellwig if compile_prog "" "" ; then 3117dce512deSChristoph Hellwig xfs="yes" 3118dce512deSChristoph Hellwig else 3119dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 312021684af0SStewart Smith feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 3121dce512deSChristoph Hellwig fi 3122dce512deSChristoph Hellwig xfs=no 3123dce512deSChristoph Hellwig fi 3124dce512deSChristoph Hellwigfi 3125dce512deSChristoph Hellwig 3126dce512deSChristoph Hellwig########################################## 31278a16d273Sths# vde libraries probe 3128dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 31294baae0acSJuan Quintela vde_libs="-lvdeplug" 31308a16d273Sths cat > $TMPC << EOF 31318a16d273Sths#include <libvdeplug.h> 31324a7f0e06Spbrookint main(void) 31334a7f0e06Spbrook{ 31344a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 3135fea08e08SPeter Maydell char s[] = ""; 3136fea08e08SPeter Maydell vde_open(s, s, &a); 31374a7f0e06Spbrook return 0; 31384a7f0e06Spbrook} 31398a16d273SthsEOF 314052166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 31414baae0acSJuan Quintela vde=yes 3142dfb278bdSJuan Quintela else 3143dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 314421684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3145dfb278bdSJuan Quintela fi 3146dfb278bdSJuan Quintela vde=no 31478a16d273Sths fi 31488a16d273Sthsfi 31498a16d273Sths 31508a16d273Sths########################################## 31510a985b37SVincenzo Maffione# netmap support probe 31520a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 31530a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 31540a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 31550a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 31560a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 315758952137SVincenzo Maffioneif test "$netmap" != "no" ; then 315858952137SVincenzo Maffione cat > $TMPC << EOF 315958952137SVincenzo Maffione#include <inttypes.h> 316058952137SVincenzo Maffione#include <net/if.h> 316158952137SVincenzo Maffione#include <net/netmap.h> 316258952137SVincenzo Maffione#include <net/netmap_user.h> 31630a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 31640a985b37SVincenzo Maffione#error 31650a985b37SVincenzo Maffione#endif 316658952137SVincenzo Maffioneint main(void) { return 0; } 316758952137SVincenzo MaffioneEOF 316858952137SVincenzo Maffione if compile_prog "" "" ; then 316958952137SVincenzo Maffione netmap=yes 317058952137SVincenzo Maffione else 317158952137SVincenzo Maffione if test "$netmap" = "yes" ; then 317258952137SVincenzo Maffione feature_not_found "netmap" 317358952137SVincenzo Maffione fi 317458952137SVincenzo Maffione netmap=no 317558952137SVincenzo Maffione fi 317658952137SVincenzo Maffionefi 317758952137SVincenzo Maffione 317858952137SVincenzo Maffione########################################## 317947e98658SCorey Bryant# libcap-ng library probe 318047e98658SCorey Bryantif test "$cap_ng" != "no" ; then 318147e98658SCorey Bryant cap_libs="-lcap-ng" 318247e98658SCorey Bryant cat > $TMPC << EOF 318347e98658SCorey Bryant#include <cap-ng.h> 318447e98658SCorey Bryantint main(void) 318547e98658SCorey Bryant{ 318647e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 318747e98658SCorey Bryant return 0; 318847e98658SCorey Bryant} 318947e98658SCorey BryantEOF 319047e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 319147e98658SCorey Bryant cap_ng=yes 319247e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 319347e98658SCorey Bryant else 319447e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 319521684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 319647e98658SCorey Bryant fi 319747e98658SCorey Bryant cap_ng=no 319847e98658SCorey Bryant fi 319947e98658SCorey Bryantfi 320047e98658SCorey Bryant 320147e98658SCorey Bryant########################################## 3202c2de5c91Smalc# Sound support libraries probe 32038f28f3fbSths 3204c2de5c91Smalcaudio_drv_probe() 3205c2de5c91Smalc{ 3206c2de5c91Smalc drv=$1 3207c2de5c91Smalc hdr=$2 3208c2de5c91Smalc lib=$3 3209c2de5c91Smalc exp=$4 3210c2de5c91Smalc cfl=$5 32118f28f3fbSths cat > $TMPC << EOF 3212c2de5c91Smalc#include <$hdr> 3213c2de5c91Smalcint main(void) { $exp } 32148f28f3fbSthsEOF 321552166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 32168f28f3fbSths : 32178f28f3fbSths else 321876ad07a4SPeter Maydell error_exit "$drv check failed" \ 321976ad07a4SPeter Maydell "Make sure to have the $drv libs and headers installed." 32208f28f3fbSths fi 3221c2de5c91Smalc} 3222c2de5c91Smalc 322389138857SStefan Weilaudio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3224c2de5c91Smalcfor drv in $audio_drv_list; do 3225c2de5c91Smalc case $drv in 3226c2de5c91Smalc alsa) 3227c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 3228e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 3229b1149911SFam Zheng alsa_libs="-lasound" 3230c2de5c91Smalc ;; 3231c2de5c91Smalc 3232b8e59f18Smalc pa) 3233e58ff62dSPeter Krempa audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \ 3234e58ff62dSPeter Krempa "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;" 3235b1149911SFam Zheng pulse_libs="-lpulse" 323667f86e8eSJuan Quintela audio_pt_int="yes" 3237b8e59f18Smalc ;; 3238b8e59f18Smalc 3239373967b2SGerd Hoffmann sdl) 3240373967b2SGerd Hoffmann if test "$sdl" = "no"; then 3241373967b2SGerd Hoffmann error_exit "sdl not found or disabled, can not use sdl audio driver" 3242373967b2SGerd Hoffmann fi 3243373967b2SGerd Hoffmann ;; 3244373967b2SGerd Hoffmann 3245997e690aSJuan Quintela coreaudio) 3246b1149911SFam Zheng coreaudio_libs="-framework CoreAudio" 3247997e690aSJuan Quintela ;; 3248997e690aSJuan Quintela 3249a4bf6780SJuan Quintela dsound) 3250b1149911SFam Zheng dsound_libs="-lole32 -ldxguid" 3251d5631638Smalc audio_win_int="yes" 3252a4bf6780SJuan Quintela ;; 3253a4bf6780SJuan Quintela 3254a4bf6780SJuan Quintela oss) 3255b1149911SFam Zheng oss_libs="$oss_lib" 3256a4bf6780SJuan Quintela ;; 3257a4bf6780SJuan Quintela 3258373967b2SGerd Hoffmann wav) 3259373967b2SGerd Hoffmann # XXX: Probes for CoreAudio, DirectSound 32602f6a1ab0Sblueswir1 ;; 32612f6a1ab0Sblueswir1 3262e4c63a6aSmalc *) 32631c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 326476ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 326576ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 3266e4c63a6aSmalc } 3267e4c63a6aSmalc ;; 3268c2de5c91Smalc esac 3269c2de5c91Smalcdone 32708f28f3fbSths 32714d3b6f6eSbalrog########################################## 32722e4d9fb1Saurel32# BrlAPI probe 32732e4d9fb1Saurel32 32744ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 3275eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 32762e4d9fb1Saurel32 cat > $TMPC << EOF 32772e4d9fb1Saurel32#include <brlapi.h> 3278832ce9c2SScott Wood#include <stddef.h> 32792e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 32802e4d9fb1Saurel32EOF 328152166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 32822e4d9fb1Saurel32 brlapi=yes 32834ffcedb6SJuan Quintela else 32844ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 328521684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 32864ffcedb6SJuan Quintela fi 32874ffcedb6SJuan Quintela brlapi=no 3288eb82284fSJuan Quintela fi 3289eb82284fSJuan Quintelafi 32902e4d9fb1Saurel32 32912e4d9fb1Saurel32########################################## 32924d3b6f6eSbalrog# curses probe 3293a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 3294e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 32958ddc5bf9SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 32968ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3297e095e2f3SStefan Weil else 32987c703002SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 32998ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3300e095e2f3SStefan Weil fi 3301c584a6d0SJuan Quintela curses_found=no 33024d3b6f6eSbalrog cat > $TMPC << EOF 33038ddc5bf9SSamuel Thibault#include <locale.h> 33044d3b6f6eSbalrog#include <curses.h> 33058ddc5bf9SSamuel Thibault#include <wchar.h> 3306ef9a2524SStefan Weilint main(void) { 33078ddc5bf9SSamuel Thibault wchar_t wch = L'w'; 33088ddc5bf9SSamuel Thibault setlocale(LC_ALL, ""); 3309ef9a2524SStefan Weil resize_term(0, 0); 33108ddc5bf9SSamuel Thibault addwstr(L"wide chars\n"); 33118ddc5bf9SSamuel Thibault addnwstr(&wch, 1); 33127c703002SSamuel Thibault add_wch(WACS_DEGREE); 3313271f37abSKamil Rytarowski return 0; 3314ef9a2524SStefan Weil} 33154d3b6f6eSbalrogEOF 3316ecbe251fSVadim Evard IFS=: 33178ddc5bf9SSamuel Thibault for curses_inc in $curses_inc_list; do 3318b01a4fd3SPeter Maydell # Make sure we get the wide character prototypes 3319b01a4fd3SPeter Maydell curses_inc="-DNCURSES_WIDECHAR $curses_inc" 33207c703002SSamuel Thibault IFS=: 33218ddc5bf9SSamuel Thibault for curses_lib in $curses_lib_list; do 3322ecbe251fSVadim Evard unset IFS 33238ddc5bf9SSamuel Thibault if compile_prog "$curses_inc" "$curses_lib" ; then 3324c584a6d0SJuan Quintela curses_found=yes 33254f78ef9aSJuan Quintela break 33264d3b6f6eSbalrog fi 33274f78ef9aSJuan Quintela done 33287c703002SSamuel Thibault if test "$curses_found" = yes ; then 33297c703002SSamuel Thibault break 33307c703002SSamuel Thibault fi 33318ddc5bf9SSamuel Thibault done 3332ecbe251fSVadim Evard unset IFS 3333c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 3334c584a6d0SJuan Quintela curses=yes 3335c584a6d0SJuan Quintela else 3336c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 333721684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 3338c584a6d0SJuan Quintela fi 3339c584a6d0SJuan Quintela curses=no 3340c584a6d0SJuan Quintela fi 33414f78ef9aSJuan Quintelafi 33424d3b6f6eSbalrog 3343414f0dabSblueswir1########################################## 3344769ce76dSAlexander Graf# curl probe 3345a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 334665d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 3347a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 33484e2b0658SPaolo Bonzini else 33494e2b0658SPaolo Bonzini curlconfig=curl-config 33504e2b0658SPaolo Bonzini fi 3351769ce76dSAlexander Graf cat > $TMPC << EOF 3352769ce76dSAlexander Graf#include <curl/curl.h> 33530b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3354769ce76dSAlexander GrafEOF 335589138857SStefan Weil curl_cflags=$($curlconfig --cflags 2>/dev/null) 335689138857SStefan Weil curl_libs=$($curlconfig --libs 2>/dev/null) 3357b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 3358769ce76dSAlexander Graf curl=yes 3359788c8196SJuan Quintela else 3360788c8196SJuan Quintela if test "$curl" = "yes" ; then 336121684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 3362788c8196SJuan Quintela fi 3363788c8196SJuan Quintela curl=no 3364769ce76dSAlexander Graf fi 3365769ce76dSAlexander Graffi # test "$curl" 3366769ce76dSAlexander Graf 3367769ce76dSAlexander Graf########################################## 3368fb599c9aSbalrog# bluez support probe 3369a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 3370e820e3f4Sbalrog cat > $TMPC << EOF 3371e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 3372e820e3f4Sbalrogint main(void) { return bt_error(0); } 3373e820e3f4SbalrogEOF 337489138857SStefan Weil bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null) 337589138857SStefan Weil bluez_libs=$($pkg_config --libs bluez 2>/dev/null) 337652166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 3377a20a6f46SJuan Quintela bluez=yes 3378e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 3379e820e3f4Sbalrog else 3380a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 338121684af0SStewart Smith feature_not_found "bluez" "Install bluez-libs/libbluetooth devel" 3382a20a6f46SJuan Quintela fi 3383e820e3f4Sbalrog bluez="no" 3384e820e3f4Sbalrog fi 3385fb599c9aSbalrogfi 3386fb599c9aSbalrog 3387fb599c9aSbalrog########################################## 3388e18df141SAnthony Liguori# glib support probe 3389a52d28afSPaolo Bonzini 3390ad04d8cbSPeter Maydellif test "$mingw32" = yes; then 3391ad04d8cbSPeter Maydell glib_req_ver=2.30 3392ad04d8cbSPeter Maydellelse 3393f40685c6SJohn Snow glib_req_ver=2.22 3394ad04d8cbSPeter Maydellfi 3395aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 3396aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 3397a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 3398aa0d1f44SPaolo Bonzinifi 3399e26110cfSFam Zheng 34004eaf7202SSameeh Jubran# This workaround is required due to a bug in pkg-config file for glib as it 34014eaf7202SSameeh Jubran# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 34024eaf7202SSameeh Jubran 34034eaf7202SSameeh Jubranif test "$static" = yes -a "$mingw32" = yes; then 34044eaf7202SSameeh Jubran QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" 34054eaf7202SSameeh Jubranfi 34064eaf7202SSameeh Jubran 3407aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 3408e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 340989138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 341089138857SStefan Weil glib_libs=$($pkg_config --libs $i) 34114a058899SMarc-André Lureau QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" 341214015304SAnthony Liguori LIBS="$glib_libs $LIBS" 3413957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 3414e18df141SAnthony Liguori else 3415e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 3416e26110cfSFam Zheng fi 3417e26110cfSFam Zhengdone 3418e26110cfSFam Zheng 3419977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 3420977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 3421977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 3422977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 3423977a82abSDaniel P. Berrangecat > $TMPC <<EOF 3424977a82abSDaniel P. Berrange#include <glib.h> 3425977a82abSDaniel P. Berrange#include <unistd.h> 3426977a82abSDaniel P. Berrange 3427977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 3428977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 3429977a82abSDaniel P. Berrange 3430977a82abSDaniel P. Berrangeint main(void) { 3431977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 3432977a82abSDaniel P. Berrange return 0; 3433977a82abSDaniel P. Berrange} 3434977a82abSDaniel P. BerrangeEOF 3435977a82abSDaniel P. Berrange 34365919e032SStefan Weilif ! compile_prog "$CFLAGS" "$LIBS" ; then 3437977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 3438977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 3439977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 3440977a82abSDaniel P. Berrange "build target" 3441977a82abSDaniel P. Berrangefi 3442977a82abSDaniel P. Berrange 34439d41401bSMichael S. Tsirkin# g_test_trap_subprocess added in 2.38. Used by some tests. 34449d41401bSMichael S. Tsirkinglib_subprocess=yes 3445a049223aSMarc-André Lureauif ! $pkg_config --atleast-version=2.38 glib-2.0; then 34469d41401bSMichael S. Tsirkin glib_subprocess=no 34479d41401bSMichael S. Tsirkinfi 34489d41401bSMichael S. Tsirkin 3449bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 3450bbbf2e04SJohn Snowcat > $TMPC << EOF 3451bbbf2e04SJohn Snow#include <glib.h> 3452bbbf2e04SJohn Snowint main(void) { return 0; } 3453bbbf2e04SJohn SnowEOF 3454bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 3455bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 3456bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 3457bbbf2e04SJohn Snow CFLAGS="-Wno-unknown-attributes $CFLAGS" 3458bbbf2e04SJohn Snow fi 3459bbbf2e04SJohn Snowfi 3460bbbf2e04SJohn Snow 3461e26110cfSFam Zheng########################################## 3462e26110cfSFam Zheng# SHA command probe for modules 3463e26110cfSFam Zhengif test "$modules" = yes; then 3464e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 3465e26110cfSFam Zheng for c in $shacmd_probe; do 34668ccefb91SFam Zheng if has $c; then 3467e26110cfSFam Zheng shacmd="$c" 3468e26110cfSFam Zheng break 3469e26110cfSFam Zheng fi 3470e26110cfSFam Zheng done 3471e26110cfSFam Zheng if test "$shacmd" = ""; then 3472e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 3473e26110cfSFam Zheng fi 3474e18df141SAnthony Liguorifi 3475e18df141SAnthony Liguori 3476e18df141SAnthony Liguori########################################## 3477e2134eb9SGerd Hoffmann# pixman support probe 3478e2134eb9SGerd Hoffmann 347974880fe2SRobert Schieleif test "$want_tools" = "no" -a "$softmmu" = "no"; then 348074880fe2SRobert Schiele pixman_cflags= 348174880fe2SRobert Schiele pixman_libs= 348235c4e86cSGerd Hoffmannelif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then 348389138857SStefan Weil pixman_cflags=$($pkg_config --cflags pixman-1) 348489138857SStefan Weil pixman_libs=$($pkg_config --libs pixman-1) 3485e2134eb9SGerd Hoffmannelse 3486c12b6d70SGerd Hoffmann error_exit "pixman >= 0.21.8 not present." \ 3487c12b6d70SGerd Hoffmann "Please install the pixman devel package." 3488e2134eb9SGerd Hoffmannfi 3489e2134eb9SGerd Hoffmann 3490e2134eb9SGerd Hoffmann########################################## 3491fe8fc5aeSPaolo Bonzini# libmpathpersist probe 3492fe8fc5aeSPaolo Bonzini 3493fe8fc5aeSPaolo Bonziniif test "$mpath" != "no" ; then 3494fe8fc5aeSPaolo Bonzini cat > $TMPC <<EOF 3495fe8fc5aeSPaolo Bonzini#include <libudev.h> 3496fe8fc5aeSPaolo Bonzini#include <mpath_persist.h> 3497fe8fc5aeSPaolo Bonziniunsigned mpath_mx_alloc_len = 1024; 3498fe8fc5aeSPaolo Bonziniint logsink; 3499b3f1c8c4SPaolo Bonzinistatic struct config *multipath_conf; 3500b3f1c8c4SPaolo Bonziniextern struct udev *udev; 3501b3f1c8c4SPaolo Bonziniextern struct config *get_multipath_config(void); 3502b3f1c8c4SPaolo Bonziniextern void put_multipath_config(struct config *conf); 3503b3f1c8c4SPaolo Bonzinistruct udev *udev; 3504b3f1c8c4SPaolo Bonzinistruct config *get_multipath_config(void) { return multipath_conf; } 3505b3f1c8c4SPaolo Bonzinivoid put_multipath_config(struct config *conf) { } 3506b3f1c8c4SPaolo Bonzini 3507fe8fc5aeSPaolo Bonziniint main(void) { 3508b3f1c8c4SPaolo Bonzini udev = udev_new(); 3509b3f1c8c4SPaolo Bonzini multipath_conf = mpath_lib_init(); 3510fe8fc5aeSPaolo Bonzini return 0; 3511fe8fc5aeSPaolo Bonzini} 3512fe8fc5aeSPaolo BonziniEOF 3513fe8fc5aeSPaolo Bonzini if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 3514fe8fc5aeSPaolo Bonzini mpathpersist=yes 3515fe8fc5aeSPaolo Bonzini else 3516fe8fc5aeSPaolo Bonzini mpathpersist=no 3517fe8fc5aeSPaolo Bonzini fi 3518fe8fc5aeSPaolo Bonzinielse 3519fe8fc5aeSPaolo Bonzini mpathpersist=no 3520fe8fc5aeSPaolo Bonzinifi 3521fe8fc5aeSPaolo Bonzini 3522fe8fc5aeSPaolo Bonzini########################################## 352317bff52bSM. Mohan Kumar# libcap probe 352417bff52bSM. Mohan Kumar 352517bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 352617bff52bSM. Mohan Kumar cat > $TMPC <<EOF 352717bff52bSM. Mohan Kumar#include <stdio.h> 352817bff52bSM. Mohan Kumar#include <sys/capability.h> 3529cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 353017bff52bSM. Mohan KumarEOF 353117bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 353217bff52bSM. Mohan Kumar cap=yes 353317bff52bSM. Mohan Kumar else 353417bff52bSM. Mohan Kumar cap=no 353517bff52bSM. Mohan Kumar fi 353617bff52bSM. Mohan Kumarfi 353717bff52bSM. Mohan Kumar 353817bff52bSM. Mohan Kumar########################################## 3539e5d355d1Saliguori# pthread probe 35404b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 35413c529d93Saliguori 3542e5d355d1Saliguoripthread=no 3543414f0dabSblueswir1cat > $TMPC << EOF 35443c529d93Saliguori#include <pthread.h> 35457a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 35467a42bbe4SStefan Weilint main(void) { 35477a42bbe4SStefan Weil pthread_t thread; 35487a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 35497a42bbe4SStefan Weil return 0; 35507a42bbe4SStefan Weil} 3551414f0dabSblueswir1EOF 3552bd00d539SAndreas Färberif compile_prog "" "" ; then 3553bd00d539SAndreas Färber pthread=yes 3554bd00d539SAndreas Färberelse 3555de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 355652166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 3557e5d355d1Saliguori pthread=yes 3558e3c56761SPeter Portante found=no 3559e3c56761SPeter Portante for lib_entry in $LIBS; do 3560e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 3561e3c56761SPeter Portante found=yes 3562e3c56761SPeter Portante break 3563e3c56761SPeter Portante fi 3564e3c56761SPeter Portante done 3565e3c56761SPeter Portante if test "$found" = "no"; then 35665572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 356714ab3aa7SMarc-André Lureau libs_qga="$pthread_lib $libs_qga" 3568e3c56761SPeter Portante fi 3569409437e1SDaniel P. Berrange PTHREAD_LIB="$pthread_lib" 3570de65fe0fSSebastian Herbszt break 3571414f0dabSblueswir1 fi 3572de65fe0fSSebastian Herbszt done 3573bd00d539SAndreas Färberfi 3574414f0dabSblueswir1 35754617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 357676ad07a4SPeter Maydell error_exit "pthread check failed" \ 357776ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 3578e5d355d1Saliguorifi 3579e5d355d1Saliguori 35805c312079SDr. David Alan Gilbert# check for pthread_setname_np 35815c312079SDr. David Alan Gilbertpthread_setname_np=no 35825c312079SDr. David Alan Gilbertcat > $TMPC << EOF 35835c312079SDr. David Alan Gilbert#include <pthread.h> 35845c312079SDr. David Alan Gilbert 35855c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 35865c312079SDr. David Alan Gilbertint main(void) 35875c312079SDr. David Alan Gilbert{ 35885c312079SDr. David Alan Gilbert pthread_t thread; 35895c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 35905c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 35915c312079SDr. David Alan Gilbert return 0; 35925c312079SDr. David Alan Gilbert} 35935c312079SDr. David Alan GilbertEOF 35945c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 35955c312079SDr. David Alan Gilbert pthread_setname_np=yes 35965c312079SDr. David Alan Gilbertfi 35975c312079SDr. David Alan Gilbert 3598bf9298b9Saliguori########################################## 3599f27aaf4bSChristian Brunner# rbd probe 3600f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 3601f27aaf4bSChristian Brunner cat > $TMPC <<EOF 3602f27aaf4bSChristian Brunner#include <stdio.h> 3603ad32e9c0SJosh Durgin#include <rbd/librbd.h> 3604f27aaf4bSChristian Brunnerint main(void) { 3605ad32e9c0SJosh Durgin rados_t cluster; 3606ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 3607f27aaf4bSChristian Brunner return 0; 3608f27aaf4bSChristian Brunner} 3609f27aaf4bSChristian BrunnerEOF 3610ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 3611f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 3612f27aaf4bSChristian Brunner rbd=yes 3613f27aaf4bSChristian Brunner else 3614f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 361521684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 3616f27aaf4bSChristian Brunner fi 3617f27aaf4bSChristian Brunner rbd=no 3618f27aaf4bSChristian Brunner fi 3619f27aaf4bSChristian Brunnerfi 3620f27aaf4bSChristian Brunner 3621f27aaf4bSChristian Brunner########################################## 36220a12ec87SRichard W.M. Jones# libssh2 probe 36234fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8 36240a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then 362565d5d3f9SStefan Weil if $pkg_config --atleast-version=$min_libssh2_version libssh2; then 362689138857SStefan Weil libssh2_cflags=$($pkg_config libssh2 --cflags) 362789138857SStefan Weil libssh2_libs=$($pkg_config libssh2 --libs) 36280a12ec87SRichard W.M. Jones libssh2=yes 36290a12ec87SRichard W.M. Jones else 36300a12ec87SRichard W.M. Jones if test "$libssh2" = "yes" ; then 36314fc16838SRichard W.M. Jones error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" 36320a12ec87SRichard W.M. Jones fi 36330a12ec87SRichard W.M. Jones libssh2=no 36340a12ec87SRichard W.M. Jones fi 36350a12ec87SRichard W.M. Jonesfi 36360a12ec87SRichard W.M. Jones 36370a12ec87SRichard W.M. Jones########################################## 36389a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe 36399a2d462eSRichard W.M. Jones 36409a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then 36419a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 36429a2d462eSRichard W.M. Jones#include <stdio.h> 36439a2d462eSRichard W.M. Jones#include <libssh2.h> 36449a2d462eSRichard W.M. Jones#include <libssh2_sftp.h> 36459a2d462eSRichard W.M. Jonesint main(void) { 36469a2d462eSRichard W.M. Jones LIBSSH2_SESSION *session; 36479a2d462eSRichard W.M. Jones LIBSSH2_SFTP *sftp; 36489a2d462eSRichard W.M. Jones LIBSSH2_SFTP_HANDLE *sftp_handle; 36499a2d462eSRichard W.M. Jones session = libssh2_session_init (); 36509a2d462eSRichard W.M. Jones sftp = libssh2_sftp_init (session); 36519a2d462eSRichard W.M. Jones sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); 36529a2d462eSRichard W.M. Jones libssh2_sftp_fsync (sftp_handle); 36539a2d462eSRichard W.M. Jones return 0; 36549a2d462eSRichard W.M. Jones} 36559a2d462eSRichard W.M. JonesEOF 36569a2d462eSRichard W.M. Jones # libssh2_cflags/libssh2_libs defined in previous test. 36579a2d462eSRichard W.M. Jones if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then 36589a2d462eSRichard W.M. Jones QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" 36599a2d462eSRichard W.M. Jones fi 36609a2d462eSRichard W.M. Jonesfi 36619a2d462eSRichard W.M. Jones 36629a2d462eSRichard W.M. Jones########################################## 36635c6c3a6cSChristoph Hellwig# linux-aio probe 36645c6c3a6cSChristoph Hellwig 36655c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 36665c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 36675c6c3a6cSChristoph Hellwig#include <libaio.h> 36685c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 3669832ce9c2SScott Wood#include <stddef.h> 36705c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 36715c6c3a6cSChristoph HellwigEOF 36725c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 36735c6c3a6cSChristoph Hellwig linux_aio=yes 36745c6c3a6cSChristoph Hellwig else 36755c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 367621684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 36775c6c3a6cSChristoph Hellwig fi 36783cfcae3cSLuiz Capitulino linux_aio=no 36795c6c3a6cSChristoph Hellwig fi 36805c6c3a6cSChristoph Hellwigfi 36815c6c3a6cSChristoph Hellwig 36825c6c3a6cSChristoph Hellwig########################################## 36833b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux 36843b8acc11SPaolo Bonzini 36853b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then 36863b8acc11SPaolo Bonzini tpm_passthrough=$tpm 36873b8acc11SPaolo Bonzinielse 36883b8acc11SPaolo Bonzini tpm_passthrough=no 36893b8acc11SPaolo Bonzinifi 36903b8acc11SPaolo Bonzini 3691f4ede81eSAmarnath Valluri# TPM emulator is for all posix systems 3692f4ede81eSAmarnath Valluriif test "$mingw32" != "yes"; then 3693f4ede81eSAmarnath Valluri tpm_emulator=$tpm 3694f4ede81eSAmarnath Vallurielse 3695f4ede81eSAmarnath Valluri tpm_emulator=no 3696f4ede81eSAmarnath Vallurifi 36973b8acc11SPaolo Bonzini########################################## 3698758e8e38SVenkateswararao Jujjuri (JV)# attr probe 3699758e8e38SVenkateswararao Jujjuri (JV) 3700758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 3701758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 3702758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 3703758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 3704f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 3705f2338fb4SPavel Borzenkov#include <attr/xattr.h> 3706f2338fb4SPavel Borzenkov#else 37074f26f2b6SAvi Kivity#include <sys/xattr.h> 3708f2338fb4SPavel Borzenkov#endif 3709758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 3710758e8e38SVenkateswararao Jujjuri (JV)EOF 37114f26f2b6SAvi Kivity if compile_prog "" "" ; then 37124f26f2b6SAvi Kivity attr=yes 37134f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 3714f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 3715758e8e38SVenkateswararao Jujjuri (JV) attr=yes 3716758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 37174f26f2b6SAvi Kivity libattr=yes 3718758e8e38SVenkateswararao Jujjuri (JV) else 3719758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 372021684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 3721758e8e38SVenkateswararao Jujjuri (JV) fi 3722758e8e38SVenkateswararao Jujjuri (JV) attr=no 3723758e8e38SVenkateswararao Jujjuri (JV) fi 3724758e8e38SVenkateswararao Jujjuri (JV)fi 3725758e8e38SVenkateswararao Jujjuri (JV) 3726758e8e38SVenkateswararao Jujjuri (JV)########################################## 3727bf9298b9Saliguori# iovec probe 3728bf9298b9Saliguoricat > $TMPC <<EOF 3729db34f0b3Sblueswir1#include <sys/types.h> 3730bf9298b9Saliguori#include <sys/uio.h> 3731db34f0b3Sblueswir1#include <unistd.h> 3732f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 3733bf9298b9SaliguoriEOF 3734bf9298b9Saliguoriiovec=no 373552166aa0SJuan Quintelaif compile_prog "" "" ; then 3736bf9298b9Saliguori iovec=yes 3737bf9298b9Saliguorifi 3738bf9298b9Saliguori 3739f652e6afSaurel32########################################## 3740ceb42de8Saliguori# preadv probe 3741ceb42de8Saliguoricat > $TMPC <<EOF 3742ceb42de8Saliguori#include <sys/types.h> 3743ceb42de8Saliguori#include <sys/uio.h> 3744ceb42de8Saliguori#include <unistd.h> 3745c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 3746ceb42de8SaliguoriEOF 3747ceb42de8Saliguoripreadv=no 374852166aa0SJuan Quintelaif compile_prog "" "" ; then 3749ceb42de8Saliguori preadv=yes 3750ceb42de8Saliguorifi 3751ceb42de8Saliguori 3752ceb42de8Saliguori########################################## 3753f652e6afSaurel32# fdt probe 3754e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 3755e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 3756e169e1e1SPeter Maydellfdt_required=no 3757e169e1e1SPeter Maydellfor target in $target_list; do 3758e169e1e1SPeter Maydell case $target in 3759a666409fSKONRAD Frederic aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu) 3760e169e1e1SPeter Maydell fdt_required=yes 3761e169e1e1SPeter Maydell ;; 3762e169e1e1SPeter Maydell esac 3763e169e1e1SPeter Maydelldone 3764e169e1e1SPeter Maydell 3765e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 3766e169e1e1SPeter Maydell if test "$fdt" = "no"; then 3767e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 3768e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 3769e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 3770e169e1e1SPeter Maydell fi 3771e169e1e1SPeter Maydell fdt=yes 3772e169e1e1SPeter Maydellfi 3773e169e1e1SPeter Maydell 37742df87df7SJuan Quintelaif test "$fdt" != "no" ; then 3775b41af4baSJuan Quintela fdt_libs="-lfdt" 377696ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 37776e85fce0SPaul Burton # and test for required functions to make sure we are on a version >= 1.4.2 3778f652e6afSaurel32 cat > $TMPC << EOF 377931ce0adbSThomas Huth#include <libfdt.h> 378096ce6545SPeter Crosthwaite#include <libfdt_env.h> 37816e85fce0SPaul Burtonint main(void) { fdt_first_subnode(0, 0); return 0; } 3782f652e6afSaurel32EOF 378352166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 3784a540f158SPeter Crosthwaite # system DTC is good - use it 3785e3971d61SPhilippe Mathieu-Daudé fdt=system 3786aef45d51SDaniel P. Berrange else 3787aef45d51SDaniel P. Berrange # have GIT checkout, so activate dtc submodule 3788aef45d51SDaniel P. Berrange if test -e "${source_path}/.git" ; then 3789aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 3790aef45d51SDaniel P. Berrange fi 3791aef45d51SDaniel P. Berrange if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then 3792e3971d61SPhilippe Mathieu-Daudé fdt=git 3793a540f158SPeter Crosthwaite mkdir -p dtc 3794cab00a5aSMichael S. Tsirkin if [ "$pwd_is_source_path" != "y" ] ; then 3795a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 3796a540f158SPeter Crosthwaite symlink "$source_path/dtc/scripts" "dtc/scripts" 37972df87df7SJuan Quintela fi 3798a540f158SPeter Crosthwaite fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 37998a99e9a3SPhilippe Mathieu-Daudé fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" 38008a99e9a3SPhilippe Mathieu-Daudé fdt_libs="$fdt_libs" 3801a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 3802aef45d51SDaniel P. Berrange # Not a git build & no libfdt found, prompt for system install 3803aef45d51SDaniel P. Berrange error_exit "DTC (libfdt) version >= 1.4.2 not present." \ 3804aef45d51SDaniel P. Berrange "Please install the DTC (libfdt) devel package" 3805a540f158SPeter Crosthwaite else 3806a540f158SPeter Crosthwaite # don't have and don't want 3807de3a354aSMichael Walle fdt_libs= 38082df87df7SJuan Quintela fdt=no 3809f652e6afSaurel32 fi 3810f652e6afSaurel32 fi 3811aef45d51SDaniel P. Berrangefi 3812f652e6afSaurel32 3813a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 3814a540f158SPeter Crosthwaite 381520ff075bSMichael Walle########################################## 3816fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 3817b1546f32SGerd Hoffmann 3818da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 3819014cb152SGerd Hoffmann opengl_pkgs="epoxy libdrm gbm" 38205f9b1e35SGerd Hoffmann if $pkg_config $opengl_pkgs; then 38215f9b1e35SGerd Hoffmann opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 38225f9b1e35SGerd Hoffmann opengl_libs="$($pkg_config --libs $opengl_pkgs)" 3823da076ffeSGerd Hoffmann opengl=yes 3824925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 3825925a0400SGerd Hoffmann gtk_gl="yes" 3826925a0400SGerd Hoffmann fi 3827cc720a5dSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" 382820ff075bSMichael Walle else 3829da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3830dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 383120ff075bSMichael Walle fi 3832f676c67eSJeremy White opengl_cflags="" 3833da076ffeSGerd Hoffmann opengl_libs="" 3834da076ffeSGerd Hoffmann opengl=no 383520ff075bSMichael Walle fi 383620ff075bSMichael Wallefi 383720ff075bSMichael Walle 3838014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 3839014cb152SGerd Hoffmann cat > $TMPC << EOF 3840014cb152SGerd Hoffmann#include <epoxy/egl.h> 3841014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 3842014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 3843014cb152SGerd Hoffmann#endif 3844014cb152SGerd Hoffmannint main(void) { return 0; } 3845014cb152SGerd HoffmannEOF 3846014cb152SGerd Hoffmann if compile_prog "" "" ; then 3847014cb152SGerd Hoffmann opengl_dmabuf=yes 3848014cb152SGerd Hoffmann fi 3849014cb152SGerd Hoffmannfi 3850c9a12e75SChrysostomos Nanakos 3851ed279a06SKlim Kireev########################################## 3852ed279a06SKlim Kireev# libxml2 probe 3853ed279a06SKlim Kireevif test "$libxml2" != "no" ; then 3854ed279a06SKlim Kireev if $pkg_config --exists libxml-2.0; then 3855ed279a06SKlim Kireev libxml2="yes" 3856ed279a06SKlim Kireev libxml2_cflags=$($pkg_config --cflags libxml-2.0) 3857ed279a06SKlim Kireev libxml2_libs=$($pkg_config --libs libxml-2.0) 3858ed279a06SKlim Kireev else 3859ed279a06SKlim Kireev if test "$libxml2" = "yes"; then 3860ed279a06SKlim Kireev feature_not_found "libxml2" "Install libxml2 devel" 3861ed279a06SKlim Kireev fi 3862ed279a06SKlim Kireev libxml2="no" 3863ed279a06SKlim Kireev fi 3864ed279a06SKlim Kireevfi 3865c9a12e75SChrysostomos Nanakos 3866eb100396SBharata B Rao########################################## 3867eb100396SBharata B Rao# glusterfs probe 3868eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 386965d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 3870e01bee08SBharata B Rao glusterfs="yes" 387189138857SStefan Weil glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 387289138857SStefan Weil glusterfs_libs=$($pkg_config --libs glusterfs-api) 3873d85fa9ebSJeff Cody if $pkg_config --atleast-version=4 glusterfs-api; then 3874d85fa9ebSJeff Cody glusterfs_xlator_opt="yes" 3875d85fa9ebSJeff Cody fi 387665d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 38770c14fb47SBharata B Rao glusterfs_discard="yes" 38780c14fb47SBharata B Rao fi 38797c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 3880df3a429aSNiels de Vos glusterfs_fallocate="yes" 38817c815372SBharata B Rao glusterfs_zerofill="yes" 38827c815372SBharata B Rao fi 3883eb100396SBharata B Rao else 3884eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 38858efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 38868efc9363SHu Tao "Install glusterfs-api devel >= 3" 3887eb100396SBharata B Rao fi 3888e01bee08SBharata B Rao glusterfs="no" 3889eb100396SBharata B Rao fi 3890eb100396SBharata B Raofi 3891eb100396SBharata B Rao 389239386ac7Saurel32# Check for inotify functions when we are building linux-user 38933b3f24adSaurel32# emulator. This is done because older glibc versions don't 38943b3f24adSaurel32# have syscall stubs for these implemented. In that case we 38953b3f24adSaurel32# don't provide them even if kernel supports them. 38963b3f24adSaurel32# 38973b3f24adSaurel32inotify=no 38983b3f24adSaurel32cat > $TMPC << EOF 38993b3f24adSaurel32#include <sys/inotify.h> 39003b3f24adSaurel32 39013b3f24adSaurel32int 39023b3f24adSaurel32main(void) 39033b3f24adSaurel32{ 39043b3f24adSaurel32 /* try to start inotify */ 39058690e420Saurel32 return inotify_init(); 39063b3f24adSaurel32} 39073b3f24adSaurel32EOF 390852166aa0SJuan Quintelaif compile_prog "" "" ; then 39093b3f24adSaurel32 inotify=yes 39103b3f24adSaurel32fi 39113b3f24adSaurel32 3912c05c7a73SRiku Voipioinotify1=no 3913c05c7a73SRiku Voipiocat > $TMPC << EOF 3914c05c7a73SRiku Voipio#include <sys/inotify.h> 3915c05c7a73SRiku Voipio 3916c05c7a73SRiku Voipioint 3917c05c7a73SRiku Voipiomain(void) 3918c05c7a73SRiku Voipio{ 3919c05c7a73SRiku Voipio /* try to start inotify */ 3920c05c7a73SRiku Voipio return inotify_init1(0); 3921c05c7a73SRiku Voipio} 3922c05c7a73SRiku VoipioEOF 3923c05c7a73SRiku Voipioif compile_prog "" "" ; then 3924c05c7a73SRiku Voipio inotify1=yes 3925c05c7a73SRiku Voipiofi 3926c05c7a73SRiku Voipio 3927099d6b0fSRiku Voipio# check if pipe2 is there 3928099d6b0fSRiku Voipiopipe2=no 3929099d6b0fSRiku Voipiocat > $TMPC << EOF 3930099d6b0fSRiku Voipio#include <unistd.h> 3931099d6b0fSRiku Voipio#include <fcntl.h> 3932099d6b0fSRiku Voipio 3933099d6b0fSRiku Voipioint main(void) 3934099d6b0fSRiku Voipio{ 3935099d6b0fSRiku Voipio int pipefd[2]; 39369bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 3937099d6b0fSRiku Voipio} 3938099d6b0fSRiku VoipioEOF 393952166aa0SJuan Quintelaif compile_prog "" "" ; then 3940099d6b0fSRiku Voipio pipe2=yes 3941099d6b0fSRiku Voipiofi 3942099d6b0fSRiku Voipio 394340ff6d7eSKevin Wolf# check if accept4 is there 394440ff6d7eSKevin Wolfaccept4=no 394540ff6d7eSKevin Wolfcat > $TMPC << EOF 394640ff6d7eSKevin Wolf#include <sys/socket.h> 394740ff6d7eSKevin Wolf#include <stddef.h> 394840ff6d7eSKevin Wolf 394940ff6d7eSKevin Wolfint main(void) 395040ff6d7eSKevin Wolf{ 395140ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 395240ff6d7eSKevin Wolf return 0; 395340ff6d7eSKevin Wolf} 395440ff6d7eSKevin WolfEOF 395540ff6d7eSKevin Wolfif compile_prog "" "" ; then 395640ff6d7eSKevin Wolf accept4=yes 395740ff6d7eSKevin Wolffi 395840ff6d7eSKevin Wolf 39593ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 39603ce34dfbSvibisreenivasansplice=no 39613ce34dfbSvibisreenivasancat > $TMPC << EOF 39623ce34dfbSvibisreenivasan#include <unistd.h> 39633ce34dfbSvibisreenivasan#include <fcntl.h> 39643ce34dfbSvibisreenivasan#include <limits.h> 39653ce34dfbSvibisreenivasan 39663ce34dfbSvibisreenivasanint main(void) 39673ce34dfbSvibisreenivasan{ 396866ea0f22SStefan Weil int len, fd = 0; 39693ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 39703ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 39713ce34dfbSvibisreenivasan return 0; 39723ce34dfbSvibisreenivasan} 39733ce34dfbSvibisreenivasanEOF 397452166aa0SJuan Quintelaif compile_prog "" "" ; then 39753ce34dfbSvibisreenivasan splice=yes 39763ce34dfbSvibisreenivasanfi 39773ce34dfbSvibisreenivasan 3978dcc38d1cSMarcelo Tosatti########################################## 3979a99d57bbSWanlong Gao# libnuma probe 3980a99d57bbSWanlong Gao 3981a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 3982a99d57bbSWanlong Gao cat > $TMPC << EOF 3983a99d57bbSWanlong Gao#include <numa.h> 3984a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 3985a99d57bbSWanlong GaoEOF 3986a99d57bbSWanlong Gao 3987a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 3988a99d57bbSWanlong Gao numa=yes 3989a99d57bbSWanlong Gao libs_softmmu="-lnuma $libs_softmmu" 3990a99d57bbSWanlong Gao else 3991a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 3992a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 3993a99d57bbSWanlong Gao fi 3994a99d57bbSWanlong Gao numa=no 3995a99d57bbSWanlong Gao fi 3996a99d57bbSWanlong Gaofi 3997a99d57bbSWanlong Gao 39987b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 39997b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 40007b01cb97SAlexandre Derumier exit 1 40017b01cb97SAlexandre Derumierfi 40027b01cb97SAlexandre Derumier 40035a22ab71SYang Zhong# Even if malloc_trim() is available, these non-libc memory allocators 40045a22ab71SYang Zhong# do not support it. 40055a22ab71SYang Zhongif test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then 40065a22ab71SYang Zhong if test "$malloc_trim" = "yes" ; then 40075a22ab71SYang Zhong echo "Disabling malloc_trim with non-libc memory allocator" 40085a22ab71SYang Zhong fi 40095a22ab71SYang Zhong malloc_trim="no" 40105a22ab71SYang Zhongfi 40115a22ab71SYang Zhong 40125a22ab71SYang Zhong####################################### 40135a22ab71SYang Zhong# malloc_trim 40145a22ab71SYang Zhong 40155a22ab71SYang Zhongif test "$malloc_trim" != "no" ; then 40165a22ab71SYang Zhong cat > $TMPC << EOF 40175a22ab71SYang Zhong#include <malloc.h> 40185a22ab71SYang Zhongint main(void) { malloc_trim(0); return 0; } 40195a22ab71SYang ZhongEOF 40205a22ab71SYang Zhong if compile_prog "" "" ; then 40215a22ab71SYang Zhong malloc_trim="yes" 40225a22ab71SYang Zhong else 40235a22ab71SYang Zhong malloc_trim="no" 40245a22ab71SYang Zhong fi 40255a22ab71SYang Zhongfi 40265a22ab71SYang Zhong 4027a99d57bbSWanlong Gao########################################## 40282847b469SFam Zheng# tcmalloc probe 40292847b469SFam Zheng 40302847b469SFam Zhengif test "$tcmalloc" = "yes" ; then 40312847b469SFam Zheng cat > $TMPC << EOF 40322847b469SFam Zheng#include <stdlib.h> 40332847b469SFam Zhengint main(void) { malloc(1); return 0; } 40342847b469SFam ZhengEOF 40352847b469SFam Zheng 40362847b469SFam Zheng if compile_prog "" "-ltcmalloc" ; then 40372847b469SFam Zheng LIBS="-ltcmalloc $LIBS" 40382847b469SFam Zheng else 40392847b469SFam Zheng feature_not_found "tcmalloc" "install gperftools devel" 40402847b469SFam Zheng fi 40412847b469SFam Zhengfi 40422847b469SFam Zheng 40432847b469SFam Zheng########################################## 40447b01cb97SAlexandre Derumier# jemalloc probe 40457b01cb97SAlexandre Derumier 40467b01cb97SAlexandre Derumierif test "$jemalloc" = "yes" ; then 40477b01cb97SAlexandre Derumier cat > $TMPC << EOF 40487b01cb97SAlexandre Derumier#include <stdlib.h> 40497b01cb97SAlexandre Derumierint main(void) { malloc(1); return 0; } 40507b01cb97SAlexandre DerumierEOF 40517b01cb97SAlexandre Derumier 40527b01cb97SAlexandre Derumier if compile_prog "" "-ljemalloc" ; then 40537b01cb97SAlexandre Derumier LIBS="-ljemalloc $LIBS" 40547b01cb97SAlexandre Derumier else 40557b01cb97SAlexandre Derumier feature_not_found "jemalloc" "install jemalloc devel" 40567b01cb97SAlexandre Derumier fi 40577b01cb97SAlexandre Derumierfi 40587b01cb97SAlexandre Derumier 40597b01cb97SAlexandre Derumier########################################## 4060dcc38d1cSMarcelo Tosatti# signalfd probe 4061dcc38d1cSMarcelo Tosattisignalfd="no" 4062dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 4063dcc38d1cSMarcelo Tosatti#include <unistd.h> 4064dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 4065dcc38d1cSMarcelo Tosatti#include <signal.h> 4066dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4067dcc38d1cSMarcelo TosattiEOF 4068dcc38d1cSMarcelo Tosatti 4069dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 4070dcc38d1cSMarcelo Tosatti signalfd=yes 4071dcc38d1cSMarcelo Tosattifi 4072dcc38d1cSMarcelo Tosatti 4073c2882b96SRiku Voipio# check if eventfd is supported 4074c2882b96SRiku Voipioeventfd=no 4075c2882b96SRiku Voipiocat > $TMPC << EOF 4076c2882b96SRiku Voipio#include <sys/eventfd.h> 4077c2882b96SRiku Voipio 4078c2882b96SRiku Voipioint main(void) 4079c2882b96SRiku Voipio{ 408055cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4081c2882b96SRiku Voipio} 4082c2882b96SRiku VoipioEOF 4083c2882b96SRiku Voipioif compile_prog "" "" ; then 4084c2882b96SRiku Voipio eventfd=yes 4085c2882b96SRiku Voipiofi 4086c2882b96SRiku Voipio 4087751bcc39SMarc-André Lureau# check if memfd is supported 4088751bcc39SMarc-André Lureaumemfd=no 4089751bcc39SMarc-André Lureaucat > $TMPC << EOF 409075e5b70eSPaolo Bonzini#include <sys/mman.h> 4091751bcc39SMarc-André Lureau 4092751bcc39SMarc-André Lureauint main(void) 4093751bcc39SMarc-André Lureau{ 4094751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 4095751bcc39SMarc-André Lureau} 4096751bcc39SMarc-André LureauEOF 4097751bcc39SMarc-André Lureauif compile_prog "" "" ; then 4098751bcc39SMarc-André Lureau memfd=yes 4099751bcc39SMarc-André Lureaufi 4100751bcc39SMarc-André Lureau 4101751bcc39SMarc-André Lureau 4102751bcc39SMarc-André Lureau 4103d0927938SUlrich Hecht# check for fallocate 4104d0927938SUlrich Hechtfallocate=no 4105d0927938SUlrich Hechtcat > $TMPC << EOF 4106d0927938SUlrich Hecht#include <fcntl.h> 4107d0927938SUlrich Hecht 4108d0927938SUlrich Hechtint main(void) 4109d0927938SUlrich Hecht{ 4110d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 4111d0927938SUlrich Hecht return 0; 4112d0927938SUlrich Hecht} 4113d0927938SUlrich HechtEOF 41148fb03151SPeter Maydellif compile_prog "" "" ; then 4115d0927938SUlrich Hecht fallocate=yes 4116d0927938SUlrich Hechtfi 4117d0927938SUlrich Hecht 41183d4fa43eSKusanagi Kouichi# check for fallocate hole punching 41193d4fa43eSKusanagi Kouichifallocate_punch_hole=no 41203d4fa43eSKusanagi Kouichicat > $TMPC << EOF 41213d4fa43eSKusanagi Kouichi#include <fcntl.h> 41223d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 41233d4fa43eSKusanagi Kouichi 41243d4fa43eSKusanagi Kouichiint main(void) 41253d4fa43eSKusanagi Kouichi{ 41263d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 41273d4fa43eSKusanagi Kouichi return 0; 41283d4fa43eSKusanagi Kouichi} 41293d4fa43eSKusanagi KouichiEOF 41303d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 41313d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 41323d4fa43eSKusanagi Kouichifi 41333d4fa43eSKusanagi Kouichi 4134b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 4135b953f075SDenis V. Lunevfallocate_zero_range=no 4136b953f075SDenis V. Lunevcat > $TMPC << EOF 4137b953f075SDenis V. Lunev#include <fcntl.h> 4138b953f075SDenis V. Lunev#include <linux/falloc.h> 4139b953f075SDenis V. Lunev 4140b953f075SDenis V. Lunevint main(void) 4141b953f075SDenis V. Lunev{ 4142b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4143b953f075SDenis V. Lunev return 0; 4144b953f075SDenis V. Lunev} 4145b953f075SDenis V. LunevEOF 4146b953f075SDenis V. Lunevif compile_prog "" "" ; then 4147b953f075SDenis V. Lunev fallocate_zero_range=yes 4148b953f075SDenis V. Lunevfi 4149b953f075SDenis V. Lunev 4150ed911435SKevin Wolf# check for posix_fallocate 4151ed911435SKevin Wolfposix_fallocate=no 4152ed911435SKevin Wolfcat > $TMPC << EOF 4153ed911435SKevin Wolf#include <fcntl.h> 4154ed911435SKevin Wolf 4155ed911435SKevin Wolfint main(void) 4156ed911435SKevin Wolf{ 4157ed911435SKevin Wolf posix_fallocate(0, 0, 0); 4158ed911435SKevin Wolf return 0; 4159ed911435SKevin Wolf} 4160ed911435SKevin WolfEOF 4161ed911435SKevin Wolfif compile_prog "" "" ; then 4162ed911435SKevin Wolf posix_fallocate=yes 4163ed911435SKevin Wolffi 4164ed911435SKevin Wolf 4165c727f47dSPeter Maydell# check for sync_file_range 4166c727f47dSPeter Maydellsync_file_range=no 4167c727f47dSPeter Maydellcat > $TMPC << EOF 4168c727f47dSPeter Maydell#include <fcntl.h> 4169c727f47dSPeter Maydell 4170c727f47dSPeter Maydellint main(void) 4171c727f47dSPeter Maydell{ 4172c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 4173c727f47dSPeter Maydell return 0; 4174c727f47dSPeter Maydell} 4175c727f47dSPeter MaydellEOF 41768fb03151SPeter Maydellif compile_prog "" "" ; then 4177c727f47dSPeter Maydell sync_file_range=yes 4178c727f47dSPeter Maydellfi 4179c727f47dSPeter Maydell 4180dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 4181dace20dcSPeter Maydellfiemap=no 4182dace20dcSPeter Maydellcat > $TMPC << EOF 4183dace20dcSPeter Maydell#include <sys/ioctl.h> 4184dace20dcSPeter Maydell#include <linux/fs.h> 4185dace20dcSPeter Maydell#include <linux/fiemap.h> 4186dace20dcSPeter Maydell 4187dace20dcSPeter Maydellint main(void) 4188dace20dcSPeter Maydell{ 4189dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 4190dace20dcSPeter Maydell return 0; 4191dace20dcSPeter Maydell} 4192dace20dcSPeter MaydellEOF 41938fb03151SPeter Maydellif compile_prog "" "" ; then 4194dace20dcSPeter Maydell fiemap=yes 4195dace20dcSPeter Maydellfi 4196dace20dcSPeter Maydell 4197d0927938SUlrich Hecht# check for dup3 4198d0927938SUlrich Hechtdup3=no 4199d0927938SUlrich Hechtcat > $TMPC << EOF 4200d0927938SUlrich Hecht#include <unistd.h> 4201d0927938SUlrich Hecht 4202d0927938SUlrich Hechtint main(void) 4203d0927938SUlrich Hecht{ 4204d0927938SUlrich Hecht dup3(0, 0, 0); 4205d0927938SUlrich Hecht return 0; 4206d0927938SUlrich Hecht} 4207d0927938SUlrich HechtEOF 420878f5d726SJan Kiszkaif compile_prog "" "" ; then 4209d0927938SUlrich Hecht dup3=yes 4210d0927938SUlrich Hechtfi 4211d0927938SUlrich Hecht 42124e0c6529SAlex Bligh# check for ppoll support 42134e0c6529SAlex Blighppoll=no 42144e0c6529SAlex Blighcat > $TMPC << EOF 42154e0c6529SAlex Bligh#include <poll.h> 42164e0c6529SAlex Bligh 42174e0c6529SAlex Blighint main(void) 42184e0c6529SAlex Bligh{ 42194e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 42204e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 42214e0c6529SAlex Bligh return 0; 42224e0c6529SAlex Bligh} 42234e0c6529SAlex BlighEOF 42244e0c6529SAlex Blighif compile_prog "" "" ; then 42254e0c6529SAlex Bligh ppoll=yes 42264e0c6529SAlex Blighfi 42274e0c6529SAlex Bligh 4228cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 4229cd758dd0SAlex Blighprctl_pr_set_timerslack=no 4230cd758dd0SAlex Blighcat > $TMPC << EOF 4231cd758dd0SAlex Bligh#include <sys/prctl.h> 4232cd758dd0SAlex Bligh 4233cd758dd0SAlex Blighint main(void) 4234cd758dd0SAlex Bligh{ 4235cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 4236cd758dd0SAlex Bligh return 0; 4237cd758dd0SAlex Bligh} 4238cd758dd0SAlex BlighEOF 4239cd758dd0SAlex Blighif compile_prog "" "" ; then 4240cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 4241cd758dd0SAlex Blighfi 4242cd758dd0SAlex Bligh 42433b6edd16SPeter Maydell# check for epoll support 42443b6edd16SPeter Maydellepoll=no 42453b6edd16SPeter Maydellcat > $TMPC << EOF 42463b6edd16SPeter Maydell#include <sys/epoll.h> 42473b6edd16SPeter Maydell 42483b6edd16SPeter Maydellint main(void) 42493b6edd16SPeter Maydell{ 42503b6edd16SPeter Maydell epoll_create(0); 42513b6edd16SPeter Maydell return 0; 42523b6edd16SPeter Maydell} 42533b6edd16SPeter MaydellEOF 42548fb03151SPeter Maydellif compile_prog "" "" ; then 42553b6edd16SPeter Maydell epoll=yes 42563b6edd16SPeter Maydellfi 42573b6edd16SPeter Maydell 4258227f0214SPeter Maydell# epoll_create1 is a later addition 4259227f0214SPeter Maydell# so we must check separately for its presence 42603b6edd16SPeter Maydellepoll_create1=no 42613b6edd16SPeter Maydellcat > $TMPC << EOF 42623b6edd16SPeter Maydell#include <sys/epoll.h> 42633b6edd16SPeter Maydell 42643b6edd16SPeter Maydellint main(void) 42653b6edd16SPeter Maydell{ 426619e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 426719e83f6bSPeter Maydell * a function being called. This is necessary so that on 426819e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 426919e83f6bSPeter Maydell * the library but not declared in the header file we will 427019e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 427119e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 427219e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 427319e83f6bSPeter Maydell */ 4274c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 42753b6edd16SPeter Maydell} 42763b6edd16SPeter MaydellEOF 42778fb03151SPeter Maydellif compile_prog "" "" ; then 42783b6edd16SPeter Maydell epoll_create1=yes 42793b6edd16SPeter Maydellfi 42803b6edd16SPeter Maydell 4281a8fd1abaSPeter Maydell# check for sendfile support 4282a8fd1abaSPeter Maydellsendfile=no 4283a8fd1abaSPeter Maydellcat > $TMPC << EOF 4284a8fd1abaSPeter Maydell#include <sys/sendfile.h> 4285a8fd1abaSPeter Maydell 4286a8fd1abaSPeter Maydellint main(void) 4287a8fd1abaSPeter Maydell{ 4288a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 4289a8fd1abaSPeter Maydell} 4290a8fd1abaSPeter MaydellEOF 4291a8fd1abaSPeter Maydellif compile_prog "" "" ; then 4292a8fd1abaSPeter Maydell sendfile=yes 4293a8fd1abaSPeter Maydellfi 4294a8fd1abaSPeter Maydell 429551834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 429651834341SRiku Voipiotimerfd=no 429751834341SRiku Voipiocat > $TMPC << EOF 429851834341SRiku Voipio#include <sys/timerfd.h> 429951834341SRiku Voipio 430051834341SRiku Voipioint main(void) 430151834341SRiku Voipio{ 430251834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 430351834341SRiku Voipio} 430451834341SRiku VoipioEOF 430551834341SRiku Voipioif compile_prog "" "" ; then 430651834341SRiku Voipio timerfd=yes 430751834341SRiku Voipiofi 430851834341SRiku Voipio 43099af5c906SRiku Voipio# check for setns and unshare support 43109af5c906SRiku Voipiosetns=no 43119af5c906SRiku Voipiocat > $TMPC << EOF 43129af5c906SRiku Voipio#include <sched.h> 43139af5c906SRiku Voipio 43149af5c906SRiku Voipioint main(void) 43159af5c906SRiku Voipio{ 43169af5c906SRiku Voipio int ret; 43179af5c906SRiku Voipio ret = setns(0, 0); 43189af5c906SRiku Voipio ret = unshare(0); 43199af5c906SRiku Voipio return ret; 43209af5c906SRiku Voipio} 43219af5c906SRiku VoipioEOF 43229af5c906SRiku Voipioif compile_prog "" "" ; then 43239af5c906SRiku Voipio setns=yes 43249af5c906SRiku Voipiofi 43259af5c906SRiku Voipio 432638860a03SAleksandar Markovic# clock_adjtime probe 432738860a03SAleksandar Markovicclock_adjtime=no 432838860a03SAleksandar Markoviccat > $TMPC <<EOF 432938860a03SAleksandar Markovic#include <time.h> 433038860a03SAleksandar Markovic 433138860a03SAleksandar Markovicint main(void) 433238860a03SAleksandar Markovic{ 433338860a03SAleksandar Markovic return clock_adjtime(0, 0); 433438860a03SAleksandar Markovic} 433538860a03SAleksandar MarkovicEOF 433638860a03SAleksandar Markovicclock_adjtime=no 433738860a03SAleksandar Markovicif compile_prog "" "" ; then 433838860a03SAleksandar Markovic clock_adjtime=yes 433938860a03SAleksandar Markovicfi 434038860a03SAleksandar Markovic 43415a03cd00SAleksandar Markovic# syncfs probe 43425a03cd00SAleksandar Markovicsyncfs=no 43435a03cd00SAleksandar Markoviccat > $TMPC <<EOF 43445a03cd00SAleksandar Markovic#include <unistd.h> 43455a03cd00SAleksandar Markovic 43465a03cd00SAleksandar Markovicint main(void) 43475a03cd00SAleksandar Markovic{ 43485a03cd00SAleksandar Markovic return syncfs(0); 43495a03cd00SAleksandar Markovic} 43505a03cd00SAleksandar MarkovicEOF 43515a03cd00SAleksandar Markovicsyncfs=no 43525a03cd00SAleksandar Markovicif compile_prog "" "" ; then 43535a03cd00SAleksandar Markovic syncfs=yes 43545a03cd00SAleksandar Markovicfi 43555a03cd00SAleksandar Markovic 4356cc8ae6deSpbrook# Check if tools are available to build documentation. 4357a25dba17SJuan Quintelaif test "$docs" != "no" ; then 435801668d98SStefan Weil if has makeinfo && has pod2man; then 4359a25dba17SJuan Quintela docs=yes 436083a3ab8bSJuan Quintela else 4361a25dba17SJuan Quintela if test "$docs" = "yes" ; then 436221684af0SStewart Smith feature_not_found "docs" "Install texinfo and Perl/perl-podlators" 436383a3ab8bSJuan Quintela fi 4364a25dba17SJuan Quintela docs=no 436583a3ab8bSJuan Quintela fi 4366cc8ae6deSpbrookfi 4367cc8ae6deSpbrook 4368f514f41cSStefan Weil# Search for bswap_32 function 43696ae9a1f4SJuan Quintelabyteswap_h=no 43706ae9a1f4SJuan Quintelacat > $TMPC << EOF 43716ae9a1f4SJuan Quintela#include <byteswap.h> 43726ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 43736ae9a1f4SJuan QuintelaEOF 437452166aa0SJuan Quintelaif compile_prog "" "" ; then 43756ae9a1f4SJuan Quintela byteswap_h=yes 43766ae9a1f4SJuan Quintelafi 43776ae9a1f4SJuan Quintela 437875f13596SStefan Weil# Search for bswap32 function 43796ae9a1f4SJuan Quintelabswap_h=no 43806ae9a1f4SJuan Quintelacat > $TMPC << EOF 43816ae9a1f4SJuan Quintela#include <sys/endian.h> 43826ae9a1f4SJuan Quintela#include <sys/types.h> 43836ae9a1f4SJuan Quintela#include <machine/bswap.h> 43846ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 43856ae9a1f4SJuan QuintelaEOF 438652166aa0SJuan Quintelaif compile_prog "" "" ; then 43876ae9a1f4SJuan Quintela bswap_h=yes 43886ae9a1f4SJuan Quintelafi 43896ae9a1f4SJuan Quintela 4390da93a1fdSaliguori########################################## 4391e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 4392c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 4393e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 43943c33ea96SPaolo Bonzini libiscsi="yes" 4395ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 4396ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 4397c589b249SRonnie Sahlberg else 4398c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 4399e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 4400c589b249SRonnie Sahlberg fi 4401c589b249SRonnie Sahlberg libiscsi="no" 4402c589b249SRonnie Sahlberg fi 4403c589b249SRonnie Sahlbergfi 4404c589b249SRonnie Sahlberg 4405c589b249SRonnie Sahlberg########################################## 44068bacde8dSNatanael Copa# Do we need libm 44078bacde8dSNatanael Copacat > $TMPC << EOF 44088bacde8dSNatanael Copa#include <math.h> 4409f80ea986SAlexey Kardashevskiyint main(int argc, char **argv) { return isnan(sin((double)argc)); } 44108bacde8dSNatanael CopaEOF 44118bacde8dSNatanael Copaif compile_prog "" "" ; then 44128bacde8dSNatanael Copa : 44138bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 44148bacde8dSNatanael Copa LIBS="-lm $LIBS" 44158bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 44168bacde8dSNatanael Copaelse 441776ad07a4SPeter Maydell error_exit "libm check failed" 44188bacde8dSNatanael Copafi 44198bacde8dSNatanael Copa 44208bacde8dSNatanael Copa########################################## 4421da93a1fdSaliguori# Do we need librt 44228bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 44238bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 44248bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 44258bacde8dSNatanael Copa# function in addition. 4426da93a1fdSaliguoricat > $TMPC <<EOF 4427da93a1fdSaliguori#include <signal.h> 4428da93a1fdSaliguori#include <time.h> 44298bacde8dSNatanael Copaint main(void) { 44308bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 44318bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 44328bacde8dSNatanael Copa} 4433da93a1fdSaliguoriEOF 4434da93a1fdSaliguori 443552166aa0SJuan Quintelaif compile_prog "" "" ; then 443607ffa4bdSJuan Quintela : 44378bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 443818e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 443918e588b1SRick Liu LIBS="$LIBS -lrt" 444018e588b1SRick Liu libs_qga="$libs_qga -lrt" 4441da93a1fdSaliguorifi 4442da93a1fdSaliguori 444331ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 444478723752SPeter Maydell "$haiku" != "yes" ; then 44456362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 44466362a53fSJuan Quintelafi 44476362a53fSJuan Quintela 4448de5071c5SBlue Swirl########################################## 4449cd4ec0b4SGerd Hoffmann# spice probe 4450cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 4451cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 4452cd4ec0b4SGerd Hoffmann#include <spice.h> 4453cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 4454cd4ec0b4SGerd HoffmannEOF 4455710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 4456710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 445765d5d3f9SStefan Weil if $pkg_config --atleast-version=0.12.0 spice-server && \ 445865d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 4459cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 4460cd4ec0b4SGerd Hoffmann spice="yes" 4461cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 4462cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 44632e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 44642e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 4465cd4ec0b4SGerd Hoffmann else 4466cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 44678efc9363SHu Tao feature_not_found "spice" \ 44688efc9363SHu Tao "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel" 4469cd4ec0b4SGerd Hoffmann fi 4470cd4ec0b4SGerd Hoffmann spice="no" 4471cd4ec0b4SGerd Hoffmann fi 4472cd4ec0b4SGerd Hoffmannfi 4473cd4ec0b4SGerd Hoffmann 44747b02f544SMarc-André Lureau# check for smartcard support 44757b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 44760f5c642dSMichal Privoznik if $pkg_config --atleast-version=2.5.1 libcacard; then 44777b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 44787b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 44797b02f544SMarc-André Lureau smartcard="yes" 4480111a38b0SRobert Relyea else 44817b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 44827b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 4483111a38b0SRobert Relyea fi 44847b02f544SMarc-André Lureau smartcard="no" 4485111a38b0SRobert Relyea fi 4486111a38b0SRobert Relyeafi 4487111a38b0SRobert Relyea 44882b2325ffSGerd Hoffmann# check for libusb 44892b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 449065d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 44912b2325ffSGerd Hoffmann libusb="yes" 4492ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 4493ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 44942b2325ffSGerd Hoffmann else 44952b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 44968efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 44972b2325ffSGerd Hoffmann fi 44982b2325ffSGerd Hoffmann libusb="no" 44992b2325ffSGerd Hoffmann fi 45002b2325ffSGerd Hoffmannfi 45012b2325ffSGerd Hoffmann 450269354a83SHans de Goede# check for usbredirparser for usb network redirection support 450369354a83SHans de Goedeif test "$usb_redir" != "no" ; then 450465d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 450569354a83SHans de Goede usb_redir="yes" 4506ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 4507ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 450869354a83SHans de Goede else 450969354a83SHans de Goede if test "$usb_redir" = "yes"; then 451021684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 451169354a83SHans de Goede fi 451269354a83SHans de Goede usb_redir="no" 451369354a83SHans de Goede fi 451469354a83SHans de Goedefi 451569354a83SHans de Goede 4516cd4ec0b4SGerd Hoffmann########################################## 4517d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 4518d9840e25STomoki Sekiyama 4519d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then 4520d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 4521690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 4522d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 4523d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 4524690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 4525d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 4526d9840e25STomoki Sekiyama ;; 4527690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 4528d9840e25STomoki Sekiyama esac 4529d9840e25STomoki Sekiyama cat > $TMPC << EOF 4530d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 4531d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 4532d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 4533d9840e25STomoki SekiyamaEOF 4534d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 4535d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 4536d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 4537315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 4538f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 4539d9840e25STomoki Sekiyama else 4540d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 4541d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 4542d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 4543d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 4544d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 4545d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 4546d9840e25STomoki Sekiyama feature_not_found "VSS support" 4547d9840e25STomoki Sekiyama fi 4548d9840e25STomoki Sekiyama guest_agent_with_vss="no" 4549d9840e25STomoki Sekiyama fi 4550d9840e25STomoki Sekiyamafi 4551d9840e25STomoki Sekiyama 4552d9840e25STomoki Sekiyama########################################## 4553d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 4554d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 4555d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 4556d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 4557d9840e25STomoki Sekiyama 4558d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then 4559d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 4560d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 4561d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 4562d9840e25STomoki Sekiyama if test -n "$programfiles"; then 4563d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 4564d9840e25STomoki Sekiyama else 4565d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 4566d9840e25STomoki Sekiyama fi 4567d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 4568d9840e25STomoki Sekiyama win_sdk="" 4569d9840e25STomoki Sekiyama fi 4570d9840e25STomoki Sekiyamafi 4571d9840e25STomoki Sekiyama 4572d9840e25STomoki Sekiyama########################################## 457350cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 457450cbebb9SMichael Rothif test "$mingw32" = "yes" -a "$guest_agent" != "no"; then 457550cbebb9SMichael Roth cat > $TMPC << EOF 457650cbebb9SMichael Roth#include <windows.h> 457750cbebb9SMichael Roth#include <ntddscsi.h> 457850cbebb9SMichael Rothint main(void) { 457950cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 458050cbebb9SMichael Roth#error Missing required ioctl definitions 458150cbebb9SMichael Roth#endif 458250cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 458350cbebb9SMichael Roth return addr.Lun; 458450cbebb9SMichael Roth} 458550cbebb9SMichael RothEOF 458650cbebb9SMichael Roth if compile_prog "" "" ; then 458750cbebb9SMichael Roth guest_agent_ntddscsi=yes 4588c54e1eb4SMichael Roth libs_qga="-lsetupapi $libs_qga" 458950cbebb9SMichael Roth fi 459050cbebb9SMichael Rothfi 459150cbebb9SMichael Roth 459250cbebb9SMichael Roth########################################## 45939d9e1521SGerd Hoffmann# virgl renderer probe 45949d9e1521SGerd Hoffmann 45959d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 45969d9e1521SGerd Hoffmann cat > $TMPC << EOF 45979d9e1521SGerd Hoffmann#include <virglrenderer.h> 45989d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 45999d9e1521SGerd HoffmannEOF 46009d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 46019d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 46029d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 46039d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 46049d9e1521SGerd Hoffmann virglrenderer="yes" 46059d9e1521SGerd Hoffmann else 46069d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 46079d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 46089d9e1521SGerd Hoffmann fi 46099d9e1521SGerd Hoffmann virglrenderer="no" 46109d9e1521SGerd Hoffmann fi 46119d9e1521SGerd Hoffmannfi 46129d9e1521SGerd Hoffmann 46139d9e1521SGerd Hoffmann########################################## 46148ca80760SRichard Henderson# capstone 46158ca80760SRichard Henderson 4616e219c499SRichard Hendersoncase "$capstone" in 4617e219c499SRichard Henderson "" | yes) 46188ca80760SRichard Henderson if $pkg_config capstone; then 4619e219c499SRichard Henderson capstone=system 4620123ac0bbSAlexey Kardashevskiy elif test -e "${source_path}/.git" -a $git_update = 'yes' ; then 4621e219c499SRichard Henderson capstone=git 4622e219c499SRichard Henderson elif test -e "${source_path}/capstone/Makefile" ; then 4623e219c499SRichard Henderson capstone=internal 4624e219c499SRichard Henderson elif test -z "$capstone" ; then 4625e219c499SRichard Henderson capstone=no 4626e219c499SRichard Henderson else 4627e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel or git submodule" 4628e219c499SRichard Henderson fi 4629e219c499SRichard Henderson ;; 4630e219c499SRichard Henderson 4631e219c499SRichard Henderson system) 4632e219c499SRichard Henderson if ! $pkg_config capstone; then 4633e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel" 4634e219c499SRichard Henderson fi 4635e219c499SRichard Henderson ;; 4636e219c499SRichard Hendersonesac 4637e219c499SRichard Henderson 4638e219c499SRichard Hendersoncase "$capstone" in 4639e219c499SRichard Henderson git | internal) 4640e219c499SRichard Henderson if test "$capstone" = git; then 4641e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 4642e219c499SRichard Henderson fi 4643e219c499SRichard Henderson mkdir -p capstone 4644e219c499SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" 4645e219c499SRichard Henderson if test "$mingw32" = "yes"; then 4646e219c499SRichard Henderson LIBCAPSTONE=capstone.lib 4647e219c499SRichard Henderson else 4648e219c499SRichard Henderson LIBCAPSTONE=libcapstone.a 4649e219c499SRichard Henderson fi 4650e219c499SRichard Henderson LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS" 4651e219c499SRichard Henderson ;; 4652e219c499SRichard Henderson 4653e219c499SRichard Henderson system) 46548ca80760SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" 46558ca80760SRichard Henderson LIBS="$($pkg_config --libs capstone) $LIBS" 4656e219c499SRichard Henderson ;; 4657e219c499SRichard Henderson 4658e219c499SRichard Henderson no) 4659e219c499SRichard Henderson ;; 4660e219c499SRichard Henderson *) 4661e219c499SRichard Henderson error_exit "Unknown state for capstone: $capstone" 4662e219c499SRichard Henderson ;; 4663e219c499SRichard Hendersonesac 46648ca80760SRichard Henderson 46658ca80760SRichard Henderson########################################## 46665f6b9e8fSBlue Swirl# check if we have fdatasync 46675f6b9e8fSBlue Swirl 46685f6b9e8fSBlue Swirlfdatasync=no 46695f6b9e8fSBlue Swirlcat > $TMPC << EOF 46705f6b9e8fSBlue Swirl#include <unistd.h> 4671d1722a27SAlexandre Raymondint main(void) { 4672d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 4673d1722a27SAlexandre Raymondreturn fdatasync(0); 4674d1722a27SAlexandre Raymond#else 4675e172fe11SStefan Weil#error Not supported 4676d1722a27SAlexandre Raymond#endif 4677d1722a27SAlexandre Raymond} 46785f6b9e8fSBlue SwirlEOF 46795f6b9e8fSBlue Swirlif compile_prog "" "" ; then 46805f6b9e8fSBlue Swirl fdatasync=yes 46815f6b9e8fSBlue Swirlfi 46825f6b9e8fSBlue Swirl 468394a420b1SStefan Hajnoczi########################################## 4684e78815a5SAndreas Färber# check if we have madvise 4685e78815a5SAndreas Färber 4686e78815a5SAndreas Färbermadvise=no 4687e78815a5SAndreas Färbercat > $TMPC << EOF 4688e78815a5SAndreas Färber#include <sys/types.h> 4689e78815a5SAndreas Färber#include <sys/mman.h> 4690832ce9c2SScott Wood#include <stddef.h> 4691e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 4692e78815a5SAndreas FärberEOF 4693e78815a5SAndreas Färberif compile_prog "" "" ; then 4694e78815a5SAndreas Färber madvise=yes 4695e78815a5SAndreas Färberfi 4696e78815a5SAndreas Färber 4697e78815a5SAndreas Färber########################################## 4698e78815a5SAndreas Färber# check if we have posix_madvise 4699e78815a5SAndreas Färber 4700e78815a5SAndreas Färberposix_madvise=no 4701e78815a5SAndreas Färbercat > $TMPC << EOF 4702e78815a5SAndreas Färber#include <sys/mman.h> 4703832ce9c2SScott Wood#include <stddef.h> 4704e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 4705e78815a5SAndreas FärberEOF 4706e78815a5SAndreas Färberif compile_prog "" "" ; then 4707e78815a5SAndreas Färber posix_madvise=yes 4708e78815a5SAndreas Färberfi 4709e78815a5SAndreas Färber 4710e78815a5SAndreas Färber########################################## 47119bc5a719SAndreas Gustafsson# check if we have posix_memalign() 47129bc5a719SAndreas Gustafsson 47139bc5a719SAndreas Gustafssonposix_memalign=no 47149bc5a719SAndreas Gustafssoncat > $TMPC << EOF 47159bc5a719SAndreas Gustafsson#include <stdlib.h> 47169bc5a719SAndreas Gustafssonint main(void) { 47179bc5a719SAndreas Gustafsson void *p; 47189bc5a719SAndreas Gustafsson return posix_memalign(&p, 8, 8); 47199bc5a719SAndreas Gustafsson} 47209bc5a719SAndreas GustafssonEOF 47219bc5a719SAndreas Gustafssonif compile_prog "" "" ; then 47229bc5a719SAndreas Gustafsson posix_memalign=yes 47239bc5a719SAndreas Gustafssonfi 47249bc5a719SAndreas Gustafsson 47259bc5a719SAndreas Gustafsson########################################## 47260a852417SPaul Durrant# check if we have posix_syslog 47270a852417SPaul Durrant 47280a852417SPaul Durrantposix_syslog=no 47290a852417SPaul Durrantcat > $TMPC << EOF 47300a852417SPaul Durrant#include <syslog.h> 47310a852417SPaul Durrantint main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 47320a852417SPaul DurrantEOF 47330a852417SPaul Durrantif compile_prog "" "" ; then 47340a852417SPaul Durrant posix_syslog=yes 47350a852417SPaul Durrantfi 47360a852417SPaul Durrant 47370a852417SPaul Durrant########################################## 4738401bc051SPeter Maydell# check if we have sem_timedwait 4739401bc051SPeter Maydell 4740401bc051SPeter Maydellsem_timedwait=no 4741401bc051SPeter Maydellcat > $TMPC << EOF 4742401bc051SPeter Maydell#include <semaphore.h> 4743401bc051SPeter Maydellint main(void) { return sem_timedwait(0, 0); } 4744401bc051SPeter MaydellEOF 4745401bc051SPeter Maydellif compile_prog "" "" ; then 4746401bc051SPeter Maydell sem_timedwait=yes 4747401bc051SPeter Maydellfi 4748401bc051SPeter Maydell 4749401bc051SPeter Maydell########################################## 475094a420b1SStefan Hajnoczi# check if trace backend exists 475194a420b1SStefan Hajnoczi 47525b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 475394a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 47545b808275SLluís Vilanova error_exit "invalid trace backends" \ 47555b808275SLluís Vilanova "Please choose supported trace backends." 475694a420b1SStefan Hajnoczifi 475794a420b1SStefan Hajnoczi 47587e24e92aSStefan Hajnoczi########################################## 47597e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 47605b808275SLluís Vilanovaif have_backend "ust"; then 47617e24e92aSStefan Hajnoczi cat > $TMPC << EOF 4762bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 47637e24e92aSStefan Hajnocziint main(void) { return 0; } 47647e24e92aSStefan HajnocziEOF 4765c79ed23dSFrancis Deslauriers if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 4766bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 476789138857SStefan Weil lttng_ust_libs=$($pkg_config --libs lttng-ust) 47687e24e92aSStefan Hajnoczi else 4769c79ed23dSFrancis Deslauriers lttng_ust_libs="-llttng-ust -ldl" 4770bf15f63cSMohamad Gebai fi 4771bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 477289138857SStefan Weil urcu_bp_libs=$($pkg_config --libs liburcu-bp) 4773bf15f63cSMohamad Gebai else 4774bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 4775bf15f63cSMohamad Gebai fi 4776bf15f63cSMohamad Gebai 4777bf15f63cSMohamad Gebai LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 4778bf15f63cSMohamad Gebai libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 4779bf15f63cSMohamad Gebai else 4780bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 47817e24e92aSStefan Hajnoczi fi 47827e24e92aSStefan Hajnoczifi 4783b3d08c02SDaniel P. Berrange 4784b3d08c02SDaniel P. Berrange########################################## 4785b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 47865b808275SLluís Vilanovaif have_backend "dtrace"; then 4787b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 478876ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 4789b3d08c02SDaniel P. Berrange fi 4790c276b17dSDaniel P. Berrange trace_backend_stap="no" 4791c276b17dSDaniel P. Berrange if has 'stap' ; then 4792c276b17dSDaniel P. Berrange trace_backend_stap="yes" 4793c276b17dSDaniel P. Berrange fi 4794b3d08c02SDaniel P. Berrangefi 4795b3d08c02SDaniel P. Berrange 47967e24e92aSStefan Hajnoczi########################################## 4797519175a2SAlex Barcelo# check and set a backend for coroutine 4798d0e2fce5SAneesh Kumar K.V 47997c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 480033c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 480133c53c54SDaniel P. Berrange# specific one. 48027c2acc70SPeter Maydell 48037c2acc70SPeter Maydellucontext_works=no 4804d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 4805d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 4806d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 4807cdf84806SPeter Maydell#ifdef __stub_makecontext 4808cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 4809cdf84806SPeter Maydell#endif 481075cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 4811d0e2fce5SAneesh Kumar K.VEOF 4812d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 48137c2acc70SPeter Maydell ucontext_works=yes 4814d0e2fce5SAneesh Kumar K.V fi 4815519175a2SAlex Barcelofi 48167c2acc70SPeter Maydell 48177c2acc70SPeter Maydellif test "$coroutine" = ""; then 48187c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 48197c2acc70SPeter Maydell coroutine=win32 48207c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 48217c2acc70SPeter Maydell coroutine=ucontext 4822519175a2SAlex Barcelo else 48237c2acc70SPeter Maydell coroutine=sigaltstack 48247c2acc70SPeter Maydell fi 48257c2acc70SPeter Maydellelse 48267c2acc70SPeter Maydell case $coroutine in 48277c2acc70SPeter Maydell windows) 48287c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 48297c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 48307c2acc70SPeter Maydell fi 48317c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 48327c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 48337c2acc70SPeter Maydell coroutine=win32 48347c2acc70SPeter Maydell ;; 48357c2acc70SPeter Maydell ucontext) 48367c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 48377c2acc70SPeter Maydell feature_not_found "ucontext" 48387c2acc70SPeter Maydell fi 48397c2acc70SPeter Maydell ;; 484033c53c54SDaniel P. Berrange sigaltstack) 48417c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 48427c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 48437c2acc70SPeter Maydell fi 48447c2acc70SPeter Maydell ;; 48457c2acc70SPeter Maydell *) 484676ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 48477c2acc70SPeter Maydell ;; 48487c2acc70SPeter Maydell esac 4849d0e2fce5SAneesh Kumar K.Vfi 4850d0e2fce5SAneesh Kumar K.V 485170c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 485270c60c08SStefan Hajnoczi coroutine_pool=yes 485370c60c08SStefan Hajnoczifi 485470c60c08SStefan Hajnoczi 48557d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 48567d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 48577d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 48587d992e4dSPeter Lieven coroutine_pool=no 48597d992e4dSPeter Lieven fi 48607d992e4dSPeter Lievenfi 48617d992e4dSPeter Lieven 48627d992e4dSPeter Lieven 4863d0e2fce5SAneesh Kumar K.V########################################## 4864d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 4865d2042378SAneesh Kumar K.V 48664e1797f9SStefan Weilopen_by_handle_at=no 4867d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 4868d2042378SAneesh Kumar K.V#include <fcntl.h> 4869acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 4870acc55ba8SStefan Weil# error missing definition 4871acc55ba8SStefan Weil#else 487275cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 4873acc55ba8SStefan Weil#endif 4874d2042378SAneesh Kumar K.VEOF 4875d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 4876d2042378SAneesh Kumar K.V open_by_handle_at=yes 4877d2042378SAneesh Kumar K.Vfi 4878d2042378SAneesh Kumar K.V 4879e06a765eSHarsh Prateek Bora######################################## 4880e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 4881e06a765eSHarsh Prateek Bora 4882e06a765eSHarsh Prateek Boralinux_magic_h=no 4883e06a765eSHarsh Prateek Boracat > $TMPC << EOF 4884e06a765eSHarsh Prateek Bora#include <linux/magic.h> 4885e06a765eSHarsh Prateek Boraint main(void) { 488675cafad7SStefan Weil return 0; 4887e06a765eSHarsh Prateek Bora} 4888e06a765eSHarsh Prateek BoraEOF 4889e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 4890e06a765eSHarsh Prateek Bora linux_magic_h=yes 4891e06a765eSHarsh Prateek Borafi 4892e06a765eSHarsh Prateek Bora 48938ab1bf12SLuiz Capitulino######################################## 4894c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed 4895c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries). 4896c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is 4897c95e3080SKevin Wolf# only a warning. 4898c95e3080SKevin Wolf# 4899c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that 4900c95e3080SKevin Wolf# the build doesn't fail anyway. 4901c95e3080SKevin Wolf 490206d71fa1SPeter Maydellpragma_disable_unused_but_set=no 490306d71fa1SPeter Maydellcat > $TMPC << EOF 4904e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push 4905c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes" 4906e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop 4907c95e3080SKevin Wolf 490806d71fa1SPeter Maydellint main(void) { 490906d71fa1SPeter Maydell return 0; 491006d71fa1SPeter Maydell} 491106d71fa1SPeter MaydellEOF 491206d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 4913cc6e3ca9SGerd Hoffmann pragma_diagnostic_available=yes 4914c95e3080SKevin Wolfelse 4915c95e3080SKevin Wolf werror=no 491606d71fa1SPeter Maydellfi 491706d71fa1SPeter Maydell 491806d71fa1SPeter Maydell######################################## 4919541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 49203f4349dcSKevin Wolf 49213f4349dcSKevin Wolfvalgrind_h=no 49223f4349dcSKevin Wolfcat > $TMPC << EOF 49233f4349dcSKevin Wolf#include <valgrind/valgrind.h> 49243f4349dcSKevin Wolfint main(void) { 49253f4349dcSKevin Wolf return 0; 49263f4349dcSKevin Wolf} 49273f4349dcSKevin WolfEOF 49283f4349dcSKevin Wolfif compile_prog "" "" ; then 49293f4349dcSKevin Wolf valgrind_h=yes 49303f4349dcSKevin Wolffi 49313f4349dcSKevin Wolf 49323f4349dcSKevin Wolf######################################## 49338ab1bf12SLuiz Capitulino# check if environ is declared 49348ab1bf12SLuiz Capitulino 49358ab1bf12SLuiz Capitulinohas_environ=no 49368ab1bf12SLuiz Capitulinocat > $TMPC << EOF 49378ab1bf12SLuiz Capitulino#include <unistd.h> 49388ab1bf12SLuiz Capitulinoint main(void) { 4939c075a723SBlue Swirl environ = 0; 49408ab1bf12SLuiz Capitulino return 0; 49418ab1bf12SLuiz Capitulino} 49428ab1bf12SLuiz CapitulinoEOF 49438ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 49448ab1bf12SLuiz Capitulino has_environ=yes 49458ab1bf12SLuiz Capitulinofi 49468ab1bf12SLuiz Capitulino 494776a347e1SRichard Henderson######################################## 494876a347e1SRichard Henderson# check if cpuid.h is usable. 494976a347e1SRichard Henderson 495076a347e1SRichard Hendersoncat > $TMPC << EOF 495176a347e1SRichard Henderson#include <cpuid.h> 495276a347e1SRichard Hendersonint main(void) { 4953774d566cSPeter Maydell unsigned a, b, c, d; 4954774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 4955774d566cSPeter Maydell 4956774d566cSPeter Maydell if (max >= 1) { 4957774d566cSPeter Maydell __cpuid(1, a, b, c, d); 4958774d566cSPeter Maydell } 4959774d566cSPeter Maydell 4960774d566cSPeter Maydell if (max >= 7) { 4961774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 4962774d566cSPeter Maydell } 4963774d566cSPeter Maydell 496476a347e1SRichard Henderson return 0; 496576a347e1SRichard Henderson} 496676a347e1SRichard HendersonEOF 496776a347e1SRichard Hendersonif compile_prog "" "" ; then 496876a347e1SRichard Henderson cpuid_h=yes 496976a347e1SRichard Hendersonfi 497076a347e1SRichard Henderson 49715dd89908SRichard Henderson########################################## 49725dd89908SRichard Henderson# avx2 optimization requirement check 49735dd89908SRichard Henderson# 49745dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 49755dd89908SRichard Henderson# since we won't be able to select the new routines. 49765dd89908SRichard Henderson 49775dd89908SRichard Hendersonif test $cpuid_h = yes; then 49785dd89908SRichard Henderson cat > $TMPC << EOF 49795dd89908SRichard Henderson#pragma GCC push_options 49805dd89908SRichard Henderson#pragma GCC target("avx2") 49815dd89908SRichard Henderson#include <cpuid.h> 49825dd89908SRichard Henderson#include <immintrin.h> 49835dd89908SRichard Hendersonstatic int bar(void *a) { 49845dd89908SRichard Henderson __m256i x = *(__m256i *)a; 49855dd89908SRichard Henderson return _mm256_testz_si256(x, x); 49865dd89908SRichard Henderson} 49875dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 49885dd89908SRichard HendersonEOF 49895dd89908SRichard Henderson if compile_object "" ; then 49905dd89908SRichard Henderson avx2_opt="yes" 49915dd89908SRichard Henderson fi 49925dd89908SRichard Hendersonfi 49935dd89908SRichard Henderson 4994f540166bSRichard Henderson######################################## 4995f540166bSRichard Henderson# check if __[u]int128_t is usable. 4996f540166bSRichard Henderson 4997f540166bSRichard Hendersonint128=no 4998f540166bSRichard Hendersoncat > $TMPC << EOF 4999a00f66abSStefan Weil#if defined(__clang_major__) && defined(__clang_minor__) 5000a00f66abSStefan Weil# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2)) 5001a00f66abSStefan Weil# error __int128_t does not work in CLANG before 3.2 5002a00f66abSStefan Weil# endif 5003a00f66abSStefan Weil#endif 5004f540166bSRichard Henderson__int128_t a; 5005f540166bSRichard Henderson__uint128_t b; 5006f540166bSRichard Hendersonint main (void) { 5007f540166bSRichard Henderson a = a + b; 5008f540166bSRichard Henderson b = a * b; 5009464e3671SPeter Maydell a = a * a; 5010f540166bSRichard Henderson return 0; 5011f540166bSRichard Henderson} 5012f540166bSRichard HendersonEOF 5013f540166bSRichard Hendersonif compile_prog "" "" ; then 5014f540166bSRichard Henderson int128=yes 5015f540166bSRichard Hendersonfi 501676a347e1SRichard Henderson 50177ebee43eSRichard Henderson######################################### 50187ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 50197ebee43eSRichard Henderson 50207ebee43eSRichard Hendersonatomic128=no 50217ebee43eSRichard Hendersonif test "$int128" = "yes"; then 50227ebee43eSRichard Henderson cat > $TMPC << EOF 50237ebee43eSRichard Hendersonint main(void) 50247ebee43eSRichard Henderson{ 50257ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 50267ebee43eSRichard Henderson y = __atomic_load_16(&x, 0); 50277ebee43eSRichard Henderson __atomic_store_16(&x, y, 0); 50287ebee43eSRichard Henderson __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 50297ebee43eSRichard Henderson return 0; 50307ebee43eSRichard Henderson} 50317ebee43eSRichard HendersonEOF 50327ebee43eSRichard Henderson if compile_prog "" "" ; then 50337ebee43eSRichard Henderson atomic128=yes 50347ebee43eSRichard Henderson fi 50357ebee43eSRichard Hendersonfi 50367ebee43eSRichard Henderson 5037df79b996SRichard Henderson######################################### 5038df79b996SRichard Henderson# See if 64-bit atomic operations are supported. 5039df79b996SRichard Henderson# Note that without __atomic builtins, we can only 5040df79b996SRichard Henderson# assume atomic loads/stores max at pointer size. 5041df79b996SRichard Henderson 5042df79b996SRichard Hendersoncat > $TMPC << EOF 5043df79b996SRichard Henderson#include <stdint.h> 5044df79b996SRichard Hendersonint main(void) 5045df79b996SRichard Henderson{ 5046df79b996SRichard Henderson uint64_t x = 0, y = 0; 5047df79b996SRichard Henderson#ifdef __ATOMIC_RELAXED 5048df79b996SRichard Henderson y = __atomic_load_8(&x, 0); 5049df79b996SRichard Henderson __atomic_store_8(&x, y, 0); 5050df79b996SRichard Henderson __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); 5051df79b996SRichard Henderson __atomic_exchange_8(&x, y, 0); 5052df79b996SRichard Henderson __atomic_fetch_add_8(&x, y, 0); 5053df79b996SRichard Henderson#else 5054df79b996SRichard Henderson typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 5055df79b996SRichard Henderson __sync_lock_test_and_set(&x, y); 5056df79b996SRichard Henderson __sync_val_compare_and_swap(&x, y, 0); 5057df79b996SRichard Henderson __sync_fetch_and_add(&x, y); 5058df79b996SRichard Henderson#endif 5059df79b996SRichard Henderson return 0; 5060df79b996SRichard Henderson} 5061df79b996SRichard HendersonEOF 5062df79b996SRichard Hendersonif compile_prog "" "" ; then 5063df79b996SRichard Henderson atomic64=yes 5064df79b996SRichard Hendersonfi 5065df79b996SRichard Henderson 50661e6e9acaSRichard Henderson######################################## 5067db432672SRichard Henderson# See if 16-byte vector operations are supported. 5068db432672SRichard Henderson# Even without a vector unit the compiler may expand these. 5069db432672SRichard Henderson# There is a bug in old GCC for PPC that crashes here. 5070db432672SRichard Henderson# Unfortunately it's the system compiler for Centos 7. 5071db432672SRichard Henderson 5072db432672SRichard Hendersoncat > $TMPC << EOF 5073db432672SRichard Hendersontypedef unsigned char U1 __attribute__((vector_size(16))); 5074db432672SRichard Hendersontypedef unsigned short U2 __attribute__((vector_size(16))); 5075db432672SRichard Hendersontypedef unsigned int U4 __attribute__((vector_size(16))); 5076db432672SRichard Hendersontypedef unsigned long long U8 __attribute__((vector_size(16))); 5077db432672SRichard Hendersontypedef signed char S1 __attribute__((vector_size(16))); 5078db432672SRichard Hendersontypedef signed short S2 __attribute__((vector_size(16))); 5079db432672SRichard Hendersontypedef signed int S4 __attribute__((vector_size(16))); 5080db432672SRichard Hendersontypedef signed long long S8 __attribute__((vector_size(16))); 5081db432672SRichard Hendersonstatic U1 a1, b1; 5082db432672SRichard Hendersonstatic U2 a2, b2; 5083db432672SRichard Hendersonstatic U4 a4, b4; 5084db432672SRichard Hendersonstatic U8 a8, b8; 5085db432672SRichard Hendersonstatic S1 c1; 5086db432672SRichard Hendersonstatic S2 c2; 5087db432672SRichard Hendersonstatic S4 c4; 5088db432672SRichard Hendersonstatic S8 c8; 5089db432672SRichard Hendersonstatic int i; 509074912f6dSLaurent Viviervoid helper(void *d, void *a, int shift, int i); 509174912f6dSLaurent Viviervoid helper(void *d, void *a, int shift, int i) 509274912f6dSLaurent Vivier{ 509374912f6dSLaurent Vivier *(U1 *)(d + i) = *(U1 *)(a + i) << shift; 509474912f6dSLaurent Vivier *(U2 *)(d + i) = *(U2 *)(a + i) << shift; 509574912f6dSLaurent Vivier *(U4 *)(d + i) = *(U4 *)(a + i) << shift; 509674912f6dSLaurent Vivier *(U8 *)(d + i) = *(U8 *)(a + i) << shift; 509774912f6dSLaurent Vivier} 5098db432672SRichard Hendersonint main(void) 5099db432672SRichard Henderson{ 5100db432672SRichard Henderson a1 += b1; a2 += b2; a4 += b4; a8 += b8; 5101db432672SRichard Henderson a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8; 5102db432672SRichard Henderson a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8; 5103db432672SRichard Henderson a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8; 5104db432672SRichard Henderson a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8; 5105db432672SRichard Henderson a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8; 5106db432672SRichard Henderson a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i; 5107db432672SRichard Henderson a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i; 5108db432672SRichard Henderson c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i; 5109db432672SRichard Henderson return 0; 5110db432672SRichard Henderson} 5111db432672SRichard HendersonEOF 5112db432672SRichard Henderson 5113db432672SRichard Hendersonvector16=no 5114db432672SRichard Hendersonif compile_prog "" "" ; then 5115db432672SRichard Henderson vector16=yes 5116db432672SRichard Hendersonfi 5117db432672SRichard Henderson 5118db432672SRichard Henderson######################################## 51191e6e9acaSRichard Henderson# check if getauxval is available. 51201e6e9acaSRichard Henderson 51211e6e9acaSRichard Hendersongetauxval=no 51221e6e9acaSRichard Hendersoncat > $TMPC << EOF 51231e6e9acaSRichard Henderson#include <sys/auxv.h> 51241e6e9acaSRichard Hendersonint main(void) { 51251e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 51261e6e9acaSRichard Henderson} 51271e6e9acaSRichard HendersonEOF 51281e6e9acaSRichard Hendersonif compile_prog "" "" ; then 51291e6e9acaSRichard Henderson getauxval=yes 51301e6e9acaSRichard Hendersonfi 51311e6e9acaSRichard Henderson 5132fd0e6053SJohn Snow######################################## 5133fd0e6053SJohn Snow# check if ccache is interfering with 5134fd0e6053SJohn Snow# semantic analysis of macros 5135fd0e6053SJohn Snow 51365e4dfd3dSJohn Snowunset CCACHE_CPP2 5137fd0e6053SJohn Snowccache_cpp2=no 5138fd0e6053SJohn Snowcat > $TMPC << EOF 5139fd0e6053SJohn Snowstatic const int Z = 1; 5140fd0e6053SJohn Snow#define fn() ({ Z; }) 5141fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 5142fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 5143fd0e6053SJohn Snow#define ID(X) (X) 5144fd0e6053SJohn Snowint main(int argc, char *argv[]) 5145fd0e6053SJohn Snow{ 5146fd0e6053SJohn Snow int x = 0, y = 0; 5147fd0e6053SJohn Snow x = ID(x); 5148fd0e6053SJohn Snow x = fn(); 5149fd0e6053SJohn Snow fn(); 5150fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 5151fd0e6053SJohn Snow if (TAUT(Z)) return 0; 5152fd0e6053SJohn Snow return 0; 5153fd0e6053SJohn Snow} 5154fd0e6053SJohn SnowEOF 5155fd0e6053SJohn Snow 5156fd0e6053SJohn Snowif ! compile_object "-Werror"; then 5157fd0e6053SJohn Snow ccache_cpp2=yes 5158fd0e6053SJohn Snowfi 5159fd0e6053SJohn Snow 5160b553a042SJohn Snow################################################# 5161b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 5162b553a042SJohn Snow 5163b553a042SJohn Snowif test "$fortify_source" != "no"; then 5164b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 5165b553a042SJohn Snow fortify_source="no"; 5166e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 5167cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 5168b553a042SJohn Snow fortify_source="no"; 5169b553a042SJohn Snow else 5170b553a042SJohn Snow fortify_source="yes" 5171b553a042SJohn Snow fi 5172b553a042SJohn Snowfi 5173b553a042SJohn Snow 51741efad060SFam Zheng############################################### 51751efad060SFam Zheng# Check if copy_file_range is provided by glibc 51761efad060SFam Zhenghave_copy_file_range=no 51771efad060SFam Zhengcat > $TMPC << EOF 51781efad060SFam Zheng#include <unistd.h> 51791efad060SFam Zhengint main(void) { 51801efad060SFam Zheng copy_file_range(0, NULL, 0, NULL, 0, 0); 51811efad060SFam Zheng return 0; 51821efad060SFam Zheng} 51831efad060SFam ZhengEOF 51841efad060SFam Zhengif compile_prog "" "" ; then 51851efad060SFam Zheng have_copy_file_range=yes 51861efad060SFam Zhengfi 51871efad060SFam Zheng 5188d2042378SAneesh Kumar K.V########################################## 5189277abf15SJan Vesely# check if struct fsxattr is available via linux/fs.h 5190277abf15SJan Vesely 5191277abf15SJan Veselyhave_fsxattr=no 5192277abf15SJan Veselycat > $TMPC << EOF 5193277abf15SJan Vesely#include <linux/fs.h> 5194277abf15SJan Veselystruct fsxattr foo; 5195277abf15SJan Veselyint main(void) { 5196277abf15SJan Vesely return 0; 5197277abf15SJan Vesely} 5198277abf15SJan VeselyEOF 5199277abf15SJan Veselyif compile_prog "" "" ; then 5200277abf15SJan Vesely have_fsxattr=yes 5201277abf15SJan Veselyfi 5202277abf15SJan Vesely 5203b66e10e4SPeter Maydell########################################## 5204a40161cbSPaolo Bonzini# check for usable membarrier system call 5205a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 5206a40161cbSPaolo Bonzini have_membarrier=no 5207a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 5208a40161cbSPaolo Bonzini have_membarrier=yes 5209a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 5210a40161cbSPaolo Bonzini cat > $TMPC << EOF 5211a40161cbSPaolo Bonzini #include <linux/membarrier.h> 5212a40161cbSPaolo Bonzini #include <sys/syscall.h> 5213a40161cbSPaolo Bonzini #include <unistd.h> 5214a40161cbSPaolo Bonzini #include <stdlib.h> 5215a40161cbSPaolo Bonzini int main(void) { 5216a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 5217a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 5218a40161cbSPaolo Bonzini exit(0); 5219a40161cbSPaolo Bonzini } 5220a40161cbSPaolo BonziniEOF 5221a40161cbSPaolo Bonzini if compile_prog "" "" ; then 5222a40161cbSPaolo Bonzini have_membarrier=yes 5223a40161cbSPaolo Bonzini fi 5224a40161cbSPaolo Bonzini fi 5225a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 5226a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 5227a40161cbSPaolo Bonzini fi 5228a40161cbSPaolo Bonzinielse 5229a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 5230a40161cbSPaolo Bonzini # work on Wine. 5231a40161cbSPaolo Bonzini membarrier=no 5232a40161cbSPaolo Bonzinifi 5233a40161cbSPaolo Bonzini 5234a40161cbSPaolo Bonzini########################################## 5235b66e10e4SPeter Maydell# check if rtnetlink.h exists and is useful 5236575b22b1SLaurent Vivierhave_rtnetlink=no 5237575b22b1SLaurent Viviercat > $TMPC << EOF 5238575b22b1SLaurent Vivier#include <linux/rtnetlink.h> 5239575b22b1SLaurent Vivierint main(void) { 5240575b22b1SLaurent Vivier return IFLA_PROTO_DOWN; 5241575b22b1SLaurent Vivier} 5242575b22b1SLaurent VivierEOF 5243575b22b1SLaurent Vivierif compile_prog "" "" ; then 5244575b22b1SLaurent Vivier have_rtnetlink=yes 5245575b22b1SLaurent Vivierfi 5246575b22b1SLaurent Vivier 52476a02c806SStefan Hajnoczi########################################## 52486a02c806SStefan Hajnoczi# check for usable AF_VSOCK environment 52496a02c806SStefan Hajnoczihave_af_vsock=no 52506a02c806SStefan Hajnoczicat > $TMPC << EOF 52516a02c806SStefan Hajnoczi#include <errno.h> 52526a02c806SStefan Hajnoczi#include <sys/types.h> 52536a02c806SStefan Hajnoczi#include <sys/socket.h> 52546a02c806SStefan Hajnoczi#if !defined(AF_VSOCK) 52556a02c806SStefan Hajnoczi# error missing AF_VSOCK flag 52566a02c806SStefan Hajnoczi#endif 52576a02c806SStefan Hajnoczi#include <linux/vm_sockets.h> 52586a02c806SStefan Hajnocziint main(void) { 52596a02c806SStefan Hajnoczi int sock, ret; 52606a02c806SStefan Hajnoczi struct sockaddr_vm svm; 52616a02c806SStefan Hajnoczi socklen_t len = sizeof(svm); 52626a02c806SStefan Hajnoczi sock = socket(AF_VSOCK, SOCK_STREAM, 0); 52636a02c806SStefan Hajnoczi ret = getpeername(sock, (struct sockaddr *)&svm, &len); 52646a02c806SStefan Hajnoczi if ((ret == -1) && (errno == ENOTCONN)) { 52656a02c806SStefan Hajnoczi return 0; 52666a02c806SStefan Hajnoczi } 52676a02c806SStefan Hajnoczi return -1; 52686a02c806SStefan Hajnoczi} 52696a02c806SStefan HajnocziEOF 52706a02c806SStefan Hajnocziif compile_prog "" "" ; then 52716a02c806SStefan Hajnoczi have_af_vsock=yes 52726a02c806SStefan Hajnoczifi 52736a02c806SStefan Hajnoczi 5274f0d92b56SLongpeng(Mike)########################################## 5275f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 5276f0d92b56SLongpeng(Mike)hava_afalg=no 5277f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 5278f0d92b56SLongpeng(Mike)#include <errno.h> 5279f0d92b56SLongpeng(Mike)#include <sys/types.h> 5280f0d92b56SLongpeng(Mike)#include <sys/socket.h> 5281f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 5282f0d92b56SLongpeng(Mike)int main(void) { 5283f0d92b56SLongpeng(Mike) int sock; 5284f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 5285f0d92b56SLongpeng(Mike) return sock; 5286f0d92b56SLongpeng(Mike)} 5287f0d92b56SLongpeng(Mike)EOF 5288f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 5289f0d92b56SLongpeng(Mike) have_afalg=yes 5290f0d92b56SLongpeng(Mike)fi 5291f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 5292f0d92b56SLongpeng(Mike)then 5293f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 5294f0d92b56SLongpeng(Mike) then 5295f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 5296f0d92b56SLongpeng(Mike) fi 5297f0d92b56SLongpeng(Mike)fi 5298f0d92b56SLongpeng(Mike) 5299f0d92b56SLongpeng(Mike) 53006969ec6cSJames Clarke################################################# 5301c97d6d2cSSergio Andres Gomez Del Real# Check to see if we have the Hypervisor framework 5302d2d08522SPeter Maydellif [ "$darwin" = "yes" ] ; then 5303c97d6d2cSSergio Andres Gomez Del Real cat > $TMPC << EOF 5304c97d6d2cSSergio Andres Gomez Del Real#include <Hypervisor/hv.h> 5305c97d6d2cSSergio Andres Gomez Del Realint main() { return 0;} 5306c97d6d2cSSergio Andres Gomez Del RealEOF 5307c97d6d2cSSergio Andres Gomez Del Real if ! compile_object ""; then 5308c97d6d2cSSergio Andres Gomez Del Real hvf='no' 5309c97d6d2cSSergio Andres Gomez Del Real else 5310c97d6d2cSSergio Andres Gomez Del Real hvf='yes' 5311c97d6d2cSSergio Andres Gomez Del Real LDFLAGS="-framework Hypervisor $LDFLAGS" 5312c97d6d2cSSergio Andres Gomez Del Real fi 5313c97d6d2cSSergio Andres Gomez Del Realfi 5314c97d6d2cSSergio Andres Gomez Del Real 5315c97d6d2cSSergio Andres Gomez Del Real################################################# 53166969ec6cSJames Clarke# Sparc implicitly links with --relax, which is 53176969ec6cSJames Clarke# incompatible with -r, so --no-relax should be 53186969ec6cSJames Clarke# given. It does no harm to give it on other 53196969ec6cSJames Clarke# platforms too. 53206969ec6cSJames Clarke 53216969ec6cSJames Clarke# Note: the prototype is needed since QEMU_CFLAGS 53226969ec6cSJames Clarke# contains -Wmissing-prototypes 53236969ec6cSJames Clarkecat > $TMPC << EOF 53246969ec6cSJames Clarkeextern int foo(void); 53256969ec6cSJames Clarkeint foo(void) { return 0; } 53266969ec6cSJames ClarkeEOF 53276969ec6cSJames Clarkeif ! compile_object ""; then 53286969ec6cSJames Clarke error_exit "Failed to compile object file for LD_REL_FLAGS test" 53296969ec6cSJames Clarkefi 53307ecf44a5SPaolo Bonzinifor i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do 53317ecf44a5SPaolo Bonzini if do_cc -nostdlib $i -o $TMPMO $TMPO; then 53327ecf44a5SPaolo Bonzini LD_REL_FLAGS=$i 53337ecf44a5SPaolo Bonzini break 53347ecf44a5SPaolo Bonzini fi 53357ecf44a5SPaolo Bonzinidone 53367ecf44a5SPaolo Bonziniif test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then 53377ecf44a5SPaolo Bonzini feature_not_found "modules" "Cannot find how to build relocatable objects" 53386969ec6cSJames Clarkefi 53396969ec6cSJames Clarke 5340277abf15SJan Vesely########################################## 53414d04351fSChristopher Covington# check for sysmacros.h 53424d04351fSChristopher Covington 53434d04351fSChristopher Covingtonhave_sysmacros=no 53444d04351fSChristopher Covingtoncat > $TMPC << EOF 53454d04351fSChristopher Covington#include <sys/sysmacros.h> 53464d04351fSChristopher Covingtonint main(void) { 53474d04351fSChristopher Covington return makedev(0, 0); 53484d04351fSChristopher Covington} 53494d04351fSChristopher CovingtonEOF 53504d04351fSChristopher Covingtonif compile_prog "" "" ; then 53514d04351fSChristopher Covington have_sysmacros=yes 53524d04351fSChristopher Covingtonfi 53534d04351fSChristopher Covington 53544d04351fSChristopher Covington########################################## 5355da92c3ffSAshish Mittal# Veritas HyperScale block driver VxHS 5356da92c3ffSAshish Mittal# Check if libvxhs is installed 5357da92c3ffSAshish Mittal 5358da92c3ffSAshish Mittalif test "$vxhs" != "no" ; then 5359da92c3ffSAshish Mittal cat > $TMPC <<EOF 5360da92c3ffSAshish Mittal#include <stdint.h> 5361da92c3ffSAshish Mittal#include <qnio/qnio_api.h> 5362da92c3ffSAshish Mittal 5363da92c3ffSAshish Mittalvoid *vxhs_callback; 5364da92c3ffSAshish Mittal 5365da92c3ffSAshish Mittalint main(void) { 5366da92c3ffSAshish Mittal iio_init(QNIO_VERSION, vxhs_callback); 5367da92c3ffSAshish Mittal return 0; 5368da92c3ffSAshish Mittal} 5369da92c3ffSAshish MittalEOF 5370da92c3ffSAshish Mittal vxhs_libs="-lvxhs -lssl" 5371da92c3ffSAshish Mittal if compile_prog "" "$vxhs_libs" ; then 5372da92c3ffSAshish Mittal vxhs=yes 5373da92c3ffSAshish Mittal else 5374da92c3ffSAshish Mittal if test "$vxhs" = "yes" ; then 5375da92c3ffSAshish Mittal feature_not_found "vxhs block device" "Install libvxhs See github" 5376da92c3ffSAshish Mittal fi 5377da92c3ffSAshish Mittal vxhs=no 5378da92c3ffSAshish Mittal fi 5379da92c3ffSAshish Mittalfi 5380da92c3ffSAshish Mittal 5381da92c3ffSAshish Mittal########################################## 538249e00a18SAndreas Grapentin# check for _Static_assert() 538349e00a18SAndreas Grapentin 538449e00a18SAndreas Grapentinhave_static_assert=no 538549e00a18SAndreas Grapentincat > $TMPC << EOF 538649e00a18SAndreas Grapentin_Static_assert(1, "success"); 538749e00a18SAndreas Grapentinint main(void) { 538849e00a18SAndreas Grapentin return 0; 538949e00a18SAndreas Grapentin} 539049e00a18SAndreas GrapentinEOF 539149e00a18SAndreas Grapentinif compile_prog "" "" ; then 539249e00a18SAndreas Grapentin have_static_assert=yes 539349e00a18SAndreas Grapentinfi 539449e00a18SAndreas Grapentin 539549e00a18SAndreas Grapentin########################################## 5396e674605fSTomáš Golembiovský# check for utmpx.h, it is missing e.g. on OpenBSD 5397e674605fSTomáš Golembiovský 5398e674605fSTomáš Golembiovskýhave_utmpx=no 5399e674605fSTomáš Golembiovskýcat > $TMPC << EOF 5400e674605fSTomáš Golembiovský#include <utmpx.h> 5401e674605fSTomáš Golembiovskýstruct utmpx user_info; 5402e674605fSTomáš Golembiovskýint main(void) { 5403e674605fSTomáš Golembiovský return 0; 5404e674605fSTomáš Golembiovský} 5405e674605fSTomáš GolembiovskýEOF 5406e674605fSTomáš Golembiovskýif compile_prog "" "" ; then 5407e674605fSTomáš Golembiovský have_utmpx=yes 5408e674605fSTomáš Golembiovskýfi 5409e674605fSTomáš Golembiovský 5410e674605fSTomáš Golembiovský########################################## 5411247724cbSMarc-André Lureau# checks for sanitizers 5412247724cbSMarc-André Lureau 5413247724cbSMarc-André Lureauhave_asan=no 5414247724cbSMarc-André Lureauhave_ubsan=no 5415d83414e1SMarc-André Lureauhave_asan_iface_h=no 5416d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 5417247724cbSMarc-André Lureau 5418247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 5419b9f44da2SMarc-André Lureau write_c_skeleton 5420247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 5421247724cbSMarc-André Lureau have_asan=yes 5422247724cbSMarc-André Lureau fi 5423b9f44da2SMarc-André Lureau 5424b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 5425b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 5426b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 5427b9f44da2SMarc-André Lureau cat > $TMPC << EOF 5428b9f44da2SMarc-André Lureau#include <stdlib.h> 5429b9f44da2SMarc-André Lureauint main(void) { 5430b9f44da2SMarc-André Lureau void *tmp = malloc(10); 5431b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 5432b9f44da2SMarc-André Lureau} 5433b9f44da2SMarc-André LureauEOF 5434247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 5435247724cbSMarc-André Lureau have_ubsan=yes 5436247724cbSMarc-André Lureau fi 5437d83414e1SMarc-André Lureau 5438d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 5439d83414e1SMarc-André Lureau have_asan_iface_h=yes 5440d83414e1SMarc-André Lureau fi 5441d83414e1SMarc-André Lureau 5442d83414e1SMarc-André Lureau cat > $TMPC << EOF 5443d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 5444d83414e1SMarc-André Lureauint main(void) { 5445d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 5446d83414e1SMarc-André Lureau return 0; 5447d83414e1SMarc-André Lureau} 5448d83414e1SMarc-André LureauEOF 5449d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 5450d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 5451d83414e1SMarc-André Lureau fi 5452247724cbSMarc-André Lureaufi 5453247724cbSMarc-André Lureau 5454247724cbSMarc-André Lureau########################################## 545551a12b51SAlex Bennée# Docker and cross-compiler support 545651a12b51SAlex Bennée# 545751a12b51SAlex Bennée# This is specifically for building test 545851a12b51SAlex Bennée# cases for foreign architectures, not 545951a12b51SAlex Bennée# cross-compiling QEMU itself. 546051a12b51SAlex Bennée 546151a12b51SAlex Bennéeif has "docker"; then 546251a12b51SAlex Bennée docker=$($python $source_path/tests/docker/docker.py probe) 546351a12b51SAlex Bennéefi 546451a12b51SAlex Bennée 546551a12b51SAlex Bennée########################################## 5466e86ecd4bSJuan Quintela# End of CC checks 5467e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 5468e86ecd4bSJuan Quintela 5469d83414e1SMarc-André Lureauwrite_c_skeleton 5470d83414e1SMarc-André Lureau 54711d728c39SBlue Swirlif test "$gcov" = "yes" ; then 54721d728c39SBlue Swirl CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" 54731d728c39SBlue Swirl LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" 5474b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 5475e600cdf3SMichal Privoznik CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" 547648e56d50SPaolo Bonzinielif test "$debug" = "no"; then 5477ce278618SPeter Maydell CFLAGS="-O2 $CFLAGS" 5478e86ecd4bSJuan Quintelafi 5479a316e378SJuan Quintela 5480247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 5481247724cbSMarc-André Lureau CFLAGS="-fsanitize=address $CFLAGS" 5482d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 5483d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 5484d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5485d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 5486d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 5487d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 5488d83414e1SMarc-André Lureau fi 5489247724cbSMarc-André Lureaufi 5490247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 5491247724cbSMarc-André Lureau CFLAGS="-fsanitize=undefined $CFLAGS" 5492247724cbSMarc-André Lureaufi 5493247724cbSMarc-André Lureau 54946542aa9cSPeter Lieven########################################## 54956542aa9cSPeter Lieven# Do we have libnfs 54966542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 5497b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 54986542aa9cSPeter Lieven libnfs="yes" 54996542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 55006542aa9cSPeter Lieven else 55016542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 55028efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 55036542aa9cSPeter Lieven fi 55046542aa9cSPeter Lieven libnfs="no" 55056542aa9cSPeter Lieven fi 55066542aa9cSPeter Lievenfi 55071d728c39SBlue Swirl 55086ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 55096ca026cbSPeter Maydellif test "$werror" = "yes"; then 55106ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 55116ca026cbSPeter Maydellfi 55126ca026cbSPeter Maydell 5513e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 5514e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 55151156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 5516e86ecd4bSJuan Quintela fi 5517e86ecd4bSJuan Quintelafi 5518e86ecd4bSJuan Quintela 551994dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 552094dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 552194dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 552294dd53c5SGerd Hoffmannelse 552394dd53c5SGerd Hoffmann POD2MAN="pod2man" 552494dd53c5SGerd Hoffmannfi 552594dd53c5SGerd Hoffmann 5526952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 5527952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 5528952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 5529e9a3591fSChristian Borntraeger if ld_has $flag ; then 5530952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 5531952afb71SBlue Swirl fi 5532952afb71SBlue Swirl done 5533952afb71SBlue Swirlfi 5534952afb71SBlue Swirl 553510ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 5536e26110cfSFam Zhengqemu_moddir=$libdir$confsuffix 5537528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 5538834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 55395a67135aSbellard 5540e0580342SKamil Rytarowski# We can only support ivshmem if we have eventfd 5541e0580342SKamil Rytarowskiif [ "$eventfd" = "yes" ]; then 5542e0580342SKamil Rytarowski ivshmem=yes 5543e0580342SKamil Rytarowskifi 5544e0580342SKamil Rytarowski 55454b1c11fdSDaniel P. Berrangetools="" 55464b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 5547ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 55484b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 55494b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 5550b1449edbSKamil Rytarowski fi 5551b1449edbSKamil Rytarowski if [ "$ivshmem" = "yes" ]; then 5552a75eb03bSDavid Marchand tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" 55534b1c11fdSDaniel P. Berrange fi 55544b1c11fdSDaniel P. Berrangefi 55554b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 5556b855f8d1SPaolo Bonzini if test "$linux" = yes; then 5557b855f8d1SPaolo Bonzini if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then 5558983eef5aSMeador Inge virtfs=yes 555917bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 5560983eef5aSMeador Inge else 5561983eef5aSMeador Inge if test "$virtfs" = yes; then 5562b855f8d1SPaolo Bonzini error_exit "VirtFS requires libcap devel and libattr devel" 5563983eef5aSMeador Inge fi 556417500370SAndreas Färber virtfs=no 5565983eef5aSMeador Inge fi 5566fe8fc5aeSPaolo Bonzini if test "$mpath" != no && test "$mpathpersist" = yes ; then 5567fe8fc5aeSPaolo Bonzini mpath=yes 5568fe8fc5aeSPaolo Bonzini else 5569fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 5570fe8fc5aeSPaolo Bonzini error_exit "Multipath requires libmpathpersist devel" 5571fe8fc5aeSPaolo Bonzini fi 5572fe8fc5aeSPaolo Bonzini mpath=no 5573fe8fc5aeSPaolo Bonzini fi 5574b855f8d1SPaolo Bonzini tools="$tools scsi/qemu-pr-helper\$(EXESUF)" 5575b855f8d1SPaolo Bonzini else 5576b855f8d1SPaolo Bonzini if test "$virtfs" = yes; then 5577b855f8d1SPaolo Bonzini error_exit "VirtFS is supported only on Linux" 5578b855f8d1SPaolo Bonzini fi 5579b855f8d1SPaolo Bonzini virtfs=no 5580fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 5581fe8fc5aeSPaolo Bonzini error_exit "Multipath is supported only on Linux" 5582fe8fc5aeSPaolo Bonzini fi 5583fe8fc5aeSPaolo Bonzini mpath=no 558417bff52bSM. Mohan Kumar fi 55856a021536SGerd Hoffmann if test "$xkbcommon" = "yes"; then 55866a021536SGerd Hoffmann tools="qemu-keymap\$(EXESUF) $tools" 55876a021536SGerd Hoffmann fi 5588ff69fd8cSLaurent Vivierfi 55899d6bc27bSMichael Roth 55909d6bc27bSMichael Roth# Probe for guest agent support/options 55919d6bc27bSMichael Roth 5592e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 5593b39297aeSTomoki Sekiyama if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 5594fafcaf1dSMichael Roth tools="qemu-ga $tools" 5595e8ef31a3SMichael Tokarev guest_agent=yes 5596e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 5597e8ef31a3SMichael Tokarev guest_agent=no 5598e8ef31a3SMichael Tokarev else 5599e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 5600ca35f780SPaolo Bonzini fi 56014b1c11fdSDaniel P. Berrangefi 5602ca35f780SPaolo Bonzini 56039d6bc27bSMichael Roth# Guest agent Window MSI package 56049d6bc27bSMichael Roth 56059d6bc27bSMichael Rothif test "$guest_agent" != yes; then 56069d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 56079d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 56089d6bc27bSMichael Roth fi 56099d6bc27bSMichael Roth guest_agent_msi=no 56109d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 56119d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 56129d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 56139d6bc27bSMichael Roth fi 56149d6bc27bSMichael Roth guest_agent_msi=no 56159d6bc27bSMichael Rothelif ! has wixl; then 56169d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 56179d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 56189d6bc27bSMichael Roth fi 56199d6bc27bSMichael Roth guest_agent_msi=no 56201a34904eSMichael Rothelse 56211a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 56221a34904eSMichael Roth # disabled explicitly 56231a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 56241a34904eSMichael Roth guest_agent_msi=yes 56251a34904eSMichael Roth fi 56269d6bc27bSMichael Rothfi 56279d6bc27bSMichael Roth 56281a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 56299d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 56309d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 56319d6bc27bSMichael Roth fi 56329d6bc27bSMichael Roth 56339d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 56349d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 56359d6bc27bSMichael Roth fi 56369d6bc27bSMichael Roth 56379d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 56389d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 56399d6bc27bSMichael Roth fi 56409d6bc27bSMichael Roth 56419d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 564289138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 56439d6bc27bSMichael Roth fi 56449d6bc27bSMichael Roth 564589138857SStefan Weil QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 56469d6bc27bSMichael Roth 56479d6bc27bSMichael Roth case "$cpu" in 56489d6bc27bSMichael Roth x86_64) 56499d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 56509d6bc27bSMichael Roth ;; 56519d6bc27bSMichael Roth i386) 56529d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 56539d6bc27bSMichael Roth ;; 56549d6bc27bSMichael Roth *) 56559d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 56569d6bc27bSMichael Roth ;; 56579d6bc27bSMichael Roth esac 56589d6bc27bSMichael Rothfi 56599d6bc27bSMichael Roth 5660ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 5661ca35f780SPaolo Bonziniroms= 5662ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 5663ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 5664ca35f780SPaolo Bonzini "$softmmu" = yes ; then 5665e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 5666c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 5667c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 5668c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 5669e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 5670e57218b6SPeter Maydell ld_i386_emulation="$emu" 5671ca35f780SPaolo Bonzini roms="optionrom" 5672e57218b6SPeter Maydell break 5673e57218b6SPeter Maydell fi 5674e57218b6SPeter Maydell done 5675ca35f780SPaolo Bonzinifi 5676d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 567739ac8455SDavid Gibson roms="$roms spapr-rtas" 567839ac8455SDavid Gibsonfi 5679ca35f780SPaolo Bonzini 56809933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 56819933c305SChristian Borntraeger roms="$roms s390-ccw" 56829933c305SChristian Borntraegerfi 56839933c305SChristian Borntraeger 5684964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary. 568592fe2ba8SPeter Maydellif ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then 5686964c6fa1SRichard Henderson textseg_addr= 5687964c6fa1SRichard Henderson case "$cpu" in 5688479eb121SRichard Henderson arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) 5689479eb121SRichard Henderson # ??? Rationale for choosing this address 5690964c6fa1SRichard Henderson textseg_addr=0x60000000 5691964c6fa1SRichard Henderson ;; 5692964c6fa1SRichard Henderson mips) 5693479eb121SRichard Henderson # A 256M aligned address, high in the address space, with enough 5694479eb121SRichard Henderson # room for the code_gen_buffer above it before the stack. 5695479eb121SRichard Henderson textseg_addr=0x60000000 5696964c6fa1SRichard Henderson ;; 5697964c6fa1SRichard Henderson esac 5698964c6fa1SRichard Henderson if [ -n "$textseg_addr" ]; then 5699964c6fa1SRichard Henderson cat > $TMPC <<EOF 5700964c6fa1SRichard Henderson int main(void) { return 0; } 5701964c6fa1SRichard HendersonEOF 5702964c6fa1SRichard Henderson textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" 5703964c6fa1SRichard Henderson if ! compile_prog "" "$textseg_ldflags"; then 5704964c6fa1SRichard Henderson # In case ld does not support -Ttext-segment, edit the default linker 5705964c6fa1SRichard Henderson # script via sed to set the .text start addr. This is needed on FreeBSD 5706964c6fa1SRichard Henderson # at least. 570792fe2ba8SPeter Maydell if ! $ld --verbose >/dev/null 2>&1; then 570892fe2ba8SPeter Maydell error_exit \ 570992fe2ba8SPeter Maydell "We need to link the QEMU user mode binaries at a" \ 571092fe2ba8SPeter Maydell "specific text address. Unfortunately your linker" \ 571192fe2ba8SPeter Maydell "doesn't support either the -Ttext-segment option or" \ 571292fe2ba8SPeter Maydell "printing the default linker script with --verbose." \ 571392fe2ba8SPeter Maydell "If you don't want the user mode binaries, pass the" \ 571492fe2ba8SPeter Maydell "--disable-user option to configure." 571592fe2ba8SPeter Maydell fi 571692fe2ba8SPeter Maydell 5717964c6fa1SRichard Henderson $ld --verbose | sed \ 5718964c6fa1SRichard Henderson -e '1,/==================================================/d' \ 5719964c6fa1SRichard Henderson -e '/==================================================/,$d' \ 5720964c6fa1SRichard Henderson -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ 5721964c6fa1SRichard Henderson -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld 5722964c6fa1SRichard Henderson textseg_ldflags="-Wl,-T../config-host.ld" 5723964c6fa1SRichard Henderson fi 5724964c6fa1SRichard Henderson fi 5725964c6fa1SRichard Hendersonfi 5726964c6fa1SRichard Henderson 572711cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 572811cde1c8SBruno 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. 572911cde1c8SBruno Dominguezif has $cxx; then 573011cde1c8SBruno Dominguez cat > $TMPC <<EOF 573111cde1c8SBruno Dominguezint c_function(void); 573211cde1c8SBruno Dominguezint main(void) { return c_function(); } 573311cde1c8SBruno DominguezEOF 573411cde1c8SBruno Dominguez 573511cde1c8SBruno Dominguez compile_object 573611cde1c8SBruno Dominguez 573711cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 573811cde1c8SBruno Dominguezextern "C" { 573911cde1c8SBruno Dominguez int c_function(void); 574011cde1c8SBruno Dominguez} 574111cde1c8SBruno Dominguezint c_function(void) { return 42; } 574211cde1c8SBruno DominguezEOF 574311cde1c8SBruno Dominguez 574411cde1c8SBruno Dominguez update_cxxflags 574511cde1c8SBruno Dominguez 574611cde1c8SBruno Dominguez if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then 574711cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 574811cde1c8SBruno Dominguez : 574911cde1c8SBruno Dominguez else 575011cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 575111cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 575211cde1c8SBruno Dominguez cxx= 575311cde1c8SBruno Dominguez fi 575411cde1c8SBruno Dominguezelse 575511cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 575611cde1c8SBruno Dominguez cxx= 575711cde1c8SBruno Dominguezfi 575811cde1c8SBruno Dominguez 575902d34f62SCole Robinsonecho_version() { 576002d34f62SCole Robinson if test "$1" = "yes" ; then 576102d34f62SCole Robinson echo "($2)" 576202d34f62SCole Robinson fi 576302d34f62SCole Robinson} 576402d34f62SCole Robinson 576550e12060SJan Kiszka# prepend pixman and ftd flags after all config tests are done 576650e12060SJan KiszkaQEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" 57678a99e9a3SPhilippe Mathieu-DaudéQEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" 576850e12060SJan Kiszkalibs_softmmu="$pixman_libs $libs_softmmu" 57695ca9388aSGerd Hoffmann 57707d13299dSbellardecho "Install prefix $prefix" 577189138857SStefan Weilecho "BIOS directory $(eval echo $qemu_datadir)" 57723d5eecabSGerd Hoffmannecho "firmware path $(eval echo $firmwarepath)" 577389138857SStefan Weilecho "binary directory $(eval echo $bindir)" 577489138857SStefan Weilecho "library directory $(eval echo $libdir)" 577589138857SStefan Weilecho "module directory $(eval echo $qemu_moddir)" 577689138857SStefan Weilecho "libexec directory $(eval echo $libexecdir)" 577789138857SStefan Weilecho "include directory $(eval echo $includedir)" 577889138857SStefan Weilecho "config directory $(eval echo $sysconfdir)" 577911d9f695Sbellardif test "$mingw32" = "no" ; then 578089138857SStefan Weilecho "local state directory $(eval echo $local_statedir)" 578189138857SStefan Weilecho "Manual directory $(eval echo $mandir)" 578243ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 57835a699bbbSLaszlo Ersekelse 57845a699bbbSLaszlo Ersekecho "local state directory queried at runtime" 5785d9840e25STomoki Sekiyamaecho "Windows SDK $win_sdk" 578611d9f695Sbellardfi 57875a67135aSbellardecho "Source path $source_path" 5788cc84d63aSDaniel P. Berrangeecho "GIT binary $git" 5789aef45d51SDaniel P. Berrangeecho "GIT submodules $git_submodules" 57907d13299dSbellardecho "C compiler $cc" 579183469015Sbellardecho "Host C compiler $host_cc" 579283f73fceSTomoki Sekiyamaecho "C++ compiler $cxx" 57933c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 579445d285abSPeter Maydellecho "ARFLAGS $ARFLAGS" 57950c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 5796a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 57970c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 57988a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS $QEMU_LDFLAGS" 57997d13299dSbellardecho "make $make" 58006a882643Spbrookecho "install $install" 5801c886edfbSBlue Swirlecho "python $python" 5802e2d8830eSBradif test "$slirp" = "yes" ; then 5803e2d8830eSBrad echo "smbd $smbd" 5804e2d8830eSBradfi 580517969268SFam Zhengecho "module support $modules" 5806a98fd896Sbellardecho "host CPU $cpu" 5807de83cd02Sbellardecho "host big endian $bigendian" 580897a847bcSbellardecho "target list $target_list" 58097d13299dSbellardecho "gprof enabled $gprof" 581003b4fe7dSaliguoriecho "sparse enabled $sparse" 58111625af87Saliguoriecho "strip binaries $strip_opt" 581205c2a3e7Sbellardecho "profiler $profiler" 581343ce4dfeSbellardecho "static build $static" 58145b0753e0Sbellardif test "$darwin" = "yes" ; then 58155b0753e0Sbellard echo "Cocoa support $cocoa" 58165b0753e0Sbellardfi 581789138857SStefan Weilecho "SDL support $sdl $(echo_version $sdl $sdlversion)" 581889138857SStefan Weilecho "GTK support $gtk $(echo_version $gtk $gtk_version)" 5819925a0400SGerd Hoffmannecho "GTK GL support $gtk_gl" 582089138857SStefan Weilecho "VTE support $vte $(echo_version $vte $vteversion)" 5821a1c5e949SDaniel P. Berrangeecho "TLS priority $tls_priority" 5822ddbb0d09SDaniel P. Berrangeecho "GNUTLS support $gnutls" 5823b917da4cSDaniel P. Berrangeecho "GNUTLS rnd $gnutls_rnd" 582491bfcdb0SDaniel P. Berrangeecho "libgcrypt $gcrypt" 582537788f25SDaniel P. Berrangeecho "libgcrypt kdf $gcrypt_kdf" 582689138857SStefan Weilecho "nettle $nettle $(echo_version $nettle $nettle_version)" 5827fff2f982SDaniel P. Berrangeecho "nettle kdf $nettle_kdf" 58289a2fd434SDaniel P. Berrangeecho "libtasn1 $tasn1" 58294d3b6f6eSbalrogecho "curses support $curses" 58309d9e1521SGerd Hoffmannecho "virgl support $virglrenderer" 5831769ce76dSAlexander Grafecho "curl support $curl" 583267b915a5Sbellardecho "mingw32 support $mingw32" 58330c58ac1cSmalcecho "Audio drivers $audio_drv_list" 5834b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist" 5835b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist" 5836983eef5aSMeador Ingeecho "VirtFS support $virtfs" 5837fe8fc5aeSPaolo Bonziniecho "Multipath support $mpath" 5838821601eaSJes Sorensenecho "VNC support $vnc" 5839821601eaSJes Sorensenif test "$vnc" = "yes" ; then 58402f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 58412f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 5842efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 5843821601eaSJes Sorensenfi 58443142255cSblueswir1if test -n "$sparc_cpu"; then 58453142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 58463142255cSblueswir1fi 5847e37630caSaliguoriecho "xen support $xen" 58483996e85cSPaul Durrantif test "$xen" = "yes" ; then 58493996e85cSPaul Durrant echo "xen ctrl version $xen_ctrl_version" 585064a7ad6fSIan Campbell echo "pv dom build $xen_pv_domain_build" 58513996e85cSPaul Durrantfi 58522e4d9fb1Saurel32echo "brlapi support $brlapi" 5853a20a6f46SJuan Quintelaecho "bluez support $bluez" 5854a25dba17SJuan Quintelaecho "Documentation $docs" 585540d6444eSAvi Kivityecho "PIE $pie" 58568a16d273Sthsecho "vde support $vde" 585758952137SVincenzo Maffioneecho "netmap support $netmap" 58585c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 5859758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 586077755340Sthsecho "Install blobs $blobs" 5861b31a0277SJuan Quintelaecho "KVM support $kvm" 5862b0cb0a66SVincent Palatinecho "HAX support $hax" 5863c97d6d2cSSergio Andres Gomez Del Realecho "HVF support $hvf" 5864d661d9a4SJustin Terry (VM)echo "WHPX support $whpx" 5865b3f6ea7eSPaolo Bonziniecho "TCG support $tcg" 5866b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes" ; then 5867b3f6ea7eSPaolo Bonzini echo "TCG debug enabled $debug_tcg" 58689195b2c2SStefan Weil echo "TCG interpreter $tcg_interpreter" 5869b3f6ea7eSPaolo Bonzinifi 58705a22ab71SYang Zhongecho "malloc trim support $malloc_trim" 5871b3f6ea7eSPaolo Bonziniecho "RDMA support $rdma" 5872f652e6afSaurel32echo "fdt support $fdt" 5873a40161cbSPaolo Bonziniecho "membarrier $membarrier" 5874ceb42de8Saliguoriecho "preadv support $preadv" 58755f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 5876e78815a5SAndreas Färberecho "madvise $madvise" 5877e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 58789bc5a719SAndreas Gustafssonecho "posix_memalign $posix_memalign" 587947e98658SCorey Bryantecho "libcap-ng support $cap_ng" 5880d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 5881042cea27SGongleiecho "vhost-crypto support $vhost_crypto" 58825e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi" 5883fc0b9b0eSStefan Hajnocziecho "vhost-vsock support $vhost_vsock" 5884e6a74868SMarc-André Lureauecho "vhost-user support $vhost_user" 58855b808275SLluís Vilanovaecho "Trace backends $trace_backends" 5886713572a7SMarc-André Lureauif have_backend "simple"; then 58879410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 5888e00e36fbSStefan Weilfi 588989138857SStefan Weilecho "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" 5890f27aaf4bSChristian Brunnerecho "rbd support $rbd" 5891dce512deSChristoph Hellwigecho "xfsctl support $xfs" 58927b02f544SMarc-André Lureauecho "smartcard support $smartcard" 58932b2325ffSGerd Hoffmannecho "libusb $libusb" 589469354a83SHans de Goedeecho "usb net redir $usb_redir" 5895da076ffeSGerd Hoffmannecho "OpenGL support $opengl" 5896014cb152SGerd Hoffmannecho "OpenGL dmabufs $opengl_dmabuf" 5897c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 58986542aa9cSPeter Lievenecho "libnfs support $libnfs" 5899d138cee9SMichael Rothecho "build guest agent $guest_agent" 5900d9840e25STomoki Sekiyamaecho "QGA VSS support $guest_agent_with_vss" 590150cbebb9SMichael Rothecho "QGA w32 disk info $guest_agent_ntddscsi" 59024c875d89SMichael Rothecho "QGA MSI support $guest_agent_msi" 5903f794573eSEduardo Otuboecho "seccomp support $seccomp" 59047c2acc70SPeter Maydellecho "coroutine backend $coroutine" 590570c60c08SStefan Hajnocziecho "coroutine pool $coroutine_pool" 59067d992e4dSPeter Lievenecho "debug stack usage $debug_stack_usage" 5907f0d92b56SLongpeng(Mike)echo "crypto afalg $crypto_afalg" 5908eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 59091d728c39SBlue Swirlecho "gcov $gcov_tool" 59101d728c39SBlue Swirlecho "gcov enabled $gcov" 5911ab214c29SStefan Bergerecho "TPM support $tpm" 59120a12ec87SRichard W.M. Jonesecho "libssh2 support $libssh2" 59133b8acc11SPaolo Bonziniecho "TPM passthrough $tpm_passthrough" 5914f4ede81eSAmarnath Valluriecho "TPM emulator $tpm_emulator" 59153556c233SPaolo Bonziniecho "QOM debugging $qom_cast_debug" 5916ed1701c6SDr. David Alan Gilbertecho "Live block migration $live_block_migration" 5917607dacd0Sqiaonuohanecho "lzo support $lzo" 5918607dacd0Sqiaonuohanecho "snappy support $snappy" 59196b383c08SPeter Wuecho "bzip2 support $bzip2" 5920a99d57bbSWanlong Gaoecho "NUMA host support $numa" 5921ed279a06SKlim Kireevecho "libxml2 $libxml2" 59222847b469SFam Zhengecho "tcmalloc support $tcmalloc" 59237b01cb97SAlexandre Derumierecho "jemalloc support $jemalloc" 592499f2dbd3SLiang Liecho "avx2 optimization $avx2_opt" 5925a6b1d4c0SChanglong Xieecho "replication support $replication" 5926da92c3ffSAshish Mittalecho "VxHS block device $vxhs" 59278ca80760SRichard Hendersonecho "capstone $capstone" 592851a12b51SAlex Bennéeecho "docker $docker" 592967b915a5Sbellard 59301ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 593124b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 5932e8cd23deSbellardfi 593397a847bcSbellard 5934b7715af2SDaniel P. Berrangeif test "$gtkabi" = "2.0"; then 5935b7715af2SDaniel P. Berrange echo 5936b7715af2SDaniel P. Berrange echo "WARNING: Use of GTK 2.0 is deprecated and will be removed in" 5937b7715af2SDaniel P. Berrange echo "WARNING: future releases. Please switch to using GTK 3.0" 5938b7715af2SDaniel P. Berrangefi 5939b7715af2SDaniel P. Berrange 5940e52c6ba3SDaniel P. Berrangeif test "$sdlabi" = "1.2"; then 5941e52c6ba3SDaniel P. Berrange echo 5942e52c6ba3SDaniel P. Berrange echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in" 5943e52c6ba3SDaniel P. Berrange echo "WARNING: future releases. Please switch to using SDL 2.0" 5944e52c6ba3SDaniel P. Berrangefi 5945e52c6ba3SDaniel P. Berrange 5946898be3e0SPeter Maydellif test "$supported_cpu" = "no"; then 5947898be3e0SPeter Maydell echo 5948898be3e0SPeter Maydell echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!" 5949898be3e0SPeter Maydell echo 5950898be3e0SPeter Maydell echo "CPU host architecture $cpu support is not currently maintained." 5951898be3e0SPeter Maydell echo "The QEMU project intends to remove support for this host CPU in" 5952898be3e0SPeter Maydell echo "a future release if nobody volunteers to maintain it and to" 5953898be3e0SPeter Maydell echo "provide a build host for our continuous integration setup." 5954898be3e0SPeter Maydell echo "configure has succeeded and you can continue to build, but" 5955898be3e0SPeter Maydell echo "if you care about QEMU on this platform you should contact" 5956898be3e0SPeter Maydell echo "us upstream at qemu-devel@nongnu.org." 5957898be3e0SPeter Maydellfi 5958898be3e0SPeter Maydell 5959898be3e0SPeter Maydellif test "$supported_os" = "no"; then 5960898be3e0SPeter Maydell echo 5961898be3e0SPeter Maydell echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!" 5962898be3e0SPeter Maydell echo 5963c50126aaSPeter Maydell echo "Host OS $targetos support is not currently maintained." 5964c50126aaSPeter Maydell echo "The QEMU project intends to remove support for this host OS in" 5965898be3e0SPeter Maydell echo "a future release if nobody volunteers to maintain it and to" 5966898be3e0SPeter Maydell echo "provide a build host for our continuous integration setup." 5967898be3e0SPeter Maydell echo "configure has succeeded and you can continue to build, but" 5968898be3e0SPeter Maydell echo "if you care about QEMU on this platform you should contact" 5969898be3e0SPeter Maydell echo "us upstream at qemu-devel@nongnu.org." 5970898be3e0SPeter Maydellfi 5971898be3e0SPeter Maydell 597298ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 597397a847bcSbellard 5974dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 5975dbd99ae3SStefan Weil 597698ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 597798ec69acSJuan Quintelaecho >> $config_host_mak 597898ec69acSJuan Quintela 5979e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 598099d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 598199d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 59823aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 59838bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 59840f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 598599d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 598699d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 598722d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 59889afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 59893d5eecabSGerd Hoffmannecho "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 59909afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 5991e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 59925a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 5993785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 59945a699bbbSLaszlo Ersekfi 5995f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 5996834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 5997f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 5998cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 5999aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6000f62bbee5SDaniel P. Berrangeecho "GIT_UPDATE=$git_update" >> $config_host_mak 6001804edf29SJuan Quintela 600298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 6003727e5283SPaolo Bonzini 6004f8393946Saurel32if test "$debug_tcg" = "yes" ; then 60052358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6006f8393946Saurel32fi 60071625af87Saliguoriif test "$strip_opt" = "yes" ; then 600852ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 60091625af87Saliguorifi 60107d13299dSbellardif test "$bigendian" = "yes" ; then 6011e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 601297a847bcSbellardfi 601367b915a5Sbellardif test "$mingw32" = "yes" ; then 601498ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 601589138857SStefan Weil rc_version=$(cat $source_path/VERSION) 60169fe6de94SBlue Swirl version_major=${rc_version%%.*} 60179fe6de94SBlue Swirl rc_version=${rc_version#*.} 60189fe6de94SBlue Swirl version_minor=${rc_version%%.*} 60199fe6de94SBlue Swirl rc_version=${rc_version#*.} 60209fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 60219fe6de94SBlue Swirl version_micro=0 60229fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 60239fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6024d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 6025d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6026f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6027d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6028d9840e25STomoki Sekiyama fi 602950cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 603050cbebb9SMichael Roth echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak 603150cbebb9SMichael Roth fi 60321a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 60339dacf32dSYossi Hindin echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 60349dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 60359dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 60369dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 60379dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 60389dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 60399dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 60409dacf32dSYossi Hindin fi 6041210fa556Spbrookelse 604235f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 6043210fa556Spbrookfi 6044128ab2ffSblueswir1 6045dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 6046dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 6047dffcb71cSMark McLoughlinfi 6048dffcb71cSMark McLoughlin 604983fb7adfSbellardif test "$darwin" = "yes" ; then 605098ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 605183fb7adfSbellardfi 6052b29fe3edSmalc 6053ec530c81Sbellardif test "$solaris" = "yes" ; then 605498ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 6055ec530c81Sbellardfi 6056179cf400SAndreas Färberif test "$haiku" = "yes" ; then 6057179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 6058179cf400SAndreas Färberfi 605997a847bcSbellardif test "$static" = "yes" ; then 606098ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 606197a847bcSbellardfi 60621ba16968SStefan Weilif test "$profiler" = "yes" ; then 60632358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 606405c2a3e7Sbellardfi 6065c20709aaSbellardif test "$slirp" = "yes" ; then 606698ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 6067e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 6068c20709aaSbellardfi 60698a16d273Sthsif test "$vde" = "yes" ; then 607098ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 6071e2ad6f16SFam Zheng echo "VDE_LIBS=$vde_libs" >> $config_host_mak 60728a16d273Sthsfi 607358952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 607458952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 607558952137SVincenzo Maffionefi 6076015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 6077015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 6078015a33bdSGongleifi 607947e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 608047e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 608147e98658SCorey Bryantfi 60822358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 60830c58ac1cSmalcfor drv in $audio_drv_list; do 60841ef1ec2aSGerd Hoffmann def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 6085ce3dc033SGerd Hoffmann case "$drv" in 6086051c7d5cSGerd Hoffmann alsa | oss | pa | sdl) 6087ce3dc033SGerd Hoffmann echo "$def=m" >> $config_host_mak ;; 6088ce3dc033SGerd Hoffmann *) 6089ce3dc033SGerd Hoffmann echo "$def=y" >> $config_host_mak ;; 6090ce3dc033SGerd Hoffmann esac 60910c58ac1cSmalcdone 6092b1149911SFam Zhengecho "ALSA_LIBS=$alsa_libs" >> $config_host_mak 6093b1149911SFam Zhengecho "PULSE_LIBS=$pulse_libs" >> $config_host_mak 6094b1149911SFam Zhengecho "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 6095b1149911SFam Zhengecho "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 6096b1149911SFam Zhengecho "OSS_LIBS=$oss_libs" >> $config_host_mak 609767f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 609867f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 609967f86e8eSJuan Quintelafi 6100d5631638Smalcif test "$audio_win_int" = "yes" ; then 6101d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 6102d5631638Smalcfi 6103b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 6104b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 6105821601eaSJes Sorensenif test "$vnc" = "yes" ; then 6106821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 6107821601eaSJes Sorensenfi 61082f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 610998ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 61102f9606b3Saliguorifi 6111821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 61122f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 61132f6f5c7aSCorentin Charyfi 6114821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 6115efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 6116efe556adSCorentin Charyfi 61176a021536SGerd Hoffmannif test "$xkbcommon" = "yes" ; then 61186a021536SGerd Hoffmann echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak 61196a021536SGerd Hoffmann echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak 61206a021536SGerd Hoffmannfi 612176655d6dSaliguoriif test "$fnmatch" = "yes" ; then 61222358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 612376655d6dSaliguorifi 6124dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 6125dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 6126dce512deSChristoph Hellwigfi 612789138857SStefan Weilqemu_version=$(head $source_path/VERSION) 612898ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 61292358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 613098ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 6131*208ecb3eSFam Zhengecho "TARGET_LIST=$target_list" >> $config_host_mak 6132a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 613398ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 6134cc8ae6deSpbrookfi 613517969268SFam Zhengif test "$modules" = "yes"; then 6136e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 6137e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 613889138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 613917969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 614017969268SFam Zhengfi 61418781595bSGerd Hoffmannif test "$have_x11" = "yes" -a "$need_x11" = "yes"; then 61428781595bSGerd Hoffmann echo "CONFIG_X11=y" >> $config_host_mak 61438781595bSGerd Hoffmann echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 61448781595bSGerd Hoffmann echo "X11_LIBS=$x11_libs" >> $config_host_mak 61458781595bSGerd Hoffmannfi 61461ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 614796400a14SGerd Hoffmann echo "CONFIG_SDL=m" >> $config_host_mak 6148a3f4d63dSCole Robinson echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak 61498ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 61508ecc89f6SFam Zheng echo "SDL_LIBS=$sdl_libs" >> $config_host_mak 615149ecc3faSbellardfi 615249ecc3faSbellardif test "$cocoa" = "yes" ; then 615398ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 615449ecc3faSbellardfi 61554d3b6f6eSbalrogif test "$curses" = "yes" ; then 61562373f7d5SGerd Hoffmann echo "CONFIG_CURSES=m" >> $config_host_mak 61572373f7d5SGerd Hoffmann echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 61582373f7d5SGerd Hoffmann echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 6159ab4e5602SJan Kiszkafi 6160099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 61612358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 6162099d6b0fSRiku Voipiofi 616340ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 616440ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 616540ff6d7eSKevin Wolffi 61663ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 61672358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 61683ce34dfbSvibisreenivasanfi 6169c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 6170c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 6171c2882b96SRiku Voipiofi 6172751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 6173751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 6174751bcc39SMarc-André Lureaufi 6175d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 6176d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 6177d0927938SUlrich Hechtfi 61783d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 61793d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 61803d4fa43eSKusanagi Kouichifi 6181b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 6182b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 6183b953f075SDenis V. Lunevfi 6184ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 6185ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 6186ed911435SKevin Wolffi 6187c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 6188c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 6189c727f47dSPeter Maydellfi 6190dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 6191dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 6192dace20dcSPeter Maydellfi 6193d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 6194d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 6195d0927938SUlrich Hechtfi 61964e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 61974e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 61984e0c6529SAlex Blighfi 6199cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 6200cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 6201cd758dd0SAlex Blighfi 62023b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 62033b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 62043b6edd16SPeter Maydellfi 62053b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 62063b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 62073b6edd16SPeter Maydellfi 6208a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 6209a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 6210a8fd1abaSPeter Maydellfi 621151834341SRiku Voipioif test "$timerfd" = "yes" ; then 621251834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 621351834341SRiku Voipiofi 62149af5c906SRiku Voipioif test "$setns" = "yes" ; then 62159af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 62169af5c906SRiku Voipiofi 621738860a03SAleksandar Markovicif test "$clock_adjtime" = "yes" ; then 621838860a03SAleksandar Markovic echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 621938860a03SAleksandar Markovicfi 62205a03cd00SAleksandar Markovicif test "$syncfs" = "yes" ; then 62215a03cd00SAleksandar Markovic echo "CONFIG_SYNCFS=y" >> $config_host_mak 62225a03cd00SAleksandar Markovicfi 62233b3f24adSaurel32if test "$inotify" = "yes" ; then 62242358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 62253b3f24adSaurel32fi 6226c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 6227c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 6228c05c7a73SRiku Voipiofi 6229401bc051SPeter Maydellif test "$sem_timedwait" = "yes" ; then 6230401bc051SPeter Maydell echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 6231401bc051SPeter Maydellfi 62326ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 62336ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 62346ae9a1f4SJuan Quintelafi 62356ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 62366ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 62376ae9a1f4SJuan Quintelafi 6238769ce76dSAlexander Grafif test "$curl" = "yes" ; then 6239d3399d7cSFam Zheng echo "CONFIG_CURL=m" >> $config_host_mak 6240b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 62416ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 6242769ce76dSAlexander Graffi 62432e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 624498ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 62458eca2889SFam Zheng echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 62462e4d9fb1Saurel32fi 6247fb599c9aSbalrogif test "$bluez" = "yes" ; then 624898ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 6249ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 6250fb599c9aSbalrogfi 6251d46f7c9eSDr. David Alan Gilbertif test "$glib_subprocess" = "yes" ; then 62529d41401bSMichael S. Tsirkin echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak 62539d41401bSMichael S. Tsirkinfi 6254a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 6255e0fb129cSGerd Hoffmann echo "CONFIG_GTK=m" >> $config_host_mak 6256a3f4d63dSCole Robinson echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak 6257a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 6258014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 6259925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 6260925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 6261925a0400SGerd Hoffmann fi 6262bbbf9bfbSStefan Weilfi 6263a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 6264ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 6265ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 6266ddbb0d09SDaniel P. Berrangefi 6267b917da4cSDaniel P. Berrangeif test "$gnutls_rnd" = "yes" ; then 6268b917da4cSDaniel P. Berrange echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak 6269b917da4cSDaniel P. Berrangefi 627091bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 627191bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 62721f923c70SLongpeng(Mike) if test "$gcrypt_hmac" = "yes" ; then 62731f923c70SLongpeng(Mike) echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 62741f923c70SLongpeng(Mike) fi 627537788f25SDaniel P. Berrange if test "$gcrypt_kdf" = "yes" ; then 627637788f25SDaniel P. Berrange echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak 627737788f25SDaniel P. Berrange fi 627862893b67SDaniel P. Berrangefi 627991bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 628091bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 6281becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 6282fff2f982SDaniel P. Berrange if test "$nettle_kdf" = "yes" ; then 6283fff2f982SDaniel P. Berrange echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak 6284fff2f982SDaniel P. Berrange fi 6285ed754746SDaniel P. Berrangefi 62869a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 62879a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 62889a2fd434SDaniel P. Berrangefi 6289559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 6290559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 6291559607eaSDaniel P. Berrangefi 62926b39b063SEric Blakeif test "$have_broken_size_max" = "yes" ; then 62936b39b063SEric Blake echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 62946b39b063SEric Blakefi 6295277abf15SJan Vesely 6296277abf15SJan Vesely# Work around a system header bug with some kernel/XFS header 6297277abf15SJan Vesely# versions where they both try to define 'struct fsxattr': 6298277abf15SJan Vesely# xfs headers will not try to redefine structs from linux headers 6299277abf15SJan Vesely# if this macro is set. 6300277abf15SJan Veselyif test "$have_fsxattr" = "yes" ; then 6301277abf15SJan Vesely echo "HAVE_FSXATTR=y" >> $config_host_mak 6302277abf15SJan Veselyfi 63031efad060SFam Zhengif test "$have_copy_file_range" = "yes" ; then 63041efad060SFam Zheng echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 63051efad060SFam Zhengfi 6306bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 6307bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 6308a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 6309e0fb129cSGerd Hoffmann echo "VTE_LIBS=$vte_libs" >> $config_host_mak 6310a4ccabcfSAnthony Liguorifi 63119d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 63129d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 63139d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 63149d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 63159d9e1521SGerd Hoffmannfi 6316e37630caSaliguoriif test "$xen" = "yes" ; then 63176dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 6318d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 631964a7ad6fSIan Campbell if test "$xen_pv_domain_build" = "yes" ; then 632064a7ad6fSIan Campbell echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak 632164a7ad6fSIan Campbell fi 6322e37630caSaliguorifi 63235c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 63245c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 63255c6c3a6cSChristoph Hellwigfi 6326758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 6327758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 6328758e8e38SVenkateswararao Jujjuri (JV)fi 63294f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 63304f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 63314f26f2b6SAvi Kivityfi 6332983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 6333758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 6334758e8e38SVenkateswararao Jujjuri (JV)fi 6335fe8fc5aeSPaolo Bonziniif test "$mpath" = "yes" ; then 6336fe8fc5aeSPaolo Bonzini echo "CONFIG_MPATH=y" >> $config_host_mak 6337fe8fc5aeSPaolo Bonzinifi 63385e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 63395e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 63405e9be92dSNicholas Bellingerfi 6341e6a74868SMarc-André Lureauif test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then 634203ce5744SNikolay Nikolaev echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak 634303ce5744SNikolay Nikolaevfi 6344042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 6345042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 6346042cea27SGongleifi 6347fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 6348fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 6349fc0b9b0eSStefan Hajnoczifi 6350e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 6351e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 6352e6a74868SMarc-André Lureaufi 635377755340Sthsif test "$blobs" = "yes" ; then 635498ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 635577755340Sthsfi 6356bf9298b9Saliguoriif test "$iovec" = "yes" ; then 63572358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 6358bf9298b9Saliguorifi 6359ceb42de8Saliguoriif test "$preadv" = "yes" ; then 63602358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 6361ceb42de8Saliguorifi 6362e3971d61SPhilippe Mathieu-Daudéif test "$fdt" != "no" ; then 63633f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 6364f652e6afSaurel32fi 6365a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 6366a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 6367a40161cbSPaolo Bonzinifi 6368dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 6369dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 6370dcc38d1cSMarcelo Tosattifi 6371b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes"; then 6372b3f6ea7eSPaolo Bonzini echo "CONFIG_TCG=y" >> $config_host_mak 63739195b2c2SStefan Weil if test "$tcg_interpreter" = "yes" ; then 63749195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 63759195b2c2SStefan Weil fi 6376b3f6ea7eSPaolo Bonzinifi 63775f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 63785f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 63795f6b9e8fSBlue Swirlfi 6380e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 6381e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 6382e78815a5SAndreas Färberfi 6383e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 6384e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 6385e78815a5SAndreas Färberfi 63869bc5a719SAndreas Gustafssonif test "$posix_memalign" = "yes" ; then 63879bc5a719SAndreas Gustafsson echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 63889bc5a719SAndreas Gustafssonfi 638997a847bcSbellard 6390cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 6391cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 6392cd4ec0b4SGerd Hoffmannfi 6393cd4ec0b4SGerd Hoffmann 63947b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 63957b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 63967b62bf5aSFam Zheng echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 63977b62bf5aSFam Zheng echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 6398111a38b0SRobert Relyeafi 6399111a38b0SRobert Relyea 64002b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 64012b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 6402b878b652SFam Zheng echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 6403b878b652SFam Zheng echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 64042b2325ffSGerd Hoffmannfi 64052b2325ffSGerd Hoffmann 640669354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 640769354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 6408cc7923fcSFam Zheng echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 6409cc7923fcSFam Zheng echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 641069354a83SHans de Goedefi 641169354a83SHans de Goede 6412da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 6413da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 6414da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 6415014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 6416014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 6417014cb152SGerd Hoffmann fi 641820ff075bSMichael Wallefi 641920ff075bSMichael Walle 64205a22ab71SYang Zhongif test "$malloc_trim" = "yes" ; then 64215a22ab71SYang Zhong echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak 64225a22ab71SYang Zhongfi 64235a22ab71SYang Zhong 642499f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 642599f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 642699f2dbd3SLiang Lifi 642799f2dbd3SLiang Li 6428607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 6429607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 6430607dacd0Sqiaonuohanfi 6431607dacd0Sqiaonuohan 6432607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 6433607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 6434607dacd0Sqiaonuohanfi 6435607dacd0Sqiaonuohan 64366b383c08SPeter Wuif test "$bzip2" = "yes" ; then 64376b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 64386b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 64396b383c08SPeter Wufi 64406b383c08SPeter Wu 6441c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 6442d3399d7cSFam Zheng echo "CONFIG_LIBISCSI=m" >> $config_host_mak 64436ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 64446ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 6445c589b249SRonnie Sahlbergfi 6446c589b249SRonnie Sahlberg 64476542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 64484be4879fSColin Lord echo "CONFIG_LIBNFS=m" >> $config_host_mak 64494be4879fSColin Lord echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 64506542aa9cSPeter Lievenfi 64516542aa9cSPeter Lieven 6452f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 6453f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 6454c3883e1fSFam Zheng echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 6455c3883e1fSFam Zheng echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 6456f794573eSEduardo Otubofi 6457f794573eSEduardo Otubo 645883fb7adfSbellard# XXX: suppress that 64597d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 64602358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 64617d3505c5Sbellardfi 64627d3505c5Sbellard 64634d9310f4SDaniel P. Berrangeif test "$localtime_r" = "yes" ; then 64644d9310f4SDaniel P. Berrange echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 64654d9310f4SDaniel P. Berrangefi 64663556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 64673556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 64683556c233SPaolo Bonzinifi 6469f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 6470d3399d7cSFam Zheng echo "CONFIG_RBD=m" >> $config_host_mak 64716ebc91e5SFam Zheng echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 64726ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 6473f27aaf4bSChristian Brunnerfi 647420ff6c80SAnthony Liguori 64757c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 647670c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 647770c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 647870c60c08SStefan Hajnoczielse 647970c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 648070c60c08SStefan Hajnoczifi 6481d0e2fce5SAneesh Kumar K.V 64827d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 64837d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 64847d992e4dSPeter Lievenfi 64857d992e4dSPeter Lieven 6486f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 6487f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 6488f0d92b56SLongpeng(Mike)fi 6489f0d92b56SLongpeng(Mike) 6490d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 6491d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 6492d2042378SAneesh Kumar K.Vfi 6493d2042378SAneesh Kumar K.V 6494e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 6495e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 6496e06a765eSHarsh Prateek Borafi 6497e06a765eSHarsh Prateek Bora 6498cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then 6499cc6e3ca9SGerd Hoffmann echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 650006d71fa1SPeter Maydellfi 650106d71fa1SPeter Maydell 65023f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 65033f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 65043f4349dcSKevin Wolffi 65053f4349dcSKevin Wolf 6506d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 6507d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 6508d83414e1SMarc-André Lureaufi 6509d83414e1SMarc-André Lureau 65108ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 65118ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 65128ab1bf12SLuiz Capitulinofi 65138ab1bf12SLuiz Capitulino 651476a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 651576a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 651676a347e1SRichard Hendersonfi 651776a347e1SRichard Henderson 6518f540166bSRichard Hendersonif test "$int128" = "yes" ; then 6519f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 6520f540166bSRichard Hendersonfi 6521f540166bSRichard Henderson 65227ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 65237ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 65247ebee43eSRichard Hendersonfi 65257ebee43eSRichard Henderson 6526df79b996SRichard Hendersonif test "$atomic64" = "yes" ; then 6527df79b996SRichard Henderson echo "CONFIG_ATOMIC64=y" >> $config_host_mak 6528df79b996SRichard Hendersonfi 6529df79b996SRichard Henderson 6530db432672SRichard Hendersonif test "$vector16" = "yes" ; then 6531db432672SRichard Henderson echo "CONFIG_VECTOR16=y" >> $config_host_mak 6532db432672SRichard Hendersonfi 6533db432672SRichard Henderson 65341e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 65351e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 65361e6e9acaSRichard Hendersonfi 65371e6e9acaSRichard Henderson 6538eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 6539d3399d7cSFam Zheng echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 65406ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 65416ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 6542eb100396SBharata B Raofi 6543eb100396SBharata B Rao 6544d85fa9ebSJeff Codyif test "$glusterfs_xlator_opt" = "yes" ; then 6545d85fa9ebSJeff Cody echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 6546d85fa9ebSJeff Codyfi 6547d85fa9ebSJeff Cody 65480c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 65490c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 65500c14fb47SBharata B Raofi 65510c14fb47SBharata B Rao 6552df3a429aSNiels de Vosif test "$glusterfs_fallocate" = "yes" ; then 6553df3a429aSNiels de Vos echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 6554df3a429aSNiels de Vosfi 6555df3a429aSNiels de Vos 65567c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 65577c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 65587c815372SBharata B Raofi 65597c815372SBharata B Rao 65600a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then 6561d3399d7cSFam Zheng echo "CONFIG_LIBSSH2=m" >> $config_host_mak 65626ebc91e5SFam Zheng echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak 65636ebc91e5SFam Zheng echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak 65640a12ec87SRichard W.M. Jonesfi 65650a12ec87SRichard W.M. Jones 6566ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 6567ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 6568ed1701c6SDr. David Alan Gilbertfi 6569ed1701c6SDr. David Alan Gilbert 65703b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 65713b8acc11SPaolo Bonzini echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak 6572f4ede81eSAmarnath Valluri # TPM passthrough support? 65733b8acc11SPaolo Bonzini if test "$tpm_passthrough" = "yes"; then 65743b8acc11SPaolo Bonzini echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak 65753b8acc11SPaolo Bonzini fi 6576f4ede81eSAmarnath Valluri # TPM emulator support? 6577f4ede81eSAmarnath Valluri if test "$tpm_emulator" = "yes"; then 6578f4ede81eSAmarnath Valluri echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak 6579f4ede81eSAmarnath Valluri fi 65803b8acc11SPaolo Bonzinifi 65813b8acc11SPaolo Bonzini 65825b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 65835b808275SLluís Vilanovaif have_backend "nop"; then 65846d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 658522890ab5SPrerna Saxenafi 65865b808275SLluís Vilanovaif have_backend "simple"; then 65876d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 65886d8a764eSLluís # Set the appropriate trace file. 6589953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 65909410b56cSPrerna Saxenafi 6591ed7f5f1dSPaolo Bonziniif have_backend "log"; then 6592ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 65936d8a764eSLluísfi 65945b808275SLluís Vilanovaif have_backend "ust"; then 65956d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 65966d8a764eSLluísfi 65975b808275SLluís Vilanovaif have_backend "dtrace"; then 65986d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 65996d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 66006d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 66016d8a764eSLluís fi 6602c276b17dSDaniel P. Berrangefi 66035b808275SLluís Vilanovaif have_backend "ftrace"; then 6604781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 6605781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 6606781e9545SEiichi Tsukata else 660721684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 6608781e9545SEiichi Tsukata fi 6609781e9545SEiichi Tsukatafi 66100a852417SPaul Durrantif have_backend "syslog"; then 66110a852417SPaul Durrant if test "$posix_syslog" = "yes" ; then 66120a852417SPaul Durrant echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 66130a852417SPaul Durrant else 66140a852417SPaul Durrant feature_not_found "syslog(trace backend)" "syslog not available" 66150a852417SPaul Durrant fi 66160a852417SPaul Durrantfi 66179410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 66189410b56cSPrerna Saxena 66192da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 66202da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 6621392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 66222da776dbSMichael R. Hinesfi 66232da776dbSMichael R. Hines 6624575b22b1SLaurent Vivierif test "$have_rtnetlink" = "yes" ; then 6625575b22b1SLaurent Vivier echo "CONFIG_RTNETLINK=y" >> $config_host_mak 6626575b22b1SLaurent Vivierfi 6627575b22b1SLaurent Vivier 6628ed279a06SKlim Kireevif test "$libxml2" = "yes" ; then 6629ed279a06SKlim Kireev echo "CONFIG_LIBXML2=y" >> $config_host_mak 6630ed279a06SKlim Kireev echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 6631ed279a06SKlim Kireev echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 6632ed279a06SKlim Kireevfi 6633ed279a06SKlim Kireev 6634a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 6635a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 6636a6b1d4c0SChanglong Xiefi 6637a6b1d4c0SChanglong Xie 66386a02c806SStefan Hajnocziif test "$have_af_vsock" = "yes" ; then 66396a02c806SStefan Hajnoczi echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 66406a02c806SStefan Hajnoczifi 66416a02c806SStefan Hajnoczi 66424d04351fSChristopher Covingtonif test "$have_sysmacros" = "yes" ; then 66434d04351fSChristopher Covington echo "CONFIG_SYSMACROS=y" >> $config_host_mak 66444d04351fSChristopher Covingtonfi 66454d04351fSChristopher Covington 664649e00a18SAndreas Grapentinif test "$have_static_assert" = "yes" ; then 664749e00a18SAndreas Grapentin echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 664849e00a18SAndreas Grapentinfi 664949e00a18SAndreas Grapentin 6650e674605fSTomáš Golembiovskýif test "$have_utmpx" = "yes" ; then 6651e674605fSTomáš Golembiovský echo "HAVE_UTMPX=y" >> $config_host_mak 6652e674605fSTomáš Golembiovskýfi 6653e674605fSTomáš Golembiovský 6654e0580342SKamil Rytarowskiif test "$ivshmem" = "yes" ; then 6655e0580342SKamil Rytarowski echo "CONFIG_IVSHMEM=y" >> $config_host_mak 6656e0580342SKamil Rytarowskifi 6657e219c499SRichard Hendersonif test "$capstone" != "no" ; then 66588ca80760SRichard Henderson echo "CONFIG_CAPSTONE=y" >> $config_host_mak 66598ca80760SRichard Hendersonfi 6660e0580342SKamil Rytarowski 66615c312079SDr. David Alan Gilbert# Hold two types of flag: 66625c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 66635c312079SDr. David Alan Gilbert# a thread we have a handle to 66645c312079SDr. David Alan Gilbert# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular 66655c312079SDr. David Alan Gilbert# platform 66665c312079SDr. David Alan Gilbertif test "$pthread_setname_np" = "yes" ; then 66675c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 66685c312079SDr. David Alan Gilbert echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak 66695c312079SDr. David Alan Gilbertfi 66705c312079SDr. David Alan Gilbert 6671da92c3ffSAshish Mittalif test "$vxhs" = "yes" ; then 6672da92c3ffSAshish Mittal echo "CONFIG_VXHS=y" >> $config_host_mak 6673da92c3ffSAshish Mittal echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak 6674da92c3ffSAshish Mittalfi 6675da92c3ffSAshish Mittal 66765b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 66779edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 66785b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 66799edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 66805b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 66819edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 6682c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then 66839edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 668440d964b5SRichard Hendersonelif test "$ARCH" = "ppc64" ; then 66859edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" 66865b5e3037SPaolo Bonzinielse 66879edc19c9SMichael S. Tsirkin QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 66885b5e3037SPaolo Bonzinifi 66899edc19c9SMichael S. TsirkinQEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES" 66905b5e3037SPaolo Bonzini 669198ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 669298ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 6693804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 6694804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 66951901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 66961901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 66971901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 669821655882SPaolo Bonziniecho "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 6699c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 6700804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 6701a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 6702a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_host_mak 6703a31a8642SMichael S. Tsirkinfi 67042b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 6705804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 670683f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 67073c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 6708804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 670945d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 6710cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 67115f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 67123dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 6713804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 6714804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 67159f81aeb5SAlistair Francisecho "RANLIB=$ranlib" >> $config_host_mak 67164852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 67179fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 6718e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 671946eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 6720a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 672111cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 6722f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 6723e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 6724e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 672580fd48dfSChristian Borntraeger echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak 67262944d742SGerd Hoffmann echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak 6727e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 6728e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 6729e39f0062SPaolo Bonzinifi 673042da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 673142da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 673242da6041SGerd Hoffmannelse 673342da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 673442da6041SGerd Hoffmannfi 6735e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 673646eef33bSBradecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 67378a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 67386969ec6cSJames Clarkeecho "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak 6739e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 674073da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 67413e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 6742409437e1SDaniel P. Berrangeecho "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 6743804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 674417969268SFam Zhengecho "DSOSUF=$DSOSUF" >> $config_host_mak 674517969268SFam Zhengecho "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 6746957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 674790246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 674890246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 674994dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 6750cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 67511d728c39SBlue Swirlif test "$gcov" = "yes" ; then 67521d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 67531d728c39SBlue Swirl echo "GCOV=$gcov_tool" >> $config_host_mak 67541d728c39SBlue Swirlfi 6755804edf29SJuan Quintela 675651a12b51SAlex Bennéeif test "$docker" != "no"; then 675751a12b51SAlex Bennée echo "HAVE_USER_DOCKER=y" >> $config_host_mak 675851a12b51SAlex Bennéefi 675951a12b51SAlex Bennée 67606efd7517SPeter Maydell# use included Linux headers 67616efd7517SPeter Maydellif test "$linux" = "yes" ; then 6762a307beb6SAndreas Färber mkdir -p linux-headers 67636efd7517SPeter Maydell case "$cpu" in 6764c72b26ecSRichard Henderson i386|x86_64|x32) 676508312a63SPeter Maydell linux_arch=x86 67666efd7517SPeter Maydell ;; 67676efd7517SPeter Maydell ppcemb|ppc|ppc64) 676808312a63SPeter Maydell linux_arch=powerpc 67696efd7517SPeter Maydell ;; 67706efd7517SPeter Maydell s390x) 677108312a63SPeter Maydell linux_arch=s390 677208312a63SPeter Maydell ;; 67731f080313SClaudio Fontana aarch64) 67741f080313SClaudio Fontana linux_arch=arm64 67751f080313SClaudio Fontana ;; 6776222e7d11SSanjay Lal mips64) 6777222e7d11SSanjay Lal linux_arch=mips 6778222e7d11SSanjay Lal ;; 677908312a63SPeter Maydell *) 678008312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 678108312a63SPeter Maydell linux_arch="$cpu" 67826efd7517SPeter Maydell ;; 67836efd7517SPeter Maydell esac 678408312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 678508312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 678608312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 678708312a63SPeter Maydell fi 67886efd7517SPeter Maydellfi 67896efd7517SPeter Maydell 679097a847bcSbellardfor target in $target_list; do 679197a847bcSbellardtarget_dir="$target" 679225be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 679389138857SStefan Weiltarget_name=$(echo $target | cut -d '-' -f 1) 679497a847bcSbellardtarget_bigendian="no" 67951f3d3c8fSJuan Quintela 6796c1799a84SPaolo Bonzinicase "$target_name" in 6797722dd7beSMichael Weiser armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 6798ea2d6a39SJuan Quintela target_bigendian=yes 6799ea2d6a39SJuan Quintela ;; 6800ea2d6a39SJuan Quintelaesac 680197a847bcSbellardtarget_softmmu="no" 6802997344f3Sbellardtarget_user_only="no" 6803831b7825Sthstarget_linux_user="no" 680484778508Sblueswir1target_bsd_user="no" 68059e407a85Spbrookcase "$target" in 6806c1799a84SPaolo Bonzini ${target_name}-softmmu) 68079e407a85Spbrook target_softmmu="yes" 68089e407a85Spbrook ;; 6809c1799a84SPaolo Bonzini ${target_name}-linux-user) 68109e407a85Spbrook target_user_only="yes" 68119e407a85Spbrook target_linux_user="yes" 68129e407a85Spbrook ;; 6813c1799a84SPaolo Bonzini ${target_name}-bsd-user) 681484778508Sblueswir1 target_user_only="yes" 681584778508Sblueswir1 target_bsd_user="yes" 681684778508Sblueswir1 ;; 68179e407a85Spbrook *) 681876ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 68199e407a85Spbrook exit 1 68209e407a85Spbrook ;; 68219e407a85Spbrookesac 6822831b7825Sths 682397a847bcSbellardmkdir -p $target_dir 682425be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 682597a847bcSbellard 6826e5fe0c52Spbrookbflt="no" 6827ca759f9eSAlex Bennéemttcg="no" 682889138857SStefan Weilinterp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") 682956aebc89Spbrookgdb_xml_files="" 68307ba1e619Saliguori 6831c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 68326acff7daSJuan QuintelaTARGET_BASE_ARCH="" 6833e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 6834e73aae67SJuan Quintela 6835c1799a84SPaolo Bonzinicase "$target_name" in 68362408a527Saurel32 i386) 6837b8158192SAbdallah Bouassida gdb_xml_files="i386-32bit.xml i386-32bit-core.xml i386-32bit-sse.xml" 68382408a527Saurel32 ;; 68392408a527Saurel32 x86_64) 68406acff7daSJuan Quintela TARGET_BASE_ARCH=i386 6841b8158192SAbdallah Bouassida gdb_xml_files="i386-64bit.xml i386-64bit-core.xml i386-64bit-sse.xml" 68422408a527Saurel32 ;; 68432408a527Saurel32 alpha) 68445ee4f3c2SRichard Henderson mttcg="yes" 68452408a527Saurel32 ;; 68462408a527Saurel32 arm|armeb) 6847b498c8a0SJuan Quintela TARGET_ARCH=arm 6848e5fe0c52Spbrook bflt="yes" 6849ca759f9eSAlex Bennée mttcg="yes" 685056aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 68512408a527Saurel32 ;; 6852722dd7beSMichael Weiser aarch64|aarch64_be) 6853722dd7beSMichael Weiser TARGET_ARCH=aarch64 68546a49fa95SAlexander Graf TARGET_BASE_ARCH=arm 68556a49fa95SAlexander Graf bflt="yes" 6856ca759f9eSAlex Bennée mttcg="yes" 68578f95ce2eSPeter Maydell gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 68586a49fa95SAlexander Graf ;; 68592408a527Saurel32 cris) 68602408a527Saurel32 ;; 686161766fe9SRichard Henderson hppa) 68627b93dab5SRichard Henderson mttcg="yes" 686361766fe9SRichard Henderson ;; 6864613a22c9SMichael Walle lm32) 6865613a22c9SMichael Walle ;; 68662408a527Saurel32 m68k) 68670938cda5Saurel32 bflt="yes" 68685a4526b2SLaurent Vivier gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml" 68692408a527Saurel32 ;; 6870877fdc12SEdgar E. Iglesias microblaze|microblazeel) 6871877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 687272b675caSEdgar E. Iglesias bflt="yes" 6873be73ef64SEdgar E. Iglesias echo "TARGET_ABI32=y" >> $config_target_mak 687472b675caSEdgar E. Iglesias ;; 68752408a527Saurel32 mips|mipsel) 6876b498c8a0SJuan Quintela TARGET_ARCH=mips 687725be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 68782408a527Saurel32 ;; 68792408a527Saurel32 mipsn32|mipsn32el) 6880597e2cecSRichard Henderson TARGET_ARCH=mips64 68816acff7daSJuan Quintela TARGET_BASE_ARCH=mips 688225be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 6883597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 68842408a527Saurel32 ;; 68852408a527Saurel32 mips64|mips64el) 6886b498c8a0SJuan Quintela TARGET_ARCH=mips64 68876acff7daSJuan Quintela TARGET_BASE_ARCH=mips 688825be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 68892408a527Saurel32 ;; 6890d15a9c23SAnthony Green moxie) 6891d15a9c23SAnthony Green ;; 6892e671711cSMarek Vasut nios2) 6893e671711cSMarek Vasut ;; 68944a09d0bbSRichard Henderson or1k) 6895e67db06eSJia Liu TARGET_ARCH=openrisc 6896e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 6897e67db06eSJia Liu ;; 68982408a527Saurel32 ppc) 6899c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 69002408a527Saurel32 ;; 69012408a527Saurel32 ppcemb) 69026acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 6903e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 6904c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 69052408a527Saurel32 ;; 69062408a527Saurel32 ppc64) 69076acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 6908e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 6909f0b0685dSNikunj A Dadhania mttcg=yes 69101438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 69112408a527Saurel32 ;; 69129c35126cSDoug Kwan ppc64le) 69139c35126cSDoug Kwan TARGET_ARCH=ppc64 69149c35126cSDoug Kwan TARGET_BASE_ARCH=ppc 69159c35126cSDoug Kwan TARGET_ABI_DIR=ppc 6916f0b0685dSNikunj A Dadhania mttcg=yes 69171438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 69189c35126cSDoug Kwan ;; 69192408a527Saurel32 ppc64abi32) 6920b498c8a0SJuan Quintela TARGET_ARCH=ppc64 69216acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 6922e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 692325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 69241438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 69252408a527Saurel32 ;; 692625fa194bSMichael Clark riscv32) 692725fa194bSMichael Clark TARGET_BASE_ARCH=riscv 692825fa194bSMichael Clark TARGET_ABI_DIR=riscv 692925fa194bSMichael Clark mttcg=yes 693025fa194bSMichael Clark ;; 693125fa194bSMichael Clark riscv64) 693225fa194bSMichael Clark TARGET_BASE_ARCH=riscv 693325fa194bSMichael Clark TARGET_ABI_DIR=riscv 693425fa194bSMichael Clark mttcg=yes 693525fa194bSMichael Clark ;; 69362408a527Saurel32 sh4|sh4eb) 6937b498c8a0SJuan Quintela TARGET_ARCH=sh4 69384dbed897Spbrook bflt="yes" 69392408a527Saurel32 ;; 69402408a527Saurel32 sparc) 69412408a527Saurel32 ;; 69422408a527Saurel32 sparc64) 69436acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 69442408a527Saurel32 ;; 69452408a527Saurel32 sparc32plus) 6946b498c8a0SJuan Quintela TARGET_ARCH=sparc64 69476acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 6948e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 694925be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 69502408a527Saurel32 ;; 695124e804ecSAlexander Graf s390x) 695263685bc4SDavid Hildenbrand mttcg=yes 695386158a2aSChristian 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" 695424e804ecSAlexander Graf ;; 6955444e06b1SChen Gang tilegx) 6956444e06b1SChen Gang ;; 69575ecaa4edSPeter Crosthwaite tricore) 69585ecaa4edSPeter Crosthwaite ;; 6959d2fbca94SGuan Xuetao unicore32) 6960d2fbca94SGuan Xuetao ;; 6961cfa550c6SMax Filippov xtensa|xtensaeb) 6962cfa550c6SMax Filippov TARGET_ARCH=xtensa 69639fb40342SMax Filippov mttcg="yes" 6964cfa550c6SMax Filippov ;; 69652408a527Saurel32 *) 696676ad07a4SPeter Maydell error_exit "Unsupported target CPU" 69672408a527Saurel32 ;; 69682408a527Saurel32esac 69695e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 69705e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 69715e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 69725e8861a0SPaolo Bonzinifi 69735e8861a0SPaolo Bonzini 69745e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 69755e8861a0SPaolo Bonzini 697699afc91dSDaniel P. Berrangeupper() { 697799afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 697899afc91dSDaniel P. Berrange} 697999afc91dSDaniel P. Berrange 698089138857SStefan Weiltarget_arch_name="$(upper $TARGET_ARCH)" 698125be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 6982c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 698325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 6984e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 6985e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 6986e6e91b9cSJuan Quintelafi 698725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 6988adfc3e91SStacey Sonif [ "$HOST_VARIANT_DIR" != "" ]; then 6989adfc3e91SStacey Son echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 6990adfc3e91SStacey Sonfi 69913b6b7550SPaolo Bonzini 69923b6b7550SPaolo Bonziniif supported_xen_target $target; then 699325be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 6994eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 6995eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 6996eb6fda0fSAnthony PERARD fi 6997432d268cSJun Nakajimafi 69983b6b7550SPaolo Bonziniif supported_kvm_target $target; then 699925be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 70001ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 7001d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 7002e6a74868SMarc-André Lureau if test "$vhost_user" = "yes" ; then 7003e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak 7004e6a74868SMarc-André Lureau fi 7005d5970055SMichael S. Tsirkin fi 7006c59249f9SJuan Quintelafi 70073b6b7550SPaolo Bonziniif supported_hax_target $target; then 7008b0cb0a66SVincent Palatin echo "CONFIG_HAX=y" >> $config_target_mak 7009b0cb0a66SVincent Palatinfi 7010c97d6d2cSSergio Andres Gomez Del Realif supported_hvf_target $target; then 7011c97d6d2cSSergio Andres Gomez Del Real echo "CONFIG_HVF=y" >> $config_target_mak 7012c97d6d2cSSergio Andres Gomez Del Realfi 7013d661d9a4SJustin Terry (VM)if supported_whpx_target $target; then 7014d661d9a4SJustin Terry (VM) echo "CONFIG_WHPX=y" >> $config_target_mak 7015d661d9a4SJustin Terry (VM)fi 7016de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 701725be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 701897a847bcSbellardfi 701997a847bcSbellardif test "$target_softmmu" = "yes" ; then 702025be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 7021ca759f9eSAlex Bennée if test "$mttcg" = "yes" ; then 7022ca759f9eSAlex Bennée echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak 7023ca759f9eSAlex Bennée fi 7024de83cd02Sbellardfi 7025997344f3Sbellardif test "$target_user_only" = "yes" ; then 702625be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 7027a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 7028997344f3Sbellardfi 7029831b7825Sthsif test "$target_linux_user" = "yes" ; then 703025be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 7031831b7825Sthsfi 703256aebc89Spbrooklist="" 703356aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 703456aebc89Spbrook for x in $gdb_xml_files; do 703556aebc89Spbrook list="$list $source_path/gdb-xml/$x" 703656aebc89Spbrook done 703725be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 70383d0f1517SJuan Quintelafi 7039de83cd02Sbellard 7040e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 704125be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 7042e5fe0c52Spbrookfi 704384778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 704425be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 704584778508Sblueswir1fi 70465b0753e0Sbellard 70474afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 7048fa282484SJuan Quintela 70494afddb55SJuan Quintelacflags="" 7050fa282484SJuan Quintelaldflags="" 70519b8e111fSJuan Quintela 7052c765fcacSPeter Crosthwaitedisas_config() { 7053c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> $config_target_mak 7054c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak 7055c765fcacSPeter Crosthwaite} 7056c765fcacSPeter Crosthwaite 705764656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 705864656024SJuan Quintela case "$i" in 705964656024SJuan Quintela alpha) 7060c765fcacSPeter Crosthwaite disas_config "ALPHA" 706164656024SJuan Quintela ;; 706282295d8aSRichard Henderson aarch64) 706382295d8aSRichard Henderson if test -n "${cxx}"; then 7064c765fcacSPeter Crosthwaite disas_config "ARM_A64" 706582295d8aSRichard Henderson fi 706682295d8aSRichard Henderson ;; 706764656024SJuan Quintela arm) 7068c765fcacSPeter Crosthwaite disas_config "ARM" 7069999b53ecSClaudio Fontana if test -n "${cxx}"; then 7070c765fcacSPeter Crosthwaite disas_config "ARM_A64" 7071999b53ecSClaudio Fontana fi 707264656024SJuan Quintela ;; 707364656024SJuan Quintela cris) 7074c765fcacSPeter Crosthwaite disas_config "CRIS" 707564656024SJuan Quintela ;; 7076429b31a2SRichard Henderson hppa) 7077429b31a2SRichard Henderson disas_config "HPPA" 7078429b31a2SRichard Henderson ;; 7079c72b26ecSRichard Henderson i386|x86_64|x32) 7080c765fcacSPeter Crosthwaite disas_config "I386" 708164656024SJuan Quintela ;; 708279368f49SMichael Walle lm32) 7083c765fcacSPeter Crosthwaite disas_config "LM32" 708479368f49SMichael Walle ;; 708564656024SJuan Quintela m68k) 7086c765fcacSPeter Crosthwaite disas_config "M68K" 708764656024SJuan Quintela ;; 7088877fdc12SEdgar E. Iglesias microblaze*) 7089c765fcacSPeter Crosthwaite disas_config "MICROBLAZE" 709064656024SJuan Quintela ;; 709164656024SJuan Quintela mips*) 7092c765fcacSPeter Crosthwaite disas_config "MIPS" 709364656024SJuan Quintela ;; 7094d15a9c23SAnthony Green moxie*) 7095c765fcacSPeter Crosthwaite disas_config "MOXIE" 7096d15a9c23SAnthony Green ;; 7097e671711cSMarek Vasut nios2) 7098e671711cSMarek Vasut disas_config "NIOS2" 7099e671711cSMarek Vasut ;; 71004a09d0bbSRichard Henderson or1k) 7101c765fcacSPeter Crosthwaite disas_config "OPENRISC" 7102e67db06eSJia Liu ;; 710364656024SJuan Quintela ppc*) 7104c765fcacSPeter Crosthwaite disas_config "PPC" 710564656024SJuan Quintela ;; 710625fa194bSMichael Clark riscv) 710725fa194bSMichael Clark disas_config "RISCV" 710825fa194bSMichael Clark ;; 710924e804ecSAlexander Graf s390*) 7110c765fcacSPeter Crosthwaite disas_config "S390" 711164656024SJuan Quintela ;; 711264656024SJuan Quintela sh4) 7113c765fcacSPeter Crosthwaite disas_config "SH4" 711464656024SJuan Quintela ;; 711564656024SJuan Quintela sparc*) 7116c765fcacSPeter Crosthwaite disas_config "SPARC" 711764656024SJuan Quintela ;; 7118cfa550c6SMax Filippov xtensa*) 7119c765fcacSPeter Crosthwaite disas_config "XTENSA" 7120cfa550c6SMax Filippov ;; 712164656024SJuan Quintela esac 712264656024SJuan Quinteladone 71239195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 7124c765fcacSPeter Crosthwaite disas_config "TCI" 71259195b2c2SStefan Weilfi 712664656024SJuan Quintela 71276ee7126fSJuan Quintelacase "$ARCH" in 71286ee7126fSJuan Quintelaalpha) 71296ee7126fSJuan Quintela # Ensure there's only a single GP 71306ee7126fSJuan Quintela cflags="-msmall-data $cflags" 71316ee7126fSJuan Quintela;; 71326ee7126fSJuan Quintelaesac 71336ee7126fSJuan Quintela 7134d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 713525be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 7136d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 7137d02c1db3SJuan Quintela cflags="-p $cflags" 7138d02c1db3SJuan Quintela ldflags="-p $ldflags" 7139d02c1db3SJuan Quintela fi 7140d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 7141d02c1db3SJuan Quintela ldflags="-p $ldflags" 714225be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 7143d02c1db3SJuan Quintela fi 7144d02c1db3SJuan Quintelafi 7145d02c1db3SJuan Quintela 71469b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 7147964c6fa1SRichard Henderson ldflags="$ldflags $textseg_ldflags" 7148fa282484SJuan Quintelafi 7149fa282484SJuan Quintela 7150e9a3591fSChristian Borntraeger# Newer kernels on s390 check for an S390_PGSTE program header and 7151e9a3591fSChristian Borntraeger# enable the pgste page table extensions in that case. This makes 7152e9a3591fSChristian Borntraeger# the vm.allocate_pgste sysctl unnecessary. We enable this program 7153e9a3591fSChristian Borntraeger# header if 7154e9a3591fSChristian Borntraeger# - we build on s390x 7155e9a3591fSChristian Borntraeger# - we build the system emulation for s390x (qemu-system-s390x) 7156e9a3591fSChristian Borntraeger# - KVM is enabled 7157e9a3591fSChristian Borntraeger# - the linker supports --s390-pgste 7158e9a3591fSChristian Borntraegerif test "$TARGET_ARCH" = "s390x" -a "$target_softmmu" = "yes" -a "$ARCH" = "s390x" -a "$kvm" = "yes"; then 7159e9a3591fSChristian Borntraeger if ld_has --s390-pgste ; then 7160e9a3591fSChristian Borntraeger ldflags="-Wl,--s390-pgste $ldflags" 7161e9a3591fSChristian Borntraeger fi 7162e9a3591fSChristian Borntraegerfi 7163e9a3591fSChristian Borntraeger 716425be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 716525be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 7166fa282484SJuan Quintela 716797a847bcSbellarddone # for target in $targets 71687d13299dSbellard 7169e3971d61SPhilippe Mathieu-Daudéif [ "$fdt" = "git" ]; then 7170a540f158SPeter Crosthwaite echo "config-host.h: subdir-dtc" >> $config_host_mak 7171a540f158SPeter Crosthwaitefi 7172e219c499SRichard Hendersonif [ "$capstone" = "git" -o "$capstone" = "internal" ]; then 7173e219c499SRichard Henderson echo "config-host.h: subdir-capstone" >> $config_host_mak 7174e219c499SRichard Hendersonfi 7175e219c499SRichard Hendersonif test -n "$LIBCAPSTONE"; then 7176e219c499SRichard Henderson echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak 7177e219c499SRichard Hendersonfi 7178a540f158SPeter Crosthwaite 7179a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 7180a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 7181a99d57bbSWanlong Gaofi 7182a99d57bbSWanlong Gao 7183fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 7184fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 7185fd0e6053SJohn Snowfi 7186fd0e6053SJohn Snow 7187d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 7188b1fb9a63SFam ZhengDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" 7189b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 71909933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" 71912d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 7192c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 7193c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 7194aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" 7195ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 7196446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 71979933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile" 71982d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 71994652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp" 72003a586d2fSStefan HajnocziFILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit 7201753d11f2SRichard Hendersonfor bios_file in \ 7202753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 7203225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 72045acc2ec0SGerd Hoffmann $source_path/pc-bios/*.aml \ 7205753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 7206753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 7207e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 7208753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 72094e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 7210753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 7211753d11f2SRichard Hendersondo 721289138857SStefan Weil FILES="$FILES pc-bios/$(basename $bios_file)" 72137ea78b74SJan Kiszkadone 721489138857SStefan Weilfor test_file in $(find $source_path/tests/acpi-test-data -type f) 7215c2304b52SMarcel Apfelbaumdo 721689138857SStefan Weil FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')" 7217c2304b52SMarcel Apfelbaumdone 7218d1807a4fSPaolo Bonzinimkdir -p $DIRS 72197d13299dSbellardfor f in $FILES ; do 7220cab00a5aSMichael S. Tsirkin if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then 7221f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 7222f9245e10SPeter Maydell fi 72237d13299dSbellarddone 72241ad2134fSPaul Brook 7225c34ebfdcSAnthony Liguori# temporary config to build submodules 72262d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 7227c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 722837116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 7229c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 7230cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 72315f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 7232c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 7233c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 72343dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 7235c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 7236a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 7237c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 72389f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 7239c34ebfdcSAnthony Liguoridone 7240c34ebfdcSAnthony Liguori 7241fe31017fSMarc-André Lureau# set up tests data directory 7242fe31017fSMarc-André Lureauif [ ! -e tests/data ]; then 7243fe31017fSMarc-André Lureau symlink "$source_path/tests/data" tests/data 7244fe31017fSMarc-André Lureaufi 7245fe31017fSMarc-André Lureau 724676c7560aSMax Reitz# set up qemu-iotests in this build directory 724776c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 724876c7560aSMax Reitziotests_check="tests/qemu-iotests/check" 724976c7560aSMax Reitz 725076c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 725176c7560aSMax Reitzecho >> "$iotests_common_env" 725276c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 725376c7560aSMax Reitz 725476c7560aSMax Reitzif [ ! -e "$iotests_check" ]; then 725576c7560aSMax Reitz symlink "$source_path/$iotests_check" "$iotests_check" 725676c7560aSMax Reitzfi 725776c7560aSMax Reitz 7258dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 7259dc655404SMichael S. Tsirkincat <<EOD >config.status 7260dc655404SMichael S. Tsirkin#!/bin/sh 7261dc655404SMichael S. Tsirkin# Generated by configure. 7262dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 7263dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 7264dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 7265dc655404SMichael S. TsirkinEOD 7266dc655404SMichael S. Tsirkinprintf "exec" >>config.status 7267dc655404SMichael S. Tsirkinprintf " '%s'" "$0" "$@" >>config.status 7268cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 7269dc655404SMichael S. Tsirkinchmod +x config.status 7270dc655404SMichael S. Tsirkin 72718cd05ab6SPeter Maydellrm -r "$TMPDIR1" 7272