17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 58cd05ab6SPeter Maydell 699519e67SCornelia Huck# Unset some variables known to interfere with behavior of common tools, 799519e67SCornelia Huck# just as autoconf does. 899519e67SCornelia HuckCLICOLOR_FORCE= GREP_OPTIONS= 999519e67SCornelia Huckunset CLICOLOR_FORCE GREP_OPTIONS 1099519e67SCornelia Huck 115e4dfd3dSJohn Snow# Don't allow CCACHE, if present, to use cached results of compile tests! 125e4dfd3dSJohn Snowexport CCACHE_RECACHE=yes 135e4dfd3dSJohn Snow 14dedad027SDaniel P. Berrangé# make source path absolute 15dedad027SDaniel P. Berrangésource_path=$(cd "$(dirname -- "$0")"; pwd) 16dedad027SDaniel P. Berrangé 17dedad027SDaniel P. Berrangéif test "$PWD" = "$source_path" 18dedad027SDaniel P. Berrangéthen 19dedad027SDaniel P. Berrangé echo "Using './build' as the directory for build output" 20dedad027SDaniel P. Berrangé 21dedad027SDaniel P. Berrangé MARKER=build/auto-created-by-configure 22dedad027SDaniel P. Berrangé 23dedad027SDaniel P. Berrangé if test -e build 24dedad027SDaniel P. Berrangé then 25dedad027SDaniel P. Berrangé if test -f $MARKER 26dedad027SDaniel P. Berrangé then 27dedad027SDaniel P. Berrangé rm -rf build 28dedad027SDaniel P. Berrangé else 29dedad027SDaniel P. Berrangé echo "ERROR: ./build dir already exists and was not previously created by configure" 30dedad027SDaniel P. Berrangé exit 1 31dedad027SDaniel P. Berrangé fi 32dedad027SDaniel P. Berrangé fi 33dedad027SDaniel P. Berrangé 34dedad027SDaniel P. Berrangé mkdir build 35dedad027SDaniel P. Berrangé touch $MARKER 36dedad027SDaniel P. Berrangé 37dedad027SDaniel P. Berrangé cat > GNUmakefile <<'EOF' 38dedad027SDaniel P. Berrangé# This file is auto-generated by configure to support in-source tree 39dedad027SDaniel P. Berrangé# 'make' command invocation 40dedad027SDaniel P. Berrangé 41dedad027SDaniel P. Berrangéifeq ($(MAKECMDGOALS),) 42dedad027SDaniel P. Berrangérecurse: all 43dedad027SDaniel P. Berrangéendif 44dedad027SDaniel P. Berrangé 45dedad027SDaniel P. Berrangé.NOTPARALLEL: % 46dedad027SDaniel P. Berrangé%: force 47dedad027SDaniel P. Berrangé @echo 'changing dir to build for $(MAKE) "$(MAKECMDGOALS)"...' 48dedad027SDaniel P. Berrangé @$(MAKE) -C build -f Makefile $(MAKECMDGOALS) 49dedad027SDaniel P. Berrangé @if test "$(MAKECMDGOALS)" = "distclean" && \ 50dedad027SDaniel P. Berrangé test -e build/auto-created-by-configure ; \ 51dedad027SDaniel P. Berrangé then \ 52dedad027SDaniel P. Berrangé rm -rf build GNUmakefile ; \ 53dedad027SDaniel P. Berrangé fi 54dedad027SDaniel P. Berrangéforce: ; 55dedad027SDaniel P. Berrangé.PHONY: force 56dedad027SDaniel P. BerrangéGNUmakefile: ; 57dedad027SDaniel P. Berrangé 58dedad027SDaniel P. BerrangéEOF 59dedad027SDaniel P. Berrangé cd build 60dedad027SDaniel P. Berrangé exec $source_path/configure "$@" 61dedad027SDaniel P. Berrangéfi 62dedad027SDaniel P. Berrangé 638cd05ab6SPeter Maydell# Temporary directory used for files created while 648cd05ab6SPeter Maydell# configure runs. Since it is in the build directory 658cd05ab6SPeter Maydell# we can safely blow away any previous version of it 668cd05ab6SPeter Maydell# (and we need not jump through hoops to try to delete 678cd05ab6SPeter Maydell# it when configure exits.) 688cd05ab6SPeter MaydellTMPDIR1="config-temp" 698cd05ab6SPeter Maydellrm -rf "${TMPDIR1}" 708cd05ab6SPeter Maydellmkdir -p "${TMPDIR1}" 718cd05ab6SPeter Maydellif [ $? -ne 0 ]; then 728cd05ab6SPeter Maydell echo "ERROR: failed to create temporary directory" 738cd05ab6SPeter Maydell exit 1 747d13299dSbellardfi 757d13299dSbellard 768cd05ab6SPeter MaydellTMPB="qemu-conf" 778cd05ab6SPeter MaydellTMPC="${TMPDIR1}/${TMPB}.c" 7866518bf6SDon SlutzTMPO="${TMPDIR1}/${TMPB}.o" 799c83ffd8SPeter MaydellTMPCXX="${TMPDIR1}/${TMPB}.cxx" 808cd05ab6SPeter MaydellTMPE="${TMPDIR1}/${TMPB}.exe" 816969ec6cSJames ClarkeTMPMO="${TMPDIR1}/${TMPB}.mo" 8226fffe29SEmilio G. CotaTMPTXT="${TMPDIR1}/${TMPB}.txt" 837d13299dSbellard 84da1d85e3SGerd Hoffmannrm -f config.log 859ac81bbbSmalc 86b48e3611SPeter Maydell# Print a helpful header at the top of config.log 87b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 88979ae168SPeter Maydellprintf "# Configured with:" >> config.log 89979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 90979ae168SPeter Maydellecho >> config.log 91b48e3611SPeter Maydellecho "#" >> config.log 92b48e3611SPeter Maydell 93d880a3baSPaolo Bonziniprint_error() { 94d880a3baSPaolo Bonzini (echo 9576ad07a4SPeter Maydell echo "ERROR: $1" 9676ad07a4SPeter Maydell while test -n "$2"; do 9776ad07a4SPeter Maydell echo " $2" 9876ad07a4SPeter Maydell shift 9976ad07a4SPeter Maydell done 100d880a3baSPaolo Bonzini echo) >&2 101d880a3baSPaolo Bonzini} 102d880a3baSPaolo Bonzini 103d880a3baSPaolo Bonzinierror_exit() { 104d880a3baSPaolo Bonzini print_error "$@" 10576ad07a4SPeter Maydell exit 1 10676ad07a4SPeter Maydell} 10776ad07a4SPeter Maydell 1089c83ffd8SPeter Maydelldo_compiler() { 1099c83ffd8SPeter Maydell # Run the compiler, capturing its output to the log. First argument 1109c83ffd8SPeter Maydell # is compiler binary to execute. 1119c83ffd8SPeter Maydell local compiler="$1" 1129c83ffd8SPeter Maydell shift 1138bbe05d7SIan Jackson if test -n "$BASH_VERSION"; then eval ' 1148bbe05d7SIan Jackson echo >>config.log " 1158bbe05d7SIan Jacksonfuncs: ${FUNCNAME[*]} 1168bbe05d7SIan Jacksonlines: ${BASH_LINENO[*]}" 1178bbe05d7SIan Jackson '; fi 1189c83ffd8SPeter Maydell echo $compiler "$@" >> config.log 1199c83ffd8SPeter Maydell $compiler "$@" >> config.log 2>&1 || return $? 1208dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 1218dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 1228dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 1238dc38a78SPeter Maydell # obvious to developers. 1248dc38a78SPeter Maydell if test "$werror" != "yes"; then 1258dc38a78SPeter Maydell return 0 1268dc38a78SPeter Maydell fi 1278dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 1288dc38a78SPeter Maydell case "$*" in 1298dc38a78SPeter Maydell *-Werror*) 1308dc38a78SPeter Maydell return 0 1318dc38a78SPeter Maydell ;; 1328dc38a78SPeter Maydell esac 1339c83ffd8SPeter Maydell echo $compiler -Werror "$@" >> config.log 1349c83ffd8SPeter Maydell $compiler -Werror "$@" >> config.log 2>&1 && return $? 13576ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 13676ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 13776ad07a4SPeter Maydell "will be at the bottom of config.log." \ 13876ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 1398dc38a78SPeter Maydell} 1408dc38a78SPeter Maydell 1419c83ffd8SPeter Maydelldo_cc() { 1429c83ffd8SPeter Maydell do_compiler "$cc" "$@" 1439c83ffd8SPeter Maydell} 1449c83ffd8SPeter Maydell 1459c83ffd8SPeter Maydelldo_cxx() { 1469c83ffd8SPeter Maydell do_compiler "$cxx" "$@" 1479c83ffd8SPeter Maydell} 1489c83ffd8SPeter Maydell 14900849b92SRichard Henderson# Append $2 to the variable named $1, with space separation 15000849b92SRichard Hendersonadd_to() { 15100849b92SRichard Henderson eval $1=\${$1:+\"\$$1 \"}\$2 15200849b92SRichard Henderson} 15300849b92SRichard Henderson 1549c83ffd8SPeter Maydellupdate_cxxflags() { 1559c83ffd8SPeter Maydell # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 1569c83ffd8SPeter Maydell # options which some versions of GCC's C++ compiler complain about 1579c83ffd8SPeter Maydell # because they only make sense for C programs. 15853422040SPaolo Bonzini QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" 159086d5f75SPaolo Bonzini CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/) 1609c83ffd8SPeter Maydell for arg in $QEMU_CFLAGS; do 1619c83ffd8SPeter Maydell case $arg in 1629c83ffd8SPeter Maydell -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 1639c83ffd8SPeter Maydell -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 1649c83ffd8SPeter Maydell ;; 1659c83ffd8SPeter Maydell *) 1669c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1679c83ffd8SPeter Maydell ;; 1689c83ffd8SPeter Maydell esac 1699c83ffd8SPeter Maydell done 1709c83ffd8SPeter Maydell} 1719c83ffd8SPeter Maydell 17252166aa0SJuan Quintelacompile_object() { 173fd0e6053SJohn Snow local_cflags="$1" 174086d5f75SPaolo Bonzini do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 17552166aa0SJuan Quintela} 17652166aa0SJuan Quintela 17752166aa0SJuan Quintelacompile_prog() { 17852166aa0SJuan Quintela local_cflags="$1" 17952166aa0SJuan Quintela local_ldflags="$2" 180086d5f75SPaolo Bonzini do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $QEMU_LDFLAGS $local_ldflags 18152166aa0SJuan Quintela} 18252166aa0SJuan Quintela 18311568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 18411568d6dSPaolo Bonzinisymlink() { 18572b8b5a1SStefan Weil rm -rf "$2" 186ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 18772b8b5a1SStefan Weil ln -s "$1" "$2" 18811568d6dSPaolo Bonzini} 18911568d6dSPaolo Bonzini 1900dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1910dba6195SLoïc Minier# executable or a builtin) 1920dba6195SLoïc Minierhas() { 1930dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1940dba6195SLoïc Minier} 1950dba6195SLoïc Minier 1960dba6195SLoïc Minier# search for an executable in PATH 1970dba6195SLoïc Minierpath_of() { 1980dba6195SLoïc Minier local_command="$1" 1990dba6195SLoïc Minier local_ifs="$IFS" 2000dba6195SLoïc Minier local_dir="" 2010dba6195SLoïc Minier 2020dba6195SLoïc Minier # pathname has a dir component? 2030dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 2040dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 2050dba6195SLoïc Minier echo "$local_command" 2060dba6195SLoïc Minier return 0 2070dba6195SLoïc Minier fi 2080dba6195SLoïc Minier fi 2090dba6195SLoïc Minier if [ -z "$local_command" ]; then 2100dba6195SLoïc Minier return 1 2110dba6195SLoïc Minier fi 2120dba6195SLoïc Minier 2130dba6195SLoïc Minier IFS=: 2140dba6195SLoïc Minier for local_dir in $PATH; do 2150dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 2160dba6195SLoïc Minier echo "$local_dir/$local_command" 2170dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 2180dba6195SLoïc Minier return 0 2190dba6195SLoïc Minier fi 2200dba6195SLoïc Minier done 2210dba6195SLoïc Minier # not found 2220dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 2230dba6195SLoïc Minier return 1 2240dba6195SLoïc Minier} 2250dba6195SLoïc Minier 2260a01d76fSMarc-André Lureauversion_ge () { 2270a01d76fSMarc-André Lureau local_ver1=`echo $1 | tr . ' '` 2280a01d76fSMarc-André Lureau local_ver2=`echo $2 | tr . ' '` 2290a01d76fSMarc-André Lureau while true; do 2300a01d76fSMarc-André Lureau set x $local_ver1 2310a01d76fSMarc-André Lureau local_first=${2-0} 2320a01d76fSMarc-André Lureau # shift 2 does nothing if there are less than 2 arguments 2330a01d76fSMarc-André Lureau shift; shift 2340a01d76fSMarc-André Lureau local_ver1=$* 2350a01d76fSMarc-André Lureau set x $local_ver2 2360a01d76fSMarc-André Lureau # the second argument finished, the first must be greater or equal 2370a01d76fSMarc-André Lureau test $# = 1 && return 0 2380a01d76fSMarc-André Lureau test $local_first -lt $2 && return 1 2390a01d76fSMarc-André Lureau test $local_first -gt $2 && return 0 2400a01d76fSMarc-André Lureau shift; shift 2410a01d76fSMarc-André Lureau local_ver2=$* 2420a01d76fSMarc-André Lureau done 2430a01d76fSMarc-André Lureau} 2440a01d76fSMarc-André Lureau 2455b808275SLluís Vilanovahave_backend () { 2465b808275SLluís Vilanova echo "$trace_backends" | grep "$1" >/dev/null 2475b808275SLluís Vilanova} 2485b808275SLluís Vilanova 2493b6b7550SPaolo Bonziniglob() { 2503b6b7550SPaolo Bonzini eval test -z '"${1#'"$2"'}"' 2513b6b7550SPaolo Bonzini} 2523b6b7550SPaolo Bonzini 2533b6b7550SPaolo Bonzinisupported_hax_target() { 2543b6b7550SPaolo Bonzini test "$hax" = "yes" || return 1 2553b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 2563b6b7550SPaolo Bonzini case "${1%-softmmu}" in 2573b6b7550SPaolo Bonzini i386|x86_64) 2583b6b7550SPaolo Bonzini return 0 2593b6b7550SPaolo Bonzini ;; 2603b6b7550SPaolo Bonzini esac 2613b6b7550SPaolo Bonzini return 1 2623b6b7550SPaolo Bonzini} 2633b6b7550SPaolo Bonzini 2643b6b7550SPaolo Bonzinisupported_kvm_target() { 2653b6b7550SPaolo Bonzini test "$kvm" = "yes" || return 1 2663b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 2673b6b7550SPaolo Bonzini case "${1%-softmmu}:$cpu" in 2683b6b7550SPaolo Bonzini arm:arm | aarch64:aarch64 | \ 2693b6b7550SPaolo Bonzini i386:i386 | i386:x86_64 | i386:x32 | \ 2703b6b7550SPaolo Bonzini x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ 271aa2953fdSHuacai Chen mips:mips | mipsel:mips | mips64:mips | mips64el:mips | \ 272f8378accSRichard Henderson ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \ 2733b6b7550SPaolo Bonzini s390x:s390x) 2743b6b7550SPaolo Bonzini return 0 2753b6b7550SPaolo Bonzini ;; 2763b6b7550SPaolo Bonzini esac 2773b6b7550SPaolo Bonzini return 1 2783b6b7550SPaolo Bonzini} 2793b6b7550SPaolo Bonzini 2803b6b7550SPaolo Bonzinisupported_xen_target() { 2813b6b7550SPaolo Bonzini test "$xen" = "yes" || return 1 2823b6b7550SPaolo Bonzini glob "$1" "*-softmmu" || return 1 283b5ed2e11SPaolo Bonzini # Only i386 and x86_64 provide the xenpv machine. 284b5ed2e11SPaolo Bonzini case "${1%-softmmu}" in 285b5ed2e11SPaolo Bonzini i386|x86_64) 2863b6b7550SPaolo Bonzini return 0 2873b6b7550SPaolo Bonzini ;; 2883b6b7550SPaolo Bonzini esac 2893b6b7550SPaolo Bonzini return 1 2903b6b7550SPaolo Bonzini} 2913b6b7550SPaolo Bonzini 292c97d6d2cSSergio Andres Gomez Del Realsupported_hvf_target() { 293c97d6d2cSSergio Andres Gomez Del Real test "$hvf" = "yes" || return 1 294c97d6d2cSSergio Andres Gomez Del Real glob "$1" "*-softmmu" || return 1 295c97d6d2cSSergio Andres Gomez Del Real case "${1%-softmmu}" in 296c97d6d2cSSergio Andres Gomez Del Real x86_64) 297c97d6d2cSSergio Andres Gomez Del Real return 0 298c97d6d2cSSergio Andres Gomez Del Real ;; 299c97d6d2cSSergio Andres Gomez Del Real esac 300c97d6d2cSSergio Andres Gomez Del Real return 1 301c97d6d2cSSergio Andres Gomez Del Real} 302c97d6d2cSSergio Andres Gomez Del Real 303d661d9a4SJustin Terry (VM)supported_whpx_target() { 304d661d9a4SJustin Terry (VM) test "$whpx" = "yes" || return 1 305d661d9a4SJustin Terry (VM) glob "$1" "*-softmmu" || return 1 306d661d9a4SJustin Terry (VM) case "${1%-softmmu}" in 307d661d9a4SJustin Terry (VM) i386|x86_64) 308d661d9a4SJustin Terry (VM) return 0 309d661d9a4SJustin Terry (VM) ;; 310d661d9a4SJustin Terry (VM) esac 311d661d9a4SJustin Terry (VM) return 1 312d661d9a4SJustin Terry (VM)} 313d661d9a4SJustin Terry (VM) 314d880a3baSPaolo Bonzinisupported_target() { 315d880a3baSPaolo Bonzini case "$1" in 316d880a3baSPaolo Bonzini *-softmmu) 317d880a3baSPaolo Bonzini ;; 318d880a3baSPaolo Bonzini *-linux-user) 319d880a3baSPaolo Bonzini if test "$linux" != "yes"; then 320d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a Linux host" 321d880a3baSPaolo Bonzini return 1 322d880a3baSPaolo Bonzini fi 323d880a3baSPaolo Bonzini ;; 324d880a3baSPaolo Bonzini *-bsd-user) 325d880a3baSPaolo Bonzini if test "$bsd" != "yes"; then 326d880a3baSPaolo Bonzini print_error "Target '$target' is only available on a BSD host" 327d880a3baSPaolo Bonzini return 1 328d880a3baSPaolo Bonzini fi 329d880a3baSPaolo Bonzini ;; 330d880a3baSPaolo Bonzini *) 331d880a3baSPaolo Bonzini print_error "Invalid target name '$target'" 332d880a3baSPaolo Bonzini return 1 333d880a3baSPaolo Bonzini ;; 334d880a3baSPaolo Bonzini esac 335b3f6ea7eSPaolo Bonzini test "$tcg" = "yes" && return 0 336b3f6ea7eSPaolo Bonzini supported_kvm_target "$1" && return 0 337b3f6ea7eSPaolo Bonzini supported_xen_target "$1" && return 0 338b3f6ea7eSPaolo Bonzini supported_hax_target "$1" && return 0 339c97d6d2cSSergio Andres Gomez Del Real supported_hvf_target "$1" && return 0 340d661d9a4SJustin Terry (VM) supported_whpx_target "$1" && return 0 341b3f6ea7eSPaolo Bonzini print_error "TCG disabled, but hardware accelerator not available for '$target'" 342b3f6ea7eSPaolo Bonzini return 1 343d880a3baSPaolo Bonzini} 344d880a3baSPaolo Bonzini 345e9a3591fSChristian Borntraeger 346e9a3591fSChristian Borntraegerld_has() { 347e9a3591fSChristian Borntraeger $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1 348e9a3591fSChristian Borntraeger} 349e9a3591fSChristian Borntraeger 3504ace32e2SAntonio Ospiteif printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; 3514ace32e2SAntonio Ospitethen 3524ace32e2SAntonio Ospite error_exit "main directory cannot contain spaces nor colons" 3534ace32e2SAntonio Ospitefi 3544ace32e2SAntonio Ospite 35514211825SAntonio Ospite# default parameters 3562ff6b91eSJuan Quintelacpu="" 357a31a8642SMichael S. Tsirkiniasl="iasl" 3581e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 35943ce4dfeSbellardstatic="no" 3607d13299dSbellardcross_prefix="" 3610c58ac1cSmalcaudio_drv_list="" 362b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 363b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 364e49d021eSPeter Maydellhost_cc="cc" 36502f9135bSDaniel P. Berrangélibs_cpu="" 36673da375eSJuan Quintelalibs_softmmu="" 3673e2e0e6bSJuan Quintelalibs_tools="" 368d5631638Smalcaudio_win_int="" 369957f1f99SMichael Rothlibs_qga="" 3705bc62e01SGerd Hoffmanndebug_info="yes" 37163678e17SSteven Noonanstack_protector="" 3721e4f6065SDaniele Buonosafe_stack="" 373afc3a8f9SAlex Bennéeuse_containers="yes" 374f2385398SAlex Bennéegdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") 375ac0df51dSaliguori 37692712822SDaniel P. Berrangeif test -e "$source_path/.git" 37792712822SDaniel P. Berrangethen 378f62bbee5SDaniel P. Berrange git_update=yes 37992712822SDaniel P. Berrange git_submodules="ui/keycodemapdb" 3803ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" 3813ac1f813SEmilio G. Cota git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" 38292712822SDaniel P. Berrangeelse 383f62bbee5SDaniel P. Berrange git_update=no 384aef45d51SDaniel P. Berrange git_submodules="" 3855c0ef67aSDaniel P. Berrangé 3865c0ef67aSDaniel P. Berrangé if ! test -f "$source_path/ui/keycodemapdb/README" 3875c0ef67aSDaniel P. Berrangé then 3885c0ef67aSDaniel P. Berrangé echo 3895c0ef67aSDaniel P. Berrangé echo "ERROR: missing file $source_path/ui/keycodemapdb/README" 3905c0ef67aSDaniel P. Berrangé echo 3915c0ef67aSDaniel P. Berrangé echo "This is not a GIT checkout but module content appears to" 3925c0ef67aSDaniel P. Berrangé echo "be missing. Do not use 'git archive' or GitHub download links" 3935c0ef67aSDaniel P. Berrangé echo "to acquire QEMU source archives. Non-GIT builds are only" 3945c0ef67aSDaniel P. Berrangé echo "supported with source archives linked from:" 3955c0ef67aSDaniel P. Berrangé echo 396a3e3b521SPeter Maydell echo " https://www.qemu.org/download/#source" 3975c0ef67aSDaniel P. Berrangé echo 3985c0ef67aSDaniel P. Berrangé echo "Developers working with GIT can use scripts/archive-source.sh" 3995c0ef67aSDaniel P. Berrangé echo "if they need to create valid source archives." 4005c0ef67aSDaniel P. Berrangé echo 4015c0ef67aSDaniel P. Berrangé exit 1 4025c0ef67aSDaniel P. Berrangé fi 40392712822SDaniel P. Berrangefi 404cc84d63aSDaniel P. Berrangegit="git" 405ac0df51dSaliguori 406afb63ebdSStefan Weil# Don't accept a target_list environment variable. 407afb63ebdSStefan Weilunset target_list 408447e133fSAlex Bennéeunset target_list_exclude 409377529c0SPaolo Bonzini 410377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 411377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 412377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 413377529c0SPaolo Bonzini# unless --disable-foo is given 414377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 415377529c0SPaolo Bonzini# feature will searched for, 416377529c0SPaolo Bonzini# if not found, configure exits with error 417377529c0SPaolo Bonzini# 418377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 419377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 420377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 421377529c0SPaolo Bonzini 422377529c0SPaolo Bonzinibrlapi="" 423377529c0SPaolo Bonzinicurl="" 424377529c0SPaolo Bonzinicurses="" 425377529c0SPaolo Bonzinidocs="" 426377529c0SPaolo Bonzinifdt="" 42758952137SVincenzo Maffionenetmap="no" 428377529c0SPaolo Bonzinisdl="" 429a442fe2fSDaniel P. Berrangésdl_image="" 430983eef5aSMeador Ingevirtfs="" 431fe8fc5aeSPaolo Bonzinimpath="" 432821601eaSJes Sorensenvnc="yes" 433377529c0SPaolo Bonzinisparse="no" 434377529c0SPaolo Bonzinivde="" 435377529c0SPaolo Bonzinivnc_sasl="" 436377529c0SPaolo Bonzinivnc_jpeg="" 437377529c0SPaolo Bonzinivnc_png="" 4386a021536SGerd Hoffmannxkbcommon="" 439377529c0SPaolo Bonzinixen="" 440d5b93ddfSAnthony PERARDxen_ctrl_version="" 441eb6fda0fSAnthony PERARDxen_pci_passthrough="" 442377529c0SPaolo Bonzinilinux_aio="" 443c10dd856SAarushi Mehtalinux_io_uring="" 44447e98658SCorey Bryantcap_ng="" 445377529c0SPaolo Bonziniattr="" 4464f26f2b6SAvi Kivitylibattr="" 447377529c0SPaolo Bonzinixfs="" 448b3f6ea7eSPaolo Bonzinitcg="yes" 449a40161cbSPaolo Bonzinimembarrier="" 450299e6f19SPaolo Bonzinivhost_net="" 451299e6f19SPaolo Bonzinivhost_crypto="" 452299e6f19SPaolo Bonzinivhost_scsi="" 453299e6f19SPaolo Bonzinivhost_vsock="" 454e6a74868SMarc-André Lureauvhost_user="" 45598fc1adaSDr. David Alan Gilbertvhost_user_fs="" 456d41a75a2SBradkvm="no" 457b0cb0a66SVincent Palatinhax="no" 458c97d6d2cSSergio Andres Gomez Del Realhvf="no" 459d661d9a4SJustin Terry (VM)whpx="no" 4602da776dbSMichael R. Hinesrdma="" 46121ab34c9SMarcel Apfelbaumpvrdma="" 462377529c0SPaolo Bonzinigprof="no" 463377529c0SPaolo Bonzinidebug_tcg="no" 464377529c0SPaolo Bonzinidebug="no" 465247724cbSMarc-André Lureausanitizers="no" 4660aebab04SLingfeng Yangtsan="no" 467b553a042SJohn Snowfortify_source="" 468377529c0SPaolo Bonzinistrip_opt="yes" 4699195b2c2SStefan Weiltcg_interpreter="no" 470377529c0SPaolo Bonzinibigendian="no" 471377529c0SPaolo Bonzinimingw32="no" 4721d728c39SBlue Swirlgcov="no" 473377529c0SPaolo BonziniEXESUF="" 47417969268SFam ZhengDSOSUF=".so" 47517969268SFam ZhengLDFLAGS_SHARED="-shared" 47617969268SFam Zhengmodules="no" 477bd83c861SChristian Ehrhardtmodule_upgrades="no" 478377529c0SPaolo Bonziniprefix="/usr/local" 4793d5eecabSGerd Hoffmannfirmwarepath="\${prefix}/share/qemu-firmware" 480377529c0SPaolo Bonziniconfsuffix="/qemu" 481675b9b53SMarc-André Lureauslirp="" 482377529c0SPaolo Bonzinioss_lib="" 483377529c0SPaolo Bonzinibsd="no" 484377529c0SPaolo Bonzinilinux="no" 485377529c0SPaolo Bonzinisolaris="no" 486377529c0SPaolo Bonziniprofiler="no" 487377529c0SPaolo Bonzinicocoa="no" 488377529c0SPaolo Bonzinisoftmmu="yes" 489377529c0SPaolo Bonzinilinux_user="no" 490377529c0SPaolo Bonzinibsd_user="no" 491377529c0SPaolo Bonziniblobs="yes" 49205dfa22bSPhilippe Mathieu-Daudéedk2_blobs="no" 493377529c0SPaolo Bonzinipkgversion="" 49440d6444eSAvi Kivitypie="" 4953556c233SPaolo Bonziniqom_cast_debug="yes" 496baf86d6bSPaolo Bonzinitrace_backends="log" 497377529c0SPaolo Bonzinitrace_file="trace" 498377529c0SPaolo Bonzinispice="" 499377529c0SPaolo Bonzinirbd="" 5007b02f544SMarc-André Lureausmartcard="" 5012b2325ffSGerd Hoffmannlibusb="" 50269354a83SHans de Goedeusb_redir="" 503da076ffeSGerd Hoffmannopengl="" 504014cb152SGerd Hoffmannopengl_dmabuf="no" 5055dd89908SRichard Hendersoncpuid_h="no" 50686583a07SLiam Merwickavx2_opt="" 5071ece9905SAlon Levyzlib="yes" 5088ca80760SRichard Hendersoncapstone="" 509b25c9dffSStefan Weillzo="" 510b25c9dffSStefan Weilsnappy="" 5116b383c08SPeter Wubzip2="" 51283bc1f97SJulio Faraccolzfse="" 5133a678481SJuan Quintelazstd="" 514e8ef31a3SMichael Tokarevguest_agent="" 515d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 51650cbebb9SMichael Rothguest_agent_ntddscsi="no" 5179dacf32dSYossi Hindinguest_agent_msi="" 518d9840e25STomoki Sekiyamavss_win32_sdk="" 519d9840e25STomoki Sekiyamawin_sdk="no" 520e10ee3f5SPhilippe Mathieu-Daudéwant_tools="" 521c589b249SRonnie Sahlberglibiscsi="" 5226542aa9cSPeter Lievenlibnfs="" 523519175a2SAlex Barcelocoroutine="" 52470c60c08SStefan Hajnoczicoroutine_pool="" 5257d992e4dSPeter Lievendebug_stack_usage="no" 526f0d92b56SLongpeng(Mike)crypto_afalg="no" 527f794573eSEduardo Otuboseccomp="" 528eb100396SBharata B Raoglusterfs="" 529d85fa9ebSJeff Codyglusterfs_xlator_opt="no" 5300c14fb47SBharata B Raoglusterfs_discard="no" 531df3a429aSNiels de Vosglusterfs_fallocate="no" 5327c815372SBharata B Raoglusterfs_zerofill="no" 533e014dbe7SPrasanna Kumar Kaleverglusterfs_ftruncate_has_stat="no" 5340e3b891fSNiels de Vosglusterfs_iocb_has_stat="no" 535a4ccabcfSAnthony Liguorigtk="" 536925a0400SGerd Hoffmanngtk_gl="no" 537a1c5e949SDaniel P. Berrangetls_priority="NORMAL" 538ddbb0d09SDaniel P. Berrangegnutls="" 53991bfcdb0SDaniel P. Berrangenettle="" 540dc2207afSDaniel P. Berrangénettle_xts="no" 54191bfcdb0SDaniel P. Berrangegcrypt="" 5421f923c70SLongpeng(Mike)gcrypt_hmac="no" 543e0576942SDaniel P. Berrangégcrypt_xts="no" 544e0576942SDaniel P. Berrangéqemu_private_xts="yes" 5458953caf3SDaniel P. Berrangeauth_pam="" 546bbbf9bfbSStefan Weilvte="" 5479d9e1521SGerd Hoffmannvirglrenderer="" 5487aaa6a16SPaolo Bonzinitpm="" 549b10d49d7SPino Toscanolibssh="" 550ed1701c6SDr. David Alan Gilbertlive_block_migration="yes" 551a99d57bbSWanlong Gaonuma="" 5522847b469SFam Zhengtcmalloc="no" 5537b01cb97SAlexandre Derumierjemalloc="no" 554a6b1d4c0SChanglong Xiereplication="yes" 5552f740136SJeff Codybochs="yes" 5562f740136SJeff Codycloop="yes" 5572f740136SJeff Codydmg="yes" 5582f740136SJeff Codyqcow1="yes" 5592f740136SJeff Codyvdi="yes" 5602f740136SJeff Codyvvfat="yes" 5612f740136SJeff Codyqed="yes" 5622f740136SJeff Codyparallels="yes" 5632f740136SJeff Codysheepdog="yes" 564ed279a06SKlim Kireevlibxml2="" 565ba59fb77SPaolo Bonzinidebug_mutex="no" 56617824406SJunyan Helibpmem="" 567f3494749SPaolo Bonzinidefault_devices="yes" 56840e8c6f4SAlex Bennéeplugins="no" 569adc28027SAlexander Bulekovfuzzing="no" 570b767d257SMarek Marczykowski-Góreckirng_none="no" 57154e7aac0SAlexey Krasikovsecret_keyring="" 57221b2eca6SJingqi Liulibdaxctl="" 573a5665051SPaolo Bonzinimeson="" 574a5665051SPaolo Bonziniskip_meson=no 575377529c0SPaolo Bonzini 576fb59dabdSPeter Maydellbogus_os="no" 5775a22ab71SYang Zhongmalloc_trim="" 578898be3e0SPeter Maydell 579ac0df51dSaliguori# parse CC options first 580ac0df51dSaliguorifor opt do 58189138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 582ac0df51dSaliguori case "$opt" in 583ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 584ac0df51dSaliguori ;; 5853d8df640SPaolo Bonzini --cc=*) CC="$optarg" 586ac0df51dSaliguori ;; 58783f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 58883f73fceSTomoki Sekiyama ;; 5892ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 5902ff6b91eSJuan Quintela ;; 591de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 592db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 593e2a2ed06SJuan Quintela ;; 59411cde1c8SBruno Dominguez --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" 59511cde1c8SBruno Dominguez ;; 596db5adeaaSPaolo Bonzini --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg" 597f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 598e2a2ed06SJuan Quintela ;; 5995bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 6005bc62e01SGerd Hoffmann ;; 6015bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 6025bc62e01SGerd Hoffmann ;; 603d75402b5SAlex Bennée --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" 604d75402b5SAlex Bennée ;; 605d422b2bcSAlex Bennée --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} 606d422b2bcSAlex Bennée eval "cross_cc_cflags_${cc_arch}=\$optarg" 6072038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" 608d422b2bcSAlex Bennée ;; 609d75402b5SAlex Bennée --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} 6102038f8c8SPaolo Bonzini cc_archs="$cc_archs $cc_arch" 611d75402b5SAlex Bennée eval "cross_cc_${cc_arch}=\$optarg" 6122038f8c8SPaolo Bonzini cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}" 613d75402b5SAlex Bennée ;; 614ac0df51dSaliguori esac 615ac0df51dSaliguoridone 616ac0df51dSaliguori# OS specific 617ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 61893148aa5SStefan Weil# we can eliminate its usage altogether. 619ac0df51dSaliguori 620e49d021eSPeter Maydell# Preferred compiler: 621e49d021eSPeter Maydell# ${CC} (if set) 622e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 623e49d021eSPeter Maydell# system compiler 624e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 625e49d021eSPeter Maydell cc="$host_cc" 626e49d021eSPeter Maydellelse 627b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 628e49d021eSPeter Maydellfi 629e49d021eSPeter Maydell 63083f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 63183f73fceSTomoki Sekiyama cxx="c++" 63283f73fceSTomoki Sekiyamaelse 63383f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 63483f73fceSTomoki Sekiyamafi 63583f73fceSTomoki Sekiyama 636b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 637cdbd727cSRichard Hendersonas="${AS-${cross_prefix}as}" 6385f6f0e27SRichard Hendersonccas="${CCAS-$cc}" 6393dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 640b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 641b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 6429f81aeb5SAlistair Francisranlib="${RANLIB-${cross_prefix}ranlib}" 6434852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 644b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 645b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 64617884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 64717884d7bSSergei Trofimovichquery_pkg_config() { 64817884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 64917884d7bSSergei Trofimovich} 65017884d7bSSergei Trofimovichpkg_config=query_pkg_config 65147c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 652ac0df51dSaliguori 65345d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 65445d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 65545d285abSPeter Maydell 656be17dc90SMichael S. Tsirkin# default flags for all hosts 6572d31515bSPeter Maydell# We use -fwrapv to tell the compiler that we require a C dialect where 6582d31515bSPeter Maydell# left shift of signed integers is well defined and has the expected 6592d31515bSPeter Maydell# 2s-complement style results. (Both clang and gcc agree that it 6602d31515bSPeter Maydell# provides these semantics.) 661086d5f75SPaolo BonziniQEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS" 662086d5f75SPaolo BonziniQEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 663c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 664be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 66525211446SPaolo BonziniQEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include" 66625211446SPaolo BonziniQEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl" 667086d5f75SPaolo BonziniCFLAGS="-std=gnu99 -Wall" 668086d5f75SPaolo Bonzini 669be17dc90SMichael S. Tsirkin 670cab00a5aSMichael S. Tsirkin# running configure in the source tree? 671cab00a5aSMichael S. Tsirkin# we know that's the case if configure is there. 672cab00a5aSMichael S. Tsirkinif test -f "./configure"; then 673cab00a5aSMichael S. Tsirkin pwd_is_source_path="y" 674cab00a5aSMichael S. Tsirkinelse 675cab00a5aSMichael S. Tsirkin pwd_is_source_path="n" 676cab00a5aSMichael S. Tsirkinfi 677cab00a5aSMichael S. Tsirkin 678ac0df51dSaliguoricheck_define() { 679ac0df51dSaliguoricat > $TMPC <<EOF 680ac0df51dSaliguori#if !defined($1) 681fd786e1aSPeter Maydell#error $1 not defined 682ac0df51dSaliguori#endif 683ac0df51dSaliguoriint main(void) { return 0; } 684ac0df51dSaliguoriEOF 68552166aa0SJuan Quintela compile_object 686ac0df51dSaliguori} 687ac0df51dSaliguori 688307119e7SGerd Hoffmanncheck_include() { 689307119e7SGerd Hoffmanncat > $TMPC <<EOF 690307119e7SGerd Hoffmann#include <$1> 691307119e7SGerd Hoffmannint main(void) { return 0; } 692307119e7SGerd HoffmannEOF 693307119e7SGerd Hoffmann compile_object 694307119e7SGerd Hoffmann} 695307119e7SGerd Hoffmann 69693b25869SJohn Snowwrite_c_skeleton() { 69793b25869SJohn Snow cat > $TMPC <<EOF 69893b25869SJohn Snowint main(void) { return 0; } 69993b25869SJohn SnowEOF 70093b25869SJohn Snow} 70193b25869SJohn Snow 702adc28027SAlexander Bulekovwrite_c_fuzzer_skeleton() { 703adc28027SAlexander Bulekov cat > $TMPC <<EOF 704adc28027SAlexander Bulekov#include <stdint.h> 705adc28027SAlexander Bulekov#include <sys/types.h> 706adc28027SAlexander Bulekovint LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); 707adc28027SAlexander Bulekovint LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } 708adc28027SAlexander BulekovEOF 709adc28027SAlexander Bulekov} 710adc28027SAlexander Bulekov 711bbea4050SPeter Maydellif check_define __linux__ ; then 712bbea4050SPeter Maydell targetos="Linux" 713bbea4050SPeter Maydellelif check_define _WIN32 ; then 714bbea4050SPeter Maydell targetos='MINGW32' 715bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 716bbea4050SPeter Maydell targetos='OpenBSD' 717bbea4050SPeter Maydellelif check_define __sun__ ; then 718bbea4050SPeter Maydell targetos='SunOS' 719bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 720bbea4050SPeter Maydell targetos='Haiku' 721951fedfcSPeter Maydellelif check_define __FreeBSD__ ; then 722951fedfcSPeter Maydell targetos='FreeBSD' 723951fedfcSPeter Maydellelif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then 724951fedfcSPeter Maydell targetos='GNU/kFreeBSD' 725951fedfcSPeter Maydellelif check_define __DragonFly__ ; then 726951fedfcSPeter Maydell targetos='DragonFly' 727951fedfcSPeter Maydellelif check_define __NetBSD__; then 728951fedfcSPeter Maydell targetos='NetBSD' 729951fedfcSPeter Maydellelif check_define __APPLE__; then 730951fedfcSPeter Maydell targetos='Darwin' 731bbea4050SPeter Maydellelse 732951fedfcSPeter Maydell # This is a fatal error, but don't report it yet, because we 733951fedfcSPeter Maydell # might be going to just print the --help text, or it might 734951fedfcSPeter Maydell # be the result of a missing compiler. 735951fedfcSPeter Maydell targetos='bogus' 736951fedfcSPeter Maydell bogus_os='yes' 737bbea4050SPeter Maydellfi 738bbea4050SPeter Maydell 739bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 740bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 741bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 742bbea4050SPeter Maydell# the correct CPU with the --cpu option. 743bbea4050SPeter Maydellcase $targetos in 744bbea4050SPeter MaydellDarwin) 745bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 746bbea4050SPeter Maydell # run 64-bit userspace code. 747bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 748bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 749bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 750bbea4050SPeter Maydell cpu="x86_64" 751bbea4050SPeter Maydell fi 752bbea4050SPeter Maydell ;; 753bbea4050SPeter MaydellSunOS) 75489138857SStefan Weil # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo 755bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 756bbea4050SPeter Maydell cpu="x86_64" 757bbea4050SPeter Maydell fi 758bbea4050SPeter Maydellesac 759bbea4050SPeter Maydell 7602ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 7612ff6b91eSJuan Quintela # command line argument 7622ff6b91eSJuan Quintela : 7632ff6b91eSJuan Quintelaelif check_define __i386__ ; then 764ac0df51dSaliguori cpu="i386" 765ac0df51dSaliguorielif check_define __x86_64__ ; then 766c72b26ecSRichard Henderson if check_define __ILP32__ ; then 767c72b26ecSRichard Henderson cpu="x32" 768c72b26ecSRichard Henderson else 769ac0df51dSaliguori cpu="x86_64" 770c72b26ecSRichard Henderson fi 7713aa9bd6cSblueswir1elif check_define __sparc__ ; then 7723aa9bd6cSblueswir1 if check_define __arch64__ ; then 7733aa9bd6cSblueswir1 cpu="sparc64" 7743aa9bd6cSblueswir1 else 7753aa9bd6cSblueswir1 cpu="sparc" 7763aa9bd6cSblueswir1 fi 777fdf7ed96Smalcelif check_define _ARCH_PPC ; then 778fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 779f8378accSRichard Henderson if check_define _LITTLE_ENDIAN ; then 780f8378accSRichard Henderson cpu="ppc64le" 781f8378accSRichard Henderson else 782fdf7ed96Smalc cpu="ppc64" 783f8378accSRichard Henderson fi 784ac0df51dSaliguori else 785fdf7ed96Smalc cpu="ppc" 786fdf7ed96Smalc fi 787afa05235SAurelien Jarnoelif check_define __mips__ ; then 788afa05235SAurelien Jarno cpu="mips" 789d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 790d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 791d66ed0eaSAurelien Jarno cpu="s390x" 792d66ed0eaSAurelien Jarno else 793d66ed0eaSAurelien Jarno cpu="s390" 794d66ed0eaSAurelien Jarno fi 795c4f80543SAlistair Franciselif check_define __riscv ; then 796c4f80543SAlistair Francis if check_define _LP64 ; then 797c4f80543SAlistair Francis cpu="riscv64" 798c4f80543SAlistair Francis else 799c4f80543SAlistair Francis cpu="riscv32" 800c4f80543SAlistair Francis fi 80121d89f84SPeter Maydellelif check_define __arm__ ; then 80221d89f84SPeter Maydell cpu="arm" 8031f080313SClaudio Fontanaelif check_define __aarch64__ ; then 8041f080313SClaudio Fontana cpu="aarch64" 805fdf7ed96Smalcelse 80689138857SStefan Weil cpu=$(uname -m) 807ac0df51dSaliguorifi 808ac0df51dSaliguori 809359bc95dSPeter MaydellARCH= 810359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 811359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 8127d13299dSbellardcase "$cpu" in 813ee35e968SThomas Huth ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64) 814898be3e0SPeter Maydell ;; 815f8378accSRichard Henderson ppc64le) 816f8378accSRichard Henderson ARCH="ppc64" 817f8378accSRichard Henderson ;; 8187d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 81997a847bcSbellard cpu="i386" 8207d13299dSbellard ;; 821aaa5fa14Saurel32 x86_64|amd64) 822aaa5fa14Saurel32 cpu="x86_64" 823aaa5fa14Saurel32 ;; 82421d89f84SPeter Maydell armv*b|armv*l|arm) 82521d89f84SPeter Maydell cpu="arm" 8267d13299dSbellard ;; 8271f080313SClaudio Fontana aarch64) 8281f080313SClaudio Fontana cpu="aarch64" 8291f080313SClaudio Fontana ;; 830afa05235SAurelien Jarno mips*) 831afa05235SAurelien Jarno cpu="mips" 832afa05235SAurelien Jarno ;; 8333142255cSblueswir1 sparc|sun4[cdmuv]) 834ae228531Sbellard cpu="sparc" 835ae228531Sbellard ;; 8367d13299dSbellard *) 837359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 838359bc95dSPeter Maydell ARCH=unknown 8397d13299dSbellard ;; 8407d13299dSbellardesac 841359bc95dSPeter Maydellif test -z "$ARCH"; then 842359bc95dSPeter Maydell ARCH="$cpu" 843359bc95dSPeter Maydellfi 844e2d52ad3SJuan Quintela 8457d13299dSbellard# OS specific 8460dbfc675SJuan Quintela 847adfc3e91SStacey Son# host *BSD for user mode 848adfc3e91SStacey SonHOST_VARIANT_DIR="" 849adfc3e91SStacey Son 8507d13299dSbellardcase $targetos in 85167b915a5SbellardMINGW32*) 85267b915a5Sbellard mingw32="yes" 853b0cb0a66SVincent Palatin hax="yes" 854299e6f19SPaolo Bonzini vhost_user="no" 8553cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 856307119e7SGerd Hoffmann if check_include dsound.h; then 8573cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 858307119e7SGerd Hoffmann else 859307119e7SGerd Hoffmann audio_drv_list="" 860307119e7SGerd Hoffmann fi 861898be3e0SPeter Maydell supported_os="yes" 86267b915a5Sbellard;; 8635c40d2bdSthsGNU/kFreeBSD) 864a167ba50SAurelien Jarno bsd="yes" 8656a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8660bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 8675c40d2bdSths;; 8687d3505c5SbellardFreeBSD) 8697d3505c5Sbellard bsd="yes" 8700db4a067SPaolo Bonzini make="${MAKE-gmake}" 8716a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8720bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 873f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 874f01576f1SJuergen Lock LIBS="-lutil $LIBS" 875a7764f15SEd Maste # needed for kinfo_getproc 876a7764f15SEd Maste libs_qga="-lutil $libs_qga" 87758952137SVincenzo Maffione netmap="" # enable netmap autodetect 878adfc3e91SStacey Son HOST_VARIANT_DIR="freebsd" 8797d3505c5Sbellard;; 880c5e97233Sblueswir1DragonFly) 881c5e97233Sblueswir1 bsd="yes" 8820db4a067SPaolo Bonzini make="${MAKE-gmake}" 8836a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8840bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 885adfc3e91SStacey Son HOST_VARIANT_DIR="dragonfly" 886c5e97233Sblueswir1;; 8877d3505c5SbellardNetBSD) 8887d3505c5Sbellard bsd="yes" 889604a5b99SKamil Rytarowski hax="yes" 8900db4a067SPaolo Bonzini make="${MAKE-gmake}" 8916a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 8920bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 8938ef92a88Sblueswir1 oss_lib="-lossaudio" 894adfc3e91SStacey Son HOST_VARIANT_DIR="netbsd" 8957d3505c5Sbellard;; 8967d3505c5SbellardOpenBSD) 8977d3505c5Sbellard bsd="yes" 8980db4a067SPaolo Bonzini make="${MAKE-gmake}" 899f92c7168SGerd Hoffmann audio_drv_list="try-sdl" 9000bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 901adfc3e91SStacey Son HOST_VARIANT_DIR="openbsd" 9027d3505c5Sbellard;; 90383fb7adfSbellardDarwin) 90483fb7adfSbellard bsd="yes" 90583fb7adfSbellard darwin="yes" 906b0cb0a66SVincent Palatin hax="yes" 907c97d6d2cSSergio Andres Gomez Del Real hvf="yes" 90817969268SFam Zheng LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 9091b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 910a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 911db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" 9121b0f9cc2Saliguori fi 913fd677642Sths cocoa="yes" 9146a485418SGerd Hoffmann audio_drv_list="coreaudio try-sdl" 91514382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 916db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" 9177973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 918a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 919a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 920a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 921adfc3e91SStacey Son HOST_VARIANT_DIR="darwin" 92283fb7adfSbellard;; 923ec530c81SbellardSunOS) 924ec530c81Sbellard solaris="yes" 9250db4a067SPaolo Bonzini make="${MAKE-gmake}" 9260db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 927e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 9286b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 9296a485418SGerd Hoffmann audio_drv_list="oss try-sdl" 9306b4d2ba1Sths fi 931c2de5c91Smalc audio_possible_drivers="oss sdl" 932d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 933d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 934d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 935d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 936560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 937560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 938560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 939ec530c81Sbellard;; 940179cf400SAndreas FärberHaiku) 941179cf400SAndreas Färber haiku="yes" 942fc433430SDavid CARLIER QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" 943fc433430SDavid CARLIER LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS" 944179cf400SAndreas Färber;; 945898be3e0SPeter MaydellLinux) 9467183834aSGerd Hoffmann audio_drv_list="try-pa oss" 9470bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 9485327cf48Sbellard linux="yes" 949831b7825Sths linux_user="yes" 950af2be207SJan Kiszka kvm="yes" 95125211446SPaolo Bonzini QEMU_INCLUDES="-isystem ${source_path}/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES" 9523efac6ebSTomáš Golembiovský libudev="yes" 953898be3e0SPeter Maydell;; 9547d13299dSbellardesac 9557d13299dSbellard 9567d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 957b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 95884778508Sblueswir1 bsd_user="yes" 9597d3505c5Sbellard fi 96008de3949SAndreas Färberfi 9617d3505c5Sbellard 9620db4a067SPaolo Bonzini: ${make=${MAKE-make}} 9630db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 964faf44142SDaniel P. Berrangé# We prefer python 3.x. A bare 'python' is traditionally 965faf44142SDaniel P. Berrangé# python 2.x, but some distros have it as python 3.x, so 966ddf90699SEduardo Habkost# we check that too 967faf44142SDaniel P. Berrangépython= 9680a01d76fSMarc-André Lureauexplicit_python=no 969ddf90699SEduardo Habkostfor binary in "${PYTHON-python3}" python 970faf44142SDaniel P. Berrangédo 971faf44142SDaniel P. Berrangé if has "$binary" 972faf44142SDaniel P. Berrangé then 97395c5f2deSPaolo Bonzini python=$(command -v "$binary") 974faf44142SDaniel P. Berrangé break 975faf44142SDaniel P. Berrangé fi 976faf44142SDaniel P. Berrangédone 977903458c8SMarkus Armbruster 978903458c8SMarkus Armbrustersphinx_build= 979903458c8SMarkus Armbrusterfor binary in sphinx-build-3 sphinx-build 980903458c8SMarkus Armbrusterdo 981903458c8SMarkus Armbruster if has "$binary" 982903458c8SMarkus Armbruster then 983903458c8SMarkus Armbruster sphinx_build=$(command -v "$binary") 984903458c8SMarkus Armbruster break 985903458c8SMarkus Armbruster fi 986903458c8SMarkus Armbrusterdone 987903458c8SMarkus Armbruster 98839d87c8cSAlex Bennée# Check for ancillary tools used in testing 98939d87c8cSAlex Bennéegenisoimage= 9903df437c7SAlex Bennéefor binary in genisoimage mkisofs 99139d87c8cSAlex Bennéedo 99239d87c8cSAlex Bennée if has $binary 99339d87c8cSAlex Bennée then 99439d87c8cSAlex Bennée genisoimage=$(command -v "$binary") 99539d87c8cSAlex Bennée break 99639d87c8cSAlex Bennée fi 99739d87c8cSAlex Bennéedone 99839d87c8cSAlex Bennée 999e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 10000db4a067SPaolo Bonzini 10013c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 10023c4a4d0dSPeter Maydellif has clang; then 10033c4a4d0dSPeter Maydell objcc=clang 10043c4a4d0dSPeter Maydellelse 10053c4a4d0dSPeter Maydell objcc="$cc" 10063c4a4d0dSPeter Maydellfi 10073c4a4d0dSPeter Maydell 10083457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 10093457a3f8SJuan Quintela EXESUF=".exe" 101017969268SFam Zheng DSOSUF=".dll" 101178e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 1012086d5f75SPaolo Bonzini CFLAGS="-mthreads $CFLAGS" 1013b965e8c5SPaolo Bonzini LIBS="-lwinmm -lws2_32 $LIBS" 101493b25869SJohn Snow write_c_skeleton; 1015f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 1016f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 1017f7cf5d5bSStefan Weil fi 1018c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 1019683035deSPaolo Bonzini confsuffix="" 1020105fad6bSBishara AbuHattoum libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" 10213457a3f8SJuan Quintelafi 10223457a3f8SJuan Quintela 1023487fefdbSAnthony Liguoriwerror="" 102485aa5189Sbellard 10257d13299dSbellardfor opt do 102689138857SStefan Weil optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') 10277d13299dSbellard case "$opt" in 10282efc3265Sbellard --help|-h) show_help=yes 10292efc3265Sbellard ;; 103099123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 103199123e13SMike Frysinger ;; 1032b1a550a0Spbrook --prefix=*) prefix="$optarg" 10337d13299dSbellard ;; 1034b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 103532ce6337Sbellard ;; 1036ac0df51dSaliguori --cross-prefix=*) 10377d13299dSbellard ;; 1038ac0df51dSaliguori --cc=*) 10397d13299dSbellard ;; 1040b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 104183469015Sbellard ;; 104283f73fceSTomoki Sekiyama --cxx=*) 104383f73fceSTomoki Sekiyama ;; 1044e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 1045e007dbecSMichael S. Tsirkin ;; 10463c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 10473c4a4d0dSPeter Maydell ;; 1048b1a550a0Spbrook --make=*) make="$optarg" 10497d13299dSbellard ;; 10506a882643Spbrook --install=*) install="$optarg" 10516a882643Spbrook ;; 10520a01d76fSMarc-André Lureau --python=*) python="$optarg" ; explicit_python=yes 1053c886edfbSBlue Swirl ;; 10542eb054c2SPeter Maydell --sphinx-build=*) sphinx_build="$optarg" 10552eb054c2SPeter Maydell ;; 1056a5665051SPaolo Bonzini --skip-meson) skip_meson=yes 1057a5665051SPaolo Bonzini ;; 1058a5665051SPaolo Bonzini --meson=*) meson="$optarg" 1059a5665051SPaolo Bonzini ;; 1060e2d8830eSBrad --smbd=*) smbd="$optarg" 1061e2d8830eSBrad ;; 1062e2a2ed06SJuan Quintela --extra-cflags=*) 10637d13299dSbellard ;; 106411cde1c8SBruno Dominguez --extra-cxxflags=*) 106511cde1c8SBruno Dominguez ;; 1066e2a2ed06SJuan Quintela --extra-ldflags=*) 10677d13299dSbellard ;; 10685bc62e01SGerd Hoffmann --enable-debug-info) 10695bc62e01SGerd Hoffmann ;; 10705bc62e01SGerd Hoffmann --disable-debug-info) 10715bc62e01SGerd Hoffmann ;; 1072d75402b5SAlex Bennée --cross-cc-*) 1073d75402b5SAlex Bennée ;; 107417969268SFam Zheng --enable-modules) 107517969268SFam Zheng modules="yes" 107617969268SFam Zheng ;; 10773aa88b31SStefan Hajnoczi --disable-modules) 10783aa88b31SStefan Hajnoczi modules="no" 10793aa88b31SStefan Hajnoczi ;; 1080bd83c861SChristian Ehrhardt --disable-module-upgrades) module_upgrades="no" 1081bd83c861SChristian Ehrhardt ;; 1082bd83c861SChristian Ehrhardt --enable-module-upgrades) module_upgrades="yes" 1083bd83c861SChristian Ehrhardt ;; 10842ff6b91eSJuan Quintela --cpu=*) 10857d13299dSbellard ;; 1086b1a550a0Spbrook --target-list=*) target_list="$optarg" 1087447e133fSAlex Bennée if test "$target_list_exclude"; then 1088447e133fSAlex Bennée error_exit "Can't mix --target-list with --target-list-exclude" 1089447e133fSAlex Bennée fi 1090447e133fSAlex Bennée ;; 1091447e133fSAlex Bennée --target-list-exclude=*) target_list_exclude="$optarg" 1092447e133fSAlex Bennée if test "$target_list"; then 1093447e133fSAlex Bennée error_exit "Can't mix --target-list-exclude with --target-list" 1094447e133fSAlex Bennée fi 1095de83cd02Sbellard ;; 10965b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 10975b808275SLluís Vilanova ;; 10985b808275SLluís Vilanova # XXX: backwards compatibility 10995b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 110094a420b1SStefan Hajnoczi ;; 110174242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 11029410b56cSPrerna Saxena ;; 1103f3494749SPaolo Bonzini --with-default-devices) default_devices="yes" 1104f3494749SPaolo Bonzini ;; 1105f3494749SPaolo Bonzini --without-default-devices) default_devices="no" 1106f3494749SPaolo Bonzini ;; 11077d13299dSbellard --enable-gprof) gprof="yes" 11087d13299dSbellard ;; 11091d728c39SBlue Swirl --enable-gcov) gcov="yes" 11101d728c39SBlue Swirl ;; 111179427693SLoïc Minier --static) 111279427693SLoïc Minier static="yes" 111317884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 111443ce4dfeSbellard ;; 11150b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 11160b24e75fSPaolo Bonzini ;; 11170b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 11180b24e75fSPaolo Bonzini ;; 11193aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 11203aa5d2beSAlon Levy ;; 11218bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 11228bf188aaSMichael Tokarev ;; 11230f94d6daSAlon Levy --includedir=*) includedir="$optarg" 11240f94d6daSAlon Levy ;; 1125528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 11260b24e75fSPaolo Bonzini ;; 1127023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 1128023d3d67SEduardo Habkost ;; 1129850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 11300b24e75fSPaolo Bonzini ;; 1131ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 113207381cc1SAnthony Liguori ;; 1133785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 1134785c23aeSLuiz Capitulino ;; 11353d5eecabSGerd Hoffmann --firmwarepath=*) firmwarepath="$optarg" 11363d5eecabSGerd Hoffmann ;; 1137181ce1d0SOlaf Hering --host=*|--build=*|\ 1138181ce1d0SOlaf Hering --disable-dependency-tracking|\ 1139785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 1140023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 1141023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 1142023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 1143023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 1144023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 1145023ddd74SMax Filippov # lots of directory switches by default. 1146023ddd74SMax Filippov ;; 114797a847bcSbellard --disable-sdl) sdl="no" 114897a847bcSbellard ;; 1149c4198157SJuan Quintela --enable-sdl) sdl="yes" 1150c4198157SJuan Quintela ;; 1151a442fe2fSDaniel P. Berrangé --disable-sdl-image) sdl_image="no" 1152a442fe2fSDaniel P. Berrangé ;; 1153a442fe2fSDaniel P. Berrangé --enable-sdl-image) sdl_image="yes" 1154a442fe2fSDaniel P. Berrangé ;; 11553556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 11563556c233SPaolo Bonzini ;; 11573556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 11583556c233SPaolo Bonzini ;; 1159983eef5aSMeador Inge --disable-virtfs) virtfs="no" 1160983eef5aSMeador Inge ;; 1161983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 1162983eef5aSMeador Inge ;; 1163fe8fc5aeSPaolo Bonzini --disable-mpath) mpath="no" 1164fe8fc5aeSPaolo Bonzini ;; 1165fe8fc5aeSPaolo Bonzini --enable-mpath) mpath="yes" 1166fe8fc5aeSPaolo Bonzini ;; 1167821601eaSJes Sorensen --disable-vnc) vnc="no" 1168821601eaSJes Sorensen ;; 1169821601eaSJes Sorensen --enable-vnc) vnc="yes" 1170821601eaSJes Sorensen ;; 11712f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 11722f6a1ab0Sblueswir1 ;; 11730c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 11740c58ac1cSmalc ;; 117589138857SStefan Weil --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1176b64ec4e4SFam Zheng ;; 117789138857SStefan Weil --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') 1178eb852011SMarkus Armbruster ;; 1179f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 1180f8393946Saurel32 ;; 1181f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 1182f8393946Saurel32 ;; 1183f3d08ee6SPaul Brook --enable-debug) 1184f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 1185f3d08ee6SPaul Brook debug_tcg="yes" 11861fcc6d42SPeter Xu debug_mutex="yes" 1187f3d08ee6SPaul Brook debug="yes" 1188f3d08ee6SPaul Brook strip_opt="no" 1189b553a042SJohn Snow fortify_source="no" 1190f3d08ee6SPaul Brook ;; 1191247724cbSMarc-André Lureau --enable-sanitizers) sanitizers="yes" 1192247724cbSMarc-André Lureau ;; 1193247724cbSMarc-André Lureau --disable-sanitizers) sanitizers="no" 1194247724cbSMarc-André Lureau ;; 11950aebab04SLingfeng Yang --enable-tsan) tsan="yes" 11960aebab04SLingfeng Yang ;; 11970aebab04SLingfeng Yang --disable-tsan) tsan="no" 11980aebab04SLingfeng Yang ;; 119903b4fe7dSaliguori --enable-sparse) sparse="yes" 120003b4fe7dSaliguori ;; 120103b4fe7dSaliguori --disable-sparse) sparse="no" 120203b4fe7dSaliguori ;; 12031625af87Saliguori --disable-strip) strip_opt="no" 12041625af87Saliguori ;; 12052f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 12062f9606b3Saliguori ;; 1207ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 1208ea784e3bSJuan Quintela ;; 12092f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 12102f6f5c7aSCorentin Chary ;; 12112f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 12122f6f5c7aSCorentin Chary ;; 1213efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 1214efe556adSCorentin Chary ;; 1215efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 1216efe556adSCorentin Chary ;; 1217443f1376Sbellard --disable-slirp) slirp="no" 1218c20709aaSbellard ;; 12197c57bdd8SMarc-André Lureau --enable-slirp=git) slirp="git" 12207c57bdd8SMarc-André Lureau ;; 1221675b9b53SMarc-André Lureau --enable-slirp=system) slirp="system" 1222675b9b53SMarc-André Lureau ;; 1223e0e6c8c0Saliguori --disable-vde) vde="no" 12248a16d273Sths ;; 1225dfb278bdSJuan Quintela --enable-vde) vde="yes" 1226dfb278bdSJuan Quintela ;; 122758952137SVincenzo Maffione --disable-netmap) netmap="no" 122858952137SVincenzo Maffione ;; 122958952137SVincenzo Maffione --enable-netmap) netmap="yes" 123058952137SVincenzo Maffione ;; 1231e37630caSaliguori --disable-xen) xen="no" 1232e37630caSaliguori ;; 1233fc321b4bSJuan Quintela --enable-xen) xen="yes" 1234fc321b4bSJuan Quintela ;; 1235eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 1236eb6fda0fSAnthony PERARD ;; 1237eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 1238eb6fda0fSAnthony PERARD ;; 12392e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 12402e4d9fb1Saurel32 ;; 12414ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 12424ffcedb6SJuan Quintela ;; 12437ba1e619Saliguori --disable-kvm) kvm="no" 12447ba1e619Saliguori ;; 1245b31a0277SJuan Quintela --enable-kvm) kvm="yes" 1246b31a0277SJuan Quintela ;; 1247b0cb0a66SVincent Palatin --disable-hax) hax="no" 1248180fb750Szhanghailiang ;; 1249b0cb0a66SVincent Palatin --enable-hax) hax="yes" 1250180fb750Szhanghailiang ;; 1251c97d6d2cSSergio Andres Gomez Del Real --disable-hvf) hvf="no" 1252c97d6d2cSSergio Andres Gomez Del Real ;; 1253c97d6d2cSSergio Andres Gomez Del Real --enable-hvf) hvf="yes" 1254c97d6d2cSSergio Andres Gomez Del Real ;; 1255d661d9a4SJustin Terry (VM) --disable-whpx) whpx="no" 1256d661d9a4SJustin Terry (VM) ;; 1257d661d9a4SJustin Terry (VM) --enable-whpx) whpx="yes" 1258d661d9a4SJustin Terry (VM) ;; 12599195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 12609195b2c2SStefan Weil ;; 12619195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 12629195b2c2SStefan Weil ;; 126347e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 126447e98658SCorey Bryant ;; 126547e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 126647e98658SCorey Bryant ;; 1267b3f6ea7eSPaolo Bonzini --disable-tcg) tcg="no" 1268b3f6ea7eSPaolo Bonzini ;; 1269b3f6ea7eSPaolo Bonzini --enable-tcg) tcg="yes" 1270b3f6ea7eSPaolo Bonzini ;; 12715a22ab71SYang Zhong --disable-malloc-trim) malloc_trim="no" 12725a22ab71SYang Zhong ;; 12735a22ab71SYang Zhong --enable-malloc-trim) malloc_trim="yes" 12745a22ab71SYang Zhong ;; 1275cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 1276cd4ec0b4SGerd Hoffmann ;; 1277cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 1278cd4ec0b4SGerd Hoffmann ;; 1279c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 1280c589b249SRonnie Sahlberg ;; 1281c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 1282c589b249SRonnie Sahlberg ;; 12836542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 12846542aa9cSPeter Lieven ;; 12856542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 12866542aa9cSPeter Lieven ;; 128705c2a3e7Sbellard --enable-profiler) profiler="yes" 128805c2a3e7Sbellard ;; 128914821030SPavel Borzenkov --disable-cocoa) cocoa="no" 129014821030SPavel Borzenkov ;; 1291c2de5c91Smalc --enable-cocoa) 1292c2de5c91Smalc cocoa="yes" ; 129389138857SStefan Weil audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" 12945b0753e0Sbellard ;; 1295cad25d69Spbrook --disable-system) softmmu="no" 12960a8e90f4Spbrook ;; 1297cad25d69Spbrook --enable-system) softmmu="yes" 12980a8e90f4Spbrook ;; 12990953a80fSZachary Amsden --disable-user) 13000953a80fSZachary Amsden linux_user="no" ; 13010953a80fSZachary Amsden bsd_user="no" ; 13020953a80fSZachary Amsden ;; 13030953a80fSZachary Amsden --enable-user) ;; 1304831b7825Sths --disable-linux-user) linux_user="no" 13050a8e90f4Spbrook ;; 1306831b7825Sths --enable-linux-user) linux_user="yes" 1307831b7825Sths ;; 130884778508Sblueswir1 --disable-bsd-user) bsd_user="no" 130984778508Sblueswir1 ;; 131084778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 131184778508Sblueswir1 ;; 131240d6444eSAvi Kivity --enable-pie) pie="yes" 131334005a00SKirill A. Shutemov ;; 131440d6444eSAvi Kivity --disable-pie) pie="no" 131534005a00SKirill A. Shutemov ;; 131685aa5189Sbellard --enable-werror) werror="yes" 131785aa5189Sbellard ;; 131885aa5189Sbellard --disable-werror) werror="no" 131985aa5189Sbellard ;; 132063678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 132163678e17SSteven Noonan ;; 132263678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 132363678e17SSteven Noonan ;; 13241e4f6065SDaniele Buono --enable-safe-stack) safe_stack="yes" 13251e4f6065SDaniele Buono ;; 13261e4f6065SDaniele Buono --disable-safe-stack) safe_stack="no" 13271e4f6065SDaniele Buono ;; 13284d3b6f6eSbalrog --disable-curses) curses="no" 13294d3b6f6eSbalrog ;; 1330c584a6d0SJuan Quintela --enable-curses) curses="yes" 1331c584a6d0SJuan Quintela ;; 1332e08bb301SSamuel Thibault --disable-iconv) iconv="no" 1333e08bb301SSamuel Thibault ;; 1334e08bb301SSamuel Thibault --enable-iconv) iconv="yes" 1335e08bb301SSamuel Thibault ;; 1336769ce76dSAlexander Graf --disable-curl) curl="no" 1337769ce76dSAlexander Graf ;; 1338788c8196SJuan Quintela --enable-curl) curl="yes" 1339788c8196SJuan Quintela ;; 13402df87df7SJuan Quintela --disable-fdt) fdt="no" 13412df87df7SJuan Quintela ;; 13422df87df7SJuan Quintela --enable-fdt) fdt="yes" 13432df87df7SJuan Quintela ;; 13445c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 13455c6c3a6cSChristoph Hellwig ;; 13465c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 13475c6c3a6cSChristoph Hellwig ;; 1348c10dd856SAarushi Mehta --disable-linux-io-uring) linux_io_uring="no" 1349c10dd856SAarushi Mehta ;; 1350c10dd856SAarushi Mehta --enable-linux-io-uring) linux_io_uring="yes" 1351c10dd856SAarushi Mehta ;; 1352758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 1353758e8e38SVenkateswararao Jujjuri (JV) ;; 1354758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 1355758e8e38SVenkateswararao Jujjuri (JV) ;; 1356a40161cbSPaolo Bonzini --disable-membarrier) membarrier="no" 1357a40161cbSPaolo Bonzini ;; 1358a40161cbSPaolo Bonzini --enable-membarrier) membarrier="yes" 1359a40161cbSPaolo Bonzini ;; 136077755340Sths --disable-blobs) blobs="no" 136177755340Sths ;; 13627e563bfbSThomas Huth --with-pkgversion=*) pkgversion="$optarg" 13634a19f1ecSpbrook ;; 1364519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 1365519175a2SAlex Barcelo ;; 136670c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 136770c60c08SStefan Hajnoczi ;; 136870c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 136970c60c08SStefan Hajnoczi ;; 13707d992e4dSPeter Lieven --enable-debug-stack-usage) debug_stack_usage="yes" 13717d992e4dSPeter Lieven ;; 1372f0d92b56SLongpeng(Mike) --enable-crypto-afalg) crypto_afalg="yes" 1373f0d92b56SLongpeng(Mike) ;; 1374f0d92b56SLongpeng(Mike) --disable-crypto-afalg) crypto_afalg="no" 1375f0d92b56SLongpeng(Mike) ;; 1376a25dba17SJuan Quintela --disable-docs) docs="no" 137770ec5dc0SAnthony Liguori ;; 1378a25dba17SJuan Quintela --enable-docs) docs="yes" 137983a3ab8bSJuan Quintela ;; 1380d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1381d5970055SMichael S. Tsirkin ;; 1382d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1383d5970055SMichael S. Tsirkin ;; 1384042cea27SGonglei --disable-vhost-crypto) vhost_crypto="no" 1385042cea27SGonglei ;; 1386299e6f19SPaolo Bonzini --enable-vhost-crypto) vhost_crypto="yes" 1387042cea27SGonglei ;; 13885e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 13895e9be92dSNicholas Bellinger ;; 13905e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 13915e9be92dSNicholas Bellinger ;; 1392fc0b9b0eSStefan Hajnoczi --disable-vhost-vsock) vhost_vsock="no" 1393fc0b9b0eSStefan Hajnoczi ;; 1394fc0b9b0eSStefan Hajnoczi --enable-vhost-vsock) vhost_vsock="yes" 1395fc0b9b0eSStefan Hajnoczi ;; 139698fc1adaSDr. David Alan Gilbert --disable-vhost-user-fs) vhost_user_fs="no" 139798fc1adaSDr. David Alan Gilbert ;; 139898fc1adaSDr. David Alan Gilbert --enable-vhost-user-fs) vhost_user_fs="yes" 139998fc1adaSDr. David Alan Gilbert ;; 1400da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 140120ff075bSMichael Walle ;; 1402da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 140320ff075bSMichael Walle ;; 1404f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1405f27aaf4bSChristian Brunner ;; 1406f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1407f27aaf4bSChristian Brunner ;; 14088c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 14098c84cf11SSergei Trofimovich ;; 14108c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 14118c84cf11SSergei Trofimovich ;; 14127b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1413111a38b0SRobert Relyea ;; 14147b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1415111a38b0SRobert Relyea ;; 14162b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 14172b2325ffSGerd Hoffmann ;; 14182b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 14192b2325ffSGerd Hoffmann ;; 142069354a83SHans de Goede --disable-usb-redir) usb_redir="no" 142169354a83SHans de Goede ;; 142269354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 142369354a83SHans de Goede ;; 14241ece9905SAlon Levy --disable-zlib-test) zlib="no" 14251ece9905SAlon Levy ;; 1426b25c9dffSStefan Weil --disable-lzo) lzo="no" 1427b25c9dffSStefan Weil ;; 1428607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1429607dacd0Sqiaonuohan ;; 1430b25c9dffSStefan Weil --disable-snappy) snappy="no" 1431b25c9dffSStefan Weil ;; 1432607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1433607dacd0Sqiaonuohan ;; 14346b383c08SPeter Wu --disable-bzip2) bzip2="no" 14356b383c08SPeter Wu ;; 14366b383c08SPeter Wu --enable-bzip2) bzip2="yes" 14376b383c08SPeter Wu ;; 143883bc1f97SJulio Faracco --enable-lzfse) lzfse="yes" 143983bc1f97SJulio Faracco ;; 144083bc1f97SJulio Faracco --disable-lzfse) lzfse="no" 144183bc1f97SJulio Faracco ;; 14423a678481SJuan Quintela --disable-zstd) zstd="no" 14433a678481SJuan Quintela ;; 14443a678481SJuan Quintela --enable-zstd) zstd="yes" 14453a678481SJuan Quintela ;; 1446d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1447d138cee9SMichael Roth ;; 1448d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1449d138cee9SMichael Roth ;; 14509dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 14519dacf32dSYossi Hindin ;; 14529dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 14539dacf32dSYossi Hindin ;; 1454d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1455d9840e25STomoki Sekiyama ;; 1456d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1457d9840e25STomoki Sekiyama ;; 1458d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1459d9840e25STomoki Sekiyama ;; 1460d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1461d9840e25STomoki Sekiyama ;; 1462d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1463d9840e25STomoki Sekiyama ;; 1464d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1465d9840e25STomoki Sekiyama ;; 14664b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 14674b1c11fdSDaniel P. Berrange ;; 14684b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 14694b1c11fdSDaniel P. Berrange ;; 1470f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1471f794573eSEduardo Otubo ;; 1472f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1473f794573eSEduardo Otubo ;; 1474eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1475eb100396SBharata B Rao ;; 147686583a07SLiam Merwick --disable-avx2) avx2_opt="no" 147786583a07SLiam Merwick ;; 147886583a07SLiam Merwick --enable-avx2) avx2_opt="yes" 147986583a07SLiam Merwick ;; 14806b8cd447SRobert Hoo --disable-avx512f) avx512f_opt="no" 14816b8cd447SRobert Hoo ;; 14826b8cd447SRobert Hoo --enable-avx512f) avx512f_opt="yes" 14836b8cd447SRobert Hoo ;; 14846b8cd447SRobert Hoo 1485eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1486eb100396SBharata B Rao ;; 148752b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 148852b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1489583f6e7bSStefan Hajnoczi ;; 1490cb6414dfSFam Zheng --enable-vhdx|--disable-vhdx) 1491cb6414dfSFam Zheng echo "$0: $opt is obsolete, VHDX driver is always built" >&2 1492cb6414dfSFam Zheng ;; 1493315d3184SFam Zheng --enable-uuid|--disable-uuid) 1494315d3184SFam Zheng echo "$0: $opt is obsolete, UUID support is always built" >&2 1495315d3184SFam Zheng ;; 1496a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1497a4ccabcfSAnthony Liguori ;; 1498a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1499a4ccabcfSAnthony Liguori ;; 1500a1c5e949SDaniel P. Berrange --tls-priority=*) tls_priority="$optarg" 1501a1c5e949SDaniel P. Berrange ;; 1502ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1503ddbb0d09SDaniel P. Berrange ;; 1504ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1505ddbb0d09SDaniel P. Berrange ;; 150691bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 150791bfcdb0SDaniel P. Berrange ;; 150891bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 150991bfcdb0SDaniel P. Berrange ;; 151091bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 151191bfcdb0SDaniel P. Berrange ;; 151291bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 151391bfcdb0SDaniel P. Berrange ;; 15148953caf3SDaniel P. Berrange --disable-auth-pam) auth_pam="no" 15158953caf3SDaniel P. Berrange ;; 15168953caf3SDaniel P. Berrange --enable-auth-pam) auth_pam="yes" 15178953caf3SDaniel P. Berrange ;; 15182da776dbSMichael R. Hines --enable-rdma) rdma="yes" 15192da776dbSMichael R. Hines ;; 15202da776dbSMichael R. Hines --disable-rdma) rdma="no" 15212da776dbSMichael R. Hines ;; 152221ab34c9SMarcel Apfelbaum --enable-pvrdma) pvrdma="yes" 152321ab34c9SMarcel Apfelbaum ;; 152421ab34c9SMarcel Apfelbaum --disable-pvrdma) pvrdma="no" 152521ab34c9SMarcel Apfelbaum ;; 1526bbbf9bfbSStefan Weil --disable-vte) vte="no" 1527bbbf9bfbSStefan Weil ;; 1528bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1529bbbf9bfbSStefan Weil ;; 15309d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 15319d9e1521SGerd Hoffmann ;; 15329d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 15339d9e1521SGerd Hoffmann ;; 1534e91c793cSCole Robinson --disable-tpm) tpm="no" 1535e91c793cSCole Robinson ;; 1536ab214c29SStefan Berger --enable-tpm) tpm="yes" 1537ab214c29SStefan Berger ;; 1538b10d49d7SPino Toscano --disable-libssh) libssh="no" 15390a12ec87SRichard W.M. Jones ;; 1540b10d49d7SPino Toscano --enable-libssh) libssh="yes" 15410a12ec87SRichard W.M. Jones ;; 1542ed1701c6SDr. David Alan Gilbert --disable-live-block-migration) live_block_migration="no" 1543ed1701c6SDr. David Alan Gilbert ;; 1544ed1701c6SDr. David Alan Gilbert --enable-live-block-migration) live_block_migration="yes" 1545ed1701c6SDr. David Alan Gilbert ;; 1546a99d57bbSWanlong Gao --disable-numa) numa="no" 1547a99d57bbSWanlong Gao ;; 1548a99d57bbSWanlong Gao --enable-numa) numa="yes" 1549a99d57bbSWanlong Gao ;; 1550ed279a06SKlim Kireev --disable-libxml2) libxml2="no" 1551ed279a06SKlim Kireev ;; 1552ed279a06SKlim Kireev --enable-libxml2) libxml2="yes" 1553ed279a06SKlim Kireev ;; 15542847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 15552847b469SFam Zheng ;; 15562847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 15572847b469SFam Zheng ;; 15587b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 15597b01cb97SAlexandre Derumier ;; 15607b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 15617b01cb97SAlexandre Derumier ;; 1562a6b1d4c0SChanglong Xie --disable-replication) replication="no" 1563a6b1d4c0SChanglong Xie ;; 1564a6b1d4c0SChanglong Xie --enable-replication) replication="yes" 1565a6b1d4c0SChanglong Xie ;; 15662f740136SJeff Cody --disable-bochs) bochs="no" 15672f740136SJeff Cody ;; 15682f740136SJeff Cody --enable-bochs) bochs="yes" 15692f740136SJeff Cody ;; 15702f740136SJeff Cody --disable-cloop) cloop="no" 15712f740136SJeff Cody ;; 15722f740136SJeff Cody --enable-cloop) cloop="yes" 15732f740136SJeff Cody ;; 15742f740136SJeff Cody --disable-dmg) dmg="no" 15752f740136SJeff Cody ;; 15762f740136SJeff Cody --enable-dmg) dmg="yes" 15772f740136SJeff Cody ;; 15782f740136SJeff Cody --disable-qcow1) qcow1="no" 15792f740136SJeff Cody ;; 15802f740136SJeff Cody --enable-qcow1) qcow1="yes" 15812f740136SJeff Cody ;; 15822f740136SJeff Cody --disable-vdi) vdi="no" 15832f740136SJeff Cody ;; 15842f740136SJeff Cody --enable-vdi) vdi="yes" 15852f740136SJeff Cody ;; 15862f740136SJeff Cody --disable-vvfat) vvfat="no" 15872f740136SJeff Cody ;; 15882f740136SJeff Cody --enable-vvfat) vvfat="yes" 15892f740136SJeff Cody ;; 15902f740136SJeff Cody --disable-qed) qed="no" 15912f740136SJeff Cody ;; 15922f740136SJeff Cody --enable-qed) qed="yes" 15932f740136SJeff Cody ;; 15942f740136SJeff Cody --disable-parallels) parallels="no" 15952f740136SJeff Cody ;; 15962f740136SJeff Cody --enable-parallels) parallels="yes" 15972f740136SJeff Cody ;; 15982f740136SJeff Cody --disable-sheepdog) sheepdog="no" 15992f740136SJeff Cody ;; 16002f740136SJeff Cody --enable-sheepdog) sheepdog="yes" 16012f740136SJeff Cody ;; 1602e6a74868SMarc-André Lureau --disable-vhost-user) vhost_user="no" 1603e6a74868SMarc-André Lureau ;; 1604299e6f19SPaolo Bonzini --enable-vhost-user) vhost_user="yes" 1605299e6f19SPaolo Bonzini ;; 1606108a6481SCindy Lu --disable-vhost-vdpa) vhost_vdpa="no" 1607108a6481SCindy Lu ;; 1608108a6481SCindy Lu --enable-vhost-vdpa) vhost_vdpa="yes" 1609108a6481SCindy Lu ;; 1610299e6f19SPaolo Bonzini --disable-vhost-kernel) vhost_kernel="no" 1611299e6f19SPaolo Bonzini ;; 1612299e6f19SPaolo Bonzini --enable-vhost-kernel) vhost_kernel="yes" 1613e6a74868SMarc-André Lureau ;; 16148ca80760SRichard Henderson --disable-capstone) capstone="no" 16158ca80760SRichard Henderson ;; 16168ca80760SRichard Henderson --enable-capstone) capstone="yes" 16178ca80760SRichard Henderson ;; 1618e219c499SRichard Henderson --enable-capstone=git) capstone="git" 1619e219c499SRichard Henderson ;; 1620e219c499SRichard Henderson --enable-capstone=system) capstone="system" 1621e219c499SRichard Henderson ;; 1622cc84d63aSDaniel P. Berrange --with-git=*) git="$optarg" 1623cc84d63aSDaniel P. Berrange ;; 1624f62bbee5SDaniel P. Berrange --enable-git-update) git_update=yes 1625f62bbee5SDaniel P. Berrange ;; 1626f62bbee5SDaniel P. Berrange --disable-git-update) git_update=no 1627f62bbee5SDaniel P. Berrange ;; 1628ba59fb77SPaolo Bonzini --enable-debug-mutex) debug_mutex=yes 1629ba59fb77SPaolo Bonzini ;; 1630ba59fb77SPaolo Bonzini --disable-debug-mutex) debug_mutex=no 1631ba59fb77SPaolo Bonzini ;; 163217824406SJunyan He --enable-libpmem) libpmem=yes 163317824406SJunyan He ;; 163417824406SJunyan He --disable-libpmem) libpmem=no 163517824406SJunyan He ;; 163675411919SJames Le Cuirot --enable-xkbcommon) xkbcommon=yes 163775411919SJames Le Cuirot ;; 163875411919SJames Le Cuirot --disable-xkbcommon) xkbcommon=no 163975411919SJames Le Cuirot ;; 164040e8c6f4SAlex Bennée --enable-plugins) plugins="yes" 164140e8c6f4SAlex Bennée ;; 164240e8c6f4SAlex Bennée --disable-plugins) plugins="no" 164340e8c6f4SAlex Bennée ;; 1644afc3a8f9SAlex Bennée --enable-containers) use_containers="yes" 1645afc3a8f9SAlex Bennée ;; 1646afc3a8f9SAlex Bennée --disable-containers) use_containers="no" 1647afc3a8f9SAlex Bennée ;; 1648adc28027SAlexander Bulekov --enable-fuzzing) fuzzing=yes 1649adc28027SAlexander Bulekov ;; 1650adc28027SAlexander Bulekov --disable-fuzzing) fuzzing=no 1651adc28027SAlexander Bulekov ;; 1652f48e590aSAlex Bennée --gdb=*) gdb_bin="$optarg" 1653f48e590aSAlex Bennée ;; 1654b767d257SMarek Marczykowski-Górecki --enable-rng-none) rng_none=yes 1655b767d257SMarek Marczykowski-Górecki ;; 1656b767d257SMarek Marczykowski-Górecki --disable-rng-none) rng_none=no 1657b767d257SMarek Marczykowski-Górecki ;; 165854e7aac0SAlexey Krasikov --enable-keyring) secret_keyring="yes" 165954e7aac0SAlexey Krasikov ;; 166054e7aac0SAlexey Krasikov --disable-keyring) secret_keyring="no" 166154e7aac0SAlexey Krasikov ;; 166221b2eca6SJingqi Liu --enable-libdaxctl) libdaxctl=yes 166321b2eca6SJingqi Liu ;; 166421b2eca6SJingqi Liu --disable-libdaxctl) libdaxctl=no 166521b2eca6SJingqi Liu ;; 16662d2ad6d0SFam Zheng *) 16672d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 16682d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 16692d2ad6d0SFam Zheng exit 1 16707f1559c6Sbalrog ;; 16717d13299dSbellard esac 16727d13299dSbellarddone 16737d13299dSbellard 167422a87800SMarc-André Lureaulibdir="${libdir:-$prefix/lib}" 167522a87800SMarc-André Lureaulibexecdir="${libexecdir:-$prefix/libexec}" 167622a87800SMarc-André Lureauincludedir="${includedir:-$prefix/include}" 167722a87800SMarc-André Lureau 167822a87800SMarc-André Lureauif test "$mingw32" = "yes" ; then 167922a87800SMarc-André Lureau mandir="$prefix" 168022a87800SMarc-André Lureau datadir="$prefix" 168122a87800SMarc-André Lureau qemu_docdir="$prefix" 168222a87800SMarc-André Lureau bindir="$prefix" 168322a87800SMarc-André Lureau sysconfdir="$prefix" 168422a87800SMarc-André Lureau local_statedir= 168522a87800SMarc-André Lureauelse 168622a87800SMarc-André Lureau mandir="${mandir:-$prefix/share/man}" 168722a87800SMarc-André Lureau datadir="${datadir:-$prefix/share}" 168822a87800SMarc-André Lureau qemu_docdir="${qemu_docdir:-$prefix/share/doc/qemu}" 168922a87800SMarc-André Lureau bindir="${bindir:-$prefix/bin}" 169022a87800SMarc-André Lureau sysconfdir="${sysconfdir:-$prefix/etc}" 169122a87800SMarc-André Lureau local_statedir="${local_statedir:-$prefix/var}" 169222a87800SMarc-André Lureaufi 169322a87800SMarc-André Lureau 169440293e58Sbellardcase "$cpu" in 1695e3608d66SRichard Henderson ppc) 1696e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1697db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 1698e3608d66SRichard Henderson ;; 1699e3608d66SRichard Henderson ppc64) 1700e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1701db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1702e3608d66SRichard Henderson ;; 17039b9c37c3SRichard Henderson sparc) 1704f1079bb8SRichard Henderson CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" 1705db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS" 17063142255cSblueswir1 ;; 1707ed968ff1SJuan Quintela sparc64) 170879f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 1709db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 17103142255cSblueswir1 ;; 171176d83bdeSths s390) 1712061cdd81SRichard Henderson CPU_CFLAGS="-m31" 1713db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS" 171428d7cc49SRichard Henderson ;; 171528d7cc49SRichard Henderson s390x) 1716061cdd81SRichard Henderson CPU_CFLAGS="-m64" 1717db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 171876d83bdeSths ;; 171940293e58Sbellard i386) 172079f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 1721db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS" 172240293e58Sbellard ;; 172340293e58Sbellard x86_64) 17247ebee43eSRichard Henderson # ??? Only extremely old AMD cpus do not have cmpxchg16b. 17257ebee43eSRichard Henderson # If we truly care, we should simply detect this case at 17267ebee43eSRichard Henderson # runtime and generate the fallback to serial emulation. 17277ebee43eSRichard Henderson CPU_CFLAGS="-m64 -mcx16" 1728db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS" 1729379f6698SPaul Brook ;; 1730c72b26ecSRichard Henderson x32) 1731c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1732db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS" 1733c72b26ecSRichard Henderson ;; 173430163d89SPeter Maydell # No special flags required for other host CPUs 17353142255cSblueswir1esac 17363142255cSblueswir1 17372038f8c8SPaolo Bonzinieval "cross_cc_${cpu}=\$host_cc" 17382038f8c8SPaolo Bonzinicross_cc_vars="$cross_cc_vars cross_cc_${cpu}" 173979f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 174079f3b12fSPeter Crosthwaite 1741affc88ccSPeter Maydell# For user-mode emulation the host arch has to be one we explicitly 1742affc88ccSPeter Maydell# support, even if we're using TCI. 1743affc88ccSPeter Maydellif [ "$ARCH" = "unknown" ]; then 1744affc88ccSPeter Maydell bsd_user="no" 1745affc88ccSPeter Maydell linux_user="no" 1746affc88ccSPeter Maydellfi 1747affc88ccSPeter Maydell 17481cf295beSPhilippe Mathieu-Daudéif [ "$bsd_user" = "no" -a "$linux_user" = "no" -a "$softmmu" = "no" ] ; then 17491cf295beSPhilippe Mathieu-Daudé tcg="no" 17501cf295beSPhilippe Mathieu-Daudéfi 17511cf295beSPhilippe Mathieu-Daudé 175260e0df25SPeter Maydelldefault_target_list="" 175360e0df25SPeter Maydell 17546e92f823SPeter Maydellmak_wilds="" 17556e92f823SPeter Maydell 175660e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 17576e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 175860e0df25SPeter Maydellfi 175960e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 17606e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 176160e0df25SPeter Maydellfi 176260e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 17636e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 176460e0df25SPeter Maydellfi 176560e0df25SPeter Maydell 1766447e133fSAlex Bennéeif test -z "$target_list_exclude"; then 17676e92f823SPeter Maydell for config in $mak_wilds; do 17686e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 17696e92f823SPeter Maydell done 1770447e133fSAlex Bennéeelse 1771447e133fSAlex Bennée exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g') 1772447e133fSAlex Bennée for config in $mak_wilds; do 1773447e133fSAlex Bennée target="$(basename "$config" .mak)" 1774447e133fSAlex Bennée exclude="no" 1775447e133fSAlex Bennée for excl in $exclude_list; do 1776447e133fSAlex Bennée if test "$excl" = "$target"; then 1777447e133fSAlex Bennée exclude="yes" 1778447e133fSAlex Bennée break; 1779447e133fSAlex Bennée fi 1780447e133fSAlex Bennée done 1781447e133fSAlex Bennée if test "$exclude" = "no"; then 1782447e133fSAlex Bennée default_target_list="${default_target_list} $target" 1783447e133fSAlex Bennée fi 1784447e133fSAlex Bennée done 1785447e133fSAlex Bennéefi 17866e92f823SPeter Maydell 1787c53eeaf7SStefan Hajnoczi# Enumerate public trace backends for --help output 178864a6047dSGreg Kurztrace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) 1789c53eeaf7SStefan Hajnoczi 1790af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1791af5db58eSpbrookcat << EOF 1792af5db58eSpbrook 1793af5db58eSpbrookUsage: configure [options] 1794af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1795af5db58eSpbrook 179608fb77edSStefan WeilStandard options: 179708fb77edSStefan Weil --help print this message 179808fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 179908fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 180008fb77edSStefan Weil use %M for cpu name [$interp_prefix] 180108fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 180208fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 180308fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 1804447e133fSAlex Bennée --target-list-exclude=LIST exclude a set of targets from the default target-list 180508fb77edSStefan Weil 180608fb77edSStefan WeilAdvanced options (experts only): 180708fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 180808fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 180908fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 181008fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 181108fb77edSStefan Weil build time 181208fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 181308fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 181408fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 181511cde1c8SBruno Dominguez --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS 181608fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 1817d75402b5SAlex Bennée --cross-cc-ARCH=CC use compiler when building ARCH guest test cases 1818d422b2bcSAlex Bennée --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests 181908fb77edSStefan Weil --make=MAKE use specified make [$make] 182008fb77edSStefan Weil --install=INSTALL use specified install [$install] 182108fb77edSStefan Weil --python=PYTHON use specified python [$python] 18222eb054c2SPeter Maydell --sphinx-build=SPHINX use specified sphinx-build [$sphinx_build] 1823a5665051SPaolo Bonzini --meson=MESON use specified meson [$meson] 182408fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 1825db1b5f13SThomas Huth --with-git=GIT use specified git [$git] 182608fb77edSStefan Weil --static enable static build [$static] 182708fb77edSStefan Weil --mandir=PATH install man pages in PATH 182808fb77edSStefan Weil --datadir=PATH install firmware in PATH$confsuffix 182908fb77edSStefan Weil --docdir=PATH install documentation in PATH$confsuffix 183008fb77edSStefan Weil --bindir=PATH install binaries in PATH 183108fb77edSStefan Weil --libdir=PATH install libraries in PATH 1832db1b5f13SThomas Huth --libexecdir=PATH install helper binaries in PATH 183308fb77edSStefan Weil --sysconfdir=PATH install config in PATH$confsuffix 183408fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 18353d5eecabSGerd Hoffmann --firmwarepath=PATH search PATH for firmware files 183613336606SRobert Foley --efi-aarch64=PATH PATH of efi file to use for aarch64 VMs. 1837e26110cfSFam Zheng --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 1838db1b5f13SThomas Huth --with-pkgversion=VERS use specified string as sub-version of the package 183908fb77edSStefan Weil --enable-debug enable common debug build options 1840247724cbSMarc-André Lureau --enable-sanitizers enable default sanitizers 18410aebab04SLingfeng Yang --enable-tsan enable thread sanitizer 184208fb77edSStefan Weil --disable-strip disable stripping binaries 184308fb77edSStefan Weil --disable-werror disable compilation abort on warning 184463678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 184508fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 184608fb77edSStefan Weil Available drivers: $audio_possible_drivers 184708fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 184808fb77edSStefan Weil --block-drv-rw-whitelist=L 184908fb77edSStefan Weil set block driver read-write whitelist 185008fb77edSStefan Weil (affects only QEMU, not qemu-img) 185108fb77edSStefan Weil --block-drv-ro-whitelist=L 185208fb77edSStefan Weil set block driver read-only whitelist 185308fb77edSStefan Weil (affects only QEMU, not qemu-img) 18545b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 1855c53eeaf7SStefan Hajnoczi Available backends: $trace_backend_list 185608fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 185708fb77edSStefan Weil Default:trace-<pid> 1858c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1859c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 18605a22ab71SYang Zhong --enable-malloc-trim enable libc malloc_trim() for memory optimization 1861c23f23b9SMichael Tokarev --oss-lib path to OSS library 1862c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 186308fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 186433c53c54SDaniel P. Berrange ucontext, sigaltstack, windows 186508fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 1866c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1867c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1868c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1869a1c5e949SDaniel P. Berrange --tls-priority default TLS protocol/cipher priority string 1870c12d66aaSLin Ma --enable-gprof QEMU profiling with gprof 1871c12d66aaSLin Ma --enable-profiler profiler support 1872c12d66aaSLin Ma --enable-debug-stack-usage 1873c12d66aaSLin Ma track the maximum stack usage of stacks created by qemu_alloc_stack 187440e8c6f4SAlex Bennée --enable-plugins 187540e8c6f4SAlex Bennée enable plugins via shared library loading 1876afc3a8f9SAlex Bennée --disable-containers don't use containers for cross-building 1877f48e590aSAlex Bennée --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] 1878c23f23b9SMichael Tokarev 1879c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1880c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1881c23f23b9SMichael Tokarev 1882c23f23b9SMichael Tokarev system all system emulation targets 1883c23f23b9SMichael Tokarev user supported user emulation targets 1884c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1885c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1886c23f23b9SMichael Tokarev docs build documentation 1887c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1888c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1889c23f23b9SMichael Tokarev pie Position Independent Executables 189021e709aaSMarc-André Lureau modules modules support (non-Windows) 1891bd83c861SChristian Ehrhardt module-upgrades try to load modules from alternate paths for upgrades 1892c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1893c23f23b9SMichael Tokarev debug-info debugging information 1894c23f23b9SMichael Tokarev sparse sparse checker 18951e4f6065SDaniele Buono safe-stack SafeStack Stack Smash Protection. Depends on 18961e4f6065SDaniele Buono clang/llvm >= 3.7 and requires coroutine backend ucontext. 1897c23f23b9SMichael Tokarev 1898ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 189991bfcdb0SDaniel P. Berrange nettle nettle cryptography support 190091bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 19018953caf3SDaniel P. Berrange auth-pam PAM access control 1902c23f23b9SMichael Tokarev sdl SDL UI 190304c6e16fSMarkus Armbruster sdl-image SDL Image support for icons 1904c23f23b9SMichael Tokarev gtk gtk UI 1905c23f23b9SMichael Tokarev vte vte support for the gtk UI 1906c23f23b9SMichael Tokarev curses curses UI 1907e08bb301SSamuel Thibault iconv font glyph conversion support 1908c23f23b9SMichael Tokarev vnc VNC UI support 1909c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1910c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1911c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1912c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1913c23f23b9SMichael Tokarev virtfs VirtFS 1914fe8fc5aeSPaolo Bonzini mpath Multipath persistent reservation passthrough 1915c23f23b9SMichael Tokarev xen xen backend driver support 191670c292afSAnthony PERARD xen-pci-passthrough PCI passthrough support for Xen 1917c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1918c23f23b9SMichael Tokarev curl curl connectivity 1919a40161cbSPaolo Bonzini membarrier membarrier system call (for Linux 4.14+ or Windows) 1920c23f23b9SMichael Tokarev fdt fdt device tree 1921c23f23b9SMichael Tokarev kvm KVM acceleration support 1922b0cb0a66SVincent Palatin hax HAX acceleration support 1923c97d6d2cSSergio Andres Gomez Del Real hvf Hypervisor.framework acceleration support 1924d661d9a4SJustin Terry (VM) whpx Windows Hypervisor Platform acceleration support 192521ab34c9SMarcel Apfelbaum rdma Enable RDMA-based migration 192621ab34c9SMarcel Apfelbaum pvrdma Enable PVRDMA support 1927c23f23b9SMichael Tokarev vde support for vde network 1928c23f23b9SMichael Tokarev netmap support for netmap network 1929c23f23b9SMichael Tokarev linux-aio Linux AIO support 1930c10dd856SAarushi Mehta linux-io-uring Linux io_uring support 1931c23f23b9SMichael Tokarev cap-ng libcap-ng support 1932c23f23b9SMichael Tokarev attr attr and xattr support 1933299e6f19SPaolo Bonzini vhost-net vhost-net kernel acceleration support 1934299e6f19SPaolo Bonzini vhost-vsock virtio sockets device support 1935299e6f19SPaolo Bonzini vhost-scsi vhost-scsi kernel target support 1936299e6f19SPaolo Bonzini vhost-crypto vhost-user-crypto backend support 1937299e6f19SPaolo Bonzini vhost-kernel vhost kernel backend support 1938299e6f19SPaolo Bonzini vhost-user vhost-user backend support 1939108a6481SCindy Lu vhost-vdpa vhost-vdpa kernel backend support 1940c23f23b9SMichael Tokarev spice spice 1941c23f23b9SMichael Tokarev rbd rados block device (rbd) 1942c23f23b9SMichael Tokarev libiscsi iscsi support 1943c23f23b9SMichael Tokarev libnfs nfs support 19447b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 1945c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1946ed1701c6SDr. David Alan Gilbert live-block-migration Block migration in the main migration stream 1947c23f23b9SMichael Tokarev usb-redir usb network redirection support 1948c23f23b9SMichael Tokarev lzo support of lzo compression library 1949c23f23b9SMichael Tokarev snappy support of snappy compression library 1950c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1951c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 195283bc1f97SJulio Faracco lzfse support of lzfse compression library 195383bc1f97SJulio Faracco (for reading lzfse-compressed dmg images) 19543a678481SJuan Quintela zstd support for zstd compression library 1955d298ac10SDenis Plotnikov (for migration compression and qcow2 cluster compression) 1956c23f23b9SMichael Tokarev seccomp seccomp support 1957c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1958c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1959c23f23b9SMichael Tokarev tpm TPM support 1960b10d49d7SPino Toscano libssh ssh block device support 1961c23f23b9SMichael Tokarev numa libnuma support 1962ed279a06SKlim Kireev libxml2 for Parallels image format 1963c23f23b9SMichael Tokarev tcmalloc tcmalloc support 19647b01cb97SAlexandre Derumier jemalloc jemalloc support 196586583a07SLiam Merwick avx2 AVX2 optimization support 19666b8cd447SRobert Hoo avx512f AVX512F optimization support 1967a6b1d4c0SChanglong Xie replication replication support 1968c12d66aaSLin Ma opengl opengl support 1969c12d66aaSLin Ma virglrenderer virgl rendering support 1970c12d66aaSLin Ma xfsctl xfsctl support 1971c12d66aaSLin Ma qom-cast-debug cast debugging support 19728de73fa8SCleber Rosa tools build qemu-io, qemu-nbd and qemu-img tools 19732f740136SJeff Cody bochs bochs image format support 19742f740136SJeff Cody cloop cloop image format support 19752f740136SJeff Cody dmg dmg image format support 19762f740136SJeff Cody qcow1 qcow v1 image format support 19772f740136SJeff Cody vdi vdi image format support 19782f740136SJeff Cody vvfat vvfat image format support 19792f740136SJeff Cody qed qed image format support 19802f740136SJeff Cody parallels parallels image format support 19812f740136SJeff Cody sheepdog sheepdog block driver support 1982f0d92b56SLongpeng(Mike) crypto-afalg Linux AF_ALG crypto backend driver 19838ca80760SRichard Henderson capstone capstone disassembler support 1984ba59fb77SPaolo Bonzini debug-mutex mutex debugging support 198517824406SJunyan He libpmem libpmem support 198675411919SJames Le Cuirot xkbcommon xkbcommon support 1987b767d257SMarek Marczykowski-Górecki rng-none dummy RNG, avoid using /dev/(u)random and getrandom() 198821b2eca6SJingqi Liu libdaxctl libdaxctl support 198908fb77edSStefan Weil 199008fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1991af5db58eSpbrookEOF 19922d2ad6d0SFam Zhengexit 0 1993af5db58eSpbrookfi 1994af5db58eSpbrook 19959c790242SThomas Huth# Remove old dependency files to make sure that they get properly regenerated 1996bb768f71SThomas Huthrm -f */config-devices.mak.d 19979c790242SThomas Huth 19984d6a835dSLaurent Vivier# Remove syscall_nr.h to be sure they will be regenerated in the build 19994d6a835dSLaurent Vivier# directory, not in the source directory 2000bb0cdc03SLaurent Vivierfor arch in alpha hppa m68k xtensa sh4 microblaze arm ppc s390x sparc sparc64 \ 2001686a0fe4SLaurent Vivier i386 x86_64 mips mips64 ; do 20024d6a835dSLaurent Vivier # remove the file if it has been generated in the source directory 20034d6a835dSLaurent Vivier rm -f "${source_path}/linux-user/${arch}/syscall_nr.h" 20044d6a835dSLaurent Vivier # remove the dependency files 200591e5998fSLaurent Vivier for target in ${arch}*-linux-user ; do 200691e5998fSLaurent Vivier test -d "${target}" && find "${target}" -type f -name "*.d" \ 20074d6a835dSLaurent Vivier -exec grep -q "${source_path}/linux-user/${arch}/syscall_nr.h" {} \; \ 200891e5998fSLaurent Vivier -print | while read file ; do rm "${file}" "${file%.d}.o" ; done 200991e5998fSLaurent Vivier done 20104d6a835dSLaurent Vivierdone 20114d6a835dSLaurent Vivier 2012faf44142SDaniel P. Berrangéif test -z "$python" 2013faf44142SDaniel P. Berrangéthen 2014c53eeaf7SStefan Hajnoczi error_exit "Python not found. Use --python=/path/to/python" 2015c53eeaf7SStefan Hajnoczifi 2016c53eeaf7SStefan Hajnoczi 2017c53eeaf7SStefan Hajnoczi# Note that if the Python conditional here evaluates True we will exit 2018c53eeaf7SStefan Hajnoczi# with status 1 which is a shell 'false' value. 2019ddf90699SEduardo Habkostif ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then 2020ddf90699SEduardo Habkost error_exit "Cannot use '$python', Python >= 3.5 is required." \ 2021c53eeaf7SStefan Hajnoczi "Use --python=/path/to/python to specify a supported Python." 2022c53eeaf7SStefan Hajnoczifi 2023c53eeaf7SStefan Hajnoczi 2024755ee70fSCleber Rosa# Preserve python version since some functionality is dependent on it 2025406ab2f3SCleber Rosapython_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) 2026755ee70fSCleber Rosa 2027c53eeaf7SStefan Hajnoczi# Suppress writing compiled files 2028c53eeaf7SStefan Hajnoczipython="$python -B" 2029c53eeaf7SStefan Hajnoczi 20300a01d76fSMarc-André Lureauif test -z "$meson"; then 20310a01d76fSMarc-André Lureau if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.0; then 20320a01d76fSMarc-André Lureau meson=meson 20330a01d76fSMarc-André Lureau elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 20340a01d76fSMarc-André Lureau meson=git 20350a01d76fSMarc-André Lureau elif test -e "${source_path}/meson/meson.py" ; then 20360a01d76fSMarc-André Lureau meson=internal 20370a01d76fSMarc-André Lureau else 20380a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 20390a01d76fSMarc-André Lureau error_exit "--python requires using QEMU's embedded Meson distribution, but it was not found." 20400a01d76fSMarc-André Lureau else 2041a5665051SPaolo Bonzini error_exit "Meson not found. Use --meson=/path/to/meson" 2042a5665051SPaolo Bonzini fi 20430a01d76fSMarc-André Lureau fi 20440a01d76fSMarc-André Lureauelse 20450a01d76fSMarc-André Lureau # Meson uses its own Python interpreter to invoke other Python scripts, 20460a01d76fSMarc-André Lureau # but the user wants to use the one they specified with --python. 20470a01d76fSMarc-André Lureau # 20480a01d76fSMarc-André Lureau # We do not want to override the distro Python interpreter (and sometimes 20490a01d76fSMarc-André Lureau # cannot: for example in Homebrew /usr/bin/meson is a bash script), so 20500a01d76fSMarc-André Lureau # just require --meson=git|internal together with --python. 20510a01d76fSMarc-André Lureau if test "$explicit_python" = yes; then 20520a01d76fSMarc-André Lureau case "$meson" in 20530a01d76fSMarc-André Lureau git | internal) ;; 20540a01d76fSMarc-André Lureau *) error_exit "--python requires using QEMU's embedded Meson distribution." ;; 20550a01d76fSMarc-André Lureau esac 20560a01d76fSMarc-André Lureau fi 20570a01d76fSMarc-André Lureaufi 2058a5665051SPaolo Bonzini 20590a01d76fSMarc-André Lureauif test "$meson" = git; then 20600a01d76fSMarc-André Lureau git_submodules="${git_submodules} meson" 20610a01d76fSMarc-André Lureaufi 20620a01d76fSMarc-André Lureauif test "$git_update" = yes; then 20630a01d76fSMarc-André Lureau (cd "${source_path}" && GIT="$git" "./scripts/git-submodule.sh" update "$git_submodules") 20640a01d76fSMarc-André Lureaufi 20650a01d76fSMarc-André Lureau 20660a01d76fSMarc-André Lureaucase "$meson" in 20670a01d76fSMarc-André Lureau git | internal) 2068a5665051SPaolo Bonzini if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then 2069a5665051SPaolo Bonzini error_exit "Python setuptools not found" 2070a5665051SPaolo Bonzini fi 20710a01d76fSMarc-André Lureau meson="$python ${source_path}/meson/meson.py" 20720a01d76fSMarc-André Lureau ;; 20730a01d76fSMarc-André Lureau *) meson=$(command -v meson) ;; 20740a01d76fSMarc-André Lureauesac 20750a01d76fSMarc-André Lureau 2076a5665051SPaolo Bonzini 20779aae6e54SDaniel Henrique Barboza# Check that the C compiler works. Doing this here before testing 20789aae6e54SDaniel Henrique Barboza# the host CPU ensures that we had a valid CC to autodetect the 20799aae6e54SDaniel Henrique Barboza# $cpu var (and we should bail right here if that's not the case). 20809aae6e54SDaniel Henrique Barboza# It also allows the help message to be printed without a CC. 20819aae6e54SDaniel Henrique Barbozawrite_c_skeleton; 20829aae6e54SDaniel Henrique Barbozaif compile_object ; then 20839aae6e54SDaniel Henrique Barboza : C compiler works ok 20849aae6e54SDaniel Henrique Barbozaelse 20859aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" either does not exist or does not work" 20869aae6e54SDaniel Henrique Barbozafi 20879aae6e54SDaniel Henrique Barbozaif ! compile_prog ; then 20889aae6e54SDaniel Henrique Barboza error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 20899aae6e54SDaniel Henrique Barbozafi 20909aae6e54SDaniel Henrique Barboza 2091359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 2092359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 2093359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 2094359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 2095359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 2096359bc95dSPeter Maydell else 209776ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 2098359bc95dSPeter Maydell fi 2099359bc95dSPeter Maydellfi 2100359bc95dSPeter Maydell 21019c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 21029c83ffd8SPeter Maydell# by default. Only enable by default for git builds 21039c83ffd8SPeter Maydellif test -z "$werror" ; then 2104fd73745dSAlexey Kardashevskiy if test -e "$source_path/.git" && \ 2105e633a5c6SEric Blake { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then 21069c83ffd8SPeter Maydell werror="yes" 21079c83ffd8SPeter Maydell else 21089c83ffd8SPeter Maydell werror="no" 21099c83ffd8SPeter Maydell fi 21109c83ffd8SPeter Maydellfi 21119c83ffd8SPeter Maydell 2112fb59dabdSPeter Maydellif test "$bogus_os" = "yes"; then 2113fb59dabdSPeter Maydell # Now that we know that we're not printing the help and that 2114fb59dabdSPeter Maydell # the compiler works (so the results of the check_defines we used 2115fb59dabdSPeter Maydell # to identify the OS are reliable), if we didn't recognize the 2116fb59dabdSPeter Maydell # host OS we should stop now. 2117951fedfcSPeter Maydell error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" 2118fb59dabdSPeter Maydellfi 2119fb59dabdSPeter Maydell 2120efc6c070SThomas Huth# Check whether the compiler matches our minimum requirements: 2121efc6c070SThomas Huthcat > $TMPC << EOF 2122efc6c070SThomas Huth#if defined(__clang_major__) && defined(__clang_minor__) 2123efc6c070SThomas Huth# ifdef __apple_build_version__ 2124efc6c070SThomas Huth# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) 2125efc6c070SThomas Huth# error You need at least XCode Clang v5.1 to compile QEMU 2126efc6c070SThomas Huth# endif 2127efc6c070SThomas Huth# else 2128efc6c070SThomas Huth# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) 2129efc6c070SThomas Huth# error You need at least Clang v3.4 to compile QEMU 2130efc6c070SThomas Huth# endif 2131efc6c070SThomas Huth# endif 2132efc6c070SThomas Huth#elif defined(__GNUC__) && defined(__GNUC_MINOR__) 2133efc6c070SThomas Huth# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 2134efc6c070SThomas Huth# error You need at least GCC v4.8 to compile QEMU 2135efc6c070SThomas Huth# endif 2136efc6c070SThomas Huth#else 2137efc6c070SThomas Huth# error You either need GCC or Clang to compiler QEMU 2138efc6c070SThomas Huth#endif 2139efc6c070SThomas Huthint main (void) { return 0; } 2140efc6c070SThomas HuthEOF 2141efc6c070SThomas Huthif ! compile_prog "" "" ; then 2142efc6c070SThomas Huth error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" 2143efc6c070SThomas Huthfi 2144efc6c070SThomas Huth 214500849b92SRichard Henderson# Accumulate -Wfoo and -Wno-bar separately. 214600849b92SRichard Henderson# We will list all of the enable flags first, and the disable flags second. 214700849b92SRichard Henderson# Note that we do not add -Werror, because that would enable it for all 214800849b92SRichard Henderson# configure tests. If a configure test failed due to -Werror this would 214900849b92SRichard Henderson# just silently disable some features, so it's too error prone. 215000849b92SRichard Henderson 215100849b92SRichard Hendersonwarn_flags= 215200849b92SRichard Hendersonadd_to warn_flags -Wold-style-declaration 215300849b92SRichard Hendersonadd_to warn_flags -Wold-style-definition 215400849b92SRichard Hendersonadd_to warn_flags -Wtype-limits 215500849b92SRichard Hendersonadd_to warn_flags -Wformat-security 215600849b92SRichard Hendersonadd_to warn_flags -Wformat-y2k 215700849b92SRichard Hendersonadd_to warn_flags -Winit-self 215800849b92SRichard Hendersonadd_to warn_flags -Wignored-qualifiers 215900849b92SRichard Hendersonadd_to warn_flags -Wempty-body 216000849b92SRichard Hendersonadd_to warn_flags -Wnested-externs 216100849b92SRichard Hendersonadd_to warn_flags -Wendif-labels 216200849b92SRichard Hendersonadd_to warn_flags -Wexpansion-to-defined 216300849b92SRichard Henderson 216400849b92SRichard Hendersonnowarn_flags= 216500849b92SRichard Hendersonadd_to nowarn_flags -Wno-initializer-overrides 216600849b92SRichard Hendersonadd_to nowarn_flags -Wno-missing-include-dirs 216700849b92SRichard Hendersonadd_to nowarn_flags -Wno-shift-negative-value 216800849b92SRichard Hendersonadd_to nowarn_flags -Wno-string-plus-int 216900849b92SRichard Hendersonadd_to nowarn_flags -Wno-typedef-redefinition 2170aabab967SRichard Hendersonadd_to nowarn_flags -Wno-tautological-type-limit-compare 2171bac8d222SRichard Hendersonadd_to nowarn_flags -Wno-psabi 217200849b92SRichard Henderson 217300849b92SRichard Hendersongcc_flags="$warn_flags $nowarn_flags" 217493b25869SJohn Snow 217593b25869SJohn Snowcc_has_warning_flag() { 217693b25869SJohn Snow write_c_skeleton; 217793b25869SJohn Snow 2178a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 2179a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 2180a1d29d6cSPeter Maydell # warning options). 218193b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 218293b25869SJohn Snow compile_prog "-Werror $optflag" "" 218393b25869SJohn Snow} 218493b25869SJohn Snow 218593b25869SJohn Snowfor flag in $gcc_flags; do 218693b25869SJohn Snow if cc_has_warning_flag $flag ; then 21878d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 21888d05095cSPaolo Bonzini fi 21898d05095cSPaolo Bonzinidone 21908d05095cSPaolo Bonzini 219163678e17SSteven Noonanif test "$stack_protector" != "no"; then 2192fccd35a0SRodrigo Rebello cat > $TMPC << EOF 2193fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 2194fccd35a0SRodrigo Rebello{ 2195fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 2196fccd35a0SRodrigo Rebello while (*c) { 2197fccd35a0SRodrigo Rebello *p++ = *c++; 2198fccd35a0SRodrigo Rebello } 2199fccd35a0SRodrigo Rebello return 0; 2200fccd35a0SRodrigo Rebello} 2201fccd35a0SRodrigo RebelloEOF 220263678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 22033b463a3fSMiroslav Rezanina sp_on=0 220463678e17SSteven Noonan for flag in $gcc_flags; do 2205590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 2206590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 2207086d5f75SPaolo Bonzini if compile_object "-Werror $flag" && 2208590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 220963678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 2210db5adeaaSPaolo Bonzini QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 22113b463a3fSMiroslav Rezanina sp_on=1 221263678e17SSteven Noonan break 221363678e17SSteven Noonan fi 221463678e17SSteven Noonan done 22153b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 22163b463a3fSMiroslav Rezanina if test $sp_on = 0; then 22173b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 22183b463a3fSMiroslav Rezanina fi 22193b463a3fSMiroslav Rezanina fi 222037746c5eSMarc-André Lureaufi 222137746c5eSMarc-André Lureau 222220bc94a2SPaolo Bonzini# Disable -Wmissing-braces on older compilers that warn even for 222320bc94a2SPaolo Bonzini# the "universal" C zero initializer {0}. 222420bc94a2SPaolo Bonzinicat > $TMPC << EOF 222520bc94a2SPaolo Bonzinistruct { 222620bc94a2SPaolo Bonzini int a[2]; 222720bc94a2SPaolo Bonzini} x = {0}; 222820bc94a2SPaolo BonziniEOF 222920bc94a2SPaolo Bonziniif compile_object "-Werror" "" ; then 223020bc94a2SPaolo Bonzini : 223120bc94a2SPaolo Bonzinielse 223220bc94a2SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" 223320bc94a2SPaolo Bonzinifi 223420bc94a2SPaolo Bonzini 223521e709aaSMarc-André Lureau# Our module code doesn't support Windows 223621e709aaSMarc-André Lureauif test "$modules" = "yes" && test "$mingw32" = "yes" ; then 223721e709aaSMarc-André Lureau error_exit "Modules are not available for Windows" 223821e709aaSMarc-André Lureaufi 223921e709aaSMarc-André Lureau 2240bd83c861SChristian Ehrhardt# module_upgrades is only reasonable if modules are enabled 2241bd83c861SChristian Ehrhardtif test "$modules" = "no" && test "$module_upgrades" = "yes" ; then 2242bd83c861SChristian Ehrhardt error_exit "Can't enable module-upgrades as Modules are not enabled" 2243bd83c861SChristian Ehrhardtfi 2244bd83c861SChristian Ehrhardt 2245d376e9deSThomas Huth# Static linking is not possible with modules or PIE 224640d6444eSAvi Kivityif test "$static" = "yes" ; then 2247aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 2248aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 2249aa0d1f44SPaolo Bonzini fi 225040d6444eSAvi Kivityfi 225140d6444eSAvi Kivity 2252768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 2253768b7855SEmilio G. Cota cat > $TMPC << EOF 2254768b7855SEmilio G. Cotastatic __thread int tls_var; 2255768b7855SEmilio G. Cotaint main(void) { return tls_var; } 2256768b7855SEmilio G. CotaEOF 2257768b7855SEmilio G. Cota 2258768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 2259768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 2260768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 2261768b7855SEmilio G. Cotafi 2262768b7855SEmilio G. Cota 226340d6444eSAvi Kivitycat > $TMPC << EOF 226421d4a791SAvi Kivity 226521d4a791SAvi Kivity#ifdef __linux__ 226621d4a791SAvi Kivity# define THREAD __thread 226721d4a791SAvi Kivity#else 226821d4a791SAvi Kivity# define THREAD 226921d4a791SAvi Kivity#endif 227021d4a791SAvi Kivitystatic THREAD int tls_var; 227121d4a791SAvi Kivityint main(void) { return tls_var; } 227240d6444eSAvi KivityEOF 2273b2634124SRichard Henderson 2274b2634124SRichard Henderson# Check we support --no-pie first; we will need this for building ROMs. 2275412aeacdSAlex Bennéeif compile_prog "-Werror -fno-pie" "-no-pie"; then 2276412aeacdSAlex Bennée CFLAGS_NOPIE="-fno-pie" 2277b2634124SRichard Henderson LDFLAGS_NOPIE="-no-pie" 2278412aeacdSAlex Bennéefi 2279412aeacdSAlex Bennée 228012781462SRichard Hendersonif test "$static" = "yes"; then 2281eca7a8e6SRichard Henderson if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then 2282086d5f75SPaolo Bonzini CFLAGS="-fPIE -DPIE $CFLAGS" 228312781462SRichard Henderson QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" 228412781462SRichard Henderson pie="yes" 228512781462SRichard Henderson elif test "$pie" = "yes"; then 228612781462SRichard Henderson error_exit "-static-pie not available due to missing toolchain support" 228712781462SRichard Henderson else 228812781462SRichard Henderson QEMU_LDFLAGS="-static $QEMU_LDFLAGS" 228912781462SRichard Henderson pie="no" 229012781462SRichard Henderson fi 229112781462SRichard Hendersonelif test "$pie" = "no"; then 2292086d5f75SPaolo Bonzini CFLAGS="$CFLAGS_NOPIE $CFLAGS" 2293086d5f75SPaolo Bonzini LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS" 2294eca7a8e6SRichard Hendersonelif compile_prog "-Werror -fPIE -DPIE" "-pie"; then 2295086d5f75SPaolo Bonzini CFLAGS="-fPIE -DPIE $CFLAGS" 2296086d5f75SPaolo Bonzini LDFLAGS="-pie $LDFLAGS" 229740d6444eSAvi Kivity pie="yes" 22982c674109SRichard Hendersonelif test "$pie" = "yes"; then 229976ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 230040d6444eSAvi Kivityelse 230140d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 230240d6444eSAvi Kivity pie="no" 230340d6444eSAvi Kivityfi 230440d6444eSAvi Kivity 2305e6cbd751SRichard Henderson# Detect support for PT_GNU_RELRO + DT_BIND_NOW. 2306e6cbd751SRichard Henderson# The combination is known as "full relro", because .got.plt is read-only too. 2307e6cbd751SRichard Hendersonif compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 2308e6cbd751SRichard Henderson QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" 2309e6cbd751SRichard Hendersonfi 2310e6cbd751SRichard Henderson 231109dada40SPaolo Bonzini########################################## 231209dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 231309dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 231409dada40SPaolo Bonzini# specification is necessary 231509dada40SPaolo Bonzini 231609dada40SPaolo Bonziniif test "$cpu" = "i386"; then 231709dada40SPaolo Bonzini cat > $TMPC << EOF 231809dada40SPaolo Bonzinistatic int sfaa(int *ptr) 231909dada40SPaolo Bonzini{ 232009dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 232109dada40SPaolo Bonzini} 232209dada40SPaolo Bonzini 232309dada40SPaolo Bonziniint main(void) 232409dada40SPaolo Bonzini{ 232509dada40SPaolo Bonzini int val = 42; 23261405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 232709dada40SPaolo Bonzini sfaa(&val); 232809dada40SPaolo Bonzini return val; 232909dada40SPaolo Bonzini} 233009dada40SPaolo BonziniEOF 233109dada40SPaolo Bonzini if ! compile_prog "" "" ; then 233209dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 233309dada40SPaolo Bonzini fi 233409dada40SPaolo Bonzinifi 233509dada40SPaolo Bonzini 233609dada40SPaolo Bonzini######################################### 2337ec530c81Sbellard# Solaris specific configure tool chain decisions 233809dada40SPaolo Bonzini 2339ec530c81Sbellardif test "$solaris" = "yes" ; then 23406792aa11SLoïc Minier if has $install; then 23416792aa11SLoïc Minier : 23426792aa11SLoïc Minier else 234376ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 234476ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 234576ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 2346ec530c81Sbellard fi 234789138857SStefan Weil if test "$(path_of $install)" = "/usr/sbin/install" ; then 234876ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 234976ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 235076ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 2351ec530c81Sbellard fi 23526792aa11SLoïc Minier if has ar; then 23536792aa11SLoïc Minier : 23546792aa11SLoïc Minier else 2355ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 235676ad07a4SPeter Maydell error_exit "No path includes ar" \ 235776ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 2358ec530c81Sbellard fi 235976ad07a4SPeter Maydell error_exit "No path includes ar" 2360ec530c81Sbellard fi 2361ec530c81Sbellardfi 2362ec530c81Sbellard 2363afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 2364d880a3baSPaolo Bonzini for target in $default_target_list; do 2365d880a3baSPaolo Bonzini supported_target $target 2>/dev/null && \ 2366d880a3baSPaolo Bonzini target_list="$target_list $target" 2367d880a3baSPaolo Bonzini done 2368d880a3baSPaolo Bonzini target_list="${target_list# }" 2369121afa9eSAnthony Liguorielse 237089138857SStefan Weil target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2371d880a3baSPaolo Bonzini for target in $target_list; do 237225b48338SPeter Maydell # Check that we recognised the target name; this allows a more 237325b48338SPeter Maydell # friendly error message than if we let it fall through. 237425b48338SPeter Maydell case " $default_target_list " in 237525b48338SPeter Maydell *" $target "*) 237625b48338SPeter Maydell ;; 237725b48338SPeter Maydell *) 237825b48338SPeter Maydell error_exit "Unknown target name '$target'" 237925b48338SPeter Maydell ;; 238025b48338SPeter Maydell esac 2381d880a3baSPaolo Bonzini supported_target $target || exit 1 238225b48338SPeter Maydell done 2383d880a3baSPaolo Bonzinifi 238425b48338SPeter Maydell 2385f55fe278SPaolo Bonzini# see if system emulation was really requested 2386f55fe278SPaolo Bonzinicase " $target_list " in 2387f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 2388f55fe278SPaolo Bonzini ;; 2389f55fe278SPaolo Bonzini *) softmmu=no 2390f55fe278SPaolo Bonzini ;; 2391f55fe278SPaolo Bonziniesac 23925327cf48Sbellard 239305dfa22bSPhilippe Mathieu-Daudéfor target in $target_list; do 239405dfa22bSPhilippe Mathieu-Daudé case "$target" in 239505dfa22bSPhilippe Mathieu-Daudé arm-softmmu | aarch64-softmmu | i386-softmmu | x86_64-softmmu) 239605dfa22bSPhilippe Mathieu-Daudé edk2_blobs="yes" 239705dfa22bSPhilippe Mathieu-Daudé ;; 239805dfa22bSPhilippe Mathieu-Daudé esac 239905dfa22bSPhilippe Mathieu-Daudédone 2400623ef637SPhilippe Mathieu-Daudé# The EDK2 binaries are compressed with bzip2 2401623ef637SPhilippe Mathieu-Daudéif test "$edk2_blobs" = "yes" && ! has bzip2; then 2402623ef637SPhilippe Mathieu-Daudé error_exit "The bzip2 program is required for building QEMU" 2403623ef637SPhilippe Mathieu-Daudéfi 240405dfa22bSPhilippe Mathieu-Daudé 2405249247c9SJuan Quintelafeature_not_found() { 2406249247c9SJuan Quintela feature=$1 240721684af0SStewart Smith remedy=$2 2408249247c9SJuan Quintela 240976ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 241021684af0SStewart Smith "configure was not able to find it." \ 241121684af0SStewart Smith "$remedy" 2412249247c9SJuan Quintela} 2413249247c9SJuan Quintela 24147d13299dSbellard# --- 24157d13299dSbellard# big/little endian test 24167d13299dSbellardcat > $TMPC << EOF 241761cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 241861cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 241961cc919fSMike Frysingerextern int foo(short *, short *); 242061cc919fSMike Frysingerint main(int argc, char *argv[]) { 242161cc919fSMike Frysinger return foo(big_endian, little_endian); 24227d13299dSbellard} 24237d13299dSbellardEOF 24247d13299dSbellard 242561cc919fSMike Frysingerif compile_object ; then 242612f15c91SAlice Frosi if strings -a $TMPO | grep -q BiGeNdIaN ; then 242761cc919fSMike Frysinger bigendian="yes" 242812f15c91SAlice Frosi elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then 242961cc919fSMike Frysinger bigendian="no" 24307d13299dSbellard else 24317d13299dSbellard echo big/little test failed 24327d13299dSbellard fi 24337d13299dSbellardelse 243461cc919fSMike Frysinger echo big/little test failed 24357d13299dSbellardfi 24367d13299dSbellard 2437b0a47e79SJuan Quintela########################################## 2438e10ee3f5SPhilippe Mathieu-Daudé# system tools 2439e10ee3f5SPhilippe Mathieu-Daudéif test -z "$want_tools"; then 2440e10ee3f5SPhilippe Mathieu-Daudé if test "$softmmu" = "no"; then 2441e10ee3f5SPhilippe Mathieu-Daudé want_tools=no 2442e10ee3f5SPhilippe Mathieu-Daudé else 2443e10ee3f5SPhilippe Mathieu-Daudé want_tools=yes 2444e10ee3f5SPhilippe Mathieu-Daudé fi 2445e10ee3f5SPhilippe Mathieu-Daudéfi 2446e10ee3f5SPhilippe Mathieu-Daudé 2447e10ee3f5SPhilippe Mathieu-Daudé########################################## 2448a30878e7SPeter Maydell# cocoa implies not SDL or GTK 2449a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 2450a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 2451a30878e7SPeter Maydellif test "$cocoa" = "yes"; then 2452a30878e7SPeter Maydell if test "$sdl" = "yes"; then 2453a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 2454a30878e7SPeter Maydell fi 2455a30878e7SPeter Maydell if test "$gtk" = "yes"; then 2456a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 2457a30878e7SPeter Maydell fi 2458a30878e7SPeter Maydell gtk=no 2459a30878e7SPeter Maydell sdl=no 2460a30878e7SPeter Maydellfi 2461a30878e7SPeter Maydell 24626b39b063SEric Blake# Some versions of Mac OS X incorrectly define SIZE_MAX 24636b39b063SEric Blakecat > $TMPC << EOF 24646b39b063SEric Blake#include <stdint.h> 24656b39b063SEric Blake#include <stdio.h> 24666b39b063SEric Blakeint main(int argc, char *argv[]) { 24676b39b063SEric Blake return printf("%zu", SIZE_MAX); 24686b39b063SEric Blake} 24696b39b063SEric BlakeEOF 24706b39b063SEric Blakehave_broken_size_max=no 24716b39b063SEric Blakeif ! compile_object -Werror ; then 24726b39b063SEric Blake have_broken_size_max=yes 24736b39b063SEric Blakefi 24746b39b063SEric Blake 2475a30878e7SPeter Maydell########################################## 2476015a33bdSGonglei# L2TPV3 probe 2477015a33bdSGonglei 2478015a33bdSGongleicat > $TMPC <<EOF 2479015a33bdSGonglei#include <sys/socket.h> 2480bff6cb72SMichael Tokarev#include <linux/ip.h> 2481015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 2482015a33bdSGongleiEOF 2483015a33bdSGongleiif compile_prog "" "" ; then 2484015a33bdSGonglei l2tpv3=yes 2485015a33bdSGongleielse 2486015a33bdSGonglei l2tpv3=no 2487015a33bdSGongleifi 2488015a33bdSGonglei 2489c9c8b88fSDavid CARLIERif check_include "pty.h" ; then 2490c9c8b88fSDavid CARLIER pty_h=yes 2491c9c8b88fSDavid CARLIERelse 2492c9c8b88fSDavid CARLIER pty_h=no 2493c9c8b88fSDavid CARLIERfi 2494c9c8b88fSDavid CARLIER 2495195588ccSDavid CARLIERcat > $TMPC <<EOF 2496195588ccSDavid CARLIER#include <sys/mman.h> 2497195588ccSDavid CARLIERint main(int argc, char *argv[]) { 2498195588ccSDavid CARLIER return mlockall(MCL_FUTURE); 2499195588ccSDavid CARLIER} 2500195588ccSDavid CARLIEREOF 2501195588ccSDavid CARLIERif compile_prog "" "" ; then 2502195588ccSDavid CARLIER have_mlockall=yes 2503195588ccSDavid CARLIERelse 2504195588ccSDavid CARLIER have_mlockall=no 2505195588ccSDavid CARLIERfi 2506195588ccSDavid CARLIER 2507299e6f19SPaolo Bonzini######################################### 2508299e6f19SPaolo Bonzini# vhost interdependencies and host support 2509299e6f19SPaolo Bonzini 2510299e6f19SPaolo Bonzini# vhost backends 2511299e6f19SPaolo Bonzinitest "$vhost_user" = "" && vhost_user=yes 2512299e6f19SPaolo Bonziniif test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then 2513299e6f19SPaolo Bonzini error_exit "vhost-user isn't available on win32" 2514299e6f19SPaolo Bonzinifi 2515108a6481SCindy Lutest "$vhost_vdpa" = "" && vhost_vdpa=$linux 2516108a6481SCindy Luif test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then 2517108a6481SCindy Lu error_exit "vhost-vdpa is only available on Linux" 2518108a6481SCindy Lufi 2519299e6f19SPaolo Bonzinitest "$vhost_kernel" = "" && vhost_kernel=$linux 2520299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then 2521299e6f19SPaolo Bonzini error_exit "vhost-kernel is only available on Linux" 2522299e6f19SPaolo Bonzinifi 2523299e6f19SPaolo Bonzini 2524299e6f19SPaolo Bonzini# vhost-kernel devices 2525299e6f19SPaolo Bonzinitest "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel 2526299e6f19SPaolo Bonziniif test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then 2527299e6f19SPaolo Bonzini error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" 2528299e6f19SPaolo Bonzinifi 2529299e6f19SPaolo Bonzinitest "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel 2530299e6f19SPaolo Bonziniif test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then 2531299e6f19SPaolo Bonzini error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" 2532299e6f19SPaolo Bonzinifi 2533299e6f19SPaolo Bonzini 2534299e6f19SPaolo Bonzini# vhost-user backends 2535299e6f19SPaolo Bonzinitest "$vhost_net_user" = "" && vhost_net_user=$vhost_user 2536299e6f19SPaolo Bonziniif test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then 2537299e6f19SPaolo Bonzini error_exit "--enable-vhost-net-user requires --enable-vhost-user" 2538299e6f19SPaolo Bonzinifi 2539299e6f19SPaolo Bonzinitest "$vhost_crypto" = "" && vhost_crypto=$vhost_user 2540299e6f19SPaolo Bonziniif test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then 2541299e6f19SPaolo Bonzini error_exit "--enable-vhost-crypto requires --enable-vhost-user" 2542299e6f19SPaolo Bonzinifi 254398fc1adaSDr. David Alan Gilberttest "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user 254498fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then 254598fc1adaSDr. David Alan Gilbert error_exit "--enable-vhost-user-fs requires --enable-vhost-user" 254698fc1adaSDr. David Alan Gilbertfi 2547108a6481SCindy Lu#vhost-vdpa backends 2548108a6481SCindy Lutest "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa 2549108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then 2550108a6481SCindy Lu error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa" 2551108a6481SCindy Lufi 2552299e6f19SPaolo Bonzini 2553299e6f19SPaolo Bonzini# OR the vhost-kernel and vhost-user values for simplicity 2554299e6f19SPaolo Bonziniif test "$vhost_net" = ""; then 2555299e6f19SPaolo Bonzini test "$vhost_net_user" = "yes" && vhost_net=yes 2556299e6f19SPaolo Bonzini test "$vhost_kernel" = "yes" && vhost_net=yes 2557299e6f19SPaolo Bonzinifi 2558299e6f19SPaolo Bonzini 2559015a33bdSGonglei########################################## 25604d9310f4SDaniel P. Berrange# MinGW / Mingw-w64 localtime_r/gmtime_r check 25614d9310f4SDaniel P. Berrange 25624d9310f4SDaniel P. Berrangeif test "$mingw32" = "yes"; then 25634d9310f4SDaniel P. Berrange # Some versions of MinGW / Mingw-w64 lack localtime_r 25644d9310f4SDaniel P. Berrange # and gmtime_r entirely. 25654d9310f4SDaniel P. Berrange # 25664d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 define a macro for 25674d9310f4SDaniel P. Berrange # localtime_r/gmtime_r. 25684d9310f4SDaniel P. Berrange # 25694d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 will define functions 25704d9310f4SDaniel P. Berrange # for localtime_r/gmtime_r, but only if you have 25714d9310f4SDaniel P. Berrange # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 25724d9310f4SDaniel P. Berrange # though, unistd.h and pthread.h both define 25734d9310f4SDaniel P. Berrange # that for you. 25744d9310f4SDaniel P. Berrange # 25754d9310f4SDaniel P. Berrange # So this #undef localtime_r and #include <unistd.h> 25764d9310f4SDaniel P. Berrange # are not in fact redundant. 25774d9310f4SDaniel P. Berrangecat > $TMPC << EOF 25784d9310f4SDaniel P. Berrange#include <unistd.h> 25794d9310f4SDaniel P. Berrange#include <time.h> 25804d9310f4SDaniel P. Berrange#undef localtime_r 25814d9310f4SDaniel P. Berrangeint main(void) { localtime_r(NULL, NULL); return 0; } 25824d9310f4SDaniel P. BerrangeEOF 25834d9310f4SDaniel P. Berrange if compile_prog "" "" ; then 25844d9310f4SDaniel P. Berrange localtime_r="yes" 25854d9310f4SDaniel P. Berrange else 25864d9310f4SDaniel P. Berrange localtime_r="no" 25874d9310f4SDaniel P. Berrange fi 25884d9310f4SDaniel P. Berrangefi 25894d9310f4SDaniel P. Berrange 25904d9310f4SDaniel P. Berrange########################################## 2591779ab5e3SStefan Weil# pkg-config probe 2592779ab5e3SStefan Weil 2593779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 259476ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 2595779ab5e3SStefan Weilfi 2596779ab5e3SStefan Weil 2597779ab5e3SStefan Weil########################################## 2598b0a47e79SJuan Quintela# NPTL probe 2599b0a47e79SJuan Quintela 260024cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 2601bd0c5661Spbrook cat > $TMPC <<EOF 2602bd0c5661Spbrook#include <sched.h> 260330813ceaSpbrook#include <linux/futex.h> 2604182eacc0SStefan Weilint main(void) { 2605bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 2606bd0c5661Spbrook#error bork 2607bd0c5661Spbrook#endif 2608182eacc0SStefan Weil return 0; 2609bd0c5661Spbrook} 2610bd0c5661SpbrookEOF 261124cb36a6SPeter Maydell if ! compile_object ; then 261221684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 2613b0a47e79SJuan Quintela fi 2614bd0c5661Spbrookfi 2615bd0c5661Spbrook 2616ac62922eSbalrog########################################## 2617607dacd0Sqiaonuohan# lzo check 2618607dacd0Sqiaonuohan 2619607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 2620607dacd0Sqiaonuohan cat > $TMPC << EOF 2621607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 2622607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 2623607dacd0SqiaonuohanEOF 2624607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 2625607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -llzo2" 2626b25c9dffSStefan Weil lzo="yes" 2627b25c9dffSStefan Weil else 2628b25c9dffSStefan Weil if test "$lzo" = "yes"; then 2629b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 2630b25c9dffSStefan Weil fi 2631b25c9dffSStefan Weil lzo="no" 2632b25c9dffSStefan Weil fi 2633607dacd0Sqiaonuohanfi 2634607dacd0Sqiaonuohan 2635607dacd0Sqiaonuohan########################################## 2636607dacd0Sqiaonuohan# snappy check 2637607dacd0Sqiaonuohan 2638607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 2639607dacd0Sqiaonuohan cat > $TMPC << EOF 2640607dacd0Sqiaonuohan#include <snappy-c.h> 2641607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 2642607dacd0SqiaonuohanEOF 2643607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 2644607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -lsnappy" 2645b25c9dffSStefan Weil snappy="yes" 2646b25c9dffSStefan Weil else 2647b25c9dffSStefan Weil if test "$snappy" = "yes"; then 2648b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 2649b25c9dffSStefan Weil fi 2650b25c9dffSStefan Weil snappy="no" 2651b25c9dffSStefan Weil fi 2652607dacd0Sqiaonuohanfi 2653607dacd0Sqiaonuohan 2654607dacd0Sqiaonuohan########################################## 26556b383c08SPeter Wu# bzip2 check 26566b383c08SPeter Wu 26576b383c08SPeter Wuif test "$bzip2" != "no" ; then 26586b383c08SPeter Wu cat > $TMPC << EOF 26596b383c08SPeter Wu#include <bzlib.h> 26606b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 26616b383c08SPeter WuEOF 26626b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 26636b383c08SPeter Wu bzip2="yes" 26646b383c08SPeter Wu else 26656b383c08SPeter Wu if test "$bzip2" = "yes"; then 26666b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 26676b383c08SPeter Wu fi 26686b383c08SPeter Wu bzip2="no" 26696b383c08SPeter Wu fi 26706b383c08SPeter Wufi 26716b383c08SPeter Wu 26726b383c08SPeter Wu########################################## 267383bc1f97SJulio Faracco# lzfse check 267483bc1f97SJulio Faracco 267583bc1f97SJulio Faraccoif test "$lzfse" != "no" ; then 267683bc1f97SJulio Faracco cat > $TMPC << EOF 267783bc1f97SJulio Faracco#include <lzfse.h> 267883bc1f97SJulio Faraccoint main(void) { lzfse_decode_scratch_size(); return 0; } 267983bc1f97SJulio FaraccoEOF 268083bc1f97SJulio Faracco if compile_prog "" "-llzfse" ; then 268183bc1f97SJulio Faracco lzfse="yes" 268283bc1f97SJulio Faracco else 268383bc1f97SJulio Faracco if test "$lzfse" = "yes"; then 268483bc1f97SJulio Faracco feature_not_found "lzfse" "Install lzfse devel" 268583bc1f97SJulio Faracco fi 268683bc1f97SJulio Faracco lzfse="no" 268783bc1f97SJulio Faracco fi 268883bc1f97SJulio Faraccofi 268983bc1f97SJulio Faracco 269083bc1f97SJulio Faracco########################################## 26913a678481SJuan Quintela# zstd check 26923a678481SJuan Quintela 26933a678481SJuan Quintelaif test "$zstd" != "no" ; then 2694297254c7SJuan Quintela libzstd_minver="1.4.0" 2695297254c7SJuan Quintela if $pkg_config --atleast-version=$libzstd_minver libzstd ; then 26963a678481SJuan Quintela zstd_cflags="$($pkg_config --cflags libzstd)" 26973a678481SJuan Quintela zstd_libs="$($pkg_config --libs libzstd)" 26983a678481SJuan Quintela LIBS="$zstd_libs $LIBS" 26993a678481SJuan Quintela QEMU_CFLAGS="$QEMU_CFLAGS $zstd_cflags" 27003a678481SJuan Quintela zstd="yes" 27013a678481SJuan Quintela else 27023a678481SJuan Quintela if test "$zstd" = "yes" ; then 27033a678481SJuan Quintela feature_not_found "libzstd" "Install libzstd devel" 27043a678481SJuan Quintela fi 27053a678481SJuan Quintela zstd="no" 27063a678481SJuan Quintela fi 27073a678481SJuan Quintelafi 27083a678481SJuan Quintela 27093a678481SJuan Quintela########################################## 2710f794573eSEduardo Otubo# libseccomp check 2711f794573eSEduardo Otubo 2712f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 27133e684455SMichael Strosaker libseccomp_minver="2.3.0" 271425ed0eccSHelge Deller if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 2715c3883e1fSFam Zheng seccomp_cflags="$($pkg_config --cflags libseccomp)" 2716c3883e1fSFam Zheng seccomp_libs="$($pkg_config --libs libseccomp)" 2717f794573eSEduardo Otubo seccomp="yes" 2718f794573eSEduardo Otubo else 2719f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 2720693e5910SAndrew Jones feature_not_found "libseccomp" \ 2721693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 2722896848f0SEduardo Otubo fi 2723e84d5956SYann E. MORIN seccomp="no" 2724f794573eSEduardo Otubo fi 2725f794573eSEduardo Otubofi 2726f794573eSEduardo Otubo########################################## 2727e37630caSaliguori# xen probe 2728e37630caSaliguori 2729fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 2730c1cdd9d5SJuergen Gross # Check whether Xen library path is specified via --extra-ldflags to avoid 2731c1cdd9d5SJuergen Gross # overriding this setting with pkg-config output. If not, try pkg-config 2732c1cdd9d5SJuergen Gross # to obtain all needed flags. 2733c1cdd9d5SJuergen Gross 2734c1cdd9d5SJuergen Gross if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ 2735c1cdd9d5SJuergen Gross $pkg_config --exists xencontrol ; then 2736c1cdd9d5SJuergen Gross xen_ctrl_version="$(printf '%d%02d%02d' \ 2737c1cdd9d5SJuergen Gross $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" 2738c1cdd9d5SJuergen Gross xen=yes 2739c1cdd9d5SJuergen Gross xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab" 2740c1cdd9d5SJuergen Gross xen_pc="$xen_pc xenevtchn xendevicemodel" 274158ea9a7aSAnthony PERARD if $pkg_config --exists xentoolcore; then 274258ea9a7aSAnthony PERARD xen_pc="$xen_pc xentoolcore" 274358ea9a7aSAnthony PERARD fi 2744c1cdd9d5SJuergen Gross QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" 2745c1cdd9d5SJuergen Gross libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu" 2746c1cdd9d5SJuergen Gross else 2747c1cdd9d5SJuergen Gross 2748b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 2749d9506cabSAnthony PERARD xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 2750d5b93ddfSAnthony PERARD 275150ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 275250ced5b3SStefan Weil # If no, we are done and there is no Xen support. 275350ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 275450ced5b3SStefan Weil 275550ced5b3SStefan Weil # Xen (any) 275650ced5b3SStefan Weil cat > $TMPC <<EOF 275750ced5b3SStefan Weil#include <xenctrl.h> 275850ced5b3SStefan Weilint main(void) { 275950ced5b3SStefan Weil return 0; 276050ced5b3SStefan Weil} 276150ced5b3SStefan WeilEOF 276250ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 276350ced5b3SStefan Weil # Xen not found 276450ced5b3SStefan Weil if test "$xen" = "yes" ; then 276521684af0SStewart Smith feature_not_found "xen" "Install xen devel" 276650ced5b3SStefan Weil fi 276750ced5b3SStefan Weil xen=no 276850ced5b3SStefan Weil 2769d5b93ddfSAnthony PERARD # Xen unstable 277069deef08SPeter Maydell elif 277169deef08SPeter Maydell cat > $TMPC <<EOF && 27722cbf8903SRoss Lagerwall#undef XC_WANT_COMPAT_DEVICEMODEL_API 27732cbf8903SRoss Lagerwall#define __XEN_TOOLS__ 27742cbf8903SRoss Lagerwall#include <xendevicemodel.h> 2775d3c49ebbSPaul Durrant#include <xenforeignmemory.h> 27762cbf8903SRoss Lagerwallint main(void) { 27772cbf8903SRoss Lagerwall xendevicemodel_handle *xd; 2778d3c49ebbSPaul Durrant xenforeignmemory_handle *xfmem; 27792cbf8903SRoss Lagerwall 27802cbf8903SRoss Lagerwall xd = xendevicemodel_open(0, 0); 27812cbf8903SRoss Lagerwall xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0); 27822cbf8903SRoss Lagerwall 2783d3c49ebbSPaul Durrant xfmem = xenforeignmemory_open(0, 0); 2784d3c49ebbSPaul Durrant xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0); 2785d3c49ebbSPaul Durrant 27862cbf8903SRoss Lagerwall return 0; 27872cbf8903SRoss Lagerwall} 27882cbf8903SRoss LagerwallEOF 27892cbf8903SRoss Lagerwall compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 27902cbf8903SRoss Lagerwall then 27912cbf8903SRoss Lagerwall xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 27922cbf8903SRoss Lagerwall xen_ctrl_version=41100 27932cbf8903SRoss Lagerwall xen=yes 27942cbf8903SRoss Lagerwall elif 27952cbf8903SRoss Lagerwall cat > $TMPC <<EOF && 27965ba3d756SIgor Druzhinin#undef XC_WANT_COMPAT_MAP_FOREIGN_API 27975ba3d756SIgor Druzhinin#include <xenforeignmemory.h> 279858ea9a7aSAnthony PERARD#include <xentoolcore.h> 27995ba3d756SIgor Druzhininint main(void) { 28005ba3d756SIgor Druzhinin xenforeignmemory_handle *xfmem; 28015ba3d756SIgor Druzhinin 28025ba3d756SIgor Druzhinin xfmem = xenforeignmemory_open(0, 0); 28035ba3d756SIgor Druzhinin xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0); 280458ea9a7aSAnthony PERARD xentoolcore_restrict_all(0); 28055ba3d756SIgor Druzhinin 28065ba3d756SIgor Druzhinin return 0; 28075ba3d756SIgor Druzhinin} 28085ba3d756SIgor DruzhininEOF 280958ea9a7aSAnthony PERARD compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore" 28105ba3d756SIgor Druzhinin then 281158ea9a7aSAnthony PERARD xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore" 28125ba3d756SIgor Druzhinin xen_ctrl_version=41000 28135ba3d756SIgor Druzhinin xen=yes 28145ba3d756SIgor Druzhinin elif 28155ba3d756SIgor Druzhinin cat > $TMPC <<EOF && 2816da8090ccSPaul Durrant#undef XC_WANT_COMPAT_DEVICEMODEL_API 2817da8090ccSPaul Durrant#define __XEN_TOOLS__ 2818da8090ccSPaul Durrant#include <xendevicemodel.h> 2819da8090ccSPaul Durrantint main(void) { 2820da8090ccSPaul Durrant xendevicemodel_handle *xd; 2821da8090ccSPaul Durrant 2822da8090ccSPaul Durrant xd = xendevicemodel_open(0, 0); 2823da8090ccSPaul Durrant xendevicemodel_close(xd); 2824da8090ccSPaul Durrant 2825da8090ccSPaul Durrant return 0; 2826da8090ccSPaul Durrant} 2827da8090ccSPaul DurrantEOF 2828da8090ccSPaul Durrant compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs" 2829da8090ccSPaul Durrant then 2830da8090ccSPaul Durrant xen_stable_libs="-lxendevicemodel $xen_stable_libs" 2831f1167ee6SJuergen Gross xen_ctrl_version=40900 2832da8090ccSPaul Durrant xen=yes 2833da8090ccSPaul Durrant elif 2834da8090ccSPaul Durrant cat > $TMPC <<EOF && 28355eeb39c2SIan Campbell/* 28365eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 28375eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 2838b6eb9b45SPaulina Szubarczyk * 2839b6eb9b45SPaulina Szubarczyk * Also, check if xengnttab_grant_copy_segment_t is defined and 2840b6eb9b45SPaulina Szubarczyk * grant copy operation is implemented. 2841b6eb9b45SPaulina Szubarczyk */ 2842b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_EVTCHN_API 2843b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_GNTTAB_API 2844b6eb9b45SPaulina Szubarczyk#undef XC_WANT_COMPAT_MAP_FOREIGN_API 2845b6eb9b45SPaulina Szubarczyk#include <xenctrl.h> 2846b6eb9b45SPaulina Szubarczyk#include <xenstore.h> 2847b6eb9b45SPaulina Szubarczyk#include <xenevtchn.h> 2848b6eb9b45SPaulina Szubarczyk#include <xengnttab.h> 2849b6eb9b45SPaulina Szubarczyk#include <xenforeignmemory.h> 2850b6eb9b45SPaulina Szubarczyk#include <stdint.h> 2851b6eb9b45SPaulina Szubarczyk#include <xen/hvm/hvm_info_table.h> 2852b6eb9b45SPaulina Szubarczyk#if !defined(HVM_MAX_VCPUS) 2853b6eb9b45SPaulina Szubarczyk# error HVM_MAX_VCPUS not defined 2854b6eb9b45SPaulina Szubarczyk#endif 2855b6eb9b45SPaulina Szubarczykint main(void) { 2856b6eb9b45SPaulina Szubarczyk xc_interface *xc = NULL; 2857b6eb9b45SPaulina Szubarczyk xenforeignmemory_handle *xfmem; 2858b6eb9b45SPaulina Szubarczyk xenevtchn_handle *xe; 2859b6eb9b45SPaulina Szubarczyk xengnttab_handle *xg; 2860b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy_segment_t* seg = NULL; 2861b6eb9b45SPaulina Szubarczyk 2862b6eb9b45SPaulina Szubarczyk xs_daemon_open(); 2863b6eb9b45SPaulina Szubarczyk 2864b6eb9b45SPaulina Szubarczyk xc = xc_interface_open(0, 0, 0); 2865b6eb9b45SPaulina Szubarczyk xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2866b6eb9b45SPaulina Szubarczyk xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2867b6eb9b45SPaulina Szubarczyk xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2868b6eb9b45SPaulina Szubarczyk xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 2869b6eb9b45SPaulina Szubarczyk 2870b6eb9b45SPaulina Szubarczyk xfmem = xenforeignmemory_open(0, 0); 2871b6eb9b45SPaulina Szubarczyk xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 2872b6eb9b45SPaulina Szubarczyk 2873b6eb9b45SPaulina Szubarczyk xe = xenevtchn_open(0, 0); 2874b6eb9b45SPaulina Szubarczyk xenevtchn_fd(xe); 2875b6eb9b45SPaulina Szubarczyk 2876b6eb9b45SPaulina Szubarczyk xg = xengnttab_open(0, 0); 2877b6eb9b45SPaulina Szubarczyk xengnttab_grant_copy(xg, 0, seg); 2878b6eb9b45SPaulina Szubarczyk 2879b6eb9b45SPaulina Szubarczyk return 0; 2880b6eb9b45SPaulina Szubarczyk} 2881b6eb9b45SPaulina SzubarczykEOF 2882b6eb9b45SPaulina Szubarczyk compile_prog "" "$xen_libs $xen_stable_libs" 2883b6eb9b45SPaulina Szubarczyk then 2884f1167ee6SJuergen Gross xen_ctrl_version=40800 2885b6eb9b45SPaulina Szubarczyk xen=yes 2886b6eb9b45SPaulina Szubarczyk elif 2887b6eb9b45SPaulina Szubarczyk cat > $TMPC <<EOF && 2888b6eb9b45SPaulina Szubarczyk/* 2889b6eb9b45SPaulina Szubarczyk * If we have stable libs the we don't want the libxc compat 2890b6eb9b45SPaulina Szubarczyk * layers, regardless of what CFLAGS we may have been given. 28915eeb39c2SIan Campbell */ 28925eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 28935eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 28945eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 28955eeb39c2SIan Campbell#include <xenctrl.h> 28965eeb39c2SIan Campbell#include <xenstore.h> 28975eeb39c2SIan Campbell#include <xenevtchn.h> 28985eeb39c2SIan Campbell#include <xengnttab.h> 28995eeb39c2SIan Campbell#include <xenforeignmemory.h> 29005eeb39c2SIan Campbell#include <stdint.h> 29015eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 29025eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 29035eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 29045eeb39c2SIan Campbell#endif 29055eeb39c2SIan Campbellint main(void) { 29065eeb39c2SIan Campbell xc_interface *xc = NULL; 29075eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 29085eeb39c2SIan Campbell xenevtchn_handle *xe; 29095eeb39c2SIan Campbell xengnttab_handle *xg; 29105eeb39c2SIan Campbell 29115eeb39c2SIan Campbell xs_daemon_open(); 29125eeb39c2SIan Campbell 29135eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 29145eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 29155eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 29165eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 29175eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 29185eeb39c2SIan Campbell 29195eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 29205eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 29215eeb39c2SIan Campbell 29225eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 29235eeb39c2SIan Campbell xenevtchn_fd(xe); 29245eeb39c2SIan Campbell 29255eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 29265eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 29275eeb39c2SIan Campbell 29285eeb39c2SIan Campbell return 0; 29295eeb39c2SIan Campbell} 29305eeb39c2SIan CampbellEOF 29315eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 29325eeb39c2SIan Campbell then 2933f1167ee6SJuergen Gross xen_ctrl_version=40701 29345eeb39c2SIan Campbell xen=yes 2935cdadde39SRoger Pau Monne 2936cdadde39SRoger Pau Monne # Xen 4.6 2937cdadde39SRoger Pau Monne elif 2938cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 2939cdadde39SRoger Pau Monne#include <xenctrl.h> 2940e108a3c1SAnthony PERARD#include <xenstore.h> 2941d5b93ddfSAnthony PERARD#include <stdint.h> 2942d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 2943d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 2944d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 2945d5b93ddfSAnthony PERARD#endif 2946d5b93ddfSAnthony PERARDint main(void) { 2947d5b93ddfSAnthony PERARD xc_interface *xc; 2948d5b93ddfSAnthony PERARD xs_daemon_open(); 2949d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 2950d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2951d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 2952b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 29538688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 2954d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 295520a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 2956d8b441a3SJan Beulich return 0; 2957d8b441a3SJan Beulich} 2958d8b441a3SJan BeulichEOF 2959d8b441a3SJan Beulich compile_prog "" "$xen_libs" 2960d8b441a3SJan Beulich then 2961f1167ee6SJuergen Gross xen_ctrl_version=40600 2962d8b441a3SJan Beulich xen=yes 2963d8b441a3SJan Beulich 2964d8b441a3SJan Beulich # Xen 4.5 2965d8b441a3SJan Beulich elif 2966d8b441a3SJan Beulich cat > $TMPC <<EOF && 2967d8b441a3SJan Beulich#include <xenctrl.h> 2968d8b441a3SJan Beulich#include <xenstore.h> 2969d8b441a3SJan Beulich#include <stdint.h> 2970d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2971d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2972d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2973d8b441a3SJan Beulich#endif 2974d8b441a3SJan Beulichint main(void) { 2975d8b441a3SJan Beulich xc_interface *xc; 2976d8b441a3SJan Beulich xs_daemon_open(); 2977d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2978d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2979d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2980d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2981d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 29823996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 29833996e85cSPaul Durrant return 0; 29843996e85cSPaul Durrant} 29853996e85cSPaul DurrantEOF 29863996e85cSPaul Durrant compile_prog "" "$xen_libs" 29873996e85cSPaul Durrant then 2988f1167ee6SJuergen Gross xen_ctrl_version=40500 29893996e85cSPaul Durrant xen=yes 29903996e85cSPaul Durrant 29913996e85cSPaul Durrant elif 29923996e85cSPaul Durrant cat > $TMPC <<EOF && 29933996e85cSPaul Durrant#include <xenctrl.h> 29943996e85cSPaul Durrant#include <xenstore.h> 29953996e85cSPaul Durrant#include <stdint.h> 29963996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 29973996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 29983996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 29993996e85cSPaul Durrant#endif 30003996e85cSPaul Durrantint main(void) { 30013996e85cSPaul Durrant xc_interface *xc; 30023996e85cSPaul Durrant xs_daemon_open(); 30033996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 30043996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 30053996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 30063996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 30073996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 30088688e065SStefano Stabellini return 0; 30098688e065SStefano Stabellini} 30108688e065SStefano StabelliniEOF 30118688e065SStefano Stabellini compile_prog "" "$xen_libs" 301269deef08SPeter Maydell then 3013f1167ee6SJuergen Gross xen_ctrl_version=40200 30148688e065SStefano Stabellini xen=yes 30158688e065SStefano Stabellini 3016e37630caSaliguori else 3017fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 3018edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 3019edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 3020fc321b4bSJuan Quintela fi 3021fc321b4bSJuan Quintela xen=no 3022e37630caSaliguori fi 3023d5b93ddfSAnthony PERARD 3024d5b93ddfSAnthony PERARD if test "$xen" = yes; then 3025f1167ee6SJuergen Gross if test $xen_ctrl_version -ge 40701 ; then 30265eeb39c2SIan Campbell libs_softmmu="$xen_stable_libs $libs_softmmu" 30275eeb39c2SIan Campbell fi 3028d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 3029d5b93ddfSAnthony PERARD fi 3030e37630caSaliguori fi 3031c1cdd9d5SJuergen Grossfi 3032e37630caSaliguori 3033eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 3034edfb07edSIan Campbell if test "$xen" = "yes" && test "$linux" = "yes"; then 3035eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 3036eb6fda0fSAnthony PERARD else 3037eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 303876ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 303976ad07a4SPeter Maydell " but this feature requires /sys from Linux" 3040eb6fda0fSAnthony PERARD fi 3041eb6fda0fSAnthony PERARD xen_pci_passthrough=no 3042eb6fda0fSAnthony PERARD fi 3043eb6fda0fSAnthony PERARDfi 3044eb6fda0fSAnthony PERARD 3045e37630caSaliguori########################################## 3046d661d9a4SJustin Terry (VM)# Windows Hypervisor Platform accelerator (WHPX) check 3047d661d9a4SJustin Terry (VM)if test "$whpx" != "no" ; then 3048327fccb2SLucian Petrut if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then 3049d661d9a4SJustin Terry (VM) whpx="yes" 3050d661d9a4SJustin Terry (VM) else 3051d661d9a4SJustin Terry (VM) if test "$whpx" = "yes"; then 305253537bb1SJustin Terry (VM) via Qemu-devel feature_not_found "WinHvPlatform" "WinHvEmulation is not installed" 3053d661d9a4SJustin Terry (VM) fi 3054d661d9a4SJustin Terry (VM) whpx="no" 3055d661d9a4SJustin Terry (VM) fi 3056d661d9a4SJustin Terry (VM)fi 3057d661d9a4SJustin Terry (VM) 3058d661d9a4SJustin Terry (VM)########################################## 3059dfffc653SJuan Quintela# Sparse probe 3060dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 3061*968b4db3SPaolo Bonzini if has sparse; then 3062dfffc653SJuan Quintela sparse=yes 3063dfffc653SJuan Quintela else 3064dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 306521684af0SStewart Smith feature_not_found "sparse" "Install sparse binary" 3066dfffc653SJuan Quintela fi 3067dfffc653SJuan Quintela sparse=no 3068dfffc653SJuan Quintela fi 3069dfffc653SJuan Quintelafi 3070dfffc653SJuan Quintela 3071dfffc653SJuan Quintela########################################## 3072f676c67eSJeremy White# X11 probe 3073f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 30748781595bSGerd Hoffmann have_x11=yes 307589138857SStefan Weil x11_cflags=$($pkg_config --cflags x11) 307689138857SStefan Weil x11_libs=$($pkg_config --libs x11) 3077f676c67eSJeremy Whitefi 3078f676c67eSJeremy White 3079f676c67eSJeremy White########################################## 3080a4ccabcfSAnthony Liguori# GTK probe 3081a4ccabcfSAnthony Liguori 30825a464e6cSPeter Xuif test "$gtk" != "no"; then 308389d85cdeSDaniel P. Berrangé gtkpackage="gtk+-3.0" 308489d85cdeSDaniel P. Berrangé gtkx11package="gtk+-x11-3.0" 30857b23d121SVolker Rümelin gtkversion="3.22.0" 3086bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 308789138857SStefan Weil gtk_cflags=$($pkg_config --cflags $gtkpackage) 308889138857SStefan Weil gtk_libs=$($pkg_config --libs $gtkpackage) 308989138857SStefan Weil gtk_version=$($pkg_config --modversion $gtkpackage) 30900a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 30918781595bSGerd Hoffmann need_x11=yes 3092f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 3093f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 30940a337ed0SGerd Hoffmann fi 3095bbbf9bfbSStefan Weil gtk="yes" 3096bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 30975fe309ffSGerd Hoffmann feature_not_found "gtk" "Install gtk3-devel" 3098bbbf9bfbSStefan Weil else 3099bbbf9bfbSStefan Weil gtk="no" 3100bbbf9bfbSStefan Weil fi 3101bbbf9bfbSStefan Weilfi 3102bbbf9bfbSStefan Weil 3103ddbb0d09SDaniel P. Berrange 3104ddbb0d09SDaniel P. Berrange########################################## 3105ddbb0d09SDaniel P. Berrange# GNUTLS probe 3106ddbb0d09SDaniel P. Berrange 3107ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 3108a73e82efSRichard Henderson pass="no" 3109a0722409SDaniel P. Berrangé if $pkg_config --exists "gnutls >= 3.1.18"; then 311089138857SStefan Weil gnutls_cflags=$($pkg_config --cflags gnutls) 311189138857SStefan Weil gnutls_libs=$($pkg_config --libs gnutls) 3112a73e82efSRichard Henderson # Packaging for the static libraries is not always correct. 3113a73e82efSRichard Henderson # At least ubuntu 18.04 ships only shared libraries. 3114a73e82efSRichard Henderson write_c_skeleton 3115a73e82efSRichard Henderson if compile_prog "" "$gnutls_libs" ; then 3116243dc2cfSRichard Henderson LIBS="$gnutls_libs $LIBS" 3117ddbb0d09SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 3118a73e82efSRichard Henderson pass="yes" 3119a73e82efSRichard Henderson fi 3120a73e82efSRichard Henderson fi 3121a73e82efSRichard Henderson if test "$pass" = "no" && test "$gnutls" = "yes"; then 3122a0722409SDaniel P. Berrangé feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" 3123ddbb0d09SDaniel P. Berrange else 3124a73e82efSRichard Henderson gnutls="$pass" 3125ddbb0d09SDaniel P. Berrange fi 3126ddbb0d09SDaniel P. Berrangefi 3127ddbb0d09SDaniel P. Berrange 312891bfcdb0SDaniel P. Berrange 312991bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 313091bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 3131a0722409SDaniel P. Berrangé# explicitly 313291bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 313391bfcdb0SDaniel P. Berrangethen 3134a0722409SDaniel P. Berrangé if test "$nettle" = "yes" 313591bfcdb0SDaniel P. Berrange then 313691bfcdb0SDaniel P. Berrange gcrypt="no" 313791bfcdb0SDaniel P. Berrange fi 313891bfcdb0SDaniel P. Berrangefi 313991bfcdb0SDaniel P. Berrange 314091bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 314191bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 3142a0722409SDaniel P. Berrangé# explicitly 314391bfcdb0SDaniel P. Berrangeif test -z "$nettle" 314491bfcdb0SDaniel P. Berrangethen 3145a0722409SDaniel P. Berrangé if test "$gcrypt" = "yes" 314691bfcdb0SDaniel P. Berrange then 314791bfcdb0SDaniel P. Berrange nettle="no" 314891bfcdb0SDaniel P. Berrange fi 314991bfcdb0SDaniel P. Berrangefi 315091bfcdb0SDaniel P. Berrange 3151dea7a64eSDaniel P. Berrangéhas_libgcrypt() { 315291bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 315391bfcdb0SDaniel P. Berrange then 315491bfcdb0SDaniel P. Berrange return 1 315591bfcdb0SDaniel P. Berrange fi 315691bfcdb0SDaniel P. Berrange 315791bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 315891bfcdb0SDaniel P. Berrange then 315989138857SStefan Weil host=$(libgcrypt-config --host) 316091bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 316191bfcdb0SDaniel P. Berrange then 316291bfcdb0SDaniel P. Berrange return 1 316391bfcdb0SDaniel P. Berrange fi 316491bfcdb0SDaniel P. Berrange fi 316591bfcdb0SDaniel P. Berrange 3166dea7a64eSDaniel P. Berrangé maj=`libgcrypt-config --version | awk -F . '{print $1}'` 3167dea7a64eSDaniel P. Berrangé min=`libgcrypt-config --version | awk -F . '{print $2}'` 3168dea7a64eSDaniel P. Berrangé 3169dea7a64eSDaniel P. Berrangé if test $maj != 1 || test $min -lt 5 3170dea7a64eSDaniel P. Berrangé then 3171dea7a64eSDaniel P. Berrangé return 1 3172dea7a64eSDaniel P. Berrangé fi 3173dea7a64eSDaniel P. Berrangé 317491bfcdb0SDaniel P. Berrange return 0 317591bfcdb0SDaniel P. Berrange} 317691bfcdb0SDaniel P. Berrange 3177a0722409SDaniel P. Berrangé 3178a0722409SDaniel P. Berrangéif test "$nettle" != "no"; then 3179a73e82efSRichard Henderson pass="no" 318064dd2f3bSDaniel P. Berrangé if $pkg_config --exists "nettle >= 2.7.1"; then 3181a0722409SDaniel P. Berrangé nettle_cflags=$($pkg_config --cflags nettle) 3182a0722409SDaniel P. Berrangé nettle_libs=$($pkg_config --libs nettle) 3183a0722409SDaniel P. Berrangé nettle_version=$($pkg_config --modversion nettle) 3184a73e82efSRichard Henderson # Link test to make sure the given libraries work (e.g for static). 3185a73e82efSRichard Henderson write_c_skeleton 3186a73e82efSRichard Henderson if compile_prog "" "$nettle_libs" ; then 3187243dc2cfSRichard Henderson LIBS="$nettle_libs $LIBS" 3188a0722409SDaniel P. Berrangé QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 3189a0722409SDaniel P. Berrangé if test -z "$gcrypt"; then 3190a0722409SDaniel P. Berrangé gcrypt="no" 3191a0722409SDaniel P. Berrangé fi 3192a73e82efSRichard Henderson pass="yes" 3193a73e82efSRichard Henderson fi 3194a73e82efSRichard Henderson fi 3195dc2207afSDaniel P. Berrangé if test "$pass" = "yes" 3196dc2207afSDaniel P. Berrangé then 3197dc2207afSDaniel P. Berrangé cat > $TMPC << EOF 3198dc2207afSDaniel P. Berrangé#include <nettle/xts.h> 3199dc2207afSDaniel P. Berrangéint main(void) { 3200dc2207afSDaniel P. Berrangé return 0; 3201dc2207afSDaniel P. Berrangé} 3202dc2207afSDaniel P. BerrangéEOF 3203dc2207afSDaniel P. Berrangé if compile_prog "$nettle_cflags" "$nettle_libs" ; then 3204dc2207afSDaniel P. Berrangé nettle_xts=yes 3205dc2207afSDaniel P. Berrangé qemu_private_xts=no 3206dc2207afSDaniel P. Berrangé fi 3207dc2207afSDaniel P. Berrangé fi 3208a73e82efSRichard Henderson if test "$pass" = "no" && test "$nettle" = "yes"; then 320964dd2f3bSDaniel P. Berrangé feature_not_found "nettle" "Install nettle devel >= 2.7.1" 3210a0722409SDaniel P. Berrangé else 3211a73e82efSRichard Henderson nettle="$pass" 3212a0722409SDaniel P. Berrangé fi 3213a0722409SDaniel P. Berrangéfi 3214a0722409SDaniel P. Berrangé 321591bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 3216a73e82efSRichard Henderson pass="no" 3217dea7a64eSDaniel P. Berrangé if has_libgcrypt; then 321889138857SStefan Weil gcrypt_cflags=$(libgcrypt-config --cflags) 321989138857SStefan Weil gcrypt_libs=$(libgcrypt-config --libs) 3220a73e82efSRichard Henderson # Debian has removed -lgpg-error from libgcrypt-config 322191bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 322291bfcdb0SDaniel P. Berrange # turn breaks static builds... 322391bfcdb0SDaniel P. Berrange if test "$static" = "yes" 322491bfcdb0SDaniel P. Berrange then 322591bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 322691bfcdb0SDaniel P. Berrange fi 32271f923c70SLongpeng(Mike) 3228a73e82efSRichard Henderson # Link test to make sure the given libraries work (e.g for static). 3229a73e82efSRichard Henderson write_c_skeleton 3230a73e82efSRichard Henderson if compile_prog "" "$gcrypt_libs" ; then 3231243dc2cfSRichard Henderson LIBS="$gcrypt_libs $LIBS" 323237788f25SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 3233a73e82efSRichard Henderson pass="yes" 3234a73e82efSRichard Henderson fi 3235a73e82efSRichard Henderson fi 3236a73e82efSRichard Henderson if test "$pass" = "yes"; then 323737788f25SDaniel P. Berrange gcrypt="yes" 32381f923c70SLongpeng(Mike) cat > $TMPC << EOF 32391f923c70SLongpeng(Mike)#include <gcrypt.h> 32401f923c70SLongpeng(Mike)int main(void) { 32411f923c70SLongpeng(Mike) gcry_mac_hd_t handle; 32421f923c70SLongpeng(Mike) gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5, 32431f923c70SLongpeng(Mike) GCRY_MAC_FLAG_SECURE, NULL); 32441f923c70SLongpeng(Mike) return 0; 32451f923c70SLongpeng(Mike)} 32461f923c70SLongpeng(Mike)EOF 32471f923c70SLongpeng(Mike) if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 32481f923c70SLongpeng(Mike) gcrypt_hmac=yes 32491f923c70SLongpeng(Mike) fi 3250e0576942SDaniel P. Berrangé cat > $TMPC << EOF 3251e0576942SDaniel P. Berrangé#include <gcrypt.h> 3252e0576942SDaniel P. Berrangéint main(void) { 3253e0576942SDaniel P. Berrangé gcry_cipher_hd_t handle; 3254e0576942SDaniel P. Berrangé gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); 3255e0576942SDaniel P. Berrangé return 0; 3256e0576942SDaniel P. Berrangé} 3257e0576942SDaniel P. BerrangéEOF 3258e0576942SDaniel P. Berrangé if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then 3259e0576942SDaniel P. Berrangé gcrypt_xts=yes 3260e0576942SDaniel P. Berrangé qemu_private_xts=no 3261e0576942SDaniel P. Berrangé fi 3262a73e82efSRichard Henderson elif test "$gcrypt" = "yes"; then 3263dea7a64eSDaniel P. Berrangé feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" 326491bfcdb0SDaniel P. Berrange else 326591bfcdb0SDaniel P. Berrange gcrypt="no" 326691bfcdb0SDaniel P. Berrange fi 326762893b67SDaniel P. Berrangefi 326862893b67SDaniel P. Berrange 3269ddbb0d09SDaniel P. Berrange 327091bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 327191bfcdb0SDaniel P. Berrangethen 327291bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 327391bfcdb0SDaniel P. Berrangefi 3274ed754746SDaniel P. Berrange 32759a2fd434SDaniel P. Berrange########################################## 32769a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 32779a2fd434SDaniel P. Berrange 32789a2fd434SDaniel P. Berrangetasn1=yes 327990246037SDaniel P. Berrangetasn1_cflags="" 328090246037SDaniel P. Berrangetasn1_libs="" 32819a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 328289138857SStefan Weil tasn1_cflags=$($pkg_config --cflags libtasn1) 328389138857SStefan Weil tasn1_libs=$($pkg_config --libs libtasn1) 32849a2fd434SDaniel P. Berrangeelse 32859a2fd434SDaniel P. Berrange tasn1=no 32869a2fd434SDaniel P. Berrangefi 32879a2fd434SDaniel P. Berrange 3288ed754746SDaniel P. Berrange 3289bbbf9bfbSStefan Weil########################################## 32908953caf3SDaniel P. Berrange# PAM probe 32918953caf3SDaniel P. Berrange 32928953caf3SDaniel P. Berrangeif test "$auth_pam" != "no"; then 32938953caf3SDaniel P. Berrange cat > $TMPC <<EOF 32948953caf3SDaniel P. Berrange#include <security/pam_appl.h> 32958953caf3SDaniel P. Berrange#include <stdio.h> 32968953caf3SDaniel P. Berrangeint main(void) { 32978953caf3SDaniel P. Berrange const char *service_name = "qemu"; 32988953caf3SDaniel P. Berrange const char *user = "frank"; 32999c9642d0SDr. David Alan Gilbert const struct pam_conv pam_conv = { 0 }; 33008953caf3SDaniel P. Berrange pam_handle_t *pamh = NULL; 33019c9642d0SDr. David Alan Gilbert pam_start(service_name, user, &pam_conv, &pamh); 33028953caf3SDaniel P. Berrange return 0; 33038953caf3SDaniel P. Berrange} 33048953caf3SDaniel P. BerrangeEOF 33058953caf3SDaniel P. Berrange if compile_prog "" "-lpam" ; then 33068953caf3SDaniel P. Berrange auth_pam=yes 33078953caf3SDaniel P. Berrange else 33088953caf3SDaniel P. Berrange if test "$auth_pam" = "yes"; then 33098953caf3SDaniel P. Berrange feature_not_found "PAM" "Install PAM development package" 33108953caf3SDaniel P. Berrange else 33118953caf3SDaniel P. Berrange auth_pam=no 33128953caf3SDaniel P. Berrange fi 33138953caf3SDaniel P. Berrange fi 33148953caf3SDaniel P. Berrangefi 33158953caf3SDaniel P. Berrange 33168953caf3SDaniel P. Berrange########################################## 3317559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 3318559607eaSDaniel P. Berrange 3319559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 3320559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 3321559607eaSDaniel P. Berrange have_ifaddrs_h=no 3322559607eaSDaniel P. Berrangefi 3323559607eaSDaniel P. Berrange 3324e865b97fSChen Gang######################################### 3325e865b97fSChen Gang# libdrm check 3326e865b97fSChen Ganghave_drm_h=no 3327e865b97fSChen Gangif check_include "libdrm/drm.h" ; then 3328e865b97fSChen Gang have_drm_h=yes 3329e865b97fSChen Gangfi 3330e865b97fSChen Gang 33312a4b472cSDavid CARLIER######################################### 33322a4b472cSDavid CARLIER# sys/signal.h check 33332a4b472cSDavid CARLIERhave_sys_signal_h=no 33342a4b472cSDavid CARLIERif check_include "sys/signal.h" ; then 33352a4b472cSDavid CARLIER have_sys_signal_h=yes 33362a4b472cSDavid CARLIERfi 33372a4b472cSDavid CARLIER 3338559607eaSDaniel P. Berrange########################################## 3339bbbf9bfbSStefan Weil# VTE probe 3340bbbf9bfbSStefan Weil 3341bbbf9bfbSStefan Weilif test "$vte" != "no"; then 3342c6feff9eSCole Robinson vteminversion="0.32.0" 3343c6feff9eSCole Robinson if $pkg_config --exists "vte-2.91"; then 3344c6feff9eSCole Robinson vtepackage="vte-2.91" 3345c6feff9eSCole Robinson else 3346528de90aSDaniel P. Berrange vtepackage="vte-2.90" 3347c6feff9eSCole Robinson fi 3348c6feff9eSCole Robinson if $pkg_config --exists "$vtepackage >= $vteminversion"; then 334989138857SStefan Weil vte_cflags=$($pkg_config --cflags $vtepackage) 335089138857SStefan Weil vte_libs=$($pkg_config --libs $vtepackage) 335189138857SStefan Weil vteversion=$($pkg_config --modversion $vtepackage) 3352bbbf9bfbSStefan Weil vte="yes" 3353bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 3354c6feff9eSCole Robinson feature_not_found "vte" "Install libvte-2.90/2.91 devel" 33559e04c683SStefan Weil else 3356bbbf9bfbSStefan Weil vte="no" 3357a4ccabcfSAnthony Liguori fi 3358a4ccabcfSAnthony Liguorifi 3359a4ccabcfSAnthony Liguori 3360a4ccabcfSAnthony Liguori########################################## 336111d9f695Sbellard# SDL probe 336211d9f695Sbellard 3363aee8a619SCarlo Marcelo Arenas Belón# Look for sdl configuration program (pkg-config or sdl2-config). Try 3364aee8a619SCarlo Marcelo Arenas Belón# sdl2-config even without cross prefix, and favour pkg-config over sdl2-config. 336547c03744SDave Airlie 3366c6093a05SPeter Xusdl_probe () 3367c6093a05SPeter Xu{ 33680015ca5cSDaniel P. Berrangé if $pkg_config sdl2 --exists; then 33690015ca5cSDaniel P. Berrangé sdlconfig="$pkg_config sdl2" 337089138857SStefan Weil sdlversion=$($sdlconfig --modversion 2>/dev/null) 3371aee8a619SCarlo Marcelo Arenas Belón elif has "$sdl2_config"; then 33720015ca5cSDaniel P. Berrangé sdlconfig="$sdl2_config" 337389138857SStefan Weil sdlversion=$($sdlconfig --version) 3374a0dfd8a4SLoïc Minier else 3375a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 33768f4ea9cdSGerd Hoffmann feature_not_found "sdl" "Install SDL2-devel" 3377a0dfd8a4SLoïc Minier fi 3378a0dfd8a4SLoïc Minier sdl=no 3379c6093a05SPeter Xu # no need to do the rest 3380c6093a05SPeter Xu return 33819316f803SPaolo Bonzini fi 3382aee8a619SCarlo Marcelo Arenas Belón if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then 33833ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 33843ec87ffeSPaolo Bonzini fi 338511d9f695Sbellard 338611d9f695Sbellard cat > $TMPC << EOF 338711d9f695Sbellard#include <SDL.h> 338811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 338911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 339011d9f695SbellardEOF 339189138857SStefan Weil sdl_cflags=$($sdlconfig --cflags 2>/dev/null) 33922ca5c430SGerd Hoffmann sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug 339374f42e18STeLeMan if test "$static" = "yes" ; then 33940015ca5cSDaniel P. Berrangé if $pkg_config sdl2 --exists; then 33950015ca5cSDaniel P. Berrangé sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null) 33965f37e6d4SThomas Huth else 339789138857SStefan Weil sdl_libs=$($sdlconfig --static-libs 2>/dev/null) 33985f37e6d4SThomas Huth fi 339974f42e18STeLeMan else 340089138857SStefan Weil sdl_libs=$($sdlconfig --libs 2>/dev/null) 340174f42e18STeLeMan fi 340252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 340311d9f695Sbellard sdl=yes 34047c1f25b4Sbellard 340567c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 3406e633a5c6SEric Blake if test "$sdl" = "yes" && test "$static" = "yes" ; then 340767c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 340889138857SStefan Weil sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" 340989138857SStefan Weil sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" 341011d9f695Sbellard fi 341152166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 34121ac88f28SJuan Quintela : 34131ac88f28SJuan Quintela else 34141ac88f28SJuan Quintela sdl=no 34157c1f25b4Sbellard fi 34167c1f25b4Sbellard fi # static link 3417c4198157SJuan Quintela else # sdl not found 3418c4198157SJuan Quintela if test "$sdl" = "yes" ; then 34190015ca5cSDaniel P. Berrangé feature_not_found "sdl" "Install SDL2 devel" 3420c4198157SJuan Quintela fi 3421c4198157SJuan Quintela sdl=no 34227c1f25b4Sbellard fi # sdl compile test 3423c6093a05SPeter Xu} 3424c6093a05SPeter Xu 3425a442fe2fSDaniel P. Berrangésdl_image_probe () 3426a442fe2fSDaniel P. Berrangé{ 3427a442fe2fSDaniel P. Berrangé if test "$sdl_image" != "no" ; then 3428a442fe2fSDaniel P. Berrangé if $pkg_config SDL2_image --exists; then 3429a442fe2fSDaniel P. Berrangé if test "$static" = "yes"; then 3430a442fe2fSDaniel P. Berrangé sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null) 3431a442fe2fSDaniel P. Berrangé else 3432a442fe2fSDaniel P. Berrangé sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null) 3433a442fe2fSDaniel P. Berrangé fi 3434a442fe2fSDaniel P. Berrangé sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null) 3435a442fe2fSDaniel P. Berrangé sdl_image=yes 3436a442fe2fSDaniel P. Berrangé 3437a442fe2fSDaniel P. Berrangé sdl_cflags="$sdl_cflags $sdl_image_cflags" 3438a442fe2fSDaniel P. Berrangé sdl_libs="$sdl_libs $sdl_image_libs" 3439a442fe2fSDaniel P. Berrangé else 3440a442fe2fSDaniel P. Berrangé if test "$sdl_image" = "yes" ; then 3441a442fe2fSDaniel P. Berrangé feature_not_found "sdl_image" "Install SDL Image devel" 3442a442fe2fSDaniel P. Berrangé else 3443a442fe2fSDaniel P. Berrangé sdl_image=no 3444a442fe2fSDaniel P. Berrangé fi 3445a442fe2fSDaniel P. Berrangé fi 3446a442fe2fSDaniel P. Berrangé fi 3447a442fe2fSDaniel P. Berrangé} 3448a442fe2fSDaniel P. Berrangé 3449c6093a05SPeter Xuif test "$sdl" != "no" ; then 3450c6093a05SPeter Xu sdl_probe 3451fd677642Sthsfi 345211d9f695Sbellard 34535368a422Saliguoriif test "$sdl" = "yes" ; then 3454a442fe2fSDaniel P. Berrangé sdl_image_probe 3455a442fe2fSDaniel P. Berrangéelse 3456a442fe2fSDaniel P. Berrangé if test "$sdl_image" = "yes"; then 3457a442fe2fSDaniel P. Berrangé echo "warning: SDL Image requested, but SDL is not available, disabling" 3458a442fe2fSDaniel P. Berrangé fi 3459a442fe2fSDaniel P. Berrangé sdl_image=no 3460a442fe2fSDaniel P. Berrangéfi 3461a442fe2fSDaniel P. Berrangé 3462a442fe2fSDaniel P. Berrangéif test "$sdl" = "yes" ; then 34635368a422Saliguori cat > $TMPC <<EOF 34645368a422Saliguori#include <SDL.h> 34655368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 34665368a422Saliguori#include <X11/XKBlib.h> 34675368a422Saliguori#else 34685368a422Saliguori#error No x11 support 34695368a422Saliguori#endif 34705368a422Saliguoriint main(void) { return 0; } 34715368a422SaliguoriEOF 3472f676c67eSJeremy White if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then 34738781595bSGerd Hoffmann need_x11=yes 3474f676c67eSJeremy White sdl_cflags="$sdl_cflags $x11_cflags" 3475f676c67eSJeremy White sdl_libs="$sdl_libs $x11_libs" 34765368a422Saliguori fi 34775368a422Saliguorifi 34785368a422Saliguori 34798f28f3fbSths########################################## 34802da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 34812da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 34822da776dbSMichael R. Hines cat > $TMPC <<EOF 34832da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 34842da776dbSMichael R. Hinesint main(void) { return 0; } 34852da776dbSMichael R. HinesEOF 3486ef6d4ccdSYuval Shaia rdma_libs="-lrdmacm -libverbs -libumad" 34872da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 34882da776dbSMichael R. Hines rdma="yes" 3489ef6d4ccdSYuval Shaia libs_softmmu="$libs_softmmu $rdma_libs" 34902da776dbSMichael R. Hines else 34912da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 34922da776dbSMichael R. Hines error_exit \ 3493ef6d4ccdSYuval Shaia " OpenFabrics librdmacm/libibverbs/libibumad not present." \ 34942da776dbSMichael R. Hines " Your options:" \ 3495ef6d4ccdSYuval Shaia " (1) Fast: Install infiniband packages (devel) from your distro." \ 34962da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 34972da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 34982da776dbSMichael R. Hines fi 34992da776dbSMichael R. Hines rdma="no" 35002da776dbSMichael R. Hines fi 35012da776dbSMichael R. Hinesfi 35022da776dbSMichael R. Hines 350321ab34c9SMarcel Apfelbaum########################################## 350421ab34c9SMarcel Apfelbaum# PVRDMA detection 350521ab34c9SMarcel Apfelbaum 350621ab34c9SMarcel Apfelbaumcat > $TMPC <<EOF && 350721ab34c9SMarcel Apfelbaum#include <sys/mman.h> 350821ab34c9SMarcel Apfelbaum 350921ab34c9SMarcel Apfelbaumint 351021ab34c9SMarcel Apfelbaummain(void) 351121ab34c9SMarcel Apfelbaum{ 351221ab34c9SMarcel Apfelbaum char buf = 0; 351321ab34c9SMarcel Apfelbaum void *addr = &buf; 351421ab34c9SMarcel Apfelbaum addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED); 351521ab34c9SMarcel Apfelbaum 351621ab34c9SMarcel Apfelbaum return 0; 351721ab34c9SMarcel Apfelbaum} 351821ab34c9SMarcel ApfelbaumEOF 351921ab34c9SMarcel Apfelbaum 352021ab34c9SMarcel Apfelbaumif test "$rdma" = "yes" ; then 352121ab34c9SMarcel Apfelbaum case "$pvrdma" in 352221ab34c9SMarcel Apfelbaum "") 352321ab34c9SMarcel Apfelbaum if compile_prog "" ""; then 352421ab34c9SMarcel Apfelbaum pvrdma="yes" 352521ab34c9SMarcel Apfelbaum else 352621ab34c9SMarcel Apfelbaum pvrdma="no" 352721ab34c9SMarcel Apfelbaum fi 352821ab34c9SMarcel Apfelbaum ;; 352921ab34c9SMarcel Apfelbaum "yes") 353021ab34c9SMarcel Apfelbaum if ! compile_prog "" ""; then 353121ab34c9SMarcel Apfelbaum error_exit "PVRDMA is not supported since mremap is not implemented" 353221ab34c9SMarcel Apfelbaum fi 353321ab34c9SMarcel Apfelbaum pvrdma="yes" 353421ab34c9SMarcel Apfelbaum ;; 353521ab34c9SMarcel Apfelbaum "no") 353621ab34c9SMarcel Apfelbaum pvrdma="no" 353721ab34c9SMarcel Apfelbaum ;; 353821ab34c9SMarcel Apfelbaum esac 353921ab34c9SMarcel Apfelbaumelse 354021ab34c9SMarcel Apfelbaum if test "$pvrdma" = "yes" ; then 354121ab34c9SMarcel Apfelbaum error_exit "PVRDMA requires rdma suppport" 354221ab34c9SMarcel Apfelbaum fi 354321ab34c9SMarcel Apfelbaum pvrdma="no" 354421ab34c9SMarcel Apfelbaumfi 354595c6bff3SBenoît Canet 3546ee108585SYuval Shaia# Let's see if enhanced reg_mr is supported 3547ee108585SYuval Shaiaif test "$pvrdma" = "yes" ; then 3548ee108585SYuval Shaia 3549ee108585SYuval Shaiacat > $TMPC <<EOF && 3550ee108585SYuval Shaia#include <infiniband/verbs.h> 3551ee108585SYuval Shaia 3552ee108585SYuval Shaiaint 3553ee108585SYuval Shaiamain(void) 3554ee108585SYuval Shaia{ 3555ee108585SYuval Shaia struct ibv_mr *mr; 3556ee108585SYuval Shaia struct ibv_pd *pd = NULL; 3557ee108585SYuval Shaia size_t length = 10; 3558ee108585SYuval Shaia uint64_t iova = 0; 3559ee108585SYuval Shaia int access = 0; 3560ee108585SYuval Shaia void *addr = NULL; 3561ee108585SYuval Shaia 3562ee108585SYuval Shaia mr = ibv_reg_mr_iova(pd, addr, length, iova, access); 3563ee108585SYuval Shaia 3564ee108585SYuval Shaia ibv_dereg_mr(mr); 3565ee108585SYuval Shaia 3566ee108585SYuval Shaia return 0; 3567ee108585SYuval Shaia} 3568ee108585SYuval ShaiaEOF 3569ee108585SYuval Shaia if ! compile_prog "" "-libverbs"; then 3570ee108585SYuval Shaia QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" 3571ee108585SYuval Shaia fi 3572ee108585SYuval Shaiafi 3573ee108585SYuval Shaia 357495c6bff3SBenoît Canet########################################## 35752f9606b3Saliguori# VNC SASL detection 3576e633a5c6SEric Blakeif test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then 35772f9606b3Saliguori cat > $TMPC <<EOF 35782f9606b3Saliguori#include <sasl/sasl.h> 35792f9606b3Saliguori#include <stdio.h> 35802f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 35812f9606b3SaliguoriEOF 35822f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 3583bd702ffcSPhilippe Mathieu-Daudé # QEMU defines struct iovec in "qemu/osdep.h", 3584bd702ffcSPhilippe Mathieu-Daudé # we don't want libsasl to redefine it in <sasl/sasl.h>. 3585bd702ffcSPhilippe Mathieu-Daudé vnc_sasl_cflags="-DSTRUCT_IOVEC_DEFINED" 35862f9606b3Saliguori vnc_sasl_libs="-lsasl2" 358752166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 3588ea784e3bSJuan Quintela vnc_sasl=yes 3589fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 3590ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 35912f9606b3Saliguori else 3592ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 359321684af0SStewart Smith feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 3594ea784e3bSJuan Quintela fi 3595ea784e3bSJuan Quintela vnc_sasl=no 35962f9606b3Saliguori fi 35972f9606b3Saliguorifi 35982f9606b3Saliguori 35992f9606b3Saliguori########################################## 36002f6f5c7aSCorentin Chary# VNC JPEG detection 3601e633a5c6SEric Blakeif test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then 36022f6f5c7aSCorentin Charycat > $TMPC <<EOF 36032f6f5c7aSCorentin Chary#include <stdio.h> 36042f6f5c7aSCorentin Chary#include <jpeglib.h> 36052f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 36062f6f5c7aSCorentin CharyEOF 36072f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 36082f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 36092f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 36102f6f5c7aSCorentin Chary vnc_jpeg=yes 36112f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 3612ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 36132f6f5c7aSCorentin Chary else 36142f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 361521684af0SStewart Smith feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 36162f6f5c7aSCorentin Chary fi 36172f6f5c7aSCorentin Chary vnc_jpeg=no 36182f6f5c7aSCorentin Chary fi 36192f6f5c7aSCorentin Charyfi 36202f6f5c7aSCorentin Chary 36212f6f5c7aSCorentin Chary########################################## 3622efe556adSCorentin Chary# VNC PNG detection 3623e633a5c6SEric Blakeif test "$vnc" = "yes" && test "$vnc_png" != "no" ; then 3624efe556adSCorentin Charycat > $TMPC <<EOF 3625efe556adSCorentin Chary//#include <stdio.h> 3626efe556adSCorentin Chary#include <png.h> 3627832ce9c2SScott Wood#include <stddef.h> 3628efe556adSCorentin Charyint main(void) { 3629efe556adSCorentin Chary png_structp png_ptr; 3630efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 36317edc3fedSPeter Maydell return png_ptr != 0; 3632efe556adSCorentin Chary} 3633efe556adSCorentin CharyEOF 363465d5d3f9SStefan Weil if $pkg_config libpng --exists; then 363589138857SStefan Weil vnc_png_cflags=$($pkg_config libpng --cflags) 363689138857SStefan Weil vnc_png_libs=$($pkg_config libpng --libs) 36379af8025eSBrad else 3638efe556adSCorentin Chary vnc_png_cflags="" 3639efe556adSCorentin Chary vnc_png_libs="-lpng" 36409af8025eSBrad fi 3641efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 3642efe556adSCorentin Chary vnc_png=yes 3643efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 36449af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 3645efe556adSCorentin Chary else 3646efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 364721684af0SStewart Smith feature_not_found "vnc-png" "Install libpng devel" 3648efe556adSCorentin Chary fi 3649efe556adSCorentin Chary vnc_png=no 3650efe556adSCorentin Chary fi 3651efe556adSCorentin Charyfi 3652efe556adSCorentin Chary 3653efe556adSCorentin Chary########################################## 36546a021536SGerd Hoffmann# xkbcommon probe 36556a021536SGerd Hoffmannif test "$xkbcommon" != "no" ; then 36566a021536SGerd Hoffmann if $pkg_config xkbcommon --exists; then 36576a021536SGerd Hoffmann xkbcommon_cflags=$($pkg_config xkbcommon --cflags) 36586a021536SGerd Hoffmann xkbcommon_libs=$($pkg_config xkbcommon --libs) 36596a021536SGerd Hoffmann xkbcommon=yes 36606a021536SGerd Hoffmann else 36616a021536SGerd Hoffmann if test "$xkbcommon" = "yes" ; then 36626a021536SGerd Hoffmann feature_not_found "xkbcommon" "Install libxkbcommon-devel" 36636a021536SGerd Hoffmann fi 36646a021536SGerd Hoffmann xkbcommon=no 36656a021536SGerd Hoffmann fi 36666a021536SGerd Hoffmannfi 36676a021536SGerd Hoffmann 366876655d6dSaliguori 366976655d6dSaliguori########################################## 3670c1bb86cdSEric Blake# xfsctl() probe, used for file-posix.c 3671dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 3672dce512deSChristoph Hellwig cat > $TMPC << EOF 3673ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 3674dce512deSChristoph Hellwig#include <xfs/xfs.h> 3675dce512deSChristoph Hellwigint main(void) 3676dce512deSChristoph Hellwig{ 3677dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 3678dce512deSChristoph Hellwig return 0; 3679dce512deSChristoph Hellwig} 3680dce512deSChristoph HellwigEOF 3681dce512deSChristoph Hellwig if compile_prog "" "" ; then 3682dce512deSChristoph Hellwig xfs="yes" 3683dce512deSChristoph Hellwig else 3684dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 368521684af0SStewart Smith feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 3686dce512deSChristoph Hellwig fi 3687dce512deSChristoph Hellwig xfs=no 3688dce512deSChristoph Hellwig fi 3689dce512deSChristoph Hellwigfi 3690dce512deSChristoph Hellwig 3691dce512deSChristoph Hellwig########################################## 36928a16d273Sths# vde libraries probe 3693dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 36944baae0acSJuan Quintela vde_libs="-lvdeplug" 36958a16d273Sths cat > $TMPC << EOF 36968a16d273Sths#include <libvdeplug.h> 36974a7f0e06Spbrookint main(void) 36984a7f0e06Spbrook{ 36994a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 3700fea08e08SPeter Maydell char s[] = ""; 3701fea08e08SPeter Maydell vde_open(s, s, &a); 37024a7f0e06Spbrook return 0; 37034a7f0e06Spbrook} 37048a16d273SthsEOF 370552166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 37064baae0acSJuan Quintela vde=yes 3707dfb278bdSJuan Quintela else 3708dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 370921684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 3710dfb278bdSJuan Quintela fi 3711dfb278bdSJuan Quintela vde=no 37128a16d273Sths fi 37138a16d273Sthsfi 37148a16d273Sths 37158a16d273Sths########################################## 37160a985b37SVincenzo Maffione# netmap support probe 37170a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 37180a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 37190a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 37200a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 37210a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 372258952137SVincenzo Maffioneif test "$netmap" != "no" ; then 372358952137SVincenzo Maffione cat > $TMPC << EOF 372458952137SVincenzo Maffione#include <inttypes.h> 372558952137SVincenzo Maffione#include <net/if.h> 372658952137SVincenzo Maffione#include <net/netmap.h> 372758952137SVincenzo Maffione#include <net/netmap_user.h> 37280a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 37290a985b37SVincenzo Maffione#error 37300a985b37SVincenzo Maffione#endif 373158952137SVincenzo Maffioneint main(void) { return 0; } 373258952137SVincenzo MaffioneEOF 373358952137SVincenzo Maffione if compile_prog "" "" ; then 373458952137SVincenzo Maffione netmap=yes 373558952137SVincenzo Maffione else 373658952137SVincenzo Maffione if test "$netmap" = "yes" ; then 373758952137SVincenzo Maffione feature_not_found "netmap" 373858952137SVincenzo Maffione fi 373958952137SVincenzo Maffione netmap=no 374058952137SVincenzo Maffione fi 374158952137SVincenzo Maffionefi 374258952137SVincenzo Maffione 374358952137SVincenzo Maffione########################################## 374447e98658SCorey Bryant# libcap-ng library probe 374547e98658SCorey Bryantif test "$cap_ng" != "no" ; then 374647e98658SCorey Bryant cap_libs="-lcap-ng" 374747e98658SCorey Bryant cat > $TMPC << EOF 374847e98658SCorey Bryant#include <cap-ng.h> 374947e98658SCorey Bryantint main(void) 375047e98658SCorey Bryant{ 375147e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 375247e98658SCorey Bryant return 0; 375347e98658SCorey Bryant} 375447e98658SCorey BryantEOF 375547e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 375647e98658SCorey Bryant cap_ng=yes 375747e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 375847e98658SCorey Bryant else 375947e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 376021684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 376147e98658SCorey Bryant fi 376247e98658SCorey Bryant cap_ng=no 376347e98658SCorey Bryant fi 376447e98658SCorey Bryantfi 376547e98658SCorey Bryant 376647e98658SCorey Bryant########################################## 3767c2de5c91Smalc# Sound support libraries probe 37688f28f3fbSths 376989138857SStefan Weilaudio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') 3770c2de5c91Smalcfor drv in $audio_drv_list; do 3771c2de5c91Smalc case $drv in 3772e42975a1SGerd Hoffmann alsa | try-alsa) 3773c80a867fSGerd Hoffmann if $pkg_config alsa --exists; then 3774c80a867fSGerd Hoffmann alsa_libs=$($pkg_config alsa --libs) 3775e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3776e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') 3777e42975a1SGerd Hoffmann fi 3778e42975a1SGerd Hoffmann else 3779e42975a1SGerd Hoffmann if test "$drv" = "try-alsa"; then 3780e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//') 3781c80a867fSGerd Hoffmann else 3782c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3783c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3784c80a867fSGerd Hoffmann fi 3785e42975a1SGerd Hoffmann fi 3786c2de5c91Smalc ;; 3787c2de5c91Smalc 3788e42975a1SGerd Hoffmann pa | try-pa) 3789c80a867fSGerd Hoffmann if $pkg_config libpulse --exists; then 3790c80a867fSGerd Hoffmann pulse_libs=$($pkg_config libpulse --libs) 3791e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3792e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') 3793e42975a1SGerd Hoffmann fi 3794e42975a1SGerd Hoffmann else 3795e42975a1SGerd Hoffmann if test "$drv" = "try-pa"; then 3796e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//') 3797c80a867fSGerd Hoffmann else 3798c80a867fSGerd Hoffmann error_exit "$drv check failed" \ 3799c80a867fSGerd Hoffmann "Make sure to have the $drv libs and headers installed." 3800c80a867fSGerd Hoffmann fi 3801e42975a1SGerd Hoffmann fi 3802b8e59f18Smalc ;; 3803b8e59f18Smalc 3804373967b2SGerd Hoffmann sdl) 3805373967b2SGerd Hoffmann if test "$sdl" = "no"; then 3806373967b2SGerd Hoffmann error_exit "sdl not found or disabled, can not use sdl audio driver" 3807373967b2SGerd Hoffmann fi 3808373967b2SGerd Hoffmann ;; 3809373967b2SGerd Hoffmann 3810e42975a1SGerd Hoffmann try-sdl) 3811e42975a1SGerd Hoffmann if test "$sdl" = "no"; then 3812e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//') 3813e42975a1SGerd Hoffmann else 3814e42975a1SGerd Hoffmann audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/') 3815e42975a1SGerd Hoffmann fi 3816e42975a1SGerd Hoffmann ;; 3817e42975a1SGerd Hoffmann 3818997e690aSJuan Quintela coreaudio) 3819b1149911SFam Zheng coreaudio_libs="-framework CoreAudio" 3820997e690aSJuan Quintela ;; 3821997e690aSJuan Quintela 3822a4bf6780SJuan Quintela dsound) 3823b1149911SFam Zheng dsound_libs="-lole32 -ldxguid" 3824d5631638Smalc audio_win_int="yes" 3825a4bf6780SJuan Quintela ;; 3826a4bf6780SJuan Quintela 3827a4bf6780SJuan Quintela oss) 3828b1149911SFam Zheng oss_libs="$oss_lib" 3829a4bf6780SJuan Quintela ;; 3830a4bf6780SJuan Quintela 38312e445703SGeoffrey McRae jack | try-jack) 38322e445703SGeoffrey McRae if $pkg_config jack --exists; then 38332e445703SGeoffrey McRae jack_libs=$($pkg_config jack --libs) 38342e445703SGeoffrey McRae if test "$drv" = "try-jack"; then 38352e445703SGeoffrey McRae audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') 38362e445703SGeoffrey McRae fi 38372e445703SGeoffrey McRae else 38382e445703SGeoffrey McRae if test "$drv" = "try-jack"; then 38392e445703SGeoffrey McRae audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') 38402e445703SGeoffrey McRae else 38412e445703SGeoffrey McRae error_exit "$drv check failed" \ 38422e445703SGeoffrey McRae "Make sure to have the $drv libs and headers installed." 38432e445703SGeoffrey McRae fi 38442e445703SGeoffrey McRae fi 38452e445703SGeoffrey McRae ;; 38462e445703SGeoffrey McRae 3847e4c63a6aSmalc *) 38481c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 384976ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 385076ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 3851e4c63a6aSmalc } 3852e4c63a6aSmalc ;; 3853c2de5c91Smalc esac 3854c2de5c91Smalcdone 38558f28f3fbSths 38564d3b6f6eSbalrog########################################## 38572e4d9fb1Saurel32# BrlAPI probe 38582e4d9fb1Saurel32 38594ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 3860eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 38612e4d9fb1Saurel32 cat > $TMPC << EOF 38622e4d9fb1Saurel32#include <brlapi.h> 3863832ce9c2SScott Wood#include <stddef.h> 38642e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 38652e4d9fb1Saurel32EOF 386652166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 38672e4d9fb1Saurel32 brlapi=yes 38684ffcedb6SJuan Quintela else 38694ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 387021684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 38714ffcedb6SJuan Quintela fi 38724ffcedb6SJuan Quintela brlapi=no 3873eb82284fSJuan Quintela fi 3874eb82284fSJuan Quintelafi 38752e4d9fb1Saurel32 38762e4d9fb1Saurel32########################################## 3877e08bb301SSamuel Thibault# iconv probe 3878e08bb301SSamuel Thibaultif test "$iconv" != "no" ; then 3879e08bb301SSamuel Thibault cat > $TMPC << EOF 3880e08bb301SSamuel Thibault#include <iconv.h> 3881e08bb301SSamuel Thibaultint main(void) { 3882e08bb301SSamuel Thibault iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); 3883e08bb301SSamuel Thibault return conv != (iconv_t) -1; 3884e08bb301SSamuel Thibault} 3885e08bb301SSamuel ThibaultEOF 3886e08bb301SSamuel Thibault iconv_prefix_list="/usr/local:/usr" 3887e08bb301SSamuel Thibault iconv_lib_list=":-liconv" 3888e08bb301SSamuel Thibault IFS=: 3889e08bb301SSamuel Thibault for iconv_prefix in $iconv_prefix_list; do 3890e08bb301SSamuel Thibault IFS=: 3891e08bb301SSamuel Thibault iconv_cflags="-I$iconv_prefix/include" 3892e08bb301SSamuel Thibault iconv_ldflags="-L$iconv_prefix/lib" 3893e08bb301SSamuel Thibault for iconv_link in $iconv_lib_list; do 3894e08bb301SSamuel Thibault unset IFS 3895e08bb301SSamuel Thibault iconv_lib="$iconv_ldflags $iconv_link" 3896e08bb301SSamuel Thibault echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log 3897e08bb301SSamuel Thibault if compile_prog "$iconv_cflags" "$iconv_lib" ; then 3898e08bb301SSamuel Thibault iconv_found=yes 3899e08bb301SSamuel Thibault break 3900e08bb301SSamuel Thibault fi 3901e08bb301SSamuel Thibault done 3902e08bb301SSamuel Thibault if test "$iconv_found" = yes ; then 3903e08bb301SSamuel Thibault break 3904e08bb301SSamuel Thibault fi 3905e08bb301SSamuel Thibault done 3906e08bb301SSamuel Thibault if test "$iconv_found" = "yes" ; then 3907e08bb301SSamuel Thibault iconv=yes 3908e08bb301SSamuel Thibault else 3909e08bb301SSamuel Thibault if test "$iconv" = "yes" ; then 3910e08bb301SSamuel Thibault feature_not_found "iconv" "Install iconv devel" 3911e08bb301SSamuel Thibault fi 3912e08bb301SSamuel Thibault iconv=no 3913e08bb301SSamuel Thibault fi 3914e08bb301SSamuel Thibaultfi 3915e08bb301SSamuel Thibault 3916e08bb301SSamuel Thibault########################################## 39174d3b6f6eSbalrog# curses probe 3918e08bb301SSamuel Thibaultif test "$iconv" = "no" ; then 3919e08bb301SSamuel Thibault # curses will need iconv 3920e08bb301SSamuel Thibault curses=no 3921e08bb301SSamuel Thibaultfi 3922a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 3923e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 39248ddc5bf9SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" 39258ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" 3926e095e2f3SStefan Weil else 39277c703002SSamuel Thibault curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" 39288ddc5bf9SSamuel Thibault curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" 3929e095e2f3SStefan Weil fi 3930c584a6d0SJuan Quintela curses_found=no 39314d3b6f6eSbalrog cat > $TMPC << EOF 39328ddc5bf9SSamuel Thibault#include <locale.h> 39334d3b6f6eSbalrog#include <curses.h> 39348ddc5bf9SSamuel Thibault#include <wchar.h> 39352f8b7cd5SSamuel Thibault#include <langinfo.h> 3936ef9a2524SStefan Weilint main(void) { 39372f8b7cd5SSamuel Thibault const char *codeset; 39388ddc5bf9SSamuel Thibault wchar_t wch = L'w'; 39398ddc5bf9SSamuel Thibault setlocale(LC_ALL, ""); 3940ef9a2524SStefan Weil resize_term(0, 0); 39418ddc5bf9SSamuel Thibault addwstr(L"wide chars\n"); 39428ddc5bf9SSamuel Thibault addnwstr(&wch, 1); 39437c703002SSamuel Thibault add_wch(WACS_DEGREE); 39442f8b7cd5SSamuel Thibault codeset = nl_langinfo(CODESET); 39452f8b7cd5SSamuel Thibault return codeset != 0; 3946ef9a2524SStefan Weil} 39474d3b6f6eSbalrogEOF 3948ecbe251fSVadim Evard IFS=: 39498ddc5bf9SSamuel Thibault for curses_inc in $curses_inc_list; do 3950b01a4fd3SPeter Maydell # Make sure we get the wide character prototypes 3951b01a4fd3SPeter Maydell curses_inc="-DNCURSES_WIDECHAR $curses_inc" 39527c703002SSamuel Thibault IFS=: 39538ddc5bf9SSamuel Thibault for curses_lib in $curses_lib_list; do 3954ecbe251fSVadim Evard unset IFS 39558ddc5bf9SSamuel Thibault if compile_prog "$curses_inc" "$curses_lib" ; then 3956c584a6d0SJuan Quintela curses_found=yes 39574f78ef9aSJuan Quintela break 39584d3b6f6eSbalrog fi 39594f78ef9aSJuan Quintela done 39607c703002SSamuel Thibault if test "$curses_found" = yes ; then 39617c703002SSamuel Thibault break 39627c703002SSamuel Thibault fi 39638ddc5bf9SSamuel Thibault done 3964ecbe251fSVadim Evard unset IFS 3965c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 3966c584a6d0SJuan Quintela curses=yes 3967c584a6d0SJuan Quintela else 3968c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 396921684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 3970c584a6d0SJuan Quintela fi 3971c584a6d0SJuan Quintela curses=no 3972c584a6d0SJuan Quintela fi 39734f78ef9aSJuan Quintelafi 39744d3b6f6eSbalrog 3975414f0dabSblueswir1########################################## 3976769ce76dSAlexander Graf# curl probe 3977a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 397865d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 3979a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 39804e2b0658SPaolo Bonzini else 39814e2b0658SPaolo Bonzini curlconfig=curl-config 39824e2b0658SPaolo Bonzini fi 3983769ce76dSAlexander Graf cat > $TMPC << EOF 3984769ce76dSAlexander Graf#include <curl/curl.h> 39850b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 3986769ce76dSAlexander GrafEOF 398789138857SStefan Weil curl_cflags=$($curlconfig --cflags 2>/dev/null) 398889138857SStefan Weil curl_libs=$($curlconfig --libs 2>/dev/null) 3989b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 3990769ce76dSAlexander Graf curl=yes 3991788c8196SJuan Quintela else 3992788c8196SJuan Quintela if test "$curl" = "yes" ; then 399321684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 3994788c8196SJuan Quintela fi 3995788c8196SJuan Quintela curl=no 3996769ce76dSAlexander Graf fi 3997769ce76dSAlexander Graffi # test "$curl" 3998769ce76dSAlexander Graf 3999769ce76dSAlexander Graf########################################## 4000e18df141SAnthony Liguori# glib support probe 4001a52d28afSPaolo Bonzini 400200f2cfbbSDaniel P. Berrangéglib_req_ver=2.48 4003aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 4004aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 4005a88afc64SGerd Hoffmann glib_modules="$glib_modules gmodule-export-2.0" 4006aa0d1f44SPaolo Bonzinifi 400754cb65d8SEmilio G. Cotaif test "$plugins" = yes; then 400854cb65d8SEmilio G. Cota glib_modules="$glib_modules gmodule-2.0" 400954cb65d8SEmilio G. Cotafi 4010e26110cfSFam Zheng 40114eaf7202SSameeh Jubran# This workaround is required due to a bug in pkg-config file for glib as it 40124eaf7202SSameeh Jubran# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static 40134eaf7202SSameeh Jubran 4014e633a5c6SEric Blakeif test "$static" = yes && test "$mingw32" = yes; then 40154eaf7202SSameeh Jubran QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" 40164eaf7202SSameeh Jubranfi 40174eaf7202SSameeh Jubran 4018aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 4019e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 402089138857SStefan Weil glib_cflags=$($pkg_config --cflags $i) 402189138857SStefan Weil glib_libs=$($pkg_config --libs $i) 40224a058899SMarc-André Lureau QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" 402314015304SAnthony Liguori LIBS="$glib_libs $LIBS" 4024957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 4025e18df141SAnthony Liguori else 4026e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 4027e26110cfSFam Zheng fi 4028e26110cfSFam Zhengdone 4029e26110cfSFam Zheng 4030f876b765SMarc-André Lureauif $pkg_config --atleast-version=$glib_req_ver gio-2.0; then 4031f876b765SMarc-André Lureau gio=yes 4032f876b765SMarc-André Lureau gio_cflags=$($pkg_config --cflags gio-2.0) 4033f876b765SMarc-André Lureau gio_libs=$($pkg_config --libs gio-2.0) 403425a97a56SMarc-André Lureau gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) 40350dba4897SMarc-André Lureau if [ ! -x "$gdbus_codegen" ]; then 40360dba4897SMarc-André Lureau gdbus_codegen= 40370dba4897SMarc-André Lureau fi 4038f876b765SMarc-André Lureauelse 4039f876b765SMarc-André Lureau gio=no 4040f876b765SMarc-André Lureaufi 4041f876b765SMarc-André Lureau 404225a97a56SMarc-André Lureauif $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then 404325a97a56SMarc-André Lureau gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)" 404425a97a56SMarc-André Lureau gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)" 404525a97a56SMarc-André Lureaufi 404625a97a56SMarc-André Lureau 4047977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 4048977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 4049977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 4050977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 4051977a82abSDaniel P. Berrangecat > $TMPC <<EOF 4052977a82abSDaniel P. Berrange#include <glib.h> 4053977a82abSDaniel P. Berrange#include <unistd.h> 4054977a82abSDaniel P. Berrange 4055977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 4056977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 4057977a82abSDaniel P. Berrange 4058977a82abSDaniel P. Berrangeint main(void) { 4059977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 4060977a82abSDaniel P. Berrange return 0; 4061977a82abSDaniel P. Berrange} 4062977a82abSDaniel P. BerrangeEOF 4063977a82abSDaniel P. Berrange 40645919e032SStefan Weilif ! compile_prog "$CFLAGS" "$LIBS" ; then 4065977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 4066977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 4067977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 4068977a82abSDaniel P. Berrange "build target" 4069977a82abSDaniel P. Berrangefi 4070977a82abSDaniel P. Berrange 4071bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 4072bbbf2e04SJohn Snowcat > $TMPC << EOF 4073bbbf2e04SJohn Snow#include <glib.h> 4074bbbf2e04SJohn Snowint main(void) { return 0; } 4075bbbf2e04SJohn SnowEOF 4076bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 4077bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 4078bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 4079086d5f75SPaolo Bonzini QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS" 4080bbbf2e04SJohn Snow fi 4081bbbf2e04SJohn Snowfi 4082bbbf2e04SJohn Snow 40839bda600bSEric Blake# Silence clang warnings triggered by glib < 2.57.2 40849bda600bSEric Blakecat > $TMPC << EOF 40859bda600bSEric Blake#include <glib.h> 40869bda600bSEric Blaketypedef struct Foo { 40879bda600bSEric Blake int i; 40889bda600bSEric Blake} Foo; 40899bda600bSEric Blakestatic void foo_free(Foo *f) 40909bda600bSEric Blake{ 40919bda600bSEric Blake g_free(f); 40929bda600bSEric Blake} 40939bda600bSEric BlakeG_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); 40949bda600bSEric Blakeint main(void) { return 0; } 40959bda600bSEric BlakeEOF 40969bda600bSEric Blakeif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 40979bda600bSEric Blake if cc_has_warning_flag "-Wno-unused-function"; then 40989bda600bSEric Blake glib_cflags="$glib_cflags -Wno-unused-function" 40999bda600bSEric Blake CFLAGS="$CFLAGS -Wno-unused-function" 41009bda600bSEric Blake fi 41019bda600bSEric Blakefi 41029bda600bSEric Blake 41036a1f42bdSStefan Weil######################################### 41046a1f42bdSStefan Weil# zlib check 41056a1f42bdSStefan Weil 41066a1f42bdSStefan Weilif test "$zlib" != "no" ; then 41076a1f42bdSStefan Weil if $pkg_config --exists zlib; then 41086a1f42bdSStefan Weil zlib_cflags=$($pkg_config --cflags zlib) 41096a1f42bdSStefan Weil zlib_libs=$($pkg_config --libs zlib) 41106a1f42bdSStefan Weil QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" 41116a1f42bdSStefan Weil LIBS="$zlib_libs $LIBS" 41126a1f42bdSStefan Weil else 41136a1f42bdSStefan Weil cat > $TMPC << EOF 41146a1f42bdSStefan Weil#include <zlib.h> 41156a1f42bdSStefan Weilint main(void) { zlibVersion(); return 0; } 41166a1f42bdSStefan WeilEOF 41176a1f42bdSStefan Weil if compile_prog "" "-lz" ; then 41186a1f42bdSStefan Weil LIBS="$LIBS -lz" 41196a1f42bdSStefan Weil else 41206a1f42bdSStefan Weil error_exit "zlib check failed" \ 41216a1f42bdSStefan Weil "Make sure to have the zlib libs and headers installed." 41226a1f42bdSStefan Weil fi 41236a1f42bdSStefan Weil fi 41246a1f42bdSStefan Weilfi 41256a1f42bdSStefan Weil 4126e26110cfSFam Zheng########################################## 4127e26110cfSFam Zheng# SHA command probe for modules 4128e26110cfSFam Zhengif test "$modules" = yes; then 4129e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 4130e26110cfSFam Zheng for c in $shacmd_probe; do 41318ccefb91SFam Zheng if has $c; then 4132e26110cfSFam Zheng shacmd="$c" 4133e26110cfSFam Zheng break 4134e26110cfSFam Zheng fi 4135e26110cfSFam Zheng done 4136e26110cfSFam Zheng if test "$shacmd" = ""; then 4137e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 4138e26110cfSFam Zheng fi 4139e18df141SAnthony Liguorifi 4140e18df141SAnthony Liguori 4141e18df141SAnthony Liguori########################################## 4142e2134eb9SGerd Hoffmann# pixman support probe 4143e2134eb9SGerd Hoffmann 41449b52b17bSThomas Huthif test "$softmmu" = "no"; then 414574880fe2SRobert Schiele pixman_cflags= 414674880fe2SRobert Schiele pixman_libs= 414735c4e86cSGerd Hoffmannelif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then 414889138857SStefan Weil pixman_cflags=$($pkg_config --cflags pixman-1) 414989138857SStefan Weil pixman_libs=$($pkg_config --libs pixman-1) 4150e2134eb9SGerd Hoffmannelse 4151c12b6d70SGerd Hoffmann error_exit "pixman >= 0.21.8 not present." \ 4152c12b6d70SGerd Hoffmann "Please install the pixman devel package." 4153e2134eb9SGerd Hoffmannfi 4154e2134eb9SGerd Hoffmann 4155e2134eb9SGerd Hoffmann########################################## 4156fe8fc5aeSPaolo Bonzini# libmpathpersist probe 4157fe8fc5aeSPaolo Bonzini 4158fe8fc5aeSPaolo Bonziniif test "$mpath" != "no" ; then 41591b0578f5SMurilo Opsfelder Araujo # probe for the new API 4160fe8fc5aeSPaolo Bonzini cat > $TMPC <<EOF 4161fe8fc5aeSPaolo Bonzini#include <libudev.h> 4162fe8fc5aeSPaolo Bonzini#include <mpath_persist.h> 4163fe8fc5aeSPaolo Bonziniunsigned mpath_mx_alloc_len = 1024; 4164fe8fc5aeSPaolo Bonziniint logsink; 4165b3f1c8c4SPaolo Bonzinistatic struct config *multipath_conf; 4166b3f1c8c4SPaolo Bonziniextern struct udev *udev; 4167b3f1c8c4SPaolo Bonziniextern struct config *get_multipath_config(void); 4168b3f1c8c4SPaolo Bonziniextern void put_multipath_config(struct config *conf); 4169b3f1c8c4SPaolo Bonzinistruct udev *udev; 4170b3f1c8c4SPaolo Bonzinistruct config *get_multipath_config(void) { return multipath_conf; } 4171b3f1c8c4SPaolo Bonzinivoid put_multipath_config(struct config *conf) { } 4172b3f1c8c4SPaolo Bonzini 4173fe8fc5aeSPaolo Bonziniint main(void) { 4174b3f1c8c4SPaolo Bonzini udev = udev_new(); 4175b3f1c8c4SPaolo Bonzini multipath_conf = mpath_lib_init(); 4176fe8fc5aeSPaolo Bonzini return 0; 4177fe8fc5aeSPaolo Bonzini} 4178fe8fc5aeSPaolo BonziniEOF 4179fe8fc5aeSPaolo Bonzini if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 4180fe8fc5aeSPaolo Bonzini mpathpersist=yes 41811b0578f5SMurilo Opsfelder Araujo mpathpersist_new_api=yes 41821b0578f5SMurilo Opsfelder Araujo else 41831b0578f5SMurilo Opsfelder Araujo # probe for the old API 41841b0578f5SMurilo Opsfelder Araujo cat > $TMPC <<EOF 41851b0578f5SMurilo Opsfelder Araujo#include <libudev.h> 41861b0578f5SMurilo Opsfelder Araujo#include <mpath_persist.h> 41871b0578f5SMurilo Opsfelder Araujounsigned mpath_mx_alloc_len = 1024; 41881b0578f5SMurilo Opsfelder Araujoint logsink; 41891b0578f5SMurilo Opsfelder Araujoint main(void) { 41901b0578f5SMurilo Opsfelder Araujo struct udev *udev = udev_new(); 41911b0578f5SMurilo Opsfelder Araujo mpath_lib_init(udev); 41921b0578f5SMurilo Opsfelder Araujo return 0; 41931b0578f5SMurilo Opsfelder Araujo} 41941b0578f5SMurilo Opsfelder AraujoEOF 41951b0578f5SMurilo Opsfelder Araujo if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then 41961b0578f5SMurilo Opsfelder Araujo mpathpersist=yes 41971b0578f5SMurilo Opsfelder Araujo mpathpersist_new_api=no 4198fe8fc5aeSPaolo Bonzini else 4199fe8fc5aeSPaolo Bonzini mpathpersist=no 4200fe8fc5aeSPaolo Bonzini fi 42011b0578f5SMurilo Opsfelder Araujo fi 4202fe8fc5aeSPaolo Bonzinielse 4203fe8fc5aeSPaolo Bonzini mpathpersist=no 4204fe8fc5aeSPaolo Bonzinifi 4205fe8fc5aeSPaolo Bonzini 4206fe8fc5aeSPaolo Bonzini########################################## 4207e5d355d1Saliguori# pthread probe 42084b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 42093c529d93Saliguori 4210e5d355d1Saliguoripthread=no 4211414f0dabSblueswir1cat > $TMPC << EOF 42123c529d93Saliguori#include <pthread.h> 42137a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 42147a42bbe4SStefan Weilint main(void) { 42157a42bbe4SStefan Weil pthread_t thread; 42167a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 42177a42bbe4SStefan Weil return 0; 42187a42bbe4SStefan Weil} 4219414f0dabSblueswir1EOF 4220bd00d539SAndreas Färberif compile_prog "" "" ; then 4221bd00d539SAndreas Färber pthread=yes 4222bd00d539SAndreas Färberelse 4223de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 422452166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 4225e5d355d1Saliguori pthread=yes 4226e3c56761SPeter Portante found=no 4227e3c56761SPeter Portante for lib_entry in $LIBS; do 4228e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 4229e3c56761SPeter Portante found=yes 4230e3c56761SPeter Portante break 4231e3c56761SPeter Portante fi 4232e3c56761SPeter Portante done 4233e3c56761SPeter Portante if test "$found" = "no"; then 42345572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 423514ab3aa7SMarc-André Lureau libs_qga="$pthread_lib $libs_qga" 4236e3c56761SPeter Portante fi 4237409437e1SDaniel P. Berrange PTHREAD_LIB="$pthread_lib" 4238de65fe0fSSebastian Herbszt break 4239414f0dabSblueswir1 fi 4240de65fe0fSSebastian Herbszt done 4241bd00d539SAndreas Färberfi 4242414f0dabSblueswir1 4243e633a5c6SEric Blakeif test "$mingw32" != yes && test "$pthread" = no; then 424476ad07a4SPeter Maydell error_exit "pthread check failed" \ 424576ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 4246e5d355d1Saliguorifi 4247e5d355d1Saliguori 4248479a5747SRoman Bolshakov# check for pthread_setname_np with thread id 4249479a5747SRoman Bolshakovpthread_setname_np_w_tid=no 42505c312079SDr. David Alan Gilbertcat > $TMPC << EOF 42515c312079SDr. David Alan Gilbert#include <pthread.h> 42525c312079SDr. David Alan Gilbert 42535c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 42545c312079SDr. David Alan Gilbertint main(void) 42555c312079SDr. David Alan Gilbert{ 42565c312079SDr. David Alan Gilbert pthread_t thread; 42575c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 42585c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 42595c312079SDr. David Alan Gilbert return 0; 42605c312079SDr. David Alan Gilbert} 42615c312079SDr. David Alan GilbertEOF 42625c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 4263479a5747SRoman Bolshakov pthread_setname_np_w_tid=yes 4264479a5747SRoman Bolshakovfi 4265479a5747SRoman Bolshakov 4266479a5747SRoman Bolshakov# check for pthread_setname_np without thread id 4267479a5747SRoman Bolshakovpthread_setname_np_wo_tid=no 4268479a5747SRoman Bolshakovcat > $TMPC << EOF 4269479a5747SRoman Bolshakov#include <pthread.h> 4270479a5747SRoman Bolshakov 427112a9b8d8SThomas Huthstatic void *f(void *p) { pthread_setname_np("QEMU"); return NULL; } 4272479a5747SRoman Bolshakovint main(void) 4273479a5747SRoman Bolshakov{ 4274479a5747SRoman Bolshakov pthread_t thread; 4275479a5747SRoman Bolshakov pthread_create(&thread, 0, f, 0); 4276479a5747SRoman Bolshakov return 0; 4277479a5747SRoman Bolshakov} 4278479a5747SRoman BolshakovEOF 4279479a5747SRoman Bolshakovif compile_prog "" "$pthread_lib" ; then 4280479a5747SRoman Bolshakov pthread_setname_np_wo_tid=yes 42815c312079SDr. David Alan Gilbertfi 42825c312079SDr. David Alan Gilbert 4283bf9298b9Saliguori########################################## 4284f27aaf4bSChristian Brunner# rbd probe 4285f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 4286f27aaf4bSChristian Brunner cat > $TMPC <<EOF 4287f27aaf4bSChristian Brunner#include <stdio.h> 4288ad32e9c0SJosh Durgin#include <rbd/librbd.h> 4289f27aaf4bSChristian Brunnerint main(void) { 4290ad32e9c0SJosh Durgin rados_t cluster; 4291ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 4292f27aaf4bSChristian Brunner return 0; 4293f27aaf4bSChristian Brunner} 4294f27aaf4bSChristian BrunnerEOF 4295ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 4296f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 4297f27aaf4bSChristian Brunner rbd=yes 4298f27aaf4bSChristian Brunner else 4299f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 430021684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 4301f27aaf4bSChristian Brunner fi 4302f27aaf4bSChristian Brunner rbd=no 4303f27aaf4bSChristian Brunner fi 4304f27aaf4bSChristian Brunnerfi 4305f27aaf4bSChristian Brunner 4306f27aaf4bSChristian Brunner########################################## 4307b10d49d7SPino Toscano# libssh probe 4308b10d49d7SPino Toscanoif test "$libssh" != "no" ; then 4309b10d49d7SPino Toscano if $pkg_config --exists libssh; then 4310b10d49d7SPino Toscano libssh_cflags=$($pkg_config libssh --cflags) 4311b10d49d7SPino Toscano libssh_libs=$($pkg_config libssh --libs) 4312b10d49d7SPino Toscano libssh=yes 43130a12ec87SRichard W.M. Jones else 4314b10d49d7SPino Toscano if test "$libssh" = "yes" ; then 4315b10d49d7SPino Toscano error_exit "libssh required for --enable-libssh" 43160a12ec87SRichard W.M. Jones fi 4317b10d49d7SPino Toscano libssh=no 43180a12ec87SRichard W.M. Jones fi 43190a12ec87SRichard W.M. Jonesfi 43200a12ec87SRichard W.M. Jones 43210a12ec87SRichard W.M. Jones########################################## 4322b10d49d7SPino Toscano# Check for libssh 0.8 4323b10d49d7SPino Toscano# This is done like this instead of using the LIBSSH_VERSION_* and 4324b10d49d7SPino Toscano# SSH_VERSION_* macros because some distributions in the past shipped 4325b10d49d7SPino Toscano# snapshots of the future 0.8 from Git, and those snapshots did not 4326b10d49d7SPino Toscano# have updated version numbers (still referring to 0.7.0). 43279a2d462eSRichard W.M. Jones 4328b10d49d7SPino Toscanoif test "$libssh" = "yes"; then 43299a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 4330b10d49d7SPino Toscano#include <libssh/libssh.h> 4331b10d49d7SPino Toscanoint main(void) { return ssh_get_server_publickey(NULL, NULL); } 43329a2d462eSRichard W.M. JonesEOF 4333b10d49d7SPino Toscano if compile_prog "$libssh_cflags" "$libssh_libs"; then 4334b10d49d7SPino Toscano libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" 43359a2d462eSRichard W.M. Jones fi 43369a2d462eSRichard W.M. Jonesfi 43379a2d462eSRichard W.M. Jones 43389a2d462eSRichard W.M. Jones########################################## 43395c6c3a6cSChristoph Hellwig# linux-aio probe 43405c6c3a6cSChristoph Hellwig 43415c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 43425c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 43435c6c3a6cSChristoph Hellwig#include <libaio.h> 43445c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 4345832ce9c2SScott Wood#include <stddef.h> 43465c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 43475c6c3a6cSChristoph HellwigEOF 43485c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 43495c6c3a6cSChristoph Hellwig linux_aio=yes 43505c6c3a6cSChristoph Hellwig else 43515c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 435221684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 43535c6c3a6cSChristoph Hellwig fi 43543cfcae3cSLuiz Capitulino linux_aio=no 43555c6c3a6cSChristoph Hellwig fi 43565c6c3a6cSChristoph Hellwigfi 4357c10dd856SAarushi Mehta########################################## 4358c10dd856SAarushi Mehta# linux-io-uring probe 4359c10dd856SAarushi Mehta 4360c10dd856SAarushi Mehtaif test "$linux_io_uring" != "no" ; then 4361c10dd856SAarushi Mehta if $pkg_config liburing; then 4362c10dd856SAarushi Mehta linux_io_uring_cflags=$($pkg_config --cflags liburing) 4363c10dd856SAarushi Mehta linux_io_uring_libs=$($pkg_config --libs liburing) 4364c10dd856SAarushi Mehta linux_io_uring=yes 436573fd282eSStefan Hajnoczi 436673fd282eSStefan Hajnoczi # io_uring is used in libqemuutil.a where per-file -libs variables are not 436773fd282eSStefan Hajnoczi # seen by programs linking the archive. It's not ideal, but just add the 436873fd282eSStefan Hajnoczi # library dependency globally. 436973fd282eSStefan Hajnoczi LIBS="$linux_io_uring_libs $LIBS" 4370c10dd856SAarushi Mehta else 4371c10dd856SAarushi Mehta if test "$linux_io_uring" = "yes" ; then 4372c10dd856SAarushi Mehta feature_not_found "linux io_uring" "Install liburing devel" 4373c10dd856SAarushi Mehta fi 4374c10dd856SAarushi Mehta linux_io_uring=no 4375c10dd856SAarushi Mehta fi 4376c10dd856SAarushi Mehtafi 43775c6c3a6cSChristoph Hellwig 43785c6c3a6cSChristoph Hellwig########################################## 43797aaa6a16SPaolo Bonzini# TPM emulation is only on POSIX 43803b8acc11SPaolo Bonzini 43817aaa6a16SPaolo Bonziniif test "$tpm" = ""; then 43827aaa6a16SPaolo Bonzini if test "$mingw32" = "yes"; then 43837aaa6a16SPaolo Bonzini tpm=no 43843b8acc11SPaolo Bonzini else 43857aaa6a16SPaolo Bonzini tpm=yes 43867aaa6a16SPaolo Bonzini fi 43877aaa6a16SPaolo Bonzinielif test "$tpm" = "yes"; then 43887aaa6a16SPaolo Bonzini if test "$mingw32" = "yes" ; then 43897aaa6a16SPaolo Bonzini error_exit "TPM emulation only available on POSIX systems" 43907aaa6a16SPaolo Bonzini fi 43913b8acc11SPaolo Bonzinifi 43923b8acc11SPaolo Bonzini 43933b8acc11SPaolo Bonzini########################################## 4394758e8e38SVenkateswararao Jujjuri (JV)# attr probe 4395758e8e38SVenkateswararao Jujjuri (JV) 4396758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 4397758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 4398758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 4399758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 4400f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 4401f2338fb4SPavel Borzenkov#include <attr/xattr.h> 4402f2338fb4SPavel Borzenkov#else 44034f26f2b6SAvi Kivity#include <sys/xattr.h> 4404f2338fb4SPavel Borzenkov#endif 4405758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 4406758e8e38SVenkateswararao Jujjuri (JV)EOF 44074f26f2b6SAvi Kivity if compile_prog "" "" ; then 44084f26f2b6SAvi Kivity attr=yes 44094f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 4410f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 4411758e8e38SVenkateswararao Jujjuri (JV) attr=yes 4412758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 44134f26f2b6SAvi Kivity libattr=yes 4414758e8e38SVenkateswararao Jujjuri (JV) else 4415758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 441621684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 4417758e8e38SVenkateswararao Jujjuri (JV) fi 4418758e8e38SVenkateswararao Jujjuri (JV) attr=no 4419758e8e38SVenkateswararao Jujjuri (JV) fi 4420758e8e38SVenkateswararao Jujjuri (JV)fi 4421758e8e38SVenkateswararao Jujjuri (JV) 4422758e8e38SVenkateswararao Jujjuri (JV)########################################## 4423bf9298b9Saliguori# iovec probe 4424bf9298b9Saliguoricat > $TMPC <<EOF 4425db34f0b3Sblueswir1#include <sys/types.h> 4426bf9298b9Saliguori#include <sys/uio.h> 4427db34f0b3Sblueswir1#include <unistd.h> 4428f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 4429bf9298b9SaliguoriEOF 4430bf9298b9Saliguoriiovec=no 443152166aa0SJuan Quintelaif compile_prog "" "" ; then 4432bf9298b9Saliguori iovec=yes 4433bf9298b9Saliguorifi 4434bf9298b9Saliguori 4435f652e6afSaurel32########################################## 4436ceb42de8Saliguori# preadv probe 4437ceb42de8Saliguoricat > $TMPC <<EOF 4438ceb42de8Saliguori#include <sys/types.h> 4439ceb42de8Saliguori#include <sys/uio.h> 4440ceb42de8Saliguori#include <unistd.h> 4441c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 4442ceb42de8SaliguoriEOF 4443ceb42de8Saliguoripreadv=no 444452166aa0SJuan Quintelaif compile_prog "" "" ; then 4445ceb42de8Saliguori preadv=yes 4446ceb42de8Saliguorifi 4447ceb42de8Saliguori 4448ceb42de8Saliguori########################################## 4449f652e6afSaurel32# fdt probe 4450e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 4451e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 4452e169e1e1SPeter Maydellfdt_required=no 4453e169e1e1SPeter Maydellfor target in $target_list; do 4454e169e1e1SPeter Maydell case $target in 4455c8c35e5fSYoshinori Sato aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu) 4456e169e1e1SPeter Maydell fdt_required=yes 4457e169e1e1SPeter Maydell ;; 4458e169e1e1SPeter Maydell esac 4459e169e1e1SPeter Maydelldone 4460e169e1e1SPeter Maydell 4461e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 4462e169e1e1SPeter Maydell if test "$fdt" = "no"; then 4463e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 4464e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 4465e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 4466e169e1e1SPeter Maydell fi 4467e169e1e1SPeter Maydell fdt=yes 44687ba4a4d3SPhilippe Mathieu-Daudéelif test "$fdt" != "yes" ; then 44697ba4a4d3SPhilippe Mathieu-Daudé fdt=no 4470e169e1e1SPeter Maydellfi 4471e169e1e1SPeter Maydell 4472d599938aSLaurent Vivier# fdt is only required when building softmmu targets 4473d599938aSLaurent Vivierif test -z "$fdt" -a "$softmmu" != "yes" ; then 4474d599938aSLaurent Vivier fdt="no" 4475d599938aSLaurent Vivierfi 4476d599938aSLaurent Vivier 44772df87df7SJuan Quintelaif test "$fdt" != "no" ; then 4478b41af4baSJuan Quintela fdt_libs="-lfdt" 447996ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 44806e85fce0SPaul Burton # and test for required functions to make sure we are on a version >= 1.4.2 4481f652e6afSaurel32 cat > $TMPC << EOF 448231ce0adbSThomas Huth#include <libfdt.h> 448396ce6545SPeter Crosthwaite#include <libfdt_env.h> 4484fea35ca4SAlexey Kardashevskiyint main(void) { fdt_check_full(NULL, 0); return 0; } 4485f652e6afSaurel32EOF 448652166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 4487a540f158SPeter Crosthwaite # system DTC is good - use it 4488e3971d61SPhilippe Mathieu-Daudé fdt=system 4489aef45d51SDaniel P. Berrange else 4490aef45d51SDaniel P. Berrange # have GIT checkout, so activate dtc submodule 4491aef45d51SDaniel P. Berrange if test -e "${source_path}/.git" ; then 4492aef45d51SDaniel P. Berrange git_submodules="${git_submodules} dtc" 4493aef45d51SDaniel P. Berrange fi 4494aef45d51SDaniel P. Berrange if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then 4495e3971d61SPhilippe Mathieu-Daudé fdt=git 4496a540f158SPeter Crosthwaite mkdir -p dtc 4497cab00a5aSMichael S. Tsirkin if [ "$pwd_is_source_path" != "y" ] ; then 4498a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 44992df87df7SJuan Quintela fi 450025211446SPaolo Bonzini fdt_cflags="-I${source_path}/dtc/libfdt" 450125211446SPaolo Bonzini fdt_ldflags="-L$PWD/dtc/libfdt" 45028a99e9a3SPhilippe Mathieu-Daudé fdt_libs="$fdt_libs" 4503a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 4504aef45d51SDaniel P. Berrange # Not a git build & no libfdt found, prompt for system install 4505aef45d51SDaniel P. Berrange error_exit "DTC (libfdt) version >= 1.4.2 not present." \ 4506aef45d51SDaniel P. Berrange "Please install the DTC (libfdt) devel package" 4507a540f158SPeter Crosthwaite else 4508a540f158SPeter Crosthwaite # don't have and don't want 4509de3a354aSMichael Walle fdt_libs= 45102df87df7SJuan Quintela fdt=no 4511f652e6afSaurel32 fi 4512f652e6afSaurel32 fi 4513aef45d51SDaniel P. Berrangefi 4514f652e6afSaurel32 4515a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 4516a540f158SPeter Crosthwaite 451720ff075bSMichael Walle########################################## 4518fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 4519b1546f32SGerd Hoffmann 4520d52c454aSMarc-André Lureaugbm="no" 4521d52c454aSMarc-André Lureauif $pkg_config gbm; then 4522d52c454aSMarc-André Lureau gbm_cflags="$($pkg_config --cflags gbm)" 4523d52c454aSMarc-André Lureau gbm_libs="$($pkg_config --libs gbm)" 4524d52c454aSMarc-André Lureau gbm="yes" 4525d52c454aSMarc-André Lureaufi 4526d52c454aSMarc-André Lureau 4527da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 45284939a1dfSMichael Tokarev opengl_pkgs="epoxy gbm" 45295f9b1e35SGerd Hoffmann if $pkg_config $opengl_pkgs; then 45305f9b1e35SGerd Hoffmann opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" 45315f9b1e35SGerd Hoffmann opengl_libs="$($pkg_config --libs $opengl_pkgs)" 4532da076ffeSGerd Hoffmann opengl=yes 4533925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 4534925a0400SGerd Hoffmann gtk_gl="yes" 4535925a0400SGerd Hoffmann fi 4536cc720a5dSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags" 453720ff075bSMichael Walle else 4538da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 4539dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 454020ff075bSMichael Walle fi 4541f676c67eSJeremy White opengl_cflags="" 4542da076ffeSGerd Hoffmann opengl_libs="" 4543da076ffeSGerd Hoffmann opengl=no 454420ff075bSMichael Walle fi 454520ff075bSMichael Wallefi 454620ff075bSMichael Walle 4547014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 4548014cb152SGerd Hoffmann cat > $TMPC << EOF 4549014cb152SGerd Hoffmann#include <epoxy/egl.h> 4550014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 4551014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 4552014cb152SGerd Hoffmann#endif 4553014cb152SGerd Hoffmannint main(void) { return 0; } 4554014cb152SGerd HoffmannEOF 4555014cb152SGerd Hoffmann if compile_prog "" "" ; then 4556014cb152SGerd Hoffmann opengl_dmabuf=yes 4557014cb152SGerd Hoffmann fi 4558014cb152SGerd Hoffmannfi 4559c9a12e75SChrysostomos Nanakos 4560e633a5c6SEric Blakeif test "$opengl" = "yes" && test "$have_x11" = "yes"; then 456199e1a93bSPhilippe Mathieu-Daudé for target in $target_list; do 456299e1a93bSPhilippe Mathieu-Daudé case $target in 456399e1a93bSPhilippe Mathieu-Daudé lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL 456499e1a93bSPhilippe Mathieu-Daudé need_x11=yes 456599e1a93bSPhilippe Mathieu-Daudé ;; 456699e1a93bSPhilippe Mathieu-Daudé esac 456799e1a93bSPhilippe Mathieu-Daudé done 456899e1a93bSPhilippe Mathieu-Daudéfi 456999e1a93bSPhilippe Mathieu-Daudé 4570ed279a06SKlim Kireev########################################## 4571ed279a06SKlim Kireev# libxml2 probe 4572ed279a06SKlim Kireevif test "$libxml2" != "no" ; then 4573ed279a06SKlim Kireev if $pkg_config --exists libxml-2.0; then 4574ed279a06SKlim Kireev libxml2="yes" 4575ed279a06SKlim Kireev libxml2_cflags=$($pkg_config --cflags libxml-2.0) 4576ed279a06SKlim Kireev libxml2_libs=$($pkg_config --libs libxml-2.0) 4577ed279a06SKlim Kireev else 4578ed279a06SKlim Kireev if test "$libxml2" = "yes"; then 4579ed279a06SKlim Kireev feature_not_found "libxml2" "Install libxml2 devel" 4580ed279a06SKlim Kireev fi 4581ed279a06SKlim Kireev libxml2="no" 4582ed279a06SKlim Kireev fi 4583ed279a06SKlim Kireevfi 4584c9a12e75SChrysostomos Nanakos 4585eb100396SBharata B Rao########################################## 4586eb100396SBharata B Rao# glusterfs probe 4587eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 458865d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 4589e01bee08SBharata B Rao glusterfs="yes" 459089138857SStefan Weil glusterfs_cflags=$($pkg_config --cflags glusterfs-api) 459189138857SStefan Weil glusterfs_libs=$($pkg_config --libs glusterfs-api) 4592d85fa9ebSJeff Cody if $pkg_config --atleast-version=4 glusterfs-api; then 4593d85fa9ebSJeff Cody glusterfs_xlator_opt="yes" 4594d85fa9ebSJeff Cody fi 459565d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 45960c14fb47SBharata B Rao glusterfs_discard="yes" 45970c14fb47SBharata B Rao fi 45987c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 4599df3a429aSNiels de Vos glusterfs_fallocate="yes" 46007c815372SBharata B Rao glusterfs_zerofill="yes" 46017c815372SBharata B Rao fi 4602e014dbe7SPrasanna Kumar Kalever cat > $TMPC << EOF 4603e014dbe7SPrasanna Kumar Kalever#include <glusterfs/api/glfs.h> 4604e014dbe7SPrasanna Kumar Kalever 4605e014dbe7SPrasanna Kumar Kaleverint 4606e014dbe7SPrasanna Kumar Kalevermain(void) 4607e014dbe7SPrasanna Kumar Kalever{ 4608e014dbe7SPrasanna Kumar Kalever /* new glfs_ftruncate() passes two additional args */ 4609e014dbe7SPrasanna Kumar Kalever return glfs_ftruncate(NULL, 0, NULL, NULL); 4610e014dbe7SPrasanna Kumar Kalever} 4611e014dbe7SPrasanna Kumar KaleverEOF 4612e014dbe7SPrasanna Kumar Kalever if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 4613e014dbe7SPrasanna Kumar Kalever glusterfs_ftruncate_has_stat="yes" 4614e014dbe7SPrasanna Kumar Kalever fi 46150e3b891fSNiels de Vos cat > $TMPC << EOF 46160e3b891fSNiels de Vos#include <glusterfs/api/glfs.h> 46170e3b891fSNiels de Vos 46180e3b891fSNiels de Vos/* new glfs_io_cbk() passes two additional glfs_stat structs */ 46190e3b891fSNiels de Vosstatic void 46200e3b891fSNiels de Vosglusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data) 46210e3b891fSNiels de Vos{} 46220e3b891fSNiels de Vos 46230e3b891fSNiels de Vosint 46240e3b891fSNiels de Vosmain(void) 46250e3b891fSNiels de Vos{ 46260e3b891fSNiels de Vos glfs_io_cbk iocb = &glusterfs_iocb; 46270e3b891fSNiels de Vos iocb(NULL, 0 , NULL, NULL, NULL); 46280e3b891fSNiels de Vos return 0; 46290e3b891fSNiels de Vos} 46300e3b891fSNiels de VosEOF 46310e3b891fSNiels de Vos if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then 46320e3b891fSNiels de Vos glusterfs_iocb_has_stat="yes" 46330e3b891fSNiels de Vos fi 4634eb100396SBharata B Rao else 4635eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 46368efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 46378efc9363SHu Tao "Install glusterfs-api devel >= 3" 4638eb100396SBharata B Rao fi 4639e01bee08SBharata B Rao glusterfs="no" 4640eb100396SBharata B Rao fi 4641eb100396SBharata B Raofi 4642eb100396SBharata B Rao 464339386ac7Saurel32# Check for inotify functions when we are building linux-user 46443b3f24adSaurel32# emulator. This is done because older glibc versions don't 46453b3f24adSaurel32# have syscall stubs for these implemented. In that case we 46463b3f24adSaurel32# don't provide them even if kernel supports them. 46473b3f24adSaurel32# 46483b3f24adSaurel32inotify=no 46493b3f24adSaurel32cat > $TMPC << EOF 46503b3f24adSaurel32#include <sys/inotify.h> 46513b3f24adSaurel32 46523b3f24adSaurel32int 46533b3f24adSaurel32main(void) 46543b3f24adSaurel32{ 46553b3f24adSaurel32 /* try to start inotify */ 46568690e420Saurel32 return inotify_init(); 46573b3f24adSaurel32} 46583b3f24adSaurel32EOF 465952166aa0SJuan Quintelaif compile_prog "" "" ; then 46603b3f24adSaurel32 inotify=yes 46613b3f24adSaurel32fi 46623b3f24adSaurel32 4663c05c7a73SRiku Voipioinotify1=no 4664c05c7a73SRiku Voipiocat > $TMPC << EOF 4665c05c7a73SRiku Voipio#include <sys/inotify.h> 4666c05c7a73SRiku Voipio 4667c05c7a73SRiku Voipioint 4668c05c7a73SRiku Voipiomain(void) 4669c05c7a73SRiku Voipio{ 4670c05c7a73SRiku Voipio /* try to start inotify */ 4671c05c7a73SRiku Voipio return inotify_init1(0); 4672c05c7a73SRiku Voipio} 4673c05c7a73SRiku VoipioEOF 4674c05c7a73SRiku Voipioif compile_prog "" "" ; then 4675c05c7a73SRiku Voipio inotify1=yes 4676c05c7a73SRiku Voipiofi 4677c05c7a73SRiku Voipio 4678099d6b0fSRiku Voipio# check if pipe2 is there 4679099d6b0fSRiku Voipiopipe2=no 4680099d6b0fSRiku Voipiocat > $TMPC << EOF 4681099d6b0fSRiku Voipio#include <unistd.h> 4682099d6b0fSRiku Voipio#include <fcntl.h> 4683099d6b0fSRiku Voipio 4684099d6b0fSRiku Voipioint main(void) 4685099d6b0fSRiku Voipio{ 4686099d6b0fSRiku Voipio int pipefd[2]; 46879bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 4688099d6b0fSRiku Voipio} 4689099d6b0fSRiku VoipioEOF 469052166aa0SJuan Quintelaif compile_prog "" "" ; then 4691099d6b0fSRiku Voipio pipe2=yes 4692099d6b0fSRiku Voipiofi 4693099d6b0fSRiku Voipio 469440ff6d7eSKevin Wolf# check if accept4 is there 469540ff6d7eSKevin Wolfaccept4=no 469640ff6d7eSKevin Wolfcat > $TMPC << EOF 469740ff6d7eSKevin Wolf#include <sys/socket.h> 469840ff6d7eSKevin Wolf#include <stddef.h> 469940ff6d7eSKevin Wolf 470040ff6d7eSKevin Wolfint main(void) 470140ff6d7eSKevin Wolf{ 470240ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 470340ff6d7eSKevin Wolf return 0; 470440ff6d7eSKevin Wolf} 470540ff6d7eSKevin WolfEOF 470640ff6d7eSKevin Wolfif compile_prog "" "" ; then 470740ff6d7eSKevin Wolf accept4=yes 470840ff6d7eSKevin Wolffi 470940ff6d7eSKevin Wolf 47103ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 47113ce34dfbSvibisreenivasansplice=no 47123ce34dfbSvibisreenivasancat > $TMPC << EOF 47133ce34dfbSvibisreenivasan#include <unistd.h> 47143ce34dfbSvibisreenivasan#include <fcntl.h> 47153ce34dfbSvibisreenivasan#include <limits.h> 47163ce34dfbSvibisreenivasan 47173ce34dfbSvibisreenivasanint main(void) 47183ce34dfbSvibisreenivasan{ 471966ea0f22SStefan Weil int len, fd = 0; 47203ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 47213ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 47223ce34dfbSvibisreenivasan return 0; 47233ce34dfbSvibisreenivasan} 47243ce34dfbSvibisreenivasanEOF 472552166aa0SJuan Quintelaif compile_prog "" "" ; then 47263ce34dfbSvibisreenivasan splice=yes 47273ce34dfbSvibisreenivasanfi 47283ce34dfbSvibisreenivasan 4729dcc38d1cSMarcelo Tosatti########################################## 4730a99d57bbSWanlong Gao# libnuma probe 4731a99d57bbSWanlong Gao 4732a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 4733a99d57bbSWanlong Gao cat > $TMPC << EOF 4734a99d57bbSWanlong Gao#include <numa.h> 4735a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 4736a99d57bbSWanlong GaoEOF 4737a99d57bbSWanlong Gao 4738a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 4739a99d57bbSWanlong Gao numa=yes 4740a99d57bbSWanlong Gao libs_softmmu="-lnuma $libs_softmmu" 4741a99d57bbSWanlong Gao else 4742a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 4743a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 4744a99d57bbSWanlong Gao fi 4745a99d57bbSWanlong Gao numa=no 4746a99d57bbSWanlong Gao fi 4747a99d57bbSWanlong Gaofi 4748a99d57bbSWanlong Gao 47497b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 47507b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 47517b01cb97SAlexandre Derumier exit 1 47527b01cb97SAlexandre Derumierfi 47537b01cb97SAlexandre Derumier 47545a22ab71SYang Zhong# Even if malloc_trim() is available, these non-libc memory allocators 47555a22ab71SYang Zhong# do not support it. 47565a22ab71SYang Zhongif test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then 47575a22ab71SYang Zhong if test "$malloc_trim" = "yes" ; then 47585a22ab71SYang Zhong echo "Disabling malloc_trim with non-libc memory allocator" 47595a22ab71SYang Zhong fi 47605a22ab71SYang Zhong malloc_trim="no" 47615a22ab71SYang Zhongfi 47625a22ab71SYang Zhong 47635a22ab71SYang Zhong####################################### 47645a22ab71SYang Zhong# malloc_trim 47655a22ab71SYang Zhong 47665a22ab71SYang Zhongif test "$malloc_trim" != "no" ; then 47675a22ab71SYang Zhong cat > $TMPC << EOF 47685a22ab71SYang Zhong#include <malloc.h> 47695a22ab71SYang Zhongint main(void) { malloc_trim(0); return 0; } 47705a22ab71SYang ZhongEOF 47715a22ab71SYang Zhong if compile_prog "" "" ; then 47725a22ab71SYang Zhong malloc_trim="yes" 47735a22ab71SYang Zhong else 47745a22ab71SYang Zhong malloc_trim="no" 47755a22ab71SYang Zhong fi 47765a22ab71SYang Zhongfi 47775a22ab71SYang Zhong 4778a99d57bbSWanlong Gao########################################## 47792847b469SFam Zheng# tcmalloc probe 47802847b469SFam Zheng 47812847b469SFam Zhengif test "$tcmalloc" = "yes" ; then 47822847b469SFam Zheng cat > $TMPC << EOF 47832847b469SFam Zheng#include <stdlib.h> 4784f2dfe54cSLeonid Blochint main(void) { 4785f2dfe54cSLeonid Bloch void *tmp = malloc(1); 4786f2dfe54cSLeonid Bloch if (tmp != NULL) { 4787f2dfe54cSLeonid Bloch return 0; 4788f2dfe54cSLeonid Bloch } 4789f2dfe54cSLeonid Bloch return 1; 4790f2dfe54cSLeonid Bloch} 47912847b469SFam ZhengEOF 47922847b469SFam Zheng 47932847b469SFam Zheng if compile_prog "" "-ltcmalloc" ; then 47942847b469SFam Zheng LIBS="-ltcmalloc $LIBS" 47952847b469SFam Zheng else 47962847b469SFam Zheng feature_not_found "tcmalloc" "install gperftools devel" 47972847b469SFam Zheng fi 47982847b469SFam Zhengfi 47992847b469SFam Zheng 48002847b469SFam Zheng########################################## 48017b01cb97SAlexandre Derumier# jemalloc probe 48027b01cb97SAlexandre Derumier 48037b01cb97SAlexandre Derumierif test "$jemalloc" = "yes" ; then 48047b01cb97SAlexandre Derumier cat > $TMPC << EOF 48057b01cb97SAlexandre Derumier#include <stdlib.h> 4806f2dfe54cSLeonid Blochint main(void) { 4807f2dfe54cSLeonid Bloch void *tmp = malloc(1); 4808f2dfe54cSLeonid Bloch if (tmp != NULL) { 4809f2dfe54cSLeonid Bloch return 0; 4810f2dfe54cSLeonid Bloch } 4811f2dfe54cSLeonid Bloch return 1; 4812f2dfe54cSLeonid Bloch} 48137b01cb97SAlexandre DerumierEOF 48147b01cb97SAlexandre Derumier 48157b01cb97SAlexandre Derumier if compile_prog "" "-ljemalloc" ; then 48167b01cb97SAlexandre Derumier LIBS="-ljemalloc $LIBS" 48177b01cb97SAlexandre Derumier else 48187b01cb97SAlexandre Derumier feature_not_found "jemalloc" "install jemalloc devel" 48197b01cb97SAlexandre Derumier fi 48207b01cb97SAlexandre Derumierfi 48217b01cb97SAlexandre Derumier 48227b01cb97SAlexandre Derumier########################################## 4823dcc38d1cSMarcelo Tosatti# signalfd probe 4824dcc38d1cSMarcelo Tosattisignalfd="no" 4825dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 4826dcc38d1cSMarcelo Tosatti#include <unistd.h> 4827dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 4828dcc38d1cSMarcelo Tosatti#include <signal.h> 4829dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 4830dcc38d1cSMarcelo TosattiEOF 4831dcc38d1cSMarcelo Tosatti 4832dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 4833dcc38d1cSMarcelo Tosatti signalfd=yes 4834dcc38d1cSMarcelo Tosattifi 4835dcc38d1cSMarcelo Tosatti 4836d339d766SRichard W.M. Jones# check if optreset global is declared by <getopt.h> 4837d339d766SRichard W.M. Jonesoptreset="no" 4838d339d766SRichard W.M. Jonescat > $TMPC << EOF 4839d339d766SRichard W.M. Jones#include <getopt.h> 4840d339d766SRichard W.M. Jonesint main(void) { return optreset; } 4841d339d766SRichard W.M. JonesEOF 4842d339d766SRichard W.M. Jones 4843d339d766SRichard W.M. Jonesif compile_prog "" "" ; then 4844d339d766SRichard W.M. Jones optreset=yes 4845d339d766SRichard W.M. Jonesfi 4846d339d766SRichard W.M. Jones 4847c2882b96SRiku Voipio# check if eventfd is supported 4848c2882b96SRiku Voipioeventfd=no 4849c2882b96SRiku Voipiocat > $TMPC << EOF 4850c2882b96SRiku Voipio#include <sys/eventfd.h> 4851c2882b96SRiku Voipio 4852c2882b96SRiku Voipioint main(void) 4853c2882b96SRiku Voipio{ 485455cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 4855c2882b96SRiku Voipio} 4856c2882b96SRiku VoipioEOF 4857c2882b96SRiku Voipioif compile_prog "" "" ; then 4858c2882b96SRiku Voipio eventfd=yes 4859c2882b96SRiku Voipiofi 4860c2882b96SRiku Voipio 4861751bcc39SMarc-André Lureau# check if memfd is supported 4862751bcc39SMarc-André Lureaumemfd=no 4863751bcc39SMarc-André Lureaucat > $TMPC << EOF 486475e5b70eSPaolo Bonzini#include <sys/mman.h> 4865751bcc39SMarc-André Lureau 4866751bcc39SMarc-André Lureauint main(void) 4867751bcc39SMarc-André Lureau{ 4868751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 4869751bcc39SMarc-André Lureau} 4870751bcc39SMarc-André LureauEOF 4871751bcc39SMarc-André Lureauif compile_prog "" "" ; then 4872751bcc39SMarc-André Lureau memfd=yes 4873751bcc39SMarc-André Lureaufi 4874751bcc39SMarc-André Lureau 4875955727d2SCortland Tölva# check for usbfs 4876955727d2SCortland Tölvahave_usbfs=no 4877955727d2SCortland Tölvaif test "$linux_user" = "yes"; then 487896566d09SThomas Petazzoni cat > $TMPC << EOF 487996566d09SThomas Petazzoni#include <linux/usbdevice_fs.h> 488096566d09SThomas Petazzoni 488196566d09SThomas Petazzoni#ifndef USBDEVFS_GET_CAPABILITIES 488296566d09SThomas Petazzoni#error "USBDEVFS_GET_CAPABILITIES undefined" 488396566d09SThomas Petazzoni#endif 488496566d09SThomas Petazzoni 488596566d09SThomas Petazzoni#ifndef USBDEVFS_DISCONNECT_CLAIM 488696566d09SThomas Petazzoni#error "USBDEVFS_DISCONNECT_CLAIM undefined" 488796566d09SThomas Petazzoni#endif 488896566d09SThomas Petazzoni 488996566d09SThomas Petazzoniint main(void) 489096566d09SThomas Petazzoni{ 489196566d09SThomas Petazzoni return 0; 489296566d09SThomas Petazzoni} 489396566d09SThomas PetazzoniEOF 489496566d09SThomas Petazzoni if compile_prog "" ""; then 4895955727d2SCortland Tölva have_usbfs=yes 4896955727d2SCortland Tölva fi 4897955727d2SCortland Tölvafi 4898751bcc39SMarc-André Lureau 4899d0927938SUlrich Hecht# check for fallocate 4900d0927938SUlrich Hechtfallocate=no 4901d0927938SUlrich Hechtcat > $TMPC << EOF 4902d0927938SUlrich Hecht#include <fcntl.h> 4903d0927938SUlrich Hecht 4904d0927938SUlrich Hechtint main(void) 4905d0927938SUlrich Hecht{ 4906d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 4907d0927938SUlrich Hecht return 0; 4908d0927938SUlrich Hecht} 4909d0927938SUlrich HechtEOF 49108fb03151SPeter Maydellif compile_prog "" "" ; then 4911d0927938SUlrich Hecht fallocate=yes 4912d0927938SUlrich Hechtfi 4913d0927938SUlrich Hecht 49143d4fa43eSKusanagi Kouichi# check for fallocate hole punching 49153d4fa43eSKusanagi Kouichifallocate_punch_hole=no 49163d4fa43eSKusanagi Kouichicat > $TMPC << EOF 49173d4fa43eSKusanagi Kouichi#include <fcntl.h> 49183d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 49193d4fa43eSKusanagi Kouichi 49203d4fa43eSKusanagi Kouichiint main(void) 49213d4fa43eSKusanagi Kouichi{ 49223d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 49233d4fa43eSKusanagi Kouichi return 0; 49243d4fa43eSKusanagi Kouichi} 49253d4fa43eSKusanagi KouichiEOF 49263d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 49273d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 49283d4fa43eSKusanagi Kouichifi 49293d4fa43eSKusanagi Kouichi 4930b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 4931b953f075SDenis V. Lunevfallocate_zero_range=no 4932b953f075SDenis V. Lunevcat > $TMPC << EOF 4933b953f075SDenis V. Lunev#include <fcntl.h> 4934b953f075SDenis V. Lunev#include <linux/falloc.h> 4935b953f075SDenis V. Lunev 4936b953f075SDenis V. Lunevint main(void) 4937b953f075SDenis V. Lunev{ 4938b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 4939b953f075SDenis V. Lunev return 0; 4940b953f075SDenis V. Lunev} 4941b953f075SDenis V. LunevEOF 4942b953f075SDenis V. Lunevif compile_prog "" "" ; then 4943b953f075SDenis V. Lunev fallocate_zero_range=yes 4944b953f075SDenis V. Lunevfi 4945b953f075SDenis V. Lunev 4946ed911435SKevin Wolf# check for posix_fallocate 4947ed911435SKevin Wolfposix_fallocate=no 4948ed911435SKevin Wolfcat > $TMPC << EOF 4949ed911435SKevin Wolf#include <fcntl.h> 4950ed911435SKevin Wolf 4951ed911435SKevin Wolfint main(void) 4952ed911435SKevin Wolf{ 4953ed911435SKevin Wolf posix_fallocate(0, 0, 0); 4954ed911435SKevin Wolf return 0; 4955ed911435SKevin Wolf} 4956ed911435SKevin WolfEOF 4957ed911435SKevin Wolfif compile_prog "" "" ; then 4958ed911435SKevin Wolf posix_fallocate=yes 4959ed911435SKevin Wolffi 4960ed911435SKevin Wolf 4961c727f47dSPeter Maydell# check for sync_file_range 4962c727f47dSPeter Maydellsync_file_range=no 4963c727f47dSPeter Maydellcat > $TMPC << EOF 4964c727f47dSPeter Maydell#include <fcntl.h> 4965c727f47dSPeter Maydell 4966c727f47dSPeter Maydellint main(void) 4967c727f47dSPeter Maydell{ 4968c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 4969c727f47dSPeter Maydell return 0; 4970c727f47dSPeter Maydell} 4971c727f47dSPeter MaydellEOF 49728fb03151SPeter Maydellif compile_prog "" "" ; then 4973c727f47dSPeter Maydell sync_file_range=yes 4974c727f47dSPeter Maydellfi 4975c727f47dSPeter Maydell 4976dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 4977dace20dcSPeter Maydellfiemap=no 4978dace20dcSPeter Maydellcat > $TMPC << EOF 4979dace20dcSPeter Maydell#include <sys/ioctl.h> 4980dace20dcSPeter Maydell#include <linux/fs.h> 4981dace20dcSPeter Maydell#include <linux/fiemap.h> 4982dace20dcSPeter Maydell 4983dace20dcSPeter Maydellint main(void) 4984dace20dcSPeter Maydell{ 4985dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 4986dace20dcSPeter Maydell return 0; 4987dace20dcSPeter Maydell} 4988dace20dcSPeter MaydellEOF 49898fb03151SPeter Maydellif compile_prog "" "" ; then 4990dace20dcSPeter Maydell fiemap=yes 4991dace20dcSPeter Maydellfi 4992dace20dcSPeter Maydell 4993d0927938SUlrich Hecht# check for dup3 4994d0927938SUlrich Hechtdup3=no 4995d0927938SUlrich Hechtcat > $TMPC << EOF 4996d0927938SUlrich Hecht#include <unistd.h> 4997d0927938SUlrich Hecht 4998d0927938SUlrich Hechtint main(void) 4999d0927938SUlrich Hecht{ 5000d0927938SUlrich Hecht dup3(0, 0, 0); 5001d0927938SUlrich Hecht return 0; 5002d0927938SUlrich Hecht} 5003d0927938SUlrich HechtEOF 500478f5d726SJan Kiszkaif compile_prog "" "" ; then 5005d0927938SUlrich Hecht dup3=yes 5006d0927938SUlrich Hechtfi 5007d0927938SUlrich Hecht 50084e0c6529SAlex Bligh# check for ppoll support 50094e0c6529SAlex Blighppoll=no 50104e0c6529SAlex Blighcat > $TMPC << EOF 50114e0c6529SAlex Bligh#include <poll.h> 50124e0c6529SAlex Bligh 50134e0c6529SAlex Blighint main(void) 50144e0c6529SAlex Bligh{ 50154e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 50164e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 50174e0c6529SAlex Bligh return 0; 50184e0c6529SAlex Bligh} 50194e0c6529SAlex BlighEOF 50204e0c6529SAlex Blighif compile_prog "" "" ; then 50214e0c6529SAlex Bligh ppoll=yes 50224e0c6529SAlex Blighfi 50234e0c6529SAlex Bligh 5024cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 5025cd758dd0SAlex Blighprctl_pr_set_timerslack=no 5026cd758dd0SAlex Blighcat > $TMPC << EOF 5027cd758dd0SAlex Bligh#include <sys/prctl.h> 5028cd758dd0SAlex Bligh 5029cd758dd0SAlex Blighint main(void) 5030cd758dd0SAlex Bligh{ 5031cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 5032cd758dd0SAlex Bligh return 0; 5033cd758dd0SAlex Bligh} 5034cd758dd0SAlex BlighEOF 5035cd758dd0SAlex Blighif compile_prog "" "" ; then 5036cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 5037cd758dd0SAlex Blighfi 5038cd758dd0SAlex Bligh 50393b6edd16SPeter Maydell# check for epoll support 50403b6edd16SPeter Maydellepoll=no 50413b6edd16SPeter Maydellcat > $TMPC << EOF 50423b6edd16SPeter Maydell#include <sys/epoll.h> 50433b6edd16SPeter Maydell 50443b6edd16SPeter Maydellint main(void) 50453b6edd16SPeter Maydell{ 50463b6edd16SPeter Maydell epoll_create(0); 50473b6edd16SPeter Maydell return 0; 50483b6edd16SPeter Maydell} 50493b6edd16SPeter MaydellEOF 50508fb03151SPeter Maydellif compile_prog "" "" ; then 50513b6edd16SPeter Maydell epoll=yes 50523b6edd16SPeter Maydellfi 50533b6edd16SPeter Maydell 5054227f0214SPeter Maydell# epoll_create1 is a later addition 5055227f0214SPeter Maydell# so we must check separately for its presence 50563b6edd16SPeter Maydellepoll_create1=no 50573b6edd16SPeter Maydellcat > $TMPC << EOF 50583b6edd16SPeter Maydell#include <sys/epoll.h> 50593b6edd16SPeter Maydell 50603b6edd16SPeter Maydellint main(void) 50613b6edd16SPeter Maydell{ 506219e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 506319e83f6bSPeter Maydell * a function being called. This is necessary so that on 506419e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 506519e83f6bSPeter Maydell * the library but not declared in the header file we will 506619e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 506719e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 506819e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 506919e83f6bSPeter Maydell */ 5070c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 50713b6edd16SPeter Maydell} 50723b6edd16SPeter MaydellEOF 50738fb03151SPeter Maydellif compile_prog "" "" ; then 50743b6edd16SPeter Maydell epoll_create1=yes 50753b6edd16SPeter Maydellfi 50763b6edd16SPeter Maydell 5077a8fd1abaSPeter Maydell# check for sendfile support 5078a8fd1abaSPeter Maydellsendfile=no 5079a8fd1abaSPeter Maydellcat > $TMPC << EOF 5080a8fd1abaSPeter Maydell#include <sys/sendfile.h> 5081a8fd1abaSPeter Maydell 5082a8fd1abaSPeter Maydellint main(void) 5083a8fd1abaSPeter Maydell{ 5084a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 5085a8fd1abaSPeter Maydell} 5086a8fd1abaSPeter MaydellEOF 5087a8fd1abaSPeter Maydellif compile_prog "" "" ; then 5088a8fd1abaSPeter Maydell sendfile=yes 5089a8fd1abaSPeter Maydellfi 5090a8fd1abaSPeter Maydell 509151834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 509251834341SRiku Voipiotimerfd=no 509351834341SRiku Voipiocat > $TMPC << EOF 509451834341SRiku Voipio#include <sys/timerfd.h> 509551834341SRiku Voipio 509651834341SRiku Voipioint main(void) 509751834341SRiku Voipio{ 509851834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 509951834341SRiku Voipio} 510051834341SRiku VoipioEOF 510151834341SRiku Voipioif compile_prog "" "" ; then 510251834341SRiku Voipio timerfd=yes 510351834341SRiku Voipiofi 510451834341SRiku Voipio 51059af5c906SRiku Voipio# check for setns and unshare support 51069af5c906SRiku Voipiosetns=no 51079af5c906SRiku Voipiocat > $TMPC << EOF 51089af5c906SRiku Voipio#include <sched.h> 51099af5c906SRiku Voipio 51109af5c906SRiku Voipioint main(void) 51119af5c906SRiku Voipio{ 51129af5c906SRiku Voipio int ret; 51139af5c906SRiku Voipio ret = setns(0, 0); 51149af5c906SRiku Voipio ret = unshare(0); 51159af5c906SRiku Voipio return ret; 51169af5c906SRiku Voipio} 51179af5c906SRiku VoipioEOF 51189af5c906SRiku Voipioif compile_prog "" "" ; then 51199af5c906SRiku Voipio setns=yes 51209af5c906SRiku Voipiofi 51219af5c906SRiku Voipio 512238860a03SAleksandar Markovic# clock_adjtime probe 512338860a03SAleksandar Markovicclock_adjtime=no 512438860a03SAleksandar Markoviccat > $TMPC <<EOF 512538860a03SAleksandar Markovic#include <time.h> 512638860a03SAleksandar Markovic 512738860a03SAleksandar Markovicint main(void) 512838860a03SAleksandar Markovic{ 512938860a03SAleksandar Markovic return clock_adjtime(0, 0); 513038860a03SAleksandar Markovic} 513138860a03SAleksandar MarkovicEOF 513238860a03SAleksandar Markovicclock_adjtime=no 513338860a03SAleksandar Markovicif compile_prog "" "" ; then 513438860a03SAleksandar Markovic clock_adjtime=yes 513538860a03SAleksandar Markovicfi 513638860a03SAleksandar Markovic 51375a03cd00SAleksandar Markovic# syncfs probe 51385a03cd00SAleksandar Markovicsyncfs=no 51395a03cd00SAleksandar Markoviccat > $TMPC <<EOF 51405a03cd00SAleksandar Markovic#include <unistd.h> 51415a03cd00SAleksandar Markovic 51425a03cd00SAleksandar Markovicint main(void) 51435a03cd00SAleksandar Markovic{ 51445a03cd00SAleksandar Markovic return syncfs(0); 51455a03cd00SAleksandar Markovic} 51465a03cd00SAleksandar MarkovicEOF 51475a03cd00SAleksandar Markovicsyncfs=no 51485a03cd00SAleksandar Markovicif compile_prog "" "" ; then 51495a03cd00SAleksandar Markovic syncfs=yes 51505a03cd00SAleksandar Markovicfi 51515a03cd00SAleksandar Markovic 5152db37dd89SAleksandar Markovic# check for kcov support (kernel must be 4.4+, compiled with certain options) 5153db37dd89SAleksandar Markovickcov=no 5154db37dd89SAleksandar Markovicif check_include sys/kcov.h ; then 5155db37dd89SAleksandar Markovic kcov=yes 5156db37dd89SAleksandar Markovicfi 5157db37dd89SAleksandar Markovic 5158516e8b7dSPeter Maydell# If we're making warnings fatal, apply this to Sphinx runs as well 5159516e8b7dSPeter Maydellsphinx_werror="" 5160516e8b7dSPeter Maydellif test "$werror" = "yes"; then 5161516e8b7dSPeter Maydell sphinx_werror="-W" 5162516e8b7dSPeter Maydellfi 5163516e8b7dSPeter Maydell 51645f71eac0SPeter Maydell# Check we have a new enough version of sphinx-build 51655f71eac0SPeter Maydellhas_sphinx_build() { 51665f71eac0SPeter Maydell # This is a bit awkward but works: create a trivial document and 51675f71eac0SPeter Maydell # try to run it with our configuration file (which enforces a 51685f71eac0SPeter Maydell # version requirement). This will fail if either 51695f71eac0SPeter Maydell # sphinx-build doesn't exist at all or if it is too old. 51705f71eac0SPeter Maydell mkdir -p "$TMPDIR1/sphinx" 51715f71eac0SPeter Maydell touch "$TMPDIR1/sphinx/index.rst" 5172988ae6c3SAlex Bennée "$sphinx_build" $sphinx_werror -c "$source_path/docs" \ 5173988ae6c3SAlex Bennée -b html "$TMPDIR1/sphinx" \ 5174988ae6c3SAlex Bennée "$TMPDIR1/sphinx/out" >> config.log 2>&1 51755f71eac0SPeter Maydell} 51765f71eac0SPeter Maydell 5177cc8ae6deSpbrook# Check if tools are available to build documentation. 5178a25dba17SJuan Quintelaif test "$docs" != "no" ; then 5179758b617aSPeter Maydell if has_sphinx_build; then 5180758b617aSPeter Maydell sphinx_ok=yes 5181758b617aSPeter Maydell else 5182758b617aSPeter Maydell sphinx_ok=no 5183758b617aSPeter Maydell fi 5184758b617aSPeter Maydell if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then 5185a25dba17SJuan Quintela docs=yes 518683a3ab8bSJuan Quintela else 5187a25dba17SJuan Quintela if test "$docs" = "yes" ; then 5188758b617aSPeter Maydell if has $sphinx_build && test "$sphinx_ok" != "yes"; then 5189758b617aSPeter Maydell echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 5190758b617aSPeter Maydell fi 5191758b617aSPeter Maydell feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a Python 3 version of python-sphinx" 519283a3ab8bSJuan Quintela fi 5193a25dba17SJuan Quintela docs=no 519483a3ab8bSJuan Quintela fi 5195cc8ae6deSpbrookfi 5196cc8ae6deSpbrook 5197f514f41cSStefan Weil# Search for bswap_32 function 51986ae9a1f4SJuan Quintelabyteswap_h=no 51996ae9a1f4SJuan Quintelacat > $TMPC << EOF 52006ae9a1f4SJuan Quintela#include <byteswap.h> 52016ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 52026ae9a1f4SJuan QuintelaEOF 520352166aa0SJuan Quintelaif compile_prog "" "" ; then 52046ae9a1f4SJuan Quintela byteswap_h=yes 52056ae9a1f4SJuan Quintelafi 52066ae9a1f4SJuan Quintela 520775f13596SStefan Weil# Search for bswap32 function 52086ae9a1f4SJuan Quintelabswap_h=no 52096ae9a1f4SJuan Quintelacat > $TMPC << EOF 52106ae9a1f4SJuan Quintela#include <sys/endian.h> 52116ae9a1f4SJuan Quintela#include <sys/types.h> 52126ae9a1f4SJuan Quintela#include <machine/bswap.h> 52136ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 52146ae9a1f4SJuan QuintelaEOF 521552166aa0SJuan Quintelaif compile_prog "" "" ; then 52166ae9a1f4SJuan Quintela bswap_h=yes 52176ae9a1f4SJuan Quintelafi 52186ae9a1f4SJuan Quintela 5219da93a1fdSaliguori########################################## 5220e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 5221c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 5222e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 52233c33ea96SPaolo Bonzini libiscsi="yes" 5224ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 5225ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 5226c589b249SRonnie Sahlberg else 5227c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 5228e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 5229c589b249SRonnie Sahlberg fi 5230c589b249SRonnie Sahlberg libiscsi="no" 5231c589b249SRonnie Sahlberg fi 5232c589b249SRonnie Sahlbergfi 5233c589b249SRonnie Sahlberg 5234c589b249SRonnie Sahlberg########################################## 52358bacde8dSNatanael Copa# Do we need libm 52368bacde8dSNatanael Copacat > $TMPC << EOF 52378bacde8dSNatanael Copa#include <math.h> 5238f80ea986SAlexey Kardashevskiyint main(int argc, char **argv) { return isnan(sin((double)argc)); } 52398bacde8dSNatanael CopaEOF 52408bacde8dSNatanael Copaif compile_prog "" "" ; then 52418bacde8dSNatanael Copa : 52428bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 52438bacde8dSNatanael Copa LIBS="-lm $LIBS" 52448bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 52458bacde8dSNatanael Copaelse 524676ad07a4SPeter Maydell error_exit "libm check failed" 52478bacde8dSNatanael Copafi 52488bacde8dSNatanael Copa 52498bacde8dSNatanael Copa########################################## 5250da93a1fdSaliguori# Do we need librt 52518bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 52528bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 52538bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 52548bacde8dSNatanael Copa# function in addition. 5255da93a1fdSaliguoricat > $TMPC <<EOF 5256da93a1fdSaliguori#include <signal.h> 5257da93a1fdSaliguori#include <time.h> 52588bacde8dSNatanael Copaint main(void) { 52598bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 52608bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 52618bacde8dSNatanael Copa} 5262da93a1fdSaliguoriEOF 5263da93a1fdSaliguori 526452166aa0SJuan Quintelaif compile_prog "" "" ; then 526507ffa4bdSJuan Quintela : 52668bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 526718e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 526818e588b1SRick Liu LIBS="$LIBS -lrt" 526918e588b1SRick Liu libs_qga="$libs_qga -lrt" 5270da93a1fdSaliguorifi 5271da93a1fdSaliguori 5272d99e97e6SThomas Huth# Check whether we need to link libutil for openpty() 5273d99e97e6SThomas Huthcat > $TMPC << EOF 5274d99e97e6SThomas Huthextern int openpty(int *am, int *as, char *name, void *termp, void *winp); 5275d99e97e6SThomas Huthint main(void) { return openpty(0, 0, 0, 0, 0); } 5276d99e97e6SThomas HuthEOF 5277d99e97e6SThomas Huth 52789df8b20dSThomas Huthhave_openpty="no" 52799df8b20dSThomas Huthif compile_prog "" "" ; then 52809df8b20dSThomas Huth have_openpty="yes" 52819df8b20dSThomas Huthelse 5282d99e97e6SThomas Huth if compile_prog "" "-lutil" ; then 52836362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 5284d99e97e6SThomas Huth libs_tools="-lutil $libs_tools" 52859df8b20dSThomas Huth have_openpty="yes" 5286d99e97e6SThomas Huth fi 52876362a53fSJuan Quintelafi 52886362a53fSJuan Quintela 5289de5071c5SBlue Swirl########################################## 5290cd4ec0b4SGerd Hoffmann# spice probe 5291cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 5292cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 5293cd4ec0b4SGerd Hoffmann#include <spice.h> 5294cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 5295cd4ec0b4SGerd HoffmannEOF 5296710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 5297710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 52981b63665cSMarc-André Lureau if $pkg_config --atleast-version=0.12.5 spice-server && \ 529965d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 5300cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 5301cd4ec0b4SGerd Hoffmann spice="yes" 5302cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 5303cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 5304cd4ec0b4SGerd Hoffmann else 5305cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 53068efc9363SHu Tao feature_not_found "spice" \ 53071b63665cSMarc-André Lureau "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel" 5308cd4ec0b4SGerd Hoffmann fi 5309cd4ec0b4SGerd Hoffmann spice="no" 5310cd4ec0b4SGerd Hoffmann fi 5311cd4ec0b4SGerd Hoffmannfi 5312cd4ec0b4SGerd Hoffmann 53137b02f544SMarc-André Lureau# check for smartcard support 53147b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 53150f5c642dSMichal Privoznik if $pkg_config --atleast-version=2.5.1 libcacard; then 53167b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 53177b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 53187b02f544SMarc-André Lureau smartcard="yes" 5319111a38b0SRobert Relyea else 53207b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 53217b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 5322111a38b0SRobert Relyea fi 53237b02f544SMarc-André Lureau smartcard="no" 5324111a38b0SRobert Relyea fi 5325111a38b0SRobert Relyeafi 5326111a38b0SRobert Relyea 53272b2325ffSGerd Hoffmann# check for libusb 53282b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 532965d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 53302b2325ffSGerd Hoffmann libusb="yes" 5331ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 5332ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 53332b2325ffSGerd Hoffmann else 53342b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 53358efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 53362b2325ffSGerd Hoffmann fi 53372b2325ffSGerd Hoffmann libusb="no" 53382b2325ffSGerd Hoffmann fi 53392b2325ffSGerd Hoffmannfi 53402b2325ffSGerd Hoffmann 534169354a83SHans de Goede# check for usbredirparser for usb network redirection support 534269354a83SHans de Goedeif test "$usb_redir" != "no" ; then 534365d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 534469354a83SHans de Goede usb_redir="yes" 5345ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 5346ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 534769354a83SHans de Goede else 534869354a83SHans de Goede if test "$usb_redir" = "yes"; then 534921684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 535069354a83SHans de Goede fi 535169354a83SHans de Goede usb_redir="no" 535269354a83SHans de Goede fi 535369354a83SHans de Goedefi 535469354a83SHans de Goede 5355cd4ec0b4SGerd Hoffmann########################################## 5356d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 5357d9840e25STomoki Sekiyama 5358e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 5359e633a5c6SEric Blake test "$vss_win32_sdk" != "no" ; then 5360d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 5361690604f6SMichael Roth "") vss_win32_include="-isystem $source_path" ;; 5362d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 5363d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 5364690604f6SMichael Roth vss_win32_include="-isystem $source_path/.sdk/vss" 5365d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 5366d9840e25STomoki Sekiyama ;; 5367690604f6SMichael Roth *) vss_win32_include="-isystem $vss_win32_sdk" 5368d9840e25STomoki Sekiyama esac 5369d9840e25STomoki Sekiyama cat > $TMPC << EOF 5370d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 5371d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 5372d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 5373d9840e25STomoki SekiyamaEOF 5374d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 5375d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 5376d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 5377315d3184SFam Zheng libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 5378f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 5379d9840e25STomoki Sekiyama else 5380d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 5381d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 5382d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 5383d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 5384d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 5385d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 5386d9840e25STomoki Sekiyama feature_not_found "VSS support" 5387d9840e25STomoki Sekiyama fi 5388d9840e25STomoki Sekiyama guest_agent_with_vss="no" 5389d9840e25STomoki Sekiyama fi 5390d9840e25STomoki Sekiyamafi 5391d9840e25STomoki Sekiyama 5392d9840e25STomoki Sekiyama########################################## 5393d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 5394d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 5395d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 5396d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 5397d9840e25STomoki Sekiyama 5398e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ 5399e633a5c6SEric Blake test "$guest_agent_with_vss" = "yes" ; then 5400d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 5401d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 5402d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 5403d9840e25STomoki Sekiyama if test -n "$programfiles"; then 5404d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 5405d9840e25STomoki Sekiyama else 5406d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 5407d9840e25STomoki Sekiyama fi 5408d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 5409d9840e25STomoki Sekiyama win_sdk="" 5410d9840e25STomoki Sekiyama fi 5411d9840e25STomoki Sekiyamafi 5412d9840e25STomoki Sekiyama 5413d9840e25STomoki Sekiyama########################################## 541450cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 5415e633a5c6SEric Blakeif test "$mingw32" = "yes" && test "$guest_agent" != "no"; then 541650cbebb9SMichael Roth cat > $TMPC << EOF 541750cbebb9SMichael Roth#include <windows.h> 541850cbebb9SMichael Roth#include <ntddscsi.h> 541950cbebb9SMichael Rothint main(void) { 542050cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 542150cbebb9SMichael Roth#error Missing required ioctl definitions 542250cbebb9SMichael Roth#endif 542350cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 542450cbebb9SMichael Roth return addr.Lun; 542550cbebb9SMichael Roth} 542650cbebb9SMichael RothEOF 542750cbebb9SMichael Roth if compile_prog "" "" ; then 542850cbebb9SMichael Roth guest_agent_ntddscsi=yes 5429996b9cdcSMatt Hines libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" 543050cbebb9SMichael Roth fi 543150cbebb9SMichael Rothfi 543250cbebb9SMichael Roth 543350cbebb9SMichael Roth########################################## 54349d9e1521SGerd Hoffmann# virgl renderer probe 54359d9e1521SGerd Hoffmann 54369d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 54379d9e1521SGerd Hoffmann cat > $TMPC << EOF 54389d9e1521SGerd Hoffmann#include <virglrenderer.h> 54399d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 54409d9e1521SGerd HoffmannEOF 54419d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 54429d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 544347479c55SMarc-André Lureau virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null) 54449d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 54459d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 54469d9e1521SGerd Hoffmann virglrenderer="yes" 54479d9e1521SGerd Hoffmann else 54489d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 54499d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 54509d9e1521SGerd Hoffmann fi 54519d9e1521SGerd Hoffmann virglrenderer="no" 54529d9e1521SGerd Hoffmann fi 54539d9e1521SGerd Hoffmannfi 54549d9e1521SGerd Hoffmann 54559d9e1521SGerd Hoffmann########################################## 54568ca80760SRichard Henderson# capstone 54578ca80760SRichard Henderson 5458e219c499SRichard Hendersoncase "$capstone" in 5459e219c499SRichard Henderson "" | yes) 54608ca80760SRichard Henderson if $pkg_config capstone; then 5461e219c499SRichard Henderson capstone=system 5462e633a5c6SEric Blake elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 5463e219c499SRichard Henderson capstone=git 5464e219c499SRichard Henderson elif test -e "${source_path}/capstone/Makefile" ; then 5465e219c499SRichard Henderson capstone=internal 5466e219c499SRichard Henderson elif test -z "$capstone" ; then 5467e219c499SRichard Henderson capstone=no 5468e219c499SRichard Henderson else 5469e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel or git submodule" 5470e219c499SRichard Henderson fi 5471e219c499SRichard Henderson ;; 5472e219c499SRichard Henderson 5473e219c499SRichard Henderson system) 5474e219c499SRichard Henderson if ! $pkg_config capstone; then 5475e219c499SRichard Henderson feature_not_found "capstone" "Install capstone devel" 5476e219c499SRichard Henderson fi 5477e219c499SRichard Henderson ;; 5478e219c499SRichard Hendersonesac 5479e219c499SRichard Henderson 5480e219c499SRichard Hendersoncase "$capstone" in 5481e219c499SRichard Henderson git | internal) 5482e219c499SRichard Henderson if test "$capstone" = git; then 5483e219c499SRichard Henderson git_submodules="${git_submodules} capstone" 5484e219c499SRichard Henderson fi 5485e219c499SRichard Henderson mkdir -p capstone 548625211446SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -I${source_path}/capstone/include" 5487e219c499SRichard Henderson if test "$mingw32" = "yes"; then 5488e219c499SRichard Henderson LIBCAPSTONE=capstone.lib 5489e219c499SRichard Henderson else 5490e219c499SRichard Henderson LIBCAPSTONE=libcapstone.a 5491e219c499SRichard Henderson fi 549225211446SPaolo Bonzini libs_cpu="-L$PWD/capstone -lcapstone $libs_cpu" 5493e219c499SRichard Henderson ;; 5494e219c499SRichard Henderson 5495e219c499SRichard Henderson system) 54968ca80760SRichard Henderson QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" 549702f9135bSDaniel P. Berrangé libs_cpu="$($pkg_config --libs capstone) $libs_cpu" 5498e219c499SRichard Henderson ;; 5499e219c499SRichard Henderson 5500e219c499SRichard Henderson no) 5501e219c499SRichard Henderson ;; 5502e219c499SRichard Henderson *) 5503e219c499SRichard Henderson error_exit "Unknown state for capstone: $capstone" 5504e219c499SRichard Henderson ;; 5505e219c499SRichard Hendersonesac 55068ca80760SRichard Henderson 55078ca80760SRichard Henderson########################################## 55085f6b9e8fSBlue Swirl# check if we have fdatasync 55095f6b9e8fSBlue Swirl 55105f6b9e8fSBlue Swirlfdatasync=no 55115f6b9e8fSBlue Swirlcat > $TMPC << EOF 55125f6b9e8fSBlue Swirl#include <unistd.h> 5513d1722a27SAlexandre Raymondint main(void) { 5514d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 5515d1722a27SAlexandre Raymondreturn fdatasync(0); 5516d1722a27SAlexandre Raymond#else 5517e172fe11SStefan Weil#error Not supported 5518d1722a27SAlexandre Raymond#endif 5519d1722a27SAlexandre Raymond} 55205f6b9e8fSBlue SwirlEOF 55215f6b9e8fSBlue Swirlif compile_prog "" "" ; then 55225f6b9e8fSBlue Swirl fdatasync=yes 55235f6b9e8fSBlue Swirlfi 55245f6b9e8fSBlue Swirl 552594a420b1SStefan Hajnoczi########################################## 5526e78815a5SAndreas Färber# check if we have madvise 5527e78815a5SAndreas Färber 5528e78815a5SAndreas Färbermadvise=no 5529e78815a5SAndreas Färbercat > $TMPC << EOF 5530e78815a5SAndreas Färber#include <sys/types.h> 5531e78815a5SAndreas Färber#include <sys/mman.h> 5532832ce9c2SScott Wood#include <stddef.h> 5533e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 5534e78815a5SAndreas FärberEOF 5535e78815a5SAndreas Färberif compile_prog "" "" ; then 5536e78815a5SAndreas Färber madvise=yes 5537e78815a5SAndreas Färberfi 5538e78815a5SAndreas Färber 5539e78815a5SAndreas Färber########################################## 5540e78815a5SAndreas Färber# check if we have posix_madvise 5541e78815a5SAndreas Färber 5542e78815a5SAndreas Färberposix_madvise=no 5543e78815a5SAndreas Färbercat > $TMPC << EOF 5544e78815a5SAndreas Färber#include <sys/mman.h> 5545832ce9c2SScott Wood#include <stddef.h> 5546e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 5547e78815a5SAndreas FärberEOF 5548e78815a5SAndreas Färberif compile_prog "" "" ; then 5549e78815a5SAndreas Färber posix_madvise=yes 5550e78815a5SAndreas Färberfi 5551e78815a5SAndreas Färber 5552e78815a5SAndreas Färber########################################## 55539bc5a719SAndreas Gustafsson# check if we have posix_memalign() 55549bc5a719SAndreas Gustafsson 55559bc5a719SAndreas Gustafssonposix_memalign=no 55569bc5a719SAndreas Gustafssoncat > $TMPC << EOF 55579bc5a719SAndreas Gustafsson#include <stdlib.h> 55589bc5a719SAndreas Gustafssonint main(void) { 55599bc5a719SAndreas Gustafsson void *p; 55609bc5a719SAndreas Gustafsson return posix_memalign(&p, 8, 8); 55619bc5a719SAndreas Gustafsson} 55629bc5a719SAndreas GustafssonEOF 55639bc5a719SAndreas Gustafssonif compile_prog "" "" ; then 55649bc5a719SAndreas Gustafsson posix_memalign=yes 55659bc5a719SAndreas Gustafssonfi 55669bc5a719SAndreas Gustafsson 55679bc5a719SAndreas Gustafsson########################################## 55680a852417SPaul Durrant# check if we have posix_syslog 55690a852417SPaul Durrant 55700a852417SPaul Durrantposix_syslog=no 55710a852417SPaul Durrantcat > $TMPC << EOF 55720a852417SPaul Durrant#include <syslog.h> 55730a852417SPaul Durrantint main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; } 55740a852417SPaul DurrantEOF 55750a852417SPaul Durrantif compile_prog "" "" ; then 55760a852417SPaul Durrant posix_syslog=yes 55770a852417SPaul Durrantfi 55780a852417SPaul Durrant 55790a852417SPaul Durrant########################################## 5580401bc051SPeter Maydell# check if we have sem_timedwait 5581401bc051SPeter Maydell 5582401bc051SPeter Maydellsem_timedwait=no 5583401bc051SPeter Maydellcat > $TMPC << EOF 5584401bc051SPeter Maydell#include <semaphore.h> 5585811294b7SDaniel P. Berrangéint main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); } 5586401bc051SPeter MaydellEOF 5587401bc051SPeter Maydellif compile_prog "" "" ; then 5588401bc051SPeter Maydell sem_timedwait=yes 5589401bc051SPeter Maydellfi 5590401bc051SPeter Maydell 5591401bc051SPeter Maydell########################################## 55925c99fa37SKeno Fischer# check if we have strchrnul 55935c99fa37SKeno Fischer 55945c99fa37SKeno Fischerstrchrnul=no 55955c99fa37SKeno Fischercat > $TMPC << EOF 55965c99fa37SKeno Fischer#include <string.h> 55975c99fa37SKeno Fischerint main(void); 55985c99fa37SKeno Fischer// Use a haystack that the compiler shouldn't be able to constant fold 55995c99fa37SKeno Fischerchar *haystack = (char*)&main; 56005c99fa37SKeno Fischerint main(void) { return strchrnul(haystack, 'x') != &haystack[6]; } 56015c99fa37SKeno FischerEOF 56025c99fa37SKeno Fischerif compile_prog "" "" ; then 56035c99fa37SKeno Fischer strchrnul=yes 56045c99fa37SKeno Fischerfi 56055c99fa37SKeno Fischer 56068a792b03SJiufei Xue######################################### 56078a792b03SJiufei Xue# check if we have st_atim 56088a792b03SJiufei Xue 56098a792b03SJiufei Xuest_atim=no 56108a792b03SJiufei Xuecat > $TMPC << EOF 56118a792b03SJiufei Xue#include <sys/stat.h> 56128a792b03SJiufei Xue#include <stddef.h> 56138a792b03SJiufei Xueint main(void) { return offsetof(struct stat, st_atim); } 56148a792b03SJiufei XueEOF 56158a792b03SJiufei Xueif compile_prog "" "" ; then 56168a792b03SJiufei Xue st_atim=yes 56178a792b03SJiufei Xuefi 56188a792b03SJiufei Xue 56195c99fa37SKeno Fischer########################################## 562094a420b1SStefan Hajnoczi# check if trace backend exists 562194a420b1SStefan Hajnoczi 56225b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 562394a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 56245b808275SLluís Vilanova error_exit "invalid trace backends" \ 56255b808275SLluís Vilanova "Please choose supported trace backends." 562694a420b1SStefan Hajnoczifi 562794a420b1SStefan Hajnoczi 56287e24e92aSStefan Hajnoczi########################################## 56297e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 56305b808275SLluís Vilanovaif have_backend "ust"; then 56317e24e92aSStefan Hajnoczi cat > $TMPC << EOF 5632bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 56337e24e92aSStefan Hajnocziint main(void) { return 0; } 56347e24e92aSStefan HajnocziEOF 5635c79ed23dSFrancis Deslauriers if compile_prog "" "-Wl,--no-as-needed -ldl" ; then 5636bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 563789138857SStefan Weil lttng_ust_libs=$($pkg_config --libs lttng-ust) 56387e24e92aSStefan Hajnoczi else 5639c79ed23dSFrancis Deslauriers lttng_ust_libs="-llttng-ust -ldl" 5640bf15f63cSMohamad Gebai fi 5641bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 564289138857SStefan Weil urcu_bp_libs=$($pkg_config --libs liburcu-bp) 5643bf15f63cSMohamad Gebai else 5644bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 5645bf15f63cSMohamad Gebai fi 5646bf15f63cSMohamad Gebai 5647bf15f63cSMohamad Gebai LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 5648bf15f63cSMohamad Gebai libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 5649bf15f63cSMohamad Gebai else 5650bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 56517e24e92aSStefan Hajnoczi fi 56527e24e92aSStefan Hajnoczifi 5653b3d08c02SDaniel P. Berrange 5654b3d08c02SDaniel P. Berrange########################################## 5655b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 56565b808275SLluís Vilanovaif have_backend "dtrace"; then 5657b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 565876ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 5659b3d08c02SDaniel P. Berrange fi 5660c276b17dSDaniel P. Berrange trace_backend_stap="no" 5661c276b17dSDaniel P. Berrange if has 'stap' ; then 5662c276b17dSDaniel P. Berrange trace_backend_stap="yes" 5663c276b17dSDaniel P. Berrange fi 5664b3d08c02SDaniel P. Berrangefi 5665b3d08c02SDaniel P. Berrange 56667e24e92aSStefan Hajnoczi########################################## 5667519175a2SAlex Barcelo# check and set a backend for coroutine 5668d0e2fce5SAneesh Kumar K.V 56697c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 567033c53c54SDaniel P. Berrange# is sigcontext. On Windows the only valid backend is the Windows 567133c53c54SDaniel P. Berrange# specific one. 56727c2acc70SPeter Maydell 56737c2acc70SPeter Maydellucontext_works=no 5674d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 5675d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 5676d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 5677cdf84806SPeter Maydell#ifdef __stub_makecontext 5678cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 5679cdf84806SPeter Maydell#endif 568075cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 5681d0e2fce5SAneesh Kumar K.VEOF 5682d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 56837c2acc70SPeter Maydell ucontext_works=yes 5684d0e2fce5SAneesh Kumar K.V fi 5685519175a2SAlex Barcelofi 56867c2acc70SPeter Maydell 56877c2acc70SPeter Maydellif test "$coroutine" = ""; then 56887c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 56897c2acc70SPeter Maydell coroutine=win32 56907c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 56917c2acc70SPeter Maydell coroutine=ucontext 5692519175a2SAlex Barcelo else 56937c2acc70SPeter Maydell coroutine=sigaltstack 56947c2acc70SPeter Maydell fi 56957c2acc70SPeter Maydellelse 56967c2acc70SPeter Maydell case $coroutine in 56977c2acc70SPeter Maydell windows) 56987c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 56997c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 57007c2acc70SPeter Maydell fi 57017c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 57027c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 57037c2acc70SPeter Maydell coroutine=win32 57047c2acc70SPeter Maydell ;; 57057c2acc70SPeter Maydell ucontext) 57067c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 57077c2acc70SPeter Maydell feature_not_found "ucontext" 57087c2acc70SPeter Maydell fi 57097c2acc70SPeter Maydell ;; 571033c53c54SDaniel P. Berrange sigaltstack) 57117c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 57127c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 57137c2acc70SPeter Maydell fi 57147c2acc70SPeter Maydell ;; 57157c2acc70SPeter Maydell *) 571676ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 57177c2acc70SPeter Maydell ;; 57187c2acc70SPeter Maydell esac 5719d0e2fce5SAneesh Kumar K.Vfi 5720d0e2fce5SAneesh Kumar K.V 572170c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 572270c60c08SStefan Hajnoczi coroutine_pool=yes 572370c60c08SStefan Hajnoczifi 572470c60c08SStefan Hajnoczi 57257d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes"; then 57267d992e4dSPeter Lieven if test "$coroutine_pool" = "yes"; then 57277d992e4dSPeter Lieven echo "WARN: disabling coroutine pool for stack usage debugging" 57287d992e4dSPeter Lieven coroutine_pool=no 57297d992e4dSPeter Lieven fi 57307d992e4dSPeter Lievenfi 57317d992e4dSPeter Lieven 57321e4f6065SDaniele Buono################################################## 57331e4f6065SDaniele Buono# SafeStack 57341e4f6065SDaniele Buono 57351e4f6065SDaniele Buono 57361e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 57371e4f6065SDaniele Buonocat > $TMPC << EOF 57381e4f6065SDaniele Buonoint main(int argc, char *argv[]) 57391e4f6065SDaniele Buono{ 57401e4f6065SDaniele Buono#if ! __has_feature(safe_stack) 57411e4f6065SDaniele Buono#error SafeStack Disabled 57421e4f6065SDaniele Buono#endif 57431e4f6065SDaniele Buono return 0; 57441e4f6065SDaniele Buono} 57451e4f6065SDaniele BuonoEOF 57461e4f6065SDaniele Buono flag="-fsanitize=safe-stack" 57471e4f6065SDaniele Buono # Check that safe-stack is supported and enabled. 57481e4f6065SDaniele Buono if compile_prog "-Werror $flag" "$flag"; then 57491e4f6065SDaniele Buono # Flag needed both at compilation and at linking 57501e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 57511e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 57521e4f6065SDaniele Buono else 57531e4f6065SDaniele Buono error_exit "SafeStack not supported by your compiler" 57541e4f6065SDaniele Buono fi 57551e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 57561e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 57571e4f6065SDaniele Buono fi 57581e4f6065SDaniele Buonoelse 57591e4f6065SDaniele Buonocat > $TMPC << EOF 57601e4f6065SDaniele Buonoint main(int argc, char *argv[]) 57611e4f6065SDaniele Buono{ 57621e4f6065SDaniele Buono#if defined(__has_feature) 57631e4f6065SDaniele Buono#if __has_feature(safe_stack) 57641e4f6065SDaniele Buono#error SafeStack Enabled 57651e4f6065SDaniele Buono#endif 57661e4f6065SDaniele Buono#endif 57671e4f6065SDaniele Buono return 0; 57681e4f6065SDaniele Buono} 57691e4f6065SDaniele BuonoEOF 57701e4f6065SDaniele Buonoif test "$safe_stack" = "no"; then 57711e4f6065SDaniele Buono # Make sure that safe-stack is disabled 57721e4f6065SDaniele Buono if ! compile_prog "-Werror" ""; then 57731e4f6065SDaniele Buono # SafeStack was already enabled, try to explicitly remove the feature 57741e4f6065SDaniele Buono flag="-fno-sanitize=safe-stack" 57751e4f6065SDaniele Buono if ! compile_prog "-Werror $flag" "$flag"; then 57761e4f6065SDaniele Buono error_exit "Configure cannot disable SafeStack" 57771e4f6065SDaniele Buono fi 57781e4f6065SDaniele Buono QEMU_CFLAGS="$QEMU_CFLAGS $flag" 57791e4f6065SDaniele Buono QEMU_LDFLAGS="$QEMU_LDFLAGS $flag" 57801e4f6065SDaniele Buono fi 57811e4f6065SDaniele Buonoelse # "$safe_stack" = "" 57821e4f6065SDaniele Buono # Set safe_stack to yes or no based on pre-existing flags 57831e4f6065SDaniele Buono if compile_prog "-Werror" ""; then 57841e4f6065SDaniele Buono safe_stack="no" 57851e4f6065SDaniele Buono else 57861e4f6065SDaniele Buono safe_stack="yes" 57871e4f6065SDaniele Buono if test "$coroutine" != "ucontext"; then 57881e4f6065SDaniele Buono error_exit "SafeStack is only supported by the coroutine backend ucontext" 57891e4f6065SDaniele Buono fi 57901e4f6065SDaniele Buono fi 57911e4f6065SDaniele Buonofi 57921e4f6065SDaniele Buonofi 57937d992e4dSPeter Lieven 5794d0e2fce5SAneesh Kumar K.V########################################## 5795d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 5796d2042378SAneesh Kumar K.V 57974e1797f9SStefan Weilopen_by_handle_at=no 5798d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 5799d2042378SAneesh Kumar K.V#include <fcntl.h> 5800acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 5801acc55ba8SStefan Weil# error missing definition 5802acc55ba8SStefan Weil#else 580375cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 5804acc55ba8SStefan Weil#endif 5805d2042378SAneesh Kumar K.VEOF 5806d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 5807d2042378SAneesh Kumar K.V open_by_handle_at=yes 5808d2042378SAneesh Kumar K.Vfi 5809d2042378SAneesh Kumar K.V 5810e06a765eSHarsh Prateek Bora######################################## 5811e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 5812e06a765eSHarsh Prateek Bora 5813e06a765eSHarsh Prateek Boralinux_magic_h=no 5814e06a765eSHarsh Prateek Boracat > $TMPC << EOF 5815e06a765eSHarsh Prateek Bora#include <linux/magic.h> 5816e06a765eSHarsh Prateek Boraint main(void) { 581775cafad7SStefan Weil return 0; 5818e06a765eSHarsh Prateek Bora} 5819e06a765eSHarsh Prateek BoraEOF 5820e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 5821e06a765eSHarsh Prateek Bora linux_magic_h=yes 5822e06a765eSHarsh Prateek Borafi 5823e06a765eSHarsh Prateek Bora 58248ab1bf12SLuiz Capitulino######################################## 5825541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 58263f4349dcSKevin Wolf 58273f4349dcSKevin Wolfvalgrind_h=no 58283f4349dcSKevin Wolfcat > $TMPC << EOF 58293f4349dcSKevin Wolf#include <valgrind/valgrind.h> 58303f4349dcSKevin Wolfint main(void) { 58313f4349dcSKevin Wolf return 0; 58323f4349dcSKevin Wolf} 58333f4349dcSKevin WolfEOF 58343f4349dcSKevin Wolfif compile_prog "" "" ; then 58353f4349dcSKevin Wolf valgrind_h=yes 58363f4349dcSKevin Wolffi 58373f4349dcSKevin Wolf 58383f4349dcSKevin Wolf######################################## 58398ab1bf12SLuiz Capitulino# check if environ is declared 58408ab1bf12SLuiz Capitulino 58418ab1bf12SLuiz Capitulinohas_environ=no 58428ab1bf12SLuiz Capitulinocat > $TMPC << EOF 58438ab1bf12SLuiz Capitulino#include <unistd.h> 58448ab1bf12SLuiz Capitulinoint main(void) { 5845c075a723SBlue Swirl environ = 0; 58468ab1bf12SLuiz Capitulino return 0; 58478ab1bf12SLuiz Capitulino} 58488ab1bf12SLuiz CapitulinoEOF 58498ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 58508ab1bf12SLuiz Capitulino has_environ=yes 58518ab1bf12SLuiz Capitulinofi 58528ab1bf12SLuiz Capitulino 585376a347e1SRichard Henderson######################################## 585476a347e1SRichard Henderson# check if cpuid.h is usable. 585576a347e1SRichard Henderson 585676a347e1SRichard Hendersoncat > $TMPC << EOF 585776a347e1SRichard Henderson#include <cpuid.h> 585876a347e1SRichard Hendersonint main(void) { 5859774d566cSPeter Maydell unsigned a, b, c, d; 5860774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 5861774d566cSPeter Maydell 5862774d566cSPeter Maydell if (max >= 1) { 5863774d566cSPeter Maydell __cpuid(1, a, b, c, d); 5864774d566cSPeter Maydell } 5865774d566cSPeter Maydell 5866774d566cSPeter Maydell if (max >= 7) { 5867774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 5868774d566cSPeter Maydell } 5869774d566cSPeter Maydell 587076a347e1SRichard Henderson return 0; 587176a347e1SRichard Henderson} 587276a347e1SRichard HendersonEOF 587376a347e1SRichard Hendersonif compile_prog "" "" ; then 587476a347e1SRichard Henderson cpuid_h=yes 587576a347e1SRichard Hendersonfi 587676a347e1SRichard Henderson 58775dd89908SRichard Henderson########################################## 58785dd89908SRichard Henderson# avx2 optimization requirement check 58795dd89908SRichard Henderson# 58805dd89908SRichard Henderson# There is no point enabling this if cpuid.h is not usable, 58815dd89908SRichard Henderson# since we won't be able to select the new routines. 58825dd89908SRichard Henderson 5883e633a5c6SEric Blakeif test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then 58845dd89908SRichard Henderson cat > $TMPC << EOF 58855dd89908SRichard Henderson#pragma GCC push_options 58865dd89908SRichard Henderson#pragma GCC target("avx2") 58875dd89908SRichard Henderson#include <cpuid.h> 58885dd89908SRichard Henderson#include <immintrin.h> 58895dd89908SRichard Hendersonstatic int bar(void *a) { 58905dd89908SRichard Henderson __m256i x = *(__m256i *)a; 58915dd89908SRichard Henderson return _mm256_testz_si256(x, x); 58925dd89908SRichard Henderson} 58935dd89908SRichard Hendersonint main(int argc, char *argv[]) { return bar(argv[0]); } 58945dd89908SRichard HendersonEOF 58955dd89908SRichard Henderson if compile_object "" ; then 58965dd89908SRichard Henderson avx2_opt="yes" 589786583a07SLiam Merwick else 589886583a07SLiam Merwick avx2_opt="no" 58995dd89908SRichard Henderson fi 59005dd89908SRichard Hendersonfi 59015dd89908SRichard Henderson 59026b8cd447SRobert Hoo########################################## 59036b8cd447SRobert Hoo# avx512f optimization requirement check 59046b8cd447SRobert Hoo# 59056b8cd447SRobert Hoo# There is no point enabling this if cpuid.h is not usable, 59066b8cd447SRobert Hoo# since we won't be able to select the new routines. 59076b8cd447SRobert Hoo# by default, it is turned off. 59086b8cd447SRobert Hoo# if user explicitly want to enable it, check environment 59096b8cd447SRobert Hoo 59106b8cd447SRobert Hooif test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then 59116b8cd447SRobert Hoo cat > $TMPC << EOF 59126b8cd447SRobert Hoo#pragma GCC push_options 59136b8cd447SRobert Hoo#pragma GCC target("avx512f") 59146b8cd447SRobert Hoo#include <cpuid.h> 59156b8cd447SRobert Hoo#include <immintrin.h> 59166b8cd447SRobert Hoostatic int bar(void *a) { 59176b8cd447SRobert Hoo __m512i x = *(__m512i *)a; 59186b8cd447SRobert Hoo return _mm512_test_epi64_mask(x, x); 59196b8cd447SRobert Hoo} 59206b8cd447SRobert Hooint main(int argc, char *argv[]) 59216b8cd447SRobert Hoo{ 59226b8cd447SRobert Hoo return bar(argv[0]); 59236b8cd447SRobert Hoo} 59246b8cd447SRobert HooEOF 59256b8cd447SRobert Hoo if ! compile_object "" ; then 59266b8cd447SRobert Hoo avx512f_opt="no" 59276b8cd447SRobert Hoo fi 59286b8cd447SRobert Hooelse 59296b8cd447SRobert Hoo avx512f_opt="no" 59306b8cd447SRobert Hoofi 59316b8cd447SRobert Hoo 5932f540166bSRichard Henderson######################################## 5933f540166bSRichard Henderson# check if __[u]int128_t is usable. 5934f540166bSRichard Henderson 5935f540166bSRichard Hendersonint128=no 5936f540166bSRichard Hendersoncat > $TMPC << EOF 5937f540166bSRichard Henderson__int128_t a; 5938f540166bSRichard Henderson__uint128_t b; 5939f540166bSRichard Hendersonint main (void) { 5940f540166bSRichard Henderson a = a + b; 5941f540166bSRichard Henderson b = a * b; 5942464e3671SPeter Maydell a = a * a; 5943f540166bSRichard Henderson return 0; 5944f540166bSRichard Henderson} 5945f540166bSRichard HendersonEOF 5946f540166bSRichard Hendersonif compile_prog "" "" ; then 5947f540166bSRichard Henderson int128=yes 5948f540166bSRichard Hendersonfi 594976a347e1SRichard Henderson 59507ebee43eSRichard Henderson######################################### 59517ebee43eSRichard Henderson# See if 128-bit atomic operations are supported. 59527ebee43eSRichard Henderson 59537ebee43eSRichard Hendersonatomic128=no 59547ebee43eSRichard Hendersonif test "$int128" = "yes"; then 59557ebee43eSRichard Henderson cat > $TMPC << EOF 59567ebee43eSRichard Hendersonint main(void) 59577ebee43eSRichard Henderson{ 59587ebee43eSRichard Henderson unsigned __int128 x = 0, y = 0; 59597ebee43eSRichard Henderson y = __atomic_load_16(&x, 0); 59607ebee43eSRichard Henderson __atomic_store_16(&x, y, 0); 59617ebee43eSRichard Henderson __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0); 59627ebee43eSRichard Henderson return 0; 59637ebee43eSRichard Henderson} 59647ebee43eSRichard HendersonEOF 59657ebee43eSRichard Henderson if compile_prog "" "" ; then 59667ebee43eSRichard Henderson atomic128=yes 59677ebee43eSRichard Henderson fi 59687ebee43eSRichard Hendersonfi 59697ebee43eSRichard Henderson 5970e6cd4bb5SRichard Hendersoncmpxchg128=no 5971e633a5c6SEric Blakeif test "$int128" = yes && test "$atomic128" = no; then 5972e6cd4bb5SRichard Henderson cat > $TMPC << EOF 5973e6cd4bb5SRichard Hendersonint main(void) 5974e6cd4bb5SRichard Henderson{ 5975e6cd4bb5SRichard Henderson unsigned __int128 x = 0, y = 0; 5976e6cd4bb5SRichard Henderson __sync_val_compare_and_swap_16(&x, y, x); 5977e6cd4bb5SRichard Henderson return 0; 5978e6cd4bb5SRichard Henderson} 5979e6cd4bb5SRichard HendersonEOF 5980e6cd4bb5SRichard Henderson if compile_prog "" "" ; then 5981e6cd4bb5SRichard Henderson cmpxchg128=yes 5982e6cd4bb5SRichard Henderson fi 5983e6cd4bb5SRichard Hendersonfi 5984e6cd4bb5SRichard Henderson 5985df79b996SRichard Henderson######################################### 5986df79b996SRichard Henderson# See if 64-bit atomic operations are supported. 5987df79b996SRichard Henderson# Note that without __atomic builtins, we can only 5988df79b996SRichard Henderson# assume atomic loads/stores max at pointer size. 5989df79b996SRichard Henderson 5990df79b996SRichard Hendersoncat > $TMPC << EOF 5991df79b996SRichard Henderson#include <stdint.h> 5992df79b996SRichard Hendersonint main(void) 5993df79b996SRichard Henderson{ 5994df79b996SRichard Henderson uint64_t x = 0, y = 0; 5995df79b996SRichard Henderson#ifdef __ATOMIC_RELAXED 5996df79b996SRichard Henderson y = __atomic_load_8(&x, 0); 5997df79b996SRichard Henderson __atomic_store_8(&x, y, 0); 5998df79b996SRichard Henderson __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0); 5999df79b996SRichard Henderson __atomic_exchange_8(&x, y, 0); 6000df79b996SRichard Henderson __atomic_fetch_add_8(&x, y, 0); 6001df79b996SRichard Henderson#else 6002df79b996SRichard Henderson typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1]; 6003df79b996SRichard Henderson __sync_lock_test_and_set(&x, y); 6004df79b996SRichard Henderson __sync_val_compare_and_swap(&x, y, 0); 6005df79b996SRichard Henderson __sync_fetch_and_add(&x, y); 6006df79b996SRichard Henderson#endif 6007df79b996SRichard Henderson return 0; 6008df79b996SRichard Henderson} 6009df79b996SRichard HendersonEOF 6010df79b996SRichard Hendersonif compile_prog "" "" ; then 6011df79b996SRichard Henderson atomic64=yes 6012df79b996SRichard Hendersonfi 6013df79b996SRichard Henderson 601426fffe29SEmilio G. Cota######################################### 601526fffe29SEmilio G. Cota# See if --dynamic-list is supported by the linker 601626fffe29SEmilio G. Cotald_dynamic_list="no" 601726fffe29SEmilio G. Cotaif test "$static" = "no" ; then 601826fffe29SEmilio G. Cota cat > $TMPTXT <<EOF 601926fffe29SEmilio G. Cota{ 602026fffe29SEmilio G. Cota foo; 602126fffe29SEmilio G. Cota}; 602226fffe29SEmilio G. CotaEOF 602326fffe29SEmilio G. Cota 602426fffe29SEmilio G. Cota cat > $TMPC <<EOF 602526fffe29SEmilio G. Cota#include <stdio.h> 602626fffe29SEmilio G. Cotavoid foo(void); 602726fffe29SEmilio G. Cota 602826fffe29SEmilio G. Cotavoid foo(void) 602926fffe29SEmilio G. Cota{ 603026fffe29SEmilio G. Cota printf("foo\n"); 603126fffe29SEmilio G. Cota} 603226fffe29SEmilio G. Cota 603326fffe29SEmilio G. Cotaint main(void) 603426fffe29SEmilio G. Cota{ 603526fffe29SEmilio G. Cota foo(); 603626fffe29SEmilio G. Cota return 0; 603726fffe29SEmilio G. Cota} 603826fffe29SEmilio G. CotaEOF 603926fffe29SEmilio G. Cota 604026fffe29SEmilio G. Cota if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then 604126fffe29SEmilio G. Cota ld_dynamic_list="yes" 604226fffe29SEmilio G. Cota fi 604326fffe29SEmilio G. Cotafi 604426fffe29SEmilio G. Cota 604526fffe29SEmilio G. Cota######################################### 604626fffe29SEmilio G. Cota# See if -exported_symbols_list is supported by the linker 604726fffe29SEmilio G. Cota 604826fffe29SEmilio G. Cotald_exported_symbols_list="no" 604926fffe29SEmilio G. Cotaif test "$static" = "no" ; then 605026fffe29SEmilio G. Cota cat > $TMPTXT <<EOF 605126fffe29SEmilio G. Cota _foo 605226fffe29SEmilio G. CotaEOF 605326fffe29SEmilio G. Cota 605426fffe29SEmilio G. Cota if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then 605526fffe29SEmilio G. Cota ld_exported_symbols_list="yes" 605626fffe29SEmilio G. Cota fi 605726fffe29SEmilio G. Cotafi 605826fffe29SEmilio G. Cota 605926fffe29SEmilio G. Cotaif test "$plugins" = "yes" && 606026fffe29SEmilio G. Cota test "$ld_dynamic_list" = "no" && 606126fffe29SEmilio G. Cota test "$ld_exported_symbols_list" = "no" ; then 606226fffe29SEmilio G. Cota error_exit \ 606326fffe29SEmilio G. Cota "Plugin support requires dynamic linking and specifying a set of symbols " \ 606426fffe29SEmilio G. Cota "that are exported to plugins. Unfortunately your linker doesn't " \ 606526fffe29SEmilio G. Cota "support the flag (--dynamic-list or -exported_symbols_list) used " \ 606626fffe29SEmilio G. Cota "for this purpose. You can't build with --static." 606726fffe29SEmilio G. Cotafi 606826fffe29SEmilio G. Cota 60691e6e9acaSRichard Henderson######################################## 6070db8aaae8SRichard Henderson# See if __attribute__((alias)) is supported. 6071db8aaae8SRichard Henderson# This false for Xcode 9, but has been remedied for Xcode 10. 6072db8aaae8SRichard Henderson# Unfortunately, travis uses Xcode 9 by default. 6073db8aaae8SRichard Henderson 6074db8aaae8SRichard Hendersonattralias=no 6075db8aaae8SRichard Hendersoncat > $TMPC << EOF 6076db8aaae8SRichard Hendersonint x = 1; 6077db8aaae8SRichard Hendersonextern const int y __attribute__((alias("x"))); 6078db8aaae8SRichard Hendersonint main(void) { return 0; } 6079db8aaae8SRichard HendersonEOF 6080db8aaae8SRichard Hendersonif compile_prog "" "" ; then 6081db8aaae8SRichard Henderson attralias=yes 6082db8aaae8SRichard Hendersonfi 6083db8aaae8SRichard Henderson 6084db8aaae8SRichard Henderson######################################## 60851e6e9acaSRichard Henderson# check if getauxval is available. 60861e6e9acaSRichard Henderson 60871e6e9acaSRichard Hendersongetauxval=no 60881e6e9acaSRichard Hendersoncat > $TMPC << EOF 60891e6e9acaSRichard Henderson#include <sys/auxv.h> 60901e6e9acaSRichard Hendersonint main(void) { 60911e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 60921e6e9acaSRichard Henderson} 60931e6e9acaSRichard HendersonEOF 60941e6e9acaSRichard Hendersonif compile_prog "" "" ; then 60951e6e9acaSRichard Henderson getauxval=yes 60961e6e9acaSRichard Hendersonfi 60971e6e9acaSRichard Henderson 6098fd0e6053SJohn Snow######################################## 6099fd0e6053SJohn Snow# check if ccache is interfering with 6100fd0e6053SJohn Snow# semantic analysis of macros 6101fd0e6053SJohn Snow 61025e4dfd3dSJohn Snowunset CCACHE_CPP2 6103fd0e6053SJohn Snowccache_cpp2=no 6104fd0e6053SJohn Snowcat > $TMPC << EOF 6105fd0e6053SJohn Snowstatic const int Z = 1; 6106fd0e6053SJohn Snow#define fn() ({ Z; }) 6107fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 6108fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 6109fd0e6053SJohn Snow#define ID(X) (X) 6110fd0e6053SJohn Snowint main(int argc, char *argv[]) 6111fd0e6053SJohn Snow{ 6112fd0e6053SJohn Snow int x = 0, y = 0; 6113fd0e6053SJohn Snow x = ID(x); 6114fd0e6053SJohn Snow x = fn(); 6115fd0e6053SJohn Snow fn(); 6116fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 6117fd0e6053SJohn Snow if (TAUT(Z)) return 0; 6118fd0e6053SJohn Snow return 0; 6119fd0e6053SJohn Snow} 6120fd0e6053SJohn SnowEOF 6121fd0e6053SJohn Snow 6122fd0e6053SJohn Snowif ! compile_object "-Werror"; then 6123fd0e6053SJohn Snow ccache_cpp2=yes 6124fd0e6053SJohn Snowfi 6125fd0e6053SJohn Snow 6126b553a042SJohn Snow################################################# 6127b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 6128b553a042SJohn Snow 6129b553a042SJohn Snowif test "$fortify_source" != "no"; then 6130b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 6131b553a042SJohn Snow fortify_source="no"; 6132e189091fSPeter Maydell elif test -n "$cxx" && has $cxx && 6133cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 6134b553a042SJohn Snow fortify_source="no"; 6135b553a042SJohn Snow else 6136b553a042SJohn Snow fortify_source="yes" 6137b553a042SJohn Snow fi 6138b553a042SJohn Snowfi 6139b553a042SJohn Snow 61401efad060SFam Zheng############################################### 61411efad060SFam Zheng# Check if copy_file_range is provided by glibc 61421efad060SFam Zhenghave_copy_file_range=no 61431efad060SFam Zhengcat > $TMPC << EOF 61441efad060SFam Zheng#include <unistd.h> 61451efad060SFam Zhengint main(void) { 61461efad060SFam Zheng copy_file_range(0, NULL, 0, NULL, 0, 0); 61471efad060SFam Zheng return 0; 61481efad060SFam Zheng} 61491efad060SFam ZhengEOF 61501efad060SFam Zhengif compile_prog "" "" ; then 61511efad060SFam Zheng have_copy_file_range=yes 61521efad060SFam Zhengfi 61531efad060SFam Zheng 6154d2042378SAneesh Kumar K.V########################################## 6155277abf15SJan Vesely# check if struct fsxattr is available via linux/fs.h 6156277abf15SJan Vesely 6157277abf15SJan Veselyhave_fsxattr=no 6158277abf15SJan Veselycat > $TMPC << EOF 6159277abf15SJan Vesely#include <linux/fs.h> 6160277abf15SJan Veselystruct fsxattr foo; 6161277abf15SJan Veselyint main(void) { 6162277abf15SJan Vesely return 0; 6163277abf15SJan Vesely} 6164277abf15SJan VeselyEOF 6165277abf15SJan Veselyif compile_prog "" "" ; then 6166277abf15SJan Vesely have_fsxattr=yes 6167277abf15SJan Veselyfi 6168277abf15SJan Vesely 6169b66e10e4SPeter Maydell########################################## 6170a40161cbSPaolo Bonzini# check for usable membarrier system call 6171a40161cbSPaolo Bonziniif test "$membarrier" = "yes"; then 6172a40161cbSPaolo Bonzini have_membarrier=no 6173a40161cbSPaolo Bonzini if test "$mingw32" = "yes" ; then 6174a40161cbSPaolo Bonzini have_membarrier=yes 6175a40161cbSPaolo Bonzini elif test "$linux" = "yes" ; then 6176a40161cbSPaolo Bonzini cat > $TMPC << EOF 6177a40161cbSPaolo Bonzini #include <linux/membarrier.h> 6178a40161cbSPaolo Bonzini #include <sys/syscall.h> 6179a40161cbSPaolo Bonzini #include <unistd.h> 6180a40161cbSPaolo Bonzini #include <stdlib.h> 6181a40161cbSPaolo Bonzini int main(void) { 6182a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); 6183a40161cbSPaolo Bonzini syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); 6184a40161cbSPaolo Bonzini exit(0); 6185a40161cbSPaolo Bonzini } 6186a40161cbSPaolo BonziniEOF 6187a40161cbSPaolo Bonzini if compile_prog "" "" ; then 6188a40161cbSPaolo Bonzini have_membarrier=yes 6189a40161cbSPaolo Bonzini fi 6190a40161cbSPaolo Bonzini fi 6191a40161cbSPaolo Bonzini if test "$have_membarrier" = "no"; then 6192a40161cbSPaolo Bonzini feature_not_found "membarrier" "membarrier system call not available" 6193a40161cbSPaolo Bonzini fi 6194a40161cbSPaolo Bonzinielse 6195a40161cbSPaolo Bonzini # Do not enable it by default even for Mingw32, because it doesn't 6196a40161cbSPaolo Bonzini # work on Wine. 6197a40161cbSPaolo Bonzini membarrier=no 6198a40161cbSPaolo Bonzinifi 6199a40161cbSPaolo Bonzini 6200a40161cbSPaolo Bonzini########################################## 6201b66e10e4SPeter Maydell# check if rtnetlink.h exists and is useful 6202575b22b1SLaurent Vivierhave_rtnetlink=no 6203575b22b1SLaurent Viviercat > $TMPC << EOF 6204575b22b1SLaurent Vivier#include <linux/rtnetlink.h> 6205575b22b1SLaurent Vivierint main(void) { 6206575b22b1SLaurent Vivier return IFLA_PROTO_DOWN; 6207575b22b1SLaurent Vivier} 6208575b22b1SLaurent VivierEOF 6209575b22b1SLaurent Vivierif compile_prog "" "" ; then 6210575b22b1SLaurent Vivier have_rtnetlink=yes 6211575b22b1SLaurent Vivierfi 6212575b22b1SLaurent Vivier 62136a02c806SStefan Hajnoczi########################################## 62146a02c806SStefan Hajnoczi# check for usable AF_VSOCK environment 62156a02c806SStefan Hajnoczihave_af_vsock=no 62166a02c806SStefan Hajnoczicat > $TMPC << EOF 62176a02c806SStefan Hajnoczi#include <errno.h> 62186a02c806SStefan Hajnoczi#include <sys/types.h> 62196a02c806SStefan Hajnoczi#include <sys/socket.h> 62206a02c806SStefan Hajnoczi#if !defined(AF_VSOCK) 62216a02c806SStefan Hajnoczi# error missing AF_VSOCK flag 62226a02c806SStefan Hajnoczi#endif 62236a02c806SStefan Hajnoczi#include <linux/vm_sockets.h> 62246a02c806SStefan Hajnocziint main(void) { 62256a02c806SStefan Hajnoczi int sock, ret; 62266a02c806SStefan Hajnoczi struct sockaddr_vm svm; 62276a02c806SStefan Hajnoczi socklen_t len = sizeof(svm); 62286a02c806SStefan Hajnoczi sock = socket(AF_VSOCK, SOCK_STREAM, 0); 62296a02c806SStefan Hajnoczi ret = getpeername(sock, (struct sockaddr *)&svm, &len); 62306a02c806SStefan Hajnoczi if ((ret == -1) && (errno == ENOTCONN)) { 62316a02c806SStefan Hajnoczi return 0; 62326a02c806SStefan Hajnoczi } 62336a02c806SStefan Hajnoczi return -1; 62346a02c806SStefan Hajnoczi} 62356a02c806SStefan HajnocziEOF 62366a02c806SStefan Hajnocziif compile_prog "" "" ; then 62376a02c806SStefan Hajnoczi have_af_vsock=yes 62386a02c806SStefan Hajnoczifi 62396a02c806SStefan Hajnoczi 6240f0d92b56SLongpeng(Mike)########################################## 6241f0d92b56SLongpeng(Mike)# check for usable AF_ALG environment 62424f67366eSThomas Huthhave_afalg=no 6243f0d92b56SLongpeng(Mike)cat > $TMPC << EOF 6244f0d92b56SLongpeng(Mike)#include <errno.h> 6245f0d92b56SLongpeng(Mike)#include <sys/types.h> 6246f0d92b56SLongpeng(Mike)#include <sys/socket.h> 6247f0d92b56SLongpeng(Mike)#include <linux/if_alg.h> 6248f0d92b56SLongpeng(Mike)int main(void) { 6249f0d92b56SLongpeng(Mike) int sock; 6250f0d92b56SLongpeng(Mike) sock = socket(AF_ALG, SOCK_SEQPACKET, 0); 6251f0d92b56SLongpeng(Mike) return sock; 6252f0d92b56SLongpeng(Mike)} 6253f0d92b56SLongpeng(Mike)EOF 6254f0d92b56SLongpeng(Mike)if compile_prog "" "" ; then 6255f0d92b56SLongpeng(Mike) have_afalg=yes 6256f0d92b56SLongpeng(Mike)fi 6257f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" 6258f0d92b56SLongpeng(Mike)then 6259f0d92b56SLongpeng(Mike) if test "$have_afalg" != "yes" 6260f0d92b56SLongpeng(Mike) then 6261f0d92b56SLongpeng(Mike) error_exit "AF_ALG requested but could not be detected" 6262f0d92b56SLongpeng(Mike) fi 6263f0d92b56SLongpeng(Mike)fi 6264f0d92b56SLongpeng(Mike) 6265f0d92b56SLongpeng(Mike) 62666969ec6cSJames Clarke################################################# 6267c97d6d2cSSergio Andres Gomez Del Real# Check to see if we have the Hypervisor framework 6268d2d08522SPeter Maydellif [ "$darwin" = "yes" ] ; then 6269c97d6d2cSSergio Andres Gomez Del Real cat > $TMPC << EOF 6270c97d6d2cSSergio Andres Gomez Del Real#include <Hypervisor/hv.h> 6271c97d6d2cSSergio Andres Gomez Del Realint main() { return 0;} 6272c97d6d2cSSergio Andres Gomez Del RealEOF 6273c97d6d2cSSergio Andres Gomez Del Real if ! compile_object ""; then 6274c97d6d2cSSergio Andres Gomez Del Real hvf='no' 6275c97d6d2cSSergio Andres Gomez Del Real else 6276c97d6d2cSSergio Andres Gomez Del Real hvf='yes' 6277db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS" 6278c97d6d2cSSergio Andres Gomez Del Real fi 6279c97d6d2cSSergio Andres Gomez Del Realfi 6280c97d6d2cSSergio Andres Gomez Del Real 6281c97d6d2cSSergio Andres Gomez Del Real################################################# 62826969ec6cSJames Clarke# Sparc implicitly links with --relax, which is 62836969ec6cSJames Clarke# incompatible with -r, so --no-relax should be 62846969ec6cSJames Clarke# given. It does no harm to give it on other 62856969ec6cSJames Clarke# platforms too. 62866969ec6cSJames Clarke 62876969ec6cSJames Clarke# Note: the prototype is needed since QEMU_CFLAGS 62886969ec6cSJames Clarke# contains -Wmissing-prototypes 62896969ec6cSJames Clarkecat > $TMPC << EOF 62906969ec6cSJames Clarkeextern int foo(void); 62916969ec6cSJames Clarkeint foo(void) { return 0; } 62926969ec6cSJames ClarkeEOF 62936969ec6cSJames Clarkeif ! compile_object ""; then 62946969ec6cSJames Clarke error_exit "Failed to compile object file for LD_REL_FLAGS test" 62956969ec6cSJames Clarkefi 62967ecf44a5SPaolo Bonzinifor i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do 62977ecf44a5SPaolo Bonzini if do_cc -nostdlib $i -o $TMPMO $TMPO; then 62987ecf44a5SPaolo Bonzini LD_REL_FLAGS=$i 62997ecf44a5SPaolo Bonzini break 63007ecf44a5SPaolo Bonzini fi 63017ecf44a5SPaolo Bonzinidone 63027ecf44a5SPaolo Bonziniif test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then 63037ecf44a5SPaolo Bonzini feature_not_found "modules" "Cannot find how to build relocatable objects" 63046969ec6cSJames Clarkefi 63056969ec6cSJames Clarke 6306277abf15SJan Vesely########################################## 63074d04351fSChristopher Covington# check for sysmacros.h 63084d04351fSChristopher Covington 63094d04351fSChristopher Covingtonhave_sysmacros=no 63104d04351fSChristopher Covingtoncat > $TMPC << EOF 63114d04351fSChristopher Covington#include <sys/sysmacros.h> 63124d04351fSChristopher Covingtonint main(void) { 63134d04351fSChristopher Covington return makedev(0, 0); 63144d04351fSChristopher Covington} 63154d04351fSChristopher CovingtonEOF 63164d04351fSChristopher Covingtonif compile_prog "" "" ; then 63174d04351fSChristopher Covington have_sysmacros=yes 63184d04351fSChristopher Covingtonfi 63194d04351fSChristopher Covington 63204d04351fSChristopher Covington########################################## 632149e00a18SAndreas Grapentin# check for _Static_assert() 632249e00a18SAndreas Grapentin 632349e00a18SAndreas Grapentinhave_static_assert=no 632449e00a18SAndreas Grapentincat > $TMPC << EOF 632549e00a18SAndreas Grapentin_Static_assert(1, "success"); 632649e00a18SAndreas Grapentinint main(void) { 632749e00a18SAndreas Grapentin return 0; 632849e00a18SAndreas Grapentin} 632949e00a18SAndreas GrapentinEOF 633049e00a18SAndreas Grapentinif compile_prog "" "" ; then 633149e00a18SAndreas Grapentin have_static_assert=yes 633249e00a18SAndreas Grapentinfi 633349e00a18SAndreas Grapentin 633449e00a18SAndreas Grapentin########################################## 6335e674605fSTomáš Golembiovský# check for utmpx.h, it is missing e.g. on OpenBSD 6336e674605fSTomáš Golembiovský 6337e674605fSTomáš Golembiovskýhave_utmpx=no 6338e674605fSTomáš Golembiovskýcat > $TMPC << EOF 6339e674605fSTomáš Golembiovský#include <utmpx.h> 6340e674605fSTomáš Golembiovskýstruct utmpx user_info; 6341e674605fSTomáš Golembiovskýint main(void) { 6342e674605fSTomáš Golembiovský return 0; 6343e674605fSTomáš Golembiovský} 6344e674605fSTomáš GolembiovskýEOF 6345e674605fSTomáš Golembiovskýif compile_prog "" "" ; then 6346e674605fSTomáš Golembiovský have_utmpx=yes 6347e674605fSTomáš Golembiovskýfi 6348e674605fSTomáš Golembiovský 6349e674605fSTomáš Golembiovský########################################## 6350db1ed1abSRichard Henderson# check for getrandom() 6351db1ed1abSRichard Henderson 6352db1ed1abSRichard Hendersonhave_getrandom=no 6353db1ed1abSRichard Hendersoncat > $TMPC << EOF 6354db1ed1abSRichard Henderson#include <sys/random.h> 6355db1ed1abSRichard Hendersonint main(void) { 6356db1ed1abSRichard Henderson return getrandom(0, 0, GRND_NONBLOCK); 6357db1ed1abSRichard Henderson} 6358db1ed1abSRichard HendersonEOF 6359db1ed1abSRichard Hendersonif compile_prog "" "" ; then 6360db1ed1abSRichard Henderson have_getrandom=yes 6361db1ed1abSRichard Hendersonfi 6362db1ed1abSRichard Henderson 6363db1ed1abSRichard Henderson########################################## 6364247724cbSMarc-André Lureau# checks for sanitizers 6365247724cbSMarc-André Lureau 6366247724cbSMarc-André Lureauhave_asan=no 6367247724cbSMarc-André Lureauhave_ubsan=no 6368d83414e1SMarc-André Lureauhave_asan_iface_h=no 6369d83414e1SMarc-André Lureauhave_asan_iface_fiber=no 6370247724cbSMarc-André Lureau 6371247724cbSMarc-André Lureauif test "$sanitizers" = "yes" ; then 6372b9f44da2SMarc-André Lureau write_c_skeleton 6373247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then 6374247724cbSMarc-André Lureau have_asan=yes 6375247724cbSMarc-André Lureau fi 6376b9f44da2SMarc-André Lureau 6377b9f44da2SMarc-André Lureau # we could use a simple skeleton for flags checks, but this also 6378b9f44da2SMarc-André Lureau # detect the static linking issue of ubsan, see also: 6379b9f44da2SMarc-André Lureau # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 6380b9f44da2SMarc-André Lureau cat > $TMPC << EOF 6381b9f44da2SMarc-André Lureau#include <stdlib.h> 6382b9f44da2SMarc-André Lureauint main(void) { 6383b9f44da2SMarc-André Lureau void *tmp = malloc(10); 6384f2dfe54cSLeonid Bloch if (tmp != NULL) { 6385b9f44da2SMarc-André Lureau return *(int *)(tmp + 2); 6386b9f44da2SMarc-André Lureau } 6387d1abf3fcSOlaf Hering return 1; 6388f2dfe54cSLeonid Bloch} 6389b9f44da2SMarc-André LureauEOF 6390247724cbSMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then 6391247724cbSMarc-André Lureau have_ubsan=yes 6392247724cbSMarc-André Lureau fi 6393d83414e1SMarc-André Lureau 6394d83414e1SMarc-André Lureau if check_include "sanitizer/asan_interface.h" ; then 6395d83414e1SMarc-André Lureau have_asan_iface_h=yes 6396d83414e1SMarc-André Lureau fi 6397d83414e1SMarc-André Lureau 6398d83414e1SMarc-André Lureau cat > $TMPC << EOF 6399d83414e1SMarc-André Lureau#include <sanitizer/asan_interface.h> 6400d83414e1SMarc-André Lureauint main(void) { 6401d83414e1SMarc-André Lureau __sanitizer_start_switch_fiber(0, 0, 0); 6402d83414e1SMarc-André Lureau return 0; 6403d83414e1SMarc-André Lureau} 6404d83414e1SMarc-André LureauEOF 6405d83414e1SMarc-André Lureau if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then 6406d83414e1SMarc-André Lureau have_asan_iface_fiber=yes 6407d83414e1SMarc-André Lureau fi 6408247724cbSMarc-André Lureaufi 6409247724cbSMarc-André Lureau 6410247724cbSMarc-André Lureau########################################## 6411adc28027SAlexander Bulekov# checks for fuzzer 6412adc28027SAlexander Bulekovif test "$fuzzing" = "yes" ; then 6413adc28027SAlexander Bulekov write_c_fuzzer_skeleton 6414dd016265SAlexander Bulekov if compile_prog "$CPU_CFLAGS -Werror -fsanitize=fuzzer" ""; then 6415adc28027SAlexander Bulekov have_fuzzer=yes 6416adc28027SAlexander Bulekov fi 6417adc28027SAlexander Bulekovfi 6418adc28027SAlexander Bulekov 64190aebab04SLingfeng Yang# Thread sanitizer is, for now, much noisier than the other sanitizers; 64200aebab04SLingfeng Yang# keep it separate until that is not the case. 64210aebab04SLingfeng Yangif test "$tsan" = "yes" && test "$sanitizers" = "yes"; then 64220aebab04SLingfeng Yang error_exit "TSAN is not supported with other sanitiziers." 64230aebab04SLingfeng Yangfi 64240aebab04SLingfeng Yanghave_tsan=no 64250aebab04SLingfeng Yanghave_tsan_iface_fiber=no 64260aebab04SLingfeng Yangif test "$tsan" = "yes" ; then 64270aebab04SLingfeng Yang write_c_skeleton 64280aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 64290aebab04SLingfeng Yang have_tsan=yes 64300aebab04SLingfeng Yang fi 64310aebab04SLingfeng Yang cat > $TMPC << EOF 64320aebab04SLingfeng Yang#include <sanitizer/tsan_interface.h> 64330aebab04SLingfeng Yangint main(void) { 64340aebab04SLingfeng Yang __tsan_create_fiber(0); 64350aebab04SLingfeng Yang return 0; 64360aebab04SLingfeng Yang} 64370aebab04SLingfeng YangEOF 64380aebab04SLingfeng Yang if compile_prog "$CPU_CFLAGS -Werror -fsanitize=thread" "" ; then 64390aebab04SLingfeng Yang have_tsan_iface_fiber=yes 64400aebab04SLingfeng Yang fi 64410aebab04SLingfeng Yangfi 64420aebab04SLingfeng Yang 6443adc28027SAlexander Bulekov########################################## 644417824406SJunyan He# check for libpmem 644517824406SJunyan He 644617824406SJunyan Heif test "$libpmem" != "no"; then 644717824406SJunyan He if $pkg_config --exists "libpmem"; then 644817824406SJunyan He libpmem="yes" 644917824406SJunyan He libpmem_libs=$($pkg_config --libs libpmem) 645017824406SJunyan He libpmem_cflags=$($pkg_config --cflags libpmem) 645117824406SJunyan He libs_softmmu="$libs_softmmu $libpmem_libs" 645217824406SJunyan He QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags" 645317824406SJunyan He else 645417824406SJunyan He if test "$libpmem" = "yes" ; then 645517824406SJunyan He feature_not_found "libpmem" "Install nvml or pmdk" 645617824406SJunyan He fi 645717824406SJunyan He libpmem="no" 645817824406SJunyan He fi 645917824406SJunyan Hefi 646017824406SJunyan He 646117824406SJunyan He########################################## 646221b2eca6SJingqi Liu# check for libdaxctl 646321b2eca6SJingqi Liu 646421b2eca6SJingqi Liuif test "$libdaxctl" != "no"; then 646521b2eca6SJingqi Liu if $pkg_config --atleast-version=57 "libdaxctl"; then 646621b2eca6SJingqi Liu libdaxctl="yes" 646721b2eca6SJingqi Liu libdaxctl_libs=$($pkg_config --libs libdaxctl) 646821b2eca6SJingqi Liu libdaxctl_cflags=$($pkg_config --cflags libdaxctl) 646921b2eca6SJingqi Liu libs_softmmu="$libs_softmmu $libdaxctl_libs" 647021b2eca6SJingqi Liu QEMU_CFLAGS="$QEMU_CFLAGS $libdaxctl_cflags" 647121b2eca6SJingqi Liu else 647221b2eca6SJingqi Liu if test "$libdaxctl" = "yes" ; then 647321b2eca6SJingqi Liu feature_not_found "libdaxctl" "Install libdaxctl" 647421b2eca6SJingqi Liu fi 647521b2eca6SJingqi Liu libdaxctl="no" 647621b2eca6SJingqi Liu fi 647721b2eca6SJingqi Liufi 647821b2eca6SJingqi Liu 647921b2eca6SJingqi Liu########################################## 6480675b9b53SMarc-André Lureau# check for slirp 6481675b9b53SMarc-André Lureau 6482d599938aSLaurent Vivier# slirp is only required when building softmmu targets 6483d599938aSLaurent Vivierif test -z "$slirp" -a "$softmmu" != "yes" ; then 6484d599938aSLaurent Vivier slirp="no" 6485d599938aSLaurent Vivierfi 6486d599938aSLaurent Vivier 6487675b9b53SMarc-André Lureaucase "$slirp" in 6488675b9b53SMarc-André Lureau "" | yes) 6489675b9b53SMarc-André Lureau if $pkg_config slirp; then 6490675b9b53SMarc-André Lureau slirp=system 64917c57bdd8SMarc-André Lureau elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then 64927c57bdd8SMarc-André Lureau slirp=git 6493675b9b53SMarc-André Lureau elif test -e "${source_path}/slirp/Makefile" ; then 6494675b9b53SMarc-André Lureau slirp=internal 6495675b9b53SMarc-André Lureau elif test -z "$slirp" ; then 6496675b9b53SMarc-André Lureau slirp=no 6497675b9b53SMarc-André Lureau else 6498675b9b53SMarc-André Lureau feature_not_found "slirp" "Install slirp devel or git submodule" 6499675b9b53SMarc-André Lureau fi 6500675b9b53SMarc-André Lureau ;; 6501675b9b53SMarc-André Lureau 6502675b9b53SMarc-André Lureau system) 6503675b9b53SMarc-André Lureau if ! $pkg_config slirp; then 6504675b9b53SMarc-André Lureau feature_not_found "slirp" "Install slirp devel" 6505675b9b53SMarc-André Lureau fi 6506675b9b53SMarc-André Lureau ;; 6507675b9b53SMarc-André Lureauesac 6508675b9b53SMarc-André Lureau 6509675b9b53SMarc-André Lureaucase "$slirp" in 65107c57bdd8SMarc-André Lureau git | internal) 65117c57bdd8SMarc-André Lureau if test "$slirp" = git; then 65127c57bdd8SMarc-André Lureau git_submodules="${git_submodules} slirp" 65137c57bdd8SMarc-André Lureau fi 6514675b9b53SMarc-André Lureau mkdir -p slirp 651525211446SPaolo Bonzini slirp_cflags="-I${source_path}/slirp/src -I$PWD/slirp/src" 651625211446SPaolo Bonzini slirp_libs="-L$PWD/slirp -lslirp" 6517b965e8c5SPaolo Bonzini if test "$mingw32" = "yes" ; then 6518b965e8c5SPaolo Bonzini slirp_libs="$slirp_libs -lws2_32 -liphlpapi" 6519b965e8c5SPaolo Bonzini fi 6520675b9b53SMarc-André Lureau ;; 6521675b9b53SMarc-André Lureau 6522675b9b53SMarc-André Lureau system) 6523675b9b53SMarc-André Lureau slirp_version=$($pkg_config --modversion slirp 2>/dev/null) 6524675b9b53SMarc-André Lureau slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null) 6525675b9b53SMarc-André Lureau slirp_libs=$($pkg_config --libs slirp 2>/dev/null) 6526675b9b53SMarc-André Lureau ;; 6527675b9b53SMarc-André Lureau 6528675b9b53SMarc-André Lureau no) 6529675b9b53SMarc-André Lureau ;; 6530675b9b53SMarc-André Lureau *) 6531675b9b53SMarc-André Lureau error_exit "Unknown state for slirp: $slirp" 6532675b9b53SMarc-André Lureau ;; 6533675b9b53SMarc-André Lureauesac 6534675b9b53SMarc-André Lureau 653554e7aac0SAlexey Krasikov########################################## 653654e7aac0SAlexey Krasikov# check for usable __NR_keyctl syscall 653754e7aac0SAlexey Krasikov 653854e7aac0SAlexey Krasikovif test "$linux" = "yes" ; then 653954e7aac0SAlexey Krasikov 654054e7aac0SAlexey Krasikov have_keyring=no 654154e7aac0SAlexey Krasikov cat > $TMPC << EOF 654254e7aac0SAlexey Krasikov#include <errno.h> 654354e7aac0SAlexey Krasikov#include <asm/unistd.h> 654454e7aac0SAlexey Krasikov#include <linux/keyctl.h> 654554e7aac0SAlexey Krasikov#include <unistd.h> 654654e7aac0SAlexey Krasikovint main(void) { 654754e7aac0SAlexey Krasikov return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0); 654854e7aac0SAlexey Krasikov} 654954e7aac0SAlexey KrasikovEOF 655054e7aac0SAlexey Krasikov if compile_prog "" "" ; then 655154e7aac0SAlexey Krasikov have_keyring=yes 655254e7aac0SAlexey Krasikov fi 655354e7aac0SAlexey Krasikovfi 655454e7aac0SAlexey Krasikovif test "$secret_keyring" != "no" 655554e7aac0SAlexey Krasikovthen 6556b418d265SDavid Edmondson if test "$have_keyring" = "yes" 655754e7aac0SAlexey Krasikov then 655854e7aac0SAlexey Krasikov secret_keyring=yes 655954e7aac0SAlexey Krasikov else 656054e7aac0SAlexey Krasikov if test "$secret_keyring" = "yes" 656154e7aac0SAlexey Krasikov then 656254e7aac0SAlexey Krasikov error_exit "syscall __NR_keyctl requested, \ 656354e7aac0SAlexey Krasikovbut not implemented on your system" 656454e7aac0SAlexey Krasikov else 656554e7aac0SAlexey Krasikov secret_keyring=no 656654e7aac0SAlexey Krasikov fi 656754e7aac0SAlexey Krasikov fi 656854e7aac0SAlexey Krasikovfi 656954e7aac0SAlexey Krasikov 657092500362SAlexey Krasikov########################################## 657192500362SAlexey Krasikov# check for usable keyutils.h 657292500362SAlexey Krasikov 657392500362SAlexey Krasikovif test "$linux" = "yes" ; then 657492500362SAlexey Krasikov 657592500362SAlexey Krasikov have_keyutils=no 657692500362SAlexey Krasikov cat > $TMPC << EOF 657792500362SAlexey Krasikov#include <errno.h> 657892500362SAlexey Krasikov#include <asm/unistd.h> 657992500362SAlexey Krasikov#include <unistd.h> 658092500362SAlexey Krasikov#include <sys/types.h> 658192500362SAlexey Krasikov#include <keyutils.h> 658292500362SAlexey Krasikovint main(void) { 658392500362SAlexey Krasikov return request_key("user", NULL, NULL, 0); 658492500362SAlexey Krasikov} 658592500362SAlexey KrasikovEOF 658692500362SAlexey Krasikov if compile_prog "" "-lkeyutils"; then 658792500362SAlexey Krasikov have_keyutils=yes 658892500362SAlexey Krasikov fi 658992500362SAlexey Krasikovfi 659092500362SAlexey Krasikov 6591675b9b53SMarc-André Lureau 6592675b9b53SMarc-André Lureau########################################## 6593e86ecd4bSJuan Quintela# End of CC checks 6594e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 6595e86ecd4bSJuan Quintela 6596d83414e1SMarc-André Lureauwrite_c_skeleton 6597d83414e1SMarc-André Lureau 65981d728c39SBlue Swirlif test "$gcov" = "yes" ; then 6599bf0e56a3SMarc-André Lureau : 6600b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 6601086d5f75SPaolo Bonzini QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 6602086d5f75SPaolo Bonzini debug=no 6603086d5f75SPaolo Bonzinifi 6604086d5f75SPaolo Bonziniif test "$debug_info" = "yes"; then 6605086d5f75SPaolo Bonzini CFLAGS="-g $CFLAGS" 6606086d5f75SPaolo Bonzini LDFLAGS="-g $LDFLAGS" 6607086d5f75SPaolo Bonzinifi 6608a5665051SPaolo Bonziniif test "$debug" = "no"; then 6609a5665051SPaolo Bonzini CFLAGS="-O2 $CFLAGS" 6610a5665051SPaolo Bonzinifi 6611086d5f75SPaolo Bonzini 6612086d5f75SPaolo Bonzinicase "$ARCH" in 6613086d5f75SPaolo Bonzinialpha) 6614086d5f75SPaolo Bonzini # Ensure there's only a single GP 6615086d5f75SPaolo Bonzini QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS" 6616086d5f75SPaolo Bonzini;; 6617086d5f75SPaolo Bonziniesac 6618086d5f75SPaolo Bonzini 6619086d5f75SPaolo Bonziniif test "$gprof" = "yes" ; then 6620086d5f75SPaolo Bonzini QEMU_CFLAGS="-p $QEMU_CFLAGS" 6621086d5f75SPaolo Bonzini QEMU_LDFLAGS="-p $QEMU_LDFLAGS" 6622086d5f75SPaolo Bonzinifi 6623a316e378SJuan Quintela 6624247724cbSMarc-André Lureauif test "$have_asan" = "yes"; then 6625db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" 6626db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" 6627d83414e1SMarc-André Lureau if test "$have_asan_iface_h" = "no" ; then 6628d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header missing." \ 6629d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 6630d83414e1SMarc-André Lureau elif test "$have_asan_iface_fiber" = "no" ; then 6631d83414e1SMarc-André Lureau echo "ASAN build enabled, but ASAN header is too old." \ 6632d83414e1SMarc-André Lureau "Without code annotation, the report may be inferior." 6633d83414e1SMarc-André Lureau fi 6634247724cbSMarc-André Lureaufi 66350aebab04SLingfeng Yangif test "$have_tsan" = "yes" ; then 66360aebab04SLingfeng Yang if test "$have_tsan_iface_fiber" = "yes" ; then 66370aebab04SLingfeng Yang QEMU_CFLAGS="-fsanitize=thread $QEMU_CFLAGS" 66380aebab04SLingfeng Yang QEMU_LDFLAGS="-fsanitize=thread $QEMU_LDFLAGS" 66390aebab04SLingfeng Yang else 66400aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing fiber annotation interface." 66410aebab04SLingfeng Yang fi 66420aebab04SLingfeng Yangelif test "$tsan" = "yes" ; then 66430aebab04SLingfeng Yang error_exit "Cannot enable TSAN due to missing sanitize thread interface." 66440aebab04SLingfeng Yangfi 6645247724cbSMarc-André Lureauif test "$have_ubsan" = "yes"; then 6646db5adeaaSPaolo Bonzini QEMU_CFLAGS="-fsanitize=undefined $QEMU_CFLAGS" 6647db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" 6648247724cbSMarc-André Lureaufi 6649247724cbSMarc-André Lureau 66506542aa9cSPeter Lieven########################################## 66516542aa9cSPeter Lieven# Do we have libnfs 66526542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 6653b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 66546542aa9cSPeter Lieven libnfs="yes" 66556542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 66566542aa9cSPeter Lieven else 66576542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 66588efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 66596542aa9cSPeter Lieven fi 66606542aa9cSPeter Lieven libnfs="no" 66616542aa9cSPeter Lieven fi 66626542aa9cSPeter Lievenfi 66631d728c39SBlue Swirl 66643efac6ebSTomáš Golembiovský########################################## 66653efac6ebSTomáš Golembiovský# Do we have libudev 66663efac6ebSTomáš Golembiovskýif test "$libudev" != "no" ; then 66673efac6ebSTomáš Golembiovský if $pkg_config libudev && test "$static" != "yes"; then 66683efac6ebSTomáš Golembiovský libudev="yes" 66693efac6ebSTomáš Golembiovský libudev_libs=$($pkg_config --libs libudev) 66703efac6ebSTomáš Golembiovský else 66713efac6ebSTomáš Golembiovský libudev="no" 66723efac6ebSTomáš Golembiovský fi 66733efac6ebSTomáš Golembiovskýfi 66743efac6ebSTomáš Golembiovský 66756ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 66766ca026cbSPeter Maydellif test "$werror" = "yes"; then 66776ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 66786ca026cbSPeter Maydellfi 66796ca026cbSPeter Maydell 66800aebab04SLingfeng Yang# Exclude --warn-common with TSan to suppress warnings from the TSan libraries. 66810aebab04SLingfeng Yangif test "$solaris" = "no" && test "$tsan" = "no"; then 6682e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 6683db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,--warn-common $QEMU_LDFLAGS" 6684e86ecd4bSJuan Quintela fi 6685e86ecd4bSJuan Quintelafi 6686e86ecd4bSJuan Quintela 668794dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 668894dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 668994dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 669094dd53c5SGerd Hoffmannelse 669194dd53c5SGerd Hoffmann POD2MAN="pod2man" 669294dd53c5SGerd Hoffmannfi 669394dd53c5SGerd Hoffmann 6694952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 6695952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 6696952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 6697e9a3591fSChristian Borntraeger if ld_has $flag ; then 6698db5adeaaSPaolo Bonzini QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS" 6699952afb71SBlue Swirl fi 6700952afb71SBlue Swirl done 6701952afb71SBlue Swirlfi 6702952afb71SBlue Swirl 67037776ea6bSPhilippe Mathieu-Daudé# Disable OpenBSD W^X if available 67047776ea6bSPhilippe Mathieu-Daudéif test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then 67057776ea6bSPhilippe Mathieu-Daudé cat > $TMPC <<EOF 67067776ea6bSPhilippe Mathieu-Daudé int main(void) { return 0; } 67077776ea6bSPhilippe Mathieu-DaudéEOF 67087776ea6bSPhilippe Mathieu-Daudé wx_ldflags="-Wl,-z,wxneeded" 67097776ea6bSPhilippe Mathieu-Daudé if compile_prog "" "$wx_ldflags"; then 67107776ea6bSPhilippe Mathieu-Daudé QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags" 67117776ea6bSPhilippe Mathieu-Daudé fi 67127776ea6bSPhilippe Mathieu-Daudéfi 67137776ea6bSPhilippe Mathieu-Daudé 671410ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 6715e26110cfSFam Zhengqemu_moddir=$libdir$confsuffix 6716528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 6717834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 6718a8260d38SDaniel P. Berrangéqemu_icondir="$datadir/icons" 671967ea9546SDaniel P. Berrangéqemu_desktopdir="$datadir/applications" 67205a67135aSbellard 6721e0580342SKamil Rytarowski# We can only support ivshmem if we have eventfd 6722e0580342SKamil Rytarowskiif [ "$eventfd" = "yes" ]; then 6723e0580342SKamil Rytarowski ivshmem=yes 6724e0580342SKamil Rytarowskifi 6725e0580342SKamil Rytarowski 67264b1c11fdSDaniel P. Berrangetools="" 67274b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 672872d277a7SGerd Hoffmann tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools" 67294b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 6730f353415fSKevin Wolf tools="qemu-nbd\$(EXESUF) qemu-storage-daemon\$(EXESUF) $tools" 6731b1449edbSKamil Rytarowski fi 6732b1449edbSKamil Rytarowski if [ "$ivshmem" = "yes" ]; then 6733a75eb03bSDavid Marchand tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" 67344b1c11fdSDaniel P. Berrange fi 67351b9d35f3SViktor Prutyanov if [ "$curl" = "yes" ]; then 67361b9d35f3SViktor Prutyanov tools="elf2dmp\$(EXESUF) $tools" 67373fa2d384SViktor Prutyanov fi 67384b1c11fdSDaniel P. Berrangefi 67394b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 6740b855f8d1SPaolo Bonzini if test "$linux" = yes; then 67417e462613SPaolo Bonzini if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then 6742983eef5aSMeador Inge virtfs=yes 6743fdbff6bdSPhilippe Mathieu-Daudé helpers="$helpers fsdev/virtfs-proxy-helper\$(EXESUF)" 6744983eef5aSMeador Inge else 6745983eef5aSMeador Inge if test "$virtfs" = yes; then 67467e462613SPaolo Bonzini error_exit "VirtFS requires libcap-ng devel and libattr devel" 6747983eef5aSMeador Inge fi 674817500370SAndreas Färber virtfs=no 6749983eef5aSMeador Inge fi 6750fe8fc5aeSPaolo Bonzini if test "$mpath" != no && test "$mpathpersist" = yes ; then 6751fe8fc5aeSPaolo Bonzini mpath=yes 6752fe8fc5aeSPaolo Bonzini else 6753fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 6754fe8fc5aeSPaolo Bonzini error_exit "Multipath requires libmpathpersist devel" 6755fe8fc5aeSPaolo Bonzini fi 6756fe8fc5aeSPaolo Bonzini mpath=no 6757fe8fc5aeSPaolo Bonzini fi 6758fdbff6bdSPhilippe Mathieu-Daudé helpers="$helpers scsi/qemu-pr-helper\$(EXESUF)" 6759b855f8d1SPaolo Bonzini else 6760b855f8d1SPaolo Bonzini if test "$virtfs" = yes; then 6761b855f8d1SPaolo Bonzini error_exit "VirtFS is supported only on Linux" 6762b855f8d1SPaolo Bonzini fi 6763b855f8d1SPaolo Bonzini virtfs=no 6764fe8fc5aeSPaolo Bonzini if test "$mpath" = yes; then 6765fe8fc5aeSPaolo Bonzini error_exit "Multipath is supported only on Linux" 6766fe8fc5aeSPaolo Bonzini fi 6767fe8fc5aeSPaolo Bonzini mpath=no 676817bff52bSM. Mohan Kumar fi 67696a021536SGerd Hoffmann if test "$xkbcommon" = "yes"; then 67706a021536SGerd Hoffmann tools="qemu-keymap\$(EXESUF) $tools" 67716a021536SGerd Hoffmann fi 6772ff69fd8cSLaurent Vivierfi 67739d6bc27bSMichael Roth 67749d6bc27bSMichael Roth# Probe for guest agent support/options 67759d6bc27bSMichael Roth 6776e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 6777a5125905SLaurent Vivier if [ "$softmmu" = no -a "$want_tools" = no ] ; then 6778a5125905SLaurent Vivier guest_agent=no 6779a5125905SLaurent Vivier elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 67800814465aSPaolo Bonzini tools="qemu-ga\$(EXESUF) $tools" 6781e8ef31a3SMichael Tokarev guest_agent=yes 6782e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 6783e8ef31a3SMichael Tokarev guest_agent=no 6784e8ef31a3SMichael Tokarev else 6785e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 6786ca35f780SPaolo Bonzini fi 67874b1c11fdSDaniel P. Berrangefi 6788ca35f780SPaolo Bonzini 67899d6bc27bSMichael Roth# Guest agent Window MSI package 67909d6bc27bSMichael Roth 67919d6bc27bSMichael Rothif test "$guest_agent" != yes; then 67929d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 67939d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 67949d6bc27bSMichael Roth fi 67959d6bc27bSMichael Roth guest_agent_msi=no 67969d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 67979d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 67989d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 67999d6bc27bSMichael Roth fi 68009d6bc27bSMichael Roth guest_agent_msi=no 68019d6bc27bSMichael Rothelif ! has wixl; then 68029d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 68039d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 68049d6bc27bSMichael Roth fi 68059d6bc27bSMichael Roth guest_agent_msi=no 68061a34904eSMichael Rothelse 68071a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 68081a34904eSMichael Roth # disabled explicitly 68091a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 68101a34904eSMichael Roth guest_agent_msi=yes 68111a34904eSMichael Roth fi 68129d6bc27bSMichael Rothfi 68139d6bc27bSMichael Roth 68141a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 68159d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 68169d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 68179d6bc27bSMichael Roth fi 68189d6bc27bSMichael Roth 68199d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 68209d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 68219d6bc27bSMichael Roth fi 68229d6bc27bSMichael Roth 68239d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 68249d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 68259d6bc27bSMichael Roth fi 68269d6bc27bSMichael Roth 68279d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 682889138857SStefan Weil QEMU_GA_VERSION=$(cat $source_path/VERSION) 68299d6bc27bSMichael Roth fi 68309d6bc27bSMichael Roth 683189138857SStefan Weil QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" 68329d6bc27bSMichael Roth 68339d6bc27bSMichael Roth case "$cpu" in 68349d6bc27bSMichael Roth x86_64) 68359d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 68369d6bc27bSMichael Roth ;; 68379d6bc27bSMichael Roth i386) 68389d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 68399d6bc27bSMichael Roth ;; 68409d6bc27bSMichael Roth *) 68419d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 68429d6bc27bSMichael Roth ;; 68439d6bc27bSMichael Roth esac 68449d6bc27bSMichael Rothfi 68459d6bc27bSMichael Roth 6846ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 6847ca35f780SPaolo Bonziniroms= 6848e633a5c6SEric Blakeif { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ 6849e633a5c6SEric Blake test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ 6850e633a5c6SEric Blake test "$softmmu" = yes ; then 6851e57218b6SPeter Maydell # Different host OS linkers have different ideas about the name of the ELF 6852c65d5e4eSBrad Smith # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd 6853c65d5e4eSBrad Smith # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. 6854c65d5e4eSBrad Smith for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do 6855e57218b6SPeter Maydell if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then 6856e57218b6SPeter Maydell ld_i386_emulation="$emu" 6857ca35f780SPaolo Bonzini roms="optionrom" 6858e57218b6SPeter Maydell break 6859e57218b6SPeter Maydell fi 6860e57218b6SPeter Maydell done 6861ca35f780SPaolo Bonzinifi 6862ca35f780SPaolo Bonzini 68632e33c3f8SThomas Huth# Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 68649933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 68652e33c3f8SThomas Huth write_c_skeleton 68662e33c3f8SThomas Huth if compile_prog "-march=z900" ""; then 68679933c305SChristian Borntraeger roms="$roms s390-ccw" 68681ef6bfc2SPhilippe Mathieu-Daudé # SLOF is required for building the s390-ccw firmware on s390x, 68691ef6bfc2SPhilippe Mathieu-Daudé # since it is using the libnet code from SLOF for network booting. 68701ef6bfc2SPhilippe Mathieu-Daudé if test -e "${source_path}/.git" ; then 68711ef6bfc2SPhilippe Mathieu-Daudé git_submodules="${git_submodules} roms/SLOF" 68721ef6bfc2SPhilippe Mathieu-Daudé fi 68739933c305SChristian Borntraeger fi 68742e33c3f8SThomas Huthfi 68759933c305SChristian Borntraeger 687611cde1c8SBruno Dominguez# Check that the C++ compiler exists and works with the C compiler. 687711cde1c8SBruno 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. 687811cde1c8SBruno Dominguezif has $cxx; then 687911cde1c8SBruno Dominguez cat > $TMPC <<EOF 688011cde1c8SBruno Dominguezint c_function(void); 688111cde1c8SBruno Dominguezint main(void) { return c_function(); } 688211cde1c8SBruno DominguezEOF 688311cde1c8SBruno Dominguez 688411cde1c8SBruno Dominguez compile_object 688511cde1c8SBruno Dominguez 688611cde1c8SBruno Dominguez cat > $TMPCXX <<EOF 688711cde1c8SBruno Dominguezextern "C" { 688811cde1c8SBruno Dominguez int c_function(void); 688911cde1c8SBruno Dominguez} 689011cde1c8SBruno Dominguezint c_function(void) { return 42; } 689111cde1c8SBruno DominguezEOF 689211cde1c8SBruno Dominguez 689311cde1c8SBruno Dominguez update_cxxflags 689411cde1c8SBruno Dominguez 6895086d5f75SPaolo Bonzini if do_cxx $CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then 689611cde1c8SBruno Dominguez # C++ compiler $cxx works ok with C compiler $cc 689711cde1c8SBruno Dominguez : 689811cde1c8SBruno Dominguez else 689911cde1c8SBruno Dominguez echo "C++ compiler $cxx does not work with C compiler $cc" 690011cde1c8SBruno Dominguez echo "Disabling C++ specific optional code" 690111cde1c8SBruno Dominguez cxx= 690211cde1c8SBruno Dominguez fi 690311cde1c8SBruno Dominguezelse 690411cde1c8SBruno Dominguez echo "No C++ compiler available; disabling C++ specific optional code" 690511cde1c8SBruno Dominguez cxx= 690611cde1c8SBruno Dominguezfi 690711cde1c8SBruno Dominguez 690802d34f62SCole Robinsonecho_version() { 690902d34f62SCole Robinson if test "$1" = "yes" ; then 691002d34f62SCole Robinson echo "($2)" 691102d34f62SCole Robinson fi 691202d34f62SCole Robinson} 691302d34f62SCole Robinson 691450e12060SJan Kiszka# prepend pixman and ftd flags after all config tests are done 691550e12060SJan KiszkaQEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" 69168a99e9a3SPhilippe Mathieu-DaudéQEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" 691750e12060SJan Kiszkalibs_softmmu="$pixman_libs $libs_softmmu" 69185ca9388aSGerd Hoffmann 691998ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 692097a847bcSbellard 6921dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 6922dbd99ae3SStefan Weil 692398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 692498ec69acSJuan Quintelaecho >> $config_host_mak 692598ec69acSJuan Quintela 6926e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 692799d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 692899d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 69293aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 69308bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 69310f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 693299d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 693399d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 693422d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 69359afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 69363d5eecabSGerd Hoffmannecho "qemu_firmwarepath=$firmwarepath" >> $config_host_mak 69379afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 6938e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 69395a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 6940785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 69415a699bbbSLaszlo Ersekfi 6942f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 6943834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 6944a8260d38SDaniel P. Berrangéecho "qemu_icondir=$qemu_icondir" >> $config_host_mak 694567ea9546SDaniel P. Berrangéecho "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak 694602f9135bSDaniel P. Berrangéecho "libs_cpu=$libs_cpu" >> $config_host_mak 6947f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 6948cc84d63aSDaniel P. Berrangeecho "GIT=$git" >> $config_host_mak 6949aef45d51SDaniel P. Berrangeecho "GIT_SUBMODULES=$git_submodules" >> $config_host_mak 6950f62bbee5SDaniel P. Berrangeecho "GIT_UPDATE=$git_update" >> $config_host_mak 6951804edf29SJuan Quintela 695298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 6953727e5283SPaolo Bonzini 6954777dddc5SAlex Bennéeecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 6955777dddc5SAlex Bennéeecho "GLIB_LDFLAGS=$glib_ldflags" >> $config_host_mak 6956777dddc5SAlex Bennée 6957f3494749SPaolo Bonziniif test "$default_devices" = "yes" ; then 6958f3494749SPaolo Bonzini echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak 6959f3494749SPaolo Bonzinielse 6960f3494749SPaolo Bonzini echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak 6961f3494749SPaolo Bonzinifi 6962f8393946Saurel32if test "$debug_tcg" = "yes" ; then 69632358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 6964f8393946Saurel32fi 69651625af87Saliguoriif test "$strip_opt" = "yes" ; then 696652ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 69671625af87Saliguorifi 69687d13299dSbellardif test "$bigendian" = "yes" ; then 6969e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 697097a847bcSbellardfi 697167b915a5Sbellardif test "$mingw32" = "yes" ; then 697298ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 697389138857SStefan Weil rc_version=$(cat $source_path/VERSION) 69749fe6de94SBlue Swirl version_major=${rc_version%%.*} 69759fe6de94SBlue Swirl rc_version=${rc_version#*.} 69769fe6de94SBlue Swirl version_minor=${rc_version%%.*} 69779fe6de94SBlue Swirl rc_version=${rc_version#*.} 69789fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 69799fe6de94SBlue Swirl version_micro=0 69809fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 69819fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 6982d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 6983d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 6984f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 6985d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 6986d9840e25STomoki Sekiyama fi 698750cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 698876dc75caSTomáš Golembiovský echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak 698950cbebb9SMichael Roth fi 69901a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 69919dacf32dSYossi Hindin echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 69929dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 69939dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 69949dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 69959dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 69969dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 69979dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 69989dacf32dSYossi Hindin fi 6999210fa556Spbrookelse 700035f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 7001210fa556Spbrookfi 7002128ab2ffSblueswir1 7003dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 7004dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 7005dffcb71cSMark McLoughlinfi 7006dffcb71cSMark McLoughlin 700783fb7adfSbellardif test "$darwin" = "yes" ; then 700898ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 700983fb7adfSbellardfi 7010b29fe3edSmalc 7011ec530c81Sbellardif test "$solaris" = "yes" ; then 701298ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 7013ec530c81Sbellardfi 7014179cf400SAndreas Färberif test "$haiku" = "yes" ; then 7015179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 7016179cf400SAndreas Färberfi 701797a847bcSbellardif test "$static" = "yes" ; then 701898ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 701997a847bcSbellardfi 70201ba16968SStefan Weilif test "$profiler" = "yes" ; then 70212358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 702205c2a3e7Sbellardfi 7023c932ce31SPaolo Bonziniif test "$want_tools" = "yes" ; then 7024c932ce31SPaolo Bonzini echo "CONFIG_TOOLS=y" >> $config_host_mak 7025c932ce31SPaolo Bonzinifi 7026675b9b53SMarc-André Lureauif test "$slirp" != "no"; then 702798ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 7028e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 7029675b9b53SMarc-André Lureau echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak 7030675b9b53SMarc-André Lureau echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak 7031675b9b53SMarc-André Lureaufi 70327c57bdd8SMarc-André Lureauif [ "$slirp" = "git" -o "$slirp" = "internal" ]; then 70333b8593eeSMarkus Armbruster echo "config-host.h: slirp/all" >> $config_host_mak 7034c20709aaSbellardfi 70358a16d273Sthsif test "$vde" = "yes" ; then 703698ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 7037e2ad6f16SFam Zheng echo "VDE_LIBS=$vde_libs" >> $config_host_mak 70388a16d273Sthsfi 703958952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 704058952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 704158952137SVincenzo Maffionefi 7042015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 7043015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 7044015a33bdSGongleifi 70454cc600d2SPaolo Bonziniif test "$gprof" = "yes" ; then 70464cc600d2SPaolo Bonzini echo "CONFIG_GPROF=y" >> $config_host_mak 70474cc600d2SPaolo Bonzinifi 704847e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 7049a358bca2SPaolo Bonzini echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak 705047e98658SCorey Bryantfi 70512358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 70520c58ac1cSmalcfor drv in $audio_drv_list; do 70531ef1ec2aSGerd Hoffmann def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') 7054ce3dc033SGerd Hoffmann case "$drv" in 7055051c7d5cSGerd Hoffmann alsa | oss | pa | sdl) 7056ce3dc033SGerd Hoffmann echo "$def=m" >> $config_host_mak ;; 7057ce3dc033SGerd Hoffmann *) 7058ce3dc033SGerd Hoffmann echo "$def=y" >> $config_host_mak ;; 7059ce3dc033SGerd Hoffmann esac 70600c58ac1cSmalcdone 7061b1149911SFam Zhengecho "ALSA_LIBS=$alsa_libs" >> $config_host_mak 7062b1149911SFam Zhengecho "PULSE_LIBS=$pulse_libs" >> $config_host_mak 7063b1149911SFam Zhengecho "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak 7064b1149911SFam Zhengecho "DSOUND_LIBS=$dsound_libs" >> $config_host_mak 7065b1149911SFam Zhengecho "OSS_LIBS=$oss_libs" >> $config_host_mak 70662e445703SGeoffrey McRaeecho "JACK_LIBS=$jack_libs" >> $config_host_mak 7067d5631638Smalcif test "$audio_win_int" = "yes" ; then 7068d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 7069d5631638Smalcfi 7070b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 7071b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 7072821601eaSJes Sorensenif test "$vnc" = "yes" ; then 7073821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 7074821601eaSJes Sorensenfi 70752f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 707698ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 70772f9606b3Saliguorifi 7078821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 70792f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 70802f6f5c7aSCorentin Charyfi 7081821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 7082efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 7083efe556adSCorentin Charyfi 70846a021536SGerd Hoffmannif test "$xkbcommon" = "yes" ; then 70856a021536SGerd Hoffmann echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak 70866a021536SGerd Hoffmann echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak 70876a021536SGerd Hoffmannfi 7088dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 7089dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 7090dce512deSChristoph Hellwigfi 709189138857SStefan Weilqemu_version=$(head $source_path/VERSION) 709298ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 70932358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 709498ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 70952b1f35b9SAlex Bennéeecho "TARGET_DIRS=$target_list" >> $config_host_mak 7096a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 709798ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 7098cc8ae6deSpbrookfi 709917969268SFam Zhengif test "$modules" = "yes"; then 7100e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 7101e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 710289138857SStefan Weil echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak 710317969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 710417969268SFam Zhengfi 7105bd83c861SChristian Ehrhardtif test "$module_upgrades" = "yes"; then 7106bd83c861SChristian Ehrhardt echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak 7107bd83c861SChristian Ehrhardtfi 7108e633a5c6SEric Blakeif test "$have_x11" = "yes" && test "$need_x11" = "yes"; then 71098781595bSGerd Hoffmann echo "CONFIG_X11=y" >> $config_host_mak 71108781595bSGerd Hoffmann echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak 71118781595bSGerd Hoffmann echo "X11_LIBS=$x11_libs" >> $config_host_mak 71128781595bSGerd Hoffmannfi 71131ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 711496400a14SGerd Hoffmann echo "CONFIG_SDL=m" >> $config_host_mak 71158ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 71168ecc89f6SFam Zheng echo "SDL_LIBS=$sdl_libs" >> $config_host_mak 7117a442fe2fSDaniel P. Berrangé if test "$sdl_image" = "yes" ; then 7118a442fe2fSDaniel P. Berrangé echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak 7119a442fe2fSDaniel P. Berrangé fi 712049ecc3faSbellardfi 712149ecc3faSbellardif test "$cocoa" = "yes" ; then 712298ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 712349ecc3faSbellardfi 7124e08bb301SSamuel Thibaultif test "$iconv" = "yes" ; then 7125e08bb301SSamuel Thibault echo "CONFIG_ICONV=y" >> $config_host_mak 7126e08bb301SSamuel Thibault echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak 7127e08bb301SSamuel Thibault echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak 7128e08bb301SSamuel Thibaultfi 71294d3b6f6eSbalrogif test "$curses" = "yes" ; then 71302373f7d5SGerd Hoffmann echo "CONFIG_CURSES=m" >> $config_host_mak 71312373f7d5SGerd Hoffmann echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak 71322373f7d5SGerd Hoffmann echo "CURSES_LIBS=$curses_lib" >> $config_host_mak 7133ab4e5602SJan Kiszkafi 7134099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 71352358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 7136099d6b0fSRiku Voipiofi 713740ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 713840ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 713940ff6d7eSKevin Wolffi 71403ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 71412358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 71423ce34dfbSvibisreenivasanfi 7143c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 7144c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 7145c2882b96SRiku Voipiofi 7146751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 7147751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 7148751bcc39SMarc-André Lureaufi 7149955727d2SCortland Tölvaif test "$have_usbfs" = "yes" ; then 7150955727d2SCortland Tölva echo "CONFIG_USBFS=y" >> $config_host_mak 7151955727d2SCortland Tölvafi 7152d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 7153d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 7154d0927938SUlrich Hechtfi 71553d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 71563d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 71573d4fa43eSKusanagi Kouichifi 7158b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 7159b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 7160b953f075SDenis V. Lunevfi 7161ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 7162ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 7163ed911435SKevin Wolffi 7164c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 7165c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 7166c727f47dSPeter Maydellfi 7167dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 7168dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 7169dace20dcSPeter Maydellfi 7170d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 7171d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 7172d0927938SUlrich Hechtfi 71734e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 71744e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 71754e0c6529SAlex Blighfi 7176cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 7177cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 7178cd758dd0SAlex Blighfi 71793b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 71803b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 71813b6edd16SPeter Maydellfi 71823b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 71833b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 71843b6edd16SPeter Maydellfi 7185a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 7186a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 7187a8fd1abaSPeter Maydellfi 718851834341SRiku Voipioif test "$timerfd" = "yes" ; then 718951834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 719051834341SRiku Voipiofi 71919af5c906SRiku Voipioif test "$setns" = "yes" ; then 71929af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 71939af5c906SRiku Voipiofi 719438860a03SAleksandar Markovicif test "$clock_adjtime" = "yes" ; then 719538860a03SAleksandar Markovic echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak 719638860a03SAleksandar Markovicfi 71975a03cd00SAleksandar Markovicif test "$syncfs" = "yes" ; then 71985a03cd00SAleksandar Markovic echo "CONFIG_SYNCFS=y" >> $config_host_mak 71995a03cd00SAleksandar Markovicfi 7200db37dd89SAleksandar Markovicif test "$kcov" = "yes" ; then 7201db37dd89SAleksandar Markovic echo "CONFIG_KCOV=y" >> $config_host_mak 7202db37dd89SAleksandar Markovicfi 72033b3f24adSaurel32if test "$inotify" = "yes" ; then 72042358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 72053b3f24adSaurel32fi 7206c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 7207c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 7208c05c7a73SRiku Voipiofi 7209401bc051SPeter Maydellif test "$sem_timedwait" = "yes" ; then 7210401bc051SPeter Maydell echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak 7211401bc051SPeter Maydellfi 72125c99fa37SKeno Fischerif test "$strchrnul" = "yes" ; then 72135c99fa37SKeno Fischer echo "HAVE_STRCHRNUL=y" >> $config_host_mak 72145c99fa37SKeno Fischerfi 72158a792b03SJiufei Xueif test "$st_atim" = "yes" ; then 72168a792b03SJiufei Xue echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak 72178a792b03SJiufei Xuefi 72186ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 72196ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 72206ae9a1f4SJuan Quintelafi 72216ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 72226ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 72236ae9a1f4SJuan Quintelafi 7224769ce76dSAlexander Grafif test "$curl" = "yes" ; then 7225d3399d7cSFam Zheng echo "CONFIG_CURL=m" >> $config_host_mak 7226b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 72276ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 7228769ce76dSAlexander Graffi 72292e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 723098ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 72318eca2889SFam Zheng echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak 72322e4d9fb1Saurel32fi 7233a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 7234e0fb129cSGerd Hoffmann echo "CONFIG_GTK=m" >> $config_host_mak 7235a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 7236014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 7237925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 7238925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 7239925a0400SGerd Hoffmann fi 7240bbbf9bfbSStefan Weilfi 7241f876b765SMarc-André Lureauif test "$gio" = "yes" ; then 7242f876b765SMarc-André Lureau echo "CONFIG_GIO=y" >> $config_host_mak 7243f876b765SMarc-André Lureau echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak 7244f876b765SMarc-André Lureau echo "GIO_LIBS=$gio_libs" >> $config_host_mak 724525a97a56SMarc-André Lureau echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak 7246f876b765SMarc-André Lureaufi 7247a1c5e949SDaniel P. Berrangeecho "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak 7248ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 7249ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 7250ddbb0d09SDaniel P. Berrangefi 725191bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 725291bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 72531f923c70SLongpeng(Mike) if test "$gcrypt_hmac" = "yes" ; then 72541f923c70SLongpeng(Mike) echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak 72551f923c70SLongpeng(Mike) fi 725662893b67SDaniel P. Berrangefi 725791bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 725891bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 7259becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 7260ed754746SDaniel P. Berrangefi 7261e0576942SDaniel P. Berrangéif test "$qemu_private_xts" = "yes" ; then 7262e0576942SDaniel P. Berrangé echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak 7263e0576942SDaniel P. Berrangéfi 72649a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 72659a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 72669a2fd434SDaniel P. Berrangefi 72678953caf3SDaniel P. Berrangeif test "$auth_pam" = "yes" ; then 72688953caf3SDaniel P. Berrange echo "CONFIG_AUTH_PAM=y" >> $config_host_mak 72698953caf3SDaniel P. Berrangefi 7270559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 7271559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 7272559607eaSDaniel P. Berrangefi 7273e865b97fSChen Gangif test "$have_drm_h" = "yes" ; then 7274e865b97fSChen Gang echo "HAVE_DRM_H=y" >> $config_host_mak 7275e865b97fSChen Gangfi 72766b39b063SEric Blakeif test "$have_broken_size_max" = "yes" ; then 72776b39b063SEric Blake echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak 72786b39b063SEric Blakefi 72799df8b20dSThomas Huthif test "$have_openpty" = "yes" ; then 72809df8b20dSThomas Huth echo "HAVE_OPENPTY=y" >> $config_host_mak 72819df8b20dSThomas Huthfi 72822a4b472cSDavid CARLIERif test "$have_sys_signal_h" = "yes" ; then 72832a4b472cSDavid CARLIER echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak 72842a4b472cSDavid CARLIERfi 7285277abf15SJan Vesely 7286277abf15SJan Vesely# Work around a system header bug with some kernel/XFS header 7287277abf15SJan Vesely# versions where they both try to define 'struct fsxattr': 7288277abf15SJan Vesely# xfs headers will not try to redefine structs from linux headers 7289277abf15SJan Vesely# if this macro is set. 7290277abf15SJan Veselyif test "$have_fsxattr" = "yes" ; then 7291277abf15SJan Vesely echo "HAVE_FSXATTR=y" >> $config_host_mak 7292277abf15SJan Veselyfi 72931efad060SFam Zhengif test "$have_copy_file_range" = "yes" ; then 72941efad060SFam Zheng echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak 72951efad060SFam Zhengfi 7296bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 7297bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 7298a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 7299e0fb129cSGerd Hoffmann echo "VTE_LIBS=$vte_libs" >> $config_host_mak 7300a4ccabcfSAnthony Liguorifi 73019d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 73029d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 73039d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 73049d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 73059d9e1521SGerd Hoffmannfi 7306e37630caSaliguoriif test "$xen" = "yes" ; then 73076dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 7308d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 7309e37630caSaliguorifi 73105c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 73115c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 73125c6c3a6cSChristoph Hellwigfi 7313c10dd856SAarushi Mehtaif test "$linux_io_uring" = "yes" ; then 7314c10dd856SAarushi Mehta echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak 7315c10dd856SAarushi Mehta echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak 7316c10dd856SAarushi Mehta echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak 7317c10dd856SAarushi Mehtafi 7318758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 7319758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 7320758e8e38SVenkateswararao Jujjuri (JV)fi 73214f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 73224f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 73234f26f2b6SAvi Kivityfi 7324983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 7325758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 7326758e8e38SVenkateswararao Jujjuri (JV)fi 7327fe8fc5aeSPaolo Bonziniif test "$mpath" = "yes" ; then 7328fe8fc5aeSPaolo Bonzini echo "CONFIG_MPATH=y" >> $config_host_mak 73291b0578f5SMurilo Opsfelder Araujo if test "$mpathpersist_new_api" = "yes"; then 73301b0578f5SMurilo Opsfelder Araujo echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak 73311b0578f5SMurilo Opsfelder Araujo fi 7332fe8fc5aeSPaolo Bonzinifi 73335e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 73345e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 73355e9be92dSNicholas Bellingerfi 7336af3bba76SPaolo Bonziniif test "$vhost_net" = "yes" ; then 7337af3bba76SPaolo Bonzini echo "CONFIG_VHOST_NET=y" >> $config_host_mak 7338af3bba76SPaolo Bonzinifi 7339af3bba76SPaolo Bonziniif test "$vhost_net_user" = "yes" ; then 734056f41de7SPaolo Bonzini echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak 734103ce5744SNikolay Nikolaevfi 7342108a6481SCindy Luif test "$vhost_net_vdpa" = "yes" ; then 7343108a6481SCindy Lu echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak 7344108a6481SCindy Lufi 7345042cea27SGongleiif test "$vhost_crypto" = "yes" ; then 7346042cea27SGonglei echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak 7347042cea27SGongleifi 7348fc0b9b0eSStefan Hajnocziif test "$vhost_vsock" = "yes" ; then 7349fc0b9b0eSStefan Hajnoczi echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak 73505fe97d88SStefano Garzarella if test "$vhost_user" = "yes" ; then 73515fe97d88SStefano Garzarella echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak 73525fe97d88SStefano Garzarella fi 7353fc0b9b0eSStefan Hajnoczifi 7354299e6f19SPaolo Bonziniif test "$vhost_kernel" = "yes" ; then 7355299e6f19SPaolo Bonzini echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak 7356299e6f19SPaolo Bonzinifi 7357e6a74868SMarc-André Lureauif test "$vhost_user" = "yes" ; then 7358e6a74868SMarc-André Lureau echo "CONFIG_VHOST_USER=y" >> $config_host_mak 7359e6a74868SMarc-André Lureaufi 7360108a6481SCindy Luif test "$vhost_vdpa" = "yes" ; then 7361108a6481SCindy Lu echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak 7362108a6481SCindy Lufi 736398fc1adaSDr. David Alan Gilbertif test "$vhost_user_fs" = "yes" ; then 736498fc1adaSDr. David Alan Gilbert echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak 736598fc1adaSDr. David Alan Gilbertfi 736677755340Sthsif test "$blobs" = "yes" ; then 736798ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 736877755340Sthsfi 7369bf9298b9Saliguoriif test "$iovec" = "yes" ; then 73702358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 7371bf9298b9Saliguorifi 7372ceb42de8Saliguoriif test "$preadv" = "yes" ; then 73732358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 7374ceb42de8Saliguorifi 7375e3971d61SPhilippe Mathieu-Daudéif test "$fdt" != "no" ; then 73763f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 7377f652e6afSaurel32fi 7378a40161cbSPaolo Bonziniif test "$membarrier" = "yes" ; then 7379a40161cbSPaolo Bonzini echo "CONFIG_MEMBARRIER=y" >> $config_host_mak 7380a40161cbSPaolo Bonzinifi 7381dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 7382dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 7383dcc38d1cSMarcelo Tosattifi 7384d339d766SRichard W.M. Jonesif test "$optreset" = "yes" ; then 7385d339d766SRichard W.M. Jones echo "HAVE_OPTRESET=y" >> $config_host_mak 7386d339d766SRichard W.M. Jonesfi 7387b3f6ea7eSPaolo Bonziniif test "$tcg" = "yes"; then 7388b3f6ea7eSPaolo Bonzini echo "CONFIG_TCG=y" >> $config_host_mak 73899195b2c2SStefan Weil if test "$tcg_interpreter" = "yes" ; then 73909195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 73919195b2c2SStefan Weil fi 7392b3f6ea7eSPaolo Bonzinifi 73935f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 73945f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 73955f6b9e8fSBlue Swirlfi 7396e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 7397e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 7398e78815a5SAndreas Färberfi 7399e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 7400e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 7401e78815a5SAndreas Färberfi 74029bc5a719SAndreas Gustafssonif test "$posix_memalign" = "yes" ; then 74039bc5a719SAndreas Gustafsson echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak 74049bc5a719SAndreas Gustafssonfi 740597a847bcSbellard 7406cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 7407cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 7408cd4ec0b4SGerd Hoffmannfi 7409cd4ec0b4SGerd Hoffmann 74107b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 74117b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 74127b62bf5aSFam Zheng echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak 74137b62bf5aSFam Zheng echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak 7414111a38b0SRobert Relyeafi 7415111a38b0SRobert Relyea 74162b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 74172b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 7418b878b652SFam Zheng echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak 7419b878b652SFam Zheng echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak 74202b2325ffSGerd Hoffmannfi 74212b2325ffSGerd Hoffmann 742269354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 742369354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 7424cc7923fcSFam Zheng echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak 7425cc7923fcSFam Zheng echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak 742669354a83SHans de Goedefi 742769354a83SHans de Goede 7428da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 7429da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 7430da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 7431014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 7432014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 7433014cb152SGerd Hoffmann fi 743420ff075bSMichael Wallefi 743520ff075bSMichael Walle 7436d52c454aSMarc-André Lureauif test "$gbm" = "yes" ; then 7437d52c454aSMarc-André Lureau echo "CONFIG_GBM=y" >> $config_host_mak 7438d52c454aSMarc-André Lureau echo "GBM_LIBS=$gbm_libs" >> $config_host_mak 7439d52c454aSMarc-André Lureau echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak 7440d52c454aSMarc-André Lureaufi 7441d52c454aSMarc-André Lureau 7442d52c454aSMarc-André Lureau 74435a22ab71SYang Zhongif test "$malloc_trim" = "yes" ; then 74445a22ab71SYang Zhong echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak 74455a22ab71SYang Zhongfi 74465a22ab71SYang Zhong 744799f2dbd3SLiang Liif test "$avx2_opt" = "yes" ; then 744899f2dbd3SLiang Li echo "CONFIG_AVX2_OPT=y" >> $config_host_mak 744999f2dbd3SLiang Lifi 745099f2dbd3SLiang Li 74516b8cd447SRobert Hooif test "$avx512f_opt" = "yes" ; then 74526b8cd447SRobert Hoo echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak 74536b8cd447SRobert Hoofi 74546b8cd447SRobert Hoo 7455607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 7456607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 7457607dacd0Sqiaonuohanfi 7458607dacd0Sqiaonuohan 7459607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 7460607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 7461607dacd0Sqiaonuohanfi 7462607dacd0Sqiaonuohan 74636b383c08SPeter Wuif test "$bzip2" = "yes" ; then 74646b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 74656b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 74666b383c08SPeter Wufi 74676b383c08SPeter Wu 746883bc1f97SJulio Faraccoif test "$lzfse" = "yes" ; then 746983bc1f97SJulio Faracco echo "CONFIG_LZFSE=y" >> $config_host_mak 747083bc1f97SJulio Faracco echo "LZFSE_LIBS=-llzfse" >> $config_host_mak 747183bc1f97SJulio Faraccofi 747283bc1f97SJulio Faracco 74733a678481SJuan Quintelaif test "$zstd" = "yes" ; then 74743a678481SJuan Quintela echo "CONFIG_ZSTD=y" >> $config_host_mak 74753a678481SJuan Quintelafi 74763a678481SJuan Quintela 7477c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 7478d3399d7cSFam Zheng echo "CONFIG_LIBISCSI=m" >> $config_host_mak 74796ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 74806ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 7481c589b249SRonnie Sahlbergfi 7482c589b249SRonnie Sahlberg 74836542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 74844be4879fSColin Lord echo "CONFIG_LIBNFS=m" >> $config_host_mak 74854be4879fSColin Lord echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak 74866542aa9cSPeter Lievenfi 74876542aa9cSPeter Lieven 7488f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 7489f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 7490c3883e1fSFam Zheng echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak 7491c3883e1fSFam Zheng echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak 7492f794573eSEduardo Otubofi 7493f794573eSEduardo Otubo 749483fb7adfSbellard# XXX: suppress that 74957d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 74962358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 74977d3505c5Sbellardfi 74987d3505c5Sbellard 74994d9310f4SDaniel P. Berrangeif test "$localtime_r" = "yes" ; then 75004d9310f4SDaniel P. Berrange echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 75014d9310f4SDaniel P. Berrangefi 75023556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 75033556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 75043556c233SPaolo Bonzinifi 7505f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 7506d3399d7cSFam Zheng echo "CONFIG_RBD=m" >> $config_host_mak 75076ebc91e5SFam Zheng echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 75086ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 7509f27aaf4bSChristian Brunnerfi 751020ff6c80SAnthony Liguori 75117c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 751270c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 751370c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 751470c60c08SStefan Hajnoczielse 751570c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 751670c60c08SStefan Hajnoczifi 7517d0e2fce5SAneesh Kumar K.V 75187d992e4dSPeter Lievenif test "$debug_stack_usage" = "yes" ; then 75197d992e4dSPeter Lieven echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak 75207d992e4dSPeter Lievenfi 75217d992e4dSPeter Lieven 7522f0d92b56SLongpeng(Mike)if test "$crypto_afalg" = "yes" ; then 7523f0d92b56SLongpeng(Mike) echo "CONFIG_AF_ALG=y" >> $config_host_mak 7524f0d92b56SLongpeng(Mike)fi 7525f0d92b56SLongpeng(Mike) 7526d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 7527d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 7528d2042378SAneesh Kumar K.Vfi 7529d2042378SAneesh Kumar K.V 7530e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 7531e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 7532e06a765eSHarsh Prateek Borafi 7533e06a765eSHarsh Prateek Bora 75343f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 75353f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 75363f4349dcSKevin Wolffi 75373f4349dcSKevin Wolf 7538d83414e1SMarc-André Lureauif test "$have_asan_iface_fiber" = "yes" ; then 7539d83414e1SMarc-André Lureau echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak 7540d83414e1SMarc-André Lureaufi 7541d83414e1SMarc-André Lureau 75420aebab04SLingfeng Yangif test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then 75430aebab04SLingfeng Yang echo "CONFIG_TSAN=y" >> $config_host_mak 75440aebab04SLingfeng Yangfi 75450aebab04SLingfeng Yang 75468ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 75478ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 75488ab1bf12SLuiz Capitulinofi 75498ab1bf12SLuiz Capitulino 755076a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 755176a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 755276a347e1SRichard Hendersonfi 755376a347e1SRichard Henderson 7554f540166bSRichard Hendersonif test "$int128" = "yes" ; then 7555f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 7556f540166bSRichard Hendersonfi 7557f540166bSRichard Henderson 75587ebee43eSRichard Hendersonif test "$atomic128" = "yes" ; then 75597ebee43eSRichard Henderson echo "CONFIG_ATOMIC128=y" >> $config_host_mak 75607ebee43eSRichard Hendersonfi 75617ebee43eSRichard Henderson 7562e6cd4bb5SRichard Hendersonif test "$cmpxchg128" = "yes" ; then 7563e6cd4bb5SRichard Henderson echo "CONFIG_CMPXCHG128=y" >> $config_host_mak 7564e6cd4bb5SRichard Hendersonfi 7565e6cd4bb5SRichard Henderson 7566df79b996SRichard Hendersonif test "$atomic64" = "yes" ; then 7567df79b996SRichard Henderson echo "CONFIG_ATOMIC64=y" >> $config_host_mak 7568df79b996SRichard Hendersonfi 7569df79b996SRichard Henderson 7570db8aaae8SRichard Hendersonif test "$attralias" = "yes" ; then 7571db8aaae8SRichard Henderson echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak 7572db8aaae8SRichard Hendersonfi 7573db8aaae8SRichard Henderson 75741e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 75751e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 75761e6e9acaSRichard Hendersonfi 75771e6e9acaSRichard Henderson 7578eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 7579d3399d7cSFam Zheng echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 75806ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 75816ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 7582eb100396SBharata B Raofi 7583eb100396SBharata B Rao 7584d85fa9ebSJeff Codyif test "$glusterfs_xlator_opt" = "yes" ; then 7585d85fa9ebSJeff Cody echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak 7586d85fa9ebSJeff Codyfi 7587d85fa9ebSJeff Cody 75880c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 75890c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 75900c14fb47SBharata B Raofi 75910c14fb47SBharata B Rao 7592df3a429aSNiels de Vosif test "$glusterfs_fallocate" = "yes" ; then 7593df3a429aSNiels de Vos echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak 7594df3a429aSNiels de Vosfi 7595df3a429aSNiels de Vos 75967c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 75977c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 75987c815372SBharata B Raofi 75997c815372SBharata B Rao 7600e014dbe7SPrasanna Kumar Kaleverif test "$glusterfs_ftruncate_has_stat" = "yes" ; then 7601e014dbe7SPrasanna Kumar Kalever echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak 7602e014dbe7SPrasanna Kumar Kaleverfi 7603e014dbe7SPrasanna Kumar Kalever 76040e3b891fSNiels de Vosif test "$glusterfs_iocb_has_stat" = "yes" ; then 76050e3b891fSNiels de Vos echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak 76060e3b891fSNiels de Vosfi 76070e3b891fSNiels de Vos 7608b10d49d7SPino Toscanoif test "$libssh" = "yes" ; then 7609b10d49d7SPino Toscano echo "CONFIG_LIBSSH=m" >> $config_host_mak 7610b10d49d7SPino Toscano echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak 7611b10d49d7SPino Toscano echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak 76120a12ec87SRichard W.M. Jonesfi 76130a12ec87SRichard W.M. Jones 7614ed1701c6SDr. David Alan Gilbertif test "$live_block_migration" = "yes" ; then 7615ed1701c6SDr. David Alan Gilbert echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak 7616ed1701c6SDr. David Alan Gilbertfi 7617ed1701c6SDr. David Alan Gilbert 76183b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 76193cae16dbSPaolo Bonzini echo 'CONFIG_TPM=y' >> $config_host_mak 76203b8acc11SPaolo Bonzinifi 76213b8acc11SPaolo Bonzini 76225b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 76235b808275SLluís Vilanovaif have_backend "nop"; then 76246d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 762522890ab5SPrerna Saxenafi 76265b808275SLluís Vilanovaif have_backend "simple"; then 76276d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 76286d8a764eSLluís # Set the appropriate trace file. 7629953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 76309410b56cSPrerna Saxenafi 7631ed7f5f1dSPaolo Bonziniif have_backend "log"; then 7632ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 76336d8a764eSLluísfi 76345b808275SLluís Vilanovaif have_backend "ust"; then 76356d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 76366d8a764eSLluísfi 76375b808275SLluís Vilanovaif have_backend "dtrace"; then 76386d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 76396d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 76406d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 76416d8a764eSLluís fi 7642c276b17dSDaniel P. Berrangefi 76435b808275SLluís Vilanovaif have_backend "ftrace"; then 7644781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 7645781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 7646781e9545SEiichi Tsukata else 764721684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 7648781e9545SEiichi Tsukata fi 7649781e9545SEiichi Tsukatafi 76500a852417SPaul Durrantif have_backend "syslog"; then 76510a852417SPaul Durrant if test "$posix_syslog" = "yes" ; then 76520a852417SPaul Durrant echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak 76530a852417SPaul Durrant else 76540a852417SPaul Durrant feature_not_found "syslog(trace backend)" "syslog not available" 76550a852417SPaul Durrant fi 76560a852417SPaul Durrantfi 76579410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 76589410b56cSPrerna Saxena 76592da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 76602da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 7661392fb643SFam Zheng echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak 76622da776dbSMichael R. Hinesfi 76632da776dbSMichael R. Hines 766421ab34c9SMarcel Apfelbaumif test "$pvrdma" = "yes" ; then 766521ab34c9SMarcel Apfelbaum echo "CONFIG_PVRDMA=y" >> $config_host_mak 766621ab34c9SMarcel Apfelbaumfi 766721ab34c9SMarcel Apfelbaum 7668575b22b1SLaurent Vivierif test "$have_rtnetlink" = "yes" ; then 7669575b22b1SLaurent Vivier echo "CONFIG_RTNETLINK=y" >> $config_host_mak 7670575b22b1SLaurent Vivierfi 7671575b22b1SLaurent Vivier 7672ed279a06SKlim Kireevif test "$libxml2" = "yes" ; then 7673ed279a06SKlim Kireev echo "CONFIG_LIBXML2=y" >> $config_host_mak 7674ed279a06SKlim Kireev echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak 7675ed279a06SKlim Kireev echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak 7676ed279a06SKlim Kireevfi 7677ed279a06SKlim Kireev 7678a6b1d4c0SChanglong Xieif test "$replication" = "yes" ; then 7679a6b1d4c0SChanglong Xie echo "CONFIG_REPLICATION=y" >> $config_host_mak 7680a6b1d4c0SChanglong Xiefi 7681a6b1d4c0SChanglong Xie 76826a02c806SStefan Hajnocziif test "$have_af_vsock" = "yes" ; then 76836a02c806SStefan Hajnoczi echo "CONFIG_AF_VSOCK=y" >> $config_host_mak 76846a02c806SStefan Hajnoczifi 76856a02c806SStefan Hajnoczi 76864d04351fSChristopher Covingtonif test "$have_sysmacros" = "yes" ; then 76874d04351fSChristopher Covington echo "CONFIG_SYSMACROS=y" >> $config_host_mak 76884d04351fSChristopher Covingtonfi 76894d04351fSChristopher Covington 769049e00a18SAndreas Grapentinif test "$have_static_assert" = "yes" ; then 769149e00a18SAndreas Grapentin echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak 769249e00a18SAndreas Grapentinfi 769349e00a18SAndreas Grapentin 7694e674605fSTomáš Golembiovskýif test "$have_utmpx" = "yes" ; then 7695e674605fSTomáš Golembiovský echo "HAVE_UTMPX=y" >> $config_host_mak 7696e674605fSTomáš Golembiovskýfi 7697db1ed1abSRichard Hendersonif test "$have_getrandom" = "yes" ; then 7698db1ed1abSRichard Henderson echo "CONFIG_GETRANDOM=y" >> $config_host_mak 7699db1ed1abSRichard Hendersonfi 7700e0580342SKamil Rytarowskiif test "$ivshmem" = "yes" ; then 7701e0580342SKamil Rytarowski echo "CONFIG_IVSHMEM=y" >> $config_host_mak 7702e0580342SKamil Rytarowskifi 7703e219c499SRichard Hendersonif test "$capstone" != "no" ; then 77048ca80760SRichard Henderson echo "CONFIG_CAPSTONE=y" >> $config_host_mak 77058ca80760SRichard Hendersonfi 7706ba59fb77SPaolo Bonziniif test "$debug_mutex" = "yes" ; then 7707ba59fb77SPaolo Bonzini echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak 7708ba59fb77SPaolo Bonzinifi 7709e0580342SKamil Rytarowski 77105c312079SDr. David Alan Gilbert# Hold two types of flag: 77115c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 77125c312079SDr. David Alan Gilbert# a thread we have a handle to 7713479a5747SRoman Bolshakov# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular 77145c312079SDr. David Alan Gilbert# platform 7715479a5747SRoman Bolshakovif test "$pthread_setname_np_w_tid" = "yes" ; then 77165c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 7717479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak 7718479a5747SRoman Bolshakovelif test "$pthread_setname_np_wo_tid" = "yes" ; then 7719479a5747SRoman Bolshakov echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 7720479a5747SRoman Bolshakov echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak 77215c312079SDr. David Alan Gilbertfi 77225c312079SDr. David Alan Gilbert 772317824406SJunyan Heif test "$libpmem" = "yes" ; then 772417824406SJunyan He echo "CONFIG_LIBPMEM=y" >> $config_host_mak 772517824406SJunyan Hefi 772617824406SJunyan He 772721b2eca6SJingqi Liuif test "$libdaxctl" = "yes" ; then 772821b2eca6SJingqi Liu echo "CONFIG_LIBDAXCTL=y" >> $config_host_mak 772921b2eca6SJingqi Liufi 773021b2eca6SJingqi Liu 77312f740136SJeff Codyif test "$bochs" = "yes" ; then 77322f740136SJeff Cody echo "CONFIG_BOCHS=y" >> $config_host_mak 77332f740136SJeff Codyfi 77342f740136SJeff Codyif test "$cloop" = "yes" ; then 77352f740136SJeff Cody echo "CONFIG_CLOOP=y" >> $config_host_mak 77362f740136SJeff Codyfi 77372f740136SJeff Codyif test "$dmg" = "yes" ; then 77382f740136SJeff Cody echo "CONFIG_DMG=y" >> $config_host_mak 77392f740136SJeff Codyfi 77402f740136SJeff Codyif test "$qcow1" = "yes" ; then 77412f740136SJeff Cody echo "CONFIG_QCOW1=y" >> $config_host_mak 77422f740136SJeff Codyfi 77432f740136SJeff Codyif test "$vdi" = "yes" ; then 77442f740136SJeff Cody echo "CONFIG_VDI=y" >> $config_host_mak 77452f740136SJeff Codyfi 77462f740136SJeff Codyif test "$vvfat" = "yes" ; then 77472f740136SJeff Cody echo "CONFIG_VVFAT=y" >> $config_host_mak 77482f740136SJeff Codyfi 77492f740136SJeff Codyif test "$qed" = "yes" ; then 77502f740136SJeff Cody echo "CONFIG_QED=y" >> $config_host_mak 77512f740136SJeff Codyfi 77522f740136SJeff Codyif test "$parallels" = "yes" ; then 77532f740136SJeff Cody echo "CONFIG_PARALLELS=y" >> $config_host_mak 77542f740136SJeff Codyfi 77552f740136SJeff Codyif test "$sheepdog" = "yes" ; then 77562f740136SJeff Cody echo "CONFIG_SHEEPDOG=y" >> $config_host_mak 77572f740136SJeff Codyfi 7758c9c8b88fSDavid CARLIERif test "$pty_h" = "yes" ; then 7759c9c8b88fSDavid CARLIER echo "HAVE_PTY_H=y" >> $config_host_mak 7760c9c8b88fSDavid CARLIERfi 7761195588ccSDavid CARLIERif test "$have_mlockall" = "yes" ; then 7762195588ccSDavid CARLIER echo "HAVE_MLOCKALL=y" >> $config_host_mak 7763195588ccSDavid CARLIERfi 7764adc28027SAlexander Bulekovif test "$fuzzing" = "yes" ; then 7765adc28027SAlexander Bulekov if test "$have_fuzzer" = "yes"; then 7766dd016265SAlexander Bulekov FUZZ_LDFLAGS=" -fsanitize=fuzzer" 7767dd016265SAlexander Bulekov FUZZ_CFLAGS=" -fsanitize=fuzzer" 7768086d5f75SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS -fsanitize=fuzzer-no-link" 7769adc28027SAlexander Bulekov else 7770dd016265SAlexander Bulekov error_exit "Your compiler doesn't support -fsanitize=fuzzer" 7771adc28027SAlexander Bulekov exit 1 7772adc28027SAlexander Bulekov fi 7773adc28027SAlexander Bulekovfi 77742f740136SJeff Cody 777540e8c6f4SAlex Bennéeif test "$plugins" = "yes" ; then 777640e8c6f4SAlex Bennée echo "CONFIG_PLUGIN=y" >> $config_host_mak 777740e8c6f4SAlex Bennée LIBS="-ldl $LIBS" 777826fffe29SEmilio G. Cota # Copy the export object list to the build dir 777926fffe29SEmilio G. Cota if test "$ld_dynamic_list" = "yes" ; then 778026fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak 778126fffe29SEmilio G. Cota ld_symbols=qemu-plugins-ld.symbols 778226fffe29SEmilio G. Cota cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols 778326fffe29SEmilio G. Cota elif test "$ld_exported_symbols_list" = "yes" ; then 778426fffe29SEmilio G. Cota echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak 778526fffe29SEmilio G. Cota ld64_symbols=qemu-plugins-ld64.symbols 778626fffe29SEmilio G. Cota echo "# Automatically generated by configure - do not modify" > $ld64_symbols 778726fffe29SEmilio G. Cota grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ 778826fffe29SEmilio G. Cota sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols 778926fffe29SEmilio G. Cota else 779026fffe29SEmilio G. Cota error_exit \ 779126fffe29SEmilio G. Cota "If \$plugins=yes, either \$ld_dynamic_list or " \ 779226fffe29SEmilio G. Cota "\$ld_exported_symbols_list should have been set to 'yes'." 779326fffe29SEmilio G. Cota fi 779440e8c6f4SAlex Bennéefi 779540e8c6f4SAlex Bennée 7796f48e590aSAlex Bennéeif test -n "$gdb_bin" ; then 7797f48e590aSAlex Bennée echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak 7798f48e590aSAlex Bennéefi 7799f48e590aSAlex Bennée 780054e7aac0SAlexey Krasikovif test "$secret_keyring" = "yes" ; then 780154e7aac0SAlexey Krasikov echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak 780292500362SAlexey Krasikov if test "$have_keyutils" = "yes" ; then 780392500362SAlexey Krasikov echo "CONFIG_TEST_SECRET_KEYRING=y" >> $config_host_mak 780492500362SAlexey Krasikov fi 780554e7aac0SAlexey Krasikovfi 780654e7aac0SAlexey Krasikov 78075b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 780825211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES" 78095b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 781025211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES" 78115b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 781225211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES" 7813e633a5c6SEric Blakeelif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then 781425211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES" 781540d964b5SRichard Hendersonelif test "$ARCH" = "ppc64" ; then 781625211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES" 7817e633a5c6SEric Blakeelif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then 781825211446SPaolo Bonzini QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES" 78195b5e3037SPaolo Bonzinielse 782025211446SPaolo Bonzini QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES" 78215b5e3037SPaolo Bonzinifi 78225b5e3037SPaolo Bonzini 7823fdbff6bdSPhilippe Mathieu-Daudéecho "HELPERS=$helpers" >> $config_host_mak 782498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 782598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 7826804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 7827804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 78281901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 78291901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 78301901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 783121655882SPaolo Bonziniecho "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 7832c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 78332eb054c2SPeter Maydellecho "SPHINX_BUILD=$sphinx_build" >> $config_host_mak 7834516e8b7dSPeter Maydellecho "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak 783539d87c8cSAlex Bennéeecho "GENISOIMAGE=$genisoimage" >> $config_host_mak 7836a5665051SPaolo Bonziniecho "MESON=$meson" >> $config_host_mak 7837804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 7838a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 7839a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_host_mak 7840a31a8642SMichael S. Tsirkinfi 7841804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 784283f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 78433c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 7844804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 784545d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 7846cdbd727cSRichard Hendersonecho "AS=$as" >> $config_host_mak 78475f6f0e27SRichard Hendersonecho "CCAS=$ccas" >> $config_host_mak 78483dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 7849804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 7850804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 78519f81aeb5SAlistair Francisecho "RANLIB=$ranlib" >> $config_host_mak 78524852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 7853daa79d9aSAlex Bennéeecho "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak 78549fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 7855e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 7856086d5f75SPaolo Bonziniecho "CXXFLAGS=$CXXFLAGS" >> $config_host_mak 785746eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 7858a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 785911cde1c8SBruno Dominguezecho "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak 7860f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 7861e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 7862*968b4db3SPaolo Bonzini echo "SPARSE_CFLAGS = -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 7863e39f0062SPaolo Bonzinifi 78648a99e9a3SPhilippe Mathieu-Daudéecho "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak 7865db5adeaaSPaolo Bonziniecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 78666969ec6cSJames Clarkeecho "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak 7867e57218b6SPeter Maydellecho "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak 786873da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 78693e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 7870409437e1SDaniel P. Berrangeecho "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak 7871804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 787217969268SFam Zhengecho "DSOSUF=$DSOSUF" >> $config_host_mak 787317969268SFam Zhengecho "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 7874957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 787590246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 787690246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 787794dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 78781d728c39SBlue Swirlif test "$gcov" = "yes" ; then 78791d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 78801d728c39SBlue Swirlfi 7881804edf29SJuan Quintela 78823efac6ebSTomáš Golembiovskýif test "$libudev" != "no"; then 78833efac6ebSTomáš Golembiovský echo "CONFIG_LIBUDEV=y" >> $config_host_mak 78843efac6ebSTomáš Golembiovský echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak 78853efac6ebSTomáš Golembiovskýfi 7886adc28027SAlexander Bulekovif test "$fuzzing" != "no"; then 7887adc28027SAlexander Bulekov echo "CONFIG_FUZZ=y" >> $config_host_mak 7888adc28027SAlexander Bulekov echo "FUZZ_CFLAGS=$FUZZ_CFLAGS" >> $config_host_mak 7889adc28027SAlexander Bulekov echo "FUZZ_LDFLAGS=$FUZZ_LDFLAGS" >> $config_host_mak 7890adc28027SAlexander Bulekovfi 78913efac6ebSTomáš Golembiovský 789205dfa22bSPhilippe Mathieu-Daudéif test "$edk2_blobs" = "yes" ; then 789305dfa22bSPhilippe Mathieu-Daudé echo "DECOMPRESS_EDK2_BLOBS=y" >> $config_host_mak 789405dfa22bSPhilippe Mathieu-Daudéfi 789505dfa22bSPhilippe Mathieu-Daudé 7896b767d257SMarek Marczykowski-Góreckiif test "$rng_none" = "yes"; then 7897b767d257SMarek Marczykowski-Górecki echo "CONFIG_RNG_NONE=y" >> $config_host_mak 7898b767d257SMarek Marczykowski-Góreckifi 7899b767d257SMarek Marczykowski-Górecki 79006efd7517SPeter Maydell# use included Linux headers 79016efd7517SPeter Maydellif test "$linux" = "yes" ; then 7902a307beb6SAndreas Färber mkdir -p linux-headers 79036efd7517SPeter Maydell case "$cpu" in 7904c72b26ecSRichard Henderson i386|x86_64|x32) 790508312a63SPeter Maydell linux_arch=x86 79066efd7517SPeter Maydell ;; 7907f8378accSRichard Henderson ppc|ppc64|ppc64le) 790808312a63SPeter Maydell linux_arch=powerpc 79096efd7517SPeter Maydell ;; 79106efd7517SPeter Maydell s390x) 791108312a63SPeter Maydell linux_arch=s390 791208312a63SPeter Maydell ;; 79131f080313SClaudio Fontana aarch64) 79141f080313SClaudio Fontana linux_arch=arm64 79151f080313SClaudio Fontana ;; 7916222e7d11SSanjay Lal mips64) 7917222e7d11SSanjay Lal linux_arch=mips 7918222e7d11SSanjay Lal ;; 791908312a63SPeter Maydell *) 792008312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 792108312a63SPeter Maydell linux_arch="$cpu" 79226efd7517SPeter Maydell ;; 79236efd7517SPeter Maydell esac 792408312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 792508312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 792608312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 792708312a63SPeter Maydell fi 79286efd7517SPeter Maydellfi 79296efd7517SPeter Maydell 793097a847bcSbellardfor target in $target_list; do 793197a847bcSbellardtarget_dir="$target" 793225be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 793389138857SStefan Weiltarget_name=$(echo $target | cut -d '-' -f 1) 793452bf9771Stony.nguyen@bt.comtarget_aligned_only="no" 793552bf9771Stony.nguyen@bt.comcase "$target_name" in 793652bf9771Stony.nguyen@bt.com alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) 793752bf9771Stony.nguyen@bt.com target_aligned_only="yes" 793852bf9771Stony.nguyen@bt.com ;; 793952bf9771Stony.nguyen@bt.comesac 794097a847bcSbellardtarget_bigendian="no" 7941c1799a84SPaolo Bonzinicase "$target_name" in 7942a69dc537SThomas Huth armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 794352bf9771Stony.nguyen@bt.com target_bigendian="yes" 7944ea2d6a39SJuan Quintela ;; 7945ea2d6a39SJuan Quintelaesac 794697a847bcSbellardtarget_softmmu="no" 7947997344f3Sbellardtarget_user_only="no" 7948831b7825Sthstarget_linux_user="no" 794984778508Sblueswir1target_bsd_user="no" 79509e407a85Spbrookcase "$target" in 7951c1799a84SPaolo Bonzini ${target_name}-softmmu) 79529e407a85Spbrook target_softmmu="yes" 79539e407a85Spbrook ;; 7954c1799a84SPaolo Bonzini ${target_name}-linux-user) 79559e407a85Spbrook target_user_only="yes" 79569e407a85Spbrook target_linux_user="yes" 79579e407a85Spbrook ;; 7958c1799a84SPaolo Bonzini ${target_name}-bsd-user) 795984778508Sblueswir1 target_user_only="yes" 796084778508Sblueswir1 target_bsd_user="yes" 796184778508Sblueswir1 ;; 79629e407a85Spbrook *) 796376ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 79649e407a85Spbrook exit 1 79659e407a85Spbrook ;; 79669e407a85Spbrookesac 7967831b7825Sths 796897a847bcSbellardmkdir -p $target_dir 796925be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 797097a847bcSbellard 7971e5fe0c52Spbrookbflt="no" 7972ca759f9eSAlex Bennéemttcg="no" 797389138857SStefan Weilinterp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") 797456aebc89Spbrookgdb_xml_files="" 79757ba1e619Saliguori 7976c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 79776acff7daSJuan QuintelaTARGET_BASE_ARCH="" 7978e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 7979e73aae67SJuan Quintela 7980c1799a84SPaolo Bonzinicase "$target_name" in 79812408a527Saurel32 i386) 79820a7fa00aSEmilio G. Cota mttcg="yes" 79837b0f97baSDoug Gale gdb_xml_files="i386-32bit.xml" 798428988117SLaurent Vivier TARGET_SYSTBL_ABI=i386 79852408a527Saurel32 ;; 79862408a527Saurel32 x86_64) 79876acff7daSJuan Quintela TARGET_BASE_ARCH=i386 79888d62f35aSLaurent Vivier TARGET_SYSTBL_ABI=common,64 79890a7fa00aSEmilio G. Cota mttcg="yes" 79907b0f97baSDoug Gale gdb_xml_files="i386-64bit.xml" 79912408a527Saurel32 ;; 79922408a527Saurel32 alpha) 79935ee4f3c2SRichard Henderson mttcg="yes" 79946116aea9SLaurent Vivier TARGET_SYSTBL_ABI=common 79952408a527Saurel32 ;; 79962408a527Saurel32 arm|armeb) 7997b498c8a0SJuan Quintela TARGET_ARCH=arm 79985bcb4986SLaurent Vivier TARGET_SYSTBL_ABI=common,oabi 7999e5fe0c52Spbrook bflt="yes" 8000ca759f9eSAlex Bennée mttcg="yes" 8001c888f7e0SPeter Maydell gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" 80022408a527Saurel32 ;; 8003722dd7beSMichael Weiser aarch64|aarch64_be) 8004722dd7beSMichael Weiser TARGET_ARCH=aarch64 80056a49fa95SAlexander Graf TARGET_BASE_ARCH=arm 80066a49fa95SAlexander Graf bflt="yes" 8007ca759f9eSAlex Bennée mttcg="yes" 8008c888f7e0SPeter Maydell gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml arm-m-profile.xml" 80096a49fa95SAlexander Graf ;; 801042f3ff00SMichael Rolnik avr) 801142f3ff00SMichael Rolnik gdb_xml_files="avr-cpu.xml" 801242f3ff00SMichael Rolnik target_compiler=$cross_cc_avr 801342f3ff00SMichael Rolnik ;; 80142408a527Saurel32 cris) 80152408a527Saurel32 ;; 801661766fe9SRichard Henderson hppa) 80177b93dab5SRichard Henderson mttcg="yes" 80189566f4c6SLaurent Vivier TARGET_SYSTBL_ABI=common,32 801961766fe9SRichard Henderson ;; 8020613a22c9SMichael Walle lm32) 8021613a22c9SMichael Walle ;; 80222408a527Saurel32 m68k) 80230938cda5Saurel32 bflt="yes" 8024a976ed3fSKONRAD Frederic gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" 80255b85cae9SLaurent Vivier TARGET_SYSTBL_ABI=common 80262408a527Saurel32 ;; 8027877fdc12SEdgar E. Iglesias microblaze|microblazeel) 8028877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 8029ddf0c4cdSLaurent Vivier TARGET_SYSTBL_ABI=common 803072b675caSEdgar E. Iglesias bflt="yes" 8031be73ef64SEdgar E. Iglesias echo "TARGET_ABI32=y" >> $config_target_mak 803272b675caSEdgar E. Iglesias ;; 80332408a527Saurel32 mips|mipsel) 80340454728cSAleksandar Markovic mttcg="yes" 8035b498c8a0SJuan Quintela TARGET_ARCH=mips 803625be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 8037c59716fcSLaurent Vivier TARGET_SYSTBL_ABI=o32 80382408a527Saurel32 ;; 80392408a527Saurel32 mipsn32|mipsn32el) 80400454728cSAleksandar Markovic mttcg="yes" 8041597e2cecSRichard Henderson TARGET_ARCH=mips64 80426acff7daSJuan Quintela TARGET_BASE_ARCH=mips 804325be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 8044597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 8045686a0fe4SLaurent Vivier TARGET_SYSTBL_ABI=n32 80462408a527Saurel32 ;; 80472408a527Saurel32 mips64|mips64el) 8048a092a955SAlex Bennée mttcg="no" 8049b498c8a0SJuan Quintela TARGET_ARCH=mips64 80506acff7daSJuan Quintela TARGET_BASE_ARCH=mips 805125be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 8052686a0fe4SLaurent Vivier TARGET_SYSTBL_ABI=n64 80532408a527Saurel32 ;; 8054d15a9c23SAnthony Green moxie) 8055d15a9c23SAnthony Green ;; 8056e671711cSMarek Vasut nios2) 8057e671711cSMarek Vasut ;; 80584a09d0bbSRichard Henderson or1k) 8059e67db06eSJia Liu TARGET_ARCH=openrisc 8060e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 8061e67db06eSJia Liu ;; 80622408a527Saurel32 ppc) 8063c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 806476a691f1SLaurent Vivier TARGET_SYSTBL_ABI=common,nospu,32 80652408a527Saurel32 ;; 80662408a527Saurel32 ppc64) 80676acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 8068e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 806976a691f1SLaurent Vivier TARGET_SYSTBL_ABI=common,nospu,64 8070f0b0685dSNikunj A Dadhania mttcg=yes 80711438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 80722408a527Saurel32 ;; 80739c35126cSDoug Kwan ppc64le) 80749c35126cSDoug Kwan TARGET_ARCH=ppc64 80759c35126cSDoug Kwan TARGET_BASE_ARCH=ppc 80769c35126cSDoug Kwan TARGET_ABI_DIR=ppc 807776a691f1SLaurent Vivier TARGET_SYSTBL_ABI=common,nospu,64 8078f0b0685dSNikunj A Dadhania mttcg=yes 80791438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 80809c35126cSDoug Kwan ;; 80812408a527Saurel32 ppc64abi32) 8082b498c8a0SJuan Quintela TARGET_ARCH=ppc64 80836acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 8084e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 808576a691f1SLaurent Vivier TARGET_SYSTBL_ABI=common,nospu,32 808625be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 80871438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 80882408a527Saurel32 ;; 808925fa194bSMichael Clark riscv32) 809025fa194bSMichael Clark TARGET_BASE_ARCH=riscv 809125fa194bSMichael Clark TARGET_ABI_DIR=riscv 809225fa194bSMichael Clark mttcg=yes 8093ae4a70c0SKeith Packard gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-32bit-csr.xml riscv-32bit-virtual.xml" 809425fa194bSMichael Clark ;; 809525fa194bSMichael Clark riscv64) 809625fa194bSMichael Clark TARGET_BASE_ARCH=riscv 809725fa194bSMichael Clark TARGET_ABI_DIR=riscv 809825fa194bSMichael Clark mttcg=yes 8099ae4a70c0SKeith Packard gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml" 810025fa194bSMichael Clark ;; 8101c8c35e5fSYoshinori Sato rx) 8102c8c35e5fSYoshinori Sato TARGET_ARCH=rx 8103c8c35e5fSYoshinori Sato bflt="yes" 8104c8c35e5fSYoshinori Sato target_compiler=$cross_cc_rx 8105c8c35e5fSYoshinori Sato gdb_xml_files="rx-core.xml" 8106c8c35e5fSYoshinori Sato ;; 81072408a527Saurel32 sh4|sh4eb) 8108b498c8a0SJuan Quintela TARGET_ARCH=sh4 8109d0c832f6SLaurent Vivier TARGET_SYSTBL_ABI=common 81104dbed897Spbrook bflt="yes" 81112408a527Saurel32 ;; 81122408a527Saurel32 sparc) 8113bb0cdc03SLaurent Vivier TARGET_SYSTBL_ABI=common,32 81142408a527Saurel32 ;; 81152408a527Saurel32 sparc64) 81166acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 8117bb0cdc03SLaurent Vivier TARGET_SYSTBL_ABI=common,64 81182408a527Saurel32 ;; 81192408a527Saurel32 sparc32plus) 8120b498c8a0SJuan Quintela TARGET_ARCH=sparc64 81216acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 8122e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 8123bb0cdc03SLaurent Vivier TARGET_SYSTBL_ABI=common,32 812425be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 81252408a527Saurel32 ;; 812624e804ecSAlexander Graf s390x) 8127318f371dSLaurent Vivier TARGET_SYSTBL_ABI=common,64 812863685bc4SDavid Hildenbrand mttcg=yes 812986158a2aSChristian 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" 813024e804ecSAlexander Graf ;; 8131444e06b1SChen Gang tilegx) 8132444e06b1SChen Gang ;; 81335ecaa4edSPeter Crosthwaite tricore) 81345ecaa4edSPeter Crosthwaite ;; 8135d2fbca94SGuan Xuetao unicore32) 8136d2fbca94SGuan Xuetao ;; 8137cfa550c6SMax Filippov xtensa|xtensaeb) 8138cfa550c6SMax Filippov TARGET_ARCH=xtensa 8139a4a93592SLaurent Vivier TARGET_SYSTBL_ABI=common 814002e33e9fSMax Filippov bflt="yes" 81419fb40342SMax Filippov mttcg="yes" 8142cfa550c6SMax Filippov ;; 81432408a527Saurel32 *) 814476ad07a4SPeter Maydell error_exit "Unsupported target CPU" 81452408a527Saurel32 ;; 81462408a527Saurel32esac 81475e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 81485e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 81495e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 81505e8861a0SPaolo Bonzinifi 81515e8861a0SPaolo Bonzini 81525e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 81535e8861a0SPaolo Bonzini 815499afc91dSDaniel P. Berrangeupper() { 815599afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 815699afc91dSDaniel P. Berrange} 815799afc91dSDaniel P. Berrange 815889138857SStefan Weiltarget_arch_name="$(upper $TARGET_ARCH)" 815925be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 8160c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 816125be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 8162e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 8163e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 8164e6e91b9cSJuan Quintelafi 816525be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 8166adfc3e91SStacey Sonif [ "$HOST_VARIANT_DIR" != "" ]; then 8167adfc3e91SStacey Son echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 8168adfc3e91SStacey Sonfi 81694d6a835dSLaurent Vivierif [ "$TARGET_SYSTBL_ABI" != "" ]; then 81704d6a835dSLaurent Vivier echo "TARGET_SYSTBL_ABI=$TARGET_SYSTBL_ABI" >> $config_target_mak 81714d6a835dSLaurent Vivierfi 81723b6b7550SPaolo Bonzini 81733b6b7550SPaolo Bonziniif supported_xen_target $target; then 817425be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 8175e0e312f3SPaolo Bonzini echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak 8176eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 8177eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 8178eb6fda0fSAnthony PERARD fi 8179e0e312f3SPaolo Bonzinielse 8180e0e312f3SPaolo Bonzini echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak 8181432d268cSJun Nakajimafi 81823b6b7550SPaolo Bonziniif supported_kvm_target $target; then 818325be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 8184e0e312f3SPaolo Bonzini echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak 8185e0e312f3SPaolo Bonzinielse 8186e0e312f3SPaolo Bonzini echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak 8187c59249f9SJuan Quintelafi 81883b6b7550SPaolo Bonziniif supported_hax_target $target; then 8189b0cb0a66SVincent Palatin echo "CONFIG_HAX=y" >> $config_target_mak 8190b0cb0a66SVincent Palatinfi 8191c97d6d2cSSergio Andres Gomez Del Realif supported_hvf_target $target; then 8192c97d6d2cSSergio Andres Gomez Del Real echo "CONFIG_HVF=y" >> $config_target_mak 8193c97d6d2cSSergio Andres Gomez Del Realfi 8194d661d9a4SJustin Terry (VM)if supported_whpx_target $target; then 8195d661d9a4SJustin Terry (VM) echo "CONFIG_WHPX=y" >> $config_target_mak 8196d661d9a4SJustin Terry (VM)fi 819752bf9771Stony.nguyen@bt.comif test "$target_aligned_only" = "yes" ; then 819852bf9771Stony.nguyen@bt.com echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak 819952bf9771Stony.nguyen@bt.comfi 8200de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 820125be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 820297a847bcSbellardfi 820397a847bcSbellardif test "$target_softmmu" = "yes" ; then 820425be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 8205ca759f9eSAlex Bennée if test "$mttcg" = "yes" ; then 8206ca759f9eSAlex Bennée echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak 8207ca759f9eSAlex Bennée fi 8208de83cd02Sbellardfi 8209997344f3Sbellardif test "$target_user_only" = "yes" ; then 821025be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 8211a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 8212997344f3Sbellardfi 8213831b7825Sthsif test "$target_linux_user" = "yes" ; then 821425be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 8215831b7825Sthsfi 821656aebc89Spbrooklist="" 821756aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 821856aebc89Spbrook for x in $gdb_xml_files; do 821956aebc89Spbrook list="$list $source_path/gdb-xml/$x" 822056aebc89Spbrook done 822125be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 82223d0f1517SJuan Quintelafi 8223de83cd02Sbellard 8224e633a5c6SEric Blakeif test "$target_user_only" = "yes" && test "$bflt" = "yes"; then 822525be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 8226e5fe0c52Spbrookfi 822784778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 822825be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 822984778508Sblueswir1fi 82305b0753e0Sbellard 8231d75402b5SAlex Bennée 8232db5adeaaSPaolo Bonzini# generate QEMU_CFLAGS/QEMU_LDFLAGS for targets 8233fa282484SJuan Quintela 82344afddb55SJuan Quintelacflags="" 8235fa282484SJuan Quintelaldflags="" 82369b8e111fSJuan Quintela 8237c765fcacSPeter Crosthwaitedisas_config() { 8238c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> $config_target_mak 8239c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak 8240c765fcacSPeter Crosthwaite} 8241c765fcacSPeter Crosthwaite 824264656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 824364656024SJuan Quintela case "$i" in 824464656024SJuan Quintela alpha) 8245c765fcacSPeter Crosthwaite disas_config "ALPHA" 824664656024SJuan Quintela ;; 824782295d8aSRichard Henderson aarch64) 824882295d8aSRichard Henderson if test -n "${cxx}"; then 8249c765fcacSPeter Crosthwaite disas_config "ARM_A64" 825082295d8aSRichard Henderson fi 825182295d8aSRichard Henderson ;; 825264656024SJuan Quintela arm) 8253c765fcacSPeter Crosthwaite disas_config "ARM" 8254999b53ecSClaudio Fontana if test -n "${cxx}"; then 8255c765fcacSPeter Crosthwaite disas_config "ARM_A64" 8256999b53ecSClaudio Fontana fi 825764656024SJuan Quintela ;; 825842f3ff00SMichael Rolnik avr) 825942f3ff00SMichael Rolnik disas_config "AVR" 826042f3ff00SMichael Rolnik ;; 826164656024SJuan Quintela cris) 8262c765fcacSPeter Crosthwaite disas_config "CRIS" 826364656024SJuan Quintela ;; 8264429b31a2SRichard Henderson hppa) 8265429b31a2SRichard Henderson disas_config "HPPA" 8266429b31a2SRichard Henderson ;; 8267c72b26ecSRichard Henderson i386|x86_64|x32) 8268c765fcacSPeter Crosthwaite disas_config "I386" 826964656024SJuan Quintela ;; 827079368f49SMichael Walle lm32) 8271c765fcacSPeter Crosthwaite disas_config "LM32" 827279368f49SMichael Walle ;; 827364656024SJuan Quintela m68k) 8274c765fcacSPeter Crosthwaite disas_config "M68K" 827564656024SJuan Quintela ;; 8276877fdc12SEdgar E. Iglesias microblaze*) 8277c765fcacSPeter Crosthwaite disas_config "MICROBLAZE" 827864656024SJuan Quintela ;; 827964656024SJuan Quintela mips*) 8280c765fcacSPeter Crosthwaite disas_config "MIPS" 828189a955e8SAleksandar Markovic if test -n "${cxx}"; then 828289a955e8SAleksandar Markovic disas_config "NANOMIPS" 828389a955e8SAleksandar Markovic fi 828464656024SJuan Quintela ;; 8285d15a9c23SAnthony Green moxie*) 8286c765fcacSPeter Crosthwaite disas_config "MOXIE" 8287d15a9c23SAnthony Green ;; 8288e671711cSMarek Vasut nios2) 8289e671711cSMarek Vasut disas_config "NIOS2" 8290e671711cSMarek Vasut ;; 82914a09d0bbSRichard Henderson or1k) 8292c765fcacSPeter Crosthwaite disas_config "OPENRISC" 8293e67db06eSJia Liu ;; 829464656024SJuan Quintela ppc*) 8295c765fcacSPeter Crosthwaite disas_config "PPC" 829664656024SJuan Quintela ;; 8297c4f80543SAlistair Francis riscv*) 829825fa194bSMichael Clark disas_config "RISCV" 829925fa194bSMichael Clark ;; 8300c8c35e5fSYoshinori Sato rx) 8301c8c35e5fSYoshinori Sato disas_config "RX" 8302c8c35e5fSYoshinori Sato ;; 830324e804ecSAlexander Graf s390*) 8304c765fcacSPeter Crosthwaite disas_config "S390" 830564656024SJuan Quintela ;; 830664656024SJuan Quintela sh4) 8307c765fcacSPeter Crosthwaite disas_config "SH4" 830864656024SJuan Quintela ;; 830964656024SJuan Quintela sparc*) 8310c765fcacSPeter Crosthwaite disas_config "SPARC" 831164656024SJuan Quintela ;; 8312cfa550c6SMax Filippov xtensa*) 8313c765fcacSPeter Crosthwaite disas_config "XTENSA" 8314cfa550c6SMax Filippov ;; 831564656024SJuan Quintela esac 831664656024SJuan Quinteladone 83179195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 8318c765fcacSPeter Crosthwaite disas_config "TCI" 83199195b2c2SStefan Weilfi 832064656024SJuan Quintela 8321e9a3591fSChristian Borntraeger# Newer kernels on s390 check for an S390_PGSTE program header and 8322e9a3591fSChristian Borntraeger# enable the pgste page table extensions in that case. This makes 8323e9a3591fSChristian Borntraeger# the vm.allocate_pgste sysctl unnecessary. We enable this program 8324e9a3591fSChristian Borntraeger# header if 8325e9a3591fSChristian Borntraeger# - we build on s390x 8326e9a3591fSChristian Borntraeger# - we build the system emulation for s390x (qemu-system-s390x) 8327e9a3591fSChristian Borntraeger# - KVM is enabled 8328e9a3591fSChristian Borntraeger# - the linker supports --s390-pgste 8329e633a5c6SEric Blakeif test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \ 8330e633a5c6SEric Blake test "$ARCH" = "s390x" && test "$kvm" = "yes"; then 8331e9a3591fSChristian Borntraeger if ld_has --s390-pgste ; then 8332e9a3591fSChristian Borntraeger ldflags="-Wl,--s390-pgste $ldflags" 8333e9a3591fSChristian Borntraeger fi 8334e9a3591fSChristian Borntraegerfi 8335e9a3591fSChristian Borntraeger 8336db5adeaaSPaolo Bonziniecho "QEMU_LDFLAGS+=$ldflags" >> $config_target_mak 833725be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 8338fa282484SJuan Quintela 833997a847bcSbellarddone # for target in $targets 83407d13299dSbellard 8341d52c454aSMarc-André Lureauecho "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak 8342d52c454aSMarc-André Lureauecho "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak 8343d52c454aSMarc-André Lureau 8344e3971d61SPhilippe Mathieu-Daudéif [ "$fdt" = "git" ]; then 83453b8593eeSMarkus Armbruster echo "config-host.h: dtc/all" >> $config_host_mak 8346a540f158SPeter Crosthwaitefi 8347e219c499SRichard Hendersonif [ "$capstone" = "git" -o "$capstone" = "internal" ]; then 83483b8593eeSMarkus Armbruster echo "config-host.h: capstone/all" >> $config_host_mak 8349e219c499SRichard Hendersonfi 8350e219c499SRichard Hendersonif test -n "$LIBCAPSTONE"; then 8351e219c499SRichard Henderson echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak 8352e219c499SRichard Hendersonfi 8353a540f158SPeter Crosthwaite 8354a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 8355a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 8356a99d57bbSWanlong Gaofi 8357a99d57bbSWanlong Gao 8358fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 8359fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 8360fd0e6053SJohn Snowfi 8361fd0e6053SJohn Snow 83621e4f6065SDaniele Buonoif test "$safe_stack" = "yes"; then 83631e4f6065SDaniele Buono echo "CONFIG_SAFESTACK=y" >> $config_host_mak 83641e4f6065SDaniele Buonofi 83651e4f6065SDaniele Buono 8366e29e5c6eSPeter Maydell# If we're using a separate build tree, set it up now. 8367e29e5c6eSPeter Maydell# DIRS are directories which we simply mkdir in the build tree; 8368e29e5c6eSPeter Maydell# LINKS are things to symlink back into the source tree 8369e29e5c6eSPeter Maydell# (these can be both files and directories). 8370e29e5c6eSPeter Maydell# Caution: do not add files or directories here using wildcards. This 8371e29e5c6eSPeter Maydell# will result in problems later if a new file matching the wildcard is 8372e29e5c6eSPeter Maydell# added to the source tree -- nothing will cause configure to be rerun 8373e29e5c6eSPeter Maydell# so the build tree will be missing the link back to the new file, and 8374e29e5c6eSPeter Maydell# tests might fail. Prefer to keep the relevant files in their own 8375e29e5c6eSPeter Maydell# directory and symlink the directory instead. 83761cf4323eSThomas HuthDIRS="tests tests/tcg tests/tcg/lm32 tests/qapi-schema tests/qtest/libqos" 83771cf4323eSThomas HuthDIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph" 8378b855f8d1SPaolo BonziniDIRS="$DIRS docs docs/interop fsdev scsi" 8379744a928cSAlexey KardashevskiyDIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" 83808db2a4fdSGerd HoffmannDIRS="$DIRS roms/seabios" 83812038f8c8SPaolo BonziniLINKS="Makefile" 83822038f8c8SPaolo BonziniLINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile" 83832038f8c8SPaolo BonziniLINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile" 8384671f760bSEmilio G. CotaLINKS="$LINKS tests/plugin/Makefile" 8385e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" 8386e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/s390-ccw/Makefile" 83878db2a4fdSGerd HoffmannLINKS="$LINKS roms/seabios/Makefile" 8388e29e5c6eSPeter MaydellLINKS="$LINKS pc-bios/qemu-icon.bmp" 8389e29e5c6eSPeter MaydellLINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit 839039950353SPeter MaydellLINKS="$LINKS tests/acceptance tests/data" 839139950353SPeter MaydellLINKS="$LINKS tests/qemu-iotests/check" 83928f8fd9edSCleber RosaLINKS="$LINKS python" 8393753d11f2SRichard Hendersonfor bios_file in \ 8394753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 8395225a9ab8SAlexey Kardashevskiy $source_path/pc-bios/*.lid \ 8396753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 8397753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 8398e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 8399753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 84004e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 840126ce90fdSLaszlo Ersek $source_path/pc-bios/edk2-*.fd.bz2 \ 8402753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 8403753d11f2SRichard Hendersondo 8404e29e5c6eSPeter Maydell LINKS="$LINKS pc-bios/$(basename $bios_file)" 84057ea78b74SJan Kiszkadone 8406d1807a4fSPaolo Bonzinimkdir -p $DIRS 8407e29e5c6eSPeter Maydellfor f in $LINKS ; do 8408cab00a5aSMichael S. Tsirkin if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then 8409f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 8410f9245e10SPeter Maydell fi 84117d13299dSbellarddone 84121ad2134fSPaul Brook 84132038f8c8SPaolo Bonzini(for i in $cross_cc_vars; do 84142038f8c8SPaolo Bonzini export $i 84152038f8c8SPaolo Bonzinidone 8416afc3a8f9SAlex Bennéeexport target_list source_path use_containers 84172038f8c8SPaolo Bonzini$source_path/tests/tcg/configure.sh) 84182038f8c8SPaolo Bonzini 8419c34ebfdcSAnthony Liguori# temporary config to build submodules 84208db2a4fdSGerd Hoffmannfor rom in seabios; do 8421c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 842237116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 8423c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 8424cdbd727cSRichard Henderson echo "AS=$as" >> $config_mak 84255f6f0e27SRichard Henderson echo "CCAS=$ccas" >> $config_mak 8426c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 8427c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 84283dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 8429c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 8430a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 8431c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 84329f81aeb5SAlistair Francis echo "RANLIB=$ranlib" >> $config_mak 8433c34ebfdcSAnthony Liguoridone 8434c34ebfdcSAnthony Liguori 843576c7560aSMax Reitz# set up qemu-iotests in this build directory 843676c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 843776c7560aSMax Reitz 843876c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 843976c7560aSMax Reitzecho >> "$iotests_common_env" 844076c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 844176c7560aSMax Reitz 8442a5665051SPaolo Bonziniif test "$skip_meson" = no; then 8443fc929892SMarc-André Lureaucross="config-meson.cross.new" 8444fc929892SMarc-André Lureaumeson_quote() { 8445fc929892SMarc-André Lureau echo "['$(echo $* | sed "s/ /','/g")']" 8446fc929892SMarc-André Lureau} 8447fc929892SMarc-André Lureau 8448fc929892SMarc-André Lureauecho "# Automatically generated by configure - do not modify" > $cross 8449fc929892SMarc-André Lureauecho "[properties]" >> $cross 8450fc929892SMarc-André Lureautest -z "$cxx" && echo "link_language = 'c'" >> $cross 8451fc929892SMarc-André Lureauecho "[binaries]" >> $cross 8452fc929892SMarc-André Lureauecho "c = $(meson_quote $cc)" >> $cross 8453fc929892SMarc-André Lureautest -n "$cxx" && echo "cpp = $(meson_quote $cxx)" >> $cross 8454fc929892SMarc-André Lureauecho "ar = $(meson_quote $ar)" >> $cross 8455fc929892SMarc-André Lureauecho "nm = $(meson_quote $nm)" >> $cross 8456fc929892SMarc-André Lureauecho "pkgconfig = $(meson_quote $pkg_config_exe)" >> $cross 8457fc929892SMarc-André Lureauecho "ranlib = $(meson_quote $ranlib)" >> $cross 8458fc929892SMarc-André Lureauecho "strip = $(meson_quote $strip)" >> $cross 8459fc929892SMarc-André Lureauecho "windres = $(meson_quote $windres)" >> $cross 8460fc929892SMarc-André Lureauif test -n "$cross_prefix"; then 8461fc929892SMarc-André Lureau cross_arg="--cross-file config-meson.cross" 8462fc929892SMarc-André Lureau # Hack: Meson expects an absolute path for the *build* machine 8463fc929892SMarc-André Lureau # for the prefix, so add a slash in front of a Windows path that 8464fc929892SMarc-André Lureau # includes a drive letter. 8465fc929892SMarc-André Lureau # 8466fc929892SMarc-André Lureau # See https://github.com/mesonbuild/meson/issues/7577. 8467fc929892SMarc-André Lureau echo "[host_machine]" >> $cross 8468fc929892SMarc-André Lureau if test "$mingw32" = "yes" ; then 8469fc929892SMarc-André Lureau echo "system = 'windows'" >> $cross 8470fc929892SMarc-André Lureau case $prefix in 8471fc929892SMarc-André Lureau ?:*) pre_prefix=/ ;; 8472fc929892SMarc-André Lureau esac 8473fc929892SMarc-André Lureau fi 8474fc929892SMarc-André Lureau case "$ARCH" in 8475fc929892SMarc-André Lureau i386|x86_64) 8476fc929892SMarc-André Lureau echo "cpu_family = 'x86'" >> $cross 8477fc929892SMarc-André Lureau ;; 8478fc929892SMarc-André Lureau ppc64le) 8479fc929892SMarc-André Lureau echo "cpu_family = 'ppc64'" >> $cross 8480fc929892SMarc-André Lureau ;; 8481fc929892SMarc-André Lureau *) 8482fc929892SMarc-André Lureau echo "cpu_family = '$ARCH'" >> $cross 8483fc929892SMarc-André Lureau ;; 8484fc929892SMarc-André Lureau esac 8485fc929892SMarc-André Lureau echo "cpu = '$cpu'" >> $cross 8486fc929892SMarc-André Lureau if test "$bigendian" = "yes" ; then 8487fc929892SMarc-André Lureau echo "endian = 'big'" >> $cross 8488fc929892SMarc-André Lureau else 8489fc929892SMarc-André Lureau echo "endian = 'little'" >> $cross 8490fc929892SMarc-André Lureau fi 8491fc929892SMarc-André Lureauelse 8492fc929892SMarc-André Lureau cross_arg="--native-file config-meson.cross" 8493fc929892SMarc-André Lureaufi 8494fc929892SMarc-André Lureaumv $cross config-meson.cross 8495fc929892SMarc-André Lureau 8496a5665051SPaolo Bonzinirm -rf meson-private meson-info meson-logs 8497a5665051SPaolo BonziniNINJA=$PWD/ninjatool $meson setup \ 8498fc929892SMarc-André Lureau --prefix "${pre_prefix}$prefix" \ 8499fc929892SMarc-André Lureau --libdir "${pre_prefix}$libdir" \ 8500fc929892SMarc-André Lureau --libexecdir "${pre_prefix}$libexecdir" \ 8501fc929892SMarc-André Lureau --bindir "${pre_prefix}$bindir" \ 8502fc929892SMarc-André Lureau --includedir "${pre_prefix}$includedir" \ 8503fc929892SMarc-André Lureau --datadir "${pre_prefix}$datadir" \ 8504fc929892SMarc-André Lureau --mandir "${pre_prefix}$mandir" \ 8505fc929892SMarc-André Lureau --sysconfdir "${pre_prefix}$sysconfdir" \ 8506fc929892SMarc-André Lureau --localstatedir "${pre_prefix}$local_statedir" \ 8507a5665051SPaolo Bonzini -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ 8508a5665051SPaolo Bonzini -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ 8509a5665051SPaolo Bonzini -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ 8510a5665051SPaolo Bonzini -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ 8511da6d48b9SMarc-André Lureau -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ 8512bf0e56a3SMarc-André Lureau -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ 8513fc929892SMarc-André Lureau $cross_arg \ 8514a5665051SPaolo Bonzini "$PWD" "$source_path" 8515a5665051SPaolo Bonzini 8516a5665051SPaolo Bonziniif test "$?" -ne 0 ; then 8517a5665051SPaolo Bonzini error_exit "meson setup failed" 8518a5665051SPaolo Bonzinifi 8519a5665051SPaolo Bonzinitouch ninjatool.stamp 8520a5665051SPaolo Bonzinifi 8521a5665051SPaolo Bonzini 8522dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 8523dc655404SMichael S. Tsirkincat <<EOD >config.status 8524dc655404SMichael S. Tsirkin#!/bin/sh 8525dc655404SMichael S. Tsirkin# Generated by configure. 8526dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 8527dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 8528dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 8529dc655404SMichael S. TsirkinEOD 8530e811da7fSDaniel P. Berrangé 8531e811da7fSDaniel P. Berrangépreserve_env() { 8532e811da7fSDaniel P. Berrangé envname=$1 8533e811da7fSDaniel P. Berrangé 8534e811da7fSDaniel P. Berrangé eval envval=\$$envname 8535e811da7fSDaniel P. Berrangé 8536e811da7fSDaniel P. Berrangé if test -n "$envval" 8537e811da7fSDaniel P. Berrangé then 8538e811da7fSDaniel P. Berrangé echo "$envname='$envval'" >> config.status 8539e811da7fSDaniel P. Berrangé echo "export $envname" >> config.status 8540e811da7fSDaniel P. Berrangé else 8541e811da7fSDaniel P. Berrangé echo "unset $envname" >> config.status 8542e811da7fSDaniel P. Berrangé fi 8543e811da7fSDaniel P. Berrangé} 8544e811da7fSDaniel P. Berrangé 8545e811da7fSDaniel P. Berrangé# Preserve various env variables that influence what 8546e811da7fSDaniel P. Berrangé# features/build target configure will detect 8547e811da7fSDaniel P. Berrangépreserve_env AR 8548e811da7fSDaniel P. Berrangépreserve_env AS 8549e811da7fSDaniel P. Berrangépreserve_env CC 8550e811da7fSDaniel P. Berrangépreserve_env CPP 8551e811da7fSDaniel P. Berrangépreserve_env CXX 8552e811da7fSDaniel P. Berrangépreserve_env INSTALL 8553e811da7fSDaniel P. Berrangépreserve_env LD 8554e811da7fSDaniel P. Berrangépreserve_env LD_LIBRARY_PATH 8555e811da7fSDaniel P. Berrangépreserve_env LIBTOOL 8556e811da7fSDaniel P. Berrangépreserve_env MAKE 8557e811da7fSDaniel P. Berrangépreserve_env NM 8558e811da7fSDaniel P. Berrangépreserve_env OBJCOPY 8559e811da7fSDaniel P. Berrangépreserve_env PATH 8560e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG 8561e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_LIBDIR 8562e811da7fSDaniel P. Berrangépreserve_env PKG_CONFIG_PATH 8563e811da7fSDaniel P. Berrangépreserve_env PYTHON 8564e811da7fSDaniel P. Berrangépreserve_env SDL2_CONFIG 8565e811da7fSDaniel P. Berrangépreserve_env SMBD 8566e811da7fSDaniel P. Berrangépreserve_env STRIP 8567e811da7fSDaniel P. Berrangépreserve_env WINDRES 8568e811da7fSDaniel P. Berrangé 8569dc655404SMichael S. Tsirkinprintf "exec" >>config.status 8570a5665051SPaolo Bonzinifor i in "$0" "$@"; do 8571a5665051SPaolo Bonzini test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status 8572a5665051SPaolo Bonzinidone 8573cf7cc929SDr. David Alan Gilbertecho ' "$@"' >>config.status 8574dc655404SMichael S. Tsirkinchmod +x config.status 8575dc655404SMichael S. Tsirkin 85768cd05ab6SPeter Maydellrm -r "$TMPDIR1" 8577