17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 58cd05ab6SPeter Maydell 699519e67SCornelia Huck# Unset some variables known to interfere with behavior of common tools, 799519e67SCornelia Huck# just as autoconf does. 899519e67SCornelia HuckCLICOLOR_FORCE= GREP_OPTIONS= 999519e67SCornelia Huckunset CLICOLOR_FORCE GREP_OPTIONS 1099519e67SCornelia Huck 115e4dfd3dSJohn Snow# Don't allow CCACHE, if present, to use cached results of compile tests! 125e4dfd3dSJohn Snowexport CCACHE_RECACHE=yes 135e4dfd3dSJohn Snow 148cd05ab6SPeter Maydell# Temporary directory used for files created while 158cd05ab6SPeter Maydell# configure runs. Since it is in the build directory 168cd05ab6SPeter Maydell# we can safely blow away any previous version of it 178cd05ab6SPeter Maydell# (and we need not jump through hoops to try to delete 188cd05ab6SPeter Maydell# it when configure exits.) 198cd05ab6SPeter MaydellTMPDIR1="config-temp" 208cd05ab6SPeter Maydellrm -rf "${TMPDIR1}" 218cd05ab6SPeter Maydellmkdir -p "${TMPDIR1}" 228cd05ab6SPeter Maydellif [ $? -ne 0 ]; then 238cd05ab6SPeter Maydell echo "ERROR: failed to create temporary directory" 248cd05ab6SPeter Maydell exit 1 257d13299dSbellardfi 267d13299dSbellard 278cd05ab6SPeter MaydellTMPB="qemu-conf" 288cd05ab6SPeter MaydellTMPC="${TMPDIR1}/${TMPB}.c" 2966518bf6SDon SlutzTMPO="${TMPDIR1}/${TMPB}.o" 309c83ffd8SPeter MaydellTMPCXX="${TMPDIR1}/${TMPB}.cxx" 3166518bf6SDon SlutzTMPL="${TMPDIR1}/${TMPB}.lo" 3266518bf6SDon SlutzTMPA="${TMPDIR1}/lib${TMPB}.la" 338cd05ab6SPeter MaydellTMPE="${TMPDIR1}/${TMPB}.exe" 347d13299dSbellard 35da1d85e3SGerd Hoffmannrm -f config.log 369ac81bbbSmalc 37b48e3611SPeter Maydell# Print a helpful header at the top of config.log 38b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 39979ae168SPeter Maydellprintf "# Configured with:" >> config.log 40979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 41979ae168SPeter Maydellecho >> config.log 42b48e3611SPeter Maydellecho "#" >> config.log 43b48e3611SPeter Maydell 4476ad07a4SPeter Maydellerror_exit() { 4576ad07a4SPeter Maydell echo 4676ad07a4SPeter Maydell echo "ERROR: $1" 4776ad07a4SPeter Maydell while test -n "$2"; do 4876ad07a4SPeter Maydell echo " $2" 4976ad07a4SPeter Maydell shift 5076ad07a4SPeter Maydell done 5176ad07a4SPeter Maydell echo 5276ad07a4SPeter Maydell exit 1 5376ad07a4SPeter Maydell} 5476ad07a4SPeter Maydell 559c83ffd8SPeter Maydelldo_compiler() { 569c83ffd8SPeter Maydell # Run the compiler, capturing its output to the log. First argument 579c83ffd8SPeter Maydell # is compiler binary to execute. 589c83ffd8SPeter Maydell local compiler="$1" 599c83ffd8SPeter Maydell shift 609c83ffd8SPeter Maydell echo $compiler "$@" >> config.log 619c83ffd8SPeter Maydell $compiler "$@" >> config.log 2>&1 || return $? 628dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 638dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 648dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 658dc38a78SPeter Maydell # obvious to developers. 668dc38a78SPeter Maydell if test "$werror" != "yes"; then 678dc38a78SPeter Maydell return 0 688dc38a78SPeter Maydell fi 698dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 708dc38a78SPeter Maydell case "$*" in 718dc38a78SPeter Maydell *-Werror*) 728dc38a78SPeter Maydell return 0 738dc38a78SPeter Maydell ;; 748dc38a78SPeter Maydell esac 759c83ffd8SPeter Maydell echo $compiler -Werror "$@" >> config.log 769c83ffd8SPeter Maydell $compiler -Werror "$@" >> config.log 2>&1 && return $? 7776ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 7876ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 7976ad07a4SPeter Maydell "will be at the bottom of config.log." \ 8076ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 818dc38a78SPeter Maydell} 828dc38a78SPeter Maydell 839c83ffd8SPeter Maydelldo_cc() { 849c83ffd8SPeter Maydell do_compiler "$cc" "$@" 859c83ffd8SPeter Maydell} 869c83ffd8SPeter Maydell 879c83ffd8SPeter Maydelldo_cxx() { 889c83ffd8SPeter Maydell do_compiler "$cxx" "$@" 899c83ffd8SPeter Maydell} 909c83ffd8SPeter Maydell 919c83ffd8SPeter Maydellupdate_cxxflags() { 929c83ffd8SPeter Maydell # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those 939c83ffd8SPeter Maydell # options which some versions of GCC's C++ compiler complain about 949c83ffd8SPeter Maydell # because they only make sense for C programs. 959c83ffd8SPeter Maydell QEMU_CXXFLAGS= 969c83ffd8SPeter Maydell for arg in $QEMU_CFLAGS; do 979c83ffd8SPeter Maydell case $arg in 989c83ffd8SPeter Maydell -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ 999c83ffd8SPeter Maydell -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls) 1009c83ffd8SPeter Maydell ;; 1019c83ffd8SPeter Maydell *) 1029c83ffd8SPeter Maydell QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg 1039c83ffd8SPeter Maydell ;; 1049c83ffd8SPeter Maydell esac 1059c83ffd8SPeter Maydell done 1069c83ffd8SPeter Maydell} 1079c83ffd8SPeter Maydell 10852166aa0SJuan Quintelacompile_object() { 109fd0e6053SJohn Snow local_cflags="$1" 110fd0e6053SJohn Snow do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC 11152166aa0SJuan Quintela} 11252166aa0SJuan Quintela 11352166aa0SJuan Quintelacompile_prog() { 11452166aa0SJuan Quintela local_cflags="$1" 11552166aa0SJuan Quintela local_ldflags="$2" 1168dc38a78SPeter Maydell do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags 11752166aa0SJuan Quintela} 11852166aa0SJuan Quintela 11911568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 12011568d6dSPaolo Bonzinisymlink() { 12172b8b5a1SStefan Weil rm -rf "$2" 122ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 12372b8b5a1SStefan Weil ln -s "$1" "$2" 12411568d6dSPaolo Bonzini} 12511568d6dSPaolo Bonzini 1260dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1270dba6195SLoïc Minier# executable or a builtin) 1280dba6195SLoïc Minierhas() { 1290dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1300dba6195SLoïc Minier} 1310dba6195SLoïc Minier 1320dba6195SLoïc Minier# search for an executable in PATH 1330dba6195SLoïc Minierpath_of() { 1340dba6195SLoïc Minier local_command="$1" 1350dba6195SLoïc Minier local_ifs="$IFS" 1360dba6195SLoïc Minier local_dir="" 1370dba6195SLoïc Minier 1380dba6195SLoïc Minier # pathname has a dir component? 1390dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 1400dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 1410dba6195SLoïc Minier echo "$local_command" 1420dba6195SLoïc Minier return 0 1430dba6195SLoïc Minier fi 1440dba6195SLoïc Minier fi 1450dba6195SLoïc Minier if [ -z "$local_command" ]; then 1460dba6195SLoïc Minier return 1 1470dba6195SLoïc Minier fi 1480dba6195SLoïc Minier 1490dba6195SLoïc Minier IFS=: 1500dba6195SLoïc Minier for local_dir in $PATH; do 1510dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 1520dba6195SLoïc Minier echo "$local_dir/$local_command" 1530dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1540dba6195SLoïc Minier return 0 1550dba6195SLoïc Minier fi 1560dba6195SLoïc Minier done 1570dba6195SLoïc Minier # not found 1580dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1590dba6195SLoïc Minier return 1 1600dba6195SLoïc Minier} 1610dba6195SLoïc Minier 1625b808275SLluís Vilanovahave_backend () { 1635b808275SLluís Vilanova echo "$trace_backends" | grep "$1" >/dev/null 1645b808275SLluís Vilanova} 1655b808275SLluís Vilanova 1667d13299dSbellard# default parameters 167ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 1682ff6b91eSJuan Quintelacpu="" 169a31a8642SMichael S. Tsirkiniasl="iasl" 1701e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 17143ce4dfeSbellardstatic="no" 1727d13299dSbellardcross_prefix="" 1730c58ac1cSmalcaudio_drv_list="" 174b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 175b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 176e49d021eSPeter Maydellhost_cc="cc" 17773da375eSJuan Quintelalibs_softmmu="" 1783e2e0e6bSJuan Quintelalibs_tools="" 17967f86e8eSJuan Quintelaaudio_pt_int="" 180d5631638Smalcaudio_win_int="" 1812b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 182957f1f99SMichael Rothlibs_qga="" 1835bc62e01SGerd Hoffmanndebug_info="yes" 18463678e17SSteven Noonanstack_protector="" 185ac0df51dSaliguori 186afb63ebdSStefan Weil# Don't accept a target_list environment variable. 187afb63ebdSStefan Weilunset target_list 188377529c0SPaolo Bonzini 189377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 190377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 191377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 192377529c0SPaolo Bonzini# unless --disable-foo is given 193377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 194377529c0SPaolo Bonzini# feature will searched for, 195377529c0SPaolo Bonzini# if not found, configure exits with error 196377529c0SPaolo Bonzini# 197377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 198377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 199377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 200377529c0SPaolo Bonzini 201377529c0SPaolo Bonzinibluez="" 202377529c0SPaolo Bonzinibrlapi="" 203377529c0SPaolo Bonzinicurl="" 204377529c0SPaolo Bonzinicurses="" 205377529c0SPaolo Bonzinidocs="" 206377529c0SPaolo Bonzinifdt="" 20758952137SVincenzo Maffionenetmap="no" 208e2134eb9SGerd Hoffmannpixman="" 209377529c0SPaolo Bonzinisdl="" 21047c03744SDave Airliesdlabi="1.2" 211983eef5aSMeador Ingevirtfs="" 212821601eaSJes Sorensenvnc="yes" 213377529c0SPaolo Bonzinisparse="no" 214377529c0SPaolo Bonziniuuid="" 215377529c0SPaolo Bonzinivde="" 216377529c0SPaolo Bonzinivnc_sasl="" 217377529c0SPaolo Bonzinivnc_jpeg="" 218377529c0SPaolo Bonzinivnc_png="" 219377529c0SPaolo Bonzinixen="" 220d5b93ddfSAnthony PERARDxen_ctrl_version="" 22164a7ad6fSIan Campbellxen_pv_domain_build="no" 222eb6fda0fSAnthony PERARDxen_pci_passthrough="" 223377529c0SPaolo Bonzinilinux_aio="" 22447e98658SCorey Bryantcap_ng="" 225377529c0SPaolo Bonziniattr="" 2264f26f2b6SAvi Kivitylibattr="" 227377529c0SPaolo Bonzinixfs="" 228377529c0SPaolo Bonzini 229d41a75a2SBradvhost_net="no" 2305e9be92dSNicholas Bellingervhost_scsi="no" 231d41a75a2SBradkvm="no" 2322da776dbSMichael R. Hinesrdma="" 233377529c0SPaolo Bonzinigprof="no" 234377529c0SPaolo Bonzinidebug_tcg="no" 235377529c0SPaolo Bonzinidebug="no" 236b553a042SJohn Snowfortify_source="" 237377529c0SPaolo Bonzinistrip_opt="yes" 2389195b2c2SStefan Weiltcg_interpreter="no" 239377529c0SPaolo Bonzinibigendian="no" 240377529c0SPaolo Bonzinimingw32="no" 2411d728c39SBlue Swirlgcov="no" 2421d728c39SBlue Swirlgcov_tool="gcov" 243377529c0SPaolo BonziniEXESUF="" 24417969268SFam ZhengDSOSUF=".so" 24517969268SFam ZhengLDFLAGS_SHARED="-shared" 24617969268SFam Zhengmodules="no" 247377529c0SPaolo Bonziniprefix="/usr/local" 248377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 249528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 250850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 251377529c0SPaolo Bonzinibindir="\${prefix}/bin" 2523aa5d2beSAlon Levylibdir="\${prefix}/lib" 2538bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 2540f94d6daSAlon Levyincludedir="\${prefix}/include" 255377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 256785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 257377529c0SPaolo Bonziniconfsuffix="/qemu" 258377529c0SPaolo Bonzinislirp="yes" 259377529c0SPaolo Bonzinioss_lib="" 260377529c0SPaolo Bonzinibsd="no" 261377529c0SPaolo Bonzinilinux="no" 262377529c0SPaolo Bonzinisolaris="no" 263377529c0SPaolo Bonziniprofiler="no" 264377529c0SPaolo Bonzinicocoa="no" 265377529c0SPaolo Bonzinisoftmmu="yes" 266377529c0SPaolo Bonzinilinux_user="no" 267377529c0SPaolo Bonzinibsd_user="no" 268377529c0SPaolo Bonziniaix="no" 269377529c0SPaolo Bonziniblobs="yes" 270377529c0SPaolo Bonzinipkgversion="" 27140d6444eSAvi Kivitypie="" 272377529c0SPaolo Bonzinizero_malloc="" 2733556c233SPaolo Bonziniqom_cast_debug="yes" 274baf86d6bSPaolo Bonzinitrace_backends="log" 275377529c0SPaolo Bonzinitrace_file="trace" 276377529c0SPaolo Bonzinispice="" 277377529c0SPaolo Bonzinirbd="" 2787b02f544SMarc-André Lureausmartcard="" 2792b2325ffSGerd Hoffmannlibusb="" 28069354a83SHans de Goedeusb_redir="" 281da076ffeSGerd Hoffmannopengl="" 282*014cb152SGerd Hoffmannopengl_dmabuf="no" 2831ece9905SAlon Levyzlib="yes" 284b25c9dffSStefan Weillzo="" 285b25c9dffSStefan Weilsnappy="" 2866b383c08SPeter Wubzip2="" 287e8ef31a3SMichael Tokarevguest_agent="" 288d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 28950cbebb9SMichael Rothguest_agent_ntddscsi="no" 2909dacf32dSYossi Hindinguest_agent_msi="" 291d9840e25STomoki Sekiyamavss_win32_sdk="" 292d9840e25STomoki Sekiyamawin_sdk="no" 2934b1c11fdSDaniel P. Berrangewant_tools="yes" 294c589b249SRonnie Sahlberglibiscsi="" 2956542aa9cSPeter Lievenlibnfs="" 296519175a2SAlex Barcelocoroutine="" 29770c60c08SStefan Hajnoczicoroutine_pool="" 298f794573eSEduardo Otuboseccomp="" 299eb100396SBharata B Raoglusterfs="" 3000c14fb47SBharata B Raoglusterfs_discard="no" 3017c815372SBharata B Raoglusterfs_zerofill="no" 3026a460ed1SStefan Hajnocziarchipelago="no" 303a4ccabcfSAnthony Liguorigtk="" 3049e04c683SStefan Weilgtkabi="" 305925a0400SGerd Hoffmanngtk_gl="no" 306ddbb0d09SDaniel P. Berrangegnutls="" 307ddbb0d09SDaniel P. Berrangegnutls_hash="" 30891bfcdb0SDaniel P. Berrangenettle="" 30991bfcdb0SDaniel P. Berrangegcrypt="" 310bbbf9bfbSStefan Weilvte="" 3119d9e1521SGerd Hoffmannvirglrenderer="" 312e91c793cSCole Robinsontpm="yes" 3130a12ec87SRichard W.M. Joneslibssh2="" 3144f18b782SJeff Codyvhdx="" 315a99d57bbSWanlong Gaonuma="" 3162847b469SFam Zhengtcmalloc="no" 3177b01cb97SAlexandre Derumierjemalloc="no" 318377529c0SPaolo Bonzini 319ac0df51dSaliguori# parse CC options first 320ac0df51dSaliguorifor opt do 321ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 322ac0df51dSaliguori case "$opt" in 323ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 324ac0df51dSaliguori ;; 3253d8df640SPaolo Bonzini --cc=*) CC="$optarg" 326ac0df51dSaliguori ;; 32783f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 32883f73fceSTomoki Sekiyama ;; 329ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 330ca4deeb1SPaolo Bonzini ;; 3312ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 3322ff6b91eSJuan Quintela ;; 333de385287SAlex Bennée --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" 334f9943cd5SGerd Hoffmann EXTRA_CFLAGS="$optarg" 335e2a2ed06SJuan Quintela ;; 336a4969e90SAlex Bennée --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" 337f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 338e2a2ed06SJuan Quintela ;; 3395bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 3405bc62e01SGerd Hoffmann ;; 3415bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 3425bc62e01SGerd Hoffmann ;; 343ac0df51dSaliguori esac 344ac0df51dSaliguoridone 345ac0df51dSaliguori# OS specific 346ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 34793148aa5SStefan Weil# we can eliminate its usage altogether. 348ac0df51dSaliguori 349e49d021eSPeter Maydell# Preferred compiler: 350e49d021eSPeter Maydell# ${CC} (if set) 351e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 352e49d021eSPeter Maydell# system compiler 353e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 354e49d021eSPeter Maydell cc="$host_cc" 355e49d021eSPeter Maydellelse 356b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 357e49d021eSPeter Maydellfi 358e49d021eSPeter Maydell 35983f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 36083f73fceSTomoki Sekiyama cxx="c++" 36183f73fceSTomoki Sekiyamaelse 36283f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 36383f73fceSTomoki Sekiyamafi 36483f73fceSTomoki Sekiyama 365b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 3663dd46c78SBlue Swirlas="${AS-${cross_prefix}as}" 3673dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 368b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 369b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 3704852ee95SStefan Weilnm="${NM-${cross_prefix}nm}" 371b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 372b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 37317884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 37417884d7bSSergei Trofimovichquery_pkg_config() { 37517884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 37617884d7bSSergei Trofimovich} 37717884d7bSSergei Trofimovichpkg_config=query_pkg_config 378b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 37947c03744SDave Airliesdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}" 380ac0df51dSaliguori 38145d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 38245d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 38345d285abSPeter Maydell 384be17dc90SMichael S. Tsirkin# default flags for all hosts 3854c288acbSPeter MaydellQEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS" 386f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 387c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 388be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 3896b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include" 3905bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 3915bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 392be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 3935bc62e01SGerd Hoffmannfi 394be17dc90SMichael S. Tsirkin 395ca4deeb1SPaolo Bonzini# make source path absolute 396ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 397ca4deeb1SPaolo Bonzini 398cab00a5aSMichael S. Tsirkin# running configure in the source tree? 399cab00a5aSMichael S. Tsirkin# we know that's the case if configure is there. 400cab00a5aSMichael S. Tsirkinif test -f "./configure"; then 401cab00a5aSMichael S. Tsirkin pwd_is_source_path="y" 402cab00a5aSMichael S. Tsirkinelse 403cab00a5aSMichael S. Tsirkin pwd_is_source_path="n" 404cab00a5aSMichael S. Tsirkinfi 405cab00a5aSMichael S. Tsirkin 406ac0df51dSaliguoricheck_define() { 407ac0df51dSaliguoricat > $TMPC <<EOF 408ac0df51dSaliguori#if !defined($1) 409fd786e1aSPeter Maydell#error $1 not defined 410ac0df51dSaliguori#endif 411ac0df51dSaliguoriint main(void) { return 0; } 412ac0df51dSaliguoriEOF 41352166aa0SJuan Quintela compile_object 414ac0df51dSaliguori} 415ac0df51dSaliguori 416307119e7SGerd Hoffmanncheck_include() { 417307119e7SGerd Hoffmanncat > $TMPC <<EOF 418307119e7SGerd Hoffmann#include <$1> 419307119e7SGerd Hoffmannint main(void) { return 0; } 420307119e7SGerd HoffmannEOF 421307119e7SGerd Hoffmann compile_object 422307119e7SGerd Hoffmann} 423307119e7SGerd Hoffmann 42493b25869SJohn Snowwrite_c_skeleton() { 42593b25869SJohn Snow cat > $TMPC <<EOF 42693b25869SJohn Snowint main(void) { return 0; } 42793b25869SJohn SnowEOF 42893b25869SJohn Snow} 42993b25869SJohn Snow 430bbea4050SPeter Maydellif check_define __linux__ ; then 431bbea4050SPeter Maydell targetos="Linux" 432bbea4050SPeter Maydellelif check_define _WIN32 ; then 433bbea4050SPeter Maydell targetos='MINGW32' 434bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 435bbea4050SPeter Maydell targetos='OpenBSD' 436bbea4050SPeter Maydellelif check_define __sun__ ; then 437bbea4050SPeter Maydell targetos='SunOS' 438bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 439bbea4050SPeter Maydell targetos='Haiku' 440bbea4050SPeter Maydellelse 441bbea4050SPeter Maydell targetos=`uname -s` 442bbea4050SPeter Maydellfi 443bbea4050SPeter Maydell 444bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 445bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 446bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 447bbea4050SPeter Maydell# the correct CPU with the --cpu option. 448bbea4050SPeter Maydellcase $targetos in 449bbea4050SPeter MaydellDarwin) 450bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 451bbea4050SPeter Maydell # run 64-bit userspace code. 452bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 453bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 454bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 455bbea4050SPeter Maydell cpu="x86_64" 456bbea4050SPeter Maydell fi 457bbea4050SPeter Maydell ;; 458bbea4050SPeter MaydellSunOS) 459bbea4050SPeter Maydell # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo 460bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 461bbea4050SPeter Maydell cpu="x86_64" 462bbea4050SPeter Maydell fi 463bbea4050SPeter Maydellesac 464bbea4050SPeter Maydell 4652ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 4662ff6b91eSJuan Quintela # command line argument 4672ff6b91eSJuan Quintela : 4682ff6b91eSJuan Quintelaelif check_define __i386__ ; then 469ac0df51dSaliguori cpu="i386" 470ac0df51dSaliguorielif check_define __x86_64__ ; then 471c72b26ecSRichard Henderson if check_define __ILP32__ ; then 472c72b26ecSRichard Henderson cpu="x32" 473c72b26ecSRichard Henderson else 474ac0df51dSaliguori cpu="x86_64" 475c72b26ecSRichard Henderson fi 4763aa9bd6cSblueswir1elif check_define __sparc__ ; then 4773aa9bd6cSblueswir1 if check_define __arch64__ ; then 4783aa9bd6cSblueswir1 cpu="sparc64" 4793aa9bd6cSblueswir1 else 4803aa9bd6cSblueswir1 cpu="sparc" 4813aa9bd6cSblueswir1 fi 482fdf7ed96Smalcelif check_define _ARCH_PPC ; then 483fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 484fdf7ed96Smalc cpu="ppc64" 485ac0df51dSaliguori else 486fdf7ed96Smalc cpu="ppc" 487fdf7ed96Smalc fi 488afa05235SAurelien Jarnoelif check_define __mips__ ; then 489afa05235SAurelien Jarno cpu="mips" 490477ba620SAurelien Jarnoelif check_define __ia64__ ; then 491477ba620SAurelien Jarno cpu="ia64" 492d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 493d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 494d66ed0eaSAurelien Jarno cpu="s390x" 495d66ed0eaSAurelien Jarno else 496d66ed0eaSAurelien Jarno cpu="s390" 497d66ed0eaSAurelien Jarno fi 49821d89f84SPeter Maydellelif check_define __arm__ ; then 49921d89f84SPeter Maydell cpu="arm" 5001f080313SClaudio Fontanaelif check_define __aarch64__ ; then 5011f080313SClaudio Fontana cpu="aarch64" 502f28ffed5SBradelif check_define __hppa__ ; then 503f28ffed5SBrad cpu="hppa" 504fdf7ed96Smalcelse 505fdf7ed96Smalc cpu=`uname -m` 506ac0df51dSaliguorifi 507ac0df51dSaliguori 508359bc95dSPeter MaydellARCH= 509359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 510359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 5117d13299dSbellardcase "$cpu" in 512c72b26ecSRichard Henderson ia64|ppc|ppc64|s390|s390x|sparc64|x32) 513ea8f20f8SJuan Quintela cpu="$cpu" 514ea8f20f8SJuan Quintela ;; 5157d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 51697a847bcSbellard cpu="i386" 5177d13299dSbellard ;; 518aaa5fa14Saurel32 x86_64|amd64) 519aaa5fa14Saurel32 cpu="x86_64" 520aaa5fa14Saurel32 ;; 52121d89f84SPeter Maydell armv*b|armv*l|arm) 52221d89f84SPeter Maydell cpu="arm" 5237d13299dSbellard ;; 5241f080313SClaudio Fontana aarch64) 5251f080313SClaudio Fontana cpu="aarch64" 5261f080313SClaudio Fontana ;; 527afa05235SAurelien Jarno mips*) 528afa05235SAurelien Jarno cpu="mips" 529afa05235SAurelien Jarno ;; 5303142255cSblueswir1 sparc|sun4[cdmuv]) 531ae228531Sbellard cpu="sparc" 532ae228531Sbellard ;; 5337d13299dSbellard *) 534359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 535359bc95dSPeter Maydell ARCH=unknown 5367d13299dSbellard ;; 5377d13299dSbellardesac 538359bc95dSPeter Maydellif test -z "$ARCH"; then 539359bc95dSPeter Maydell ARCH="$cpu" 540359bc95dSPeter Maydellfi 541e2d52ad3SJuan Quintela 5427d13299dSbellard# OS specific 5430dbfc675SJuan Quintela 544adfc3e91SStacey Son# host *BSD for user mode 545adfc3e91SStacey SonHOST_VARIANT_DIR="" 546adfc3e91SStacey Son 5477d13299dSbellardcase $targetos in 548c326e0afSbellardCYGWIN*) 549c326e0afSbellard mingw32="yes" 550a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 5513cec7cc2SKővágó, Zoltán audio_possible_drivers="sdl" 5523cec7cc2SKővágó, Zoltán audio_drv_list="sdl" 553c326e0afSbellard;; 55467b915a5SbellardMINGW32*) 55567b915a5Sbellard mingw32="yes" 5563cec7cc2SKővágó, Zoltán audio_possible_drivers="dsound sdl" 557307119e7SGerd Hoffmann if check_include dsound.h; then 5583cec7cc2SKővágó, Zoltán audio_drv_list="dsound" 559307119e7SGerd Hoffmann else 560307119e7SGerd Hoffmann audio_drv_list="" 561307119e7SGerd Hoffmann fi 56267b915a5Sbellard;; 5635c40d2bdSthsGNU/kFreeBSD) 564a167ba50SAurelien Jarno bsd="yes" 5650c58ac1cSmalc audio_drv_list="oss" 5660bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 5675c40d2bdSths;; 5687d3505c5SbellardFreeBSD) 5697d3505c5Sbellard bsd="yes" 5700db4a067SPaolo Bonzini make="${MAKE-gmake}" 5710c58ac1cSmalc audio_drv_list="oss" 5720bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 573f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 574f01576f1SJuergen Lock LIBS="-lutil $LIBS" 57558952137SVincenzo Maffione netmap="" # enable netmap autodetect 576adfc3e91SStacey Son HOST_VARIANT_DIR="freebsd" 5777d3505c5Sbellard;; 578c5e97233Sblueswir1DragonFly) 579c5e97233Sblueswir1 bsd="yes" 5800db4a067SPaolo Bonzini make="${MAKE-gmake}" 581c5e97233Sblueswir1 audio_drv_list="oss" 5820bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl pa" 583adfc3e91SStacey Son HOST_VARIANT_DIR="dragonfly" 584c5e97233Sblueswir1;; 5857d3505c5SbellardNetBSD) 5867d3505c5Sbellard bsd="yes" 5870db4a067SPaolo Bonzini make="${MAKE-gmake}" 5880c58ac1cSmalc audio_drv_list="oss" 5890bac1111SKővágó, Zoltán audio_possible_drivers="oss sdl" 5908ef92a88Sblueswir1 oss_lib="-lossaudio" 591adfc3e91SStacey Son HOST_VARIANT_DIR="netbsd" 5927d3505c5Sbellard;; 5937d3505c5SbellardOpenBSD) 5947d3505c5Sbellard bsd="yes" 5950db4a067SPaolo Bonzini make="${MAKE-gmake}" 5964f6ab397SBrad Smith audio_drv_list="sdl" 5970bac1111SKővágó, Zoltán audio_possible_drivers="sdl" 598adfc3e91SStacey Son HOST_VARIANT_DIR="openbsd" 5997d3505c5Sbellard;; 60083fb7adfSbellardDarwin) 60183fb7adfSbellard bsd="yes" 60283fb7adfSbellard darwin="yes" 60317969268SFam Zheng LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 6041b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 605a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 6060c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 6071b0f9cc2Saliguori fi 608fd677642Sths cocoa="yes" 6090c58ac1cSmalc audio_drv_list="coreaudio" 61014382605SKővágó, Zoltán audio_possible_drivers="coreaudio sdl" 6110c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 6127973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 613a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 614a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 615a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 616adfc3e91SStacey Son HOST_VARIANT_DIR="darwin" 61783fb7adfSbellard;; 618ec530c81SbellardSunOS) 619ec530c81Sbellard solaris="yes" 6200db4a067SPaolo Bonzini make="${MAKE-gmake}" 6210db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 622fa58948dSBlue Swirl ld="gld" 623e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 6240475a5caSths needs_libsunmath="no" 625c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 626c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 6270475a5caSths if test "$solarisrev" -le 9 ; then 6280475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 6290475a5caSths needs_libsunmath="yes" 630f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 631f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 632f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 6330475a5caSths else 63476ad07a4SPeter Maydell error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \ 63576ad07a4SPeter Maydell "libsunmath from the Sun Studio compilers tools, due to a lack of" \ 63676ad07a4SPeter Maydell "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \ 63776ad07a4SPeter Maydell "Studio 11 can be downloaded from www.sun.com." 6380475a5caSths fi 6390475a5caSths fi 64086b2bd93Sths fi 6416b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 6420c58ac1cSmalc audio_drv_list="oss" 6436b4d2ba1Sths fi 644c2de5c91Smalc audio_possible_drivers="oss sdl" 645d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 646d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 647d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 648d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 649a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 650560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 651560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 652560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 653ec530c81Sbellard;; 654b29fe3edSmalcAIX) 655b29fe3edSmalc aix="yes" 6560db4a067SPaolo Bonzini make="${MAKE-gmake}" 657b29fe3edSmalc;; 658179cf400SAndreas FärberHaiku) 659179cf400SAndreas Färber haiku="yes" 660179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 661179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 662179cf400SAndreas Färber;; 663fb065187Sbellard*) 6640c58ac1cSmalc audio_drv_list="oss" 6650bac1111SKővágó, Zoltán audio_possible_drivers="oss alsa sdl pa" 6665327cf48Sbellard linux="yes" 667831b7825Sths linux_user="yes" 668af2be207SJan Kiszka kvm="yes" 669af2be207SJan Kiszka vhost_net="yes" 6705e9be92dSNicholas Bellinger vhost_scsi="yes" 671a585140dSAlexey Kardashevskiy QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" 672fb065187Sbellard;; 6737d13299dSbellardesac 6747d13299dSbellard 6757d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 676b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 67784778508Sblueswir1 bsd_user="yes" 6787d3505c5Sbellard fi 67908de3949SAndreas Färberfi 6807d3505c5Sbellard 6810db4a067SPaolo Bonzini: ${make=${MAKE-make}} 6820db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 68352510f8bSStefan Weil: ${python=${PYTHON-python}} 684e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 6850db4a067SPaolo Bonzini 6863c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 6873c4a4d0dSPeter Maydellif has clang; then 6883c4a4d0dSPeter Maydell objcc=clang 6893c4a4d0dSPeter Maydellelse 6903c4a4d0dSPeter Maydell objcc="$cc" 6913c4a4d0dSPeter Maydellfi 6923c4a4d0dSPeter Maydell 6933457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 6943457a3f8SJuan Quintela EXESUF=".exe" 69517969268SFam Zheng DSOSUF=".dll" 696a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 697e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 698e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 69978e9d4adSStefan Weil # MinGW needs -mthreads for TLS and macro _MT. 70078e9d4adSStefan Weil QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" 701f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 70293b25869SJohn Snow write_c_skeleton; 703f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 704f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 705f7cf5d5bSStefan Weil fi 706c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 707683035deSPaolo Bonzini mandir="\${prefix}" 708528ae5b8SEduardo Habkost datadir="\${prefix}" 709850da188SEduardo Habkost qemu_docdir="\${prefix}" 710683035deSPaolo Bonzini bindir="\${prefix}" 711683035deSPaolo Bonzini sysconfdir="\${prefix}" 7125a699bbbSLaszlo Ersek local_statedir= 713683035deSPaolo Bonzini confsuffix="" 714259434b8SMarc-André Lureau libs_qga="-lws2_32 -lwinmm -lpowrprof -liphlpapi -lnetapi32 $libs_qga" 7153457a3f8SJuan Quintelafi 7163457a3f8SJuan Quintela 717487fefdbSAnthony Liguoriwerror="" 71885aa5189Sbellard 7197d13299dSbellardfor opt do 720a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 7217d13299dSbellard case "$opt" in 7222efc3265Sbellard --help|-h) show_help=yes 7232efc3265Sbellard ;; 72499123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 72599123e13SMike Frysinger ;; 726b1a550a0Spbrook --prefix=*) prefix="$optarg" 7277d13299dSbellard ;; 728b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 72932ce6337Sbellard ;; 730ca4deeb1SPaolo Bonzini --source-path=*) 7317d13299dSbellard ;; 732ac0df51dSaliguori --cross-prefix=*) 7337d13299dSbellard ;; 734ac0df51dSaliguori --cc=*) 7357d13299dSbellard ;; 736b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 73783469015Sbellard ;; 73883f73fceSTomoki Sekiyama --cxx=*) 73983f73fceSTomoki Sekiyama ;; 740e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 741e007dbecSMichael S. Tsirkin ;; 7423c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 7433c4a4d0dSPeter Maydell ;; 744b1a550a0Spbrook --make=*) make="$optarg" 7457d13299dSbellard ;; 7466a882643Spbrook --install=*) install="$optarg" 7476a882643Spbrook ;; 748c886edfbSBlue Swirl --python=*) python="$optarg" 749c886edfbSBlue Swirl ;; 7501d728c39SBlue Swirl --gcov=*) gcov_tool="$optarg" 7511d728c39SBlue Swirl ;; 752e2d8830eSBrad --smbd=*) smbd="$optarg" 753e2d8830eSBrad ;; 754e2a2ed06SJuan Quintela --extra-cflags=*) 7557d13299dSbellard ;; 756e2a2ed06SJuan Quintela --extra-ldflags=*) 7577d13299dSbellard ;; 7585bc62e01SGerd Hoffmann --enable-debug-info) 7595bc62e01SGerd Hoffmann ;; 7605bc62e01SGerd Hoffmann --disable-debug-info) 7615bc62e01SGerd Hoffmann ;; 76217969268SFam Zheng --enable-modules) 76317969268SFam Zheng modules="yes" 76417969268SFam Zheng ;; 7653aa88b31SStefan Hajnoczi --disable-modules) 7663aa88b31SStefan Hajnoczi modules="no" 7673aa88b31SStefan Hajnoczi ;; 7682ff6b91eSJuan Quintela --cpu=*) 7697d13299dSbellard ;; 770b1a550a0Spbrook --target-list=*) target_list="$optarg" 771de83cd02Sbellard ;; 7725b808275SLluís Vilanova --enable-trace-backends=*) trace_backends="$optarg" 7735b808275SLluís Vilanova ;; 7745b808275SLluís Vilanova # XXX: backwards compatibility 7755b808275SLluís Vilanova --enable-trace-backend=*) trace_backends="$optarg" 77694a420b1SStefan Hajnoczi ;; 77774242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 7789410b56cSPrerna Saxena ;; 7797d13299dSbellard --enable-gprof) gprof="yes" 7807d13299dSbellard ;; 7811d728c39SBlue Swirl --enable-gcov) gcov="yes" 7821d728c39SBlue Swirl ;; 78379427693SLoïc Minier --static) 78479427693SLoïc Minier static="yes" 78579427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 78617884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 78743ce4dfeSbellard ;; 7880b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 7890b24e75fSPaolo Bonzini ;; 7900b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 7910b24e75fSPaolo Bonzini ;; 7923aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 7933aa5d2beSAlon Levy ;; 7948bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 7958bf188aaSMichael Tokarev ;; 7960f94d6daSAlon Levy --includedir=*) includedir="$optarg" 7970f94d6daSAlon Levy ;; 798528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 7990b24e75fSPaolo Bonzini ;; 800023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 801023d3d67SEduardo Habkost ;; 802850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 8030b24e75fSPaolo Bonzini ;; 804ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 80507381cc1SAnthony Liguori ;; 806785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 807785c23aeSLuiz Capitulino ;; 808785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 809023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 810023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 811023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 812023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 813023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 814023ddd74SMax Filippov # lots of directory switches by default. 815023ddd74SMax Filippov ;; 816e2134eb9SGerd Hoffmann --with-system-pixman) pixman="system" 817e2134eb9SGerd Hoffmann ;; 818e2134eb9SGerd Hoffmann --without-system-pixman) pixman="internal" 819e2134eb9SGerd Hoffmann ;; 82074880fe2SRobert Schiele --without-pixman) pixman="none" 82174880fe2SRobert Schiele ;; 82297a847bcSbellard --disable-sdl) sdl="no" 82397a847bcSbellard ;; 824c4198157SJuan Quintela --enable-sdl) sdl="yes" 825c4198157SJuan Quintela ;; 82647c03744SDave Airlie --with-sdlabi=*) sdlabi="$optarg" 82747c03744SDave Airlie ;; 8283556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 8293556c233SPaolo Bonzini ;; 8303556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 8313556c233SPaolo Bonzini ;; 832983eef5aSMeador Inge --disable-virtfs) virtfs="no" 833983eef5aSMeador Inge ;; 834983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 835983eef5aSMeador Inge ;; 836821601eaSJes Sorensen --disable-vnc) vnc="no" 837821601eaSJes Sorensen ;; 838821601eaSJes Sorensen --enable-vnc) vnc="yes" 839821601eaSJes Sorensen ;; 8402f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 8412f6a1ab0Sblueswir1 ;; 8420c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 8430c58ac1cSmalc ;; 844b64ec4e4SFam Zheng --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 845b64ec4e4SFam Zheng ;; 846b64ec4e4SFam Zheng --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 847eb852011SMarkus Armbruster ;; 848f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 849f8393946Saurel32 ;; 850f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 851f8393946Saurel32 ;; 852f3d08ee6SPaul Brook --enable-debug) 853f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 854f3d08ee6SPaul Brook debug_tcg="yes" 855f3d08ee6SPaul Brook debug="yes" 856f3d08ee6SPaul Brook strip_opt="no" 857b553a042SJohn Snow fortify_source="no" 858f3d08ee6SPaul Brook ;; 85903b4fe7dSaliguori --enable-sparse) sparse="yes" 86003b4fe7dSaliguori ;; 86103b4fe7dSaliguori --disable-sparse) sparse="no" 86203b4fe7dSaliguori ;; 8631625af87Saliguori --disable-strip) strip_opt="no" 8641625af87Saliguori ;; 8652f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 8662f9606b3Saliguori ;; 867ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 868ea784e3bSJuan Quintela ;; 8692f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 8702f6f5c7aSCorentin Chary ;; 8712f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 8722f6f5c7aSCorentin Chary ;; 873efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 874efe556adSCorentin Chary ;; 875efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 876efe556adSCorentin Chary ;; 877443f1376Sbellard --disable-slirp) slirp="no" 878c20709aaSbellard ;; 879ee682d27SStefan Weil --disable-uuid) uuid="no" 880ee682d27SStefan Weil ;; 881ee682d27SStefan Weil --enable-uuid) uuid="yes" 882ee682d27SStefan Weil ;; 883e0e6c8c0Saliguori --disable-vde) vde="no" 8848a16d273Sths ;; 885dfb278bdSJuan Quintela --enable-vde) vde="yes" 886dfb278bdSJuan Quintela ;; 88758952137SVincenzo Maffione --disable-netmap) netmap="no" 88858952137SVincenzo Maffione ;; 88958952137SVincenzo Maffione --enable-netmap) netmap="yes" 89058952137SVincenzo Maffione ;; 891e37630caSaliguori --disable-xen) xen="no" 892e37630caSaliguori ;; 893fc321b4bSJuan Quintela --enable-xen) xen="yes" 894fc321b4bSJuan Quintela ;; 895eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 896eb6fda0fSAnthony PERARD ;; 897eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 898eb6fda0fSAnthony PERARD ;; 89964a7ad6fSIan Campbell --disable-xen-pv-domain-build) xen_pv_domain_build="no" 90064a7ad6fSIan Campbell ;; 90164a7ad6fSIan Campbell --enable-xen-pv-domain-build) xen_pv_domain_build="yes" 90264a7ad6fSIan Campbell ;; 9032e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 9042e4d9fb1Saurel32 ;; 9054ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 9064ffcedb6SJuan Quintela ;; 907fb599c9aSbalrog --disable-bluez) bluez="no" 908fb599c9aSbalrog ;; 909a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 910a20a6f46SJuan Quintela ;; 9117ba1e619Saliguori --disable-kvm) kvm="no" 9127ba1e619Saliguori ;; 913b31a0277SJuan Quintela --enable-kvm) kvm="yes" 914b31a0277SJuan Quintela ;; 9159195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 9169195b2c2SStefan Weil ;; 9179195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 9189195b2c2SStefan Weil ;; 91947e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 92047e98658SCorey Bryant ;; 92147e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 92247e98658SCorey Bryant ;; 923cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 924cd4ec0b4SGerd Hoffmann ;; 925cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 926cd4ec0b4SGerd Hoffmann ;; 927c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 928c589b249SRonnie Sahlberg ;; 929c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 930c589b249SRonnie Sahlberg ;; 9316542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 9326542aa9cSPeter Lieven ;; 9336542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 9346542aa9cSPeter Lieven ;; 93505c2a3e7Sbellard --enable-profiler) profiler="yes" 93605c2a3e7Sbellard ;; 93714821030SPavel Borzenkov --disable-cocoa) cocoa="no" 93814821030SPavel Borzenkov ;; 939c2de5c91Smalc --enable-cocoa) 940c2de5c91Smalc cocoa="yes" ; 941c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 9425b0753e0Sbellard ;; 943cad25d69Spbrook --disable-system) softmmu="no" 9440a8e90f4Spbrook ;; 945cad25d69Spbrook --enable-system) softmmu="yes" 9460a8e90f4Spbrook ;; 9470953a80fSZachary Amsden --disable-user) 9480953a80fSZachary Amsden linux_user="no" ; 9490953a80fSZachary Amsden bsd_user="no" ; 9500953a80fSZachary Amsden ;; 9510953a80fSZachary Amsden --enable-user) ;; 952831b7825Sths --disable-linux-user) linux_user="no" 9530a8e90f4Spbrook ;; 954831b7825Sths --enable-linux-user) linux_user="yes" 955831b7825Sths ;; 95684778508Sblueswir1 --disable-bsd-user) bsd_user="no" 95784778508Sblueswir1 ;; 95884778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 95984778508Sblueswir1 ;; 96040d6444eSAvi Kivity --enable-pie) pie="yes" 96134005a00SKirill A. Shutemov ;; 96240d6444eSAvi Kivity --disable-pie) pie="no" 96334005a00SKirill A. Shutemov ;; 96485aa5189Sbellard --enable-werror) werror="yes" 96585aa5189Sbellard ;; 96685aa5189Sbellard --disable-werror) werror="no" 96785aa5189Sbellard ;; 96863678e17SSteven Noonan --enable-stack-protector) stack_protector="yes" 96963678e17SSteven Noonan ;; 97063678e17SSteven Noonan --disable-stack-protector) stack_protector="no" 97163678e17SSteven Noonan ;; 9724d3b6f6eSbalrog --disable-curses) curses="no" 9734d3b6f6eSbalrog ;; 974c584a6d0SJuan Quintela --enable-curses) curses="yes" 975c584a6d0SJuan Quintela ;; 976769ce76dSAlexander Graf --disable-curl) curl="no" 977769ce76dSAlexander Graf ;; 978788c8196SJuan Quintela --enable-curl) curl="yes" 979788c8196SJuan Quintela ;; 9802df87df7SJuan Quintela --disable-fdt) fdt="no" 9812df87df7SJuan Quintela ;; 9822df87df7SJuan Quintela --enable-fdt) fdt="yes" 9832df87df7SJuan Quintela ;; 9845c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 9855c6c3a6cSChristoph Hellwig ;; 9865c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 9875c6c3a6cSChristoph Hellwig ;; 988758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 989758e8e38SVenkateswararao Jujjuri (JV) ;; 990758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 991758e8e38SVenkateswararao Jujjuri (JV) ;; 99277755340Sths --disable-blobs) blobs="no" 99377755340Sths ;; 9944a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 9954a19f1ecSpbrook ;; 996519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 997519175a2SAlex Barcelo ;; 99870c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 99970c60c08SStefan Hajnoczi ;; 100070c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 100170c60c08SStefan Hajnoczi ;; 1002a25dba17SJuan Quintela --disable-docs) docs="no" 100370ec5dc0SAnthony Liguori ;; 1004a25dba17SJuan Quintela --enable-docs) docs="yes" 100583a3ab8bSJuan Quintela ;; 1006d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 1007d5970055SMichael S. Tsirkin ;; 1008d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 1009d5970055SMichael S. Tsirkin ;; 10105e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 10115e9be92dSNicholas Bellinger ;; 10125e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 10135e9be92dSNicholas Bellinger ;; 1014da076ffeSGerd Hoffmann --disable-opengl) opengl="no" 101520ff075bSMichael Walle ;; 1016da076ffeSGerd Hoffmann --enable-opengl) opengl="yes" 101720ff075bSMichael Walle ;; 1018f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 1019f27aaf4bSChristian Brunner ;; 1020f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 1021f27aaf4bSChristian Brunner ;; 10228c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 10238c84cf11SSergei Trofimovich ;; 10248c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 10258c84cf11SSergei Trofimovich ;; 10267b02f544SMarc-André Lureau --disable-smartcard) smartcard="no" 1027111a38b0SRobert Relyea ;; 10287b02f544SMarc-André Lureau --enable-smartcard) smartcard="yes" 1029111a38b0SRobert Relyea ;; 10302b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 10312b2325ffSGerd Hoffmann ;; 10322b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 10332b2325ffSGerd Hoffmann ;; 103469354a83SHans de Goede --disable-usb-redir) usb_redir="no" 103569354a83SHans de Goede ;; 103669354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 103769354a83SHans de Goede ;; 10381ece9905SAlon Levy --disable-zlib-test) zlib="no" 10391ece9905SAlon Levy ;; 1040b25c9dffSStefan Weil --disable-lzo) lzo="no" 1041b25c9dffSStefan Weil ;; 1042607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1043607dacd0Sqiaonuohan ;; 1044b25c9dffSStefan Weil --disable-snappy) snappy="no" 1045b25c9dffSStefan Weil ;; 1046607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1047607dacd0Sqiaonuohan ;; 10486b383c08SPeter Wu --disable-bzip2) bzip2="no" 10496b383c08SPeter Wu ;; 10506b383c08SPeter Wu --enable-bzip2) bzip2="yes" 10516b383c08SPeter Wu ;; 1052d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1053d138cee9SMichael Roth ;; 1054d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1055d138cee9SMichael Roth ;; 10569dacf32dSYossi Hindin --enable-guest-agent-msi) guest_agent_msi="yes" 10579dacf32dSYossi Hindin ;; 10589dacf32dSYossi Hindin --disable-guest-agent-msi) guest_agent_msi="no" 10599dacf32dSYossi Hindin ;; 1060d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1061d9840e25STomoki Sekiyama ;; 1062d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1063d9840e25STomoki Sekiyama ;; 1064d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1065d9840e25STomoki Sekiyama ;; 1066d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1067d9840e25STomoki Sekiyama ;; 1068d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1069d9840e25STomoki Sekiyama ;; 1070d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1071d9840e25STomoki Sekiyama ;; 10724b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 10734b1c11fdSDaniel P. Berrange ;; 10744b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 10754b1c11fdSDaniel P. Berrange ;; 1076f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1077f794573eSEduardo Otubo ;; 1078f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1079f794573eSEduardo Otubo ;; 1080eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1081eb100396SBharata B Rao ;; 1082eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1083eb100396SBharata B Rao ;; 1084c9a12e75SChrysostomos Nanakos --disable-archipelago) archipelago="no" 1085c9a12e75SChrysostomos Nanakos ;; 1086c9a12e75SChrysostomos Nanakos --enable-archipelago) archipelago="yes" 1087c9a12e75SChrysostomos Nanakos ;; 108852b53c04SFam Zheng --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) 108952b53c04SFam Zheng echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 1090583f6e7bSStefan Hajnoczi ;; 1091a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1092a4ccabcfSAnthony Liguori ;; 1093a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1094a4ccabcfSAnthony Liguori ;; 1095ddbb0d09SDaniel P. Berrange --disable-gnutls) gnutls="no" 1096ddbb0d09SDaniel P. Berrange ;; 1097ddbb0d09SDaniel P. Berrange --enable-gnutls) gnutls="yes" 1098ddbb0d09SDaniel P. Berrange ;; 109991bfcdb0SDaniel P. Berrange --disable-nettle) nettle="no" 110091bfcdb0SDaniel P. Berrange ;; 110191bfcdb0SDaniel P. Berrange --enable-nettle) nettle="yes" 110291bfcdb0SDaniel P. Berrange ;; 110391bfcdb0SDaniel P. Berrange --disable-gcrypt) gcrypt="no" 110491bfcdb0SDaniel P. Berrange ;; 110591bfcdb0SDaniel P. Berrange --enable-gcrypt) gcrypt="yes" 110691bfcdb0SDaniel P. Berrange ;; 11072da776dbSMichael R. Hines --enable-rdma) rdma="yes" 11082da776dbSMichael R. Hines ;; 11092da776dbSMichael R. Hines --disable-rdma) rdma="no" 11102da776dbSMichael R. Hines ;; 1111528de90aSDaniel P. Berrange --with-gtkabi=*) gtkabi="$optarg" 1112528de90aSDaniel P. Berrange ;; 1113bbbf9bfbSStefan Weil --disable-vte) vte="no" 1114bbbf9bfbSStefan Weil ;; 1115bbbf9bfbSStefan Weil --enable-vte) vte="yes" 1116bbbf9bfbSStefan Weil ;; 11179d9e1521SGerd Hoffmann --disable-virglrenderer) virglrenderer="no" 11189d9e1521SGerd Hoffmann ;; 11199d9e1521SGerd Hoffmann --enable-virglrenderer) virglrenderer="yes" 11209d9e1521SGerd Hoffmann ;; 1121e91c793cSCole Robinson --disable-tpm) tpm="no" 1122e91c793cSCole Robinson ;; 1123ab214c29SStefan Berger --enable-tpm) tpm="yes" 1124ab214c29SStefan Berger ;; 11250a12ec87SRichard W.M. Jones --disable-libssh2) libssh2="no" 11260a12ec87SRichard W.M. Jones ;; 11270a12ec87SRichard W.M. Jones --enable-libssh2) libssh2="yes" 11280a12ec87SRichard W.M. Jones ;; 11294f18b782SJeff Cody --enable-vhdx) vhdx="yes" 11304f18b782SJeff Cody ;; 11314f18b782SJeff Cody --disable-vhdx) vhdx="no" 11324f18b782SJeff Cody ;; 1133a99d57bbSWanlong Gao --disable-numa) numa="no" 1134a99d57bbSWanlong Gao ;; 1135a99d57bbSWanlong Gao --enable-numa) numa="yes" 1136a99d57bbSWanlong Gao ;; 11372847b469SFam Zheng --disable-tcmalloc) tcmalloc="no" 11382847b469SFam Zheng ;; 11392847b469SFam Zheng --enable-tcmalloc) tcmalloc="yes" 11402847b469SFam Zheng ;; 11417b01cb97SAlexandre Derumier --disable-jemalloc) jemalloc="no" 11427b01cb97SAlexandre Derumier ;; 11437b01cb97SAlexandre Derumier --enable-jemalloc) jemalloc="yes" 11447b01cb97SAlexandre Derumier ;; 11452d2ad6d0SFam Zheng *) 11462d2ad6d0SFam Zheng echo "ERROR: unknown option $opt" 11472d2ad6d0SFam Zheng echo "Try '$0 --help' for more information" 11482d2ad6d0SFam Zheng exit 1 11497f1559c6Sbalrog ;; 11507d13299dSbellard esac 11517d13299dSbellarddone 11527d13299dSbellard 1153f6f0b7d9SStefan Weilif ! has $python; then 1154f6f0b7d9SStefan Weil error_exit "Python not found. Use --python=/path/to/python" 1155f6f0b7d9SStefan Weilfi 1156f6f0b7d9SStefan Weil 1157f6f0b7d9SStefan Weil# Note that if the Python conditional here evaluates True we will exit 1158f6f0b7d9SStefan Weil# with status 1 which is a shell 'false' value. 1159fec21036SMarkus Armbrusterif ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then 1160fec21036SMarkus Armbruster error_exit "Cannot use '$python', Python 2.6 or later is required." \ 1161f6f0b7d9SStefan Weil "Note that Python 3 or later is not yet supported." \ 1162f6f0b7d9SStefan Weil "Use --python=/path/to/python to specify a supported Python." 1163f6f0b7d9SStefan Weilfi 1164f6f0b7d9SStefan Weil 1165fec21036SMarkus Armbruster# Suppress writing compiled files 1166f6f0b7d9SStefan Weilpython="$python -B" 1167f6f0b7d9SStefan Weil 116840293e58Sbellardcase "$cpu" in 1169e3608d66SRichard Henderson ppc) 1170e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1171e3608d66SRichard Henderson LDFLAGS="-m32 $LDFLAGS" 1172e3608d66SRichard Henderson ;; 1173e3608d66SRichard Henderson ppc64) 1174e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1175e3608d66SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 1176e3608d66SRichard Henderson ;; 11779b9c37c3SRichard Henderson sparc) 11780c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 117979f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32 -mcpu=ultrasparc" 11803142255cSblueswir1 ;; 1181ed968ff1SJuan Quintela sparc64) 11820c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 118379f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 11843142255cSblueswir1 ;; 118576d83bdeSths s390) 1186061cdd81SRichard Henderson CPU_CFLAGS="-m31" 118728d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 118828d7cc49SRichard Henderson ;; 118928d7cc49SRichard Henderson s390x) 1190061cdd81SRichard Henderson CPU_CFLAGS="-m64" 119128d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 119276d83bdeSths ;; 119340293e58Sbellard i386) 119479f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 11950c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 11962b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 119740293e58Sbellard ;; 119840293e58Sbellard x86_64) 119979f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64" 12000c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 12012b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 1202379f6698SPaul Brook ;; 1203c72b26ecSRichard Henderson x32) 1204c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1205c72b26ecSRichard Henderson LDFLAGS="-mx32 $LDFLAGS" 1206c72b26ecSRichard Henderson cc_i386='$(CC) -m32' 1207c72b26ecSRichard Henderson ;; 120830163d89SPeter Maydell # No special flags required for other host CPUs 12093142255cSblueswir1esac 12103142255cSblueswir1 121179f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 121279f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS" 121379f3b12fSPeter Crosthwaite 121460e0df25SPeter Maydelldefault_target_list="" 121560e0df25SPeter Maydell 12166e92f823SPeter Maydellmak_wilds="" 12176e92f823SPeter Maydell 121860e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 12196e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 122060e0df25SPeter Maydellfi 122160e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 12226e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 122360e0df25SPeter Maydellfi 122460e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 12256e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 122660e0df25SPeter Maydellfi 122760e0df25SPeter Maydell 12286e92f823SPeter Maydellfor config in $mak_wilds; do 12296e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 12306e92f823SPeter Maydelldone 12316e92f823SPeter Maydell 1232af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1233af5db58eSpbrookcat << EOF 1234af5db58eSpbrook 1235af5db58eSpbrookUsage: configure [options] 1236af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1237af5db58eSpbrook 123808fb77edSStefan WeilStandard options: 123908fb77edSStefan Weil --help print this message 124008fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 124108fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 124208fb77edSStefan Weil use %M for cpu name [$interp_prefix] 124308fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 124408fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 124508fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 124608fb77edSStefan Weil 124708fb77edSStefan WeilAdvanced options (experts only): 124808fb77edSStefan Weil --source-path=PATH path of source code [$source_path] 124908fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 125008fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 125108fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 125208fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 125308fb77edSStefan Weil build time 125408fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 125508fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 125608fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 125708fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 125808fb77edSStefan Weil --make=MAKE use specified make [$make] 125908fb77edSStefan Weil --install=INSTALL use specified install [$install] 126008fb77edSStefan Weil --python=PYTHON use specified python [$python] 126108fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 126208fb77edSStefan Weil --static enable static build [$static] 126308fb77edSStefan Weil --mandir=PATH install man pages in PATH 126408fb77edSStefan Weil --datadir=PATH install firmware in PATH$confsuffix 126508fb77edSStefan Weil --docdir=PATH install documentation in PATH$confsuffix 126608fb77edSStefan Weil --bindir=PATH install binaries in PATH 126708fb77edSStefan Weil --libdir=PATH install libraries in PATH 126808fb77edSStefan Weil --sysconfdir=PATH install config in PATH$confsuffix 126908fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 1270e26110cfSFam Zheng --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 127108fb77edSStefan Weil --enable-debug enable common debug build options 127208fb77edSStefan Weil --disable-strip disable stripping binaries 127308fb77edSStefan Weil --disable-werror disable compilation abort on warning 127463678e17SSteven Noonan --disable-stack-protector disable compiler-provided stack protection 127508fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 127608fb77edSStefan Weil Available drivers: $audio_possible_drivers 127708fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 127808fb77edSStefan Weil --block-drv-rw-whitelist=L 127908fb77edSStefan Weil set block driver read-write whitelist 128008fb77edSStefan Weil (affects only QEMU, not qemu-img) 128108fb77edSStefan Weil --block-drv-ro-whitelist=L 128208fb77edSStefan Weil set block driver read-only whitelist 128308fb77edSStefan Weil (affects only QEMU, not qemu-img) 12845b808275SLluís Vilanova --enable-trace-backends=B Set trace backend 128508fb77edSStefan Weil Available backends: $($python $source_path/scripts/tracetool.py --list-backends) 128608fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 128708fb77edSStefan Weil Default:trace-<pid> 1288c23f23b9SMichael Tokarev --disable-slirp disable SLIRP userspace network connectivity 1289c23f23b9SMichael Tokarev --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 1290c23f23b9SMichael Tokarev --oss-lib path to OSS library 1291c23f23b9SMichael Tokarev --cpu=CPU Build for host CPU [$cpu] 129208fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 129308fb77edSStefan Weil gthread, ucontext, sigaltstack, windows 129408fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 129508fb77edSStefan Weil --gcov=GCOV use specified gcov [$gcov_tool] 1296c23f23b9SMichael Tokarev --disable-blobs disable installing provided firmware blobs 1297c23f23b9SMichael Tokarev --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 1298c23f23b9SMichael Tokarev --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 1299c23f23b9SMichael Tokarev 1300c23f23b9SMichael TokarevOptional features, enabled with --enable-FEATURE and 1301c23f23b9SMichael Tokarevdisabled with --disable-FEATURE, default is enabled if available: 1302c23f23b9SMichael Tokarev 1303c23f23b9SMichael Tokarev system all system emulation targets 1304c23f23b9SMichael Tokarev user supported user emulation targets 1305c23f23b9SMichael Tokarev linux-user all linux usermode emulation targets 1306c23f23b9SMichael Tokarev bsd-user all BSD usermode emulation targets 1307c23f23b9SMichael Tokarev docs build documentation 1308c23f23b9SMichael Tokarev guest-agent build the QEMU Guest Agent 1309c23f23b9SMichael Tokarev guest-agent-msi build guest agent Windows MSI installation package 1310c23f23b9SMichael Tokarev pie Position Independent Executables 1311c23f23b9SMichael Tokarev modules modules support 1312c23f23b9SMichael Tokarev debug-tcg TCG debugging (default is disabled) 1313c23f23b9SMichael Tokarev debug-info debugging information 1314c23f23b9SMichael Tokarev sparse sparse checker 1315c23f23b9SMichael Tokarev 1316ddbb0d09SDaniel P. Berrange gnutls GNUTLS cryptography support 131791bfcdb0SDaniel P. Berrange nettle nettle cryptography support 131891bfcdb0SDaniel P. Berrange gcrypt libgcrypt cryptography support 1319c23f23b9SMichael Tokarev sdl SDL UI 1320c23f23b9SMichael Tokarev --with-sdlabi select preferred SDL ABI 1.2 or 2.0 1321c23f23b9SMichael Tokarev gtk gtk UI 1322c23f23b9SMichael Tokarev --with-gtkabi select preferred GTK ABI 2.0 or 3.0 1323c23f23b9SMichael Tokarev vte vte support for the gtk UI 1324c23f23b9SMichael Tokarev curses curses UI 1325c23f23b9SMichael Tokarev vnc VNC UI support 1326c23f23b9SMichael Tokarev vnc-sasl SASL encryption for VNC server 1327c23f23b9SMichael Tokarev vnc-jpeg JPEG lossy compression for VNC server 1328c23f23b9SMichael Tokarev vnc-png PNG compression for VNC server 1329c23f23b9SMichael Tokarev cocoa Cocoa UI (Mac OS X only) 1330c23f23b9SMichael Tokarev virtfs VirtFS 1331c23f23b9SMichael Tokarev xen xen backend driver support 1332c23f23b9SMichael Tokarev xen-pci-passthrough 1333c23f23b9SMichael Tokarev brlapi BrlAPI (Braile) 1334c23f23b9SMichael Tokarev curl curl connectivity 1335c23f23b9SMichael Tokarev fdt fdt device tree 1336c23f23b9SMichael Tokarev bluez bluez stack connectivity 1337c23f23b9SMichael Tokarev kvm KVM acceleration support 1338c23f23b9SMichael Tokarev rdma RDMA-based migration support 1339c23f23b9SMichael Tokarev uuid uuid support 1340c23f23b9SMichael Tokarev vde support for vde network 1341c23f23b9SMichael Tokarev netmap support for netmap network 1342c23f23b9SMichael Tokarev linux-aio Linux AIO support 1343c23f23b9SMichael Tokarev cap-ng libcap-ng support 1344c23f23b9SMichael Tokarev attr attr and xattr support 1345c23f23b9SMichael Tokarev vhost-net vhost-net acceleration support 1346c23f23b9SMichael Tokarev spice spice 1347c23f23b9SMichael Tokarev rbd rados block device (rbd) 1348c23f23b9SMichael Tokarev libiscsi iscsi support 1349c23f23b9SMichael Tokarev libnfs nfs support 13507b02f544SMarc-André Lureau smartcard smartcard support (libcacard) 1351c23f23b9SMichael Tokarev libusb libusb (for usb passthrough) 1352c23f23b9SMichael Tokarev usb-redir usb network redirection support 1353c23f23b9SMichael Tokarev lzo support of lzo compression library 1354c23f23b9SMichael Tokarev snappy support of snappy compression library 1355c23f23b9SMichael Tokarev bzip2 support of bzip2 compression library 1356c23f23b9SMichael Tokarev (for reading bzip2-compressed dmg images) 1357c23f23b9SMichael Tokarev seccomp seccomp support 1358c23f23b9SMichael Tokarev coroutine-pool coroutine freelist (better performance) 1359c23f23b9SMichael Tokarev glusterfs GlusterFS backend 1360c23f23b9SMichael Tokarev archipelago Archipelago backend 1361c23f23b9SMichael Tokarev tpm TPM support 1362c23f23b9SMichael Tokarev libssh2 ssh block device support 1363c23f23b9SMichael Tokarev vhdx support for the Microsoft VHDX image format 1364c23f23b9SMichael Tokarev numa libnuma support 1365c23f23b9SMichael Tokarev tcmalloc tcmalloc support 13667b01cb97SAlexandre Derumier jemalloc jemalloc support 136708fb77edSStefan Weil 136808fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1369af5db58eSpbrookEOF 13702d2ad6d0SFam Zhengexit 0 1371af5db58eSpbrookfi 1372af5db58eSpbrook 1373359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1374359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1375359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1376359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1377359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1378359bc95dSPeter Maydell ARCH=tci 1379359bc95dSPeter Maydell else 138076ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1381359bc95dSPeter Maydell fi 1382359bc95dSPeter Maydellfi 1383359bc95dSPeter Maydell 13849c83ffd8SPeter Maydell# Consult white-list to determine whether to enable werror 13859c83ffd8SPeter Maydell# by default. Only enable by default for git builds 13869c83ffd8SPeter Maydellz_version=`cut -f3 -d. $source_path/VERSION` 13879c83ffd8SPeter Maydell 13889c83ffd8SPeter Maydellif test -z "$werror" ; then 13899c83ffd8SPeter Maydell if test -d "$source_path/.git" -a \ 13909c83ffd8SPeter Maydell "$linux" = "yes" ; then 13919c83ffd8SPeter Maydell werror="yes" 13929c83ffd8SPeter Maydell else 13939c83ffd8SPeter Maydell werror="no" 13949c83ffd8SPeter Maydell fi 13959c83ffd8SPeter Maydellfi 13969c83ffd8SPeter Maydell 13978d05095cSPaolo Bonzini# check that the C compiler works. 139893b25869SJohn Snowwrite_c_skeleton; 13998d05095cSPaolo Bonziniif compile_object ; then 14008d05095cSPaolo Bonzini : C compiler works ok 14018d05095cSPaolo Bonzinielse 140276ad07a4SPeter Maydell error_exit "\"$cc\" either does not exist or does not work" 14038d05095cSPaolo Bonzinifi 14040ef74c74SPeter Maydellif ! compile_prog ; then 14050ef74c74SPeter Maydell error_exit "\"$cc\" cannot build an executable (is your linker broken?)" 14060ef74c74SPeter Maydellfi 14078d05095cSPaolo Bonzini 140898b21dcdSPeter Maydell# Check that the C++ compiler exists and works with the C compiler 140998b21dcdSPeter Maydellif has $cxx; then 141098b21dcdSPeter Maydell cat > $TMPC <<EOF 141198b21dcdSPeter Maydellint c_function(void); 141298b21dcdSPeter Maydellint main(void) { return c_function(); } 141398b21dcdSPeter MaydellEOF 141498b21dcdSPeter Maydell 141598b21dcdSPeter Maydell compile_object 141698b21dcdSPeter Maydell 14179c83ffd8SPeter Maydell cat > $TMPCXX <<EOF 141898b21dcdSPeter Maydellextern "C" { 141998b21dcdSPeter Maydell int c_function(void); 142098b21dcdSPeter Maydell} 142198b21dcdSPeter Maydellint c_function(void) { return 42; } 142298b21dcdSPeter MaydellEOF 142398b21dcdSPeter Maydell 14249c83ffd8SPeter Maydell update_cxxflags 14259c83ffd8SPeter Maydell 14269c83ffd8SPeter Maydell if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then 142798b21dcdSPeter Maydell # C++ compiler $cxx works ok with C compiler $cc 142898b21dcdSPeter Maydell : 142998b21dcdSPeter Maydell else 143098b21dcdSPeter Maydell echo "C++ compiler $cxx does not work with C compiler $cc" 143198b21dcdSPeter Maydell echo "Disabling C++ specific optional code" 143298b21dcdSPeter Maydell cxx= 143398b21dcdSPeter Maydell fi 143498b21dcdSPeter Maydellelse 143598b21dcdSPeter Maydell echo "No C++ compiler available; disabling C++ specific optional code" 143698b21dcdSPeter Maydell cxx= 143798b21dcdSPeter Maydellfi 143898b21dcdSPeter Maydell 14398d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 14408d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 14418d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 144237746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags" 1443c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags" 144471429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags" 14456ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 14466ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 14476ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 14486ca026cbSPeter Maydell# so it's too error prone. 144993b25869SJohn Snow 145093b25869SJohn Snowcc_has_warning_flag() { 145193b25869SJohn Snow write_c_skeleton; 145293b25869SJohn Snow 1453a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1454a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1455a1d29d6cSPeter Maydell # warning options). 145693b25869SJohn Snow optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" 145793b25869SJohn Snow compile_prog "-Werror $optflag" "" 145893b25869SJohn Snow} 145993b25869SJohn Snow 146093b25869SJohn Snowfor flag in $gcc_flags; do 146193b25869SJohn Snow if cc_has_warning_flag $flag ; then 14628d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 14638d05095cSPaolo Bonzini fi 14648d05095cSPaolo Bonzinidone 14658d05095cSPaolo Bonzini 146663678e17SSteven Noonanif test "$stack_protector" != "no"; then 1467fccd35a0SRodrigo Rebello cat > $TMPC << EOF 1468fccd35a0SRodrigo Rebelloint main(int argc, char *argv[]) 1469fccd35a0SRodrigo Rebello{ 1470fccd35a0SRodrigo Rebello char arr[64], *p = arr, *c = argv[0]; 1471fccd35a0SRodrigo Rebello while (*c) { 1472fccd35a0SRodrigo Rebello *p++ = *c++; 1473fccd35a0SRodrigo Rebello } 1474fccd35a0SRodrigo Rebello return 0; 1475fccd35a0SRodrigo Rebello} 1476fccd35a0SRodrigo RebelloEOF 147763678e17SSteven Noonan gcc_flags="-fstack-protector-strong -fstack-protector-all" 14783b463a3fSMiroslav Rezanina sp_on=0 147963678e17SSteven Noonan for flag in $gcc_flags; do 1480590e5dd9SPeter Maydell # We need to check both a compile and a link, since some compiler 1481590e5dd9SPeter Maydell # setups fail only on a .c->.o compile and some only at link time 1482590e5dd9SPeter Maydell if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC && 1483590e5dd9SPeter Maydell compile_prog "-Werror $flag" ""; then 148463678e17SSteven Noonan QEMU_CFLAGS="$QEMU_CFLAGS $flag" 14853b463a3fSMiroslav Rezanina sp_on=1 148663678e17SSteven Noonan break 148763678e17SSteven Noonan fi 148863678e17SSteven Noonan done 14893b463a3fSMiroslav Rezanina if test "$stack_protector" = yes; then 14903b463a3fSMiroslav Rezanina if test $sp_on = 0; then 14913b463a3fSMiroslav Rezanina error_exit "Stack protector not supported" 14923b463a3fSMiroslav Rezanina fi 14933b463a3fSMiroslav Rezanina fi 149437746c5eSMarc-André Lureaufi 149537746c5eSMarc-André Lureau 1496cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1497cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1498cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1499cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1500cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1501cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1502cbdd1999SPaolo Bonziniint main(void) { return 0; } 1503cbdd1999SPaolo Bonzini#else 1504cbdd1999SPaolo Bonzini#error No bug in this compiler. 1505cbdd1999SPaolo Bonzini#endif 1506cbdd1999SPaolo BonziniEOF 1507cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1508cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1509cbdd1999SPaolo Bonzinifi 1510cbdd1999SPaolo Bonzini 151140d6444eSAvi Kivityif test "$static" = "yes" ; then 1512aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1513aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1514aa0d1f44SPaolo Bonzini fi 151540d6444eSAvi Kivity if test "$pie" = "yes" ; then 151676ad07a4SPeter Maydell error_exit "static and pie are mutually incompatible" 151740d6444eSAvi Kivity else 151840d6444eSAvi Kivity pie="no" 151940d6444eSAvi Kivity fi 152040d6444eSAvi Kivityfi 152140d6444eSAvi Kivity 1522768b7855SEmilio G. Cota# Unconditional check for compiler __thread support 1523768b7855SEmilio G. Cota cat > $TMPC << EOF 1524768b7855SEmilio G. Cotastatic __thread int tls_var; 1525768b7855SEmilio G. Cotaint main(void) { return tls_var; } 1526768b7855SEmilio G. CotaEOF 1527768b7855SEmilio G. Cota 1528768b7855SEmilio G. Cotaif ! compile_prog "-Werror" "" ; then 1529768b7855SEmilio G. Cota error_exit "Your compiler does not support the __thread specifier for " \ 1530768b7855SEmilio G. Cota "Thread-Local Storage (TLS). Please upgrade to a version that does." 1531768b7855SEmilio G. Cotafi 1532768b7855SEmilio G. Cota 153340d6444eSAvi Kivityif test "$pie" = ""; then 153440d6444eSAvi Kivity case "$cpu-$targetos" in 1535c72b26ecSRichard Henderson i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) 153640d6444eSAvi Kivity ;; 153740d6444eSAvi Kivity *) 153840d6444eSAvi Kivity pie="no" 153940d6444eSAvi Kivity ;; 154040d6444eSAvi Kivity esac 154140d6444eSAvi Kivityfi 154240d6444eSAvi Kivity 154340d6444eSAvi Kivityif test "$pie" != "no" ; then 154440d6444eSAvi Kivity cat > $TMPC << EOF 154521d4a791SAvi Kivity 154621d4a791SAvi Kivity#ifdef __linux__ 154721d4a791SAvi Kivity# define THREAD __thread 154821d4a791SAvi Kivity#else 154921d4a791SAvi Kivity# define THREAD 155021d4a791SAvi Kivity#endif 155121d4a791SAvi Kivity 155221d4a791SAvi Kivitystatic THREAD int tls_var; 155321d4a791SAvi Kivity 155421d4a791SAvi Kivityint main(void) { return tls_var; } 155521d4a791SAvi Kivity 155640d6444eSAvi KivityEOF 155740d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 155840d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 155940d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 156040d6444eSAvi Kivity pie="yes" 156140d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 156240d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 156340d6444eSAvi Kivity fi 156440d6444eSAvi Kivity else 156540d6444eSAvi Kivity if test "$pie" = "yes"; then 156676ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 156740d6444eSAvi Kivity else 156840d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 156940d6444eSAvi Kivity pie="no" 157040d6444eSAvi Kivity fi 157140d6444eSAvi Kivity fi 157246eef33bSBrad 1573e4a7b344SStefan Hajnoczi if compile_prog "-Werror -fno-pie" "-nopie"; then 157446eef33bSBrad CFLAGS_NOPIE="-fno-pie" 157546eef33bSBrad LDFLAGS_NOPIE="-nopie" 157646eef33bSBrad fi 157740d6444eSAvi Kivityfi 157840d6444eSAvi Kivity 157909dada40SPaolo Bonzini########################################## 158009dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 158109dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 158209dada40SPaolo Bonzini# specification is necessary 158309dada40SPaolo Bonzini 158409dada40SPaolo Bonziniif test "$cpu" = "i386"; then 158509dada40SPaolo Bonzini cat > $TMPC << EOF 158609dada40SPaolo Bonzinistatic int sfaa(int *ptr) 158709dada40SPaolo Bonzini{ 158809dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 158909dada40SPaolo Bonzini} 159009dada40SPaolo Bonzini 159109dada40SPaolo Bonziniint main(void) 159209dada40SPaolo Bonzini{ 159309dada40SPaolo Bonzini int val = 42; 15941405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 159509dada40SPaolo Bonzini sfaa(&val); 159609dada40SPaolo Bonzini return val; 159709dada40SPaolo Bonzini} 159809dada40SPaolo BonziniEOF 159909dada40SPaolo Bonzini if ! compile_prog "" "" ; then 160009dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 160109dada40SPaolo Bonzini fi 160209dada40SPaolo Bonzinifi 160309dada40SPaolo Bonzini 160409dada40SPaolo Bonzini######################################### 1605ec530c81Sbellard# Solaris specific configure tool chain decisions 160609dada40SPaolo Bonzini 1607ec530c81Sbellardif test "$solaris" = "yes" ; then 16086792aa11SLoïc Minier if has $install; then 16096792aa11SLoïc Minier : 16106792aa11SLoïc Minier else 161176ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 161276ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 161376ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1614ec530c81Sbellard fi 16156792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 161676ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 161776ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 161876ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1619ec530c81Sbellard fi 16206792aa11SLoïc Minier if has ar; then 16216792aa11SLoïc Minier : 16226792aa11SLoïc Minier else 1623ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 162476ad07a4SPeter Maydell error_exit "No path includes ar" \ 162576ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 1626ec530c81Sbellard fi 162776ad07a4SPeter Maydell error_exit "No path includes ar" 1628ec530c81Sbellard fi 1629ec530c81Sbellardfi 1630ec530c81Sbellard 1631afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1632121afa9eSAnthony Liguori target_list="$default_target_list" 1633121afa9eSAnthony Liguorielse 1634121afa9eSAnthony Liguori target_list=`echo "$target_list" | sed -e 's/,/ /g'` 16355327cf48Sbellardfi 163625b48338SPeter Maydell 163725b48338SPeter Maydell# Check that we recognised the target name; this allows a more 163825b48338SPeter Maydell# friendly error message than if we let it fall through. 163925b48338SPeter Maydellfor target in $target_list; do 164025b48338SPeter Maydell case " $default_target_list " in 164125b48338SPeter Maydell *" $target "*) 164225b48338SPeter Maydell ;; 164325b48338SPeter Maydell *) 164425b48338SPeter Maydell error_exit "Unknown target name '$target'" 164525b48338SPeter Maydell ;; 164625b48338SPeter Maydell esac 164725b48338SPeter Maydelldone 164825b48338SPeter Maydell 1649f55fe278SPaolo Bonzini# see if system emulation was really requested 1650f55fe278SPaolo Bonzinicase " $target_list " in 1651f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1652f55fe278SPaolo Bonzini ;; 1653f55fe278SPaolo Bonzini *) softmmu=no 1654f55fe278SPaolo Bonzini ;; 1655f55fe278SPaolo Bonziniesac 16565327cf48Sbellard 1657249247c9SJuan Quintelafeature_not_found() { 1658249247c9SJuan Quintela feature=$1 165921684af0SStewart Smith remedy=$2 1660249247c9SJuan Quintela 166176ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 166221684af0SStewart Smith "configure was not able to find it." \ 166321684af0SStewart Smith "$remedy" 1664249247c9SJuan Quintela} 1665249247c9SJuan Quintela 16667d13299dSbellard# --- 16677d13299dSbellard# big/little endian test 16687d13299dSbellardcat > $TMPC << EOF 166961cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 167061cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 167161cc919fSMike Frysingerextern int foo(short *, short *); 167261cc919fSMike Frysingerint main(int argc, char *argv[]) { 167361cc919fSMike Frysinger return foo(big_endian, little_endian); 16747d13299dSbellard} 16757d13299dSbellardEOF 16767d13299dSbellard 167761cc919fSMike Frysingerif compile_object ; then 167861cc919fSMike Frysinger if grep -q BiGeNdIaN $TMPO ; then 167961cc919fSMike Frysinger bigendian="yes" 168061cc919fSMike Frysinger elif grep -q LiTtLeEnDiAn $TMPO ; then 168161cc919fSMike Frysinger bigendian="no" 16827d13299dSbellard else 16837d13299dSbellard echo big/little test failed 16847d13299dSbellard fi 16857d13299dSbellardelse 168661cc919fSMike Frysinger echo big/little test failed 16877d13299dSbellardfi 16887d13299dSbellard 1689b0a47e79SJuan Quintela########################################## 1690a30878e7SPeter Maydell# cocoa implies not SDL or GTK 1691a30878e7SPeter Maydell# (the cocoa UI code currently assumes it is always the active UI 1692a30878e7SPeter Maydell# and doesn't interact well with other UI frontend code) 1693a30878e7SPeter Maydellif test "$cocoa" = "yes"; then 1694a30878e7SPeter Maydell if test "$sdl" = "yes"; then 1695a30878e7SPeter Maydell error_exit "Cocoa and SDL UIs cannot both be enabled at once" 1696a30878e7SPeter Maydell fi 1697a30878e7SPeter Maydell if test "$gtk" = "yes"; then 1698a30878e7SPeter Maydell error_exit "Cocoa and GTK UIs cannot both be enabled at once" 1699a30878e7SPeter Maydell fi 1700a30878e7SPeter Maydell gtk=no 1701a30878e7SPeter Maydell sdl=no 1702a30878e7SPeter Maydellfi 1703a30878e7SPeter Maydell 1704a30878e7SPeter Maydell########################################## 1705015a33bdSGonglei# L2TPV3 probe 1706015a33bdSGonglei 1707015a33bdSGongleicat > $TMPC <<EOF 1708015a33bdSGonglei#include <sys/socket.h> 1709bff6cb72SMichael Tokarev#include <linux/ip.h> 1710015a33bdSGongleiint main(void) { return sizeof(struct mmsghdr); } 1711015a33bdSGongleiEOF 1712015a33bdSGongleiif compile_prog "" "" ; then 1713015a33bdSGonglei l2tpv3=yes 1714015a33bdSGongleielse 1715015a33bdSGonglei l2tpv3=no 1716015a33bdSGongleifi 1717015a33bdSGonglei 1718015a33bdSGonglei########################################## 17194d9310f4SDaniel P. Berrange# MinGW / Mingw-w64 localtime_r/gmtime_r check 17204d9310f4SDaniel P. Berrange 17214d9310f4SDaniel P. Berrangeif test "$mingw32" = "yes"; then 17224d9310f4SDaniel P. Berrange # Some versions of MinGW / Mingw-w64 lack localtime_r 17234d9310f4SDaniel P. Berrange # and gmtime_r entirely. 17244d9310f4SDaniel P. Berrange # 17254d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 define a macro for 17264d9310f4SDaniel P. Berrange # localtime_r/gmtime_r. 17274d9310f4SDaniel P. Berrange # 17284d9310f4SDaniel P. Berrange # Some versions of Mingw-w64 will define functions 17294d9310f4SDaniel P. Berrange # for localtime_r/gmtime_r, but only if you have 17304d9310f4SDaniel P. Berrange # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun 17314d9310f4SDaniel P. Berrange # though, unistd.h and pthread.h both define 17324d9310f4SDaniel P. Berrange # that for you. 17334d9310f4SDaniel P. Berrange # 17344d9310f4SDaniel P. Berrange # So this #undef localtime_r and #include <unistd.h> 17354d9310f4SDaniel P. Berrange # are not in fact redundant. 17364d9310f4SDaniel P. Berrangecat > $TMPC << EOF 17374d9310f4SDaniel P. Berrange#include <unistd.h> 17384d9310f4SDaniel P. Berrange#include <time.h> 17394d9310f4SDaniel P. Berrange#undef localtime_r 17404d9310f4SDaniel P. Berrangeint main(void) { localtime_r(NULL, NULL); return 0; } 17414d9310f4SDaniel P. BerrangeEOF 17424d9310f4SDaniel P. Berrange if compile_prog "" "" ; then 17434d9310f4SDaniel P. Berrange localtime_r="yes" 17444d9310f4SDaniel P. Berrange else 17454d9310f4SDaniel P. Berrange localtime_r="no" 17464d9310f4SDaniel P. Berrange fi 17474d9310f4SDaniel P. Berrangefi 17484d9310f4SDaniel P. Berrange 17494d9310f4SDaniel P. Berrange########################################## 1750779ab5e3SStefan Weil# pkg-config probe 1751779ab5e3SStefan Weil 1752779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 175376ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 1754779ab5e3SStefan Weilfi 1755779ab5e3SStefan Weil 1756779ab5e3SStefan Weil########################################## 1757b0a47e79SJuan Quintela# NPTL probe 1758b0a47e79SJuan Quintela 175924cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 1760bd0c5661Spbrook cat > $TMPC <<EOF 1761bd0c5661Spbrook#include <sched.h> 176230813ceaSpbrook#include <linux/futex.h> 1763182eacc0SStefan Weilint main(void) { 1764bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1765bd0c5661Spbrook#error bork 1766bd0c5661Spbrook#endif 1767182eacc0SStefan Weil return 0; 1768bd0c5661Spbrook} 1769bd0c5661SpbrookEOF 177024cb36a6SPeter Maydell if ! compile_object ; then 177121684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 1772b0a47e79SJuan Quintela fi 1773bd0c5661Spbrookfi 1774bd0c5661Spbrook 177511d9f695Sbellard########################################## 1776ac62922eSbalrog# zlib check 1777ac62922eSbalrog 17781ece9905SAlon Levyif test "$zlib" != "no" ; then 1779ac62922eSbalrog cat > $TMPC << EOF 1780ac62922eSbalrog#include <zlib.h> 1781ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1782ac62922eSbalrogEOF 178352166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1784ac62922eSbalrog : 1785ac62922eSbalrog else 178676ad07a4SPeter Maydell error_exit "zlib check failed" \ 178776ad07a4SPeter Maydell "Make sure to have the zlib libs and headers installed." 1788ac62922eSbalrog fi 17891ece9905SAlon Levyfi 1790eb0ecd5aSWill NewtonLIBS="$LIBS -lz" 1791ac62922eSbalrog 1792ac62922eSbalrog########################################## 1793607dacd0Sqiaonuohan# lzo check 1794607dacd0Sqiaonuohan 1795607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 1796607dacd0Sqiaonuohan cat > $TMPC << EOF 1797607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 1798607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 1799607dacd0SqiaonuohanEOF 1800607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 1801607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -llzo2" 1802b25c9dffSStefan Weil lzo="yes" 1803b25c9dffSStefan Weil else 1804b25c9dffSStefan Weil if test "$lzo" = "yes"; then 1805b25c9dffSStefan Weil feature_not_found "liblzo2" "Install liblzo2 devel" 1806b25c9dffSStefan Weil fi 1807b25c9dffSStefan Weil lzo="no" 1808b25c9dffSStefan Weil fi 1809607dacd0Sqiaonuohanfi 1810607dacd0Sqiaonuohan 1811607dacd0Sqiaonuohan########################################## 1812607dacd0Sqiaonuohan# snappy check 1813607dacd0Sqiaonuohan 1814607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 1815607dacd0Sqiaonuohan cat > $TMPC << EOF 1816607dacd0Sqiaonuohan#include <snappy-c.h> 1817607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 1818607dacd0SqiaonuohanEOF 1819607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 1820607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -lsnappy" 1821b25c9dffSStefan Weil snappy="yes" 1822b25c9dffSStefan Weil else 1823b25c9dffSStefan Weil if test "$snappy" = "yes"; then 1824b25c9dffSStefan Weil feature_not_found "libsnappy" "Install libsnappy devel" 1825b25c9dffSStefan Weil fi 1826b25c9dffSStefan Weil snappy="no" 1827b25c9dffSStefan Weil fi 1828607dacd0Sqiaonuohanfi 1829607dacd0Sqiaonuohan 1830607dacd0Sqiaonuohan########################################## 18316b383c08SPeter Wu# bzip2 check 18326b383c08SPeter Wu 18336b383c08SPeter Wuif test "$bzip2" != "no" ; then 18346b383c08SPeter Wu cat > $TMPC << EOF 18356b383c08SPeter Wu#include <bzlib.h> 18366b383c08SPeter Wuint main(void) { BZ2_bzlibVersion(); return 0; } 18376b383c08SPeter WuEOF 18386b383c08SPeter Wu if compile_prog "" "-lbz2" ; then 18396b383c08SPeter Wu bzip2="yes" 18406b383c08SPeter Wu else 18416b383c08SPeter Wu if test "$bzip2" = "yes"; then 18426b383c08SPeter Wu feature_not_found "libbzip2" "Install libbzip2 devel" 18436b383c08SPeter Wu fi 18446b383c08SPeter Wu bzip2="no" 18456b383c08SPeter Wu fi 18466b383c08SPeter Wufi 18476b383c08SPeter Wu 18486b383c08SPeter Wu########################################## 1849f794573eSEduardo Otubo# libseccomp check 1850f794573eSEduardo Otubo 1851f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 1852693e5910SAndrew Jones case "$cpu" in 1853693e5910SAndrew Jones i386|x86_64) 1854ba060c53Sdann frazier libseccomp_minver="2.1.0" 1855693e5910SAndrew Jones ;; 1856693e5910SAndrew Jones arm|aarch64) 1857693e5910SAndrew Jones libseccomp_minver="2.2.3" 1858693e5910SAndrew Jones ;; 1859693e5910SAndrew Jones *) 1860693e5910SAndrew Jones libseccomp_minver="" 1861693e5910SAndrew Jones ;; 1862693e5910SAndrew Jones esac 1863693e5910SAndrew Jones 1864693e5910SAndrew Jones if test "$libseccomp_minver" != "" && 1865693e5910SAndrew Jones $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then 1866b4451996SMichael Tokarev libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`" 1867372e47e9SAndreas Färber QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`" 1868f794573eSEduardo Otubo seccomp="yes" 1869f794573eSEduardo Otubo else 1870f794573eSEduardo Otubo if test "$seccomp" = "yes" ; then 1871693e5910SAndrew Jones if test "$libseccomp_minver" != "" ; then 1872693e5910SAndrew Jones feature_not_found "libseccomp" \ 1873693e5910SAndrew Jones "Install libseccomp devel >= $libseccomp_minver" 1874693e5910SAndrew Jones else 1875693e5910SAndrew Jones feature_not_found "libseccomp" \ 1876693e5910SAndrew Jones "libseccomp is not supported for host cpu $cpu" 1877693e5910SAndrew Jones fi 1878896848f0SEduardo Otubo fi 1879e84d5956SYann E. MORIN seccomp="no" 1880f794573eSEduardo Otubo fi 1881f794573eSEduardo Otubofi 1882f794573eSEduardo Otubo########################################## 1883e37630caSaliguori# xen probe 1884e37630caSaliguori 1885fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1886b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 18875eeb39c2SIan Campbell xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn" 1888d5b93ddfSAnthony PERARD 188950ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 189050ced5b3SStefan Weil # If no, we are done and there is no Xen support. 189150ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 189250ced5b3SStefan Weil 189350ced5b3SStefan Weil # Xen (any) 189450ced5b3SStefan Weil cat > $TMPC <<EOF 189550ced5b3SStefan Weil#include <xenctrl.h> 189650ced5b3SStefan Weilint main(void) { 189750ced5b3SStefan Weil return 0; 189850ced5b3SStefan Weil} 189950ced5b3SStefan WeilEOF 190050ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 190150ced5b3SStefan Weil # Xen not found 190250ced5b3SStefan Weil if test "$xen" = "yes" ; then 190321684af0SStewart Smith feature_not_found "xen" "Install xen devel" 190450ced5b3SStefan Weil fi 190550ced5b3SStefan Weil xen=no 190650ced5b3SStefan Weil 1907d5b93ddfSAnthony PERARD # Xen unstable 190869deef08SPeter Maydell elif 190969deef08SPeter Maydell cat > $TMPC <<EOF && 19105eeb39c2SIan Campbell/* 19115eeb39c2SIan Campbell * If we have stable libs the we don't want the libxc compat 19125eeb39c2SIan Campbell * layers, regardless of what CFLAGS we may have been given. 19135eeb39c2SIan Campbell */ 19145eeb39c2SIan Campbell#undef XC_WANT_COMPAT_EVTCHN_API 19155eeb39c2SIan Campbell#undef XC_WANT_COMPAT_GNTTAB_API 19165eeb39c2SIan Campbell#undef XC_WANT_COMPAT_MAP_FOREIGN_API 19175eeb39c2SIan Campbell#include <xenctrl.h> 19185eeb39c2SIan Campbell#include <xenstore.h> 19195eeb39c2SIan Campbell#include <xenevtchn.h> 19205eeb39c2SIan Campbell#include <xengnttab.h> 19215eeb39c2SIan Campbell#include <xenforeignmemory.h> 19225eeb39c2SIan Campbell#include <stdint.h> 19235eeb39c2SIan Campbell#include <xen/hvm/hvm_info_table.h> 19245eeb39c2SIan Campbell#if !defined(HVM_MAX_VCPUS) 19255eeb39c2SIan Campbell# error HVM_MAX_VCPUS not defined 19265eeb39c2SIan Campbell#endif 19275eeb39c2SIan Campbellint main(void) { 19285eeb39c2SIan Campbell xc_interface *xc = NULL; 19295eeb39c2SIan Campbell xenforeignmemory_handle *xfmem; 19305eeb39c2SIan Campbell xenevtchn_handle *xe; 19315eeb39c2SIan Campbell xengnttab_handle *xg; 19325eeb39c2SIan Campbell xen_domain_handle_t handle; 19335eeb39c2SIan Campbell 19345eeb39c2SIan Campbell xs_daemon_open(); 19355eeb39c2SIan Campbell 19365eeb39c2SIan Campbell xc = xc_interface_open(0, 0, 0); 19375eeb39c2SIan Campbell xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 19385eeb39c2SIan Campbell xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 19395eeb39c2SIan Campbell xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 19405eeb39c2SIan Campbell xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 19415eeb39c2SIan Campbell xc_domain_create(xc, 0, handle, 0, NULL, NULL); 19425eeb39c2SIan Campbell 19435eeb39c2SIan Campbell xfmem = xenforeignmemory_open(0, 0); 19445eeb39c2SIan Campbell xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0); 19455eeb39c2SIan Campbell 19465eeb39c2SIan Campbell xe = xenevtchn_open(0, 0); 19475eeb39c2SIan Campbell xenevtchn_fd(xe); 19485eeb39c2SIan Campbell 19495eeb39c2SIan Campbell xg = xengnttab_open(0, 0); 19505eeb39c2SIan Campbell xengnttab_map_grant_ref(xg, 0, 0, 0); 19515eeb39c2SIan Campbell 19525eeb39c2SIan Campbell return 0; 19535eeb39c2SIan Campbell} 19545eeb39c2SIan CampbellEOF 19555eeb39c2SIan Campbell compile_prog "" "$xen_libs $xen_stable_libs" 19565eeb39c2SIan Campbell then 19575eeb39c2SIan Campbell xen_ctrl_version=471 19585eeb39c2SIan Campbell xen=yes 19595eeb39c2SIan Campbell elif 19605eeb39c2SIan Campbell cat > $TMPC <<EOF && 1961e37630caSaliguori#include <xenctrl.h> 1962cdadde39SRoger Pau Monne#include <stdint.h> 1963cdadde39SRoger Pau Monneint main(void) { 1964cdadde39SRoger Pau Monne xc_interface *xc = NULL; 1965cdadde39SRoger Pau Monne xen_domain_handle_t handle; 1966cdadde39SRoger Pau Monne xc_domain_create(xc, 0, handle, 0, NULL, NULL); 1967cdadde39SRoger Pau Monne return 0; 1968cdadde39SRoger Pau Monne} 1969cdadde39SRoger Pau MonneEOF 1970cdadde39SRoger Pau Monne compile_prog "" "$xen_libs" 1971cdadde39SRoger Pau Monne then 1972cdadde39SRoger Pau Monne xen_ctrl_version=470 1973cdadde39SRoger Pau Monne xen=yes 1974cdadde39SRoger Pau Monne 1975cdadde39SRoger Pau Monne # Xen 4.6 1976cdadde39SRoger Pau Monne elif 1977cdadde39SRoger Pau Monne cat > $TMPC <<EOF && 1978cdadde39SRoger Pau Monne#include <xenctrl.h> 1979e108a3c1SAnthony PERARD#include <xenstore.h> 1980d5b93ddfSAnthony PERARD#include <stdint.h> 1981d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1982d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1983d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1984d5b93ddfSAnthony PERARD#endif 1985d5b93ddfSAnthony PERARDint main(void) { 1986d5b93ddfSAnthony PERARD xc_interface *xc; 1987d5b93ddfSAnthony PERARD xs_daemon_open(); 1988d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1989d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1990d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1991b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 19928688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 1993d8b441a3SJan Beulich xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL); 199420a544c7SKonrad Rzeszutek Wilk xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0); 1995d8b441a3SJan Beulich return 0; 1996d8b441a3SJan Beulich} 1997d8b441a3SJan BeulichEOF 1998d8b441a3SJan Beulich compile_prog "" "$xen_libs" 1999d8b441a3SJan Beulich then 2000d8b441a3SJan Beulich xen_ctrl_version=460 2001d8b441a3SJan Beulich xen=yes 2002d8b441a3SJan Beulich 2003d8b441a3SJan Beulich # Xen 4.5 2004d8b441a3SJan Beulich elif 2005d8b441a3SJan Beulich cat > $TMPC <<EOF && 2006d8b441a3SJan Beulich#include <xenctrl.h> 2007d8b441a3SJan Beulich#include <xenstore.h> 2008d8b441a3SJan Beulich#include <stdint.h> 2009d8b441a3SJan Beulich#include <xen/hvm/hvm_info_table.h> 2010d8b441a3SJan Beulich#if !defined(HVM_MAX_VCPUS) 2011d8b441a3SJan Beulich# error HVM_MAX_VCPUS not defined 2012d8b441a3SJan Beulich#endif 2013d8b441a3SJan Beulichint main(void) { 2014d8b441a3SJan Beulich xc_interface *xc; 2015d8b441a3SJan Beulich xs_daemon_open(); 2016d8b441a3SJan Beulich xc = xc_interface_open(0, 0, 0); 2017d8b441a3SJan Beulich xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 2018d8b441a3SJan Beulich xc_gnttab_open(NULL, 0); 2019d8b441a3SJan Beulich xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 2020d8b441a3SJan Beulich xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 20213996e85cSPaul Durrant xc_hvm_create_ioreq_server(xc, 0, 0, NULL); 20223996e85cSPaul Durrant return 0; 20233996e85cSPaul Durrant} 20243996e85cSPaul DurrantEOF 20253996e85cSPaul Durrant compile_prog "" "$xen_libs" 20263996e85cSPaul Durrant then 20273996e85cSPaul Durrant xen_ctrl_version=450 20283996e85cSPaul Durrant xen=yes 20293996e85cSPaul Durrant 20303996e85cSPaul Durrant elif 20313996e85cSPaul Durrant cat > $TMPC <<EOF && 20323996e85cSPaul Durrant#include <xenctrl.h> 20333996e85cSPaul Durrant#include <xenstore.h> 20343996e85cSPaul Durrant#include <stdint.h> 20353996e85cSPaul Durrant#include <xen/hvm/hvm_info_table.h> 20363996e85cSPaul Durrant#if !defined(HVM_MAX_VCPUS) 20373996e85cSPaul Durrant# error HVM_MAX_VCPUS not defined 20383996e85cSPaul Durrant#endif 20393996e85cSPaul Durrantint main(void) { 20403996e85cSPaul Durrant xc_interface *xc; 20413996e85cSPaul Durrant xs_daemon_open(); 20423996e85cSPaul Durrant xc = xc_interface_open(0, 0, 0); 20433996e85cSPaul Durrant xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 20443996e85cSPaul Durrant xc_gnttab_open(NULL, 0); 20453996e85cSPaul Durrant xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 20463996e85cSPaul Durrant xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 20478688e065SStefano Stabellini return 0; 20488688e065SStefano Stabellini} 20498688e065SStefano StabelliniEOF 20508688e065SStefano Stabellini compile_prog "" "$xen_libs" 205169deef08SPeter Maydell then 20528688e065SStefano Stabellini xen_ctrl_version=420 20538688e065SStefano Stabellini xen=yes 20548688e065SStefano Stabellini 2055e37630caSaliguori else 2056fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 2057edfb07edSIan Campbell feature_not_found "xen (unsupported version)" \ 2058edfb07edSIan Campbell "Install a supported xen (xen 4.2 or newer)" 2059fc321b4bSJuan Quintela fi 2060fc321b4bSJuan Quintela xen=no 2061e37630caSaliguori fi 2062d5b93ddfSAnthony PERARD 2063d5b93ddfSAnthony PERARD if test "$xen" = yes; then 20645eeb39c2SIan Campbell if test $xen_ctrl_version -ge 471 ; then 20655eeb39c2SIan Campbell libs_softmmu="$xen_stable_libs $libs_softmmu" 20665eeb39c2SIan Campbell fi 2067d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 2068d5b93ddfSAnthony PERARD fi 2069e37630caSaliguorifi 2070e37630caSaliguori 2071eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 2072edfb07edSIan Campbell if test "$xen" = "yes" && test "$linux" = "yes"; then 2073eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 2074eb6fda0fSAnthony PERARD else 2075eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 207676ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 207776ad07a4SPeter Maydell " but this feature requires /sys from Linux" 2078eb6fda0fSAnthony PERARD fi 2079eb6fda0fSAnthony PERARD xen_pci_passthrough=no 2080eb6fda0fSAnthony PERARD fi 2081eb6fda0fSAnthony PERARDfi 2082eb6fda0fSAnthony PERARD 208364a7ad6fSIan Campbellif test "$xen_pv_domain_build" = "yes" && 208464a7ad6fSIan Campbell test "$xen" != "yes"; then 208564a7ad6fSIan Campbell error_exit "User requested Xen PV domain builder support" \ 208664a7ad6fSIan Campbell "which requires Xen support." 208764a7ad6fSIan Campbellfi 208864a7ad6fSIan Campbell 2089e37630caSaliguori########################################## 2090dfffc653SJuan Quintela# Sparse probe 2091dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 20920dba6195SLoïc Minier if has cgcc; then 2093dfffc653SJuan Quintela sparse=yes 2094dfffc653SJuan Quintela else 2095dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 209621684af0SStewart Smith feature_not_found "sparse" "Install sparse binary" 2097dfffc653SJuan Quintela fi 2098dfffc653SJuan Quintela sparse=no 2099dfffc653SJuan Quintela fi 2100dfffc653SJuan Quintelafi 2101dfffc653SJuan Quintela 2102dfffc653SJuan Quintela########################################## 2103f676c67eSJeremy White# X11 probe 2104f676c67eSJeremy Whitex11_cflags= 2105f676c67eSJeremy Whitex11_libs=-lX11 2106f676c67eSJeremy Whiteif $pkg_config --exists "x11"; then 2107f676c67eSJeremy White x11_cflags=`$pkg_config --cflags x11` 2108f676c67eSJeremy White x11_libs=`$pkg_config --libs x11` 2109f676c67eSJeremy Whitefi 2110f676c67eSJeremy White 2111f676c67eSJeremy White########################################## 2112a4ccabcfSAnthony Liguori# GTK probe 2113a4ccabcfSAnthony Liguori 21149e04c683SStefan Weilif test "$gtkabi" = ""; then 21159e04c683SStefan Weil # The GTK ABI was not specified explicitly, so try whether 2.0 is available. 21169e04c683SStefan Weil # Use 3.0 as a fallback if that is available. 21179e04c683SStefan Weil if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then 21189e04c683SStefan Weil gtkabi=2.0 21199e04c683SStefan Weil elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then 21209e04c683SStefan Weil gtkabi=3.0 21219e04c683SStefan Weil else 21229e04c683SStefan Weil gtkabi=2.0 21239e04c683SStefan Weil fi 21249e04c683SStefan Weilfi 21259e04c683SStefan Weil 2126a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then 2127528de90aSDaniel P. Berrange gtkpackage="gtk+-$gtkabi" 21280a337ed0SGerd Hoffmann gtkx11package="gtk+-x11-$gtkabi" 2129528de90aSDaniel P. Berrange if test "$gtkabi" = "3.0" ; then 2130528de90aSDaniel P. Berrange gtkversion="3.0.0" 2131bbbf9bfbSStefan Weil else 2132bbbf9bfbSStefan Weil gtkversion="2.18.0" 2133bbbf9bfbSStefan Weil fi 2134bbbf9bfbSStefan Weil if $pkg_config --exists "$gtkpackage >= $gtkversion"; then 2135bbbf9bfbSStefan Weil gtk_cflags=`$pkg_config --cflags $gtkpackage` 2136bbbf9bfbSStefan Weil gtk_libs=`$pkg_config --libs $gtkpackage` 21370a337ed0SGerd Hoffmann if $pkg_config --exists "$gtkx11package >= $gtkversion"; then 2138f676c67eSJeremy White gtk_cflags="$gtk_cflags $x11_cflags" 2139f676c67eSJeremy White gtk_libs="$gtk_libs $x11_libs" 21400a337ed0SGerd Hoffmann fi 2141bbbf9bfbSStefan Weil libs_softmmu="$gtk_libs $libs_softmmu" 2142bbbf9bfbSStefan Weil gtk="yes" 2143bbbf9bfbSStefan Weil elif test "$gtk" = "yes"; then 21449e04c683SStefan Weil feature_not_found "gtk" "Install gtk2 or gtk3 devel" 2145bbbf9bfbSStefan Weil else 2146bbbf9bfbSStefan Weil gtk="no" 2147bbbf9bfbSStefan Weil fi 2148bbbf9bfbSStefan Weilfi 2149bbbf9bfbSStefan Weil 2150ddbb0d09SDaniel P. Berrange 2151ddbb0d09SDaniel P. Berrange########################################## 2152ddbb0d09SDaniel P. Berrange# GNUTLS probe 2153ddbb0d09SDaniel P. Berrange 215437371299SPeter Maydellgnutls_works() { 215537371299SPeter Maydell # Unfortunately some distros have bad pkg-config information for gnutls 215637371299SPeter Maydell # such that it claims to exist but you get a compiler error if you try 215737371299SPeter Maydell # to use the options returned by --libs. Specifically, Ubuntu for --static 215837371299SPeter Maydell # builds doesn't work: 215937371299SPeter Maydell # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035 216037371299SPeter Maydell # 216137371299SPeter Maydell # So sanity check the cflags/libs before assuming gnutls can be used. 216237371299SPeter Maydell if ! $pkg_config --exists "gnutls"; then 216337371299SPeter Maydell return 1 216437371299SPeter Maydell fi 216537371299SPeter Maydell 216637371299SPeter Maydell write_c_skeleton 216737371299SPeter Maydell compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)" 216837371299SPeter Maydell} 216937371299SPeter Maydell 217062893b67SDaniel P. Berrangegnutls_gcrypt=no 2171ed754746SDaniel P. Berrangegnutls_nettle=no 2172ddbb0d09SDaniel P. Berrangeif test "$gnutls" != "no"; then 217337371299SPeter Maydell if gnutls_works; then 2174ddbb0d09SDaniel P. Berrange gnutls_cflags=`$pkg_config --cflags gnutls` 2175ddbb0d09SDaniel P. Berrange gnutls_libs=`$pkg_config --libs gnutls` 2176ddbb0d09SDaniel P. Berrange libs_softmmu="$gnutls_libs $libs_softmmu" 2177ddbb0d09SDaniel P. Berrange libs_tools="$gnutls_libs $libs_tools" 2178ddbb0d09SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" 2179ddbb0d09SDaniel P. Berrange gnutls="yes" 2180ddbb0d09SDaniel P. Berrange 2181ddbb0d09SDaniel P. Berrange # gnutls_hash_init requires >= 2.9.10 2182ddbb0d09SDaniel P. Berrange if $pkg_config --exists "gnutls >= 2.9.10"; then 2183ddbb0d09SDaniel P. Berrange gnutls_hash="yes" 2184ddbb0d09SDaniel P. Berrange else 2185ddbb0d09SDaniel P. Berrange gnutls_hash="no" 2186ddbb0d09SDaniel P. Berrange fi 218762893b67SDaniel P. Berrange 218862893b67SDaniel P. Berrange if $pkg_config --exists 'gnutls >= 3.0'; then 218962893b67SDaniel P. Berrange gnutls_gcrypt=no 2190ed754746SDaniel P. Berrange gnutls_nettle=yes 219162893b67SDaniel P. Berrange elif $pkg_config --exists 'gnutls >= 2.12'; then 219262893b67SDaniel P. Berrange case `$pkg_config --libs --static gnutls` in 2193ed754746SDaniel P. Berrange *gcrypt*) 2194ed754746SDaniel P. Berrange gnutls_gcrypt=yes 2195ed754746SDaniel P. Berrange gnutls_nettle=no 2196ed754746SDaniel P. Berrange ;; 2197ed754746SDaniel P. Berrange *nettle*) 2198ed754746SDaniel P. Berrange gnutls_gcrypt=no 2199ed754746SDaniel P. Berrange gnutls_nettle=yes 2200ed754746SDaniel P. Berrange ;; 2201ed754746SDaniel P. Berrange *) 2202ed754746SDaniel P. Berrange gnutls_gcrypt=yes 2203ed754746SDaniel P. Berrange gnutls_nettle=no 2204ed754746SDaniel P. Berrange ;; 220562893b67SDaniel P. Berrange esac 220662893b67SDaniel P. Berrange else 220762893b67SDaniel P. Berrange gnutls_gcrypt=yes 2208ed754746SDaniel P. Berrange gnutls_nettle=no 220962893b67SDaniel P. Berrange fi 2210ddbb0d09SDaniel P. Berrange elif test "$gnutls" = "yes"; then 2211ddbb0d09SDaniel P. Berrange feature_not_found "gnutls" "Install gnutls devel" 2212ddbb0d09SDaniel P. Berrange else 2213ddbb0d09SDaniel P. Berrange gnutls="no" 2214ddbb0d09SDaniel P. Berrange gnutls_hash="no" 2215ddbb0d09SDaniel P. Berrange fi 2216ddbb0d09SDaniel P. Berrangeelse 2217ddbb0d09SDaniel P. Berrange gnutls_hash="no" 2218ddbb0d09SDaniel P. Berrangefi 2219ddbb0d09SDaniel P. Berrange 222091bfcdb0SDaniel P. Berrange 222191bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-gcrypt flag, 222291bfcdb0SDaniel P. Berrange# then mark as disabled if user requested nettle 222391bfcdb0SDaniel P. Berrange# explicitly, or if gnutls links to nettle 222491bfcdb0SDaniel P. Berrangeif test -z "$gcrypt" 222591bfcdb0SDaniel P. Berrangethen 222691bfcdb0SDaniel P. Berrange if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes" 222791bfcdb0SDaniel P. Berrange then 222891bfcdb0SDaniel P. Berrange gcrypt="no" 222991bfcdb0SDaniel P. Berrange fi 223091bfcdb0SDaniel P. Berrangefi 223191bfcdb0SDaniel P. Berrange 223291bfcdb0SDaniel P. Berrange# If user didn't give a --disable/enable-nettle flag, 223391bfcdb0SDaniel P. Berrange# then mark as disabled if user requested gcrypt 223491bfcdb0SDaniel P. Berrange# explicitly, or if gnutls links to gcrypt 223591bfcdb0SDaniel P. Berrangeif test -z "$nettle" 223691bfcdb0SDaniel P. Berrangethen 223791bfcdb0SDaniel P. Berrange if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes" 223891bfcdb0SDaniel P. Berrange then 223991bfcdb0SDaniel P. Berrange nettle="no" 224091bfcdb0SDaniel P. Berrange fi 224191bfcdb0SDaniel P. Berrangefi 224291bfcdb0SDaniel P. Berrange 224391bfcdb0SDaniel P. Berrangehas_libgcrypt_config() { 224491bfcdb0SDaniel P. Berrange if ! has "libgcrypt-config" 224591bfcdb0SDaniel P. Berrange then 224691bfcdb0SDaniel P. Berrange return 1 224791bfcdb0SDaniel P. Berrange fi 224891bfcdb0SDaniel P. Berrange 224991bfcdb0SDaniel P. Berrange if test -n "$cross_prefix" 225091bfcdb0SDaniel P. Berrange then 225191bfcdb0SDaniel P. Berrange host=`libgcrypt-config --host` 225291bfcdb0SDaniel P. Berrange if test "$host-" != $cross_prefix 225391bfcdb0SDaniel P. Berrange then 225491bfcdb0SDaniel P. Berrange return 1 225591bfcdb0SDaniel P. Berrange fi 225691bfcdb0SDaniel P. Berrange fi 225791bfcdb0SDaniel P. Berrange 225891bfcdb0SDaniel P. Berrange return 0 225991bfcdb0SDaniel P. Berrange} 226091bfcdb0SDaniel P. Berrange 226191bfcdb0SDaniel P. Berrangeif test "$gcrypt" != "no"; then 226291bfcdb0SDaniel P. Berrange if has_libgcrypt_config; then 226362893b67SDaniel P. Berrange gcrypt_cflags=`libgcrypt-config --cflags` 226462893b67SDaniel P. Berrange gcrypt_libs=`libgcrypt-config --libs` 226591bfcdb0SDaniel P. Berrange # Debian has remove -lgpg-error from libgcrypt-config 226691bfcdb0SDaniel P. Berrange # as it "spreads unnecessary dependencies" which in 226791bfcdb0SDaniel P. Berrange # turn breaks static builds... 226891bfcdb0SDaniel P. Berrange if test "$static" = "yes" 226991bfcdb0SDaniel P. Berrange then 227091bfcdb0SDaniel P. Berrange gcrypt_libs="$gcrypt_libs -lgpg-error" 227191bfcdb0SDaniel P. Berrange fi 227262893b67SDaniel P. Berrange libs_softmmu="$gcrypt_libs $libs_softmmu" 227362893b67SDaniel P. Berrange libs_tools="$gcrypt_libs $libs_tools" 227462893b67SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" 227591bfcdb0SDaniel P. Berrange gcrypt="yes" 227691bfcdb0SDaniel P. Berrange if test -z "$nettle"; then 227791bfcdb0SDaniel P. Berrange nettle="no" 227891bfcdb0SDaniel P. Berrange fi 227962893b67SDaniel P. Berrange else 228091bfcdb0SDaniel P. Berrange if test "$gcrypt" = "yes"; then 228162893b67SDaniel P. Berrange feature_not_found "gcrypt" "Install gcrypt devel" 228291bfcdb0SDaniel P. Berrange else 228391bfcdb0SDaniel P. Berrange gcrypt="no" 228491bfcdb0SDaniel P. Berrange fi 228562893b67SDaniel P. Berrange fi 228662893b67SDaniel P. Berrangefi 228762893b67SDaniel P. Berrange 2288ddbb0d09SDaniel P. Berrange 228991bfcdb0SDaniel P. Berrangeif test "$nettle" != "no"; then 2290ed754746SDaniel P. Berrange if $pkg_config --exists "nettle"; then 2291ed754746SDaniel P. Berrange nettle_cflags=`$pkg_config --cflags nettle` 2292ed754746SDaniel P. Berrange nettle_libs=`$pkg_config --libs nettle` 2293becaeb72SRadim Krčmář nettle_version=`$pkg_config --modversion nettle` 2294ed754746SDaniel P. Berrange libs_softmmu="$nettle_libs $libs_softmmu" 2295ed754746SDaniel P. Berrange libs_tools="$nettle_libs $libs_tools" 2296ed754746SDaniel P. Berrange QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" 229791bfcdb0SDaniel P. Berrange nettle="yes" 2298ed754746SDaniel P. Berrange else 229991bfcdb0SDaniel P. Berrange if test "$nettle" = "yes"; then 2300ed754746SDaniel P. Berrange feature_not_found "nettle" "Install nettle devel" 230191bfcdb0SDaniel P. Berrange else 230291bfcdb0SDaniel P. Berrange nettle="no" 2303ed754746SDaniel P. Berrange fi 2304ed754746SDaniel P. Berrange fi 230591bfcdb0SDaniel P. Berrangefi 230691bfcdb0SDaniel P. Berrange 230791bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" && test "$nettle" = "yes" 230891bfcdb0SDaniel P. Berrangethen 230991bfcdb0SDaniel P. Berrange error_exit "Only one of gcrypt & nettle can be enabled" 231091bfcdb0SDaniel P. Berrangefi 2311ed754746SDaniel P. Berrange 23129a2fd434SDaniel P. Berrange########################################## 23139a2fd434SDaniel P. Berrange# libtasn1 - only for the TLS creds/session test suite 23149a2fd434SDaniel P. Berrange 23159a2fd434SDaniel P. Berrangetasn1=yes 231690246037SDaniel P. Berrangetasn1_cflags="" 231790246037SDaniel P. Berrangetasn1_libs="" 23189a2fd434SDaniel P. Berrangeif $pkg_config --exists "libtasn1"; then 23199a2fd434SDaniel P. Berrange tasn1_cflags=`$pkg_config --cflags libtasn1` 23209a2fd434SDaniel P. Berrange tasn1_libs=`$pkg_config --libs libtasn1` 23219a2fd434SDaniel P. Berrangeelse 23229a2fd434SDaniel P. Berrange tasn1=no 23239a2fd434SDaniel P. Berrangefi 23249a2fd434SDaniel P. Berrange 2325ed754746SDaniel P. Berrange 2326bbbf9bfbSStefan Weil########################################## 2327559607eaSDaniel P. Berrange# getifaddrs (for tests/test-io-channel-socket ) 2328559607eaSDaniel P. Berrange 2329559607eaSDaniel P. Berrangehave_ifaddrs_h=yes 2330559607eaSDaniel P. Berrangeif ! check_include "ifaddrs.h" ; then 2331559607eaSDaniel P. Berrange have_ifaddrs_h=no 2332559607eaSDaniel P. Berrangefi 2333559607eaSDaniel P. Berrange 2334559607eaSDaniel P. Berrange########################################## 2335bbbf9bfbSStefan Weil# VTE probe 2336bbbf9bfbSStefan Weil 2337bbbf9bfbSStefan Weilif test "$vte" != "no"; then 2338bbbf9bfbSStefan Weil if test "$gtkabi" = "3.0"; then 2339528de90aSDaniel P. Berrange vtepackage="vte-2.90" 2340528de90aSDaniel P. Berrange vteversion="0.32.0" 2341528de90aSDaniel P. Berrange else 2342528de90aSDaniel P. Berrange vtepackage="vte" 2343528de90aSDaniel P. Berrange vteversion="0.24.0" 2344528de90aSDaniel P. Berrange fi 2345bbbf9bfbSStefan Weil if $pkg_config --exists "$vtepackage >= $vteversion"; then 2346ca871ec8SStefan Weil vte_cflags=`$pkg_config --cflags $vtepackage` 2347ca871ec8SStefan Weil vte_libs=`$pkg_config --libs $vtepackage` 2348bbbf9bfbSStefan Weil libs_softmmu="$vte_libs $libs_softmmu" 2349bbbf9bfbSStefan Weil vte="yes" 2350bbbf9bfbSStefan Weil elif test "$vte" = "yes"; then 23519e04c683SStefan Weil if test "$gtkabi" = "3.0"; then 23529e04c683SStefan Weil feature_not_found "vte" "Install libvte-2.90 devel" 23539e04c683SStefan Weil else 23549e04c683SStefan Weil feature_not_found "vte" "Install libvte devel" 23559e04c683SStefan Weil fi 2356bbbf9bfbSStefan Weil else 2357bbbf9bfbSStefan Weil vte="no" 2358a4ccabcfSAnthony Liguori fi 2359a4ccabcfSAnthony Liguorifi 2360a4ccabcfSAnthony Liguori 2361a4ccabcfSAnthony Liguori########################################## 236211d9f695Sbellard# SDL probe 236311d9f695Sbellard 23643ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 23653ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 236647c03744SDave Airlie 236747c03744SDave Airlieif test $sdlabi = "2.0"; then 236847c03744SDave Airlie sdl_config=$sdl2_config 236947c03744SDave Airlie sdlname=sdl2 237047c03744SDave Airlie sdlconfigname=sdl2_config 237147c03744SDave Airlieelse 237247c03744SDave Airlie sdlname=sdl 237347c03744SDave Airlie sdlconfigname=sdl_config 23743ec87ffeSPaolo Bonzinifi 23753ec87ffeSPaolo Bonzini 237647c03744SDave Airlieif test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then 237747c03744SDave Airlie sdl_config=$sdlconfigname 237847c03744SDave Airliefi 237947c03744SDave Airlie 238047c03744SDave Airlieif $pkg_config $sdlname --exists; then 238147c03744SDave Airlie sdlconfig="$pkg_config $sdlname" 2382fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 23833ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 23843ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 23859316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 2386a0dfd8a4SLoïc Minierelse 2387a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 238821684af0SStewart Smith feature_not_found "sdl" "Install SDL devel" 2389a0dfd8a4SLoïc Minier fi 2390a0dfd8a4SLoïc Minier sdl=no 23919316f803SPaolo Bonzinifi 239229e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 23933ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 23943ec87ffeSPaolo Bonzinifi 239511d9f695Sbellard 23969316f803SPaolo Bonzinisdl_too_old=no 2397c4198157SJuan Quintelaif test "$sdl" != "no" ; then 239811d9f695Sbellard cat > $TMPC << EOF 239911d9f695Sbellard#include <SDL.h> 240011d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 240111d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 240211d9f695SbellardEOF 24039316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 240474f42e18STeLeMan if test "$static" = "yes" ; then 240574f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 240674f42e18STeLeMan else 24079316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 240874f42e18STeLeMan fi 240952166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 241011d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 241111d9f695Sbellard sdl_too_old=yes 241211d9f695Sbellard else 241311d9f695Sbellard sdl=yes 241411d9f695Sbellard fi 24157c1f25b4Sbellard 241667c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 24171ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 241867c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 2419f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 2420f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 242111d9f695Sbellard fi 242252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 24231ac88f28SJuan Quintela : 24241ac88f28SJuan Quintela else 24251ac88f28SJuan Quintela sdl=no 24267c1f25b4Sbellard fi 24277c1f25b4Sbellard fi # static link 2428c4198157SJuan Quintela else # sdl not found 2429c4198157SJuan Quintela if test "$sdl" = "yes" ; then 243021684af0SStewart Smith feature_not_found "sdl" "Install SDL devel" 2431c4198157SJuan Quintela fi 2432c4198157SJuan Quintela sdl=no 24337c1f25b4Sbellard fi # sdl compile test 2434fd677642Sthsfi 243511d9f695Sbellard 24365368a422Saliguoriif test "$sdl" = "yes" ; then 24375368a422Saliguori cat > $TMPC <<EOF 24385368a422Saliguori#include <SDL.h> 24395368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 24405368a422Saliguori#include <X11/XKBlib.h> 24415368a422Saliguori#else 24425368a422Saliguori#error No x11 support 24435368a422Saliguori#endif 24445368a422Saliguoriint main(void) { return 0; } 24455368a422SaliguoriEOF 2446f676c67eSJeremy White if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then 2447f676c67eSJeremy White sdl_cflags="$sdl_cflags $x11_cflags" 2448f676c67eSJeremy White sdl_libs="$sdl_libs $x11_libs" 24495368a422Saliguori fi 24500705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 24515368a422Saliguorifi 24525368a422Saliguori 24538f28f3fbSths########################################## 24542da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 24552da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 24562da776dbSMichael R. Hines cat > $TMPC <<EOF 24572da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 24582da776dbSMichael R. Hinesint main(void) { return 0; } 24592da776dbSMichael R. HinesEOF 24602da776dbSMichael R. Hines rdma_libs="-lrdmacm -libverbs" 24612da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 24622da776dbSMichael R. Hines rdma="yes" 24632da776dbSMichael R. Hines libs_softmmu="$libs_softmmu $rdma_libs" 24642da776dbSMichael R. Hines else 24652da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 24662da776dbSMichael R. Hines error_exit \ 24672da776dbSMichael R. Hines " OpenFabrics librdmacm/libibverbs not present." \ 24682da776dbSMichael R. Hines " Your options:" \ 24692da776dbSMichael R. Hines " (1) Fast: Install infiniband packages from your distro." \ 24702da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 24712da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 24722da776dbSMichael R. Hines fi 24732da776dbSMichael R. Hines rdma="no" 24742da776dbSMichael R. Hines fi 24752da776dbSMichael R. Hinesfi 24762da776dbSMichael R. Hines 247795c6bff3SBenoît Canet 247895c6bff3SBenoît Canet########################################## 24792f9606b3Saliguori# VNC SASL detection 2480821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 24812f9606b3Saliguori cat > $TMPC <<EOF 24822f9606b3Saliguori#include <sasl/sasl.h> 24832f9606b3Saliguori#include <stdio.h> 24842f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 24852f9606b3SaliguoriEOF 24862f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 24872f9606b3Saliguori vnc_sasl_cflags="" 24882f9606b3Saliguori vnc_sasl_libs="-lsasl2" 248952166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 2490ea784e3bSJuan Quintela vnc_sasl=yes 2491fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 2492ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 24932f9606b3Saliguori else 2494ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 249521684af0SStewart Smith feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 2496ea784e3bSJuan Quintela fi 2497ea784e3bSJuan Quintela vnc_sasl=no 24982f9606b3Saliguori fi 24992f9606b3Saliguorifi 25002f9606b3Saliguori 25012f9606b3Saliguori########################################## 25022f6f5c7aSCorentin Chary# VNC JPEG detection 2503821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 25042f6f5c7aSCorentin Charycat > $TMPC <<EOF 25052f6f5c7aSCorentin Chary#include <stdio.h> 25062f6f5c7aSCorentin Chary#include <jpeglib.h> 25072f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 25082f6f5c7aSCorentin CharyEOF 25092f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 25102f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 25112f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 25122f6f5c7aSCorentin Chary vnc_jpeg=yes 25132f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 2514ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 25152f6f5c7aSCorentin Chary else 25162f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 251721684af0SStewart Smith feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 25182f6f5c7aSCorentin Chary fi 25192f6f5c7aSCorentin Chary vnc_jpeg=no 25202f6f5c7aSCorentin Chary fi 25212f6f5c7aSCorentin Charyfi 25222f6f5c7aSCorentin Chary 25232f6f5c7aSCorentin Chary########################################## 2524efe556adSCorentin Chary# VNC PNG detection 2525821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 2526efe556adSCorentin Charycat > $TMPC <<EOF 2527efe556adSCorentin Chary//#include <stdio.h> 2528efe556adSCorentin Chary#include <png.h> 2529832ce9c2SScott Wood#include <stddef.h> 2530efe556adSCorentin Charyint main(void) { 2531efe556adSCorentin Chary png_structp png_ptr; 2532efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 25337edc3fedSPeter Maydell return png_ptr != 0; 2534efe556adSCorentin Chary} 2535efe556adSCorentin CharyEOF 253665d5d3f9SStefan Weil if $pkg_config libpng --exists; then 2537ca871ec8SStefan Weil vnc_png_cflags=`$pkg_config libpng --cflags` 2538ca871ec8SStefan Weil vnc_png_libs=`$pkg_config libpng --libs` 25399af8025eSBrad else 2540efe556adSCorentin Chary vnc_png_cflags="" 2541efe556adSCorentin Chary vnc_png_libs="-lpng" 25429af8025eSBrad fi 2543efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 2544efe556adSCorentin Chary vnc_png=yes 2545efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 25469af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 2547efe556adSCorentin Chary else 2548efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 254921684af0SStewart Smith feature_not_found "vnc-png" "Install libpng devel" 2550efe556adSCorentin Chary fi 2551efe556adSCorentin Chary vnc_png=no 2552efe556adSCorentin Chary fi 2553efe556adSCorentin Charyfi 2554efe556adSCorentin Chary 2555efe556adSCorentin Chary########################################## 255676655d6dSaliguori# fnmatch() probe, used for ACL routines 255776655d6dSaliguorifnmatch="no" 255876655d6dSaliguoricat > $TMPC << EOF 255976655d6dSaliguori#include <fnmatch.h> 256076655d6dSaliguoriint main(void) 256176655d6dSaliguori{ 256276655d6dSaliguori fnmatch("foo", "foo", 0); 256376655d6dSaliguori return 0; 256476655d6dSaliguori} 256576655d6dSaliguoriEOF 256652166aa0SJuan Quintelaif compile_prog "" "" ; then 256776655d6dSaliguori fnmatch="yes" 256876655d6dSaliguorifi 256976655d6dSaliguori 257076655d6dSaliguori########################################## 2571ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 25722d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library 25732d16c8e9SPeter Maydell# need be linked to get the uuid functions. 2574ee682d27SStefan Weilif test "$uuid" != "no" ; then 2575ee682d27SStefan Weil uuid_libs="-luuid" 2576ee682d27SStefan Weil cat > $TMPC << EOF 2577ee682d27SStefan Weil#include <uuid/uuid.h> 2578ee682d27SStefan Weilint main(void) 2579ee682d27SStefan Weil{ 2580ee682d27SStefan Weil uuid_t my_uuid; 2581ee682d27SStefan Weil uuid_generate(my_uuid); 2582ee682d27SStefan Weil return 0; 2583ee682d27SStefan Weil} 2584ee682d27SStefan WeilEOF 25852d16c8e9SPeter Maydell if compile_prog "" "" ; then 25862d16c8e9SPeter Maydell uuid="yes" 25872d16c8e9SPeter Maydell elif compile_prog "" "$uuid_libs" ; then 2588ee682d27SStefan Weil uuid="yes" 2589ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 2590ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 2591ee682d27SStefan Weil else 2592ee682d27SStefan Weil if test "$uuid" = "yes" ; then 259321684af0SStewart Smith feature_not_found "uuid" "Install libuuid devel" 2594ee682d27SStefan Weil fi 2595ee682d27SStefan Weil uuid=no 2596ee682d27SStefan Weil fi 2597ee682d27SStefan Weilfi 2598ee682d27SStefan Weil 25994f18b782SJeff Codyif test "$vhdx" = "yes" ; then 26004f18b782SJeff Cody if test "$uuid" = "no" ; then 26014f18b782SJeff Cody error_exit "uuid required for VHDX support" 26024f18b782SJeff Cody fi 26034f18b782SJeff Codyelif test "$vhdx" != "no" ; then 26044f18b782SJeff Cody if test "$uuid" = "yes" ; then 26054f18b782SJeff Cody vhdx=yes 26064f18b782SJeff Cody else 26074f18b782SJeff Cody vhdx=no 26084f18b782SJeff Cody fi 26094f18b782SJeff Codyfi 26104f18b782SJeff Cody 2611ee682d27SStefan Weil########################################## 2612dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 2613dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 2614dce512deSChristoph Hellwig cat > $TMPC << EOF 2615ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 2616dce512deSChristoph Hellwig#include <xfs/xfs.h> 2617dce512deSChristoph Hellwigint main(void) 2618dce512deSChristoph Hellwig{ 2619dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 2620dce512deSChristoph Hellwig return 0; 2621dce512deSChristoph Hellwig} 2622dce512deSChristoph HellwigEOF 2623dce512deSChristoph Hellwig if compile_prog "" "" ; then 2624dce512deSChristoph Hellwig xfs="yes" 2625dce512deSChristoph Hellwig else 2626dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 262721684af0SStewart Smith feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 2628dce512deSChristoph Hellwig fi 2629dce512deSChristoph Hellwig xfs=no 2630dce512deSChristoph Hellwig fi 2631dce512deSChristoph Hellwigfi 2632dce512deSChristoph Hellwig 2633dce512deSChristoph Hellwig########################################## 26348a16d273Sths# vde libraries probe 2635dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 26364baae0acSJuan Quintela vde_libs="-lvdeplug" 26378a16d273Sths cat > $TMPC << EOF 26388a16d273Sths#include <libvdeplug.h> 26394a7f0e06Spbrookint main(void) 26404a7f0e06Spbrook{ 26414a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 2642fea08e08SPeter Maydell char s[] = ""; 2643fea08e08SPeter Maydell vde_open(s, s, &a); 26444a7f0e06Spbrook return 0; 26454a7f0e06Spbrook} 26468a16d273SthsEOF 264752166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 26484baae0acSJuan Quintela vde=yes 26498e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 26508e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 2651dfb278bdSJuan Quintela else 2652dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 265321684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 2654dfb278bdSJuan Quintela fi 2655dfb278bdSJuan Quintela vde=no 26568a16d273Sths fi 26578a16d273Sthsfi 26588a16d273Sths 26598a16d273Sths########################################## 26600a985b37SVincenzo Maffione# netmap support probe 26610a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 26620a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 26630a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 26640a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 26650a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 266658952137SVincenzo Maffioneif test "$netmap" != "no" ; then 266758952137SVincenzo Maffione cat > $TMPC << EOF 266858952137SVincenzo Maffione#include <inttypes.h> 266958952137SVincenzo Maffione#include <net/if.h> 267058952137SVincenzo Maffione#include <net/netmap.h> 267158952137SVincenzo Maffione#include <net/netmap_user.h> 26720a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 26730a985b37SVincenzo Maffione#error 26740a985b37SVincenzo Maffione#endif 267558952137SVincenzo Maffioneint main(void) { return 0; } 267658952137SVincenzo MaffioneEOF 267758952137SVincenzo Maffione if compile_prog "" "" ; then 267858952137SVincenzo Maffione netmap=yes 267958952137SVincenzo Maffione else 268058952137SVincenzo Maffione if test "$netmap" = "yes" ; then 268158952137SVincenzo Maffione feature_not_found "netmap" 268258952137SVincenzo Maffione fi 268358952137SVincenzo Maffione netmap=no 268458952137SVincenzo Maffione fi 268558952137SVincenzo Maffionefi 268658952137SVincenzo Maffione 268758952137SVincenzo Maffione########################################## 268847e98658SCorey Bryant# libcap-ng library probe 268947e98658SCorey Bryantif test "$cap_ng" != "no" ; then 269047e98658SCorey Bryant cap_libs="-lcap-ng" 269147e98658SCorey Bryant cat > $TMPC << EOF 269247e98658SCorey Bryant#include <cap-ng.h> 269347e98658SCorey Bryantint main(void) 269447e98658SCorey Bryant{ 269547e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 269647e98658SCorey Bryant return 0; 269747e98658SCorey Bryant} 269847e98658SCorey BryantEOF 269947e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 270047e98658SCorey Bryant cap_ng=yes 270147e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 270247e98658SCorey Bryant else 270347e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 270421684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 270547e98658SCorey Bryant fi 270647e98658SCorey Bryant cap_ng=no 270747e98658SCorey Bryant fi 270847e98658SCorey Bryantfi 270947e98658SCorey Bryant 271047e98658SCorey Bryant########################################## 2711c2de5c91Smalc# Sound support libraries probe 27128f28f3fbSths 2713c2de5c91Smalcaudio_drv_probe() 2714c2de5c91Smalc{ 2715c2de5c91Smalc drv=$1 2716c2de5c91Smalc hdr=$2 2717c2de5c91Smalc lib=$3 2718c2de5c91Smalc exp=$4 2719c2de5c91Smalc cfl=$5 27208f28f3fbSths cat > $TMPC << EOF 2721c2de5c91Smalc#include <$hdr> 2722c2de5c91Smalcint main(void) { $exp } 27238f28f3fbSthsEOF 272452166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 27258f28f3fbSths : 27268f28f3fbSths else 272776ad07a4SPeter Maydell error_exit "$drv check failed" \ 272876ad07a4SPeter Maydell "Make sure to have the $drv libs and headers installed." 27298f28f3fbSths fi 2730c2de5c91Smalc} 2731c2de5c91Smalc 27322fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 2733c2de5c91Smalcfor drv in $audio_drv_list; do 2734c2de5c91Smalc case $drv in 2735c2de5c91Smalc alsa) 2736c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 2737e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 2738a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 2739c2de5c91Smalc ;; 2740c2de5c91Smalc 2741b8e59f18Smalc pa) 2742a394aed2SMarc-André Lureau audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ 2743a394aed2SMarc-André Lureau "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" 2744a394aed2SMarc-André Lureau libs_softmmu="-lpulse $libs_softmmu" 274567f86e8eSJuan Quintela audio_pt_int="yes" 2746b8e59f18Smalc ;; 2747b8e59f18Smalc 2748997e690aSJuan Quintela coreaudio) 2749997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 2750997e690aSJuan Quintela ;; 2751997e690aSJuan Quintela 2752a4bf6780SJuan Quintela dsound) 2753a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 2754d5631638Smalc audio_win_int="yes" 2755a4bf6780SJuan Quintela ;; 2756a4bf6780SJuan Quintela 2757a4bf6780SJuan Quintela oss) 2758a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 2759a4bf6780SJuan Quintela ;; 2760a4bf6780SJuan Quintela 2761a4bf6780SJuan Quintela sdl|wav) 27622f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 27632f6a1ab0Sblueswir1 ;; 27642f6a1ab0Sblueswir1 2765e4c63a6aSmalc *) 27661c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 276776ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 276876ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 2769e4c63a6aSmalc } 2770e4c63a6aSmalc ;; 2771c2de5c91Smalc esac 2772c2de5c91Smalcdone 27738f28f3fbSths 27744d3b6f6eSbalrog########################################## 27752e4d9fb1Saurel32# BrlAPI probe 27762e4d9fb1Saurel32 27774ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 2778eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 27792e4d9fb1Saurel32 cat > $TMPC << EOF 27802e4d9fb1Saurel32#include <brlapi.h> 2781832ce9c2SScott Wood#include <stddef.h> 27822e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 27832e4d9fb1Saurel32EOF 278452166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 27852e4d9fb1Saurel32 brlapi=yes 2786264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 27874ffcedb6SJuan Quintela else 27884ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 278921684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 27904ffcedb6SJuan Quintela fi 27914ffcedb6SJuan Quintela brlapi=no 2792eb82284fSJuan Quintela fi 2793eb82284fSJuan Quintelafi 27942e4d9fb1Saurel32 27952e4d9fb1Saurel32########################################## 27964d3b6f6eSbalrog# curses probe 2797a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 2798e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 2799e095e2f3SStefan Weil curses_list="-lpdcurses" 2800e095e2f3SStefan Weil else 2801cfeda5f4SEd Maste curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses" 2802e095e2f3SStefan Weil fi 2803c584a6d0SJuan Quintela curses_found=no 28044d3b6f6eSbalrog cat > $TMPC << EOF 28054d3b6f6eSbalrog#include <curses.h> 2806ef9a2524SStefan Weilint main(void) { 2807ef9a2524SStefan Weil const char *s = curses_version(); 2808ef9a2524SStefan Weil resize_term(0, 0); 2809ef9a2524SStefan Weil return s != 0; 2810ef9a2524SStefan Weil} 28114d3b6f6eSbalrogEOF 2812ecbe251fSVadim Evard IFS=: 28134f78ef9aSJuan Quintela for curses_lib in $curses_list; do 2814ecbe251fSVadim Evard unset IFS 28154f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 2816c584a6d0SJuan Quintela curses_found=yes 28174f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 28184f78ef9aSJuan Quintela break 28194d3b6f6eSbalrog fi 28204f78ef9aSJuan Quintela done 2821ecbe251fSVadim Evard unset IFS 2822c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 2823c584a6d0SJuan Quintela curses=yes 2824c584a6d0SJuan Quintela else 2825c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 282621684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 2827c584a6d0SJuan Quintela fi 2828c584a6d0SJuan Quintela curses=no 2829c584a6d0SJuan Quintela fi 28304f78ef9aSJuan Quintelafi 28314d3b6f6eSbalrog 2832414f0dabSblueswir1########################################## 2833769ce76dSAlexander Graf# curl probe 2834a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 283565d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 2836a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 28374e2b0658SPaolo Bonzini else 28384e2b0658SPaolo Bonzini curlconfig=curl-config 28394e2b0658SPaolo Bonzini fi 2840769ce76dSAlexander Graf cat > $TMPC << EOF 2841769ce76dSAlexander Graf#include <curl/curl.h> 28420b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 2843769ce76dSAlexander GrafEOF 28444e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 28454e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 2846b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 2847769ce76dSAlexander Graf curl=yes 2848788c8196SJuan Quintela else 2849788c8196SJuan Quintela if test "$curl" = "yes" ; then 285021684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 2851788c8196SJuan Quintela fi 2852788c8196SJuan Quintela curl=no 2853769ce76dSAlexander Graf fi 2854769ce76dSAlexander Graffi # test "$curl" 2855769ce76dSAlexander Graf 2856769ce76dSAlexander Graf########################################## 2857fb599c9aSbalrog# bluez support probe 2858a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 2859e820e3f4Sbalrog cat > $TMPC << EOF 2860e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 2861e820e3f4Sbalrogint main(void) { return bt_error(0); } 2862e820e3f4SbalrogEOF 2863a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 2864a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 286552166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 2866a20a6f46SJuan Quintela bluez=yes 2867e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 2868e820e3f4Sbalrog else 2869a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 287021684af0SStewart Smith feature_not_found "bluez" "Install bluez-libs/libbluetooth devel" 2871a20a6f46SJuan Quintela fi 2872e820e3f4Sbalrog bluez="no" 2873e820e3f4Sbalrog fi 2874fb599c9aSbalrogfi 2875fb599c9aSbalrog 2876fb599c9aSbalrog########################################## 2877e18df141SAnthony Liguori# glib support probe 2878a52d28afSPaolo Bonzini 2879f40685c6SJohn Snowglib_req_ver=2.22 2880aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 2881aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 2882aa0d1f44SPaolo Bonzini glib_modules="$glib_modules gmodule-2.0" 2883aa0d1f44SPaolo Bonzinifi 2884e26110cfSFam Zheng 2885aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 2886e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 2887e26110cfSFam Zheng glib_cflags=`$pkg_config --cflags $i` 2888e26110cfSFam Zheng glib_libs=`$pkg_config --libs $i` 2889ba1183daSFam Zheng CFLAGS="$glib_cflags $CFLAGS" 289014015304SAnthony Liguori LIBS="$glib_libs $LIBS" 2891957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 2892e18df141SAnthony Liguori else 2893e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 2894e26110cfSFam Zheng fi 2895e26110cfSFam Zhengdone 2896e26110cfSFam Zheng 2897977a82abSDaniel P. Berrange# Sanity check that the current size_t matches the 2898977a82abSDaniel P. Berrange# size that glib thinks it should be. This catches 2899977a82abSDaniel P. Berrange# problems on multi-arch where people try to build 2900977a82abSDaniel P. Berrange# 32-bit QEMU while pointing at 64-bit glib headers 2901977a82abSDaniel P. Berrangecat > $TMPC <<EOF 2902977a82abSDaniel P. Berrange#include <glib.h> 2903977a82abSDaniel P. Berrange#include <unistd.h> 2904977a82abSDaniel P. Berrange 2905977a82abSDaniel P. Berrange#define QEMU_BUILD_BUG_ON(x) \ 2906977a82abSDaniel P. Berrange typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); 2907977a82abSDaniel P. Berrange 2908977a82abSDaniel P. Berrangeint main(void) { 2909977a82abSDaniel P. Berrange QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T); 2910977a82abSDaniel P. Berrange return 0; 2911977a82abSDaniel P. Berrange} 2912977a82abSDaniel P. BerrangeEOF 2913977a82abSDaniel P. Berrange 2914977a82abSDaniel P. Berrangeif ! compile_prog "-Werror $CFLAGS" "$LIBS" ; then 2915977a82abSDaniel P. Berrange error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ 2916977a82abSDaniel P. Berrange "You probably need to set PKG_CONFIG_LIBDIR"\ 2917977a82abSDaniel P. Berrange "to point to the right pkg-config files for your"\ 2918977a82abSDaniel P. Berrange "build target" 2919977a82abSDaniel P. Berrangefi 2920977a82abSDaniel P. Berrange 29219d41401bSMichael S. Tsirkin# g_test_trap_subprocess added in 2.38. Used by some tests. 29229d41401bSMichael S. Tsirkinglib_subprocess=yes 29239d41401bSMichael S. Tsirkinif ! $pkg_config --atleast-version=2.38 glib-2.0; then 29249d41401bSMichael S. Tsirkin glib_subprocess=no 29259d41401bSMichael S. Tsirkinfi 29269d41401bSMichael S. Tsirkin 2927bbbf2e04SJohn Snow# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage 2928bbbf2e04SJohn Snowcat > $TMPC << EOF 2929bbbf2e04SJohn Snow#include <glib.h> 2930bbbf2e04SJohn Snowint main(void) { return 0; } 2931bbbf2e04SJohn SnowEOF 2932bbbf2e04SJohn Snowif ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then 2933bbbf2e04SJohn Snow if cc_has_warning_flag "-Wno-unknown-attributes"; then 2934bbbf2e04SJohn Snow glib_cflags="-Wno-unknown-attributes $glib_cflags" 2935bbbf2e04SJohn Snow CFLAGS="-Wno-unknown-attributes $CFLAGS" 2936bbbf2e04SJohn Snow fi 2937bbbf2e04SJohn Snowfi 2938bbbf2e04SJohn Snow 2939e26110cfSFam Zheng########################################## 2940e26110cfSFam Zheng# SHA command probe for modules 2941e26110cfSFam Zhengif test "$modules" = yes; then 2942e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 2943e26110cfSFam Zheng for c in $shacmd_probe; do 29448ccefb91SFam Zheng if has $c; then 2945e26110cfSFam Zheng shacmd="$c" 2946e26110cfSFam Zheng break 2947e26110cfSFam Zheng fi 2948e26110cfSFam Zheng done 2949e26110cfSFam Zheng if test "$shacmd" = ""; then 2950e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 2951e26110cfSFam Zheng fi 2952e18df141SAnthony Liguorifi 2953e18df141SAnthony Liguori 2954e18df141SAnthony Liguori########################################## 2955e2134eb9SGerd Hoffmann# pixman support probe 2956e2134eb9SGerd Hoffmann 2957e2134eb9SGerd Hoffmannif test "$pixman" = ""; then 295874880fe2SRobert Schiele if test "$want_tools" = "no" -a "$softmmu" = "no"; then 295974880fe2SRobert Schiele pixman="none" 2960236f282cSHu Tao elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then 2961e2134eb9SGerd Hoffmann pixman="system" 2962e2134eb9SGerd Hoffmann else 2963e2134eb9SGerd Hoffmann pixman="internal" 2964e2134eb9SGerd Hoffmann fi 2965e2134eb9SGerd Hoffmannfi 296674880fe2SRobert Schieleif test "$pixman" = "none"; then 296774880fe2SRobert Schiele if test "$want_tools" != "no" -o "$softmmu" != "no"; then 296876ad07a4SPeter Maydell error_exit "pixman disabled but system emulation or tools build" \ 296976ad07a4SPeter Maydell "enabled. You can turn off pixman only if you also" \ 297076ad07a4SPeter Maydell "disable all system emulation targets and the tools" \ 297176ad07a4SPeter Maydell "build with '--disable-tools --disable-system'." 297274880fe2SRobert Schiele fi 297374880fe2SRobert Schiele pixman_cflags= 297474880fe2SRobert Schiele pixman_libs= 297574880fe2SRobert Schieleelif test "$pixman" = "system"; then 2976236f282cSHu Tao # pixman version has been checked above 2977ca871ec8SStefan Weil pixman_cflags=`$pkg_config --cflags pixman-1` 2978ca871ec8SStefan Weil pixman_libs=`$pkg_config --libs pixman-1` 2979e2134eb9SGerd Hoffmannelse 2980e2134eb9SGerd Hoffmann if test ! -d ${source_path}/pixman/pixman; then 2981236f282cSHu Tao error_exit "pixman >= 0.21.8 not present. Your options:" \ 298276ad07a4SPeter Maydell " (1) Preferred: Install the pixman devel package (any recent" \ 298376ad07a4SPeter Maydell " distro should have packages as Xorg needs pixman too)." \ 298476ad07a4SPeter Maydell " (2) Fetch the pixman submodule, using:" \ 298576ad07a4SPeter Maydell " git submodule update --init pixman" 2986e2134eb9SGerd Hoffmann fi 29875ca9388aSGerd Hoffmann mkdir -p pixman/pixman 29885ca9388aSGerd Hoffmann pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman" 29895ca9388aSGerd Hoffmann pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1" 2990e2134eb9SGerd Hoffmannfi 2991e2134eb9SGerd Hoffmann 2992e2134eb9SGerd Hoffmann########################################## 299317bff52bSM. Mohan Kumar# libcap probe 299417bff52bSM. Mohan Kumar 299517bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 299617bff52bSM. Mohan Kumar cat > $TMPC <<EOF 299717bff52bSM. Mohan Kumar#include <stdio.h> 299817bff52bSM. Mohan Kumar#include <sys/capability.h> 2999cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 300017bff52bSM. Mohan KumarEOF 300117bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 300217bff52bSM. Mohan Kumar cap=yes 300317bff52bSM. Mohan Kumar else 300417bff52bSM. Mohan Kumar cap=no 300517bff52bSM. Mohan Kumar fi 300617bff52bSM. Mohan Kumarfi 300717bff52bSM. Mohan Kumar 300817bff52bSM. Mohan Kumar########################################## 3009e5d355d1Saliguori# pthread probe 30104b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 30113c529d93Saliguori 3012e5d355d1Saliguoripthread=no 3013414f0dabSblueswir1cat > $TMPC << EOF 30143c529d93Saliguori#include <pthread.h> 30157a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 30167a42bbe4SStefan Weilint main(void) { 30177a42bbe4SStefan Weil pthread_t thread; 30187a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 30197a42bbe4SStefan Weil return 0; 30207a42bbe4SStefan Weil} 3021414f0dabSblueswir1EOF 3022bd00d539SAndreas Färberif compile_prog "" "" ; then 3023bd00d539SAndreas Färber pthread=yes 3024bd00d539SAndreas Färberelse 3025de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 302652166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 3027e5d355d1Saliguori pthread=yes 3028e3c56761SPeter Portante found=no 3029e3c56761SPeter Portante for lib_entry in $LIBS; do 3030e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 3031e3c56761SPeter Portante found=yes 3032e3c56761SPeter Portante break 3033e3c56761SPeter Portante fi 3034e3c56761SPeter Portante done 3035e3c56761SPeter Portante if test "$found" = "no"; then 30365572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 3037e3c56761SPeter Portante fi 3038de65fe0fSSebastian Herbszt break 3039414f0dabSblueswir1 fi 3040de65fe0fSSebastian Herbszt done 3041bd00d539SAndreas Färberfi 3042414f0dabSblueswir1 30434617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 304476ad07a4SPeter Maydell error_exit "pthread check failed" \ 304576ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 3046e5d355d1Saliguorifi 3047e5d355d1Saliguori 30485c312079SDr. David Alan Gilbert# check for pthread_setname_np 30495c312079SDr. David Alan Gilbertpthread_setname_np=no 30505c312079SDr. David Alan Gilbertcat > $TMPC << EOF 30515c312079SDr. David Alan Gilbert#include <pthread.h> 30525c312079SDr. David Alan Gilbert 30535c312079SDr. David Alan Gilbertstatic void *f(void *p) { return NULL; } 30545c312079SDr. David Alan Gilbertint main(void) 30555c312079SDr. David Alan Gilbert{ 30565c312079SDr. David Alan Gilbert pthread_t thread; 30575c312079SDr. David Alan Gilbert pthread_create(&thread, 0, f, 0); 30585c312079SDr. David Alan Gilbert pthread_setname_np(thread, "QEMU"); 30595c312079SDr. David Alan Gilbert return 0; 30605c312079SDr. David Alan Gilbert} 30615c312079SDr. David Alan GilbertEOF 30625c312079SDr. David Alan Gilbertif compile_prog "" "$pthread_lib" ; then 30635c312079SDr. David Alan Gilbert pthread_setname_np=yes 30645c312079SDr. David Alan Gilbertfi 30655c312079SDr. David Alan Gilbert 3066bf9298b9Saliguori########################################## 3067f27aaf4bSChristian Brunner# rbd probe 3068f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 3069f27aaf4bSChristian Brunner cat > $TMPC <<EOF 3070f27aaf4bSChristian Brunner#include <stdio.h> 3071ad32e9c0SJosh Durgin#include <rbd/librbd.h> 3072f27aaf4bSChristian Brunnerint main(void) { 3073ad32e9c0SJosh Durgin rados_t cluster; 3074ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 3075f27aaf4bSChristian Brunner return 0; 3076f27aaf4bSChristian Brunner} 3077f27aaf4bSChristian BrunnerEOF 3078ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 3079f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 3080f27aaf4bSChristian Brunner rbd=yes 3081f27aaf4bSChristian Brunner else 3082f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 308321684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 3084f27aaf4bSChristian Brunner fi 3085f27aaf4bSChristian Brunner rbd=no 3086f27aaf4bSChristian Brunner fi 3087f27aaf4bSChristian Brunnerfi 3088f27aaf4bSChristian Brunner 3089f27aaf4bSChristian Brunner########################################## 30900a12ec87SRichard W.M. Jones# libssh2 probe 30914fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8 30920a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then 309365d5d3f9SStefan Weil if $pkg_config --atleast-version=$min_libssh2_version libssh2; then 30940a12ec87SRichard W.M. Jones libssh2_cflags=`$pkg_config libssh2 --cflags` 30950a12ec87SRichard W.M. Jones libssh2_libs=`$pkg_config libssh2 --libs` 30960a12ec87SRichard W.M. Jones libssh2=yes 30970a12ec87SRichard W.M. Jones else 30980a12ec87SRichard W.M. Jones if test "$libssh2" = "yes" ; then 30994fc16838SRichard W.M. Jones error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" 31000a12ec87SRichard W.M. Jones fi 31010a12ec87SRichard W.M. Jones libssh2=no 31020a12ec87SRichard W.M. Jones fi 31030a12ec87SRichard W.M. Jonesfi 31040a12ec87SRichard W.M. Jones 31050a12ec87SRichard W.M. Jones########################################## 31069a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe 31079a2d462eSRichard W.M. Jones 31089a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then 31099a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 31109a2d462eSRichard W.M. Jones#include <stdio.h> 31119a2d462eSRichard W.M. Jones#include <libssh2.h> 31129a2d462eSRichard W.M. Jones#include <libssh2_sftp.h> 31139a2d462eSRichard W.M. Jonesint main(void) { 31149a2d462eSRichard W.M. Jones LIBSSH2_SESSION *session; 31159a2d462eSRichard W.M. Jones LIBSSH2_SFTP *sftp; 31169a2d462eSRichard W.M. Jones LIBSSH2_SFTP_HANDLE *sftp_handle; 31179a2d462eSRichard W.M. Jones session = libssh2_session_init (); 31189a2d462eSRichard W.M. Jones sftp = libssh2_sftp_init (session); 31199a2d462eSRichard W.M. Jones sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); 31209a2d462eSRichard W.M. Jones libssh2_sftp_fsync (sftp_handle); 31219a2d462eSRichard W.M. Jones return 0; 31229a2d462eSRichard W.M. Jones} 31239a2d462eSRichard W.M. JonesEOF 31249a2d462eSRichard W.M. Jones # libssh2_cflags/libssh2_libs defined in previous test. 31259a2d462eSRichard W.M. Jones if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then 31269a2d462eSRichard W.M. Jones QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" 31279a2d462eSRichard W.M. Jones fi 31289a2d462eSRichard W.M. Jonesfi 31299a2d462eSRichard W.M. Jones 31309a2d462eSRichard W.M. Jones########################################## 31315c6c3a6cSChristoph Hellwig# linux-aio probe 31325c6c3a6cSChristoph Hellwig 31335c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 31345c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 31355c6c3a6cSChristoph Hellwig#include <libaio.h> 31365c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 3137832ce9c2SScott Wood#include <stddef.h> 31385c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 31395c6c3a6cSChristoph HellwigEOF 31405c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 31415c6c3a6cSChristoph Hellwig linux_aio=yes 31425c6c3a6cSChristoph Hellwig else 31435c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 314421684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 31455c6c3a6cSChristoph Hellwig fi 31463cfcae3cSLuiz Capitulino linux_aio=no 31475c6c3a6cSChristoph Hellwig fi 31485c6c3a6cSChristoph Hellwigfi 31495c6c3a6cSChristoph Hellwig 31505c6c3a6cSChristoph Hellwig########################################## 31513b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux 31523b8acc11SPaolo Bonzini 31533b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then 31543b8acc11SPaolo Bonzini tpm_passthrough=$tpm 31553b8acc11SPaolo Bonzinielse 31563b8acc11SPaolo Bonzini tpm_passthrough=no 31573b8acc11SPaolo Bonzinifi 31583b8acc11SPaolo Bonzini 31593b8acc11SPaolo Bonzini########################################## 3160758e8e38SVenkateswararao Jujjuri (JV)# attr probe 3161758e8e38SVenkateswararao Jujjuri (JV) 3162758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 3163758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 3164758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 3165758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 3166f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 3167f2338fb4SPavel Borzenkov#include <attr/xattr.h> 3168f2338fb4SPavel Borzenkov#else 31694f26f2b6SAvi Kivity#include <sys/xattr.h> 3170f2338fb4SPavel Borzenkov#endif 3171758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 3172758e8e38SVenkateswararao Jujjuri (JV)EOF 31734f26f2b6SAvi Kivity if compile_prog "" "" ; then 31744f26f2b6SAvi Kivity attr=yes 31754f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 3176f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 3177758e8e38SVenkateswararao Jujjuri (JV) attr=yes 3178758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 31794f26f2b6SAvi Kivity libattr=yes 3180758e8e38SVenkateswararao Jujjuri (JV) else 3181758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 318221684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 3183758e8e38SVenkateswararao Jujjuri (JV) fi 3184758e8e38SVenkateswararao Jujjuri (JV) attr=no 3185758e8e38SVenkateswararao Jujjuri (JV) fi 3186758e8e38SVenkateswararao Jujjuri (JV)fi 3187758e8e38SVenkateswararao Jujjuri (JV) 3188758e8e38SVenkateswararao Jujjuri (JV)########################################## 3189bf9298b9Saliguori# iovec probe 3190bf9298b9Saliguoricat > $TMPC <<EOF 3191db34f0b3Sblueswir1#include <sys/types.h> 3192bf9298b9Saliguori#include <sys/uio.h> 3193db34f0b3Sblueswir1#include <unistd.h> 3194f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 3195bf9298b9SaliguoriEOF 3196bf9298b9Saliguoriiovec=no 319752166aa0SJuan Quintelaif compile_prog "" "" ; then 3198bf9298b9Saliguori iovec=yes 3199bf9298b9Saliguorifi 3200bf9298b9Saliguori 3201f652e6afSaurel32########################################## 3202ceb42de8Saliguori# preadv probe 3203ceb42de8Saliguoricat > $TMPC <<EOF 3204ceb42de8Saliguori#include <sys/types.h> 3205ceb42de8Saliguori#include <sys/uio.h> 3206ceb42de8Saliguori#include <unistd.h> 3207c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 3208ceb42de8SaliguoriEOF 3209ceb42de8Saliguoripreadv=no 321052166aa0SJuan Quintelaif compile_prog "" "" ; then 3211ceb42de8Saliguori preadv=yes 3212ceb42de8Saliguorifi 3213ceb42de8Saliguori 3214ceb42de8Saliguori########################################## 3215f652e6afSaurel32# fdt probe 3216e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 3217e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 3218e169e1e1SPeter Maydellfdt_required=no 3219e169e1e1SPeter Maydellfor target in $target_list; do 3220e169e1e1SPeter Maydell case $target in 32216a49fa95SAlexander Graf aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu) 3222e169e1e1SPeter Maydell fdt_required=yes 3223e169e1e1SPeter Maydell ;; 3224e169e1e1SPeter Maydell esac 3225e169e1e1SPeter Maydelldone 3226e169e1e1SPeter Maydell 3227e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 3228e169e1e1SPeter Maydell if test "$fdt" = "no"; then 3229e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 3230e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 3231e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 3232e169e1e1SPeter Maydell fi 3233e169e1e1SPeter Maydell fdt=yes 3234e169e1e1SPeter Maydellfi 3235e169e1e1SPeter Maydell 32362df87df7SJuan Quintelaif test "$fdt" != "no" ; then 3237b41af4baSJuan Quintela fdt_libs="-lfdt" 323896ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 323931ce0adbSThomas Huth # and test for required functions to make sure we are on a version >= 1.4.0 3240f652e6afSaurel32 cat > $TMPC << EOF 324131ce0adbSThomas Huth#include <libfdt.h> 324296ce6545SPeter Crosthwaite#include <libfdt_env.h> 324331ce0adbSThomas Huthint main(void) { fdt_get_property_by_offset(0, 0, 0); return 0; } 3244f652e6afSaurel32EOF 324552166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 3246a540f158SPeter Crosthwaite # system DTC is good - use it 3247f652e6afSaurel32 fdt=yes 3248a540f158SPeter Crosthwaite elif test -d ${source_path}/dtc/libfdt ; then 3249a540f158SPeter Crosthwaite # have submodule DTC - use it 3250a540f158SPeter Crosthwaite fdt=yes 3251a540f158SPeter Crosthwaite dtc_internal="yes" 3252a540f158SPeter Crosthwaite mkdir -p dtc 3253cab00a5aSMichael S. Tsirkin if [ "$pwd_is_source_path" != "y" ] ; then 3254a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 3255a540f158SPeter Crosthwaite symlink "$source_path/dtc/scripts" "dtc/scripts" 32562df87df7SJuan Quintela fi 3257a540f158SPeter Crosthwaite fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 3258a540f158SPeter Crosthwaite fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" 3259a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 3260a540f158SPeter Crosthwaite # have neither and want - prompt for system/submodule install 326131ce0adbSThomas Huth error_exit "DTC (libfdt) version >= 1.4.0 not present. Your options:" \ 32623f281822SStewart Smith " (1) Preferred: Install the DTC (libfdt) devel package" \ 3263a540f158SPeter Crosthwaite " (2) Fetch the DTC submodule, using:" \ 3264a540f158SPeter Crosthwaite " git submodule update --init dtc" 3265a540f158SPeter Crosthwaite else 3266a540f158SPeter Crosthwaite # don't have and don't want 3267de3a354aSMichael Walle fdt_libs= 32682df87df7SJuan Quintela fdt=no 3269f652e6afSaurel32 fi 3270f652e6afSaurel32fi 3271f652e6afSaurel32 3272a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 3273a540f158SPeter Crosthwaite 327420ff075bSMichael Walle########################################## 3275fb719563SOGAWA Hirofumi# opengl probe (for sdl2, gtk, milkymist-tmu2) 3276b1546f32SGerd Hoffmann 3277da076ffeSGerd Hoffmannif test "$opengl" != "no" ; then 3278*014cb152SGerd Hoffmann opengl_pkgs="epoxy libdrm gbm" 3279fb719563SOGAWA Hirofumi if $pkg_config $opengl_pkgs x11; then 3280f676c67eSJeremy White opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags" 3281f676c67eSJeremy White opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs" 3282da076ffeSGerd Hoffmann opengl=yes 3283925a0400SGerd Hoffmann if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then 3284925a0400SGerd Hoffmann gtk_gl="yes" 3285925a0400SGerd Hoffmann fi 328620ff075bSMichael Walle else 3287da076ffeSGerd Hoffmann if test "$opengl" = "yes" ; then 3288dcf30025SGerd Hoffmann feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" 328920ff075bSMichael Walle fi 3290f676c67eSJeremy White opengl_cflags="" 3291da076ffeSGerd Hoffmann opengl_libs="" 3292da076ffeSGerd Hoffmann opengl=no 329320ff075bSMichael Walle fi 329420ff075bSMichael Wallefi 329520ff075bSMichael Walle 3296*014cb152SGerd Hoffmannif test "$opengl" = "yes"; then 3297*014cb152SGerd Hoffmann cat > $TMPC << EOF 3298*014cb152SGerd Hoffmann#include <epoxy/egl.h> 3299*014cb152SGerd Hoffmann#ifndef EGL_MESA_image_dma_buf_export 3300*014cb152SGerd Hoffmann# error mesa/epoxy lacks support for dmabufs (mesa 10.6+) 3301*014cb152SGerd Hoffmann#endif 3302*014cb152SGerd Hoffmannint main(void) { return 0; } 3303*014cb152SGerd HoffmannEOF 3304*014cb152SGerd Hoffmann if compile_prog "" "" ; then 3305*014cb152SGerd Hoffmann opengl_dmabuf=yes 3306*014cb152SGerd Hoffmann fi 3307*014cb152SGerd Hoffmannfi 3308c9a12e75SChrysostomos Nanakos 3309c9a12e75SChrysostomos Nanakos########################################## 3310c9a12e75SChrysostomos Nanakos# archipelago probe 3311c9a12e75SChrysostomos Nanakosif test "$archipelago" != "no" ; then 3312c9a12e75SChrysostomos Nanakos cat > $TMPC <<EOF 3313c9a12e75SChrysostomos Nanakos#include <stdio.h> 3314c9a12e75SChrysostomos Nanakos#include <xseg/xseg.h> 3315c9a12e75SChrysostomos Nanakos#include <xseg/protocol.h> 3316c9a12e75SChrysostomos Nanakosint main(void) { 3317c9a12e75SChrysostomos Nanakos xseg_initialize(); 3318c9a12e75SChrysostomos Nanakos return 0; 3319c9a12e75SChrysostomos Nanakos} 3320c9a12e75SChrysostomos NanakosEOF 3321c9a12e75SChrysostomos Nanakos archipelago_libs=-lxseg 3322c9a12e75SChrysostomos Nanakos if compile_prog "" "$archipelago_libs"; then 3323c9a12e75SChrysostomos Nanakos archipelago="yes" 3324c9a12e75SChrysostomos Nanakos libs_tools="$archipelago_libs $libs_tools" 3325c9a12e75SChrysostomos Nanakos libs_softmmu="$archipelago_libs $libs_softmmu" 33266a460ed1SStefan Hajnoczi 33276a460ed1SStefan Hajnoczi echo "WARNING: Please check the licenses of QEMU and libxseg carefully." 33286a460ed1SStefan Hajnoczi echo "GPLv3 versions of libxseg may not be compatible with QEMU's" 33296a460ed1SStefan Hajnoczi echo "license and therefore prevent redistribution." 33306a460ed1SStefan Hajnoczi echo 33316a460ed1SStefan Hajnoczi echo "To disable Archipelago, use --disable-archipelago" 3332c9a12e75SChrysostomos Nanakos else 3333c9a12e75SChrysostomos Nanakos if test "$archipelago" = "yes" ; then 3334c9a12e75SChrysostomos Nanakos feature_not_found "Archipelago backend support" "Install libxseg devel" 3335c9a12e75SChrysostomos Nanakos fi 3336c9a12e75SChrysostomos Nanakos archipelago="no" 3337c9a12e75SChrysostomos Nanakos fi 3338c9a12e75SChrysostomos Nanakosfi 3339c9a12e75SChrysostomos Nanakos 3340c9a12e75SChrysostomos Nanakos 3341eb100396SBharata B Rao########################################## 3342eb100396SBharata B Rao# glusterfs probe 3343eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 334465d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 3345e01bee08SBharata B Rao glusterfs="yes" 3346ca871ec8SStefan Weil glusterfs_cflags=`$pkg_config --cflags glusterfs-api` 3347ca871ec8SStefan Weil glusterfs_libs=`$pkg_config --libs glusterfs-api` 334865d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 33490c14fb47SBharata B Rao glusterfs_discard="yes" 33500c14fb47SBharata B Rao fi 33517c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 33527c815372SBharata B Rao glusterfs_zerofill="yes" 33537c815372SBharata B Rao fi 3354eb100396SBharata B Rao else 3355eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 33568efc9363SHu Tao feature_not_found "GlusterFS backend support" \ 33578efc9363SHu Tao "Install glusterfs-api devel >= 3" 3358eb100396SBharata B Rao fi 3359e01bee08SBharata B Rao glusterfs="no" 3360eb100396SBharata B Rao fi 3361eb100396SBharata B Raofi 3362eb100396SBharata B Rao 336339386ac7Saurel32# Check for inotify functions when we are building linux-user 33643b3f24adSaurel32# emulator. This is done because older glibc versions don't 33653b3f24adSaurel32# have syscall stubs for these implemented. In that case we 33663b3f24adSaurel32# don't provide them even if kernel supports them. 33673b3f24adSaurel32# 33683b3f24adSaurel32inotify=no 33693b3f24adSaurel32cat > $TMPC << EOF 33703b3f24adSaurel32#include <sys/inotify.h> 33713b3f24adSaurel32 33723b3f24adSaurel32int 33733b3f24adSaurel32main(void) 33743b3f24adSaurel32{ 33753b3f24adSaurel32 /* try to start inotify */ 33768690e420Saurel32 return inotify_init(); 33773b3f24adSaurel32} 33783b3f24adSaurel32EOF 337952166aa0SJuan Quintelaif compile_prog "" "" ; then 33803b3f24adSaurel32 inotify=yes 33813b3f24adSaurel32fi 33823b3f24adSaurel32 3383c05c7a73SRiku Voipioinotify1=no 3384c05c7a73SRiku Voipiocat > $TMPC << EOF 3385c05c7a73SRiku Voipio#include <sys/inotify.h> 3386c05c7a73SRiku Voipio 3387c05c7a73SRiku Voipioint 3388c05c7a73SRiku Voipiomain(void) 3389c05c7a73SRiku Voipio{ 3390c05c7a73SRiku Voipio /* try to start inotify */ 3391c05c7a73SRiku Voipio return inotify_init1(0); 3392c05c7a73SRiku Voipio} 3393c05c7a73SRiku VoipioEOF 3394c05c7a73SRiku Voipioif compile_prog "" "" ; then 3395c05c7a73SRiku Voipio inotify1=yes 3396c05c7a73SRiku Voipiofi 3397c05c7a73SRiku Voipio 3398ebc996f3SRiku Voipio# check if utimensat and futimens are supported 3399ebc996f3SRiku Voipioutimens=no 3400ebc996f3SRiku Voipiocat > $TMPC << EOF 3401ebc996f3SRiku Voipio#define _ATFILE_SOURCE 3402ebc996f3SRiku Voipio#include <stddef.h> 3403ebc996f3SRiku Voipio#include <fcntl.h> 34043014ee00SPeter Maydell#include <sys/stat.h> 3405ebc996f3SRiku Voipio 3406ebc996f3SRiku Voipioint main(void) 3407ebc996f3SRiku Voipio{ 3408ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 3409ebc996f3SRiku Voipio futimens(0, NULL); 3410ebc996f3SRiku Voipio return 0; 3411ebc996f3SRiku Voipio} 3412ebc996f3SRiku VoipioEOF 341352166aa0SJuan Quintelaif compile_prog "" "" ; then 3414ebc996f3SRiku Voipio utimens=yes 3415ebc996f3SRiku Voipiofi 3416ebc996f3SRiku Voipio 3417099d6b0fSRiku Voipio# check if pipe2 is there 3418099d6b0fSRiku Voipiopipe2=no 3419099d6b0fSRiku Voipiocat > $TMPC << EOF 3420099d6b0fSRiku Voipio#include <unistd.h> 3421099d6b0fSRiku Voipio#include <fcntl.h> 3422099d6b0fSRiku Voipio 3423099d6b0fSRiku Voipioint main(void) 3424099d6b0fSRiku Voipio{ 3425099d6b0fSRiku Voipio int pipefd[2]; 34269bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 3427099d6b0fSRiku Voipio} 3428099d6b0fSRiku VoipioEOF 342952166aa0SJuan Quintelaif compile_prog "" "" ; then 3430099d6b0fSRiku Voipio pipe2=yes 3431099d6b0fSRiku Voipiofi 3432099d6b0fSRiku Voipio 343340ff6d7eSKevin Wolf# check if accept4 is there 343440ff6d7eSKevin Wolfaccept4=no 343540ff6d7eSKevin Wolfcat > $TMPC << EOF 343640ff6d7eSKevin Wolf#include <sys/socket.h> 343740ff6d7eSKevin Wolf#include <stddef.h> 343840ff6d7eSKevin Wolf 343940ff6d7eSKevin Wolfint main(void) 344040ff6d7eSKevin Wolf{ 344140ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 344240ff6d7eSKevin Wolf return 0; 344340ff6d7eSKevin Wolf} 344440ff6d7eSKevin WolfEOF 344540ff6d7eSKevin Wolfif compile_prog "" "" ; then 344640ff6d7eSKevin Wolf accept4=yes 344740ff6d7eSKevin Wolffi 344840ff6d7eSKevin Wolf 34493ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 34503ce34dfbSvibisreenivasansplice=no 34513ce34dfbSvibisreenivasancat > $TMPC << EOF 34523ce34dfbSvibisreenivasan#include <unistd.h> 34533ce34dfbSvibisreenivasan#include <fcntl.h> 34543ce34dfbSvibisreenivasan#include <limits.h> 34553ce34dfbSvibisreenivasan 34563ce34dfbSvibisreenivasanint main(void) 34573ce34dfbSvibisreenivasan{ 345866ea0f22SStefan Weil int len, fd = 0; 34593ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 34603ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 34613ce34dfbSvibisreenivasan return 0; 34623ce34dfbSvibisreenivasan} 34633ce34dfbSvibisreenivasanEOF 346452166aa0SJuan Quintelaif compile_prog "" "" ; then 34653ce34dfbSvibisreenivasan splice=yes 34663ce34dfbSvibisreenivasanfi 34673ce34dfbSvibisreenivasan 3468dcc38d1cSMarcelo Tosatti########################################## 3469a99d57bbSWanlong Gao# libnuma probe 3470a99d57bbSWanlong Gao 3471a99d57bbSWanlong Gaoif test "$numa" != "no" ; then 3472a99d57bbSWanlong Gao cat > $TMPC << EOF 3473a99d57bbSWanlong Gao#include <numa.h> 3474a99d57bbSWanlong Gaoint main(void) { return numa_available(); } 3475a99d57bbSWanlong GaoEOF 3476a99d57bbSWanlong Gao 3477a99d57bbSWanlong Gao if compile_prog "" "-lnuma" ; then 3478a99d57bbSWanlong Gao numa=yes 3479a99d57bbSWanlong Gao libs_softmmu="-lnuma $libs_softmmu" 3480a99d57bbSWanlong Gao else 3481a99d57bbSWanlong Gao if test "$numa" = "yes" ; then 3482a99d57bbSWanlong Gao feature_not_found "numa" "install numactl devel" 3483a99d57bbSWanlong Gao fi 3484a99d57bbSWanlong Gao numa=no 3485a99d57bbSWanlong Gao fi 3486a99d57bbSWanlong Gaofi 3487a99d57bbSWanlong Gao 34887b01cb97SAlexandre Derumierif test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then 34897b01cb97SAlexandre Derumier echo "ERROR: tcmalloc && jemalloc can't be used at the same time" 34907b01cb97SAlexandre Derumier exit 1 34917b01cb97SAlexandre Derumierfi 34927b01cb97SAlexandre Derumier 3493a99d57bbSWanlong Gao########################################## 34942847b469SFam Zheng# tcmalloc probe 34952847b469SFam Zheng 34962847b469SFam Zhengif test "$tcmalloc" = "yes" ; then 34972847b469SFam Zheng cat > $TMPC << EOF 34982847b469SFam Zheng#include <stdlib.h> 34992847b469SFam Zhengint main(void) { malloc(1); return 0; } 35002847b469SFam ZhengEOF 35012847b469SFam Zheng 35022847b469SFam Zheng if compile_prog "" "-ltcmalloc" ; then 35032847b469SFam Zheng LIBS="-ltcmalloc $LIBS" 35042847b469SFam Zheng else 35052847b469SFam Zheng feature_not_found "tcmalloc" "install gperftools devel" 35062847b469SFam Zheng fi 35072847b469SFam Zhengfi 35082847b469SFam Zheng 35092847b469SFam Zheng########################################## 35107b01cb97SAlexandre Derumier# jemalloc probe 35117b01cb97SAlexandre Derumier 35127b01cb97SAlexandre Derumierif test "$jemalloc" = "yes" ; then 35137b01cb97SAlexandre Derumier cat > $TMPC << EOF 35147b01cb97SAlexandre Derumier#include <stdlib.h> 35157b01cb97SAlexandre Derumierint main(void) { malloc(1); return 0; } 35167b01cb97SAlexandre DerumierEOF 35177b01cb97SAlexandre Derumier 35187b01cb97SAlexandre Derumier if compile_prog "" "-ljemalloc" ; then 35197b01cb97SAlexandre Derumier LIBS="-ljemalloc $LIBS" 35207b01cb97SAlexandre Derumier else 35217b01cb97SAlexandre Derumier feature_not_found "jemalloc" "install jemalloc devel" 35227b01cb97SAlexandre Derumier fi 35237b01cb97SAlexandre Derumierfi 35247b01cb97SAlexandre Derumier 35257b01cb97SAlexandre Derumier########################################## 3526dcc38d1cSMarcelo Tosatti# signalfd probe 3527dcc38d1cSMarcelo Tosattisignalfd="no" 3528dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 3529dcc38d1cSMarcelo Tosatti#include <unistd.h> 3530dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 3531dcc38d1cSMarcelo Tosatti#include <signal.h> 3532dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 3533dcc38d1cSMarcelo TosattiEOF 3534dcc38d1cSMarcelo Tosatti 3535dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 3536dcc38d1cSMarcelo Tosatti signalfd=yes 3537dcc38d1cSMarcelo Tosattifi 3538dcc38d1cSMarcelo Tosatti 3539c2882b96SRiku Voipio# check if eventfd is supported 3540c2882b96SRiku Voipioeventfd=no 3541c2882b96SRiku Voipiocat > $TMPC << EOF 3542c2882b96SRiku Voipio#include <sys/eventfd.h> 3543c2882b96SRiku Voipio 3544c2882b96SRiku Voipioint main(void) 3545c2882b96SRiku Voipio{ 354655cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 3547c2882b96SRiku Voipio} 3548c2882b96SRiku VoipioEOF 3549c2882b96SRiku Voipioif compile_prog "" "" ; then 3550c2882b96SRiku Voipio eventfd=yes 3551c2882b96SRiku Voipiofi 3552c2882b96SRiku Voipio 3553751bcc39SMarc-André Lureau# check if memfd is supported 3554751bcc39SMarc-André Lureaumemfd=no 3555751bcc39SMarc-André Lureaucat > $TMPC << EOF 3556751bcc39SMarc-André Lureau#include <sys/memfd.h> 3557751bcc39SMarc-André Lureau 3558751bcc39SMarc-André Lureauint main(void) 3559751bcc39SMarc-André Lureau{ 3560751bcc39SMarc-André Lureau return memfd_create("foo", MFD_ALLOW_SEALING); 3561751bcc39SMarc-André Lureau} 3562751bcc39SMarc-André LureauEOF 3563751bcc39SMarc-André Lureauif compile_prog "" "" ; then 3564751bcc39SMarc-André Lureau memfd=yes 3565751bcc39SMarc-André Lureaufi 3566751bcc39SMarc-André Lureau 3567751bcc39SMarc-André Lureau 3568751bcc39SMarc-André Lureau 3569d0927938SUlrich Hecht# check for fallocate 3570d0927938SUlrich Hechtfallocate=no 3571d0927938SUlrich Hechtcat > $TMPC << EOF 3572d0927938SUlrich Hecht#include <fcntl.h> 3573d0927938SUlrich Hecht 3574d0927938SUlrich Hechtint main(void) 3575d0927938SUlrich Hecht{ 3576d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 3577d0927938SUlrich Hecht return 0; 3578d0927938SUlrich Hecht} 3579d0927938SUlrich HechtEOF 35808fb03151SPeter Maydellif compile_prog "" "" ; then 3581d0927938SUlrich Hecht fallocate=yes 3582d0927938SUlrich Hechtfi 3583d0927938SUlrich Hecht 35843d4fa43eSKusanagi Kouichi# check for fallocate hole punching 35853d4fa43eSKusanagi Kouichifallocate_punch_hole=no 35863d4fa43eSKusanagi Kouichicat > $TMPC << EOF 35873d4fa43eSKusanagi Kouichi#include <fcntl.h> 35883d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 35893d4fa43eSKusanagi Kouichi 35903d4fa43eSKusanagi Kouichiint main(void) 35913d4fa43eSKusanagi Kouichi{ 35923d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 35933d4fa43eSKusanagi Kouichi return 0; 35943d4fa43eSKusanagi Kouichi} 35953d4fa43eSKusanagi KouichiEOF 35963d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 35973d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 35983d4fa43eSKusanagi Kouichifi 35993d4fa43eSKusanagi Kouichi 3600b953f075SDenis V. Lunev# check that fallocate supports range zeroing inside the file 3601b953f075SDenis V. Lunevfallocate_zero_range=no 3602b953f075SDenis V. Lunevcat > $TMPC << EOF 3603b953f075SDenis V. Lunev#include <fcntl.h> 3604b953f075SDenis V. Lunev#include <linux/falloc.h> 3605b953f075SDenis V. Lunev 3606b953f075SDenis V. Lunevint main(void) 3607b953f075SDenis V. Lunev{ 3608b953f075SDenis V. Lunev fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0); 3609b953f075SDenis V. Lunev return 0; 3610b953f075SDenis V. Lunev} 3611b953f075SDenis V. LunevEOF 3612b953f075SDenis V. Lunevif compile_prog "" "" ; then 3613b953f075SDenis V. Lunev fallocate_zero_range=yes 3614b953f075SDenis V. Lunevfi 3615b953f075SDenis V. Lunev 3616ed911435SKevin Wolf# check for posix_fallocate 3617ed911435SKevin Wolfposix_fallocate=no 3618ed911435SKevin Wolfcat > $TMPC << EOF 3619ed911435SKevin Wolf#include <fcntl.h> 3620ed911435SKevin Wolf 3621ed911435SKevin Wolfint main(void) 3622ed911435SKevin Wolf{ 3623ed911435SKevin Wolf posix_fallocate(0, 0, 0); 3624ed911435SKevin Wolf return 0; 3625ed911435SKevin Wolf} 3626ed911435SKevin WolfEOF 3627ed911435SKevin Wolfif compile_prog "" "" ; then 3628ed911435SKevin Wolf posix_fallocate=yes 3629ed911435SKevin Wolffi 3630ed911435SKevin Wolf 3631c727f47dSPeter Maydell# check for sync_file_range 3632c727f47dSPeter Maydellsync_file_range=no 3633c727f47dSPeter Maydellcat > $TMPC << EOF 3634c727f47dSPeter Maydell#include <fcntl.h> 3635c727f47dSPeter Maydell 3636c727f47dSPeter Maydellint main(void) 3637c727f47dSPeter Maydell{ 3638c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 3639c727f47dSPeter Maydell return 0; 3640c727f47dSPeter Maydell} 3641c727f47dSPeter MaydellEOF 36428fb03151SPeter Maydellif compile_prog "" "" ; then 3643c727f47dSPeter Maydell sync_file_range=yes 3644c727f47dSPeter Maydellfi 3645c727f47dSPeter Maydell 3646dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 3647dace20dcSPeter Maydellfiemap=no 3648dace20dcSPeter Maydellcat > $TMPC << EOF 3649dace20dcSPeter Maydell#include <sys/ioctl.h> 3650dace20dcSPeter Maydell#include <linux/fs.h> 3651dace20dcSPeter Maydell#include <linux/fiemap.h> 3652dace20dcSPeter Maydell 3653dace20dcSPeter Maydellint main(void) 3654dace20dcSPeter Maydell{ 3655dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 3656dace20dcSPeter Maydell return 0; 3657dace20dcSPeter Maydell} 3658dace20dcSPeter MaydellEOF 36598fb03151SPeter Maydellif compile_prog "" "" ; then 3660dace20dcSPeter Maydell fiemap=yes 3661dace20dcSPeter Maydellfi 3662dace20dcSPeter Maydell 3663d0927938SUlrich Hecht# check for dup3 3664d0927938SUlrich Hechtdup3=no 3665d0927938SUlrich Hechtcat > $TMPC << EOF 3666d0927938SUlrich Hecht#include <unistd.h> 3667d0927938SUlrich Hecht 3668d0927938SUlrich Hechtint main(void) 3669d0927938SUlrich Hecht{ 3670d0927938SUlrich Hecht dup3(0, 0, 0); 3671d0927938SUlrich Hecht return 0; 3672d0927938SUlrich Hecht} 3673d0927938SUlrich HechtEOF 367478f5d726SJan Kiszkaif compile_prog "" "" ; then 3675d0927938SUlrich Hecht dup3=yes 3676d0927938SUlrich Hechtfi 3677d0927938SUlrich Hecht 36784e0c6529SAlex Bligh# check for ppoll support 36794e0c6529SAlex Blighppoll=no 36804e0c6529SAlex Blighcat > $TMPC << EOF 36814e0c6529SAlex Bligh#include <poll.h> 36824e0c6529SAlex Bligh 36834e0c6529SAlex Blighint main(void) 36844e0c6529SAlex Bligh{ 36854e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 36864e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 36874e0c6529SAlex Bligh return 0; 36884e0c6529SAlex Bligh} 36894e0c6529SAlex BlighEOF 36904e0c6529SAlex Blighif compile_prog "" "" ; then 36914e0c6529SAlex Bligh ppoll=yes 36924e0c6529SAlex Blighfi 36934e0c6529SAlex Bligh 3694cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 3695cd758dd0SAlex Blighprctl_pr_set_timerslack=no 3696cd758dd0SAlex Blighcat > $TMPC << EOF 3697cd758dd0SAlex Bligh#include <sys/prctl.h> 3698cd758dd0SAlex Bligh 3699cd758dd0SAlex Blighint main(void) 3700cd758dd0SAlex Bligh{ 3701cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 3702cd758dd0SAlex Bligh return 0; 3703cd758dd0SAlex Bligh} 3704cd758dd0SAlex BlighEOF 3705cd758dd0SAlex Blighif compile_prog "" "" ; then 3706cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 3707cd758dd0SAlex Blighfi 3708cd758dd0SAlex Bligh 37093b6edd16SPeter Maydell# check for epoll support 37103b6edd16SPeter Maydellepoll=no 37113b6edd16SPeter Maydellcat > $TMPC << EOF 37123b6edd16SPeter Maydell#include <sys/epoll.h> 37133b6edd16SPeter Maydell 37143b6edd16SPeter Maydellint main(void) 37153b6edd16SPeter Maydell{ 37163b6edd16SPeter Maydell epoll_create(0); 37173b6edd16SPeter Maydell return 0; 37183b6edd16SPeter Maydell} 37193b6edd16SPeter MaydellEOF 37208fb03151SPeter Maydellif compile_prog "" "" ; then 37213b6edd16SPeter Maydell epoll=yes 37223b6edd16SPeter Maydellfi 37233b6edd16SPeter Maydell 37243b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 37253b6edd16SPeter Maydell# so we must check separately for their presence 37263b6edd16SPeter Maydellepoll_create1=no 37273b6edd16SPeter Maydellcat > $TMPC << EOF 37283b6edd16SPeter Maydell#include <sys/epoll.h> 37293b6edd16SPeter Maydell 37303b6edd16SPeter Maydellint main(void) 37313b6edd16SPeter Maydell{ 373219e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 373319e83f6bSPeter Maydell * a function being called. This is necessary so that on 373419e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 373519e83f6bSPeter Maydell * the library but not declared in the header file we will 373619e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 373719e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 373819e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 373919e83f6bSPeter Maydell */ 3740c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 37413b6edd16SPeter Maydell} 37423b6edd16SPeter MaydellEOF 37438fb03151SPeter Maydellif compile_prog "" "" ; then 37443b6edd16SPeter Maydell epoll_create1=yes 37453b6edd16SPeter Maydellfi 37463b6edd16SPeter Maydell 37473b6edd16SPeter Maydellepoll_pwait=no 37483b6edd16SPeter Maydellcat > $TMPC << EOF 37493b6edd16SPeter Maydell#include <sys/epoll.h> 37503b6edd16SPeter Maydell 37513b6edd16SPeter Maydellint main(void) 37523b6edd16SPeter Maydell{ 37533b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 37543b6edd16SPeter Maydell return 0; 37553b6edd16SPeter Maydell} 37563b6edd16SPeter MaydellEOF 37578fb03151SPeter Maydellif compile_prog "" "" ; then 37583b6edd16SPeter Maydell epoll_pwait=yes 37593b6edd16SPeter Maydellfi 37603b6edd16SPeter Maydell 3761a8fd1abaSPeter Maydell# check for sendfile support 3762a8fd1abaSPeter Maydellsendfile=no 3763a8fd1abaSPeter Maydellcat > $TMPC << EOF 3764a8fd1abaSPeter Maydell#include <sys/sendfile.h> 3765a8fd1abaSPeter Maydell 3766a8fd1abaSPeter Maydellint main(void) 3767a8fd1abaSPeter Maydell{ 3768a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 3769a8fd1abaSPeter Maydell} 3770a8fd1abaSPeter MaydellEOF 3771a8fd1abaSPeter Maydellif compile_prog "" "" ; then 3772a8fd1abaSPeter Maydell sendfile=yes 3773a8fd1abaSPeter Maydellfi 3774a8fd1abaSPeter Maydell 377551834341SRiku Voipio# check for timerfd support (glibc 2.8 and newer) 377651834341SRiku Voipiotimerfd=no 377751834341SRiku Voipiocat > $TMPC << EOF 377851834341SRiku Voipio#include <sys/timerfd.h> 377951834341SRiku Voipio 378051834341SRiku Voipioint main(void) 378151834341SRiku Voipio{ 378251834341SRiku Voipio return(timerfd_create(CLOCK_REALTIME, 0)); 378351834341SRiku Voipio} 378451834341SRiku VoipioEOF 378551834341SRiku Voipioif compile_prog "" "" ; then 378651834341SRiku Voipio timerfd=yes 378751834341SRiku Voipiofi 378851834341SRiku Voipio 37899af5c906SRiku Voipio# check for setns and unshare support 37909af5c906SRiku Voipiosetns=no 37919af5c906SRiku Voipiocat > $TMPC << EOF 37929af5c906SRiku Voipio#include <sched.h> 37939af5c906SRiku Voipio 37949af5c906SRiku Voipioint main(void) 37959af5c906SRiku Voipio{ 37969af5c906SRiku Voipio int ret; 37979af5c906SRiku Voipio ret = setns(0, 0); 37989af5c906SRiku Voipio ret = unshare(0); 37999af5c906SRiku Voipio return ret; 38009af5c906SRiku Voipio} 38019af5c906SRiku VoipioEOF 38029af5c906SRiku Voipioif compile_prog "" "" ; then 38039af5c906SRiku Voipio setns=yes 38049af5c906SRiku Voipiofi 38059af5c906SRiku Voipio 3806cc8ae6deSpbrook# Check if tools are available to build documentation. 3807a25dba17SJuan Quintelaif test "$docs" != "no" ; then 380801668d98SStefan Weil if has makeinfo && has pod2man; then 3809a25dba17SJuan Quintela docs=yes 381083a3ab8bSJuan Quintela else 3811a25dba17SJuan Quintela if test "$docs" = "yes" ; then 381221684af0SStewart Smith feature_not_found "docs" "Install texinfo and Perl/perl-podlators" 381383a3ab8bSJuan Quintela fi 3814a25dba17SJuan Quintela docs=no 381583a3ab8bSJuan Quintela fi 3816cc8ae6deSpbrookfi 3817cc8ae6deSpbrook 3818f514f41cSStefan Weil# Search for bswap_32 function 38196ae9a1f4SJuan Quintelabyteswap_h=no 38206ae9a1f4SJuan Quintelacat > $TMPC << EOF 38216ae9a1f4SJuan Quintela#include <byteswap.h> 38226ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 38236ae9a1f4SJuan QuintelaEOF 382452166aa0SJuan Quintelaif compile_prog "" "" ; then 38256ae9a1f4SJuan Quintela byteswap_h=yes 38266ae9a1f4SJuan Quintelafi 38276ae9a1f4SJuan Quintela 382875f13596SStefan Weil# Search for bswap32 function 38296ae9a1f4SJuan Quintelabswap_h=no 38306ae9a1f4SJuan Quintelacat > $TMPC << EOF 38316ae9a1f4SJuan Quintela#include <sys/endian.h> 38326ae9a1f4SJuan Quintela#include <sys/types.h> 38336ae9a1f4SJuan Quintela#include <machine/bswap.h> 38346ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 38356ae9a1f4SJuan QuintelaEOF 383652166aa0SJuan Quintelaif compile_prog "" "" ; then 38376ae9a1f4SJuan Quintela bswap_h=yes 38386ae9a1f4SJuan Quintelafi 38396ae9a1f4SJuan Quintela 3840da93a1fdSaliguori########################################## 3841e49ab19fSPeter Lieven# Do we have libiscsi >= 1.9.0 3842c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 3843e49ab19fSPeter Lieven if $pkg_config --atleast-version=1.9.0 libiscsi; then 38443c33ea96SPaolo Bonzini libiscsi="yes" 3845ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 3846ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 3847c589b249SRonnie Sahlberg else 3848c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 3849e49ab19fSPeter Lieven feature_not_found "libiscsi" "Install libiscsi >= 1.9.0" 3850c589b249SRonnie Sahlberg fi 3851c589b249SRonnie Sahlberg libiscsi="no" 3852c589b249SRonnie Sahlberg fi 3853c589b249SRonnie Sahlbergfi 3854c589b249SRonnie Sahlberg 3855c589b249SRonnie Sahlberg########################################## 38568bacde8dSNatanael Copa# Do we need libm 38578bacde8dSNatanael Copacat > $TMPC << EOF 38588bacde8dSNatanael Copa#include <math.h> 3859f80ea986SAlexey Kardashevskiyint main(int argc, char **argv) { return isnan(sin((double)argc)); } 38608bacde8dSNatanael CopaEOF 38618bacde8dSNatanael Copaif compile_prog "" "" ; then 38628bacde8dSNatanael Copa : 38638bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 38648bacde8dSNatanael Copa LIBS="-lm $LIBS" 38658bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 38668bacde8dSNatanael Copaelse 386776ad07a4SPeter Maydell error_exit "libm check failed" 38688bacde8dSNatanael Copafi 38698bacde8dSNatanael Copa 38708bacde8dSNatanael Copa########################################## 3871da93a1fdSaliguori# Do we need librt 38728bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 38738bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 38748bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 38758bacde8dSNatanael Copa# function in addition. 3876da93a1fdSaliguoricat > $TMPC <<EOF 3877da93a1fdSaliguori#include <signal.h> 3878da93a1fdSaliguori#include <time.h> 38798bacde8dSNatanael Copaint main(void) { 38808bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 38818bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 38828bacde8dSNatanael Copa} 3883da93a1fdSaliguoriEOF 3884da93a1fdSaliguori 388552166aa0SJuan Quintelaif compile_prog "" "" ; then 388607ffa4bdSJuan Quintela : 38878bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 388818e588b1SRick Liuelif compile_prog "" "$pthread_lib -lrt" ; then 388918e588b1SRick Liu LIBS="$LIBS -lrt" 389018e588b1SRick Liu libs_qga="$libs_qga -lrt" 3891da93a1fdSaliguorifi 3892da93a1fdSaliguori 389331ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 3894179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 38956362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 38966362a53fSJuan Quintelafi 38976362a53fSJuan Quintela 3898de5071c5SBlue Swirl########################################## 3899cd4ec0b4SGerd Hoffmann# spice probe 3900cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 3901cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 3902cd4ec0b4SGerd Hoffmann#include <spice.h> 3903cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 3904cd4ec0b4SGerd HoffmannEOF 3905710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 3906710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 390765d5d3f9SStefan Weil if $pkg_config --atleast-version=0.12.0 spice-server && \ 390865d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 3909cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 3910cd4ec0b4SGerd Hoffmann spice="yes" 3911cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 3912cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 39132e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 39142e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 3915cd4ec0b4SGerd Hoffmann else 3916cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 39178efc9363SHu Tao feature_not_found "spice" \ 39188efc9363SHu Tao "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel" 3919cd4ec0b4SGerd Hoffmann fi 3920cd4ec0b4SGerd Hoffmann spice="no" 3921cd4ec0b4SGerd Hoffmann fi 3922cd4ec0b4SGerd Hoffmannfi 3923cd4ec0b4SGerd Hoffmann 39247b02f544SMarc-André Lureau# check for smartcard support 3925111a38b0SRobert Relyeasmartcard_cflags="" 39267b02f544SMarc-André Lureauif test "$smartcard" != "no"; then 39277b02f544SMarc-André Lureau if $pkg_config libcacard; then 39287b02f544SMarc-André Lureau libcacard_cflags=$($pkg_config --cflags libcacard) 39297b02f544SMarc-André Lureau libcacard_libs=$($pkg_config --libs libcacard) 39307b02f544SMarc-André Lureau QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" 39317b02f544SMarc-André Lureau libs_softmmu="$libs_softmmu $libcacard_libs" 39327b02f544SMarc-André Lureau smartcard="yes" 3933111a38b0SRobert Relyea else 39347b02f544SMarc-André Lureau if test "$smartcard" = "yes"; then 39357b02f544SMarc-André Lureau feature_not_found "smartcard" "Install libcacard devel" 3936111a38b0SRobert Relyea fi 39377b02f544SMarc-André Lureau smartcard="no" 3938111a38b0SRobert Relyea fi 3939111a38b0SRobert Relyeafi 3940111a38b0SRobert Relyea 39412b2325ffSGerd Hoffmann# check for libusb 39422b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 394365d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 39442b2325ffSGerd Hoffmann libusb="yes" 3945ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 3946ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 39472b2325ffSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags" 39482b2325ffSGerd Hoffmann libs_softmmu="$libs_softmmu $libusb_libs" 39492b2325ffSGerd Hoffmann else 39502b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 39518efc9363SHu Tao feature_not_found "libusb" "Install libusb devel >= 1.0.13" 39522b2325ffSGerd Hoffmann fi 39532b2325ffSGerd Hoffmann libusb="no" 39542b2325ffSGerd Hoffmann fi 39552b2325ffSGerd Hoffmannfi 39562b2325ffSGerd Hoffmann 395769354a83SHans de Goede# check for usbredirparser for usb network redirection support 395869354a83SHans de Goedeif test "$usb_redir" != "no" ; then 395965d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 396069354a83SHans de Goede usb_redir="yes" 3961ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 3962ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 396369354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 396456ab2ad1SAurelien Jarno libs_softmmu="$libs_softmmu $usb_redir_libs" 396569354a83SHans de Goede else 396669354a83SHans de Goede if test "$usb_redir" = "yes"; then 396721684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 396869354a83SHans de Goede fi 396969354a83SHans de Goede usb_redir="no" 397069354a83SHans de Goede fi 397169354a83SHans de Goedefi 397269354a83SHans de Goede 3973cd4ec0b4SGerd Hoffmann########################################## 3974d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 3975d9840e25STomoki Sekiyama 3976d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then 3977d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 3978d9840e25STomoki Sekiyama "") vss_win32_include="-I$source_path" ;; 3979d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 3980d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 3981d9840e25STomoki Sekiyama vss_win32_include="-I$source_path/.sdk/vss" 3982d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 3983d9840e25STomoki Sekiyama ;; 3984d9840e25STomoki Sekiyama *) vss_win32_include="-I$vss_win32_sdk" 3985d9840e25STomoki Sekiyama esac 3986d9840e25STomoki Sekiyama cat > $TMPC << EOF 3987d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 3988d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 3989d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 3990d9840e25STomoki SekiyamaEOF 3991d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 3992d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 3993d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 3994d9840e25STomoki Sekiyama libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 3995f33ca81fSMichael Roth qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" 3996d9840e25STomoki Sekiyama else 3997d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 3998d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 3999d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 4000d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 4001d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 4002d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 4003d9840e25STomoki Sekiyama feature_not_found "VSS support" 4004d9840e25STomoki Sekiyama fi 4005d9840e25STomoki Sekiyama guest_agent_with_vss="no" 4006d9840e25STomoki Sekiyama fi 4007d9840e25STomoki Sekiyamafi 4008d9840e25STomoki Sekiyama 4009d9840e25STomoki Sekiyama########################################## 4010d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 4011d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 4012d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 4013d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 4014d9840e25STomoki Sekiyama 4015d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then 4016d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 4017d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 4018d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 4019d9840e25STomoki Sekiyama if test -n "$programfiles"; then 4020d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 4021d9840e25STomoki Sekiyama else 4022d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 4023d9840e25STomoki Sekiyama fi 4024d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 4025d9840e25STomoki Sekiyama win_sdk="" 4026d9840e25STomoki Sekiyama fi 4027d9840e25STomoki Sekiyamafi 4028d9840e25STomoki Sekiyama 4029d9840e25STomoki Sekiyama########################################## 403050cbebb9SMichael Roth# check if mingw environment provides a recent ntddscsi.h 403150cbebb9SMichael Rothif test "$mingw32" = "yes" -a "$guest_agent" != "no"; then 403250cbebb9SMichael Roth cat > $TMPC << EOF 403350cbebb9SMichael Roth#include <windows.h> 403450cbebb9SMichael Roth#include <ntddscsi.h> 403550cbebb9SMichael Rothint main(void) { 403650cbebb9SMichael Roth#if !defined(IOCTL_SCSI_GET_ADDRESS) 403750cbebb9SMichael Roth#error Missing required ioctl definitions 403850cbebb9SMichael Roth#endif 403950cbebb9SMichael Roth SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; 404050cbebb9SMichael Roth return addr.Lun; 404150cbebb9SMichael Roth} 404250cbebb9SMichael RothEOF 404350cbebb9SMichael Roth if compile_prog "" "" ; then 404450cbebb9SMichael Roth guest_agent_ntddscsi=yes 4045c54e1eb4SMichael Roth libs_qga="-lsetupapi $libs_qga" 404650cbebb9SMichael Roth fi 404750cbebb9SMichael Rothfi 404850cbebb9SMichael Roth 404950cbebb9SMichael Roth########################################## 40509d9e1521SGerd Hoffmann# virgl renderer probe 40519d9e1521SGerd Hoffmann 40529d9e1521SGerd Hoffmannif test "$virglrenderer" != "no" ; then 40539d9e1521SGerd Hoffmann cat > $TMPC << EOF 40549d9e1521SGerd Hoffmann#include <virglrenderer.h> 40559d9e1521SGerd Hoffmannint main(void) { virgl_renderer_poll(); return 0; } 40569d9e1521SGerd HoffmannEOF 40579d9e1521SGerd Hoffmann virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null) 40589d9e1521SGerd Hoffmann virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null) 40599d9e1521SGerd Hoffmann if $pkg_config virglrenderer >/dev/null 2>&1 && \ 40609d9e1521SGerd Hoffmann compile_prog "$virgl_cflags" "$virgl_libs" ; then 40619d9e1521SGerd Hoffmann virglrenderer="yes" 40629d9e1521SGerd Hoffmann else 40639d9e1521SGerd Hoffmann if test "$virglrenderer" = "yes" ; then 40649d9e1521SGerd Hoffmann feature_not_found "virglrenderer" 40659d9e1521SGerd Hoffmann fi 40669d9e1521SGerd Hoffmann virglrenderer="no" 40679d9e1521SGerd Hoffmann fi 40689d9e1521SGerd Hoffmannfi 40699d9e1521SGerd Hoffmann 40709d9e1521SGerd Hoffmann########################################## 40715f6b9e8fSBlue Swirl# check if we have fdatasync 40725f6b9e8fSBlue Swirl 40735f6b9e8fSBlue Swirlfdatasync=no 40745f6b9e8fSBlue Swirlcat > $TMPC << EOF 40755f6b9e8fSBlue Swirl#include <unistd.h> 4076d1722a27SAlexandre Raymondint main(void) { 4077d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 4078d1722a27SAlexandre Raymondreturn fdatasync(0); 4079d1722a27SAlexandre Raymond#else 4080e172fe11SStefan Weil#error Not supported 4081d1722a27SAlexandre Raymond#endif 4082d1722a27SAlexandre Raymond} 40835f6b9e8fSBlue SwirlEOF 40845f6b9e8fSBlue Swirlif compile_prog "" "" ; then 40855f6b9e8fSBlue Swirl fdatasync=yes 40865f6b9e8fSBlue Swirlfi 40875f6b9e8fSBlue Swirl 408894a420b1SStefan Hajnoczi########################################## 4089e78815a5SAndreas Färber# check if we have madvise 4090e78815a5SAndreas Färber 4091e78815a5SAndreas Färbermadvise=no 4092e78815a5SAndreas Färbercat > $TMPC << EOF 4093e78815a5SAndreas Färber#include <sys/types.h> 4094e78815a5SAndreas Färber#include <sys/mman.h> 4095832ce9c2SScott Wood#include <stddef.h> 4096e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 4097e78815a5SAndreas FärberEOF 4098e78815a5SAndreas Färberif compile_prog "" "" ; then 4099e78815a5SAndreas Färber madvise=yes 4100e78815a5SAndreas Färberfi 4101e78815a5SAndreas Färber 4102e78815a5SAndreas Färber########################################## 4103e78815a5SAndreas Färber# check if we have posix_madvise 4104e78815a5SAndreas Färber 4105e78815a5SAndreas Färberposix_madvise=no 4106e78815a5SAndreas Färbercat > $TMPC << EOF 4107e78815a5SAndreas Färber#include <sys/mman.h> 4108832ce9c2SScott Wood#include <stddef.h> 4109e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 4110e78815a5SAndreas FärberEOF 4111e78815a5SAndreas Färberif compile_prog "" "" ; then 4112e78815a5SAndreas Färber posix_madvise=yes 4113e78815a5SAndreas Färberfi 4114e78815a5SAndreas Färber 4115e78815a5SAndreas Färber########################################## 41161e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID 41171e9737daSRichard Henderson 41181e9737daSRichard Hendersonsigev_thread_id=no 41191e9737daSRichard Hendersoncat > $TMPC << EOF 41201e9737daSRichard Henderson#include <signal.h> 41211e9737daSRichard Hendersonint main(void) { 41221e9737daSRichard Henderson struct sigevent ev; 41231e9737daSRichard Henderson ev.sigev_notify = SIGEV_THREAD_ID; 41241e9737daSRichard Henderson ev._sigev_un._tid = 0; 41251e9737daSRichard Henderson asm volatile("" : : "g"(&ev)); 41261e9737daSRichard Henderson return 0; 41271e9737daSRichard Henderson} 41281e9737daSRichard HendersonEOF 41291e9737daSRichard Hendersonif compile_prog "" "" ; then 41301e9737daSRichard Henderson sigev_thread_id=yes 41311e9737daSRichard Hendersonfi 41321e9737daSRichard Henderson 41331e9737daSRichard Henderson########################################## 413494a420b1SStefan Hajnoczi# check if trace backend exists 413594a420b1SStefan Hajnoczi 41365b808275SLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null 413794a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 41385b808275SLluís Vilanova error_exit "invalid trace backends" \ 41395b808275SLluís Vilanova "Please choose supported trace backends." 414094a420b1SStefan Hajnoczifi 414194a420b1SStefan Hajnoczi 41427e24e92aSStefan Hajnoczi########################################## 41437e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 41445b808275SLluís Vilanovaif have_backend "ust"; then 41457e24e92aSStefan Hajnoczi cat > $TMPC << EOF 4146bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 41477e24e92aSStefan Hajnocziint main(void) { return 0; } 41487e24e92aSStefan HajnocziEOF 41497e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 4150bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 4151bf15f63cSMohamad Gebai lttng_ust_libs=`$pkg_config --libs lttng-ust` 41527e24e92aSStefan Hajnoczi else 4153bf15f63cSMohamad Gebai lttng_ust_libs="-llttng-ust" 4154bf15f63cSMohamad Gebai fi 4155bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 4156bf15f63cSMohamad Gebai urcu_bp_libs=`$pkg_config --libs liburcu-bp` 4157bf15f63cSMohamad Gebai else 4158bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 4159bf15f63cSMohamad Gebai fi 4160bf15f63cSMohamad Gebai 4161bf15f63cSMohamad Gebai LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 4162bf15f63cSMohamad Gebai libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 4163bf15f63cSMohamad Gebai else 4164bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 41657e24e92aSStefan Hajnoczi fi 41667e24e92aSStefan Hajnoczifi 4167b3d08c02SDaniel P. Berrange 4168b3d08c02SDaniel P. Berrange########################################## 4169b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 41705b808275SLluís Vilanovaif have_backend "dtrace"; then 4171b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 417276ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 4173b3d08c02SDaniel P. Berrange fi 4174c276b17dSDaniel P. Berrange trace_backend_stap="no" 4175c276b17dSDaniel P. Berrange if has 'stap' ; then 4176c276b17dSDaniel P. Berrange trace_backend_stap="yes" 4177c276b17dSDaniel P. Berrange fi 4178b3d08c02SDaniel P. Berrangefi 4179b3d08c02SDaniel P. Berrange 41807e24e92aSStefan Hajnoczi########################################## 4181519175a2SAlex Barcelo# check and set a backend for coroutine 4182d0e2fce5SAneesh Kumar K.V 41837c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 41847c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because 41857c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally 41867c2acc70SPeter Maydell# useful for debugging purposes.) On Windows the only valid backend 41877c2acc70SPeter Maydell# is the Windows-specific one. 41887c2acc70SPeter Maydell 41897c2acc70SPeter Maydellucontext_works=no 4190d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 4191d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 4192d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 4193cdf84806SPeter Maydell#ifdef __stub_makecontext 4194cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 4195cdf84806SPeter Maydell#endif 419675cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 4197d0e2fce5SAneesh Kumar K.VEOF 4198d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 41997c2acc70SPeter Maydell ucontext_works=yes 4200d0e2fce5SAneesh Kumar K.V fi 4201519175a2SAlex Barcelofi 42027c2acc70SPeter Maydell 42037c2acc70SPeter Maydellif test "$coroutine" = ""; then 42047c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 42057c2acc70SPeter Maydell coroutine=win32 42067c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 42077c2acc70SPeter Maydell coroutine=ucontext 4208519175a2SAlex Barcelo else 42097c2acc70SPeter Maydell coroutine=sigaltstack 42107c2acc70SPeter Maydell fi 42117c2acc70SPeter Maydellelse 42127c2acc70SPeter Maydell case $coroutine in 42137c2acc70SPeter Maydell windows) 42147c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 42157c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 42167c2acc70SPeter Maydell fi 42177c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 42187c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 42197c2acc70SPeter Maydell coroutine=win32 42207c2acc70SPeter Maydell ;; 42217c2acc70SPeter Maydell ucontext) 42227c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 42237c2acc70SPeter Maydell feature_not_found "ucontext" 42247c2acc70SPeter Maydell fi 42257c2acc70SPeter Maydell ;; 42267c2acc70SPeter Maydell gthread|sigaltstack) 42277c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 42287c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 42297c2acc70SPeter Maydell fi 42307c2acc70SPeter Maydell ;; 42317c2acc70SPeter Maydell *) 423276ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 42337c2acc70SPeter Maydell ;; 42347c2acc70SPeter Maydell esac 4235d0e2fce5SAneesh Kumar K.Vfi 4236d0e2fce5SAneesh Kumar K.V 423770c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 423870c60c08SStefan Hajnoczi if test "$coroutine" = "gthread"; then 423970c60c08SStefan Hajnoczi coroutine_pool=no 424070c60c08SStefan Hajnoczi else 424170c60c08SStefan Hajnoczi coroutine_pool=yes 424270c60c08SStefan Hajnoczi fi 424370c60c08SStefan Hajnoczifi 424470c60c08SStefan Hajnocziif test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then 424570c60c08SStefan Hajnoczi error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)" 424670c60c08SStefan Hajnoczifi 424770c60c08SStefan Hajnoczi 4248d0e2fce5SAneesh Kumar K.V########################################## 4249d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 4250d2042378SAneesh Kumar K.V 42514e1797f9SStefan Weilopen_by_handle_at=no 4252d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 4253d2042378SAneesh Kumar K.V#include <fcntl.h> 4254acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 4255acc55ba8SStefan Weil# error missing definition 4256acc55ba8SStefan Weil#else 425775cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 4258acc55ba8SStefan Weil#endif 4259d2042378SAneesh Kumar K.VEOF 4260d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 4261d2042378SAneesh Kumar K.V open_by_handle_at=yes 4262d2042378SAneesh Kumar K.Vfi 4263d2042378SAneesh Kumar K.V 4264e06a765eSHarsh Prateek Bora######################################## 4265e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 4266e06a765eSHarsh Prateek Bora 4267e06a765eSHarsh Prateek Boralinux_magic_h=no 4268e06a765eSHarsh Prateek Boracat > $TMPC << EOF 4269e06a765eSHarsh Prateek Bora#include <linux/magic.h> 4270e06a765eSHarsh Prateek Boraint main(void) { 427175cafad7SStefan Weil return 0; 4272e06a765eSHarsh Prateek Bora} 4273e06a765eSHarsh Prateek BoraEOF 4274e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 4275e06a765eSHarsh Prateek Bora linux_magic_h=yes 4276e06a765eSHarsh Prateek Borafi 4277e06a765eSHarsh Prateek Bora 42788ab1bf12SLuiz Capitulino######################################## 4279c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed 4280c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries). 4281c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is 4282c95e3080SKevin Wolf# only a warning. 4283c95e3080SKevin Wolf# 4284c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that 4285c95e3080SKevin Wolf# the build doesn't fail anyway. 4286c95e3080SKevin Wolf 428706d71fa1SPeter Maydellpragma_disable_unused_but_set=no 428806d71fa1SPeter Maydellcat > $TMPC << EOF 4289e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push 429006d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable" 4291c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes" 4292e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop 4293c95e3080SKevin Wolf 429406d71fa1SPeter Maydellint main(void) { 429506d71fa1SPeter Maydell return 0; 429606d71fa1SPeter Maydell} 429706d71fa1SPeter MaydellEOF 429806d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 4299cc6e3ca9SGerd Hoffmann pragma_diagnostic_available=yes 4300c95e3080SKevin Wolfelse 4301c95e3080SKevin Wolf werror=no 430206d71fa1SPeter Maydellfi 430306d71fa1SPeter Maydell 430406d71fa1SPeter Maydell######################################## 4305541be927SChristian Borntraeger# check if we have valgrind/valgrind.h 43063f4349dcSKevin Wolf 43073f4349dcSKevin Wolfvalgrind_h=no 43083f4349dcSKevin Wolfcat > $TMPC << EOF 43093f4349dcSKevin Wolf#include <valgrind/valgrind.h> 43103f4349dcSKevin Wolfint main(void) { 43113f4349dcSKevin Wolf return 0; 43123f4349dcSKevin Wolf} 43133f4349dcSKevin WolfEOF 43143f4349dcSKevin Wolfif compile_prog "" "" ; then 43153f4349dcSKevin Wolf valgrind_h=yes 43163f4349dcSKevin Wolffi 43173f4349dcSKevin Wolf 43183f4349dcSKevin Wolf######################################## 43198ab1bf12SLuiz Capitulino# check if environ is declared 43208ab1bf12SLuiz Capitulino 43218ab1bf12SLuiz Capitulinohas_environ=no 43228ab1bf12SLuiz Capitulinocat > $TMPC << EOF 43238ab1bf12SLuiz Capitulino#include <unistd.h> 43248ab1bf12SLuiz Capitulinoint main(void) { 4325c075a723SBlue Swirl environ = 0; 43268ab1bf12SLuiz Capitulino return 0; 43278ab1bf12SLuiz Capitulino} 43288ab1bf12SLuiz CapitulinoEOF 43298ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 43308ab1bf12SLuiz Capitulino has_environ=yes 43318ab1bf12SLuiz Capitulinofi 43328ab1bf12SLuiz Capitulino 433376a347e1SRichard Henderson######################################## 433476a347e1SRichard Henderson# check if cpuid.h is usable. 433576a347e1SRichard Henderson 433676a347e1SRichard Hendersoncpuid_h=no 433776a347e1SRichard Hendersoncat > $TMPC << EOF 433876a347e1SRichard Henderson#include <cpuid.h> 433976a347e1SRichard Hendersonint main(void) { 4340774d566cSPeter Maydell unsigned a, b, c, d; 4341774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 4342774d566cSPeter Maydell 4343774d566cSPeter Maydell if (max >= 1) { 4344774d566cSPeter Maydell __cpuid(1, a, b, c, d); 4345774d566cSPeter Maydell } 4346774d566cSPeter Maydell 4347774d566cSPeter Maydell if (max >= 7) { 4348774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 4349774d566cSPeter Maydell } 4350774d566cSPeter Maydell 435176a347e1SRichard Henderson return 0; 435276a347e1SRichard Henderson} 435376a347e1SRichard HendersonEOF 435476a347e1SRichard Hendersonif compile_prog "" "" ; then 435576a347e1SRichard Henderson cpuid_h=yes 435676a347e1SRichard Hendersonfi 435776a347e1SRichard Henderson 4358f540166bSRichard Henderson######################################## 4359f540166bSRichard Henderson# check if __[u]int128_t is usable. 4360f540166bSRichard Henderson 4361f540166bSRichard Hendersonint128=no 4362f540166bSRichard Hendersoncat > $TMPC << EOF 4363a00f66abSStefan Weil#if defined(__clang_major__) && defined(__clang_minor__) 4364a00f66abSStefan Weil# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2)) 4365a00f66abSStefan Weil# error __int128_t does not work in CLANG before 3.2 4366a00f66abSStefan Weil# endif 4367a00f66abSStefan Weil#endif 4368f540166bSRichard Henderson__int128_t a; 4369f540166bSRichard Henderson__uint128_t b; 4370f540166bSRichard Hendersonint main (void) { 4371f540166bSRichard Henderson a = a + b; 4372f540166bSRichard Henderson b = a * b; 4373464e3671SPeter Maydell a = a * a; 4374f540166bSRichard Henderson return 0; 4375f540166bSRichard Henderson} 4376f540166bSRichard HendersonEOF 4377f540166bSRichard Hendersonif compile_prog "" "" ; then 4378f540166bSRichard Henderson int128=yes 4379f540166bSRichard Hendersonfi 438076a347e1SRichard Henderson 43811e6e9acaSRichard Henderson######################################## 43821e6e9acaSRichard Henderson# check if getauxval is available. 43831e6e9acaSRichard Henderson 43841e6e9acaSRichard Hendersongetauxval=no 43851e6e9acaSRichard Hendersoncat > $TMPC << EOF 43861e6e9acaSRichard Henderson#include <sys/auxv.h> 43871e6e9acaSRichard Hendersonint main(void) { 43881e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 43891e6e9acaSRichard Henderson} 43901e6e9acaSRichard HendersonEOF 43911e6e9acaSRichard Hendersonif compile_prog "" "" ; then 43921e6e9acaSRichard Henderson getauxval=yes 43931e6e9acaSRichard Hendersonfi 43941e6e9acaSRichard Henderson 4395fd0e6053SJohn Snow######################################## 4396fd0e6053SJohn Snow# check if ccache is interfering with 4397fd0e6053SJohn Snow# semantic analysis of macros 4398fd0e6053SJohn Snow 43995e4dfd3dSJohn Snowunset CCACHE_CPP2 4400fd0e6053SJohn Snowccache_cpp2=no 4401fd0e6053SJohn Snowcat > $TMPC << EOF 4402fd0e6053SJohn Snowstatic const int Z = 1; 4403fd0e6053SJohn Snow#define fn() ({ Z; }) 4404fd0e6053SJohn Snow#define TAUT(X) ((X) == Z) 4405fd0e6053SJohn Snow#define PAREN(X, Y) (X == Y) 4406fd0e6053SJohn Snow#define ID(X) (X) 4407fd0e6053SJohn Snowint main(int argc, char *argv[]) 4408fd0e6053SJohn Snow{ 4409fd0e6053SJohn Snow int x = 0, y = 0; 4410fd0e6053SJohn Snow x = ID(x); 4411fd0e6053SJohn Snow x = fn(); 4412fd0e6053SJohn Snow fn(); 4413fd0e6053SJohn Snow if (PAREN(x, y)) return 0; 4414fd0e6053SJohn Snow if (TAUT(Z)) return 0; 4415fd0e6053SJohn Snow return 0; 4416fd0e6053SJohn Snow} 4417fd0e6053SJohn SnowEOF 4418fd0e6053SJohn Snow 4419fd0e6053SJohn Snowif ! compile_object "-Werror"; then 4420fd0e6053SJohn Snow ccache_cpp2=yes 4421fd0e6053SJohn Snowfi 4422fd0e6053SJohn Snow 4423b553a042SJohn Snow################################################# 4424b553a042SJohn Snow# clang does not support glibc + FORTIFY_SOURCE. 4425b553a042SJohn Snow 4426b553a042SJohn Snowif test "$fortify_source" != "no"; then 4427b553a042SJohn Snow if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then 4428b553a042SJohn Snow fortify_source="no"; 4429cfcc7c14SJohn Snow elif test -n "$cxx" && 4430cfcc7c14SJohn Snow echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then 4431b553a042SJohn Snow fortify_source="no"; 4432b553a042SJohn Snow else 4433b553a042SJohn Snow fortify_source="yes" 4434b553a042SJohn Snow fi 4435b553a042SJohn Snowfi 4436b553a042SJohn Snow 4437d2042378SAneesh Kumar K.V########################################## 4438e86ecd4bSJuan Quintela# End of CC checks 4439e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 4440e86ecd4bSJuan Quintela 44411d728c39SBlue Swirlif test "$gcov" = "yes" ; then 44421d728c39SBlue Swirl CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" 44431d728c39SBlue Swirl LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" 4444b553a042SJohn Snowelif test "$fortify_source" = "yes" ; then 4445e600cdf3SMichal Privoznik CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" 4446ce278618SPeter Maydellelif test "$debug" = "no"; then 4447ce278618SPeter Maydell CFLAGS="-O2 $CFLAGS" 4448e86ecd4bSJuan Quintelafi 4449a316e378SJuan Quintela 44506542aa9cSPeter Lieven########################################## 44516542aa9cSPeter Lieven# Do we have libnfs 44526542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 4453b7d769c9SPeter Lieven if $pkg_config --atleast-version=1.9.3 libnfs; then 44546542aa9cSPeter Lieven libnfs="yes" 44556542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 44566542aa9cSPeter Lieven LIBS="$LIBS $libnfs_libs" 44576542aa9cSPeter Lieven else 44586542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 44598efc9363SHu Tao feature_not_found "libnfs" "Install libnfs devel >= 1.9.3" 44606542aa9cSPeter Lieven fi 44616542aa9cSPeter Lieven libnfs="no" 44626542aa9cSPeter Lieven fi 44636542aa9cSPeter Lievenfi 44641d728c39SBlue Swirl 446520ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 446620ff6c80SAnthony Liguori# enable/disable 446720ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 446820ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 446920ff6c80SAnthony Liguori zero_malloc="no" 447020ff6c80SAnthony Liguori else 447120ff6c80SAnthony Liguori zero_malloc="yes" 447220ff6c80SAnthony Liguori fi 447320ff6c80SAnthony Liguorifi 447420ff6c80SAnthony Liguori 44756ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 44766ca026cbSPeter Maydellif test "$werror" = "yes"; then 44776ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 44786ca026cbSPeter Maydellfi 44796ca026cbSPeter Maydell 4480e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 4481e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 44821156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 4483e86ecd4bSJuan Quintela fi 4484e86ecd4bSJuan Quintelafi 4485e86ecd4bSJuan Quintela 448694dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 448794dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 448894dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 448994dd53c5SGerd Hoffmannelse 449094dd53c5SGerd Hoffmann POD2MAN="pod2man" 449194dd53c5SGerd Hoffmannfi 449294dd53c5SGerd Hoffmann 4493952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 4494952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 4495952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 4496952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 4497952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 4498952afb71SBlue Swirl fi 4499952afb71SBlue Swirl done 4500952afb71SBlue Swirlfi 4501952afb71SBlue Swirl 450210ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 4503e26110cfSFam Zhengqemu_moddir=$libdir$confsuffix 4504528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 4505834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 45065a67135aSbellard 45074b1c11fdSDaniel P. Berrangetools="" 45084b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 4509ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 45104b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 45114b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 4512a75eb03bSDavid Marchand tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" 45134b1c11fdSDaniel P. Berrange fi 45144b1c11fdSDaniel P. Berrangefi 45154b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 4516983eef5aSMeador Inge if test "$virtfs" != no ; then 4517be5ea8edSAnthony Liguori if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then 4518983eef5aSMeador Inge virtfs=yes 451917bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 4520983eef5aSMeador Inge else 4521983eef5aSMeador Inge if test "$virtfs" = yes; then 452276ad07a4SPeter Maydell error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel" 4523983eef5aSMeador Inge fi 452417500370SAndreas Färber virtfs=no 4525983eef5aSMeador Inge fi 452617bff52bSM. Mohan Kumar fi 4527d138cee9SMichael Rothfi 45289d6bc27bSMichael Roth 45299d6bc27bSMichael Roth# Probe for guest agent support/options 45309d6bc27bSMichael Roth 4531e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 4532b39297aeSTomoki Sekiyama if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 4533fafcaf1dSMichael Roth tools="qemu-ga $tools" 4534e8ef31a3SMichael Tokarev guest_agent=yes 4535e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 4536e8ef31a3SMichael Tokarev guest_agent=no 4537e8ef31a3SMichael Tokarev else 4538e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 4539ca35f780SPaolo Bonzini fi 45404b1c11fdSDaniel P. Berrangefi 4541ca35f780SPaolo Bonzini 45429d6bc27bSMichael Roth# Guest agent Window MSI package 45439d6bc27bSMichael Roth 45449d6bc27bSMichael Rothif test "$guest_agent" != yes; then 45459d6bc27bSMichael Roth if test "$guest_agent_msi" = yes; then 45469d6bc27bSMichael Roth error_exit "MSI guest agent package requires guest agent enabled" 45479d6bc27bSMichael Roth fi 45489d6bc27bSMichael Roth guest_agent_msi=no 45499d6bc27bSMichael Rothelif test "$mingw32" != "yes"; then 45509d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 45519d6bc27bSMichael Roth error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" 45529d6bc27bSMichael Roth fi 45539d6bc27bSMichael Roth guest_agent_msi=no 45549d6bc27bSMichael Rothelif ! has wixl; then 45559d6bc27bSMichael Roth if test "$guest_agent_msi" = "yes"; then 45569d6bc27bSMichael Roth error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" 45579d6bc27bSMichael Roth fi 45589d6bc27bSMichael Roth guest_agent_msi=no 45591a34904eSMichael Rothelse 45601a34904eSMichael Roth # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't 45611a34904eSMichael Roth # disabled explicitly 45621a34904eSMichael Roth if test "$guest_agent_msi" != "no"; then 45631a34904eSMichael Roth guest_agent_msi=yes 45641a34904eSMichael Roth fi 45659d6bc27bSMichael Rothfi 45669d6bc27bSMichael Roth 45671a34904eSMichael Rothif test "$guest_agent_msi" = "yes"; then 45689d6bc27bSMichael Roth if test "$guest_agent_with_vss" = "yes"; then 45699d6bc27bSMichael Roth QEMU_GA_MSI_WITH_VSS="-D InstallVss" 45709d6bc27bSMichael Roth fi 45719d6bc27bSMichael Roth 45729d6bc27bSMichael Roth if test "$QEMU_GA_MANUFACTURER" = ""; then 45739d6bc27bSMichael Roth QEMU_GA_MANUFACTURER=QEMU 45749d6bc27bSMichael Roth fi 45759d6bc27bSMichael Roth 45769d6bc27bSMichael Roth if test "$QEMU_GA_DISTRO" = ""; then 45779d6bc27bSMichael Roth QEMU_GA_DISTRO=Linux 45789d6bc27bSMichael Roth fi 45799d6bc27bSMichael Roth 45809d6bc27bSMichael Roth if test "$QEMU_GA_VERSION" = ""; then 45819d6bc27bSMichael Roth QEMU_GA_VERSION=`cat $source_path/VERSION` 45829d6bc27bSMichael Roth fi 45839d6bc27bSMichael Roth 45849d6bc27bSMichael Roth QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin" 45859d6bc27bSMichael Roth 45869d6bc27bSMichael Roth case "$cpu" in 45879d6bc27bSMichael Roth x86_64) 45889d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" 45899d6bc27bSMichael Roth ;; 45909d6bc27bSMichael Roth i386) 45919d6bc27bSMichael Roth QEMU_GA_MSI_ARCH="-D Arch=32" 45929d6bc27bSMichael Roth ;; 45939d6bc27bSMichael Roth *) 45949d6bc27bSMichael Roth error_exit "CPU $cpu not supported for building installation package" 45959d6bc27bSMichael Roth ;; 45969d6bc27bSMichael Roth esac 45979d6bc27bSMichael Rothfi 45989d6bc27bSMichael Roth 4599ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 4600ca35f780SPaolo Bonziniroms= 4601ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 4602ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 4603ca35f780SPaolo Bonzini "$softmmu" = yes ; then 4604ca35f780SPaolo Bonzini roms="optionrom" 4605ca35f780SPaolo Bonzinifi 4606d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 460739ac8455SDavid Gibson roms="$roms spapr-rtas" 460839ac8455SDavid Gibsonfi 4609ca35f780SPaolo Bonzini 46109933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 46119933c305SChristian Borntraeger roms="$roms s390-ccw" 46129933c305SChristian Borntraegerfi 46139933c305SChristian Borntraeger 4614964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary. 4615964c6fa1SRichard Hendersonif test "$pie" = "no" ; then 4616964c6fa1SRichard Henderson textseg_addr= 4617964c6fa1SRichard Henderson case "$cpu" in 4618479eb121SRichard Henderson arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) 4619479eb121SRichard Henderson # ??? Rationale for choosing this address 4620964c6fa1SRichard Henderson textseg_addr=0x60000000 4621964c6fa1SRichard Henderson ;; 4622964c6fa1SRichard Henderson mips) 4623479eb121SRichard Henderson # A 256M aligned address, high in the address space, with enough 4624479eb121SRichard Henderson # room for the code_gen_buffer above it before the stack. 4625479eb121SRichard Henderson textseg_addr=0x60000000 4626964c6fa1SRichard Henderson ;; 4627964c6fa1SRichard Henderson esac 4628964c6fa1SRichard Henderson if [ -n "$textseg_addr" ]; then 4629964c6fa1SRichard Henderson cat > $TMPC <<EOF 4630964c6fa1SRichard Henderson int main(void) { return 0; } 4631964c6fa1SRichard HendersonEOF 4632964c6fa1SRichard Henderson textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" 4633964c6fa1SRichard Henderson if ! compile_prog "" "$textseg_ldflags"; then 4634964c6fa1SRichard Henderson # In case ld does not support -Ttext-segment, edit the default linker 4635964c6fa1SRichard Henderson # script via sed to set the .text start addr. This is needed on FreeBSD 4636964c6fa1SRichard Henderson # at least. 4637964c6fa1SRichard Henderson $ld --verbose | sed \ 4638964c6fa1SRichard Henderson -e '1,/==================================================/d' \ 4639964c6fa1SRichard Henderson -e '/==================================================/,$d' \ 4640964c6fa1SRichard Henderson -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ 4641964c6fa1SRichard Henderson -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld 4642964c6fa1SRichard Henderson textseg_ldflags="-Wl,-T../config-host.ld" 4643964c6fa1SRichard Henderson fi 4644964c6fa1SRichard Henderson fi 4645964c6fa1SRichard Hendersonfi 4646964c6fa1SRichard Henderson 464750e12060SJan Kiszka# prepend pixman and ftd flags after all config tests are done 464850e12060SJan KiszkaQEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" 464950e12060SJan Kiszkalibs_softmmu="$pixman_libs $libs_softmmu" 46505ca9388aSGerd Hoffmann 46517d13299dSbellardecho "Install prefix $prefix" 4652c00b2808SEduardo Habkostecho "BIOS directory `eval echo $qemu_datadir`" 4653f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 46543aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 4655e26110cfSFam Zhengecho "module directory `eval echo $qemu_moddir`" 46568bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`" 46570f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 46581c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 465911d9f695Sbellardif test "$mingw32" = "no" ; then 46605a699bbbSLaszlo Ersekecho "local state directory `eval echo $local_statedir`" 4661f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 466243ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 46635a699bbbSLaszlo Ersekelse 46645a699bbbSLaszlo Ersekecho "local state directory queried at runtime" 4665d9840e25STomoki Sekiyamaecho "Windows SDK $win_sdk" 466611d9f695Sbellardfi 46675a67135aSbellardecho "Source path $source_path" 46687d13299dSbellardecho "C compiler $cc" 466983469015Sbellardecho "Host C compiler $host_cc" 467083f73fceSTomoki Sekiyamaecho "C++ compiler $cxx" 46713c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 467245d285abSPeter Maydellecho "ARFLAGS $ARFLAGS" 46730c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 4674a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 46750c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 46767d13299dSbellardecho "make $make" 46776a882643Spbrookecho "install $install" 4678c886edfbSBlue Swirlecho "python $python" 4679e2d8830eSBradif test "$slirp" = "yes" ; then 4680e2d8830eSBrad echo "smbd $smbd" 4681e2d8830eSBradfi 468217969268SFam Zhengecho "module support $modules" 4683a98fd896Sbellardecho "host CPU $cpu" 4684de83cd02Sbellardecho "host big endian $bigendian" 468597a847bcSbellardecho "target list $target_list" 4686ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 46877d13299dSbellardecho "gprof enabled $gprof" 468803b4fe7dSaliguoriecho "sparse enabled $sparse" 46891625af87Saliguoriecho "strip binaries $strip_opt" 469005c2a3e7Sbellardecho "profiler $profiler" 469143ce4dfeSbellardecho "static build $static" 46925b0753e0Sbellardif test "$darwin" = "yes" ; then 46935b0753e0Sbellard echo "Cocoa support $cocoa" 46945b0753e0Sbellardfi 4695e2134eb9SGerd Hoffmannecho "pixman $pixman" 469697a847bcSbellardecho "SDL support $sdl" 4697a4ccabcfSAnthony Liguoriecho "GTK support $gtk" 4698925a0400SGerd Hoffmannecho "GTK GL support $gtk_gl" 4699ddbb0d09SDaniel P. Berrangeecho "GNUTLS support $gnutls" 4700ddbb0d09SDaniel P. Berrangeecho "GNUTLS hash $gnutls_hash" 470191bfcdb0SDaniel P. Berrangeecho "libgcrypt $gcrypt" 470218f49881SPeter Maydellif test "$nettle" = "yes"; then 470318f49881SPeter Maydell echo "nettle $nettle ($nettle_version)" 470418f49881SPeter Maydellelse 470518f49881SPeter Maydell echo "nettle $nettle" 470618f49881SPeter Maydellfi 47079a2fd434SDaniel P. Berrangeecho "libtasn1 $tasn1" 4708bbbf9bfbSStefan Weilecho "VTE support $vte" 47094d3b6f6eSbalrogecho "curses support $curses" 47109d9e1521SGerd Hoffmannecho "virgl support $virglrenderer" 4711769ce76dSAlexander Grafecho "curl support $curl" 471267b915a5Sbellardecho "mingw32 support $mingw32" 47130c58ac1cSmalcecho "Audio drivers $audio_drv_list" 4714b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist" 4715b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist" 4716983eef5aSMeador Ingeecho "VirtFS support $virtfs" 4717821601eaSJes Sorensenecho "VNC support $vnc" 4718821601eaSJes Sorensenif test "$vnc" = "yes" ; then 47192f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 47202f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 4721efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 4722821601eaSJes Sorensenfi 47233142255cSblueswir1if test -n "$sparc_cpu"; then 47243142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 47253142255cSblueswir1fi 4726e37630caSaliguoriecho "xen support $xen" 47273996e85cSPaul Durrantif test "$xen" = "yes" ; then 47283996e85cSPaul Durrant echo "xen ctrl version $xen_ctrl_version" 472964a7ad6fSIan Campbell echo "pv dom build $xen_pv_domain_build" 47303996e85cSPaul Durrantfi 47312e4d9fb1Saurel32echo "brlapi support $brlapi" 4732a20a6f46SJuan Quintelaecho "bluez support $bluez" 4733a25dba17SJuan Quintelaecho "Documentation $docs" 473440d6444eSAvi Kivityecho "PIE $pie" 47358a16d273Sthsecho "vde support $vde" 473658952137SVincenzo Maffioneecho "netmap support $netmap" 47375c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 4738758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 473977755340Sthsecho "Install blobs $blobs" 4740b31a0277SJuan Quintelaecho "KVM support $kvm" 47412da776dbSMichael R. Hinesecho "RDMA support $rdma" 47429195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 4743f652e6afSaurel32echo "fdt support $fdt" 4744ceb42de8Saliguoriecho "preadv support $preadv" 47455f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 4746e78815a5SAndreas Färberecho "madvise $madvise" 4747e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 47481e9737daSRichard Hendersonecho "sigev_thread_id $sigev_thread_id" 4749ee682d27SStefan Weilecho "uuid support $uuid" 475047e98658SCorey Bryantecho "libcap-ng support $cap_ng" 4751d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 47525e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi" 47535b808275SLluís Vilanovaecho "Trace backends $trace_backends" 4754713572a7SMarc-André Lureauif have_backend "simple"; then 47559410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 4756e00e36fbSStefan Weilfi 4757c9dd4074SStefan Weilif test "$spice" = "yes"; then 47582e0e3c39SAlon Levyecho "spice support $spice ($spice_protocol_version/$spice_server_version)" 4759c9dd4074SStefan Weilelse 4760c9dd4074SStefan Weilecho "spice support $spice" 4761c9dd4074SStefan Weilfi 4762f27aaf4bSChristian Brunnerecho "rbd support $rbd" 4763dce512deSChristoph Hellwigecho "xfsctl support $xfs" 47647b02f544SMarc-André Lureauecho "smartcard support $smartcard" 47652b2325ffSGerd Hoffmannecho "libusb $libusb" 476669354a83SHans de Goedeecho "usb net redir $usb_redir" 4767da076ffeSGerd Hoffmannecho "OpenGL support $opengl" 4768*014cb152SGerd Hoffmannecho "OpenGL dmabufs $opengl_dmabuf" 4769c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 47706542aa9cSPeter Lievenecho "libnfs support $libnfs" 4771d138cee9SMichael Rothecho "build guest agent $guest_agent" 4772d9840e25STomoki Sekiyamaecho "QGA VSS support $guest_agent_with_vss" 477350cbebb9SMichael Rothecho "QGA w32 disk info $guest_agent_ntddscsi" 47744c875d89SMichael Rothecho "QGA MSI support $guest_agent_msi" 4775f794573eSEduardo Otuboecho "seccomp support $seccomp" 47767c2acc70SPeter Maydellecho "coroutine backend $coroutine" 477770c60c08SStefan Hajnocziecho "coroutine pool $coroutine_pool" 4778eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 4779c9a12e75SChrysostomos Nanakosecho "Archipelago support $archipelago" 47801d728c39SBlue Swirlecho "gcov $gcov_tool" 47811d728c39SBlue Swirlecho "gcov enabled $gcov" 4782ab214c29SStefan Bergerecho "TPM support $tpm" 47830a12ec87SRichard W.M. Jonesecho "libssh2 support $libssh2" 47843b8acc11SPaolo Bonziniecho "TPM passthrough $tpm_passthrough" 47853556c233SPaolo Bonziniecho "QOM debugging $qom_cast_debug" 47864f18b782SJeff Codyecho "vhdx $vhdx" 4787607dacd0Sqiaonuohanecho "lzo support $lzo" 4788607dacd0Sqiaonuohanecho "snappy support $snappy" 47896b383c08SPeter Wuecho "bzip2 support $bzip2" 4790a99d57bbSWanlong Gaoecho "NUMA host support $numa" 47912847b469SFam Zhengecho "tcmalloc support $tcmalloc" 47927b01cb97SAlexandre Derumierecho "jemalloc support $jemalloc" 479367b915a5Sbellard 47941ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 479524b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 4796e8cd23deSbellardfi 479797a847bcSbellard 479898ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 479997a847bcSbellard 4800dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 4801dbd99ae3SStefan Weil 480298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 480398ec69acSJuan Quintelaecho >> $config_host_mak 480498ec69acSJuan Quintela 4805e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 480699d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 480799d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 48083aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 48098bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 48100f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 481199d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 481299d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 481322d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 48149afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 48159afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 4816e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 48175a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 4818785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 48195a699bbbSLaszlo Ersekfi 4820f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 4821f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak 4822f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak 4823834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 4824f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 4825804edf29SJuan Quintela 482698ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 4827727e5283SPaolo Bonzini 4828f8393946Saurel32if test "$debug_tcg" = "yes" ; then 48292358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 4830f8393946Saurel32fi 48311625af87Saliguoriif test "$strip_opt" = "yes" ; then 483252ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 48331625af87Saliguorifi 48347d13299dSbellardif test "$bigendian" = "yes" ; then 4835e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 483697a847bcSbellardfi 483767b915a5Sbellardif test "$mingw32" = "yes" ; then 483898ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 48399fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 48409fe6de94SBlue Swirl version_major=${rc_version%%.*} 48419fe6de94SBlue Swirl rc_version=${rc_version#*.} 48429fe6de94SBlue Swirl version_minor=${rc_version%%.*} 48439fe6de94SBlue Swirl rc_version=${rc_version#*.} 48449fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 48459fe6de94SBlue Swirl version_micro=0 48469fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 48479fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 4848d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 4849d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 4850f33ca81fSMichael Roth echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak 4851d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 4852d9840e25STomoki Sekiyama fi 485350cbebb9SMichael Roth if test "$guest_agent_ntddscsi" = "yes" ; then 485450cbebb9SMichael Roth echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak 485550cbebb9SMichael Roth fi 48561a34904eSMichael Roth if test "$guest_agent_msi" = "yes"; then 48579dacf32dSYossi Hindin echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak 48589dacf32dSYossi Hindin echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak 48599dacf32dSYossi Hindin echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak 48609dacf32dSYossi Hindin echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak 48619dacf32dSYossi Hindin echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak 48629dacf32dSYossi Hindin echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak 48639dacf32dSYossi Hindin echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak 48649dacf32dSYossi Hindin fi 4865210fa556Spbrookelse 486635f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 4867210fa556Spbrookfi 4868128ab2ffSblueswir1 4869dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 4870dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 4871dffcb71cSMark McLoughlinfi 4872dffcb71cSMark McLoughlin 487383fb7adfSbellardif test "$darwin" = "yes" ; then 487498ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 487583fb7adfSbellardfi 4876b29fe3edSmalc 4877b29fe3edSmalcif test "$aix" = "yes" ; then 487898ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 4879b29fe3edSmalcfi 4880b29fe3edSmalc 4881ec530c81Sbellardif test "$solaris" = "yes" ; then 488298ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 48832358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 48840475a5caSths if test "$needs_libsunmath" = "yes" ; then 488575b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 48860475a5caSths fi 4887ec530c81Sbellardfi 4888179cf400SAndreas Färberif test "$haiku" = "yes" ; then 4889179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 4890179cf400SAndreas Färberfi 489197a847bcSbellardif test "$static" = "yes" ; then 489298ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 489397a847bcSbellardfi 48941ba16968SStefan Weilif test "$profiler" = "yes" ; then 48952358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 489605c2a3e7Sbellardfi 4897c20709aaSbellardif test "$slirp" = "yes" ; then 489898ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 4899e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 4900c20709aaSbellardfi 49018a16d273Sthsif test "$vde" = "yes" ; then 490298ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 49038a16d273Sthsfi 490458952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 490558952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 490658952137SVincenzo Maffionefi 4907015a33bdSGongleiif test "$l2tpv3" = "yes" ; then 4908015a33bdSGonglei echo "CONFIG_L2TPV3=y" >> $config_host_mak 4909015a33bdSGongleifi 491047e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 491147e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 491247e98658SCorey Bryantfi 49132358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 49140c58ac1cSmalcfor drv in $audio_drv_list; do 4915bb55b712SStefan Weil def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` 491698ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 49170c58ac1cSmalcdone 491867f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 491967f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 492067f86e8eSJuan Quintelafi 4921d5631638Smalcif test "$audio_win_int" = "yes" ; then 4922d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 4923d5631638Smalcfi 4924b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 4925b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 4926821601eaSJes Sorensenif test "$vnc" = "yes" ; then 4927821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 4928821601eaSJes Sorensenfi 49292f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 493098ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 49312f9606b3Saliguorifi 4932821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 49332f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 49342f6f5c7aSCorentin Charyfi 4935821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 4936efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 4937efe556adSCorentin Charyfi 493876655d6dSaliguoriif test "$fnmatch" = "yes" ; then 49392358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 494076655d6dSaliguorifi 4941ee682d27SStefan Weilif test "$uuid" = "yes" ; then 4942ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 4943ee682d27SStefan Weilfi 4944dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 4945dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 4946dce512deSChristoph Hellwigfi 4947b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 494898ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 49492358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 495098ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 495198ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 4952a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 495398ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 4954cc8ae6deSpbrookfi 495517969268SFam Zhengif test "$modules" = "yes"; then 4956e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 4957e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 4958e26110cfSFam Zheng echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak 495917969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 496017969268SFam Zhengfi 49611ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 496298ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 4963a3f4d63dSCole Robinson echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak 49648ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 496549ecc3faSbellardfi 496649ecc3faSbellardif test "$cocoa" = "yes" ; then 496798ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 496849ecc3faSbellardfi 49694d3b6f6eSbalrogif test "$curses" = "yes" ; then 497098ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 4971ab4e5602SJan Kiszkafi 4972ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 49732358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 4974ebc996f3SRiku Voipiofi 4975099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 49762358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 4977099d6b0fSRiku Voipiofi 497840ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 497940ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 498040ff6d7eSKevin Wolffi 49813ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 49822358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 49833ce34dfbSvibisreenivasanfi 4984c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 4985c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 4986c2882b96SRiku Voipiofi 4987751bcc39SMarc-André Lureauif test "$memfd" = "yes" ; then 4988751bcc39SMarc-André Lureau echo "CONFIG_MEMFD=y" >> $config_host_mak 4989751bcc39SMarc-André Lureaufi 4990d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 4991d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 4992d0927938SUlrich Hechtfi 49933d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 49943d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 49953d4fa43eSKusanagi Kouichifi 4996b953f075SDenis V. Lunevif test "$fallocate_zero_range" = "yes" ; then 4997b953f075SDenis V. Lunev echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak 4998b953f075SDenis V. Lunevfi 4999ed911435SKevin Wolfif test "$posix_fallocate" = "yes" ; then 5000ed911435SKevin Wolf echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak 5001ed911435SKevin Wolffi 5002c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 5003c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 5004c727f47dSPeter Maydellfi 5005dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 5006dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 5007dace20dcSPeter Maydellfi 5008d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 5009d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 5010d0927938SUlrich Hechtfi 50114e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 50124e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 50134e0c6529SAlex Blighfi 5014cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 5015cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 5016cd758dd0SAlex Blighfi 50173b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 50183b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 50193b6edd16SPeter Maydellfi 50203b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 50213b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 50223b6edd16SPeter Maydellfi 50233b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 50243b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 50253b6edd16SPeter Maydellfi 5026a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 5027a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 5028a8fd1abaSPeter Maydellfi 502951834341SRiku Voipioif test "$timerfd" = "yes" ; then 503051834341SRiku Voipio echo "CONFIG_TIMERFD=y" >> $config_host_mak 503151834341SRiku Voipiofi 50329af5c906SRiku Voipioif test "$setns" = "yes" ; then 50339af5c906SRiku Voipio echo "CONFIG_SETNS=y" >> $config_host_mak 50349af5c906SRiku Voipiofi 50353b3f24adSaurel32if test "$inotify" = "yes" ; then 50362358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 50373b3f24adSaurel32fi 5038c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 5039c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 5040c05c7a73SRiku Voipiofi 50416ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 50426ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 50436ae9a1f4SJuan Quintelafi 50446ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 50456ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 50466ae9a1f4SJuan Quintelafi 5047769ce76dSAlexander Grafif test "$curl" = "yes" ; then 5048d3399d7cSFam Zheng echo "CONFIG_CURL=m" >> $config_host_mak 5049b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 50506ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 5051769ce76dSAlexander Graffi 50522e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 505398ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 50542e4d9fb1Saurel32fi 5055fb599c9aSbalrogif test "$bluez" = "yes" ; then 505698ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 5057ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 5058fb599c9aSbalrogfi 5059d46f7c9eSDr. David Alan Gilbertif test "$glib_subprocess" = "yes" ; then 50609d41401bSMichael S. Tsirkin echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak 50619d41401bSMichael S. Tsirkinfi 5062e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 5063a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 5064a4ccabcfSAnthony Liguori echo "CONFIG_GTK=y" >> $config_host_mak 5065a3f4d63dSCole Robinson echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak 5066a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 5067*014cb152SGerd Hoffmann echo "GTK_LIBS=$gtk_libs" >> $config_host_mak 5068925a0400SGerd Hoffmann if test "$gtk_gl" = "yes" ; then 5069925a0400SGerd Hoffmann echo "CONFIG_GTK_GL=y" >> $config_host_mak 5070925a0400SGerd Hoffmann fi 5071bbbf9bfbSStefan Weilfi 5072ddbb0d09SDaniel P. Berrangeif test "$gnutls" = "yes" ; then 5073ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS=y" >> $config_host_mak 5074ddbb0d09SDaniel P. Berrangefi 5075ddbb0d09SDaniel P. Berrangeif test "$gnutls_hash" = "yes" ; then 5076ddbb0d09SDaniel P. Berrange echo "CONFIG_GNUTLS_HASH=y" >> $config_host_mak 5077ddbb0d09SDaniel P. Berrangefi 507891bfcdb0SDaniel P. Berrangeif test "$gcrypt" = "yes" ; then 507991bfcdb0SDaniel P. Berrange echo "CONFIG_GCRYPT=y" >> $config_host_mak 508062893b67SDaniel P. Berrangefi 508191bfcdb0SDaniel P. Berrangeif test "$nettle" = "yes" ; then 508291bfcdb0SDaniel P. Berrange echo "CONFIG_NETTLE=y" >> $config_host_mak 5083becaeb72SRadim Krčmář echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak 5084ed754746SDaniel P. Berrangefi 50859a2fd434SDaniel P. Berrangeif test "$tasn1" = "yes" ; then 50869a2fd434SDaniel P. Berrange echo "CONFIG_TASN1=y" >> $config_host_mak 50879a2fd434SDaniel P. Berrangefi 5088559607eaSDaniel P. Berrangeif test "$have_ifaddrs_h" = "yes" ; then 5089559607eaSDaniel P. Berrange echo "HAVE_IFADDRS_H=y" >> $config_host_mak 5090559607eaSDaniel P. Berrangefi 5091bbbf9bfbSStefan Weilif test "$vte" = "yes" ; then 5092bbbf9bfbSStefan Weil echo "CONFIG_VTE=y" >> $config_host_mak 5093a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 5094a4ccabcfSAnthony Liguorifi 50959d9e1521SGerd Hoffmannif test "$virglrenderer" = "yes" ; then 50969d9e1521SGerd Hoffmann echo "CONFIG_VIRGL=y" >> $config_host_mak 50979d9e1521SGerd Hoffmann echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak 50989d9e1521SGerd Hoffmann echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak 50999d9e1521SGerd Hoffmannfi 5100e37630caSaliguoriif test "$xen" = "yes" ; then 51016dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 5102d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 510364a7ad6fSIan Campbell if test "$xen_pv_domain_build" = "yes" ; then 510464a7ad6fSIan Campbell echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak 510564a7ad6fSIan Campbell fi 5106e37630caSaliguorifi 51075c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 51085c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 51095c6c3a6cSChristoph Hellwigfi 5110758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 5111758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 5112758e8e38SVenkateswararao Jujjuri (JV)fi 51134f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 51144f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 51154f26f2b6SAvi Kivityfi 5116983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 5117758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 5118758e8e38SVenkateswararao Jujjuri (JV)fi 51195e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 51205e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 51215e9be92dSNicholas Bellingerfi 512203ce5744SNikolay Nikolaevif test "$vhost_net" = "yes" ; then 512303ce5744SNikolay Nikolaev echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak 512403ce5744SNikolay Nikolaevfi 512577755340Sthsif test "$blobs" = "yes" ; then 512698ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 512777755340Sthsfi 5128bf9298b9Saliguoriif test "$iovec" = "yes" ; then 51292358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 5130bf9298b9Saliguorifi 5131ceb42de8Saliguoriif test "$preadv" = "yes" ; then 51322358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 5133ceb42de8Saliguorifi 5134f652e6afSaurel32if test "$fdt" = "yes" ; then 51353f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 5136f652e6afSaurel32fi 5137dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 5138dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 5139dcc38d1cSMarcelo Tosattifi 51409195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 51419195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 51429195b2c2SStefan Weilfi 51435f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 51445f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 51455f6b9e8fSBlue Swirlfi 5146e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 5147e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 5148e78815a5SAndreas Färberfi 5149e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 5150e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 5151e78815a5SAndreas Färberfi 51521e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then 51531e9737daSRichard Henderson echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak 51541e9737daSRichard Hendersonfi 515597a847bcSbellard 5156cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 5157cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 5158cd4ec0b4SGerd Hoffmannfi 5159cd4ec0b4SGerd Hoffmann 51607b02f544SMarc-André Lureauif test "$smartcard" = "yes" ; then 51617b02f544SMarc-André Lureau echo "CONFIG_SMARTCARD=y" >> $config_host_mak 5162111a38b0SRobert Relyeafi 5163111a38b0SRobert Relyea 51642b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 51652b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 51662b2325ffSGerd Hoffmannfi 51672b2325ffSGerd Hoffmann 516869354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 516969354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 517069354a83SHans de Goedefi 517169354a83SHans de Goede 5172da076ffeSGerd Hoffmannif test "$opengl" = "yes" ; then 5173da076ffeSGerd Hoffmann echo "CONFIG_OPENGL=y" >> $config_host_mak 5174f676c67eSJeremy White echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak 5175da076ffeSGerd Hoffmann echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak 5176*014cb152SGerd Hoffmann if test "$opengl_dmabuf" = "yes" ; then 5177*014cb152SGerd Hoffmann echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak 5178*014cb152SGerd Hoffmann fi 517920ff075bSMichael Wallefi 518020ff075bSMichael Walle 5181607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 5182607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 5183607dacd0Sqiaonuohanfi 5184607dacd0Sqiaonuohan 5185607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 5186607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 5187607dacd0Sqiaonuohanfi 5188607dacd0Sqiaonuohan 51896b383c08SPeter Wuif test "$bzip2" = "yes" ; then 51906b383c08SPeter Wu echo "CONFIG_BZIP2=y" >> $config_host_mak 51916b383c08SPeter Wu echo "BZIP2_LIBS=-lbz2" >> $config_host_mak 51926b383c08SPeter Wufi 51936b383c08SPeter Wu 5194c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 5195d3399d7cSFam Zheng echo "CONFIG_LIBISCSI=m" >> $config_host_mak 51966ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 51976ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 5198c589b249SRonnie Sahlbergfi 5199c589b249SRonnie Sahlberg 52006542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 52016542aa9cSPeter Lieven echo "CONFIG_LIBNFS=y" >> $config_host_mak 52026542aa9cSPeter Lievenfi 52036542aa9cSPeter Lieven 5204f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 5205f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 5206f794573eSEduardo Otubofi 5207f794573eSEduardo Otubo 520883fb7adfSbellard# XXX: suppress that 52097d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 52102358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 52117d3505c5Sbellardfi 52127d3505c5Sbellard 521320ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 521420ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 521520ff6c80SAnthony Liguorifi 52164d9310f4SDaniel P. Berrangeif test "$localtime_r" = "yes" ; then 52174d9310f4SDaniel P. Berrange echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak 52184d9310f4SDaniel P. Berrangefi 52193556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 52203556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 52213556c233SPaolo Bonzinifi 5222f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 5223d3399d7cSFam Zheng echo "CONFIG_RBD=m" >> $config_host_mak 52246ebc91e5SFam Zheng echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 52256ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 5226f27aaf4bSChristian Brunnerfi 522720ff6c80SAnthony Liguori 52287c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 522970c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 523070c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 523170c60c08SStefan Hajnoczielse 523270c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 523370c60c08SStefan Hajnoczifi 5234d0e2fce5SAneesh Kumar K.V 5235d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 5236d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 5237d2042378SAneesh Kumar K.Vfi 5238d2042378SAneesh Kumar K.V 5239e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 5240e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 5241e06a765eSHarsh Prateek Borafi 5242e06a765eSHarsh Prateek Bora 5243cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then 5244cc6e3ca9SGerd Hoffmann echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 524506d71fa1SPeter Maydellfi 524606d71fa1SPeter Maydell 52473f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 52483f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 52493f4349dcSKevin Wolffi 52503f4349dcSKevin Wolf 52518ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 52528ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 52538ab1bf12SLuiz Capitulinofi 52548ab1bf12SLuiz Capitulino 525576a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 525676a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 525776a347e1SRichard Hendersonfi 525876a347e1SRichard Henderson 5259f540166bSRichard Hendersonif test "$int128" = "yes" ; then 5260f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 5261f540166bSRichard Hendersonfi 5262f540166bSRichard Henderson 52631e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 52641e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 52651e6e9acaSRichard Hendersonfi 52661e6e9acaSRichard Henderson 5267eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 5268d3399d7cSFam Zheng echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 52696ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 52706ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 5271eb100396SBharata B Raofi 5272eb100396SBharata B Rao 52730c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 52740c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 52750c14fb47SBharata B Raofi 52760c14fb47SBharata B Rao 52777c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 52787c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 52797c815372SBharata B Raofi 52807c815372SBharata B Rao 5281c9a12e75SChrysostomos Nanakosif test "$archipelago" = "yes" ; then 5282c9a12e75SChrysostomos Nanakos echo "CONFIG_ARCHIPELAGO=m" >> $config_host_mak 5283c9a12e75SChrysostomos Nanakos echo "ARCHIPELAGO_LIBS=$archipelago_libs" >> $config_host_mak 5284c9a12e75SChrysostomos Nanakosfi 5285c9a12e75SChrysostomos Nanakos 52860a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then 5287d3399d7cSFam Zheng echo "CONFIG_LIBSSH2=m" >> $config_host_mak 52886ebc91e5SFam Zheng echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak 52896ebc91e5SFam Zheng echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak 52900a12ec87SRichard W.M. Jonesfi 52910a12ec87SRichard W.M. Jones 52924f18b782SJeff Codyif test "$vhdx" = "yes" ; then 52934f18b782SJeff Cody echo "CONFIG_VHDX=y" >> $config_host_mak 52944f18b782SJeff Codyfi 52954f18b782SJeff Cody 529668063649Sblueswir1# USB host support 5297b5613fdcSGerd Hoffmannif test "$libusb" = "yes"; then 52982b2325ffSGerd Hoffmann echo "HOST_USB=libusb legacy" >> $config_host_mak 5299b5613fdcSGerd Hoffmannelse 530098ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 5301b5613fdcSGerd Hoffmannfi 530268063649Sblueswir1 53033b8acc11SPaolo Bonzini# TPM passthrough support? 53043b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 53053b8acc11SPaolo Bonzini echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak 53063b8acc11SPaolo Bonzini if test "$tpm_passthrough" = "yes"; then 53073b8acc11SPaolo Bonzini echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak 53083b8acc11SPaolo Bonzini fi 53093b8acc11SPaolo Bonzinifi 53103b8acc11SPaolo Bonzini 53115b808275SLluís Vilanovaecho "TRACE_BACKENDS=$trace_backends" >> $config_host_mak 53125b808275SLluís Vilanovaif have_backend "nop"; then 53136d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 531422890ab5SPrerna Saxenafi 53155b808275SLluís Vilanovaif have_backend "simple"; then 53166d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 53176d8a764eSLluís # Set the appropriate trace file. 5318953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 53199410b56cSPrerna Saxenafi 5320ed7f5f1dSPaolo Bonziniif have_backend "log"; then 5321ed7f5f1dSPaolo Bonzini echo "CONFIG_TRACE_LOG=y" >> $config_host_mak 53226d8a764eSLluísfi 53235b808275SLluís Vilanovaif have_backend "ust"; then 53246d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 53256d8a764eSLluísfi 53265b808275SLluís Vilanovaif have_backend "dtrace"; then 53276d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 53286d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 53296d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 53306d8a764eSLluís fi 5331c276b17dSDaniel P. Berrangefi 53325b808275SLluís Vilanovaif have_backend "ftrace"; then 5333781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 5334781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 5335781e9545SEiichi Tsukata else 533621684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 5337781e9545SEiichi Tsukata fi 5338781e9545SEiichi Tsukatafi 53399410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 53409410b56cSPrerna Saxena 53412da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 53422da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 53432da776dbSMichael R. Hinesfi 53442da776dbSMichael R. Hines 53455c312079SDr. David Alan Gilbert# Hold two types of flag: 53465c312079SDr. David Alan Gilbert# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on 53475c312079SDr. David Alan Gilbert# a thread we have a handle to 53485c312079SDr. David Alan Gilbert# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular 53495c312079SDr. David Alan Gilbert# platform 53505c312079SDr. David Alan Gilbertif test "$pthread_setname_np" = "yes" ; then 53515c312079SDr. David Alan Gilbert echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak 53525c312079SDr. David Alan Gilbert echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak 53535c312079SDr. David Alan Gilbertfi 53545c312079SDr. David Alan Gilbert 53555b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 53565b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 53575b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 53585b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 53595b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 53605b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 5361c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then 53625b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 536340d964b5SRichard Hendersonelif test "$ARCH" = "ppc64" ; then 536440d964b5SRichard Henderson QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" 53655b5e3037SPaolo Bonzinielse 53665b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 53675b5e3037SPaolo Bonzinifi 53685b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES" 53695b5e3037SPaolo Bonzini 537098ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 537198ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 5372804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 5373804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 53741901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 53751901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 53761901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 537721655882SPaolo Bonziniecho "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 5378c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 5379804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 5380a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 5381a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_host_mak 5382a31a8642SMichael S. Tsirkinfi 53832b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 5384804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 538583f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 53863c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 5387804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 538845d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 53893dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak 53903dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 5391804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 5392804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 53934852ee95SStefan Weilecho "NM=$nm" >> $config_host_mak 53949fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 5395e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 539646eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 5397a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 5398f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 5399e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 5400e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 540180fd48dfSChristian Borntraeger echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak 54022944d742SGerd Hoffmann echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak 5403e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 5404e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 5405e39f0062SPaolo Bonzinifi 540642da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 540742da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 540842da6041SGerd Hoffmannelse 540942da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 541042da6041SGerd Hoffmannfi 5411e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 541246eef33bSBradecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 541373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 54143e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 5415804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 541617969268SFam Zhengecho "DSOSUF=$DSOSUF" >> $config_host_mak 541717969268SFam Zhengecho "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 5418957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 541990246037SDaniel P. Berrangeecho "TASN1_LIBS=$tasn1_libs" >> $config_host_mak 542090246037SDaniel P. Berrangeecho "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak 542194dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 5422cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 54231d728c39SBlue Swirlif test "$gcov" = "yes" ; then 54241d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 54251d728c39SBlue Swirl echo "GCOV=$gcov_tool" >> $config_host_mak 54261d728c39SBlue Swirlfi 5427804edf29SJuan Quintela 54286efd7517SPeter Maydell# use included Linux headers 54296efd7517SPeter Maydellif test "$linux" = "yes" ; then 5430a307beb6SAndreas Färber mkdir -p linux-headers 54316efd7517SPeter Maydell case "$cpu" in 5432c72b26ecSRichard Henderson i386|x86_64|x32) 543308312a63SPeter Maydell linux_arch=x86 54346efd7517SPeter Maydell ;; 54356efd7517SPeter Maydell ppcemb|ppc|ppc64) 543608312a63SPeter Maydell linux_arch=powerpc 54376efd7517SPeter Maydell ;; 54386efd7517SPeter Maydell s390x) 543908312a63SPeter Maydell linux_arch=s390 544008312a63SPeter Maydell ;; 54411f080313SClaudio Fontana aarch64) 54421f080313SClaudio Fontana linux_arch=arm64 54431f080313SClaudio Fontana ;; 5444222e7d11SSanjay Lal mips64) 5445222e7d11SSanjay Lal linux_arch=mips 5446222e7d11SSanjay Lal ;; 544708312a63SPeter Maydell *) 544808312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 544908312a63SPeter Maydell linux_arch="$cpu" 54506efd7517SPeter Maydell ;; 54516efd7517SPeter Maydell esac 545208312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 545308312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 545408312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 545508312a63SPeter Maydell fi 54566efd7517SPeter Maydellfi 54576efd7517SPeter Maydell 545897a847bcSbellardfor target in $target_list; do 545997a847bcSbellardtarget_dir="$target" 546025be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 5461c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1` 546297a847bcSbellardtarget_bigendian="no" 54631f3d3c8fSJuan Quintela 5464c1799a84SPaolo Bonzinicase "$target_name" in 5465d15a9c23SAnthony Green armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 5466ea2d6a39SJuan Quintela target_bigendian=yes 5467ea2d6a39SJuan Quintela ;; 5468ea2d6a39SJuan Quintelaesac 546997a847bcSbellardtarget_softmmu="no" 5470997344f3Sbellardtarget_user_only="no" 5471831b7825Sthstarget_linux_user="no" 547284778508Sblueswir1target_bsd_user="no" 54739e407a85Spbrookcase "$target" in 5474c1799a84SPaolo Bonzini ${target_name}-softmmu) 54759e407a85Spbrook target_softmmu="yes" 54769e407a85Spbrook ;; 5477c1799a84SPaolo Bonzini ${target_name}-linux-user) 54789c7a4202SBlue Swirl if test "$linux" != "yes" ; then 547976ad07a4SPeter Maydell error_exit "Target '$target' is only available on a Linux host" 54809c7a4202SBlue Swirl fi 54819e407a85Spbrook target_user_only="yes" 54829e407a85Spbrook target_linux_user="yes" 54839e407a85Spbrook ;; 5484c1799a84SPaolo Bonzini ${target_name}-bsd-user) 54859cf55765SBlue Swirl if test "$bsd" != "yes" ; then 548676ad07a4SPeter Maydell error_exit "Target '$target' is only available on a BSD host" 54879c7a4202SBlue Swirl fi 548884778508Sblueswir1 target_user_only="yes" 548984778508Sblueswir1 target_bsd_user="yes" 549084778508Sblueswir1 ;; 54919e407a85Spbrook *) 549276ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 54939e407a85Spbrook exit 1 54949e407a85Spbrook ;; 54959e407a85Spbrookesac 5496831b7825Sths 549797a847bcSbellardmkdir -p $target_dir 549825be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 549997a847bcSbellard 5500e5fe0c52Spbrookbflt="no" 5501c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"` 550256aebc89Spbrookgdb_xml_files="" 55037ba1e619Saliguori 5504c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 55056acff7daSJuan QuintelaTARGET_BASE_ARCH="" 5506e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 5507e73aae67SJuan Quintela 5508c1799a84SPaolo Bonzinicase "$target_name" in 55092408a527Saurel32 i386) 55102408a527Saurel32 ;; 55112408a527Saurel32 x86_64) 55126acff7daSJuan Quintela TARGET_BASE_ARCH=i386 55132408a527Saurel32 ;; 55142408a527Saurel32 alpha) 55152408a527Saurel32 ;; 55162408a527Saurel32 arm|armeb) 5517b498c8a0SJuan Quintela TARGET_ARCH=arm 5518e5fe0c52Spbrook bflt="yes" 551956aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 55202408a527Saurel32 ;; 55216a49fa95SAlexander Graf aarch64) 55226a49fa95SAlexander Graf TARGET_BASE_ARCH=arm 55236a49fa95SAlexander Graf bflt="yes" 55248f95ce2eSPeter Maydell gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 55256a49fa95SAlexander Graf ;; 55262408a527Saurel32 cris) 55272408a527Saurel32 ;; 5528613a22c9SMichael Walle lm32) 5529613a22c9SMichael Walle ;; 55302408a527Saurel32 m68k) 55310938cda5Saurel32 bflt="yes" 553256aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 55332408a527Saurel32 ;; 5534877fdc12SEdgar E. Iglesias microblaze|microblazeel) 5535877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 553672b675caSEdgar E. Iglesias bflt="yes" 553772b675caSEdgar E. Iglesias ;; 55382408a527Saurel32 mips|mipsel) 5539b498c8a0SJuan Quintela TARGET_ARCH=mips 554025be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 55412408a527Saurel32 ;; 55422408a527Saurel32 mipsn32|mipsn32el) 5543597e2cecSRichard Henderson TARGET_ARCH=mips64 55446acff7daSJuan Quintela TARGET_BASE_ARCH=mips 554525be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 5546597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 55472408a527Saurel32 ;; 55482408a527Saurel32 mips64|mips64el) 5549b498c8a0SJuan Quintela TARGET_ARCH=mips64 55506acff7daSJuan Quintela TARGET_BASE_ARCH=mips 555125be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 55522408a527Saurel32 ;; 5553d15a9c23SAnthony Green moxie) 5554d15a9c23SAnthony Green ;; 5555e67db06eSJia Liu or32) 5556e67db06eSJia Liu TARGET_ARCH=openrisc 5557e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 5558e67db06eSJia Liu ;; 55592408a527Saurel32 ppc) 5560c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 55612408a527Saurel32 ;; 55622408a527Saurel32 ppcemb) 55636acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 5564e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 5565c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 55662408a527Saurel32 ;; 55672408a527Saurel32 ppc64) 55686acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 5569e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 55701438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 55712408a527Saurel32 ;; 55729c35126cSDoug Kwan ppc64le) 55739c35126cSDoug Kwan TARGET_ARCH=ppc64 55749c35126cSDoug Kwan TARGET_BASE_ARCH=ppc 55759c35126cSDoug Kwan TARGET_ABI_DIR=ppc 55761438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 55779c35126cSDoug Kwan ;; 55782408a527Saurel32 ppc64abi32) 5579b498c8a0SJuan Quintela TARGET_ARCH=ppc64 55806acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 5581e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 558225be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 55831438eff3SAnton Blanchard gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" 55842408a527Saurel32 ;; 55852408a527Saurel32 sh4|sh4eb) 5586b498c8a0SJuan Quintela TARGET_ARCH=sh4 55874dbed897Spbrook bflt="yes" 55882408a527Saurel32 ;; 55892408a527Saurel32 sparc) 55902408a527Saurel32 ;; 55912408a527Saurel32 sparc64) 55926acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 55932408a527Saurel32 ;; 55942408a527Saurel32 sparc32plus) 5595b498c8a0SJuan Quintela TARGET_ARCH=sparc64 55966acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 5597e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 559825be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 55992408a527Saurel32 ;; 560024e804ecSAlexander Graf s390x) 56018a641ff6SDavid Hildenbrand gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml" 560224e804ecSAlexander Graf ;; 5603444e06b1SChen Gang tilegx) 5604444e06b1SChen Gang ;; 56055ecaa4edSPeter Crosthwaite tricore) 56065ecaa4edSPeter Crosthwaite ;; 5607d2fbca94SGuan Xuetao unicore32) 5608d2fbca94SGuan Xuetao ;; 5609cfa550c6SMax Filippov xtensa|xtensaeb) 5610cfa550c6SMax Filippov TARGET_ARCH=xtensa 5611cfa550c6SMax Filippov ;; 56122408a527Saurel32 *) 561376ad07a4SPeter Maydell error_exit "Unsupported target CPU" 56142408a527Saurel32 ;; 56152408a527Saurel32esac 56165e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 56175e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 56185e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 56195e8861a0SPaolo Bonzinifi 56205e8861a0SPaolo Bonzini 56215e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 56225e8861a0SPaolo Bonzini 562399afc91dSDaniel P. Berrangeupper() { 562499afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 562599afc91dSDaniel P. Berrange} 562699afc91dSDaniel P. Berrange 562799afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`" 562825be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 5629c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 563025be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 5631e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 5632e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 5633e6e91b9cSJuan Quintelafi 563425be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 5635adfc3e91SStacey Sonif [ "$HOST_VARIANT_DIR" != "" ]; then 5636adfc3e91SStacey Son echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak 5637adfc3e91SStacey Sonfi 5638c1799a84SPaolo Bonzinicase "$target_name" in 56391b0c87fcSJuan Quintela i386|x86_64) 56401b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 564125be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 5642eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 5643eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 5644eb6fda0fSAnthony PERARD fi 5645432d268cSJun Nakajima fi 564659d21e53SAlexander Graf ;; 564759d21e53SAlexander Graf *) 56481b0c87fcSJuan Quintelaesac 5649c1799a84SPaolo Bonzinicase "$target_name" in 5650222e7d11SSanjay Lal aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips) 5651c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 5652c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 5653c1799a84SPaolo Bonzini \( "$target_name" = "$cpu" -o \ 5654c1799a84SPaolo Bonzini \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 5655c1799a84SPaolo Bonzini \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \ 5656c1799a84SPaolo Bonzini \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \ 5657c1799a84SPaolo Bonzini \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 5658222e7d11SSanjay Lal \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \ 5659c1799a84SPaolo Bonzini \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \ 566018b8263eSMichael Tokarev \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \ 566118b8263eSMichael Tokarev \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \ 566218b8263eSMichael Tokarev \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then 566325be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 56641ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 5665d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 5666421f4448SMarc-André Lureau echo "CONFIG_VHOST_NET_TEST_$target_name=y" >> $config_host_mak 5667d5970055SMichael S. Tsirkin fi 5668c59249f9SJuan Quintela fi 5669c59249f9SJuan Quintelaesac 5670de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 567125be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 567297a847bcSbellardfi 567397a847bcSbellardif test "$target_softmmu" = "yes" ; then 567425be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 5675de83cd02Sbellardfi 5676997344f3Sbellardif test "$target_user_only" = "yes" ; then 567725be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 5678a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 5679997344f3Sbellardfi 5680831b7825Sthsif test "$target_linux_user" = "yes" ; then 568125be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 5682831b7825Sthsfi 568356aebc89Spbrooklist="" 568456aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 568556aebc89Spbrook for x in $gdb_xml_files; do 568656aebc89Spbrook list="$list $source_path/gdb-xml/$x" 568756aebc89Spbrook done 568825be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 56893d0f1517SJuan Quintelafi 5690de83cd02Sbellard 5691e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 569225be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 5693e5fe0c52Spbrookfi 569484778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 569525be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 569684778508Sblueswir1fi 56975b0753e0Sbellard 56984afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 5699fa282484SJuan Quintela 57004afddb55SJuan Quintelacflags="" 5701fa282484SJuan Quintelaldflags="" 57029b8e111fSJuan Quintela 5703c765fcacSPeter Crosthwaitedisas_config() { 5704c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> $config_target_mak 5705c765fcacSPeter Crosthwaite echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak 5706c765fcacSPeter Crosthwaite} 5707c765fcacSPeter Crosthwaite 570864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 570964656024SJuan Quintela case "$i" in 571064656024SJuan Quintela alpha) 5711c765fcacSPeter Crosthwaite disas_config "ALPHA" 571264656024SJuan Quintela ;; 571382295d8aSRichard Henderson aarch64) 571482295d8aSRichard Henderson if test -n "${cxx}"; then 5715c765fcacSPeter Crosthwaite disas_config "ARM_A64" 571682295d8aSRichard Henderson fi 571782295d8aSRichard Henderson ;; 571864656024SJuan Quintela arm) 5719c765fcacSPeter Crosthwaite disas_config "ARM" 5720999b53ecSClaudio Fontana if test -n "${cxx}"; then 5721c765fcacSPeter Crosthwaite disas_config "ARM_A64" 5722999b53ecSClaudio Fontana fi 572364656024SJuan Quintela ;; 572464656024SJuan Quintela cris) 5725c765fcacSPeter Crosthwaite disas_config "CRIS" 572664656024SJuan Quintela ;; 572764656024SJuan Quintela hppa) 5728c765fcacSPeter Crosthwaite disas_config "HPPA" 572964656024SJuan Quintela ;; 5730c72b26ecSRichard Henderson i386|x86_64|x32) 5731c765fcacSPeter Crosthwaite disas_config "I386" 573264656024SJuan Quintela ;; 5733903ec55cSAurelien Jarno ia64*) 5734c765fcacSPeter Crosthwaite disas_config "IA64" 5735903ec55cSAurelien Jarno ;; 573679368f49SMichael Walle lm32) 5737c765fcacSPeter Crosthwaite disas_config "LM32" 573879368f49SMichael Walle ;; 573964656024SJuan Quintela m68k) 5740c765fcacSPeter Crosthwaite disas_config "M68K" 574164656024SJuan Quintela ;; 5742877fdc12SEdgar E. Iglesias microblaze*) 5743c765fcacSPeter Crosthwaite disas_config "MICROBLAZE" 574464656024SJuan Quintela ;; 574564656024SJuan Quintela mips*) 5746c765fcacSPeter Crosthwaite disas_config "MIPS" 574764656024SJuan Quintela ;; 5748d15a9c23SAnthony Green moxie*) 5749c765fcacSPeter Crosthwaite disas_config "MOXIE" 5750d15a9c23SAnthony Green ;; 5751e67db06eSJia Liu or32) 5752c765fcacSPeter Crosthwaite disas_config "OPENRISC" 5753e67db06eSJia Liu ;; 575464656024SJuan Quintela ppc*) 5755c765fcacSPeter Crosthwaite disas_config "PPC" 575664656024SJuan Quintela ;; 575724e804ecSAlexander Graf s390*) 5758c765fcacSPeter Crosthwaite disas_config "S390" 575964656024SJuan Quintela ;; 576064656024SJuan Quintela sh4) 5761c765fcacSPeter Crosthwaite disas_config "SH4" 576264656024SJuan Quintela ;; 576364656024SJuan Quintela sparc*) 5764c765fcacSPeter Crosthwaite disas_config "SPARC" 576564656024SJuan Quintela ;; 5766cfa550c6SMax Filippov xtensa*) 5767c765fcacSPeter Crosthwaite disas_config "XTENSA" 5768cfa550c6SMax Filippov ;; 576964656024SJuan Quintela esac 577064656024SJuan Quinteladone 57719195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 5772c765fcacSPeter Crosthwaite disas_config "TCI" 57739195b2c2SStefan Weilfi 577464656024SJuan Quintela 57756ee7126fSJuan Quintelacase "$ARCH" in 57766ee7126fSJuan Quintelaalpha) 57776ee7126fSJuan Quintela # Ensure there's only a single GP 57786ee7126fSJuan Quintela cflags="-msmall-data $cflags" 57796ee7126fSJuan Quintela;; 57806ee7126fSJuan Quintelaesac 57816ee7126fSJuan Quintela 5782d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 578325be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 5784d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 5785d02c1db3SJuan Quintela cflags="-p $cflags" 5786d02c1db3SJuan Quintela ldflags="-p $ldflags" 5787d02c1db3SJuan Quintela fi 5788d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 5789d02c1db3SJuan Quintela ldflags="-p $ldflags" 579025be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 5791d02c1db3SJuan Quintela fi 5792d02c1db3SJuan Quintelafi 5793d02c1db3SJuan Quintela 57949b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 5795964c6fa1SRichard Henderson ldflags="$ldflags $textseg_ldflags" 5796fa282484SJuan Quintelafi 5797fa282484SJuan Quintela 579825be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 579925be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 5800fa282484SJuan Quintela 580197a847bcSbellarddone # for target in $targets 58027d13299dSbellard 5803b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then 5804b776eca1SGerd Hoffmann echo "config-host.h: subdir-pixman" >> $config_host_mak 5805b776eca1SGerd Hoffmannfi 5806b776eca1SGerd Hoffmann 5807a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then 5808a540f158SPeter Crosthwaite echo "config-host.h: subdir-dtc" >> $config_host_mak 5809a540f158SPeter Crosthwaitefi 5810a540f158SPeter Crosthwaite 5811a99d57bbSWanlong Gaoif test "$numa" = "yes"; then 5812a99d57bbSWanlong Gao echo "CONFIG_NUMA=y" >> $config_host_mak 5813a99d57bbSWanlong Gaofi 5814a99d57bbSWanlong Gao 5815fd0e6053SJohn Snowif test "$ccache_cpp2" = "yes"; then 5816fd0e6053SJohn Snow echo "export CCACHE_CPP2=y" >> $config_host_mak 5817fd0e6053SJohn Snowfi 5818fd0e6053SJohn Snow 5819d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 5820f93296eaSWenchao XiaDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests" 58212b170effSMichael TokarevDIRS="$DIRS fsdev" 58229933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" 58232d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 58242dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated" 5825c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 5826c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 5827aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" 5828ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 5829446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 58309933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile" 58312d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 58324652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp" 5833753d11f2SRichard Hendersonfor bios_file in \ 5834753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 58355acc2ec0SGerd Hoffmann $source_path/pc-bios/*.aml \ 5836753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 5837753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 5838e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 5839753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 58404e73c781SAlexander Graf $source_path/pc-bios/u-boot.* \ 5841753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 5842753d11f2SRichard Hendersondo 58437ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 58447ea78b74SJan Kiszkadone 5845c2304b52SMarcel Apfelbaumfor test_file in `find $source_path/tests/acpi-test-data -type f` 5846c2304b52SMarcel Apfelbaumdo 5847c2304b52SMarcel Apfelbaum FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`" 5848c2304b52SMarcel Apfelbaumdone 5849d1807a4fSPaolo Bonzinimkdir -p $DIRS 58507d13299dSbellardfor f in $FILES ; do 5851cab00a5aSMichael S. Tsirkin if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then 5852f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 5853f9245e10SPeter Maydell fi 58547d13299dSbellarddone 58551ad2134fSPaul Brook 5856c34ebfdcSAnthony Liguori# temporary config to build submodules 58572d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 5858c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 585937116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 5860c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 58613dd46c78SBlue Swirl echo "AS=$as" >> $config_mak 5862c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 5863c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 58643dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 5865c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 5866a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 5867c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 5868c34ebfdcSAnthony Liguoridone 5869c34ebfdcSAnthony Liguori 587076c7560aSMax Reitz# set up qemu-iotests in this build directory 587176c7560aSMax Reitziotests_common_env="tests/qemu-iotests/common.env" 587276c7560aSMax Reitziotests_check="tests/qemu-iotests/check" 587376c7560aSMax Reitz 587476c7560aSMax Reitzecho "# Automatically generated by configure - do not modify" > "$iotests_common_env" 587576c7560aSMax Reitzecho >> "$iotests_common_env" 587676c7560aSMax Reitzecho "export PYTHON='$python'" >> "$iotests_common_env" 587776c7560aSMax Reitz 587876c7560aSMax Reitzif [ ! -e "$iotests_check" ]; then 587976c7560aSMax Reitz symlink "$source_path/$iotests_check" "$iotests_check" 588076c7560aSMax Reitzfi 588176c7560aSMax Reitz 5882dc655404SMichael S. Tsirkin# Save the configure command line for later reuse. 5883dc655404SMichael S. Tsirkincat <<EOD >config.status 5884dc655404SMichael S. Tsirkin#!/bin/sh 5885dc655404SMichael S. Tsirkin# Generated by configure. 5886dc655404SMichael S. Tsirkin# Run this file to recreate the current configuration. 5887dc655404SMichael S. Tsirkin# Compiler output produced by configure, useful for debugging 5888dc655404SMichael S. Tsirkin# configure, is in config.log if it exists. 5889dc655404SMichael S. TsirkinEOD 5890dc655404SMichael S. Tsirkinprintf "exec" >>config.status 5891dc655404SMichael S. Tsirkinprintf " '%s'" "$0" "$@" >>config.status 5892dc655404SMichael S. Tsirkinecho >>config.status 5893dc655404SMichael S. Tsirkinchmod +x config.status 5894dc655404SMichael S. Tsirkin 58958cd05ab6SPeter Maydellrm -r "$TMPDIR1" 5896