17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 57d13299dSbellard# set temporary file name 67d13299dSbellardif test ! -z "$TMPDIR" ; then 77d13299dSbellard TMPDIR1="${TMPDIR}" 87d13299dSbellardelif test ! -z "$TEMPDIR" ; then 97d13299dSbellard TMPDIR1="${TEMPDIR}" 107d13299dSbellardelse 117d13299dSbellard TMPDIR1="/tmp" 127d13299dSbellardfi 137d13299dSbellard 143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" 1566518bf6SDon SlutzTMPB="qemu-conf-${RANDOM}-$$-${RANDOM}" 1666518bf6SDon SlutzTMPO="${TMPDIR1}/${TMPB}.o" 1766518bf6SDon SlutzTMPL="${TMPDIR1}/${TMPB}.lo" 1866518bf6SDon SlutzTMPA="${TMPDIR1}/lib${TMPB}.la" 19a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" 207d13299dSbellard 210ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells; 220ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> 230ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM 24da1d85e3SGerd Hoffmannrm -f config.log 259ac81bbbSmalc 26b48e3611SPeter Maydell# Print a helpful header at the top of config.log 27b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 28979ae168SPeter Maydellprintf "# Configured with:" >> config.log 29979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 30979ae168SPeter Maydellecho >> config.log 31b48e3611SPeter Maydellecho "#" >> config.log 32b48e3611SPeter Maydell 33bdf523e6SStefan Weil# Save the configure command line for later reuse. 34bdf523e6SStefan Weilcat <<EOD >config.status 35bdf523e6SStefan Weil#!/bin/sh 36bdf523e6SStefan Weil# Generated by configure. 37bdf523e6SStefan Weil# Run this file to recreate the current configuration. 38bdf523e6SStefan Weil# Compiler output produced by configure, useful for debugging 39bdf523e6SStefan Weil# configure, is in config.log if it exists. 40bdf523e6SStefan WeilEOD 41bdf523e6SStefan Weilprintf "exec" >>config.status 42bdf523e6SStefan Weilprintf " '%s'" "$0" "$@" >>config.status 43bdf523e6SStefan Weilecho >>config.status 44bdf523e6SStefan Weilchmod +x config.status 45bdf523e6SStefan Weil 4676ad07a4SPeter Maydellerror_exit() { 4776ad07a4SPeter Maydell echo 4876ad07a4SPeter Maydell echo "ERROR: $1" 4976ad07a4SPeter Maydell while test -n "$2"; do 5076ad07a4SPeter Maydell echo " $2" 5176ad07a4SPeter Maydell shift 5276ad07a4SPeter Maydell done 5376ad07a4SPeter Maydell echo 5476ad07a4SPeter Maydell exit 1 5576ad07a4SPeter Maydell} 5676ad07a4SPeter Maydell 578dc38a78SPeter Maydelldo_cc() { 588dc38a78SPeter Maydell # Run the compiler, capturing its output to the log. 598dc38a78SPeter Maydell echo $cc "$@" >> config.log 608dc38a78SPeter Maydell $cc "$@" >> config.log 2>&1 || return $? 618dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 628dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 638dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 648dc38a78SPeter Maydell # obvious to developers. 658dc38a78SPeter Maydell if test "$werror" != "yes"; then 668dc38a78SPeter Maydell return 0 678dc38a78SPeter Maydell fi 688dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 698dc38a78SPeter Maydell case "$*" in 708dc38a78SPeter Maydell *-Werror*) 718dc38a78SPeter Maydell return 0 728dc38a78SPeter Maydell ;; 738dc38a78SPeter Maydell esac 748dc38a78SPeter Maydell echo $cc -Werror "$@" >> config.log 758dc38a78SPeter Maydell $cc -Werror "$@" >> config.log 2>&1 && return $? 7676ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 7776ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 7876ad07a4SPeter Maydell "will be at the bottom of config.log." \ 7976ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 808dc38a78SPeter Maydell} 818dc38a78SPeter Maydell 8252166aa0SJuan Quintelacompile_object() { 838dc38a78SPeter Maydell do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC 8452166aa0SJuan Quintela} 8552166aa0SJuan Quintela 8652166aa0SJuan Quintelacompile_prog() { 8752166aa0SJuan Quintela local_cflags="$1" 8852166aa0SJuan Quintela local_ldflags="$2" 898dc38a78SPeter Maydell do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags 9052166aa0SJuan Quintela} 9152166aa0SJuan Quintela 9266518bf6SDon Slutzdo_libtool() { 9366518bf6SDon Slutz local mode=$1 9466518bf6SDon Slutz shift 9566518bf6SDon Slutz # Run the compiler, capturing its output to the log. 9666518bf6SDon Slutz echo $libtool $mode --tag=CC $cc "$@" >> config.log 9766518bf6SDon Slutz $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $? 9866518bf6SDon Slutz # Test passed. If this is an --enable-werror build, rerun 9966518bf6SDon Slutz # the test with -Werror and bail out if it fails. This 10066518bf6SDon Slutz # makes warning-generating-errors in configure test code 10166518bf6SDon Slutz # obvious to developers. 10266518bf6SDon Slutz if test "$werror" != "yes"; then 10366518bf6SDon Slutz return 0 10466518bf6SDon Slutz fi 10566518bf6SDon Slutz # Don't bother rerunning the compile if we were already using -Werror 10666518bf6SDon Slutz case "$*" in 10766518bf6SDon Slutz *-Werror*) 10866518bf6SDon Slutz return 0 10966518bf6SDon Slutz ;; 11066518bf6SDon Slutz esac 11166518bf6SDon Slutz echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 11266518bf6SDon Slutz $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $? 11366518bf6SDon Slutz error_exit "configure test passed without -Werror but failed with -Werror." \ 11466518bf6SDon Slutz "This is probably a bug in the configure script. The failing command" \ 11566518bf6SDon Slutz "will be at the bottom of config.log." \ 11666518bf6SDon Slutz "You can run configure with --disable-werror to bypass this check." 11766518bf6SDon Slutz} 11866518bf6SDon Slutz 11966518bf6SDon Slutzlibtool_prog() { 12066518bf6SDon Slutz do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $? 12166518bf6SDon Slutz do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib 12266518bf6SDon Slutz} 12366518bf6SDon Slutz 12411568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 12511568d6dSPaolo Bonzinisymlink() { 12672b8b5a1SStefan Weil rm -rf "$2" 127ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 12872b8b5a1SStefan Weil ln -s "$1" "$2" 12911568d6dSPaolo Bonzini} 13011568d6dSPaolo Bonzini 1310dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 1320dba6195SLoïc Minier# executable or a builtin) 1330dba6195SLoïc Minierhas() { 1340dba6195SLoïc Minier type "$1" >/dev/null 2>&1 1350dba6195SLoïc Minier} 1360dba6195SLoïc Minier 1370dba6195SLoïc Minier# search for an executable in PATH 1380dba6195SLoïc Minierpath_of() { 1390dba6195SLoïc Minier local_command="$1" 1400dba6195SLoïc Minier local_ifs="$IFS" 1410dba6195SLoïc Minier local_dir="" 1420dba6195SLoïc Minier 1430dba6195SLoïc Minier # pathname has a dir component? 1440dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 1450dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 1460dba6195SLoïc Minier echo "$local_command" 1470dba6195SLoïc Minier return 0 1480dba6195SLoïc Minier fi 1490dba6195SLoïc Minier fi 1500dba6195SLoïc Minier if [ -z "$local_command" ]; then 1510dba6195SLoïc Minier return 1 1520dba6195SLoïc Minier fi 1530dba6195SLoïc Minier 1540dba6195SLoïc Minier IFS=: 1550dba6195SLoïc Minier for local_dir in $PATH; do 1560dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 1570dba6195SLoïc Minier echo "$local_dir/$local_command" 1580dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1590dba6195SLoïc Minier return 0 1600dba6195SLoïc Minier fi 1610dba6195SLoïc Minier done 1620dba6195SLoïc Minier # not found 1630dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1640dba6195SLoïc Minier return 1 1650dba6195SLoïc Minier} 1660dba6195SLoïc Minier 1677d13299dSbellard# default parameters 168ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 1692ff6b91eSJuan Quintelacpu="" 170a31a8642SMichael S. Tsirkiniasl="iasl" 1711e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 17243ce4dfeSbellardstatic="no" 1737d13299dSbellardcross_prefix="" 1740c58ac1cSmalcaudio_drv_list="" 175b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 176b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 177e49d021eSPeter Maydellhost_cc="cc" 17873da375eSJuan Quintelalibs_softmmu="" 1793e2e0e6bSJuan Quintelalibs_tools="" 18067f86e8eSJuan Quintelaaudio_pt_int="" 181d5631638Smalcaudio_win_int="" 1822b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 183957f1f99SMichael Rothlibs_qga="" 1845bc62e01SGerd Hoffmanndebug_info="yes" 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="" 210983eef5aSMeador Ingevirtfs="" 211821601eaSJes Sorensenvnc="yes" 212377529c0SPaolo Bonzinisparse="no" 213377529c0SPaolo Bonziniuuid="" 214377529c0SPaolo Bonzinivde="" 215377529c0SPaolo Bonzinivnc_tls="" 216377529c0SPaolo Bonzinivnc_sasl="" 217377529c0SPaolo Bonzinivnc_jpeg="" 218377529c0SPaolo Bonzinivnc_png="" 2197536ee4bSTim Hardeckvnc_ws="" 220377529c0SPaolo Bonzinixen="" 221d5b93ddfSAnthony PERARDxen_ctrl_version="" 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" 236377529c0SPaolo Bonzinistrip_opt="yes" 2379195b2c2SStefan Weiltcg_interpreter="no" 238377529c0SPaolo Bonzinibigendian="no" 239377529c0SPaolo Bonzinimingw32="no" 2401d728c39SBlue Swirlgcov="no" 2411d728c39SBlue Swirlgcov_tool="gcov" 242377529c0SPaolo BonziniEXESUF="" 24317969268SFam ZhengDSOSUF=".so" 24417969268SFam ZhengLDFLAGS_SHARED="-shared" 24517969268SFam Zhengmodules="no" 246377529c0SPaolo Bonziniprefix="/usr/local" 247377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 248528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 249850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 250377529c0SPaolo Bonzinibindir="\${prefix}/bin" 2513aa5d2beSAlon Levylibdir="\${prefix}/lib" 2528bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 2530f94d6daSAlon Levyincludedir="\${prefix}/include" 254377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 255785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 256377529c0SPaolo Bonziniconfsuffix="/qemu" 257377529c0SPaolo Bonzinislirp="yes" 258377529c0SPaolo Bonzinifmod_lib="" 259377529c0SPaolo Bonzinifmod_inc="" 260377529c0SPaolo Bonzinioss_lib="" 261377529c0SPaolo Bonzinibsd="no" 262377529c0SPaolo Bonzinilinux="no" 263377529c0SPaolo Bonzinisolaris="no" 264377529c0SPaolo Bonziniprofiler="no" 265377529c0SPaolo Bonzinicocoa="no" 266377529c0SPaolo Bonzinisoftmmu="yes" 267377529c0SPaolo Bonzinilinux_user="no" 268377529c0SPaolo Bonzinibsd_user="no" 26930163d89SPeter Maydellguest_base="yes" 270377529c0SPaolo Bonziniuname_release="" 271377529c0SPaolo Bonziniaix="no" 272377529c0SPaolo Bonziniblobs="yes" 273377529c0SPaolo Bonzinipkgversion="" 27440d6444eSAvi Kivitypie="" 275377529c0SPaolo Bonzinizero_malloc="" 2763556c233SPaolo Bonziniqom_cast_debug="yes" 277377529c0SPaolo Bonzinitrace_backend="nop" 278377529c0SPaolo Bonzinitrace_file="trace" 279377529c0SPaolo Bonzinispice="" 280377529c0SPaolo Bonzinirbd="" 281111a38b0SRobert Relyeasmartcard_nss="" 2822b2325ffSGerd Hoffmannlibusb="" 28369354a83SHans de Goedeusb_redir="" 284b1e5fff4SMichael Walleglx="" 2851ece9905SAlon Levyzlib="yes" 286*607dacd0Sqiaonuohanlzo="no" 287*607dacd0Sqiaonuohansnappy="no" 288e8ef31a3SMichael Tokarevguest_agent="" 289d9840e25STomoki Sekiyamaguest_agent_with_vss="no" 290d9840e25STomoki Sekiyamavss_win32_sdk="" 291d9840e25STomoki Sekiyamawin_sdk="no" 2924b1c11fdSDaniel P. Berrangewant_tools="yes" 293c589b249SRonnie Sahlberglibiscsi="" 2946542aa9cSPeter Lievenlibnfs="" 295519175a2SAlex Barcelocoroutine="" 29670c60c08SStefan Hajnoczicoroutine_pool="" 297f794573eSEduardo Otuboseccomp="" 298eb100396SBharata B Raoglusterfs="" 2990c14fb47SBharata B Raoglusterfs_discard="no" 3007c815372SBharata B Raoglusterfs_zerofill="no" 301583f6e7bSStefan Hajnoczivirtio_blk_data_plane="" 302a4ccabcfSAnthony Liguorigtk="" 303528de90aSDaniel P. Berrangegtkabi="2.0" 304ab214c29SStefan Bergertpm="no" 3050a12ec87SRichard W.M. Joneslibssh2="" 3064f18b782SJeff Codyvhdx="" 30795c6bff3SBenoît Canetquorum="no" 308377529c0SPaolo Bonzini 309ac0df51dSaliguori# parse CC options first 310ac0df51dSaliguorifor opt do 311ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 312ac0df51dSaliguori case "$opt" in 313ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 314ac0df51dSaliguori ;; 3153d8df640SPaolo Bonzini --cc=*) CC="$optarg" 316ac0df51dSaliguori ;; 31783f73fceSTomoki Sekiyama --cxx=*) CXX="$optarg" 31883f73fceSTomoki Sekiyama ;; 319ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 320ca4deeb1SPaolo Bonzini ;; 3212ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 3222ff6b91eSJuan Quintela ;; 323a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 324f9943cd5SGerd Hoffmann EXTRA_CFLAGS="$optarg" 325e2a2ed06SJuan Quintela ;; 326e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 327f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 328e2a2ed06SJuan Quintela ;; 3295bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 3305bc62e01SGerd Hoffmann ;; 3315bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 3325bc62e01SGerd Hoffmann ;; 333ac0df51dSaliguori esac 334ac0df51dSaliguoridone 335ac0df51dSaliguori# OS specific 336ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 33793148aa5SStefan Weil# we can eliminate its usage altogether. 338ac0df51dSaliguori 339e49d021eSPeter Maydell# Preferred compiler: 340e49d021eSPeter Maydell# ${CC} (if set) 341e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 342e49d021eSPeter Maydell# system compiler 343e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 344e49d021eSPeter Maydell cc="$host_cc" 345e49d021eSPeter Maydellelse 346b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 347e49d021eSPeter Maydellfi 348e49d021eSPeter Maydell 34983f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then 35083f73fceSTomoki Sekiyama cxx="c++" 35183f73fceSTomoki Sekiyamaelse 35283f73fceSTomoki Sekiyama cxx="${CXX-${cross_prefix}g++}" 35383f73fceSTomoki Sekiyamafi 35483f73fceSTomoki Sekiyama 355b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 3563dd46c78SBlue Swirlas="${AS-${cross_prefix}as}" 3573dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 358b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 359b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 3603f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}" 361b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 362b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 36317884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 36417884d7bSSergei Trofimovichquery_pkg_config() { 36517884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 36617884d7bSSergei Trofimovich} 36717884d7bSSergei Trofimovichpkg_config=query_pkg_config 368b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 369ac0df51dSaliguori 37045d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. 37145d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}" 37245d285abSPeter Maydell 373be17dc90SMichael S. Tsirkin# default flags for all hosts 374be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 375f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 376c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 377be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 3786b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include" 3795bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 3805bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 381be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 3825bc62e01SGerd Hoffmannfi 383be17dc90SMichael S. Tsirkin 384ca4deeb1SPaolo Bonzini# make source path absolute 385ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 386ca4deeb1SPaolo Bonzini 387ac0df51dSaliguoricheck_define() { 388ac0df51dSaliguoricat > $TMPC <<EOF 389ac0df51dSaliguori#if !defined($1) 390fd786e1aSPeter Maydell#error $1 not defined 391ac0df51dSaliguori#endif 392ac0df51dSaliguoriint main(void) { return 0; } 393ac0df51dSaliguoriEOF 39452166aa0SJuan Quintela compile_object 395ac0df51dSaliguori} 396ac0df51dSaliguori 397bbea4050SPeter Maydellif check_define __linux__ ; then 398bbea4050SPeter Maydell targetos="Linux" 399bbea4050SPeter Maydellelif check_define _WIN32 ; then 400bbea4050SPeter Maydell targetos='MINGW32' 401bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 402bbea4050SPeter Maydell targetos='OpenBSD' 403bbea4050SPeter Maydellelif check_define __sun__ ; then 404bbea4050SPeter Maydell targetos='SunOS' 405bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 406bbea4050SPeter Maydell targetos='Haiku' 407bbea4050SPeter Maydellelse 408bbea4050SPeter Maydell targetos=`uname -s` 409bbea4050SPeter Maydellfi 410bbea4050SPeter Maydell 411bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 412bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 413bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 414bbea4050SPeter Maydell# the correct CPU with the --cpu option. 415bbea4050SPeter Maydellcase $targetos in 416bbea4050SPeter MaydellDarwin) 417bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 418bbea4050SPeter Maydell # run 64-bit userspace code. 419bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 420bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 421bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 422bbea4050SPeter Maydell cpu="x86_64" 423bbea4050SPeter Maydell fi 424bbea4050SPeter Maydell ;; 425bbea4050SPeter MaydellSunOS) 426bbea4050SPeter Maydell # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo 427bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 428bbea4050SPeter Maydell cpu="x86_64" 429bbea4050SPeter Maydell fi 430bbea4050SPeter Maydellesac 431bbea4050SPeter Maydell 4322ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 4332ff6b91eSJuan Quintela # command line argument 4342ff6b91eSJuan Quintela : 4352ff6b91eSJuan Quintelaelif check_define __i386__ ; then 436ac0df51dSaliguori cpu="i386" 437ac0df51dSaliguorielif check_define __x86_64__ ; then 438c72b26ecSRichard Henderson if check_define __ILP32__ ; then 439c72b26ecSRichard Henderson cpu="x32" 440c72b26ecSRichard Henderson else 441ac0df51dSaliguori cpu="x86_64" 442c72b26ecSRichard Henderson fi 4433aa9bd6cSblueswir1elif check_define __sparc__ ; then 4443aa9bd6cSblueswir1 if check_define __arch64__ ; then 4453aa9bd6cSblueswir1 cpu="sparc64" 4463aa9bd6cSblueswir1 else 4473aa9bd6cSblueswir1 cpu="sparc" 4483aa9bd6cSblueswir1 fi 449fdf7ed96Smalcelif check_define _ARCH_PPC ; then 450fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 451fdf7ed96Smalc cpu="ppc64" 452ac0df51dSaliguori else 453fdf7ed96Smalc cpu="ppc" 454fdf7ed96Smalc fi 455afa05235SAurelien Jarnoelif check_define __mips__ ; then 456afa05235SAurelien Jarno cpu="mips" 457477ba620SAurelien Jarnoelif check_define __ia64__ ; then 458477ba620SAurelien Jarno cpu="ia64" 459d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 460d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 461d66ed0eaSAurelien Jarno cpu="s390x" 462d66ed0eaSAurelien Jarno else 463d66ed0eaSAurelien Jarno cpu="s390" 464d66ed0eaSAurelien Jarno fi 46521d89f84SPeter Maydellelif check_define __arm__ ; then 46621d89f84SPeter Maydell cpu="arm" 4671f080313SClaudio Fontanaelif check_define __aarch64__ ; then 4681f080313SClaudio Fontana cpu="aarch64" 469f28ffed5SBradelif check_define __hppa__ ; then 470f28ffed5SBrad cpu="hppa" 471fdf7ed96Smalcelse 472fdf7ed96Smalc cpu=`uname -m` 473ac0df51dSaliguorifi 474ac0df51dSaliguori 475359bc95dSPeter MaydellARCH= 476359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 477359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 4787d13299dSbellardcase "$cpu" in 479c72b26ecSRichard Henderson ia64|ppc|ppc64|s390|s390x|sparc64|x32) 480ea8f20f8SJuan Quintela cpu="$cpu" 481ea8f20f8SJuan Quintela ;; 4827d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 48397a847bcSbellard cpu="i386" 4847d13299dSbellard ;; 485aaa5fa14Saurel32 x86_64|amd64) 486aaa5fa14Saurel32 cpu="x86_64" 487aaa5fa14Saurel32 ;; 48821d89f84SPeter Maydell armv*b|armv*l|arm) 48921d89f84SPeter Maydell cpu="arm" 4907d13299dSbellard ;; 4911f080313SClaudio Fontana aarch64) 4921f080313SClaudio Fontana cpu="aarch64" 4931f080313SClaudio Fontana ;; 494afa05235SAurelien Jarno mips*) 495afa05235SAurelien Jarno cpu="mips" 496afa05235SAurelien Jarno ;; 4973142255cSblueswir1 sparc|sun4[cdmuv]) 498ae228531Sbellard cpu="sparc" 499ae228531Sbellard ;; 5007d13299dSbellard *) 501359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 502359bc95dSPeter Maydell ARCH=unknown 5037d13299dSbellard ;; 5047d13299dSbellardesac 505359bc95dSPeter Maydellif test -z "$ARCH"; then 506359bc95dSPeter Maydell ARCH="$cpu" 507359bc95dSPeter Maydellfi 508e2d52ad3SJuan Quintela 5097d13299dSbellard# OS specific 5100dbfc675SJuan Quintela 5117d13299dSbellardcase $targetos in 512c326e0afSbellardCYGWIN*) 513c326e0afSbellard mingw32="yes" 514a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 515d5631638Smalc audio_possible_drivers="winwave sdl" 516d5631638Smalc audio_drv_list="winwave" 517c326e0afSbellard;; 51867b915a5SbellardMINGW32*) 51967b915a5Sbellard mingw32="yes" 520d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 521d5631638Smalc audio_drv_list="winwave" 52267b915a5Sbellard;; 5235c40d2bdSthsGNU/kFreeBSD) 524a167ba50SAurelien Jarno bsd="yes" 5250c58ac1cSmalc audio_drv_list="oss" 526f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 5275c40d2bdSths;; 5287d3505c5SbellardFreeBSD) 5297d3505c5Sbellard bsd="yes" 5300db4a067SPaolo Bonzini make="${MAKE-gmake}" 5310c58ac1cSmalc audio_drv_list="oss" 532f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 533f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 534f01576f1SJuergen Lock LIBS="-lutil $LIBS" 53558952137SVincenzo Maffione netmap="" # enable netmap autodetect 5367d3505c5Sbellard;; 537c5e97233Sblueswir1DragonFly) 538c5e97233Sblueswir1 bsd="yes" 5390db4a067SPaolo Bonzini make="${MAKE-gmake}" 540c5e97233Sblueswir1 audio_drv_list="oss" 541c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 542c5e97233Sblueswir1;; 5437d3505c5SbellardNetBSD) 5447d3505c5Sbellard bsd="yes" 5450db4a067SPaolo Bonzini make="${MAKE-gmake}" 5460c58ac1cSmalc audio_drv_list="oss" 547c2de5c91Smalc audio_possible_drivers="oss sdl esd" 5488ef92a88Sblueswir1 oss_lib="-lossaudio" 5497d3505c5Sbellard;; 5507d3505c5SbellardOpenBSD) 5517d3505c5Sbellard bsd="yes" 5520db4a067SPaolo Bonzini make="${MAKE-gmake}" 5534f6ab397SBrad Smith audio_drv_list="sdl" 5544f6ab397SBrad Smith audio_possible_drivers="sdl esd" 5557d3505c5Sbellard;; 55683fb7adfSbellardDarwin) 55783fb7adfSbellard bsd="yes" 55883fb7adfSbellard darwin="yes" 55917969268SFam Zheng LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" 5601b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 561a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 5620c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 5631b0f9cc2Saliguori fi 564fd677642Sths cocoa="yes" 5650c58ac1cSmalc audio_drv_list="coreaudio" 566c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 5670c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 5687973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 569a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 570a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 571a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 57283fb7adfSbellard;; 573ec530c81SbellardSunOS) 574ec530c81Sbellard solaris="yes" 5750db4a067SPaolo Bonzini make="${MAKE-gmake}" 5760db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 577fa58948dSBlue Swirl ld="gld" 578e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 5790475a5caSths needs_libsunmath="no" 580c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 581c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 5820475a5caSths if test "$solarisrev" -le 9 ; then 5830475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 5840475a5caSths needs_libsunmath="yes" 585f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 586f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 587f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 5880475a5caSths else 58976ad07a4SPeter Maydell error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \ 59076ad07a4SPeter Maydell "libsunmath from the Sun Studio compilers tools, due to a lack of" \ 59176ad07a4SPeter Maydell "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \ 59276ad07a4SPeter Maydell "Studio 11 can be downloaded from www.sun.com." 5930475a5caSths fi 5940475a5caSths fi 59586b2bd93Sths fi 5966b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 5970c58ac1cSmalc audio_drv_list="oss" 5986b4d2ba1Sths fi 599c2de5c91Smalc audio_possible_drivers="oss sdl" 600d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 601d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 602d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 603d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 604a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 605560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 606560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 607560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 608ec530c81Sbellard;; 609b29fe3edSmalcAIX) 610b29fe3edSmalc aix="yes" 6110db4a067SPaolo Bonzini make="${MAKE-gmake}" 612b29fe3edSmalc;; 613179cf400SAndreas FärberHaiku) 614179cf400SAndreas Färber haiku="yes" 615179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 616179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 617179cf400SAndreas Färber;; 618fb065187Sbellard*) 6190c58ac1cSmalc audio_drv_list="oss" 620b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 6215327cf48Sbellard linux="yes" 622831b7825Sths linux_user="yes" 623af2be207SJan Kiszka kvm="yes" 624af2be207SJan Kiszka vhost_net="yes" 6255e9be92dSNicholas Bellinger vhost_scsi="yes" 626c72b26ecSRichard Henderson if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then 627c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 628c9ec1fe4Sbellard fi 629a585140dSAlexey Kardashevskiy QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" 630fb065187Sbellard;; 6317d13299dSbellardesac 6327d13299dSbellard 6337d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 634b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 63584778508Sblueswir1 bsd_user="yes" 6367d3505c5Sbellard fi 63708de3949SAndreas Färberfi 6387d3505c5Sbellard 6390db4a067SPaolo Bonzini: ${make=${MAKE-make}} 6400db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 64152510f8bSStefan Weil: ${python=${PYTHON-python}} 642e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 6430db4a067SPaolo Bonzini 6443c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 6453c4a4d0dSPeter Maydellif has clang; then 6463c4a4d0dSPeter Maydell objcc=clang 6473c4a4d0dSPeter Maydellelse 6483c4a4d0dSPeter Maydell objcc="$cc" 6493c4a4d0dSPeter Maydellfi 6503c4a4d0dSPeter Maydell 6513457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 6523457a3f8SJuan Quintela EXESUF=".exe" 65317969268SFam Zheng DSOSUF=".dll" 654a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 655e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 656e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 657f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 658f7cf5d5bSStefan Weilcat > $TMPC << EOF 659f7cf5d5bSStefan Weilint main(void) { return 0; } 660f7cf5d5bSStefan WeilEOF 661f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 662f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 663f7cf5d5bSStefan Weil fi 664c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 665683035deSPaolo Bonzini mandir="\${prefix}" 666528ae5b8SEduardo Habkost datadir="\${prefix}" 667850da188SEduardo Habkost qemu_docdir="\${prefix}" 668683035deSPaolo Bonzini bindir="\${prefix}" 669683035deSPaolo Bonzini sysconfdir="\${prefix}" 6705a699bbbSLaszlo Ersek local_statedir= 671683035deSPaolo Bonzini confsuffix="" 672368542b8SStefan Hajnoczi libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga" 6733457a3f8SJuan Quintelafi 6743457a3f8SJuan Quintela 675487fefdbSAnthony Liguoriwerror="" 67685aa5189Sbellard 6777d13299dSbellardfor opt do 678a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 6797d13299dSbellard case "$opt" in 6802efc3265Sbellard --help|-h) show_help=yes 6812efc3265Sbellard ;; 68299123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 68399123e13SMike Frysinger ;; 684b1a550a0Spbrook --prefix=*) prefix="$optarg" 6857d13299dSbellard ;; 686b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 68732ce6337Sbellard ;; 688ca4deeb1SPaolo Bonzini --source-path=*) 6897d13299dSbellard ;; 690ac0df51dSaliguori --cross-prefix=*) 6917d13299dSbellard ;; 692ac0df51dSaliguori --cc=*) 6937d13299dSbellard ;; 694b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 69583469015Sbellard ;; 69683f73fceSTomoki Sekiyama --cxx=*) 69783f73fceSTomoki Sekiyama ;; 698e007dbecSMichael S. Tsirkin --iasl=*) iasl="$optarg" 699e007dbecSMichael S. Tsirkin ;; 7003c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 7013c4a4d0dSPeter Maydell ;; 702b1a550a0Spbrook --make=*) make="$optarg" 7037d13299dSbellard ;; 7046a882643Spbrook --install=*) install="$optarg" 7056a882643Spbrook ;; 706c886edfbSBlue Swirl --python=*) python="$optarg" 707c886edfbSBlue Swirl ;; 7081d728c39SBlue Swirl --gcov=*) gcov_tool="$optarg" 7091d728c39SBlue Swirl ;; 710e2d8830eSBrad --smbd=*) smbd="$optarg" 711e2d8830eSBrad ;; 712e2a2ed06SJuan Quintela --extra-cflags=*) 7137d13299dSbellard ;; 714e2a2ed06SJuan Quintela --extra-ldflags=*) 7157d13299dSbellard ;; 7165bc62e01SGerd Hoffmann --enable-debug-info) 7175bc62e01SGerd Hoffmann ;; 7185bc62e01SGerd Hoffmann --disable-debug-info) 7195bc62e01SGerd Hoffmann ;; 72017969268SFam Zheng --enable-modules) 72117969268SFam Zheng modules="yes" 72217969268SFam Zheng ;; 7232ff6b91eSJuan Quintela --cpu=*) 7247d13299dSbellard ;; 725b1a550a0Spbrook --target-list=*) target_list="$optarg" 726de83cd02Sbellard ;; 72774242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 72894a420b1SStefan Hajnoczi ;; 72974242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 7309410b56cSPrerna Saxena ;; 7317d13299dSbellard --enable-gprof) gprof="yes" 7327d13299dSbellard ;; 7331d728c39SBlue Swirl --enable-gcov) gcov="yes" 7341d728c39SBlue Swirl ;; 73579427693SLoïc Minier --static) 73679427693SLoïc Minier static="yes" 73779427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 73817884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 73943ce4dfeSbellard ;; 7400b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 7410b24e75fSPaolo Bonzini ;; 7420b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 7430b24e75fSPaolo Bonzini ;; 7443aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 7453aa5d2beSAlon Levy ;; 7468bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 7478bf188aaSMichael Tokarev ;; 7480f94d6daSAlon Levy --includedir=*) includedir="$optarg" 7490f94d6daSAlon Levy ;; 750528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 7510b24e75fSPaolo Bonzini ;; 752023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 753023d3d67SEduardo Habkost ;; 754850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 7550b24e75fSPaolo Bonzini ;; 756ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 75707381cc1SAnthony Liguori ;; 758785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 759785c23aeSLuiz Capitulino ;; 760785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 761023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 762023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 763023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 764023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 765023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 766023ddd74SMax Filippov # lots of directory switches by default. 767023ddd74SMax Filippov ;; 768e2134eb9SGerd Hoffmann --with-system-pixman) pixman="system" 769e2134eb9SGerd Hoffmann ;; 770e2134eb9SGerd Hoffmann --without-system-pixman) pixman="internal" 771e2134eb9SGerd Hoffmann ;; 77274880fe2SRobert Schiele --without-pixman) pixman="none" 77374880fe2SRobert Schiele ;; 77497a847bcSbellard --disable-sdl) sdl="no" 77597a847bcSbellard ;; 776c4198157SJuan Quintela --enable-sdl) sdl="yes" 777c4198157SJuan Quintela ;; 7783556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 7793556c233SPaolo Bonzini ;; 7803556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 7813556c233SPaolo Bonzini ;; 782983eef5aSMeador Inge --disable-virtfs) virtfs="no" 783983eef5aSMeador Inge ;; 784983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 785983eef5aSMeador Inge ;; 786821601eaSJes Sorensen --disable-vnc) vnc="no" 787821601eaSJes Sorensen ;; 788821601eaSJes Sorensen --enable-vnc) vnc="yes" 789821601eaSJes Sorensen ;; 790b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 791102a52e4Sbellard ;; 792c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 793c2de5c91Smalc ;; 7942f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 7952f6a1ab0Sblueswir1 ;; 7960c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 7970c58ac1cSmalc ;; 798b64ec4e4SFam Zheng --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 799b64ec4e4SFam Zheng ;; 800b64ec4e4SFam Zheng --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 801eb852011SMarkus Armbruster ;; 802f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 803f8393946Saurel32 ;; 804f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 805f8393946Saurel32 ;; 806f3d08ee6SPaul Brook --enable-debug) 807f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 808f3d08ee6SPaul Brook debug_tcg="yes" 809f3d08ee6SPaul Brook debug="yes" 810f3d08ee6SPaul Brook strip_opt="no" 811f3d08ee6SPaul Brook ;; 81203b4fe7dSaliguori --enable-sparse) sparse="yes" 81303b4fe7dSaliguori ;; 81403b4fe7dSaliguori --disable-sparse) sparse="no" 81503b4fe7dSaliguori ;; 8161625af87Saliguori --disable-strip) strip_opt="no" 8171625af87Saliguori ;; 8188d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 8198d5d2d4cSths ;; 8201be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 8211be10ad2SJuan Quintela ;; 8222f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 8232f9606b3Saliguori ;; 824ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 825ea784e3bSJuan Quintela ;; 8262f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 8272f6f5c7aSCorentin Chary ;; 8282f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 8292f6f5c7aSCorentin Chary ;; 830efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 831efe556adSCorentin Chary ;; 832efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 833efe556adSCorentin Chary ;; 8347536ee4bSTim Hardeck --disable-vnc-ws) vnc_ws="no" 8357536ee4bSTim Hardeck ;; 8367536ee4bSTim Hardeck --enable-vnc-ws) vnc_ws="yes" 8377536ee4bSTim Hardeck ;; 838443f1376Sbellard --disable-slirp) slirp="no" 839c20709aaSbellard ;; 840ee682d27SStefan Weil --disable-uuid) uuid="no" 841ee682d27SStefan Weil ;; 842ee682d27SStefan Weil --enable-uuid) uuid="yes" 843ee682d27SStefan Weil ;; 844e0e6c8c0Saliguori --disable-vde) vde="no" 8458a16d273Sths ;; 846dfb278bdSJuan Quintela --enable-vde) vde="yes" 847dfb278bdSJuan Quintela ;; 84858952137SVincenzo Maffione --disable-netmap) netmap="no" 84958952137SVincenzo Maffione ;; 85058952137SVincenzo Maffione --enable-netmap) netmap="yes" 85158952137SVincenzo Maffione ;; 852e37630caSaliguori --disable-xen) xen="no" 853e37630caSaliguori ;; 854fc321b4bSJuan Quintela --enable-xen) xen="yes" 855fc321b4bSJuan Quintela ;; 856eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 857eb6fda0fSAnthony PERARD ;; 858eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 859eb6fda0fSAnthony PERARD ;; 8602e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 8612e4d9fb1Saurel32 ;; 8624ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 8634ffcedb6SJuan Quintela ;; 864fb599c9aSbalrog --disable-bluez) bluez="no" 865fb599c9aSbalrog ;; 866a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 867a20a6f46SJuan Quintela ;; 8687ba1e619Saliguori --disable-kvm) kvm="no" 8697ba1e619Saliguori ;; 870b31a0277SJuan Quintela --enable-kvm) kvm="yes" 871b31a0277SJuan Quintela ;; 8729195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 8739195b2c2SStefan Weil ;; 8749195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 8759195b2c2SStefan Weil ;; 87647e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 87747e98658SCorey Bryant ;; 87847e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 87947e98658SCorey Bryant ;; 880cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 881cd4ec0b4SGerd Hoffmann ;; 882cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 883cd4ec0b4SGerd Hoffmann ;; 884c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 885c589b249SRonnie Sahlberg ;; 886c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 887c589b249SRonnie Sahlberg ;; 8886542aa9cSPeter Lieven --disable-libnfs) libnfs="no" 8896542aa9cSPeter Lieven ;; 8906542aa9cSPeter Lieven --enable-libnfs) libnfs="yes" 8916542aa9cSPeter Lieven ;; 89205c2a3e7Sbellard --enable-profiler) profiler="yes" 89305c2a3e7Sbellard ;; 89414821030SPavel Borzenkov --disable-cocoa) cocoa="no" 89514821030SPavel Borzenkov ;; 896c2de5c91Smalc --enable-cocoa) 897c2de5c91Smalc cocoa="yes" ; 898c2de5c91Smalc sdl="no" ; 899c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 9005b0753e0Sbellard ;; 901cad25d69Spbrook --disable-system) softmmu="no" 9020a8e90f4Spbrook ;; 903cad25d69Spbrook --enable-system) softmmu="yes" 9040a8e90f4Spbrook ;; 9050953a80fSZachary Amsden --disable-user) 9060953a80fSZachary Amsden linux_user="no" ; 9070953a80fSZachary Amsden bsd_user="no" ; 9080953a80fSZachary Amsden ;; 9090953a80fSZachary Amsden --enable-user) ;; 910831b7825Sths --disable-linux-user) linux_user="no" 9110a8e90f4Spbrook ;; 912831b7825Sths --enable-linux-user) linux_user="yes" 913831b7825Sths ;; 91484778508Sblueswir1 --disable-bsd-user) bsd_user="no" 91584778508Sblueswir1 ;; 91684778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 91784778508Sblueswir1 ;; 918379f6698SPaul Brook --enable-guest-base) guest_base="yes" 919379f6698SPaul Brook ;; 920379f6698SPaul Brook --disable-guest-base) guest_base="no" 921379f6698SPaul Brook ;; 92240d6444eSAvi Kivity --enable-pie) pie="yes" 92334005a00SKirill A. Shutemov ;; 92440d6444eSAvi Kivity --disable-pie) pie="no" 92534005a00SKirill A. Shutemov ;; 926c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 927c5937220Spbrook ;; 92885aa5189Sbellard --enable-werror) werror="yes" 92985aa5189Sbellard ;; 93085aa5189Sbellard --disable-werror) werror="no" 93185aa5189Sbellard ;; 9324d3b6f6eSbalrog --disable-curses) curses="no" 9334d3b6f6eSbalrog ;; 934c584a6d0SJuan Quintela --enable-curses) curses="yes" 935c584a6d0SJuan Quintela ;; 936769ce76dSAlexander Graf --disable-curl) curl="no" 937769ce76dSAlexander Graf ;; 938788c8196SJuan Quintela --enable-curl) curl="yes" 939788c8196SJuan Quintela ;; 9402df87df7SJuan Quintela --disable-fdt) fdt="no" 9412df87df7SJuan Quintela ;; 9422df87df7SJuan Quintela --enable-fdt) fdt="yes" 9432df87df7SJuan Quintela ;; 9445c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 9455c6c3a6cSChristoph Hellwig ;; 9465c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 9475c6c3a6cSChristoph Hellwig ;; 948758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 949758e8e38SVenkateswararao Jujjuri (JV) ;; 950758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 951758e8e38SVenkateswararao Jujjuri (JV) ;; 95277755340Sths --disable-blobs) blobs="no" 95377755340Sths ;; 9544a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 9554a19f1ecSpbrook ;; 956519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 957519175a2SAlex Barcelo ;; 95870c60c08SStefan Hajnoczi --disable-coroutine-pool) coroutine_pool="no" 95970c60c08SStefan Hajnoczi ;; 96070c60c08SStefan Hajnoczi --enable-coroutine-pool) coroutine_pool="yes" 96170c60c08SStefan Hajnoczi ;; 962a25dba17SJuan Quintela --disable-docs) docs="no" 96370ec5dc0SAnthony Liguori ;; 964a25dba17SJuan Quintela --enable-docs) docs="yes" 96583a3ab8bSJuan Quintela ;; 966d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 967d5970055SMichael S. Tsirkin ;; 968d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 969d5970055SMichael S. Tsirkin ;; 9705e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 9715e9be92dSNicholas Bellinger ;; 9725e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 9735e9be92dSNicholas Bellinger ;; 974b1e5fff4SMichael Walle --disable-glx) glx="no" 97520ff075bSMichael Walle ;; 976b1e5fff4SMichael Walle --enable-glx) glx="yes" 97720ff075bSMichael Walle ;; 978f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 979f27aaf4bSChristian Brunner ;; 980f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 981f27aaf4bSChristian Brunner ;; 9828c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 9838c84cf11SSergei Trofimovich ;; 9848c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 9858c84cf11SSergei Trofimovich ;; 986111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 987111a38b0SRobert Relyea ;; 988111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 989111a38b0SRobert Relyea ;; 9902b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 9912b2325ffSGerd Hoffmann ;; 9922b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 9932b2325ffSGerd Hoffmann ;; 99469354a83SHans de Goede --disable-usb-redir) usb_redir="no" 99569354a83SHans de Goede ;; 99669354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 99769354a83SHans de Goede ;; 9981ece9905SAlon Levy --disable-zlib-test) zlib="no" 9991ece9905SAlon Levy ;; 1000*607dacd0Sqiaonuohan --enable-lzo) lzo="yes" 1001*607dacd0Sqiaonuohan ;; 1002*607dacd0Sqiaonuohan --enable-snappy) snappy="yes" 1003*607dacd0Sqiaonuohan ;; 1004d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 1005d138cee9SMichael Roth ;; 1006d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 1007d138cee9SMichael Roth ;; 1008d9840e25STomoki Sekiyama --with-vss-sdk) vss_win32_sdk="" 1009d9840e25STomoki Sekiyama ;; 1010d9840e25STomoki Sekiyama --with-vss-sdk=*) vss_win32_sdk="$optarg" 1011d9840e25STomoki Sekiyama ;; 1012d9840e25STomoki Sekiyama --without-vss-sdk) vss_win32_sdk="no" 1013d9840e25STomoki Sekiyama ;; 1014d9840e25STomoki Sekiyama --with-win-sdk) win_sdk="" 1015d9840e25STomoki Sekiyama ;; 1016d9840e25STomoki Sekiyama --with-win-sdk=*) win_sdk="$optarg" 1017d9840e25STomoki Sekiyama ;; 1018d9840e25STomoki Sekiyama --without-win-sdk) win_sdk="no" 1019d9840e25STomoki Sekiyama ;; 10204b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 10214b1c11fdSDaniel P. Berrange ;; 10224b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 10234b1c11fdSDaniel P. Berrange ;; 1024f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 1025f794573eSEduardo Otubo ;; 1026f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 1027f794573eSEduardo Otubo ;; 1028eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 1029eb100396SBharata B Rao ;; 1030eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 1031eb100396SBharata B Rao ;; 1032583f6e7bSStefan Hajnoczi --disable-virtio-blk-data-plane) virtio_blk_data_plane="no" 1033583f6e7bSStefan Hajnoczi ;; 1034583f6e7bSStefan Hajnoczi --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes" 1035583f6e7bSStefan Hajnoczi ;; 1036a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 1037a4ccabcfSAnthony Liguori ;; 1038a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 1039a4ccabcfSAnthony Liguori ;; 10402da776dbSMichael R. Hines --enable-rdma) rdma="yes" 10412da776dbSMichael R. Hines ;; 10422da776dbSMichael R. Hines --disable-rdma) rdma="no" 10432da776dbSMichael R. Hines ;; 1044528de90aSDaniel P. Berrange --with-gtkabi=*) gtkabi="$optarg" 1045528de90aSDaniel P. Berrange ;; 1046ab214c29SStefan Berger --enable-tpm) tpm="yes" 1047ab214c29SStefan Berger ;; 10480a12ec87SRichard W.M. Jones --disable-libssh2) libssh2="no" 10490a12ec87SRichard W.M. Jones ;; 10500a12ec87SRichard W.M. Jones --enable-libssh2) libssh2="yes" 10510a12ec87SRichard W.M. Jones ;; 10524f18b782SJeff Cody --enable-vhdx) vhdx="yes" 10534f18b782SJeff Cody ;; 10544f18b782SJeff Cody --disable-vhdx) vhdx="no" 10554f18b782SJeff Cody ;; 105695c6bff3SBenoît Canet --disable-quorum) quorum="no" 105795c6bff3SBenoît Canet ;; 105895c6bff3SBenoît Canet --enable-quorum) quorum="yes" 105995c6bff3SBenoît Canet ;; 10607f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 10617f1559c6Sbalrog ;; 10627d13299dSbellard esac 10637d13299dSbellarddone 10647d13299dSbellard 1065f6f0b7d9SStefan Weilif ! has $python; then 1066f6f0b7d9SStefan Weil error_exit "Python not found. Use --python=/path/to/python" 1067f6f0b7d9SStefan Weilfi 1068f6f0b7d9SStefan Weil 1069f6f0b7d9SStefan Weil# Note that if the Python conditional here evaluates True we will exit 1070f6f0b7d9SStefan Weil# with status 1 which is a shell 'false' value. 1071f6f0b7d9SStefan Weilif ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then 1072f6f0b7d9SStefan Weil error_exit "Cannot use '$python', Python 2.4 or later is required." \ 1073f6f0b7d9SStefan Weil "Note that Python 3 or later is not yet supported." \ 1074f6f0b7d9SStefan Weil "Use --python=/path/to/python to specify a supported Python." 1075f6f0b7d9SStefan Weilfi 1076f6f0b7d9SStefan Weil 1077f6f0b7d9SStefan Weil# The -B switch was added in Python 2.6. 1078f6f0b7d9SStefan Weil# If it is supplied, compiled files are not written. 1079f6f0b7d9SStefan Weil# Use it for Python versions which support it. 1080f6f0b7d9SStefan Weilif $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then 1081f6f0b7d9SStefan Weil python="$python -B" 1082f6f0b7d9SStefan Weilfi 1083f6f0b7d9SStefan Weil 108440293e58Sbellardcase "$cpu" in 1085e3608d66SRichard Henderson ppc) 1086e3608d66SRichard Henderson CPU_CFLAGS="-m32" 1087e3608d66SRichard Henderson LDFLAGS="-m32 $LDFLAGS" 1088e3608d66SRichard Henderson ;; 1089e3608d66SRichard Henderson ppc64) 1090e3608d66SRichard Henderson CPU_CFLAGS="-m64" 1091e3608d66SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 1092e3608d66SRichard Henderson ;; 10939b9c37c3SRichard Henderson sparc) 10940c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 109579f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32 -mcpu=ultrasparc" 10963142255cSblueswir1 ;; 1097ed968ff1SJuan Quintela sparc64) 10980c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 109979f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 11003142255cSblueswir1 ;; 110176d83bdeSths s390) 110279f3b12fSPeter Crosthwaite CPU_CFLAGS="-m31 -march=z990" 110328d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 110428d7cc49SRichard Henderson ;; 110528d7cc49SRichard Henderson s390x) 110679f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -march=z990" 110728d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 110876d83bdeSths ;; 110940293e58Sbellard i386) 111079f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 11110c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 11122b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 111340293e58Sbellard ;; 111440293e58Sbellard x86_64) 111579f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64" 11160c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 11172b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 1118379f6698SPaul Brook ;; 1119c72b26ecSRichard Henderson x32) 1120c72b26ecSRichard Henderson CPU_CFLAGS="-mx32" 1121c72b26ecSRichard Henderson LDFLAGS="-mx32 $LDFLAGS" 1122c72b26ecSRichard Henderson cc_i386='$(CC) -m32' 1123c72b26ecSRichard Henderson ;; 112430163d89SPeter Maydell # No special flags required for other host CPUs 11253142255cSblueswir1esac 11263142255cSblueswir1 112779f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 112879f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS" 112979f3b12fSPeter Crosthwaite 113060e0df25SPeter Maydelldefault_target_list="" 113160e0df25SPeter Maydell 11326e92f823SPeter Maydellmak_wilds="" 11336e92f823SPeter Maydell 113460e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 11356e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 113660e0df25SPeter Maydellfi 113760e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 11386e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 113960e0df25SPeter Maydellfi 114060e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 11416e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 114260e0df25SPeter Maydellfi 114360e0df25SPeter Maydell 11446e92f823SPeter Maydellfor config in $mak_wilds; do 11456e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 11466e92f823SPeter Maydelldone 11476e92f823SPeter Maydell 1148af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1149af5db58eSpbrookcat << EOF 1150af5db58eSpbrook 1151af5db58eSpbrookUsage: configure [options] 1152af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1153af5db58eSpbrook 115408fb77edSStefan WeilStandard options: 115508fb77edSStefan Weil --help print this message 115608fb77edSStefan Weil --prefix=PREFIX install in PREFIX [$prefix] 115708fb77edSStefan Weil --interp-prefix=PREFIX where to find shared libraries, etc. 115808fb77edSStefan Weil use %M for cpu name [$interp_prefix] 115908fb77edSStefan Weil --target-list=LIST set target list (default: build everything) 116008fb77edSStefan Weil$(echo Available targets: $default_target_list | \ 116108fb77edSStefan Weil fold -s -w 53 | sed -e 's/^/ /') 116208fb77edSStefan Weil 116308fb77edSStefan WeilAdvanced options (experts only): 116408fb77edSStefan Weil --source-path=PATH path of source code [$source_path] 116508fb77edSStefan Weil --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] 116608fb77edSStefan Weil --cc=CC use C compiler CC [$cc] 116708fb77edSStefan Weil --iasl=IASL use ACPI compiler IASL [$iasl] 116808fb77edSStefan Weil --host-cc=CC use C compiler CC [$host_cc] for code run at 116908fb77edSStefan Weil build time 117008fb77edSStefan Weil --cxx=CXX use C++ compiler CXX [$cxx] 117108fb77edSStefan Weil --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] 117208fb77edSStefan Weil --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS 117308fb77edSStefan Weil --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS 117408fb77edSStefan Weil --make=MAKE use specified make [$make] 117508fb77edSStefan Weil --install=INSTALL use specified install [$install] 117608fb77edSStefan Weil --python=PYTHON use specified python [$python] 117708fb77edSStefan Weil --smbd=SMBD use specified smbd [$smbd] 117808fb77edSStefan Weil --static enable static build [$static] 117908fb77edSStefan Weil --mandir=PATH install man pages in PATH 118008fb77edSStefan Weil --datadir=PATH install firmware in PATH$confsuffix 118108fb77edSStefan Weil --docdir=PATH install documentation in PATH$confsuffix 118208fb77edSStefan Weil --bindir=PATH install binaries in PATH 118308fb77edSStefan Weil --libdir=PATH install libraries in PATH 118408fb77edSStefan Weil --sysconfdir=PATH install config in PATH$confsuffix 118508fb77edSStefan Weil --localstatedir=PATH install local state in PATH (set at runtime on win32) 1186e26110cfSFam Zheng --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] 118717969268SFam Zheng --enable-modules enable modules support 118808fb77edSStefan Weil --enable-debug-tcg enable TCG debugging 118908fb77edSStefan Weil --disable-debug-tcg disable TCG debugging (default) 119008fb77edSStefan Weil --enable-debug-info enable debugging information (default) 119108fb77edSStefan Weil --disable-debug-info disable debugging information 119208fb77edSStefan Weil --enable-debug enable common debug build options 119308fb77edSStefan Weil --enable-sparse enable sparse checker 119408fb77edSStefan Weil --disable-sparse disable sparse checker (default) 119508fb77edSStefan Weil --disable-strip disable stripping binaries 119608fb77edSStefan Weil --disable-werror disable compilation abort on warning 119708fb77edSStefan Weil --disable-sdl disable SDL 119808fb77edSStefan Weil --enable-sdl enable SDL 119908fb77edSStefan Weil --disable-gtk disable gtk UI 120008fb77edSStefan Weil --enable-gtk enable gtk UI 120108fb77edSStefan Weil --disable-virtfs disable VirtFS 120208fb77edSStefan Weil --enable-virtfs enable VirtFS 120308fb77edSStefan Weil --disable-vnc disable VNC 120408fb77edSStefan Weil --enable-vnc enable VNC 120508fb77edSStefan Weil --disable-cocoa disable Cocoa (Mac OS X only) 120608fb77edSStefan Weil --enable-cocoa enable Cocoa (default on Mac OS X) 120708fb77edSStefan Weil --audio-drv-list=LIST set audio drivers list: 120808fb77edSStefan Weil Available drivers: $audio_possible_drivers 120908fb77edSStefan Weil --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L 121008fb77edSStefan Weil --block-drv-rw-whitelist=L 121108fb77edSStefan Weil set block driver read-write whitelist 121208fb77edSStefan Weil (affects only QEMU, not qemu-img) 121308fb77edSStefan Weil --block-drv-ro-whitelist=L 121408fb77edSStefan Weil set block driver read-only whitelist 121508fb77edSStefan Weil (affects only QEMU, not qemu-img) 121608fb77edSStefan Weil --disable-xen disable xen backend driver support 121708fb77edSStefan Weil --enable-xen enable xen backend driver support 121808fb77edSStefan Weil --disable-xen-pci-passthrough 121908fb77edSStefan Weil --enable-xen-pci-passthrough 122008fb77edSStefan Weil --disable-brlapi disable BrlAPI 122108fb77edSStefan Weil --enable-brlapi enable BrlAPI 122208fb77edSStefan Weil --disable-vnc-tls disable TLS encryption for VNC server 122308fb77edSStefan Weil --enable-vnc-tls enable TLS encryption for VNC server 122408fb77edSStefan Weil --disable-vnc-sasl disable SASL encryption for VNC server 122508fb77edSStefan Weil --enable-vnc-sasl enable SASL encryption for VNC server 122608fb77edSStefan Weil --disable-vnc-jpeg disable JPEG lossy compression for VNC server 122708fb77edSStefan Weil --enable-vnc-jpeg enable JPEG lossy compression for VNC server 122808fb77edSStefan Weil --disable-vnc-png disable PNG compression for VNC server (default) 122908fb77edSStefan Weil --enable-vnc-png enable PNG compression for VNC server 123008fb77edSStefan Weil --disable-vnc-ws disable Websockets support for VNC server 123108fb77edSStefan Weil --enable-vnc-ws enable Websockets support for VNC server 123208fb77edSStefan Weil --disable-curses disable curses output 123308fb77edSStefan Weil --enable-curses enable curses output 123408fb77edSStefan Weil --disable-curl disable curl connectivity 123508fb77edSStefan Weil --enable-curl enable curl connectivity 123608fb77edSStefan Weil --disable-fdt disable fdt device tree 123708fb77edSStefan Weil --enable-fdt enable fdt device tree 123808fb77edSStefan Weil --disable-bluez disable bluez stack connectivity 123908fb77edSStefan Weil --enable-bluez enable bluez stack connectivity 124008fb77edSStefan Weil --disable-slirp disable SLIRP userspace network connectivity 124108fb77edSStefan Weil --disable-kvm disable KVM acceleration support 124208fb77edSStefan Weil --enable-kvm enable KVM acceleration support 124308fb77edSStefan Weil --disable-rdma disable RDMA-based migration support 124408fb77edSStefan Weil --enable-rdma enable RDMA-based migration support 124508fb77edSStefan Weil --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) 124608fb77edSStefan Weil --enable-system enable all system emulation targets 124708fb77edSStefan Weil --disable-system disable all system emulation targets 124808fb77edSStefan Weil --enable-user enable supported user emulation targets 124908fb77edSStefan Weil --disable-user disable all user emulation targets 125008fb77edSStefan Weil --enable-linux-user enable all linux usermode emulation targets 125108fb77edSStefan Weil --disable-linux-user disable all linux usermode emulation targets 125208fb77edSStefan Weil --enable-bsd-user enable all BSD usermode emulation targets 125308fb77edSStefan Weil --disable-bsd-user disable all BSD usermode emulation targets 125408fb77edSStefan Weil --enable-guest-base enable GUEST_BASE support for usermode 125508fb77edSStefan Weil emulation targets 125608fb77edSStefan Weil --disable-guest-base disable GUEST_BASE support 125708fb77edSStefan Weil --enable-pie build Position Independent Executables 125808fb77edSStefan Weil --disable-pie do not build Position Independent Executables 125908fb77edSStefan Weil --fmod-lib path to FMOD library 126008fb77edSStefan Weil --fmod-inc path to FMOD includes 126108fb77edSStefan Weil --oss-lib path to OSS library 126208fb77edSStefan Weil --enable-uname-release=R Return R for uname -r in usermode emulation 126308fb77edSStefan Weil --cpu=CPU Build for host CPU [$cpu] 126408fb77edSStefan Weil --disable-uuid disable uuid support 126508fb77edSStefan Weil --enable-uuid enable uuid support 126608fb77edSStefan Weil --disable-vde disable support for vde network 126708fb77edSStefan Weil --enable-vde enable support for vde network 126808fb77edSStefan Weil --disable-netmap disable support for netmap network 126908fb77edSStefan Weil --enable-netmap enable support for netmap network 127008fb77edSStefan Weil --disable-linux-aio disable Linux AIO support 127108fb77edSStefan Weil --enable-linux-aio enable Linux AIO support 127208fb77edSStefan Weil --disable-cap-ng disable libcap-ng support 127308fb77edSStefan Weil --enable-cap-ng enable libcap-ng support 127408fb77edSStefan Weil --disable-attr disables attr and xattr support 127508fb77edSStefan Weil --enable-attr enable attr and xattr support 127608fb77edSStefan Weil --disable-blobs disable installing provided firmware blobs 127708fb77edSStefan Weil --enable-docs enable documentation build 127808fb77edSStefan Weil --disable-docs disable documentation build 127908fb77edSStefan Weil --disable-vhost-net disable vhost-net acceleration support 128008fb77edSStefan Weil --enable-vhost-net enable vhost-net acceleration support 128108fb77edSStefan Weil --enable-trace-backend=B Set trace backend 128208fb77edSStefan Weil Available backends: $($python $source_path/scripts/tracetool.py --list-backends) 128308fb77edSStefan Weil --with-trace-file=NAME Full PATH,NAME of file to store traces 128408fb77edSStefan Weil Default:trace-<pid> 128508fb77edSStefan Weil --disable-spice disable spice 128608fb77edSStefan Weil --enable-spice enable spice 128708fb77edSStefan Weil --enable-rbd enable building the rados block device (rbd) 128808fb77edSStefan Weil --disable-libiscsi disable iscsi support 128908fb77edSStefan Weil --enable-libiscsi enable iscsi support 12906542aa9cSPeter Lieven --disable-libnfs disable nfs support 12916542aa9cSPeter Lieven --enable-libnfs enable nfs support 129208fb77edSStefan Weil --disable-smartcard-nss disable smartcard nss support 129308fb77edSStefan Weil --enable-smartcard-nss enable smartcard nss support 129408fb77edSStefan Weil --disable-libusb disable libusb (for usb passthrough) 129508fb77edSStefan Weil --enable-libusb enable libusb (for usb passthrough) 129608fb77edSStefan Weil --disable-usb-redir disable usb network redirection support 129708fb77edSStefan Weil --enable-usb-redir enable usb network redirection support 1298*607dacd0Sqiaonuohan --enable-lzo enable the support of lzo compression library 1299*607dacd0Sqiaonuohan --enable-snappy enable the support of snappy compression library 130008fb77edSStefan Weil --disable-guest-agent disable building of the QEMU Guest Agent 130108fb77edSStefan Weil --enable-guest-agent enable building of the QEMU Guest Agent 130208fb77edSStefan Weil --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent 130308fb77edSStefan Weil --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) 130408fb77edSStefan Weil --disable-seccomp disable seccomp support 130508fb77edSStefan Weil --enable-seccomp enables seccomp support 130608fb77edSStefan Weil --with-coroutine=BACKEND coroutine backend. Supported options: 130708fb77edSStefan Weil gthread, ucontext, sigaltstack, windows 130808fb77edSStefan Weil --disable-coroutine-pool disable coroutine freelist (worse performance) 130908fb77edSStefan Weil --enable-coroutine-pool enable coroutine freelist (better performance) 131008fb77edSStefan Weil --enable-glusterfs enable GlusterFS backend 131108fb77edSStefan Weil --disable-glusterfs disable GlusterFS backend 131208fb77edSStefan Weil --enable-gcov enable test coverage analysis with gcov 131308fb77edSStefan Weil --gcov=GCOV use specified gcov [$gcov_tool] 131408fb77edSStefan Weil --enable-tpm enable TPM support 131508fb77edSStefan Weil --disable-libssh2 disable ssh block device support 131608fb77edSStefan Weil --enable-libssh2 enable ssh block device support 131708fb77edSStefan Weil --disable-vhdx disables support for the Microsoft VHDX image format 131808fb77edSStefan Weil --enable-vhdx enable support for the Microsoft VHDX image format 131995c6bff3SBenoît Canet --disable-quorum disable quorum block filter support 132095c6bff3SBenoît Canet --enable-quorum enable quorum block filter support 132108fb77edSStefan Weil 132208fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched 1323af5db58eSpbrookEOF 1324af5db58eSpbrookexit 1 1325af5db58eSpbrookfi 1326af5db58eSpbrook 1327359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1328359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1329359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1330359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1331359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1332359bc95dSPeter Maydell ARCH=tci 1333359bc95dSPeter Maydell else 133476ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1335359bc95dSPeter Maydell fi 1336359bc95dSPeter Maydellfi 1337359bc95dSPeter Maydell 13388d05095cSPaolo Bonzini# check that the C compiler works. 13398d05095cSPaolo Bonzinicat > $TMPC <<EOF 134075cafad7SStefan Weilint main(void) { return 0; } 13418d05095cSPaolo BonziniEOF 13428d05095cSPaolo Bonzini 13438d05095cSPaolo Bonziniif compile_object ; then 13448d05095cSPaolo Bonzini : C compiler works ok 13458d05095cSPaolo Bonzinielse 134676ad07a4SPeter Maydell error_exit "\"$cc\" either does not exist or does not work" 13478d05095cSPaolo Bonzinifi 13488d05095cSPaolo Bonzini 134998b21dcdSPeter Maydell# Check that the C++ compiler exists and works with the C compiler 135098b21dcdSPeter Maydellif has $cxx; then 135198b21dcdSPeter Maydell cat > $TMPC <<EOF 135298b21dcdSPeter Maydellint c_function(void); 135398b21dcdSPeter Maydellint main(void) { return c_function(); } 135498b21dcdSPeter MaydellEOF 135598b21dcdSPeter Maydell 135698b21dcdSPeter Maydell compile_object 135798b21dcdSPeter Maydell 135898b21dcdSPeter Maydell cat > $TMPC <<EOF 135998b21dcdSPeter Maydellextern "C" { 136098b21dcdSPeter Maydell int c_function(void); 136198b21dcdSPeter Maydell} 136298b21dcdSPeter Maydellint c_function(void) { return 42; } 136398b21dcdSPeter MaydellEOF 136498b21dcdSPeter Maydell 136598b21dcdSPeter Maydell if (cc=$cxx do_cc $QEMU_CFLAGS -o $TMPE $TMPC $TMPO $LDFLAGS); then 136698b21dcdSPeter Maydell # C++ compiler $cxx works ok with C compiler $cc 136798b21dcdSPeter Maydell : 136898b21dcdSPeter Maydell else 136998b21dcdSPeter Maydell echo "C++ compiler $cxx does not work with C compiler $cc" 137098b21dcdSPeter Maydell echo "Disabling C++ specific optional code" 137198b21dcdSPeter Maydell cxx= 137298b21dcdSPeter Maydell fi 137398b21dcdSPeter Maydellelse 137498b21dcdSPeter Maydell echo "No C++ compiler available; disabling C++ specific optional code" 137598b21dcdSPeter Maydell cxx= 137698b21dcdSPeter Maydellfi 137798b21dcdSPeter Maydell 1378417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror 1379417c9d72SAlexander Graf# by default. Only enable by default for git builds 1380417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION` 1381417c9d72SAlexander Graf 1382417c9d72SAlexander Grafif test -z "$werror" ; then 13836c8fec83SAndreas Färber if test -d "$source_path/.git" -a \ 1384417c9d72SAlexander Graf "$linux" = "yes" ; then 1385417c9d72SAlexander Graf werror="yes" 1386417c9d72SAlexander Graf else 1387417c9d72SAlexander Graf werror="no" 1388417c9d72SAlexander Graf fi 1389417c9d72SAlexander Graffi 1390417c9d72SAlexander Graf 13918d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 13928d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 13938d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 139437746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags" 1395c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags" 139671429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags" 13976ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 13986ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 13996ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 14006ca026cbSPeter Maydell# so it's too error prone. 14018d05095cSPaolo Bonzinicat > $TMPC << EOF 14028d05095cSPaolo Bonziniint main(void) { return 0; } 14038d05095cSPaolo BonziniEOF 14048d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1405a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1406a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1407a1d29d6cSPeter Maydell # warning options). 1408a1d29d6cSPeter Maydell optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')" 1409a1d29d6cSPeter Maydell if compile_prog "-Werror $optflag" "" ; then 14108d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 14118d05095cSPaolo Bonzini fi 14128d05095cSPaolo Bonzinidone 14138d05095cSPaolo Bonzini 141437746c5eSMarc-André Lureauif compile_prog "-Werror -fstack-protector-all" "" ; then 141537746c5eSMarc-André Lureau QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all" 141637746c5eSMarc-André Lureau LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all" 141737746c5eSMarc-André Lureaufi 141837746c5eSMarc-André Lureau 1419cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1420cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1421cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1422cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1423cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1424cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1425cbdd1999SPaolo Bonziniint main(void) { return 0; } 1426cbdd1999SPaolo Bonzini#else 1427cbdd1999SPaolo Bonzini#error No bug in this compiler. 1428cbdd1999SPaolo Bonzini#endif 1429cbdd1999SPaolo BonziniEOF 1430cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1431cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1432cbdd1999SPaolo Bonzinifi 1433cbdd1999SPaolo Bonzini 143440d6444eSAvi Kivityif test "$static" = "yes" ; then 1435aa0d1f44SPaolo Bonzini if test "$modules" = "yes" ; then 1436aa0d1f44SPaolo Bonzini error_exit "static and modules are mutually incompatible" 1437aa0d1f44SPaolo Bonzini fi 143840d6444eSAvi Kivity if test "$pie" = "yes" ; then 143976ad07a4SPeter Maydell error_exit "static and pie are mutually incompatible" 144040d6444eSAvi Kivity else 144140d6444eSAvi Kivity pie="no" 144240d6444eSAvi Kivity fi 144340d6444eSAvi Kivityfi 144440d6444eSAvi Kivity 144540d6444eSAvi Kivityif test "$pie" = ""; then 144640d6444eSAvi Kivity case "$cpu-$targetos" in 1447c72b26ecSRichard Henderson i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) 144840d6444eSAvi Kivity ;; 144940d6444eSAvi Kivity *) 145040d6444eSAvi Kivity pie="no" 145140d6444eSAvi Kivity ;; 145240d6444eSAvi Kivity esac 145340d6444eSAvi Kivityfi 145440d6444eSAvi Kivity 145540d6444eSAvi Kivityif test "$pie" != "no" ; then 145640d6444eSAvi Kivity cat > $TMPC << EOF 145721d4a791SAvi Kivity 145821d4a791SAvi Kivity#ifdef __linux__ 145921d4a791SAvi Kivity# define THREAD __thread 146021d4a791SAvi Kivity#else 146121d4a791SAvi Kivity# define THREAD 146221d4a791SAvi Kivity#endif 146321d4a791SAvi Kivity 146421d4a791SAvi Kivitystatic THREAD int tls_var; 146521d4a791SAvi Kivity 146621d4a791SAvi Kivityint main(void) { return tls_var; } 146721d4a791SAvi Kivity 146840d6444eSAvi KivityEOF 146940d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 147040d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 147140d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 147240d6444eSAvi Kivity pie="yes" 147340d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 147440d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 147540d6444eSAvi Kivity fi 147640d6444eSAvi Kivity else 147740d6444eSAvi Kivity if test "$pie" = "yes"; then 147876ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 147940d6444eSAvi Kivity else 148040d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 148140d6444eSAvi Kivity pie="no" 148240d6444eSAvi Kivity fi 148340d6444eSAvi Kivity fi 148446eef33bSBrad 148546eef33bSBrad if compile_prog "-fno-pie" "-nopie"; then 148646eef33bSBrad CFLAGS_NOPIE="-fno-pie" 148746eef33bSBrad LDFLAGS_NOPIE="-nopie" 148846eef33bSBrad fi 148940d6444eSAvi Kivityfi 149040d6444eSAvi Kivity 149166518bf6SDon Slutz# check for broken gcc and libtool in RHEL5 149266518bf6SDon Slutzif test -n "$libtool" -a "$pie" != "no" ; then 149366518bf6SDon Slutz cat > $TMPC <<EOF 149466518bf6SDon Slutz 149566518bf6SDon Slutzvoid *f(unsigned char *buf, int len); 149666518bf6SDon Slutzvoid *g(unsigned char *buf, int len); 149766518bf6SDon Slutz 149866518bf6SDon Slutzvoid * 149966518bf6SDon Slutzf(unsigned char *buf, int len) 150066518bf6SDon Slutz{ 150166518bf6SDon Slutz return (void*)0L; 150266518bf6SDon Slutz} 150366518bf6SDon Slutz 150466518bf6SDon Slutzvoid * 150566518bf6SDon Slutzg(unsigned char *buf, int len) 150666518bf6SDon Slutz{ 150766518bf6SDon Slutz return f(buf, len); 150866518bf6SDon Slutz} 150966518bf6SDon Slutz 151066518bf6SDon SlutzEOF 151166518bf6SDon Slutz if ! libtool_prog; then 151266518bf6SDon Slutz echo "Disabling libtool due to broken toolchain support" 151366518bf6SDon Slutz libtool= 151466518bf6SDon Slutz fi 151566518bf6SDon Slutzfi 151666518bf6SDon Slutz 151709dada40SPaolo Bonzini########################################## 151809dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 151909dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 152009dada40SPaolo Bonzini# specification is necessary 152109dada40SPaolo Bonzini 152209dada40SPaolo Bonziniif test "$cpu" = "i386"; then 152309dada40SPaolo Bonzini cat > $TMPC << EOF 152409dada40SPaolo Bonzinistatic int sfaa(int *ptr) 152509dada40SPaolo Bonzini{ 152609dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 152709dada40SPaolo Bonzini} 152809dada40SPaolo Bonzini 152909dada40SPaolo Bonziniint main(void) 153009dada40SPaolo Bonzini{ 153109dada40SPaolo Bonzini int val = 42; 15321405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 153309dada40SPaolo Bonzini sfaa(&val); 153409dada40SPaolo Bonzini return val; 153509dada40SPaolo Bonzini} 153609dada40SPaolo BonziniEOF 153709dada40SPaolo Bonzini if ! compile_prog "" "" ; then 153809dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 153909dada40SPaolo Bonzini fi 154009dada40SPaolo Bonzinifi 154109dada40SPaolo Bonzini 154209dada40SPaolo Bonzini######################################### 1543ec530c81Sbellard# Solaris specific configure tool chain decisions 154409dada40SPaolo Bonzini 1545ec530c81Sbellardif test "$solaris" = "yes" ; then 15466792aa11SLoïc Minier if has $install; then 15476792aa11SLoïc Minier : 15486792aa11SLoïc Minier else 154976ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 155076ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 155176ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1552ec530c81Sbellard fi 15536792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 155476ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 155576ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 155676ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1557ec530c81Sbellard fi 15586792aa11SLoïc Minier if has ar; then 15596792aa11SLoïc Minier : 15606792aa11SLoïc Minier else 1561ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 156276ad07a4SPeter Maydell error_exit "No path includes ar" \ 156376ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 1564ec530c81Sbellard fi 156576ad07a4SPeter Maydell error_exit "No path includes ar" 1566ec530c81Sbellard fi 1567ec530c81Sbellardfi 1568ec530c81Sbellard 1569afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1570121afa9eSAnthony Liguori target_list="$default_target_list" 1571121afa9eSAnthony Liguorielse 1572121afa9eSAnthony Liguori target_list=`echo "$target_list" | sed -e 's/,/ /g'` 15735327cf48Sbellardfi 157425b48338SPeter Maydell 157525b48338SPeter Maydell# Check that we recognised the target name; this allows a more 157625b48338SPeter Maydell# friendly error message than if we let it fall through. 157725b48338SPeter Maydellfor target in $target_list; do 157825b48338SPeter Maydell case " $default_target_list " in 157925b48338SPeter Maydell *" $target "*) 158025b48338SPeter Maydell ;; 158125b48338SPeter Maydell *) 158225b48338SPeter Maydell error_exit "Unknown target name '$target'" 158325b48338SPeter Maydell ;; 158425b48338SPeter Maydell esac 158525b48338SPeter Maydelldone 158625b48338SPeter Maydell 1587f55fe278SPaolo Bonzini# see if system emulation was really requested 1588f55fe278SPaolo Bonzinicase " $target_list " in 1589f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1590f55fe278SPaolo Bonzini ;; 1591f55fe278SPaolo Bonzini *) softmmu=no 1592f55fe278SPaolo Bonzini ;; 1593f55fe278SPaolo Bonziniesac 15945327cf48Sbellard 1595249247c9SJuan Quintelafeature_not_found() { 1596249247c9SJuan Quintela feature=$1 159721684af0SStewart Smith remedy=$2 1598249247c9SJuan Quintela 159976ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 160021684af0SStewart Smith "configure was not able to find it." \ 160121684af0SStewart Smith "$remedy" 1602249247c9SJuan Quintela} 1603249247c9SJuan Quintela 16047d13299dSbellard# --- 16057d13299dSbellard# big/little endian test 16067d13299dSbellardcat > $TMPC << EOF 160761cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; 160861cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; 160961cc919fSMike Frysingerextern int foo(short *, short *); 161061cc919fSMike Frysingerint main(int argc, char *argv[]) { 161161cc919fSMike Frysinger return foo(big_endian, little_endian); 16127d13299dSbellard} 16137d13299dSbellardEOF 16147d13299dSbellard 161561cc919fSMike Frysingerif compile_object ; then 161661cc919fSMike Frysinger if grep -q BiGeNdIaN $TMPO ; then 161761cc919fSMike Frysinger bigendian="yes" 161861cc919fSMike Frysinger elif grep -q LiTtLeEnDiAn $TMPO ; then 161961cc919fSMike Frysinger bigendian="no" 16207d13299dSbellard else 16217d13299dSbellard echo big/little test failed 16227d13299dSbellard fi 16237d13299dSbellardelse 162461cc919fSMike Frysinger echo big/little test failed 16257d13299dSbellardfi 16267d13299dSbellard 1627b0a47e79SJuan Quintela########################################## 1628779ab5e3SStefan Weil# pkg-config probe 1629779ab5e3SStefan Weil 1630779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 163176ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 1632779ab5e3SStefan Weilfi 1633779ab5e3SStefan Weil 1634779ab5e3SStefan Weil########################################## 1635b0a47e79SJuan Quintela# NPTL probe 1636b0a47e79SJuan Quintela 163724cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 1638bd0c5661Spbrook cat > $TMPC <<EOF 1639bd0c5661Spbrook#include <sched.h> 164030813ceaSpbrook#include <linux/futex.h> 1641182eacc0SStefan Weilint main(void) { 1642bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1643bd0c5661Spbrook#error bork 1644bd0c5661Spbrook#endif 1645182eacc0SStefan Weil return 0; 1646bd0c5661Spbrook} 1647bd0c5661SpbrookEOF 164824cb36a6SPeter Maydell if ! compile_object ; then 164921684af0SStewart Smith feature_not_found "nptl" "Install glibc and linux kernel headers." 1650b0a47e79SJuan Quintela fi 1651bd0c5661Spbrookfi 1652bd0c5661Spbrook 165311d9f695Sbellard########################################## 1654ac62922eSbalrog# zlib check 1655ac62922eSbalrog 16561ece9905SAlon Levyif test "$zlib" != "no" ; then 1657ac62922eSbalrog cat > $TMPC << EOF 1658ac62922eSbalrog#include <zlib.h> 1659ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1660ac62922eSbalrogEOF 166152166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1662ac62922eSbalrog : 1663ac62922eSbalrog else 166476ad07a4SPeter Maydell error_exit "zlib check failed" \ 166576ad07a4SPeter Maydell "Make sure to have the zlib libs and headers installed." 1666ac62922eSbalrog fi 16671ece9905SAlon Levyfi 1668eb0ecd5aSWill NewtonLIBS="$LIBS -lz" 1669ac62922eSbalrog 1670ac62922eSbalrog########################################## 1671*607dacd0Sqiaonuohan# lzo check 1672*607dacd0Sqiaonuohan 1673*607dacd0Sqiaonuohanif test "$lzo" != "no" ; then 1674*607dacd0Sqiaonuohan cat > $TMPC << EOF 1675*607dacd0Sqiaonuohan#include <lzo/lzo1x.h> 1676*607dacd0Sqiaonuohanint main(void) { lzo_version(); return 0; } 1677*607dacd0SqiaonuohanEOF 1678*607dacd0Sqiaonuohan if compile_prog "" "-llzo2" ; then 1679*607dacd0Sqiaonuohan : 1680*607dacd0Sqiaonuohan else 1681*607dacd0Sqiaonuohan error_exit "lzo check failed" \ 1682*607dacd0Sqiaonuohan "Make sure to have the lzo libs and headers installed." 1683*607dacd0Sqiaonuohan fi 1684*607dacd0Sqiaonuohan 1685*607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -llzo2" 1686*607dacd0Sqiaonuohanfi 1687*607dacd0Sqiaonuohan 1688*607dacd0Sqiaonuohan########################################## 1689*607dacd0Sqiaonuohan# snappy check 1690*607dacd0Sqiaonuohan 1691*607dacd0Sqiaonuohanif test "$snappy" != "no" ; then 1692*607dacd0Sqiaonuohan cat > $TMPC << EOF 1693*607dacd0Sqiaonuohan#include <snappy-c.h> 1694*607dacd0Sqiaonuohanint main(void) { snappy_max_compressed_length(4096); return 0; } 1695*607dacd0SqiaonuohanEOF 1696*607dacd0Sqiaonuohan if compile_prog "" "-lsnappy" ; then 1697*607dacd0Sqiaonuohan : 1698*607dacd0Sqiaonuohan else 1699*607dacd0Sqiaonuohan error_exit "snappy check failed" \ 1700*607dacd0Sqiaonuohan "Make sure to have the snappy libs and headers installed." 1701*607dacd0Sqiaonuohan fi 1702*607dacd0Sqiaonuohan 1703*607dacd0Sqiaonuohan libs_softmmu="$libs_softmmu -lsnappy" 1704*607dacd0Sqiaonuohanfi 1705*607dacd0Sqiaonuohan 1706*607dacd0Sqiaonuohan########################################## 1707f794573eSEduardo Otubo# libseccomp check 1708f794573eSEduardo Otubo 1709f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 171065d5d3f9SStefan Weil if $pkg_config --atleast-version=2.1.0 libseccomp; then 1711b4451996SMichael Tokarev libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`" 1712372e47e9SAndreas Färber QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`" 1713f794573eSEduardo Otubo seccomp="yes" 1714f794573eSEduardo Otubo else 1715f794573eSEduardo Otubo if test "$seccomp" = "yes"; then 171621684af0SStewart Smith feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0" 1717f794573eSEduardo Otubo fi 1718e84d5956SYann E. MORIN seccomp="no" 1719f794573eSEduardo Otubo fi 1720f794573eSEduardo Otubofi 1721f794573eSEduardo Otubo########################################## 1722e37630caSaliguori# xen probe 1723e37630caSaliguori 1724fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1725b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1726d5b93ddfSAnthony PERARD 172750ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 172850ced5b3SStefan Weil # If no, we are done and there is no Xen support. 172950ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 173050ced5b3SStefan Weil 173150ced5b3SStefan Weil # Xen (any) 173250ced5b3SStefan Weil cat > $TMPC <<EOF 173350ced5b3SStefan Weil#include <xenctrl.h> 173450ced5b3SStefan Weilint main(void) { 173550ced5b3SStefan Weil return 0; 173650ced5b3SStefan Weil} 173750ced5b3SStefan WeilEOF 173850ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 173950ced5b3SStefan Weil # Xen not found 174050ced5b3SStefan Weil if test "$xen" = "yes" ; then 174121684af0SStewart Smith feature_not_found "xen" "Install xen devel" 174250ced5b3SStefan Weil fi 174350ced5b3SStefan Weil xen=no 174450ced5b3SStefan Weil 1745d5b93ddfSAnthony PERARD # Xen unstable 174669deef08SPeter Maydell elif 174769deef08SPeter Maydell cat > $TMPC <<EOF && 1748e37630caSaliguori#include <xenctrl.h> 1749e108a3c1SAnthony PERARD#include <xenstore.h> 1750d5b93ddfSAnthony PERARD#include <stdint.h> 1751d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1752d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1753d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1754d5b93ddfSAnthony PERARD#endif 1755d5b93ddfSAnthony PERARDint main(void) { 1756d5b93ddfSAnthony PERARD xc_interface *xc; 1757d5b93ddfSAnthony PERARD xs_daemon_open(); 1758d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1759d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1760d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1761b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 17628688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 17638688e065SStefano Stabellini return 0; 17648688e065SStefano Stabellini} 17658688e065SStefano StabelliniEOF 17668688e065SStefano Stabellini compile_prog "" "$xen_libs" 176769deef08SPeter Maydell then 17688688e065SStefano Stabellini xen_ctrl_version=420 17698688e065SStefano Stabellini xen=yes 17708688e065SStefano Stabellini 177169deef08SPeter Maydell elif 177269deef08SPeter Maydell cat > $TMPC <<EOF && 17738688e065SStefano Stabellini#include <xenctrl.h> 17748688e065SStefano Stabellini#include <xs.h> 17758688e065SStefano Stabellini#include <stdint.h> 17768688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h> 17778688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS) 17788688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined 17798688e065SStefano Stabellini#endif 17808688e065SStefano Stabelliniint main(void) { 17818688e065SStefano Stabellini xs_daemon_open(); 17829b4c0b56SPeter Maydell xc_interface_open(0, 0, 0); 17838688e065SStefano Stabellini xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 17848688e065SStefano Stabellini xc_gnttab_open(NULL, 0); 17858688e065SStefano Stabellini xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1786d5b93ddfSAnthony PERARD return 0; 1787d5b93ddfSAnthony PERARD} 1788e37630caSaliguoriEOF 178950ced5b3SStefan Weil compile_prog "" "$xen_libs" 179069deef08SPeter Maydell then 1791d5b93ddfSAnthony PERARD xen_ctrl_version=410 1792fc321b4bSJuan Quintela xen=yes 1793d5b93ddfSAnthony PERARD 1794d5b93ddfSAnthony PERARD # Xen 4.0.0 179569deef08SPeter Maydell elif 179669deef08SPeter Maydell cat > $TMPC <<EOF && 1797d5b93ddfSAnthony PERARD#include <xenctrl.h> 1798d5b93ddfSAnthony PERARD#include <xs.h> 1799d5b93ddfSAnthony PERARD#include <stdint.h> 1800d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1801d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1802d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1803d5b93ddfSAnthony PERARD#endif 1804d5b93ddfSAnthony PERARDint main(void) { 1805b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1806b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1807b87de24eSAnthony PERARD }; 1808d5b93ddfSAnthony PERARD xs_daemon_open(); 1809d5b93ddfSAnthony PERARD xc_interface_open(); 1810d5b93ddfSAnthony PERARD xc_gnttab_open(); 1811d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1812b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1813d5b93ddfSAnthony PERARD return 0; 1814d5b93ddfSAnthony PERARD} 1815d5b93ddfSAnthony PERARDEOF 1816d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 181769deef08SPeter Maydell then 1818d5b93ddfSAnthony PERARD xen_ctrl_version=400 1819d5b93ddfSAnthony PERARD xen=yes 1820d5b93ddfSAnthony PERARD 1821b87de24eSAnthony PERARD # Xen 3.4.0 182269deef08SPeter Maydell elif 182369deef08SPeter Maydell cat > $TMPC <<EOF && 1824b87de24eSAnthony PERARD#include <xenctrl.h> 1825b87de24eSAnthony PERARD#include <xs.h> 1826b87de24eSAnthony PERARDint main(void) { 1827b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1828b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1829b87de24eSAnthony PERARD }; 1830b87de24eSAnthony PERARD xs_daemon_open(); 1831b87de24eSAnthony PERARD xc_interface_open(); 1832b87de24eSAnthony PERARD xc_gnttab_open(); 1833b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1834b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1835b87de24eSAnthony PERARD return 0; 1836b87de24eSAnthony PERARD} 1837b87de24eSAnthony PERARDEOF 1838b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 183969deef08SPeter Maydell then 1840b87de24eSAnthony PERARD xen_ctrl_version=340 1841b87de24eSAnthony PERARD xen=yes 1842b87de24eSAnthony PERARD 1843b87de24eSAnthony PERARD # Xen 3.3.0 184469deef08SPeter Maydell elif 184569deef08SPeter Maydell cat > $TMPC <<EOF && 1846d5b93ddfSAnthony PERARD#include <xenctrl.h> 1847d5b93ddfSAnthony PERARD#include <xs.h> 1848d5b93ddfSAnthony PERARDint main(void) { 1849d5b93ddfSAnthony PERARD xs_daemon_open(); 1850d5b93ddfSAnthony PERARD xc_interface_open(); 1851d5b93ddfSAnthony PERARD xc_gnttab_open(); 1852d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1853d5b93ddfSAnthony PERARD return 0; 1854d5b93ddfSAnthony PERARD} 1855d5b93ddfSAnthony PERARDEOF 1856d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 185769deef08SPeter Maydell then 1858d5b93ddfSAnthony PERARD xen_ctrl_version=330 1859d5b93ddfSAnthony PERARD xen=yes 1860d5b93ddfSAnthony PERARD 186150ced5b3SStefan Weil # Xen version unsupported 1862e37630caSaliguori else 1863fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 186421684af0SStewart Smith feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)" 1865fc321b4bSJuan Quintela fi 1866fc321b4bSJuan Quintela xen=no 1867e37630caSaliguori fi 1868d5b93ddfSAnthony PERARD 1869d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1870d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1871d5b93ddfSAnthony PERARD fi 1872e37630caSaliguorifi 1873e37630caSaliguori 1874eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 1875eb6fda0fSAnthony PERARD if test "$xen" = "yes" && test "$linux" = "yes" && 1876eb6fda0fSAnthony PERARD test "$xen_ctrl_version" -ge 340; then 1877eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 1878eb6fda0fSAnthony PERARD else 1879eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 1880eb6fda0fSAnthony PERARD if test "$xen_ctrl_version" -lt 340; then 188176ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 188276ad07a4SPeter Maydell "This feature does not work with Xen 3.3" 1883eb6fda0fSAnthony PERARD fi 188476ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 188576ad07a4SPeter Maydell " but this feature requires /sys from Linux" 1886eb6fda0fSAnthony PERARD fi 1887eb6fda0fSAnthony PERARD xen_pci_passthrough=no 1888eb6fda0fSAnthony PERARD fi 1889eb6fda0fSAnthony PERARDfi 1890eb6fda0fSAnthony PERARD 1891e37630caSaliguori########################################## 189244dc0ca3SAlon Levy# libtool probe 189344dc0ca3SAlon Levy 18943f534581SBradif ! has $libtool; then 189544dc0ca3SAlon Levy libtool= 189644dc0ca3SAlon Levyfi 189744dc0ca3SAlon Levy 18988e515b12SPeter Maydell# MacOSX ships with a libtool which isn't the GNU one; weed this 18998e515b12SPeter Maydell# out by checking whether libtool supports the --version switch 19008e515b12SPeter Maydellif test -n "$libtool"; then 19018e515b12SPeter Maydell if ! "$libtool" --version >/dev/null 2>&1; then 19028e515b12SPeter Maydell libtool= 19038e515b12SPeter Maydell fi 19048e515b12SPeter Maydellfi 19058e515b12SPeter Maydell 190644dc0ca3SAlon Levy########################################## 1907dfffc653SJuan Quintela# Sparse probe 1908dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 19090dba6195SLoïc Minier if has cgcc; then 1910dfffc653SJuan Quintela sparse=yes 1911dfffc653SJuan Quintela else 1912dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 191321684af0SStewart Smith feature_not_found "sparse" "Install sparse binary" 1914dfffc653SJuan Quintela fi 1915dfffc653SJuan Quintela sparse=no 1916dfffc653SJuan Quintela fi 1917dfffc653SJuan Quintelafi 1918dfffc653SJuan Quintela 1919dfffc653SJuan Quintela########################################## 1920a4ccabcfSAnthony Liguori# GTK probe 1921a4ccabcfSAnthony Liguori 1922a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then 1923528de90aSDaniel P. Berrange gtkpackage="gtk+-$gtkabi" 1924528de90aSDaniel P. Berrange if test "$gtkabi" = "3.0" ; then 1925528de90aSDaniel P. Berrange gtkversion="3.0.0" 1926528de90aSDaniel P. Berrange vtepackage="vte-2.90" 1927528de90aSDaniel P. Berrange vteversion="0.32.0" 1928528de90aSDaniel P. Berrange else 1929528de90aSDaniel P. Berrange gtkversion="2.18.0" 1930528de90aSDaniel P. Berrange vtepackage="vte" 1931528de90aSDaniel P. Berrange vteversion="0.24.0" 1932528de90aSDaniel P. Berrange fi 19330d185e63SPeter Maydell if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then 19340d185e63SPeter Maydell if test "$gtk" = "yes" ; then 193521684af0SStewart Smith feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel" 19360d185e63SPeter Maydell fi 19370d185e63SPeter Maydell gtk="no" 19380d185e63SPeter Maydell elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then 19390d185e63SPeter Maydell if test "$gtk" = "yes" ; then 19400d185e63SPeter Maydell error_exit "libvte not found (required for gtk support)" 19410d185e63SPeter Maydell fi 19420d185e63SPeter Maydell gtk="no" 19430d185e63SPeter Maydell else 1944ca871ec8SStefan Weil gtk_cflags=`$pkg_config --cflags $gtkpackage` 1945ca871ec8SStefan Weil gtk_libs=`$pkg_config --libs $gtkpackage` 1946ca871ec8SStefan Weil vte_cflags=`$pkg_config --cflags $vtepackage` 1947ca871ec8SStefan Weil vte_libs=`$pkg_config --libs $vtepackage` 1948a4ccabcfSAnthony Liguori libs_softmmu="$gtk_libs $vte_libs $libs_softmmu" 1949a4ccabcfSAnthony Liguori gtk="yes" 1950a4ccabcfSAnthony Liguori fi 1951a4ccabcfSAnthony Liguorifi 1952a4ccabcfSAnthony Liguori 1953a4ccabcfSAnthony Liguori########################################## 195411d9f695Sbellard# SDL probe 195511d9f695Sbellard 19563ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 19573ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 19583ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 19593ec87ffeSPaolo Bonzini sdl_config=sdl-config 19603ec87ffeSPaolo Bonzinifi 19613ec87ffeSPaolo Bonzini 196265d5d3f9SStefan Weilif $pkg_config sdl --exists; then 1963a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1964fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 19653ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 19663ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 19679316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1968a0dfd8a4SLoïc Minierelse 1969a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 197021684af0SStewart Smith feature_not_found "sdl" "Install SDL devel" 1971a0dfd8a4SLoïc Minier fi 1972a0dfd8a4SLoïc Minier sdl=no 19739316f803SPaolo Bonzinifi 197429e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 19753ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 19763ec87ffeSPaolo Bonzinifi 197711d9f695Sbellard 19789316f803SPaolo Bonzinisdl_too_old=no 1979c4198157SJuan Quintelaif test "$sdl" != "no" ; then 198011d9f695Sbellard cat > $TMPC << EOF 198111d9f695Sbellard#include <SDL.h> 198211d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 198311d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 198411d9f695SbellardEOF 19859316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 198674f42e18STeLeMan if test "$static" = "yes" ; then 198774f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 198874f42e18STeLeMan else 19899316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 199074f42e18STeLeMan fi 199152166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 199211d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 199311d9f695Sbellard sdl_too_old=yes 199411d9f695Sbellard else 1995fd677642Sths if test "$cocoa" = "no" ; then 199611d9f695Sbellard sdl=yes 199711d9f695Sbellard fi 1998fd677642Sths fi 19997c1f25b4Sbellard 200067c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 20011ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 200267c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 2003f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 2004f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 200511d9f695Sbellard fi 200652166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 20071ac88f28SJuan Quintela : 20081ac88f28SJuan Quintela else 20091ac88f28SJuan Quintela sdl=no 20107c1f25b4Sbellard fi 20117c1f25b4Sbellard fi # static link 2012c4198157SJuan Quintela else # sdl not found 2013c4198157SJuan Quintela if test "$sdl" = "yes" ; then 201421684af0SStewart Smith feature_not_found "sdl" "Install SDL devel" 2015c4198157SJuan Quintela fi 2016c4198157SJuan Quintela sdl=no 20177c1f25b4Sbellard fi # sdl compile test 2018fd677642Sthsfi 201911d9f695Sbellard 20205368a422Saliguoriif test "$sdl" = "yes" ; then 20215368a422Saliguori cat > $TMPC <<EOF 20225368a422Saliguori#include <SDL.h> 20235368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 20245368a422Saliguori#include <X11/XKBlib.h> 20255368a422Saliguori#else 20265368a422Saliguori#error No x11 support 20275368a422Saliguori#endif 20285368a422Saliguoriint main(void) { return 0; } 20295368a422SaliguoriEOF 203052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 2031681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 20325368a422Saliguori fi 20330705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 20345368a422Saliguorifi 20355368a422Saliguori 20368f28f3fbSths########################################## 20372da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 20382da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 20392da776dbSMichael R. Hines cat > $TMPC <<EOF 20402da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 20412da776dbSMichael R. Hinesint main(void) { return 0; } 20422da776dbSMichael R. HinesEOF 20432da776dbSMichael R. Hines rdma_libs="-lrdmacm -libverbs" 20442da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 20452da776dbSMichael R. Hines rdma="yes" 20462da776dbSMichael R. Hines libs_softmmu="$libs_softmmu $rdma_libs" 20472da776dbSMichael R. Hines else 20482da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 20492da776dbSMichael R. Hines error_exit \ 20502da776dbSMichael R. Hines " OpenFabrics librdmacm/libibverbs not present." \ 20512da776dbSMichael R. Hines " Your options:" \ 20522da776dbSMichael R. Hines " (1) Fast: Install infiniband packages from your distro." \ 20532da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 20542da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 20552da776dbSMichael R. Hines fi 20562da776dbSMichael R. Hines rdma="no" 20572da776dbSMichael R. Hines fi 20582da776dbSMichael R. Hinesfi 20592da776dbSMichael R. Hines 20602da776dbSMichael R. Hines########################################## 20617536ee4bSTim Hardeck# VNC TLS/WS detection 20627536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then 2063ae6b5e5aSaliguori cat > $TMPC <<EOF 2064ae6b5e5aSaliguori#include <gnutls/gnutls.h> 2065ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 2066ae6b5e5aSaliguoriEOF 2067a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 2068a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 206952166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 20707536ee4bSTim Hardeck if test "$vnc_tls" != "no" ; then 20711be10ad2SJuan Quintela vnc_tls=yes 20727536ee4bSTim Hardeck fi 20737536ee4bSTim Hardeck if test "$vnc_ws" != "no" ; then 20747536ee4bSTim Hardeck vnc_ws=yes 20757536ee4bSTim Hardeck fi 2076a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 2077ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags" 2078ae6b5e5aSaliguori else 20791be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 208021684af0SStewart Smith feature_not_found "vnc-tls" "Install gnutls devel" 20811be10ad2SJuan Quintela fi 20827536ee4bSTim Hardeck if test "$vnc_ws" = "yes" ; then 208321684af0SStewart Smith feature_not_found "vnc-ws" "Install gnutls devel" 20847536ee4bSTim Hardeck fi 20851be10ad2SJuan Quintela vnc_tls=no 20867536ee4bSTim Hardeck vnc_ws=no 20878d5d2d4cSths fi 20888d5d2d4cSthsfi 20898d5d2d4cSths 20908d5d2d4cSths########################################## 209195c6bff3SBenoît Canet# Quorum probe (check for gnutls) 209295c6bff3SBenoît Canetif test "$quorum" != "no" ; then 209395c6bff3SBenoît Canetcat > $TMPC <<EOF 209495c6bff3SBenoît Canet#include <gnutls/gnutls.h> 209595c6bff3SBenoît Canet#include <gnutls/crypto.h> 209695c6bff3SBenoît Canetint main(void) {char data[4096], digest[32]; 209795c6bff3SBenoît Canetgnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest); 209895c6bff3SBenoît Canetreturn 0; 209995c6bff3SBenoît Canet} 210095c6bff3SBenoît CanetEOF 210195c6bff3SBenoît Canetquorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 210295c6bff3SBenoît Canetquorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 210395c6bff3SBenoît Canetif compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then 210495c6bff3SBenoît Canet qcow_tls=yes 210595c6bff3SBenoît Canet libs_softmmu="$quorum_tls_libs $libs_softmmu" 210695c6bff3SBenoît Canet libs_tools="$quorum_tls_libs $libs_softmmu" 210795c6bff3SBenoît Canet QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags" 210895c6bff3SBenoît Canetelse 210995c6bff3SBenoît Canet echo "gnutls > 2.10.0 required to compile Quorum" 211095c6bff3SBenoît Canet exit 1 211195c6bff3SBenoît Canetfi 211295c6bff3SBenoît Canetfi 211395c6bff3SBenoît Canet 211495c6bff3SBenoît Canet########################################## 21152f9606b3Saliguori# VNC SASL detection 2116821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 21172f9606b3Saliguori cat > $TMPC <<EOF 21182f9606b3Saliguori#include <sasl/sasl.h> 21192f9606b3Saliguori#include <stdio.h> 21202f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 21212f9606b3SaliguoriEOF 21222f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 21232f9606b3Saliguori vnc_sasl_cflags="" 21242f9606b3Saliguori vnc_sasl_libs="-lsasl2" 212552166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 2126ea784e3bSJuan Quintela vnc_sasl=yes 2127fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 2128ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 21292f9606b3Saliguori else 2130ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 213121684af0SStewart Smith feature_not_found "vnc-sasl" "Install Cyrus SASL devel" 2132ea784e3bSJuan Quintela fi 2133ea784e3bSJuan Quintela vnc_sasl=no 21342f9606b3Saliguori fi 21352f9606b3Saliguorifi 21362f9606b3Saliguori 21372f9606b3Saliguori########################################## 21382f6f5c7aSCorentin Chary# VNC JPEG detection 2139821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 21402f6f5c7aSCorentin Charycat > $TMPC <<EOF 21412f6f5c7aSCorentin Chary#include <stdio.h> 21422f6f5c7aSCorentin Chary#include <jpeglib.h> 21432f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 21442f6f5c7aSCorentin CharyEOF 21452f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 21462f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 21472f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 21482f6f5c7aSCorentin Chary vnc_jpeg=yes 21492f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 2150ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 21512f6f5c7aSCorentin Chary else 21522f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 215321684af0SStewart Smith feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel" 21542f6f5c7aSCorentin Chary fi 21552f6f5c7aSCorentin Chary vnc_jpeg=no 21562f6f5c7aSCorentin Chary fi 21572f6f5c7aSCorentin Charyfi 21582f6f5c7aSCorentin Chary 21592f6f5c7aSCorentin Chary########################################## 2160efe556adSCorentin Chary# VNC PNG detection 2161821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 2162efe556adSCorentin Charycat > $TMPC <<EOF 2163efe556adSCorentin Chary//#include <stdio.h> 2164efe556adSCorentin Chary#include <png.h> 2165832ce9c2SScott Wood#include <stddef.h> 2166efe556adSCorentin Charyint main(void) { 2167efe556adSCorentin Chary png_structp png_ptr; 2168efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 21697edc3fedSPeter Maydell return png_ptr != 0; 2170efe556adSCorentin Chary} 2171efe556adSCorentin CharyEOF 217265d5d3f9SStefan Weil if $pkg_config libpng --exists; then 2173ca871ec8SStefan Weil vnc_png_cflags=`$pkg_config libpng --cflags` 2174ca871ec8SStefan Weil vnc_png_libs=`$pkg_config libpng --libs` 21759af8025eSBrad else 2176efe556adSCorentin Chary vnc_png_cflags="" 2177efe556adSCorentin Chary vnc_png_libs="-lpng" 21789af8025eSBrad fi 2179efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 2180efe556adSCorentin Chary vnc_png=yes 2181efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 21829af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 2183efe556adSCorentin Chary else 2184efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 218521684af0SStewart Smith feature_not_found "vnc-png" "Install libpng devel" 2186efe556adSCorentin Chary fi 2187efe556adSCorentin Chary vnc_png=no 2188efe556adSCorentin Chary fi 2189efe556adSCorentin Charyfi 2190efe556adSCorentin Chary 2191efe556adSCorentin Chary########################################## 219276655d6dSaliguori# fnmatch() probe, used for ACL routines 219376655d6dSaliguorifnmatch="no" 219476655d6dSaliguoricat > $TMPC << EOF 219576655d6dSaliguori#include <fnmatch.h> 219676655d6dSaliguoriint main(void) 219776655d6dSaliguori{ 219876655d6dSaliguori fnmatch("foo", "foo", 0); 219976655d6dSaliguori return 0; 220076655d6dSaliguori} 220176655d6dSaliguoriEOF 220252166aa0SJuan Quintelaif compile_prog "" "" ; then 220376655d6dSaliguori fnmatch="yes" 220476655d6dSaliguorifi 220576655d6dSaliguori 220676655d6dSaliguori########################################## 2207ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 22082d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library 22092d16c8e9SPeter Maydell# need be linked to get the uuid functions. 2210ee682d27SStefan Weilif test "$uuid" != "no" ; then 2211ee682d27SStefan Weil uuid_libs="-luuid" 2212ee682d27SStefan Weil cat > $TMPC << EOF 2213ee682d27SStefan Weil#include <uuid/uuid.h> 2214ee682d27SStefan Weilint main(void) 2215ee682d27SStefan Weil{ 2216ee682d27SStefan Weil uuid_t my_uuid; 2217ee682d27SStefan Weil uuid_generate(my_uuid); 2218ee682d27SStefan Weil return 0; 2219ee682d27SStefan Weil} 2220ee682d27SStefan WeilEOF 22212d16c8e9SPeter Maydell if compile_prog "" "" ; then 22222d16c8e9SPeter Maydell uuid="yes" 22232d16c8e9SPeter Maydell elif compile_prog "" "$uuid_libs" ; then 2224ee682d27SStefan Weil uuid="yes" 2225ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 2226ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 2227ee682d27SStefan Weil else 2228ee682d27SStefan Weil if test "$uuid" = "yes" ; then 222921684af0SStewart Smith feature_not_found "uuid" "Install libuuid devel" 2230ee682d27SStefan Weil fi 2231ee682d27SStefan Weil uuid=no 2232ee682d27SStefan Weil fi 2233ee682d27SStefan Weilfi 2234ee682d27SStefan Weil 22354f18b782SJeff Codyif test "$vhdx" = "yes" ; then 22364f18b782SJeff Cody if test "$uuid" = "no" ; then 22374f18b782SJeff Cody error_exit "uuid required for VHDX support" 22384f18b782SJeff Cody fi 22394f18b782SJeff Codyelif test "$vhdx" != "no" ; then 22404f18b782SJeff Cody if test "$uuid" = "yes" ; then 22414f18b782SJeff Cody vhdx=yes 22424f18b782SJeff Cody else 22434f18b782SJeff Cody vhdx=no 22444f18b782SJeff Cody fi 22454f18b782SJeff Codyfi 22464f18b782SJeff Cody 2247ee682d27SStefan Weil########################################## 2248dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 2249dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 2250dce512deSChristoph Hellwig cat > $TMPC << EOF 2251ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 2252dce512deSChristoph Hellwig#include <xfs/xfs.h> 2253dce512deSChristoph Hellwigint main(void) 2254dce512deSChristoph Hellwig{ 2255dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 2256dce512deSChristoph Hellwig return 0; 2257dce512deSChristoph Hellwig} 2258dce512deSChristoph HellwigEOF 2259dce512deSChristoph Hellwig if compile_prog "" "" ; then 2260dce512deSChristoph Hellwig xfs="yes" 2261dce512deSChristoph Hellwig else 2262dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 226321684af0SStewart Smith feature_not_found "xfs" "Instal xfsprogs/xfslibs devel" 2264dce512deSChristoph Hellwig fi 2265dce512deSChristoph Hellwig xfs=no 2266dce512deSChristoph Hellwig fi 2267dce512deSChristoph Hellwigfi 2268dce512deSChristoph Hellwig 2269dce512deSChristoph Hellwig########################################## 22708a16d273Sths# vde libraries probe 2271dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 22724baae0acSJuan Quintela vde_libs="-lvdeplug" 22738a16d273Sths cat > $TMPC << EOF 22748a16d273Sths#include <libvdeplug.h> 22754a7f0e06Spbrookint main(void) 22764a7f0e06Spbrook{ 22774a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 2278fea08e08SPeter Maydell char s[] = ""; 2279fea08e08SPeter Maydell vde_open(s, s, &a); 22804a7f0e06Spbrook return 0; 22814a7f0e06Spbrook} 22828a16d273SthsEOF 228352166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 22844baae0acSJuan Quintela vde=yes 22858e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 22868e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 2287dfb278bdSJuan Quintela else 2288dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 228921684af0SStewart Smith feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel" 2290dfb278bdSJuan Quintela fi 2291dfb278bdSJuan Quintela vde=no 22928a16d273Sths fi 22938a16d273Sthsfi 22948a16d273Sths 22958a16d273Sths########################################## 22960a985b37SVincenzo Maffione# netmap support probe 22970a985b37SVincenzo Maffione# Apart from looking for netmap headers, we make sure that the host API version 22980a985b37SVincenzo Maffione# supports the netmap backend (>=11). The upper bound (15) is meant to simulate 22990a985b37SVincenzo Maffione# a minor/major version number. Minor new features will be marked with values up 23000a985b37SVincenzo Maffione# to 15, and if something happens that requires a change to the backend we will 23010a985b37SVincenzo Maffione# move above 15, submit the backend fixes and modify this two bounds. 230258952137SVincenzo Maffioneif test "$netmap" != "no" ; then 230358952137SVincenzo Maffione cat > $TMPC << EOF 230458952137SVincenzo Maffione#include <inttypes.h> 230558952137SVincenzo Maffione#include <net/if.h> 230658952137SVincenzo Maffione#include <net/netmap.h> 230758952137SVincenzo Maffione#include <net/netmap_user.h> 23080a985b37SVincenzo Maffione#if (NETMAP_API < 11) || (NETMAP_API > 15) 23090a985b37SVincenzo Maffione#error 23100a985b37SVincenzo Maffione#endif 231158952137SVincenzo Maffioneint main(void) { return 0; } 231258952137SVincenzo MaffioneEOF 231358952137SVincenzo Maffione if compile_prog "" "" ; then 231458952137SVincenzo Maffione netmap=yes 231558952137SVincenzo Maffione else 231658952137SVincenzo Maffione if test "$netmap" = "yes" ; then 231758952137SVincenzo Maffione feature_not_found "netmap" 231858952137SVincenzo Maffione fi 231958952137SVincenzo Maffione netmap=no 232058952137SVincenzo Maffione fi 232158952137SVincenzo Maffionefi 232258952137SVincenzo Maffione 232358952137SVincenzo Maffione########################################## 232447e98658SCorey Bryant# libcap-ng library probe 232547e98658SCorey Bryantif test "$cap_ng" != "no" ; then 232647e98658SCorey Bryant cap_libs="-lcap-ng" 232747e98658SCorey Bryant cat > $TMPC << EOF 232847e98658SCorey Bryant#include <cap-ng.h> 232947e98658SCorey Bryantint main(void) 233047e98658SCorey Bryant{ 233147e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 233247e98658SCorey Bryant return 0; 233347e98658SCorey Bryant} 233447e98658SCorey BryantEOF 233547e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 233647e98658SCorey Bryant cap_ng=yes 233747e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 233847e98658SCorey Bryant else 233947e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 234021684af0SStewart Smith feature_not_found "cap_ng" "Install libcap-ng devel" 234147e98658SCorey Bryant fi 234247e98658SCorey Bryant cap_ng=no 234347e98658SCorey Bryant fi 234447e98658SCorey Bryantfi 234547e98658SCorey Bryant 234647e98658SCorey Bryant########################################## 2347c2de5c91Smalc# Sound support libraries probe 23488f28f3fbSths 2349c2de5c91Smalcaudio_drv_probe() 2350c2de5c91Smalc{ 2351c2de5c91Smalc drv=$1 2352c2de5c91Smalc hdr=$2 2353c2de5c91Smalc lib=$3 2354c2de5c91Smalc exp=$4 2355c2de5c91Smalc cfl=$5 23568f28f3fbSths cat > $TMPC << EOF 2357c2de5c91Smalc#include <$hdr> 2358c2de5c91Smalcint main(void) { $exp } 23598f28f3fbSthsEOF 236052166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 23618f28f3fbSths : 23628f28f3fbSths else 236376ad07a4SPeter Maydell error_exit "$drv check failed" \ 236476ad07a4SPeter Maydell "Make sure to have the $drv libs and headers installed." 23658f28f3fbSths fi 2366c2de5c91Smalc} 2367c2de5c91Smalc 23682fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 2369c2de5c91Smalcfor drv in $audio_drv_list; do 2370c2de5c91Smalc case $drv in 2371c2de5c91Smalc alsa) 2372c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 2373e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 2374a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 2375c2de5c91Smalc ;; 2376c2de5c91Smalc 2377c2de5c91Smalc fmod) 2378c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 237976ad07a4SPeter Maydell error_exit "You must specify path to FMOD library and headers" \ 238076ad07a4SPeter Maydell "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 23818f28f3fbSths fi 2382c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 2383a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 2384c2de5c91Smalc ;; 2385c2de5c91Smalc 2386c2de5c91Smalc esd) 2387c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 2388a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 238967f86e8eSJuan Quintela audio_pt_int="yes" 2390c2de5c91Smalc ;; 2391b8e59f18Smalc 2392b8e59f18Smalc pa) 2393a394aed2SMarc-André Lureau audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ 2394a394aed2SMarc-André Lureau "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" 2395a394aed2SMarc-André Lureau libs_softmmu="-lpulse $libs_softmmu" 239667f86e8eSJuan Quintela audio_pt_int="yes" 2397b8e59f18Smalc ;; 2398b8e59f18Smalc 2399997e690aSJuan Quintela coreaudio) 2400997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 2401997e690aSJuan Quintela ;; 2402997e690aSJuan Quintela 2403a4bf6780SJuan Quintela dsound) 2404a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 2405d5631638Smalc audio_win_int="yes" 2406a4bf6780SJuan Quintela ;; 2407a4bf6780SJuan Quintela 2408a4bf6780SJuan Quintela oss) 2409a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 2410a4bf6780SJuan Quintela ;; 2411a4bf6780SJuan Quintela 2412a4bf6780SJuan Quintela sdl|wav) 24132f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 24142f6a1ab0Sblueswir1 ;; 24152f6a1ab0Sblueswir1 2416d5631638Smalc winwave) 2417d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 2418d5631638Smalc audio_win_int="yes" 2419d5631638Smalc ;; 2420d5631638Smalc 2421e4c63a6aSmalc *) 24221c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 242376ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 242476ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 2425e4c63a6aSmalc } 2426e4c63a6aSmalc ;; 2427c2de5c91Smalc esac 2428c2de5c91Smalcdone 24298f28f3fbSths 24304d3b6f6eSbalrog########################################## 24312e4d9fb1Saurel32# BrlAPI probe 24322e4d9fb1Saurel32 24334ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 2434eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 24352e4d9fb1Saurel32 cat > $TMPC << EOF 24362e4d9fb1Saurel32#include <brlapi.h> 2437832ce9c2SScott Wood#include <stddef.h> 24382e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 24392e4d9fb1Saurel32EOF 244052166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 24412e4d9fb1Saurel32 brlapi=yes 2442264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 24434ffcedb6SJuan Quintela else 24444ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 244521684af0SStewart Smith feature_not_found "brlapi" "Install brlapi devel" 24464ffcedb6SJuan Quintela fi 24474ffcedb6SJuan Quintela brlapi=no 2448eb82284fSJuan Quintela fi 2449eb82284fSJuan Quintelafi 24502e4d9fb1Saurel32 24512e4d9fb1Saurel32########################################## 24524d3b6f6eSbalrog# curses probe 2453a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 2454e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 2455e095e2f3SStefan Weil curses_list="-lpdcurses" 2456e095e2f3SStefan Weil else 2457cfeda5f4SEd Maste curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses" 2458e095e2f3SStefan Weil fi 2459c584a6d0SJuan Quintela curses_found=no 24604d3b6f6eSbalrog cat > $TMPC << EOF 24614d3b6f6eSbalrog#include <curses.h> 2462ef9a2524SStefan Weilint main(void) { 2463ef9a2524SStefan Weil const char *s = curses_version(); 2464ef9a2524SStefan Weil resize_term(0, 0); 2465ef9a2524SStefan Weil return s != 0; 2466ef9a2524SStefan Weil} 24674d3b6f6eSbalrogEOF 2468ecbe251fSVadim Evard IFS=: 24694f78ef9aSJuan Quintela for curses_lib in $curses_list; do 2470ecbe251fSVadim Evard unset IFS 24714f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 2472c584a6d0SJuan Quintela curses_found=yes 24734f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 24744f78ef9aSJuan Quintela break 24754d3b6f6eSbalrog fi 24764f78ef9aSJuan Quintela done 2477ecbe251fSVadim Evard unset IFS 2478c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 2479c584a6d0SJuan Quintela curses=yes 2480c584a6d0SJuan Quintela else 2481c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 248221684af0SStewart Smith feature_not_found "curses" "Install ncurses devel" 2483c584a6d0SJuan Quintela fi 2484c584a6d0SJuan Quintela curses=no 2485c584a6d0SJuan Quintela fi 24864f78ef9aSJuan Quintelafi 24874d3b6f6eSbalrog 2488414f0dabSblueswir1########################################## 2489769ce76dSAlexander Graf# curl probe 2490a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 249165d5d3f9SStefan Weil if $pkg_config libcurl --exists; then 2492a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 24934e2b0658SPaolo Bonzini else 24944e2b0658SPaolo Bonzini curlconfig=curl-config 24954e2b0658SPaolo Bonzini fi 2496769ce76dSAlexander Graf cat > $TMPC << EOF 2497769ce76dSAlexander Graf#include <curl/curl.h> 24980b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 2499769ce76dSAlexander GrafEOF 25004e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 25014e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 2502b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 2503769ce76dSAlexander Graf curl=yes 2504788c8196SJuan Quintela else 2505788c8196SJuan Quintela if test "$curl" = "yes" ; then 250621684af0SStewart Smith feature_not_found "curl" "Install libcurl devel" 2507788c8196SJuan Quintela fi 2508788c8196SJuan Quintela curl=no 2509769ce76dSAlexander Graf fi 2510769ce76dSAlexander Graffi # test "$curl" 2511769ce76dSAlexander Graf 2512769ce76dSAlexander Graf########################################## 2513fb599c9aSbalrog# bluez support probe 2514a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 2515e820e3f4Sbalrog cat > $TMPC << EOF 2516e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 2517e820e3f4Sbalrogint main(void) { return bt_error(0); } 2518e820e3f4SbalrogEOF 2519a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 2520a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 252152166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 2522a20a6f46SJuan Quintela bluez=yes 2523e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 2524e820e3f4Sbalrog else 2525a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 252621684af0SStewart Smith feature_not_found "bluez" "Install bluez-libs/libbluetooth devel" 2527a20a6f46SJuan Quintela fi 2528e820e3f4Sbalrog bluez="no" 2529e820e3f4Sbalrog fi 2530fb599c9aSbalrogfi 2531fb599c9aSbalrog 2532fb599c9aSbalrog########################################## 2533e18df141SAnthony Liguori# glib support probe 2534a52d28afSPaolo Bonzini 2535a52d28afSPaolo Bonziniif test "$mingw32" = yes; then 2536a52d28afSPaolo Bonzini # g_poll is required in order to integrate with the glib main loop. 2537a52d28afSPaolo Bonzini glib_req_ver=2.20 2538a52d28afSPaolo Bonzinielse 2539a52d28afSPaolo Bonzini glib_req_ver=2.12 2540a52d28afSPaolo Bonzinifi 2541aa0d1f44SPaolo Bonziniglib_modules=gthread-2.0 2542aa0d1f44SPaolo Bonziniif test "$modules" = yes; then 2543aa0d1f44SPaolo Bonzini glib_modules="$glib_modules gmodule-2.0" 2544aa0d1f44SPaolo Bonzinifi 2545e26110cfSFam Zheng 2546aa0d1f44SPaolo Bonzinifor i in $glib_modules; do 2547e26110cfSFam Zheng if $pkg_config --atleast-version=$glib_req_ver $i; then 2548e26110cfSFam Zheng glib_cflags=`$pkg_config --cflags $i` 2549e26110cfSFam Zheng glib_libs=`$pkg_config --libs $i` 2550ba1183daSFam Zheng CFLAGS="$glib_cflags $CFLAGS" 255114015304SAnthony Liguori LIBS="$glib_libs $LIBS" 2552957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 2553e18df141SAnthony Liguori else 2554e26110cfSFam Zheng error_exit "glib-$glib_req_ver $i is required to compile QEMU" 2555e26110cfSFam Zheng fi 2556e26110cfSFam Zhengdone 2557e26110cfSFam Zheng 2558e26110cfSFam Zheng########################################## 2559e26110cfSFam Zheng# SHA command probe for modules 2560e26110cfSFam Zhengif test "$modules" = yes; then 2561e26110cfSFam Zheng shacmd_probe="sha1sum sha1 shasum" 2562e26110cfSFam Zheng for c in $shacmd_probe; do 2563e26110cfSFam Zheng if which $c &>/dev/null; then 2564e26110cfSFam Zheng shacmd="$c" 2565e26110cfSFam Zheng break 2566e26110cfSFam Zheng fi 2567e26110cfSFam Zheng done 2568e26110cfSFam Zheng if test "$shacmd" = ""; then 2569e26110cfSFam Zheng error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" 2570e26110cfSFam Zheng fi 2571e18df141SAnthony Liguorifi 2572e18df141SAnthony Liguori 2573e18df141SAnthony Liguori########################################## 2574e2134eb9SGerd Hoffmann# pixman support probe 2575e2134eb9SGerd Hoffmann 2576e2134eb9SGerd Hoffmannif test "$pixman" = ""; then 257774880fe2SRobert Schiele if test "$want_tools" = "no" -a "$softmmu" = "no"; then 257874880fe2SRobert Schiele pixman="none" 257974880fe2SRobert Schiele elif $pkg_config pixman-1 > /dev/null 2>&1; then 2580e2134eb9SGerd Hoffmann pixman="system" 2581e2134eb9SGerd Hoffmann else 2582e2134eb9SGerd Hoffmann pixman="internal" 2583e2134eb9SGerd Hoffmann fi 2584e2134eb9SGerd Hoffmannfi 258574880fe2SRobert Schieleif test "$pixman" = "none"; then 258674880fe2SRobert Schiele if test "$want_tools" != "no" -o "$softmmu" != "no"; then 258776ad07a4SPeter Maydell error_exit "pixman disabled but system emulation or tools build" \ 258876ad07a4SPeter Maydell "enabled. You can turn off pixman only if you also" \ 258976ad07a4SPeter Maydell "disable all system emulation targets and the tools" \ 259076ad07a4SPeter Maydell "build with '--disable-tools --disable-system'." 259174880fe2SRobert Schiele fi 259274880fe2SRobert Schiele pixman_cflags= 259374880fe2SRobert Schiele pixman_libs= 259474880fe2SRobert Schieleelif test "$pixman" = "system"; then 2595ca871ec8SStefan Weil pixman_cflags=`$pkg_config --cflags pixman-1` 2596ca871ec8SStefan Weil pixman_libs=`$pkg_config --libs pixman-1` 2597e2134eb9SGerd Hoffmannelse 2598e2134eb9SGerd Hoffmann if test ! -d ${source_path}/pixman/pixman; then 259976ad07a4SPeter Maydell error_exit "pixman not present. Your options:" \ 260076ad07a4SPeter Maydell " (1) Preferred: Install the pixman devel package (any recent" \ 260176ad07a4SPeter Maydell " distro should have packages as Xorg needs pixman too)." \ 260276ad07a4SPeter Maydell " (2) Fetch the pixman submodule, using:" \ 260376ad07a4SPeter Maydell " git submodule update --init pixman" 2604e2134eb9SGerd Hoffmann fi 26055ca9388aSGerd Hoffmann mkdir -p pixman/pixman 26065ca9388aSGerd Hoffmann pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman" 26075ca9388aSGerd Hoffmann pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1" 2608e2134eb9SGerd Hoffmannfi 2609e2134eb9SGerd Hoffmann 2610e2134eb9SGerd Hoffmann########################################## 261117bff52bSM. Mohan Kumar# libcap probe 261217bff52bSM. Mohan Kumar 261317bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 261417bff52bSM. Mohan Kumar cat > $TMPC <<EOF 261517bff52bSM. Mohan Kumar#include <stdio.h> 261617bff52bSM. Mohan Kumar#include <sys/capability.h> 2617cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 261817bff52bSM. Mohan KumarEOF 261917bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 262017bff52bSM. Mohan Kumar cap=yes 262117bff52bSM. Mohan Kumar else 262217bff52bSM. Mohan Kumar cap=no 262317bff52bSM. Mohan Kumar fi 262417bff52bSM. Mohan Kumarfi 262517bff52bSM. Mohan Kumar 262617bff52bSM. Mohan Kumar########################################## 2627e5d355d1Saliguori# pthread probe 26284b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 26293c529d93Saliguori 2630e5d355d1Saliguoripthread=no 2631414f0dabSblueswir1cat > $TMPC << EOF 26323c529d93Saliguori#include <pthread.h> 26337a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 26347a42bbe4SStefan Weilint main(void) { 26357a42bbe4SStefan Weil pthread_t thread; 26367a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 26377a42bbe4SStefan Weil return 0; 26387a42bbe4SStefan Weil} 2639414f0dabSblueswir1EOF 2640bd00d539SAndreas Färberif compile_prog "" "" ; then 2641bd00d539SAndreas Färber pthread=yes 2642bd00d539SAndreas Färberelse 2643de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 264452166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 2645e5d355d1Saliguori pthread=yes 2646e3c56761SPeter Portante found=no 2647e3c56761SPeter Portante for lib_entry in $LIBS; do 2648e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 2649e3c56761SPeter Portante found=yes 2650e3c56761SPeter Portante break 2651e3c56761SPeter Portante fi 2652e3c56761SPeter Portante done 2653e3c56761SPeter Portante if test "$found" = "no"; then 26545572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 2655e3c56761SPeter Portante fi 2656de65fe0fSSebastian Herbszt break 2657414f0dabSblueswir1 fi 2658de65fe0fSSebastian Herbszt done 2659bd00d539SAndreas Färberfi 2660414f0dabSblueswir1 26614617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 266276ad07a4SPeter Maydell error_exit "pthread check failed" \ 266376ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 2664e5d355d1Saliguorifi 2665e5d355d1Saliguori 2666bf9298b9Saliguori########################################## 2667f27aaf4bSChristian Brunner# rbd probe 2668f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2669f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2670f27aaf4bSChristian Brunner#include <stdio.h> 2671ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2672f27aaf4bSChristian Brunnerint main(void) { 2673ad32e9c0SJosh Durgin rados_t cluster; 2674ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2675f27aaf4bSChristian Brunner return 0; 2676f27aaf4bSChristian Brunner} 2677f27aaf4bSChristian BrunnerEOF 2678ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2679f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2680f27aaf4bSChristian Brunner rbd=yes 2681f27aaf4bSChristian Brunner else 2682f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 268321684af0SStewart Smith feature_not_found "rados block device" "Install librbd/ceph devel" 2684f27aaf4bSChristian Brunner fi 2685f27aaf4bSChristian Brunner rbd=no 2686f27aaf4bSChristian Brunner fi 2687f27aaf4bSChristian Brunnerfi 2688f27aaf4bSChristian Brunner 2689f27aaf4bSChristian Brunner########################################## 26900a12ec87SRichard W.M. Jones# libssh2 probe 26914fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8 26920a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then 269365d5d3f9SStefan Weil if $pkg_config --atleast-version=$min_libssh2_version libssh2; then 26940a12ec87SRichard W.M. Jones libssh2_cflags=`$pkg_config libssh2 --cflags` 26950a12ec87SRichard W.M. Jones libssh2_libs=`$pkg_config libssh2 --libs` 26960a12ec87SRichard W.M. Jones libssh2=yes 26970a12ec87SRichard W.M. Jones else 26980a12ec87SRichard W.M. Jones if test "$libssh2" = "yes" ; then 26994fc16838SRichard W.M. Jones error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" 27000a12ec87SRichard W.M. Jones fi 27010a12ec87SRichard W.M. Jones libssh2=no 27020a12ec87SRichard W.M. Jones fi 27030a12ec87SRichard W.M. Jonesfi 27040a12ec87SRichard W.M. Jones 27050a12ec87SRichard W.M. Jones########################################## 27069a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe 27079a2d462eSRichard W.M. Jones 27089a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then 27099a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 27109a2d462eSRichard W.M. Jones#include <stdio.h> 27119a2d462eSRichard W.M. Jones#include <libssh2.h> 27129a2d462eSRichard W.M. Jones#include <libssh2_sftp.h> 27139a2d462eSRichard W.M. Jonesint main(void) { 27149a2d462eSRichard W.M. Jones LIBSSH2_SESSION *session; 27159a2d462eSRichard W.M. Jones LIBSSH2_SFTP *sftp; 27169a2d462eSRichard W.M. Jones LIBSSH2_SFTP_HANDLE *sftp_handle; 27179a2d462eSRichard W.M. Jones session = libssh2_session_init (); 27189a2d462eSRichard W.M. Jones sftp = libssh2_sftp_init (session); 27199a2d462eSRichard W.M. Jones sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); 27209a2d462eSRichard W.M. Jones libssh2_sftp_fsync (sftp_handle); 27219a2d462eSRichard W.M. Jones return 0; 27229a2d462eSRichard W.M. Jones} 27239a2d462eSRichard W.M. JonesEOF 27249a2d462eSRichard W.M. Jones # libssh2_cflags/libssh2_libs defined in previous test. 27259a2d462eSRichard W.M. Jones if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then 27269a2d462eSRichard W.M. Jones QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" 27279a2d462eSRichard W.M. Jones fi 27289a2d462eSRichard W.M. Jonesfi 27299a2d462eSRichard W.M. Jones 27309a2d462eSRichard W.M. Jones########################################## 27315c6c3a6cSChristoph Hellwig# linux-aio probe 27325c6c3a6cSChristoph Hellwig 27335c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 27345c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 27355c6c3a6cSChristoph Hellwig#include <libaio.h> 27365c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2737832ce9c2SScott Wood#include <stddef.h> 27385c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 27395c6c3a6cSChristoph HellwigEOF 27405c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 27415c6c3a6cSChristoph Hellwig linux_aio=yes 27425c6c3a6cSChristoph Hellwig else 27435c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 274421684af0SStewart Smith feature_not_found "linux AIO" "Install libaio devel" 27455c6c3a6cSChristoph Hellwig fi 27463cfcae3cSLuiz Capitulino linux_aio=no 27475c6c3a6cSChristoph Hellwig fi 27485c6c3a6cSChristoph Hellwigfi 27495c6c3a6cSChristoph Hellwig 27505c6c3a6cSChristoph Hellwig########################################## 27513b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux 27523b8acc11SPaolo Bonzini 27533b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then 27543b8acc11SPaolo Bonzini tpm_passthrough=$tpm 27553b8acc11SPaolo Bonzinielse 27563b8acc11SPaolo Bonzini tpm_passthrough=no 27573b8acc11SPaolo Bonzinifi 27583b8acc11SPaolo Bonzini 27593b8acc11SPaolo Bonzini########################################## 2760583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio 2761583f6e7bSStefan Hajnoczi 2762583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \ 2763583f6e7bSStefan Hajnoczi "$linux_aio" != "yes" ; then 276476ad07a4SPeter Maydell error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio" 2765583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then 2766583f6e7bSStefan Hajnoczi virtio_blk_data_plane=$linux_aio 2767583f6e7bSStefan Hajnoczifi 2768583f6e7bSStefan Hajnoczi 2769583f6e7bSStefan Hajnoczi########################################## 2770758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2771758e8e38SVenkateswararao Jujjuri (JV) 2772758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2773758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2774758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2775758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2776f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2777f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2778f2338fb4SPavel Borzenkov#else 27794f26f2b6SAvi Kivity#include <sys/xattr.h> 2780f2338fb4SPavel Borzenkov#endif 2781758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2782758e8e38SVenkateswararao Jujjuri (JV)EOF 27834f26f2b6SAvi Kivity if compile_prog "" "" ; then 27844f26f2b6SAvi Kivity attr=yes 27854f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2786f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2787758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2788758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 27894f26f2b6SAvi Kivity libattr=yes 2790758e8e38SVenkateswararao Jujjuri (JV) else 2791758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 279221684af0SStewart Smith feature_not_found "ATTR" "Install libc6 or libattr devel" 2793758e8e38SVenkateswararao Jujjuri (JV) fi 2794758e8e38SVenkateswararao Jujjuri (JV) attr=no 2795758e8e38SVenkateswararao Jujjuri (JV) fi 2796758e8e38SVenkateswararao Jujjuri (JV)fi 2797758e8e38SVenkateswararao Jujjuri (JV) 2798758e8e38SVenkateswararao Jujjuri (JV)########################################## 2799bf9298b9Saliguori# iovec probe 2800bf9298b9Saliguoricat > $TMPC <<EOF 2801db34f0b3Sblueswir1#include <sys/types.h> 2802bf9298b9Saliguori#include <sys/uio.h> 2803db34f0b3Sblueswir1#include <unistd.h> 2804f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2805bf9298b9SaliguoriEOF 2806bf9298b9Saliguoriiovec=no 280752166aa0SJuan Quintelaif compile_prog "" "" ; then 2808bf9298b9Saliguori iovec=yes 2809bf9298b9Saliguorifi 2810bf9298b9Saliguori 2811f652e6afSaurel32########################################## 2812ceb42de8Saliguori# preadv probe 2813ceb42de8Saliguoricat > $TMPC <<EOF 2814ceb42de8Saliguori#include <sys/types.h> 2815ceb42de8Saliguori#include <sys/uio.h> 2816ceb42de8Saliguori#include <unistd.h> 2817c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 2818ceb42de8SaliguoriEOF 2819ceb42de8Saliguoripreadv=no 282052166aa0SJuan Quintelaif compile_prog "" "" ; then 2821ceb42de8Saliguori preadv=yes 2822ceb42de8Saliguorifi 2823ceb42de8Saliguori 2824ceb42de8Saliguori########################################## 2825f652e6afSaurel32# fdt probe 2826e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 2827e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 2828e169e1e1SPeter Maydellfdt_required=no 2829e169e1e1SPeter Maydellfor target in $target_list; do 2830e169e1e1SPeter Maydell case $target in 28316a49fa95SAlexander Graf aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu) 2832e169e1e1SPeter Maydell fdt_required=yes 2833e169e1e1SPeter Maydell ;; 2834e169e1e1SPeter Maydell esac 2835e169e1e1SPeter Maydelldone 2836e169e1e1SPeter Maydell 2837e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 2838e169e1e1SPeter Maydell if test "$fdt" = "no"; then 2839e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 2840e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 2841e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 2842e169e1e1SPeter Maydell fi 2843e169e1e1SPeter Maydell fdt=yes 2844e169e1e1SPeter Maydellfi 2845e169e1e1SPeter Maydell 28462df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2847b41af4baSJuan Quintela fdt_libs="-lfdt" 284896ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 2849f652e6afSaurel32 cat > $TMPC << EOF 285096ce6545SPeter Crosthwaite#include <libfdt_env.h> 2851f652e6afSaurel32int main(void) { return 0; } 2852f652e6afSaurel32EOF 285352166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2854a540f158SPeter Crosthwaite # system DTC is good - use it 2855f652e6afSaurel32 fdt=yes 2856a540f158SPeter Crosthwaite elif test -d ${source_path}/dtc/libfdt ; then 2857a540f158SPeter Crosthwaite # have submodule DTC - use it 2858a540f158SPeter Crosthwaite fdt=yes 2859a540f158SPeter Crosthwaite dtc_internal="yes" 2860a540f158SPeter Crosthwaite mkdir -p dtc 2861a540f158SPeter Crosthwaite if [ "$source_path" != `pwd` ] ; then 2862a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 2863a540f158SPeter Crosthwaite symlink "$source_path/dtc/scripts" "dtc/scripts" 28642df87df7SJuan Quintela fi 2865a540f158SPeter Crosthwaite fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 2866a540f158SPeter Crosthwaite fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" 2867a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 2868a540f158SPeter Crosthwaite # have neither and want - prompt for system/submodule install 28693f281822SStewart Smith error_exit "DTC (libfdt) not present. Your options:" \ 28703f281822SStewart Smith " (1) Preferred: Install the DTC (libfdt) devel package" \ 2871a540f158SPeter Crosthwaite " (2) Fetch the DTC submodule, using:" \ 2872a540f158SPeter Crosthwaite " git submodule update --init dtc" 2873a540f158SPeter Crosthwaite else 2874a540f158SPeter Crosthwaite # don't have and don't want 2875de3a354aSMichael Walle fdt_libs= 28762df87df7SJuan Quintela fdt=no 2877f652e6afSaurel32 fi 2878f652e6afSaurel32fi 2879f652e6afSaurel32 2880a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 2881a540f158SPeter Crosthwaite 288220ff075bSMichael Walle########################################## 2883b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2 2884b1e5fff4SMichael Walleif test "$glx" != "no" ; then 2885b1e5fff4SMichael Walle glx_libs="-lGL -lX11" 288620ff075bSMichael Walle cat > $TMPC << EOF 288720ff075bSMichael Walle#include <X11/Xlib.h> 288820ff075bSMichael Walle#include <GL/gl.h> 288920ff075bSMichael Walle#include <GL/glx.h> 2890d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; } 289120ff075bSMichael WalleEOF 2892d3fcbb16SMichael Walle if compile_prog "" "-lGL -lX11" ; then 2893b1e5fff4SMichael Walle glx=yes 289420ff075bSMichael Walle else 2895b1e5fff4SMichael Walle if test "$glx" = "yes" ; then 289621684af0SStewart Smith feature_not_found "glx" "Install GL devel (e.g. MESA)" 289720ff075bSMichael Walle fi 2898b1e5fff4SMichael Walle glx_libs= 2899b1e5fff4SMichael Walle glx=no 290020ff075bSMichael Walle fi 290120ff075bSMichael Wallefi 290220ff075bSMichael Walle 2903eb100396SBharata B Rao########################################## 2904eb100396SBharata B Rao# glusterfs probe 2905eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 290665d5d3f9SStefan Weil if $pkg_config --atleast-version=3 glusterfs-api; then 2907e01bee08SBharata B Rao glusterfs="yes" 2908ca871ec8SStefan Weil glusterfs_cflags=`$pkg_config --cflags glusterfs-api` 2909ca871ec8SStefan Weil glusterfs_libs=`$pkg_config --libs glusterfs-api` 291065d5d3f9SStefan Weil if $pkg_config --atleast-version=5 glusterfs-api; then 29110c14fb47SBharata B Rao glusterfs_discard="yes" 29120c14fb47SBharata B Rao fi 29137c815372SBharata B Rao if $pkg_config --atleast-version=6 glusterfs-api; then 29147c815372SBharata B Rao glusterfs_zerofill="yes" 29157c815372SBharata B Rao fi 2916eb100396SBharata B Rao else 2917eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 291821684af0SStewart Smith feature_not_found "GlusterFS backend support" "Install glusterfs-api devel" 2919eb100396SBharata B Rao fi 2920e01bee08SBharata B Rao glusterfs="no" 2921eb100396SBharata B Rao fi 2922eb100396SBharata B Raofi 2923eb100396SBharata B Rao 292439386ac7Saurel32# Check for inotify functions when we are building linux-user 29253b3f24adSaurel32# emulator. This is done because older glibc versions don't 29263b3f24adSaurel32# have syscall stubs for these implemented. In that case we 29273b3f24adSaurel32# don't provide them even if kernel supports them. 29283b3f24adSaurel32# 29293b3f24adSaurel32inotify=no 29303b3f24adSaurel32cat > $TMPC << EOF 29313b3f24adSaurel32#include <sys/inotify.h> 29323b3f24adSaurel32 29333b3f24adSaurel32int 29343b3f24adSaurel32main(void) 29353b3f24adSaurel32{ 29363b3f24adSaurel32 /* try to start inotify */ 29378690e420Saurel32 return inotify_init(); 29383b3f24adSaurel32} 29393b3f24adSaurel32EOF 294052166aa0SJuan Quintelaif compile_prog "" "" ; then 29413b3f24adSaurel32 inotify=yes 29423b3f24adSaurel32fi 29433b3f24adSaurel32 2944c05c7a73SRiku Voipioinotify1=no 2945c05c7a73SRiku Voipiocat > $TMPC << EOF 2946c05c7a73SRiku Voipio#include <sys/inotify.h> 2947c05c7a73SRiku Voipio 2948c05c7a73SRiku Voipioint 2949c05c7a73SRiku Voipiomain(void) 2950c05c7a73SRiku Voipio{ 2951c05c7a73SRiku Voipio /* try to start inotify */ 2952c05c7a73SRiku Voipio return inotify_init1(0); 2953c05c7a73SRiku Voipio} 2954c05c7a73SRiku VoipioEOF 2955c05c7a73SRiku Voipioif compile_prog "" "" ; then 2956c05c7a73SRiku Voipio inotify1=yes 2957c05c7a73SRiku Voipiofi 2958c05c7a73SRiku Voipio 2959ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2960ebc996f3SRiku Voipioutimens=no 2961ebc996f3SRiku Voipiocat > $TMPC << EOF 2962ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2963ebc996f3SRiku Voipio#include <stddef.h> 2964ebc996f3SRiku Voipio#include <fcntl.h> 29653014ee00SPeter Maydell#include <sys/stat.h> 2966ebc996f3SRiku Voipio 2967ebc996f3SRiku Voipioint main(void) 2968ebc996f3SRiku Voipio{ 2969ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2970ebc996f3SRiku Voipio futimens(0, NULL); 2971ebc996f3SRiku Voipio return 0; 2972ebc996f3SRiku Voipio} 2973ebc996f3SRiku VoipioEOF 297452166aa0SJuan Quintelaif compile_prog "" "" ; then 2975ebc996f3SRiku Voipio utimens=yes 2976ebc996f3SRiku Voipiofi 2977ebc996f3SRiku Voipio 2978099d6b0fSRiku Voipio# check if pipe2 is there 2979099d6b0fSRiku Voipiopipe2=no 2980099d6b0fSRiku Voipiocat > $TMPC << EOF 2981099d6b0fSRiku Voipio#include <unistd.h> 2982099d6b0fSRiku Voipio#include <fcntl.h> 2983099d6b0fSRiku Voipio 2984099d6b0fSRiku Voipioint main(void) 2985099d6b0fSRiku Voipio{ 2986099d6b0fSRiku Voipio int pipefd[2]; 29879bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 2988099d6b0fSRiku Voipio} 2989099d6b0fSRiku VoipioEOF 299052166aa0SJuan Quintelaif compile_prog "" "" ; then 2991099d6b0fSRiku Voipio pipe2=yes 2992099d6b0fSRiku Voipiofi 2993099d6b0fSRiku Voipio 299440ff6d7eSKevin Wolf# check if accept4 is there 299540ff6d7eSKevin Wolfaccept4=no 299640ff6d7eSKevin Wolfcat > $TMPC << EOF 299740ff6d7eSKevin Wolf#include <sys/socket.h> 299840ff6d7eSKevin Wolf#include <stddef.h> 299940ff6d7eSKevin Wolf 300040ff6d7eSKevin Wolfint main(void) 300140ff6d7eSKevin Wolf{ 300240ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 300340ff6d7eSKevin Wolf return 0; 300440ff6d7eSKevin Wolf} 300540ff6d7eSKevin WolfEOF 300640ff6d7eSKevin Wolfif compile_prog "" "" ; then 300740ff6d7eSKevin Wolf accept4=yes 300840ff6d7eSKevin Wolffi 300940ff6d7eSKevin Wolf 30103ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 30113ce34dfbSvibisreenivasansplice=no 30123ce34dfbSvibisreenivasancat > $TMPC << EOF 30133ce34dfbSvibisreenivasan#include <unistd.h> 30143ce34dfbSvibisreenivasan#include <fcntl.h> 30153ce34dfbSvibisreenivasan#include <limits.h> 30163ce34dfbSvibisreenivasan 30173ce34dfbSvibisreenivasanint main(void) 30183ce34dfbSvibisreenivasan{ 301966ea0f22SStefan Weil int len, fd = 0; 30203ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 30213ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 30223ce34dfbSvibisreenivasan return 0; 30233ce34dfbSvibisreenivasan} 30243ce34dfbSvibisreenivasanEOF 302552166aa0SJuan Quintelaif compile_prog "" "" ; then 30263ce34dfbSvibisreenivasan splice=yes 30273ce34dfbSvibisreenivasanfi 30283ce34dfbSvibisreenivasan 3029dcc38d1cSMarcelo Tosatti########################################## 3030dcc38d1cSMarcelo Tosatti# signalfd probe 3031dcc38d1cSMarcelo Tosattisignalfd="no" 3032dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 3033dcc38d1cSMarcelo Tosatti#include <unistd.h> 3034dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 3035dcc38d1cSMarcelo Tosatti#include <signal.h> 3036dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 3037dcc38d1cSMarcelo TosattiEOF 3038dcc38d1cSMarcelo Tosatti 3039dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 3040dcc38d1cSMarcelo Tosatti signalfd=yes 3041dcc38d1cSMarcelo Tosattifi 3042dcc38d1cSMarcelo Tosatti 3043c2882b96SRiku Voipio# check if eventfd is supported 3044c2882b96SRiku Voipioeventfd=no 3045c2882b96SRiku Voipiocat > $TMPC << EOF 3046c2882b96SRiku Voipio#include <sys/eventfd.h> 3047c2882b96SRiku Voipio 3048c2882b96SRiku Voipioint main(void) 3049c2882b96SRiku Voipio{ 305055cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 3051c2882b96SRiku Voipio} 3052c2882b96SRiku VoipioEOF 3053c2882b96SRiku Voipioif compile_prog "" "" ; then 3054c2882b96SRiku Voipio eventfd=yes 3055c2882b96SRiku Voipiofi 3056c2882b96SRiku Voipio 3057d0927938SUlrich Hecht# check for fallocate 3058d0927938SUlrich Hechtfallocate=no 3059d0927938SUlrich Hechtcat > $TMPC << EOF 3060d0927938SUlrich Hecht#include <fcntl.h> 3061d0927938SUlrich Hecht 3062d0927938SUlrich Hechtint main(void) 3063d0927938SUlrich Hecht{ 3064d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 3065d0927938SUlrich Hecht return 0; 3066d0927938SUlrich Hecht} 3067d0927938SUlrich HechtEOF 30688fb03151SPeter Maydellif compile_prog "" "" ; then 3069d0927938SUlrich Hecht fallocate=yes 3070d0927938SUlrich Hechtfi 3071d0927938SUlrich Hecht 30723d4fa43eSKusanagi Kouichi# check for fallocate hole punching 30733d4fa43eSKusanagi Kouichifallocate_punch_hole=no 30743d4fa43eSKusanagi Kouichicat > $TMPC << EOF 30753d4fa43eSKusanagi Kouichi#include <fcntl.h> 30763d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 30773d4fa43eSKusanagi Kouichi 30783d4fa43eSKusanagi Kouichiint main(void) 30793d4fa43eSKusanagi Kouichi{ 30803d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 30813d4fa43eSKusanagi Kouichi return 0; 30823d4fa43eSKusanagi Kouichi} 30833d4fa43eSKusanagi KouichiEOF 30843d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 30853d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 30863d4fa43eSKusanagi Kouichifi 30873d4fa43eSKusanagi Kouichi 3088c727f47dSPeter Maydell# check for sync_file_range 3089c727f47dSPeter Maydellsync_file_range=no 3090c727f47dSPeter Maydellcat > $TMPC << EOF 3091c727f47dSPeter Maydell#include <fcntl.h> 3092c727f47dSPeter Maydell 3093c727f47dSPeter Maydellint main(void) 3094c727f47dSPeter Maydell{ 3095c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 3096c727f47dSPeter Maydell return 0; 3097c727f47dSPeter Maydell} 3098c727f47dSPeter MaydellEOF 30998fb03151SPeter Maydellif compile_prog "" "" ; then 3100c727f47dSPeter Maydell sync_file_range=yes 3101c727f47dSPeter Maydellfi 3102c727f47dSPeter Maydell 3103dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 3104dace20dcSPeter Maydellfiemap=no 3105dace20dcSPeter Maydellcat > $TMPC << EOF 3106dace20dcSPeter Maydell#include <sys/ioctl.h> 3107dace20dcSPeter Maydell#include <linux/fs.h> 3108dace20dcSPeter Maydell#include <linux/fiemap.h> 3109dace20dcSPeter Maydell 3110dace20dcSPeter Maydellint main(void) 3111dace20dcSPeter Maydell{ 3112dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 3113dace20dcSPeter Maydell return 0; 3114dace20dcSPeter Maydell} 3115dace20dcSPeter MaydellEOF 31168fb03151SPeter Maydellif compile_prog "" "" ; then 3117dace20dcSPeter Maydell fiemap=yes 3118dace20dcSPeter Maydellfi 3119dace20dcSPeter Maydell 3120d0927938SUlrich Hecht# check for dup3 3121d0927938SUlrich Hechtdup3=no 3122d0927938SUlrich Hechtcat > $TMPC << EOF 3123d0927938SUlrich Hecht#include <unistd.h> 3124d0927938SUlrich Hecht 3125d0927938SUlrich Hechtint main(void) 3126d0927938SUlrich Hecht{ 3127d0927938SUlrich Hecht dup3(0, 0, 0); 3128d0927938SUlrich Hecht return 0; 3129d0927938SUlrich Hecht} 3130d0927938SUlrich HechtEOF 313178f5d726SJan Kiszkaif compile_prog "" "" ; then 3132d0927938SUlrich Hecht dup3=yes 3133d0927938SUlrich Hechtfi 3134d0927938SUlrich Hecht 31354e0c6529SAlex Bligh# check for ppoll support 31364e0c6529SAlex Blighppoll=no 31374e0c6529SAlex Blighcat > $TMPC << EOF 31384e0c6529SAlex Bligh#include <poll.h> 31394e0c6529SAlex Bligh 31404e0c6529SAlex Blighint main(void) 31414e0c6529SAlex Bligh{ 31424e0c6529SAlex Bligh struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 }; 31434e0c6529SAlex Bligh ppoll(&pfd, 1, 0, 0); 31444e0c6529SAlex Bligh return 0; 31454e0c6529SAlex Bligh} 31464e0c6529SAlex BlighEOF 31474e0c6529SAlex Blighif compile_prog "" "" ; then 31484e0c6529SAlex Bligh ppoll=yes 31494e0c6529SAlex Blighfi 31504e0c6529SAlex Bligh 3151cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support 3152cd758dd0SAlex Blighprctl_pr_set_timerslack=no 3153cd758dd0SAlex Blighcat > $TMPC << EOF 3154cd758dd0SAlex Bligh#include <sys/prctl.h> 3155cd758dd0SAlex Bligh 3156cd758dd0SAlex Blighint main(void) 3157cd758dd0SAlex Bligh{ 3158cd758dd0SAlex Bligh prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); 3159cd758dd0SAlex Bligh return 0; 3160cd758dd0SAlex Bligh} 3161cd758dd0SAlex BlighEOF 3162cd758dd0SAlex Blighif compile_prog "" "" ; then 3163cd758dd0SAlex Bligh prctl_pr_set_timerslack=yes 3164cd758dd0SAlex Blighfi 3165cd758dd0SAlex Bligh 31663b6edd16SPeter Maydell# check for epoll support 31673b6edd16SPeter Maydellepoll=no 31683b6edd16SPeter Maydellcat > $TMPC << EOF 31693b6edd16SPeter Maydell#include <sys/epoll.h> 31703b6edd16SPeter Maydell 31713b6edd16SPeter Maydellint main(void) 31723b6edd16SPeter Maydell{ 31733b6edd16SPeter Maydell epoll_create(0); 31743b6edd16SPeter Maydell return 0; 31753b6edd16SPeter Maydell} 31763b6edd16SPeter MaydellEOF 31778fb03151SPeter Maydellif compile_prog "" "" ; then 31783b6edd16SPeter Maydell epoll=yes 31793b6edd16SPeter Maydellfi 31803b6edd16SPeter Maydell 31813b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 31823b6edd16SPeter Maydell# so we must check separately for their presence 31833b6edd16SPeter Maydellepoll_create1=no 31843b6edd16SPeter Maydellcat > $TMPC << EOF 31853b6edd16SPeter Maydell#include <sys/epoll.h> 31863b6edd16SPeter Maydell 31873b6edd16SPeter Maydellint main(void) 31883b6edd16SPeter Maydell{ 318919e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 319019e83f6bSPeter Maydell * a function being called. This is necessary so that on 319119e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 319219e83f6bSPeter Maydell * the library but not declared in the header file we will 319319e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 319419e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 319519e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 319619e83f6bSPeter Maydell */ 3197c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 31983b6edd16SPeter Maydell} 31993b6edd16SPeter MaydellEOF 32008fb03151SPeter Maydellif compile_prog "" "" ; then 32013b6edd16SPeter Maydell epoll_create1=yes 32023b6edd16SPeter Maydellfi 32033b6edd16SPeter Maydell 32043b6edd16SPeter Maydellepoll_pwait=no 32053b6edd16SPeter Maydellcat > $TMPC << EOF 32063b6edd16SPeter Maydell#include <sys/epoll.h> 32073b6edd16SPeter Maydell 32083b6edd16SPeter Maydellint main(void) 32093b6edd16SPeter Maydell{ 32103b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 32113b6edd16SPeter Maydell return 0; 32123b6edd16SPeter Maydell} 32133b6edd16SPeter MaydellEOF 32148fb03151SPeter Maydellif compile_prog "" "" ; then 32153b6edd16SPeter Maydell epoll_pwait=yes 32163b6edd16SPeter Maydellfi 32173b6edd16SPeter Maydell 3218a8fd1abaSPeter Maydell# check for sendfile support 3219a8fd1abaSPeter Maydellsendfile=no 3220a8fd1abaSPeter Maydellcat > $TMPC << EOF 3221a8fd1abaSPeter Maydell#include <sys/sendfile.h> 3222a8fd1abaSPeter Maydell 3223a8fd1abaSPeter Maydellint main(void) 3224a8fd1abaSPeter Maydell{ 3225a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 3226a8fd1abaSPeter Maydell} 3227a8fd1abaSPeter MaydellEOF 3228a8fd1abaSPeter Maydellif compile_prog "" "" ; then 3229a8fd1abaSPeter Maydell sendfile=yes 3230a8fd1abaSPeter Maydellfi 3231a8fd1abaSPeter Maydell 3232cc8ae6deSpbrook# Check if tools are available to build documentation. 3233a25dba17SJuan Quintelaif test "$docs" != "no" ; then 323401668d98SStefan Weil if has makeinfo && has pod2man; then 3235a25dba17SJuan Quintela docs=yes 323683a3ab8bSJuan Quintela else 3237a25dba17SJuan Quintela if test "$docs" = "yes" ; then 323821684af0SStewart Smith feature_not_found "docs" "Install texinfo and Perl/perl-podlators" 323983a3ab8bSJuan Quintela fi 3240a25dba17SJuan Quintela docs=no 324183a3ab8bSJuan Quintela fi 3242cc8ae6deSpbrookfi 3243cc8ae6deSpbrook 3244f514f41cSStefan Weil# Search for bswap_32 function 32456ae9a1f4SJuan Quintelabyteswap_h=no 32466ae9a1f4SJuan Quintelacat > $TMPC << EOF 32476ae9a1f4SJuan Quintela#include <byteswap.h> 32486ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 32496ae9a1f4SJuan QuintelaEOF 325052166aa0SJuan Quintelaif compile_prog "" "" ; then 32516ae9a1f4SJuan Quintela byteswap_h=yes 32526ae9a1f4SJuan Quintelafi 32536ae9a1f4SJuan Quintela 325475f13596SStefan Weil# Search for bswap32 function 32556ae9a1f4SJuan Quintelabswap_h=no 32566ae9a1f4SJuan Quintelacat > $TMPC << EOF 32576ae9a1f4SJuan Quintela#include <sys/endian.h> 32586ae9a1f4SJuan Quintela#include <sys/types.h> 32596ae9a1f4SJuan Quintela#include <machine/bswap.h> 32606ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 32616ae9a1f4SJuan QuintelaEOF 326252166aa0SJuan Quintelaif compile_prog "" "" ; then 32636ae9a1f4SJuan Quintela bswap_h=yes 32646ae9a1f4SJuan Quintelafi 32656ae9a1f4SJuan Quintela 3266da93a1fdSaliguori########################################## 3267c589b249SRonnie Sahlberg# Do we have libiscsi 3268063c3378SPeter Lieven# We check for iscsi_write16_sync() to make sure we have a 3269063c3378SPeter Lieven# at least version 1.4.0 of libiscsi. 3270c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 3271c589b249SRonnie Sahlberg cat > $TMPC << EOF 3272fa6acb0cSRonnie Sahlberg#include <stdio.h> 3273c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 3274063c3378SPeter Lievenint main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; } 3275c589b249SRonnie SahlbergEOF 327665d5d3f9SStefan Weil if $pkg_config --atleast-version=1.7.0 libiscsi; then 32773c33ea96SPaolo Bonzini libiscsi="yes" 3278ca871ec8SStefan Weil libiscsi_cflags=$($pkg_config --cflags libiscsi) 3279ca871ec8SStefan Weil libiscsi_libs=$($pkg_config --libs libiscsi) 32803c33ea96SPaolo Bonzini elif compile_prog "" "-liscsi" ; then 3281c589b249SRonnie Sahlberg libiscsi="yes" 32826ebc91e5SFam Zheng libiscsi_libs="-liscsi" 3283c589b249SRonnie Sahlberg else 3284c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 328521684af0SStewart Smith feature_not_found "libiscsi" "Install libiscsi devel" 3286c589b249SRonnie Sahlberg fi 3287c589b249SRonnie Sahlberg libiscsi="no" 3288c589b249SRonnie Sahlberg fi 3289c589b249SRonnie Sahlbergfi 3290c589b249SRonnie Sahlberg 3291219c2521SStefan Weil# We also need to know the API version because there was an 3292219c2521SStefan Weil# API change from 1.4.0 to 1.5.0. 3293219c2521SStefan Weilif test "$libiscsi" = "yes"; then 3294219c2521SStefan Weil cat >$TMPC <<EOF 3295219c2521SStefan Weil#include <iscsi/iscsi.h> 3296219c2521SStefan Weilint main(void) 3297219c2521SStefan Weil{ 3298219c2521SStefan Weil iscsi_read10_task(0, 0, 0, 0, 0, 0, 0); 3299219c2521SStefan Weil return 0; 3300219c2521SStefan Weil} 3301219c2521SStefan WeilEOF 3302219c2521SStefan Weil if compile_prog "" "-liscsi"; then 3303219c2521SStefan Weil libiscsi_version="1.4.0" 3304219c2521SStefan Weil fi 3305219c2521SStefan Weilfi 3306c589b249SRonnie Sahlberg 3307c589b249SRonnie Sahlberg########################################## 33088bacde8dSNatanael Copa# Do we need libm 33098bacde8dSNatanael Copacat > $TMPC << EOF 33108bacde8dSNatanael Copa#include <math.h> 33118bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); } 33128bacde8dSNatanael CopaEOF 33138bacde8dSNatanael Copaif compile_prog "" "" ; then 33148bacde8dSNatanael Copa : 33158bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 33168bacde8dSNatanael Copa LIBS="-lm $LIBS" 33178bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 33188bacde8dSNatanael Copaelse 331976ad07a4SPeter Maydell error_exit "libm check failed" 33208bacde8dSNatanael Copafi 33218bacde8dSNatanael Copa 33228bacde8dSNatanael Copa########################################## 3323da93a1fdSaliguori# Do we need librt 33248bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 33258bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 33268bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 33278bacde8dSNatanael Copa# function in addition. 3328da93a1fdSaliguoricat > $TMPC <<EOF 3329da93a1fdSaliguori#include <signal.h> 3330da93a1fdSaliguori#include <time.h> 33318bacde8dSNatanael Copaint main(void) { 33328bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 33338bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 33348bacde8dSNatanael Copa} 3335da93a1fdSaliguoriEOF 3336da93a1fdSaliguori 333752166aa0SJuan Quintelaif compile_prog "" "" ; then 333807ffa4bdSJuan Quintela : 33398bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 33408bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then 334107ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 33428bacde8dSNatanael Copa libs_qga="-lrt $libs_qga" 3343da93a1fdSaliguorifi 3344da93a1fdSaliguori 334531ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 3346179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 33476362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 33486362a53fSJuan Quintelafi 33496362a53fSJuan Quintela 3350de5071c5SBlue Swirl########################################## 3351cd4ec0b4SGerd Hoffmann# spice probe 3352cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 3353cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 3354cd4ec0b4SGerd Hoffmann#include <spice.h> 3355cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 3356cd4ec0b4SGerd HoffmannEOF 3357710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 3358710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 335965d5d3f9SStefan Weil if $pkg_config --atleast-version=0.12.0 spice-server && \ 336065d5d3f9SStefan Weil $pkg_config --atleast-version=0.12.3 spice-protocol && \ 3361cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 3362cd4ec0b4SGerd Hoffmann spice="yes" 3363cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 3364cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 33652e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 33662e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 3367cd4ec0b4SGerd Hoffmann else 3368cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 336921684af0SStewart Smith feature_not_found "spice" "Install spice-server and spice-protocol devel" 3370cd4ec0b4SGerd Hoffmann fi 3371cd4ec0b4SGerd Hoffmann spice="no" 3372cd4ec0b4SGerd Hoffmann fi 3373cd4ec0b4SGerd Hoffmannfi 3374cd4ec0b4SGerd Hoffmann 3375111a38b0SRobert Relyea# check for libcacard for smartcard support 3376111a38b0SRobert Relyeasmartcard_cflags="" 3377111a38b0SRobert Relyea# TODO - what's the minimal nss version we support? 3378111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then 33795f01e06fSSergei Trofimovich cat > $TMPC << EOF 33805f01e06fSSergei Trofimovich#include <pk11pub.h> 33815f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; } 33825f01e06fSSergei TrofimovichEOF 33830b22ef0fSPeter Maydell smartcard_includes="-I\$(SRC_PATH)/libcacard" 33848c741c22SAlon Levy libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" 33858c741c22SAlon Levy libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" 33866ca026cbSPeter Maydell test_cflags="$libcacard_cflags" 33876ca026cbSPeter Maydell # The header files in nss < 3.13.3 have a bug which causes them to 33886ca026cbSPeter Maydell # emit a warning. If we're going to compile QEMU with -Werror, then 33896ca026cbSPeter Maydell # test that the headers don't have this bug. Otherwise we would pass 33906ca026cbSPeter Maydell # the configure test but fail to compile QEMU later. 33916ca026cbSPeter Maydell if test "$werror" = "yes"; then 33926ca026cbSPeter Maydell test_cflags="-Werror $test_cflags" 33936ca026cbSPeter Maydell fi 3394b6fc675bSPaolo Bonzini if test -n "$libtool" && 339565d5d3f9SStefan Weil $pkg_config --atleast-version=3.12.8 nss && \ 33966ca026cbSPeter Maydell compile_prog "$test_cflags" "$libcacard_libs"; then 33975f01e06fSSergei Trofimovich smartcard_nss="yes" 33980b22ef0fSPeter Maydell QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" 33990b22ef0fSPeter Maydell QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes" 3400ad4cf3f6SPaul Brook libs_softmmu="$libcacard_libs $libs_softmmu" 3401111a38b0SRobert Relyea else 3402111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 3403111a38b0SRobert Relyea feature_not_found "nss" 3404111a38b0SRobert Relyea fi 3405111a38b0SRobert Relyea smartcard_nss="no" 3406111a38b0SRobert Relyea fi 3407111a38b0SRobert Relyeafi 3408111a38b0SRobert Relyea 34092b2325ffSGerd Hoffmann# check for libusb 34102b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 341165d5d3f9SStefan Weil if $pkg_config --atleast-version=1.0.13 libusb-1.0; then 34122b2325ffSGerd Hoffmann libusb="yes" 3413ca871ec8SStefan Weil libusb_cflags=$($pkg_config --cflags libusb-1.0) 3414ca871ec8SStefan Weil libusb_libs=$($pkg_config --libs libusb-1.0) 34152b2325ffSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags" 34162b2325ffSGerd Hoffmann libs_softmmu="$libs_softmmu $libusb_libs" 34172b2325ffSGerd Hoffmann else 34182b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 341921684af0SStewart Smith feature_not_found "libusb" "Install libusb devel" 34202b2325ffSGerd Hoffmann fi 34212b2325ffSGerd Hoffmann libusb="no" 34222b2325ffSGerd Hoffmann fi 34232b2325ffSGerd Hoffmannfi 34242b2325ffSGerd Hoffmann 342569354a83SHans de Goede# check for usbredirparser for usb network redirection support 342669354a83SHans de Goedeif test "$usb_redir" != "no" ; then 342765d5d3f9SStefan Weil if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then 342869354a83SHans de Goede usb_redir="yes" 3429ca871ec8SStefan Weil usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) 3430ca871ec8SStefan Weil usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) 343169354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 343256ab2ad1SAurelien Jarno libs_softmmu="$libs_softmmu $usb_redir_libs" 343369354a83SHans de Goede else 343469354a83SHans de Goede if test "$usb_redir" = "yes"; then 343521684af0SStewart Smith feature_not_found "usb-redir" "Install usbredir devel" 343669354a83SHans de Goede fi 343769354a83SHans de Goede usb_redir="no" 343869354a83SHans de Goede fi 343969354a83SHans de Goedefi 344069354a83SHans de Goede 3441cd4ec0b4SGerd Hoffmann########################################## 3442d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win 3443d9840e25STomoki Sekiyama 3444d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then 3445d9840e25STomoki Sekiyama case "$vss_win32_sdk" in 3446d9840e25STomoki Sekiyama "") vss_win32_include="-I$source_path" ;; 3447d9840e25STomoki Sekiyama *\ *) # The SDK is installed in "Program Files" by default, but we cannot 3448d9840e25STomoki Sekiyama # handle path with spaces. So we symlink the headers into ".sdk/vss". 3449d9840e25STomoki Sekiyama vss_win32_include="-I$source_path/.sdk/vss" 3450d9840e25STomoki Sekiyama symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" 3451d9840e25STomoki Sekiyama ;; 3452d9840e25STomoki Sekiyama *) vss_win32_include="-I$vss_win32_sdk" 3453d9840e25STomoki Sekiyama esac 3454d9840e25STomoki Sekiyama cat > $TMPC << EOF 3455d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__ 3456d9840e25STomoki Sekiyama#include <inc/win2003/vss.h> 3457d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; } 3458d9840e25STomoki SekiyamaEOF 3459d9840e25STomoki Sekiyama if compile_prog "$vss_win32_include" "" ; then 3460d9840e25STomoki Sekiyama guest_agent_with_vss="yes" 3461d9840e25STomoki Sekiyama QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" 3462d9840e25STomoki Sekiyama libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" 3463d9840e25STomoki Sekiyama else 3464d9840e25STomoki Sekiyama if test "$vss_win32_sdk" != "" ; then 3465d9840e25STomoki Sekiyama echo "ERROR: Please download and install Microsoft VSS SDK:" 3466d9840e25STomoki Sekiyama echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" 3467d9840e25STomoki Sekiyama echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" 3468d9840e25STomoki Sekiyama echo "ERROR: scripts/extract-vsssdk-headers setup.exe" 3469d9840e25STomoki Sekiyama echo "ERROR: The headers are extracted in the directory \`inc'." 3470d9840e25STomoki Sekiyama feature_not_found "VSS support" 3471d9840e25STomoki Sekiyama fi 3472d9840e25STomoki Sekiyama guest_agent_with_vss="no" 3473d9840e25STomoki Sekiyama fi 3474d9840e25STomoki Sekiyamafi 3475d9840e25STomoki Sekiyama 3476d9840e25STomoki Sekiyama########################################## 3477d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified) 3478d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent 3479d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the 3480d9840e25STomoki Sekiyama# pre-compiled .tlb file is included. 3481d9840e25STomoki Sekiyama 3482d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then 3483d9840e25STomoki Sekiyama if test -z "$win_sdk"; then 3484d9840e25STomoki Sekiyama programfiles="$PROGRAMFILES" 3485d9840e25STomoki Sekiyama test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" 3486d9840e25STomoki Sekiyama if test -n "$programfiles"; then 3487d9840e25STomoki Sekiyama win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null 3488d9840e25STomoki Sekiyama else 3489d9840e25STomoki Sekiyama feature_not_found "Windows SDK" 3490d9840e25STomoki Sekiyama fi 3491d9840e25STomoki Sekiyama elif test "$win_sdk" = "no"; then 3492d9840e25STomoki Sekiyama win_sdk="" 3493d9840e25STomoki Sekiyama fi 3494d9840e25STomoki Sekiyamafi 3495d9840e25STomoki Sekiyama 3496d9840e25STomoki Sekiyama########################################## 3497cd4ec0b4SGerd Hoffmann 3498747bbdf7SBlue Swirl########################################## 34995f6b9e8fSBlue Swirl# check if we have fdatasync 35005f6b9e8fSBlue Swirl 35015f6b9e8fSBlue Swirlfdatasync=no 35025f6b9e8fSBlue Swirlcat > $TMPC << EOF 35035f6b9e8fSBlue Swirl#include <unistd.h> 3504d1722a27SAlexandre Raymondint main(void) { 3505d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 3506d1722a27SAlexandre Raymondreturn fdatasync(0); 3507d1722a27SAlexandre Raymond#else 3508e172fe11SStefan Weil#error Not supported 3509d1722a27SAlexandre Raymond#endif 3510d1722a27SAlexandre Raymond} 35115f6b9e8fSBlue SwirlEOF 35125f6b9e8fSBlue Swirlif compile_prog "" "" ; then 35135f6b9e8fSBlue Swirl fdatasync=yes 35145f6b9e8fSBlue Swirlfi 35155f6b9e8fSBlue Swirl 351694a420b1SStefan Hajnoczi########################################## 3517e78815a5SAndreas Färber# check if we have madvise 3518e78815a5SAndreas Färber 3519e78815a5SAndreas Färbermadvise=no 3520e78815a5SAndreas Färbercat > $TMPC << EOF 3521e78815a5SAndreas Färber#include <sys/types.h> 3522e78815a5SAndreas Färber#include <sys/mman.h> 3523832ce9c2SScott Wood#include <stddef.h> 3524e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 3525e78815a5SAndreas FärberEOF 3526e78815a5SAndreas Färberif compile_prog "" "" ; then 3527e78815a5SAndreas Färber madvise=yes 3528e78815a5SAndreas Färberfi 3529e78815a5SAndreas Färber 3530e78815a5SAndreas Färber########################################## 3531e78815a5SAndreas Färber# check if we have posix_madvise 3532e78815a5SAndreas Färber 3533e78815a5SAndreas Färberposix_madvise=no 3534e78815a5SAndreas Färbercat > $TMPC << EOF 3535e78815a5SAndreas Färber#include <sys/mman.h> 3536832ce9c2SScott Wood#include <stddef.h> 3537e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 3538e78815a5SAndreas FärberEOF 3539e78815a5SAndreas Färberif compile_prog "" "" ; then 3540e78815a5SAndreas Färber posix_madvise=yes 3541e78815a5SAndreas Färberfi 3542e78815a5SAndreas Färber 3543e78815a5SAndreas Färber########################################## 35441e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID 35451e9737daSRichard Henderson 35461e9737daSRichard Hendersonsigev_thread_id=no 35471e9737daSRichard Hendersoncat > $TMPC << EOF 35481e9737daSRichard Henderson#include <signal.h> 35491e9737daSRichard Hendersonint main(void) { 35501e9737daSRichard Henderson struct sigevent ev; 35511e9737daSRichard Henderson ev.sigev_notify = SIGEV_THREAD_ID; 35521e9737daSRichard Henderson ev._sigev_un._tid = 0; 35531e9737daSRichard Henderson asm volatile("" : : "g"(&ev)); 35541e9737daSRichard Henderson return 0; 35551e9737daSRichard Henderson} 35561e9737daSRichard HendersonEOF 35571e9737daSRichard Hendersonif compile_prog "" "" ; then 35581e9737daSRichard Henderson sigev_thread_id=yes 35591e9737daSRichard Hendersonfi 35601e9737daSRichard Henderson 35611e9737daSRichard Henderson########################################## 356294a420b1SStefan Hajnoczi# check if trace backend exists 356394a420b1SStefan Hajnoczi 3564650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null 356594a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 356676ad07a4SPeter Maydell error_exit "invalid trace backend" \ 356776ad07a4SPeter Maydell "Please choose a supported trace backend." 356894a420b1SStefan Hajnoczifi 356994a420b1SStefan Hajnoczi 35707e24e92aSStefan Hajnoczi########################################## 35717e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 35727e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 35737e24e92aSStefan Hajnoczi cat > $TMPC << EOF 3574bf15f63cSMohamad Gebai#include <lttng/tracepoint.h> 35757e24e92aSStefan Hajnocziint main(void) { return 0; } 35767e24e92aSStefan HajnocziEOF 35777e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 3578bf15f63cSMohamad Gebai if $pkg_config lttng-ust --exists; then 3579bf15f63cSMohamad Gebai lttng_ust_libs=`$pkg_config --libs lttng-ust` 35807e24e92aSStefan Hajnoczi else 3581bf15f63cSMohamad Gebai lttng_ust_libs="-llttng-ust" 3582bf15f63cSMohamad Gebai fi 3583bf15f63cSMohamad Gebai if $pkg_config liburcu-bp --exists; then 3584bf15f63cSMohamad Gebai urcu_bp_libs=`$pkg_config --libs liburcu-bp` 3585bf15f63cSMohamad Gebai else 3586bf15f63cSMohamad Gebai urcu_bp_libs="-lurcu-bp" 3587bf15f63cSMohamad Gebai fi 3588bf15f63cSMohamad Gebai 3589bf15f63cSMohamad Gebai LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS" 3590bf15f63cSMohamad Gebai libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga" 3591bf15f63cSMohamad Gebai else 3592bf15f63cSMohamad Gebai error_exit "Trace backend 'ust' missing lttng-ust header files" 35937e24e92aSStefan Hajnoczi fi 35947e24e92aSStefan Hajnoczifi 3595b3d08c02SDaniel P. Berrange 3596b3d08c02SDaniel P. Berrange########################################## 3597b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 3598b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 3599b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 360076ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 3601b3d08c02SDaniel P. Berrange fi 3602c276b17dSDaniel P. Berrange trace_backend_stap="no" 3603c276b17dSDaniel P. Berrange if has 'stap' ; then 3604c276b17dSDaniel P. Berrange trace_backend_stap="yes" 3605c276b17dSDaniel P. Berrange fi 3606b3d08c02SDaniel P. Berrangefi 3607b3d08c02SDaniel P. Berrange 36087e24e92aSStefan Hajnoczi########################################## 3609519175a2SAlex Barcelo# check and set a backend for coroutine 3610d0e2fce5SAneesh Kumar K.V 36117c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 36127c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because 36137c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally 36147c2acc70SPeter Maydell# useful for debugging purposes.) On Windows the only valid backend 36157c2acc70SPeter Maydell# is the Windows-specific one. 36167c2acc70SPeter Maydell 36177c2acc70SPeter Maydellucontext_works=no 3618d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 3619d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 3620d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 3621cdf84806SPeter Maydell#ifdef __stub_makecontext 3622cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 3623cdf84806SPeter Maydell#endif 362475cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 3625d0e2fce5SAneesh Kumar K.VEOF 3626d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 36277c2acc70SPeter Maydell ucontext_works=yes 3628d0e2fce5SAneesh Kumar K.V fi 3629519175a2SAlex Barcelofi 36307c2acc70SPeter Maydell 36317c2acc70SPeter Maydellif test "$coroutine" = ""; then 36327c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 36337c2acc70SPeter Maydell coroutine=win32 36347c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 36357c2acc70SPeter Maydell coroutine=ucontext 3636519175a2SAlex Barcelo else 36377c2acc70SPeter Maydell coroutine=sigaltstack 36387c2acc70SPeter Maydell fi 36397c2acc70SPeter Maydellelse 36407c2acc70SPeter Maydell case $coroutine in 36417c2acc70SPeter Maydell windows) 36427c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 36437c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 36447c2acc70SPeter Maydell fi 36457c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 36467c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 36477c2acc70SPeter Maydell coroutine=win32 36487c2acc70SPeter Maydell ;; 36497c2acc70SPeter Maydell ucontext) 36507c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 36517c2acc70SPeter Maydell feature_not_found "ucontext" 36527c2acc70SPeter Maydell fi 36537c2acc70SPeter Maydell ;; 36547c2acc70SPeter Maydell gthread|sigaltstack) 36557c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 36567c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 36577c2acc70SPeter Maydell fi 36587c2acc70SPeter Maydell ;; 36597c2acc70SPeter Maydell *) 366076ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 36617c2acc70SPeter Maydell ;; 36627c2acc70SPeter Maydell esac 3663d0e2fce5SAneesh Kumar K.Vfi 3664d0e2fce5SAneesh Kumar K.V 366570c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then 366670c60c08SStefan Hajnoczi if test "$coroutine" = "gthread"; then 366770c60c08SStefan Hajnoczi coroutine_pool=no 366870c60c08SStefan Hajnoczi else 366970c60c08SStefan Hajnoczi coroutine_pool=yes 367070c60c08SStefan Hajnoczi fi 367170c60c08SStefan Hajnoczifi 367270c60c08SStefan Hajnocziif test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then 367370c60c08SStefan Hajnoczi error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)" 367470c60c08SStefan Hajnoczifi 367570c60c08SStefan Hajnoczi 3676d0e2fce5SAneesh Kumar K.V########################################## 3677d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 3678d2042378SAneesh Kumar K.V 36794e1797f9SStefan Weilopen_by_handle_at=no 3680d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 3681d2042378SAneesh Kumar K.V#include <fcntl.h> 3682acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 3683acc55ba8SStefan Weil# error missing definition 3684acc55ba8SStefan Weil#else 368575cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 3686acc55ba8SStefan Weil#endif 3687d2042378SAneesh Kumar K.VEOF 3688d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 3689d2042378SAneesh Kumar K.V open_by_handle_at=yes 3690d2042378SAneesh Kumar K.Vfi 3691d2042378SAneesh Kumar K.V 3692e06a765eSHarsh Prateek Bora######################################## 3693e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 3694e06a765eSHarsh Prateek Bora 3695e06a765eSHarsh Prateek Boralinux_magic_h=no 3696e06a765eSHarsh Prateek Boracat > $TMPC << EOF 3697e06a765eSHarsh Prateek Bora#include <linux/magic.h> 3698e06a765eSHarsh Prateek Boraint main(void) { 369975cafad7SStefan Weil return 0; 3700e06a765eSHarsh Prateek Bora} 3701e06a765eSHarsh Prateek BoraEOF 3702e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 3703e06a765eSHarsh Prateek Bora linux_magic_h=yes 3704e06a765eSHarsh Prateek Borafi 3705e06a765eSHarsh Prateek Bora 37068ab1bf12SLuiz Capitulino######################################## 3707c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed 3708c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries). 3709c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is 3710c95e3080SKevin Wolf# only a warning. 3711c95e3080SKevin Wolf# 3712c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that 3713c95e3080SKevin Wolf# the build doesn't fail anyway. 3714c95e3080SKevin Wolf 371506d71fa1SPeter Maydellpragma_disable_unused_but_set=no 371606d71fa1SPeter Maydellcat > $TMPC << EOF 3717e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push 371806d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable" 3719c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes" 3720e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop 3721c95e3080SKevin Wolf 372206d71fa1SPeter Maydellint main(void) { 372306d71fa1SPeter Maydell return 0; 372406d71fa1SPeter Maydell} 372506d71fa1SPeter MaydellEOF 372606d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 3727cc6e3ca9SGerd Hoffmann pragma_diagnostic_available=yes 3728c95e3080SKevin Wolfelse 3729c95e3080SKevin Wolf werror=no 373006d71fa1SPeter Maydellfi 373106d71fa1SPeter Maydell 373206d71fa1SPeter Maydell######################################## 373362fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h 37343f4349dcSKevin Wolf 37353f4349dcSKevin Wolfvalgrind_h=no 37363f4349dcSKevin Wolfcat > $TMPC << EOF 37373f4349dcSKevin Wolf#include <valgrind/valgrind.h> 373862fe8331SChristian Borntraeger#include <valgrind/memcheck.h> 37393f4349dcSKevin Wolfint main(void) { 37403f4349dcSKevin Wolf return 0; 37413f4349dcSKevin Wolf} 37423f4349dcSKevin WolfEOF 37433f4349dcSKevin Wolfif compile_prog "" "" ; then 37443f4349dcSKevin Wolf valgrind_h=yes 37453f4349dcSKevin Wolffi 37463f4349dcSKevin Wolf 37473f4349dcSKevin Wolf######################################## 37488ab1bf12SLuiz Capitulino# check if environ is declared 37498ab1bf12SLuiz Capitulino 37508ab1bf12SLuiz Capitulinohas_environ=no 37518ab1bf12SLuiz Capitulinocat > $TMPC << EOF 37528ab1bf12SLuiz Capitulino#include <unistd.h> 37538ab1bf12SLuiz Capitulinoint main(void) { 3754c075a723SBlue Swirl environ = 0; 37558ab1bf12SLuiz Capitulino return 0; 37568ab1bf12SLuiz Capitulino} 37578ab1bf12SLuiz CapitulinoEOF 37588ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 37598ab1bf12SLuiz Capitulino has_environ=yes 37608ab1bf12SLuiz Capitulinofi 37618ab1bf12SLuiz Capitulino 376276a347e1SRichard Henderson######################################## 376376a347e1SRichard Henderson# check if cpuid.h is usable. 376476a347e1SRichard Henderson 376576a347e1SRichard Hendersoncpuid_h=no 376676a347e1SRichard Hendersoncat > $TMPC << EOF 376776a347e1SRichard Henderson#include <cpuid.h> 376876a347e1SRichard Hendersonint main(void) { 3769774d566cSPeter Maydell unsigned a, b, c, d; 3770774d566cSPeter Maydell int max = __get_cpuid_max(0, 0); 3771774d566cSPeter Maydell 3772774d566cSPeter Maydell if (max >= 1) { 3773774d566cSPeter Maydell __cpuid(1, a, b, c, d); 3774774d566cSPeter Maydell } 3775774d566cSPeter Maydell 3776774d566cSPeter Maydell if (max >= 7) { 3777774d566cSPeter Maydell __cpuid_count(7, 0, a, b, c, d); 3778774d566cSPeter Maydell } 3779774d566cSPeter Maydell 378076a347e1SRichard Henderson return 0; 378176a347e1SRichard Henderson} 378276a347e1SRichard HendersonEOF 378376a347e1SRichard Hendersonif compile_prog "" "" ; then 378476a347e1SRichard Henderson cpuid_h=yes 378576a347e1SRichard Hendersonfi 378676a347e1SRichard Henderson 3787f540166bSRichard Henderson######################################## 3788f540166bSRichard Henderson# check if __[u]int128_t is usable. 3789f540166bSRichard Henderson 3790f540166bSRichard Hendersonint128=no 3791f540166bSRichard Hendersoncat > $TMPC << EOF 3792f540166bSRichard Henderson__int128_t a; 3793f540166bSRichard Henderson__uint128_t b; 3794f540166bSRichard Hendersonint main (void) { 3795f540166bSRichard Henderson a = a + b; 3796f540166bSRichard Henderson b = a * b; 3797464e3671SPeter Maydell a = a * a; 3798f540166bSRichard Henderson return 0; 3799f540166bSRichard Henderson} 3800f540166bSRichard HendersonEOF 3801f540166bSRichard Hendersonif compile_prog "" "" ; then 3802f540166bSRichard Henderson int128=yes 3803f540166bSRichard Hendersonfi 380476a347e1SRichard Henderson 38051e6e9acaSRichard Henderson######################################## 38061e6e9acaSRichard Henderson# check if getauxval is available. 38071e6e9acaSRichard Henderson 38081e6e9acaSRichard Hendersongetauxval=no 38091e6e9acaSRichard Hendersoncat > $TMPC << EOF 38101e6e9acaSRichard Henderson#include <sys/auxv.h> 38111e6e9acaSRichard Hendersonint main(void) { 38121e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 38131e6e9acaSRichard Henderson} 38141e6e9acaSRichard HendersonEOF 38151e6e9acaSRichard Hendersonif compile_prog "" "" ; then 38161e6e9acaSRichard Henderson getauxval=yes 38171e6e9acaSRichard Hendersonfi 38181e6e9acaSRichard Henderson 3819d2042378SAneesh Kumar K.V########################################## 3820e86ecd4bSJuan Quintela# End of CC checks 3821e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3822e86ecd4bSJuan Quintela 38231d728c39SBlue Swirlif test "$gcov" = "yes" ; then 38241d728c39SBlue Swirl CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" 38251d728c39SBlue Swirl LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" 38261d728c39SBlue Swirlelif test "$debug" = "no" ; then 3827e600cdf3SMichal Privoznik CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" 3828e86ecd4bSJuan Quintelafi 3829a316e378SJuan Quintela 38306542aa9cSPeter Lieven########################################## 38316542aa9cSPeter Lieven# Do we have libnfs 38326542aa9cSPeter Lievenif test "$libnfs" != "no" ; then 38336542aa9cSPeter Lieven if $pkg_config --atleast-version=1.9.2 libnfs; then 38346542aa9cSPeter Lieven libnfs="yes" 38356542aa9cSPeter Lieven libnfs_libs=$($pkg_config --libs libnfs) 38366542aa9cSPeter Lieven LIBS="$LIBS $libnfs_libs" 38376542aa9cSPeter Lieven else 38386542aa9cSPeter Lieven if test "$libnfs" = "yes" ; then 38396542aa9cSPeter Lieven feature_not_found "libnfs" 38406542aa9cSPeter Lieven fi 38416542aa9cSPeter Lieven libnfs="no" 38426542aa9cSPeter Lieven fi 38436542aa9cSPeter Lievenfi 38441d728c39SBlue Swirl 384520ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 384620ff6c80SAnthony Liguori# enable/disable 384720ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 384820ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 384920ff6c80SAnthony Liguori zero_malloc="no" 385020ff6c80SAnthony Liguori else 385120ff6c80SAnthony Liguori zero_malloc="yes" 385220ff6c80SAnthony Liguori fi 385320ff6c80SAnthony Liguorifi 385420ff6c80SAnthony Liguori 38556ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 38566ca026cbSPeter Maydellif test "$werror" = "yes"; then 38576ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 38586ca026cbSPeter Maydellfi 38596ca026cbSPeter Maydell 3860e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 3861e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 38621156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 3863e86ecd4bSJuan Quintela fi 3864e86ecd4bSJuan Quintelafi 3865e86ecd4bSJuan Quintela 386694dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 386794dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 386894dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 386994dd53c5SGerd Hoffmannelse 387094dd53c5SGerd Hoffmann POD2MAN="pod2man" 387194dd53c5SGerd Hoffmannfi 387294dd53c5SGerd Hoffmann 3873952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3874952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3875952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 3876952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 3877952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 3878952afb71SBlue Swirl fi 3879952afb71SBlue Swirl done 3880952afb71SBlue Swirlfi 3881952afb71SBlue Swirl 388210ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 3883e26110cfSFam Zhengqemu_moddir=$libdir$confsuffix 3884528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 3885834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 38865a67135aSbellard 38874b1c11fdSDaniel P. Berrangetools="" 38884b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 3889ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 38904b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 38914b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 38924b1c11fdSDaniel P. Berrange fi 38934b1c11fdSDaniel P. Berrangefi 38944b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 3895983eef5aSMeador Inge if test "$virtfs" != no ; then 3896be5ea8edSAnthony Liguori if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then 3897983eef5aSMeador Inge virtfs=yes 389817bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 3899983eef5aSMeador Inge else 3900983eef5aSMeador Inge if test "$virtfs" = yes; then 390176ad07a4SPeter Maydell error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel" 3902983eef5aSMeador Inge fi 390317500370SAndreas Färber virtfs=no 3904983eef5aSMeador Inge fi 390517bff52bSM. Mohan Kumar fi 3906d138cee9SMichael Rothfi 3907e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 3908b39297aeSTomoki Sekiyama if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then 3909e8ef31a3SMichael Tokarev tools="qemu-ga\$(EXESUF) $tools" 3910b39297aeSTomoki Sekiyama if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then 3911b39297aeSTomoki Sekiyama tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools" 3912b39297aeSTomoki Sekiyama fi 3913e8ef31a3SMichael Tokarev guest_agent=yes 3914e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 3915e8ef31a3SMichael Tokarev guest_agent=no 3916e8ef31a3SMichael Tokarev else 3917e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 3918ca35f780SPaolo Bonzini fi 39194b1c11fdSDaniel P. Berrangefi 3920ca35f780SPaolo Bonzini 3921ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3922ca35f780SPaolo Bonziniroms= 3923ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 3924ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 3925ca35f780SPaolo Bonzini "$softmmu" = yes ; then 3926ca35f780SPaolo Bonzini roms="optionrom" 3927ca35f780SPaolo Bonzinifi 3928d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 392939ac8455SDavid Gibson roms="$roms spapr-rtas" 393039ac8455SDavid Gibsonfi 3931ca35f780SPaolo Bonzini 39329933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 39339933c305SChristian Borntraeger roms="$roms s390-ccw" 39349933c305SChristian Borntraegerfi 39359933c305SChristian Borntraeger 3936964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary. 3937964c6fa1SRichard Hendersonif test "$pie" = "no" ; then 3938964c6fa1SRichard Henderson textseg_addr= 3939964c6fa1SRichard Henderson case "$cpu" in 3940c72b26ecSRichard Henderson arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32) 3941964c6fa1SRichard Henderson textseg_addr=0x60000000 3942964c6fa1SRichard Henderson ;; 3943964c6fa1SRichard Henderson mips) 3944964c6fa1SRichard Henderson textseg_addr=0x400000 3945964c6fa1SRichard Henderson ;; 3946964c6fa1SRichard Henderson esac 3947964c6fa1SRichard Henderson if [ -n "$textseg_addr" ]; then 3948964c6fa1SRichard Henderson cat > $TMPC <<EOF 3949964c6fa1SRichard Henderson int main(void) { return 0; } 3950964c6fa1SRichard HendersonEOF 3951964c6fa1SRichard Henderson textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" 3952964c6fa1SRichard Henderson if ! compile_prog "" "$textseg_ldflags"; then 3953964c6fa1SRichard Henderson # In case ld does not support -Ttext-segment, edit the default linker 3954964c6fa1SRichard Henderson # script via sed to set the .text start addr. This is needed on FreeBSD 3955964c6fa1SRichard Henderson # at least. 3956964c6fa1SRichard Henderson $ld --verbose | sed \ 3957964c6fa1SRichard Henderson -e '1,/==================================================/d' \ 3958964c6fa1SRichard Henderson -e '/==================================================/,$d' \ 3959964c6fa1SRichard Henderson -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ 3960964c6fa1SRichard Henderson -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld 3961964c6fa1SRichard Henderson textseg_ldflags="-Wl,-T../config-host.ld" 3962964c6fa1SRichard Henderson fi 3963964c6fa1SRichard Henderson fi 3964964c6fa1SRichard Hendersonfi 3965964c6fa1SRichard Henderson 39665ca9388aSGerd Hoffmann# add pixman flags after all config tests are done 3967a540f158SPeter CrosthwaiteQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags" 39685ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs" 39695ca9388aSGerd Hoffmann 39707d13299dSbellardecho "Install prefix $prefix" 3971c00b2808SEduardo Habkostecho "BIOS directory `eval echo $qemu_datadir`" 3972f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 39733aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 3974e26110cfSFam Zhengecho "module directory `eval echo $qemu_moddir`" 39758bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`" 39760f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 39771c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 397811d9f695Sbellardif test "$mingw32" = "no" ; then 39795a699bbbSLaszlo Ersekecho "local state directory `eval echo $local_statedir`" 3980f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 398143ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 39825a699bbbSLaszlo Ersekelse 39835a699bbbSLaszlo Ersekecho "local state directory queried at runtime" 3984d9840e25STomoki Sekiyamaecho "Windows SDK $win_sdk" 398511d9f695Sbellardfi 39865a67135aSbellardecho "Source path $source_path" 39877d13299dSbellardecho "C compiler $cc" 398883469015Sbellardecho "Host C compiler $host_cc" 398983f73fceSTomoki Sekiyamaecho "C++ compiler $cxx" 39903c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 399145d285abSPeter Maydellecho "ARFLAGS $ARFLAGS" 39920c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 3993a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 39940c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 39957d13299dSbellardecho "make $make" 39966a882643Spbrookecho "install $install" 3997c886edfbSBlue Swirlecho "python $python" 3998e2d8830eSBradif test "$slirp" = "yes" ; then 3999e2d8830eSBrad echo "smbd $smbd" 4000e2d8830eSBradfi 400117969268SFam Zhengecho "module support $modules" 4002a98fd896Sbellardecho "host CPU $cpu" 4003de83cd02Sbellardecho "host big endian $bigendian" 400497a847bcSbellardecho "target list $target_list" 4005ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 40067d13299dSbellardecho "gprof enabled $gprof" 400703b4fe7dSaliguoriecho "sparse enabled $sparse" 40081625af87Saliguoriecho "strip binaries $strip_opt" 400905c2a3e7Sbellardecho "profiler $profiler" 401043ce4dfeSbellardecho "static build $static" 401185aa5189Sbellardecho "-Werror enabled $werror" 40125b0753e0Sbellardif test "$darwin" = "yes" ; then 40135b0753e0Sbellard echo "Cocoa support $cocoa" 40145b0753e0Sbellardfi 4015e2134eb9SGerd Hoffmannecho "pixman $pixman" 401697a847bcSbellardecho "SDL support $sdl" 4017a4ccabcfSAnthony Liguoriecho "GTK support $gtk" 40184d3b6f6eSbalrogecho "curses support $curses" 4019769ce76dSAlexander Grafecho "curl support $curl" 402067b915a5Sbellardecho "mingw32 support $mingw32" 40210c58ac1cSmalcecho "Audio drivers $audio_drv_list" 4022b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist" 4023b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist" 4024983eef5aSMeador Ingeecho "VirtFS support $virtfs" 4025821601eaSJes Sorensenecho "VNC support $vnc" 4026821601eaSJes Sorensenif test "$vnc" = "yes" ; then 40278d5d2d4cSths echo "VNC TLS support $vnc_tls" 40282f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 40292f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 4030efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 40317536ee4bSTim Hardeck echo "VNC WS support $vnc_ws" 4032821601eaSJes Sorensenfi 40333142255cSblueswir1if test -n "$sparc_cpu"; then 40343142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 40353142255cSblueswir1fi 4036e37630caSaliguoriecho "xen support $xen" 40372e4d9fb1Saurel32echo "brlapi support $brlapi" 4038a20a6f46SJuan Quintelaecho "bluez support $bluez" 4039a25dba17SJuan Quintelaecho "Documentation $docs" 4040c5937220Spbrook[ ! -z "$uname_release" ] && \ 4041c5937220Spbrookecho "uname -r $uname_release" 4042379f6698SPaul Brookecho "GUEST_BASE $guest_base" 404340d6444eSAvi Kivityecho "PIE $pie" 40448a16d273Sthsecho "vde support $vde" 404558952137SVincenzo Maffioneecho "netmap support $netmap" 40465c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 4047758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 404877755340Sthsecho "Install blobs $blobs" 4049b31a0277SJuan Quintelaecho "KVM support $kvm" 40502da776dbSMichael R. Hinesecho "RDMA support $rdma" 40519195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 4052f652e6afSaurel32echo "fdt support $fdt" 4053ceb42de8Saliguoriecho "preadv support $preadv" 40545f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 4055e78815a5SAndreas Färberecho "madvise $madvise" 4056e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 40571e9737daSRichard Hendersonecho "sigev_thread_id $sigev_thread_id" 4058ee682d27SStefan Weilecho "uuid support $uuid" 405947e98658SCorey Bryantecho "libcap-ng support $cap_ng" 4060d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 40615e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi" 406294a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 40639410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 40642e0e3c39SAlon Levyecho "spice support $spice ($spice_protocol_version/$spice_server_version)" 4065f27aaf4bSChristian Brunnerecho "rbd support $rbd" 4066dce512deSChristoph Hellwigecho "xfsctl support $xfs" 4067111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 40682b2325ffSGerd Hoffmannecho "libusb $libusb" 406969354a83SHans de Goedeecho "usb net redir $usb_redir" 4070b1e5fff4SMichael Walleecho "GLX support $glx" 4071219c2521SStefan Weilif test "$libiscsi_version" = "1.4.0"; then 4072219c2521SStefan Weilecho "libiscsi support $libiscsi (1.4.0)" 4073219c2521SStefan Weilelse 4074c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 4075219c2521SStefan Weilfi 40766542aa9cSPeter Lievenecho "libnfs support $libnfs" 4077d138cee9SMichael Rothecho "build guest agent $guest_agent" 4078d9840e25STomoki Sekiyamaecho "QGA VSS support $guest_agent_with_vss" 4079f794573eSEduardo Otuboecho "seccomp support $seccomp" 40807c2acc70SPeter Maydellecho "coroutine backend $coroutine" 408170c60c08SStefan Hajnocziecho "coroutine pool $coroutine_pool" 4082eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 4083583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane" 40841d728c39SBlue Swirlecho "gcov $gcov_tool" 40851d728c39SBlue Swirlecho "gcov enabled $gcov" 4086ab214c29SStefan Bergerecho "TPM support $tpm" 40870a12ec87SRichard W.M. Jonesecho "libssh2 support $libssh2" 40883b8acc11SPaolo Bonziniecho "TPM passthrough $tpm_passthrough" 40893556c233SPaolo Bonziniecho "QOM debugging $qom_cast_debug" 40904f18b782SJeff Codyecho "vhdx $vhdx" 409195c6bff3SBenoît Canetecho "Quorum $quorum" 4092*607dacd0Sqiaonuohanecho "lzo support $lzo" 4093*607dacd0Sqiaonuohanecho "snappy support $snappy" 409467b915a5Sbellard 40951ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 409624b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 4097e8cd23deSbellardfi 409897a847bcSbellard 409998ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 410097a847bcSbellard 4101dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 4102dbd99ae3SStefan Weil 410398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 410498ec69acSJuan Quintelaecho >> $config_host_mak 410598ec69acSJuan Quintela 4106e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 410799d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 410899d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 41093aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 41108bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 41110f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 411299d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 411399d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 411422d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 41159afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 41169afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 4117e26110cfSFam Zhengecho "qemu_moddir=$qemu_moddir" >> $config_host_mak 41185a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 4119785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 41205a699bbbSLaszlo Ersekfi 4121f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 4122f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak 4123f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak 4124834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 4125f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 4126804edf29SJuan Quintela 412798ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 4128727e5283SPaolo Bonzini 4129f8393946Saurel32if test "$debug_tcg" = "yes" ; then 41302358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 4131f8393946Saurel32fi 41321625af87Saliguoriif test "$strip_opt" = "yes" ; then 413352ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 41341625af87Saliguorifi 41357d13299dSbellardif test "$bigendian" = "yes" ; then 4136e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 413797a847bcSbellardfi 413867b915a5Sbellardif test "$mingw32" = "yes" ; then 413998ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 41409fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 41419fe6de94SBlue Swirl version_major=${rc_version%%.*} 41429fe6de94SBlue Swirl rc_version=${rc_version#*.} 41439fe6de94SBlue Swirl version_minor=${rc_version%%.*} 41449fe6de94SBlue Swirl rc_version=${rc_version#*.} 41459fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 41469fe6de94SBlue Swirl version_micro=0 41479fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 41489fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 4149d9840e25STomoki Sekiyama if test "$guest_agent_with_vss" = "yes" ; then 4150d9840e25STomoki Sekiyama echo "CONFIG_QGA_VSS=y" >> $config_host_mak 4151d9840e25STomoki Sekiyama echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak 4152d9840e25STomoki Sekiyama fi 4153210fa556Spbrookelse 415435f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 4155210fa556Spbrookfi 4156128ab2ffSblueswir1 4157dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 4158dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 4159dffcb71cSMark McLoughlinfi 4160dffcb71cSMark McLoughlin 416183fb7adfSbellardif test "$darwin" = "yes" ; then 416298ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 416383fb7adfSbellardfi 4164b29fe3edSmalc 4165b29fe3edSmalcif test "$aix" = "yes" ; then 416698ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 4167b29fe3edSmalcfi 4168b29fe3edSmalc 4169ec530c81Sbellardif test "$solaris" = "yes" ; then 417098ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 41712358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 41720475a5caSths if test "$needs_libsunmath" = "yes" ; then 417375b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 41740475a5caSths fi 4175ec530c81Sbellardfi 4176179cf400SAndreas Färberif test "$haiku" = "yes" ; then 4177179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 4178179cf400SAndreas Färberfi 417997a847bcSbellardif test "$static" = "yes" ; then 418098ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 418197a847bcSbellardfi 41821ba16968SStefan Weilif test "$profiler" = "yes" ; then 41832358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 418405c2a3e7Sbellardfi 4185c20709aaSbellardif test "$slirp" = "yes" ; then 418698ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 4187e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 4188c20709aaSbellardfi 41898a16d273Sthsif test "$vde" = "yes" ; then 419098ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 41918a16d273Sthsfi 419258952137SVincenzo Maffioneif test "$netmap" = "yes" ; then 419358952137SVincenzo Maffione echo "CONFIG_NETMAP=y" >> $config_host_mak 419458952137SVincenzo Maffionefi 419547e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 419647e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 419747e98658SCorey Bryantfi 41982358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 41990c58ac1cSmalcfor drv in $audio_drv_list; do 4200bb55b712SStefan Weil def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` 420198ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 4202923e4521Smalc if test "$drv" = "fmod"; then 42037aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 4204fb065187Sbellard fi 42050c58ac1cSmalcdone 420667f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 420767f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 420867f86e8eSJuan Quintelafi 4209d5631638Smalcif test "$audio_win_int" = "yes" ; then 4210d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 4211d5631638Smalcfi 4212b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 4213b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 4214821601eaSJes Sorensenif test "$vnc" = "yes" ; then 4215821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 4216821601eaSJes Sorensenfi 42178d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 421898ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 42198d5d2d4cSthsfi 42202f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 422198ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 42222f9606b3Saliguorifi 4223821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 42242f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 42252f6f5c7aSCorentin Charyfi 4226821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 4227efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 4228efe556adSCorentin Charyfi 42297536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then 42307536ee4bSTim Hardeck echo "CONFIG_VNC_WS=y" >> $config_host_mak 42317536ee4bSTim Hardeck echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak 42327536ee4bSTim Hardeckfi 423376655d6dSaliguoriif test "$fnmatch" = "yes" ; then 42342358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 423576655d6dSaliguorifi 4236ee682d27SStefan Weilif test "$uuid" = "yes" ; then 4237ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 4238ee682d27SStefan Weilfi 4239dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 4240dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 4241dce512deSChristoph Hellwigfi 4242b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 424398ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 42442358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 424598ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 424698ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 4247a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 424898ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 4249cc8ae6deSpbrookfi 425017969268SFam Zhengif test "$modules" = "yes"; then 4251e26110cfSFam Zheng # $shacmd can generate a hash started with digit, which the compiler doesn't 4252e26110cfSFam Zheng # like as an symbol. So prefix it with an underscore 4253e26110cfSFam Zheng echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak 425417969268SFam Zheng echo "CONFIG_MODULES=y" >> $config_host_mak 425517969268SFam Zhengfi 42561ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 425798ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 42588ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 425949ecc3faSbellardfi 426049ecc3faSbellardif test "$cocoa" = "yes" ; then 426198ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 426249ecc3faSbellardfi 42634d3b6f6eSbalrogif test "$curses" = "yes" ; then 426498ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 4265ab4e5602SJan Kiszkafi 4266ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 42672358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 4268ebc996f3SRiku Voipiofi 4269099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 42702358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 4271099d6b0fSRiku Voipiofi 427240ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 427340ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 427440ff6d7eSKevin Wolffi 42753ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 42762358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 42773ce34dfbSvibisreenivasanfi 4278c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 4279c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 4280c2882b96SRiku Voipiofi 4281d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 4282d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 4283d0927938SUlrich Hechtfi 42843d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 42853d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 42863d4fa43eSKusanagi Kouichifi 4287c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 4288c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 4289c727f47dSPeter Maydellfi 4290dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 4291dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 4292dace20dcSPeter Maydellfi 4293d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 4294d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 4295d0927938SUlrich Hechtfi 42964e0c6529SAlex Blighif test "$ppoll" = "yes" ; then 42974e0c6529SAlex Bligh echo "CONFIG_PPOLL=y" >> $config_host_mak 42984e0c6529SAlex Blighfi 4299cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then 4300cd758dd0SAlex Bligh echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak 4301cd758dd0SAlex Blighfi 43023b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 43033b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 43043b6edd16SPeter Maydellfi 43053b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 43063b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 43073b6edd16SPeter Maydellfi 43083b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 43093b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 43103b6edd16SPeter Maydellfi 4311a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 4312a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 4313a8fd1abaSPeter Maydellfi 43143b3f24adSaurel32if test "$inotify" = "yes" ; then 43152358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 43163b3f24adSaurel32fi 4317c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 4318c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 4319c05c7a73SRiku Voipiofi 43206ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 43216ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 43226ae9a1f4SJuan Quintelafi 43236ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 43246ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 43256ae9a1f4SJuan Quintelafi 4326769ce76dSAlexander Grafif test "$curl" = "yes" ; then 4327d3399d7cSFam Zheng echo "CONFIG_CURL=m" >> $config_host_mak 4328b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 43296ebc91e5SFam Zheng echo "CURL_LIBS=$curl_libs" >> $config_host_mak 4330769ce76dSAlexander Graffi 43312e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 433298ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 43332e4d9fb1Saurel32fi 4334fb599c9aSbalrogif test "$bluez" = "yes" ; then 433598ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 4336ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 4337fb599c9aSbalrogfi 4338e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 4339a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 4340a4ccabcfSAnthony Liguori echo "CONFIG_GTK=y" >> $config_host_mak 4341a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 4342a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 4343a4ccabcfSAnthony Liguorifi 4344e37630caSaliguoriif test "$xen" = "yes" ; then 43456dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 4346d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 4347e37630caSaliguorifi 43485c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 43495c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 43505c6c3a6cSChristoph Hellwigfi 4351758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 4352758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 4353758e8e38SVenkateswararao Jujjuri (JV)fi 43544f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 43554f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 43564f26f2b6SAvi Kivityfi 4357983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 4358758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 4359758e8e38SVenkateswararao Jujjuri (JV)fi 43605e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 43615e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 43625e9be92dSNicholas Bellingerfi 436377755340Sthsif test "$blobs" = "yes" ; then 436498ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 436577755340Sthsfi 4366bf9298b9Saliguoriif test "$iovec" = "yes" ; then 43672358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 4368bf9298b9Saliguorifi 4369ceb42de8Saliguoriif test "$preadv" = "yes" ; then 43702358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 4371ceb42de8Saliguorifi 4372f652e6afSaurel32if test "$fdt" = "yes" ; then 43733f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 4374f652e6afSaurel32fi 4375dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 4376dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 4377dcc38d1cSMarcelo Tosattifi 43789195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 43799195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 43809195b2c2SStefan Weilfi 43815f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 43825f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 43835f6b9e8fSBlue Swirlfi 4384e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 4385e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 4386e78815a5SAndreas Färberfi 4387e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 4388e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 4389e78815a5SAndreas Färberfi 43901e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then 43911e9737daSRichard Henderson echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak 43921e9737daSRichard Hendersonfi 439397a847bcSbellard 4394cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 4395cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 4396cd4ec0b4SGerd Hoffmannfi 4397cd4ec0b4SGerd Hoffmann 4398111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 4399111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 4400ad4cf3f6SPaul Brook echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 4401ad4cf3f6SPaul Brook echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 4402111a38b0SRobert Relyeafi 4403111a38b0SRobert Relyea 44042b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 44052b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 44062b2325ffSGerd Hoffmannfi 44072b2325ffSGerd Hoffmann 440869354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 440969354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 441069354a83SHans de Goedefi 441169354a83SHans de Goede 4412b1e5fff4SMichael Walleif test "$glx" = "yes" ; then 4413b1e5fff4SMichael Walle echo "CONFIG_GLX=y" >> $config_host_mak 44142b6b7099SPaolo Bonzini echo "GLX_LIBS=$glx_libs" >> $config_host_mak 441520ff075bSMichael Wallefi 441620ff075bSMichael Walle 4417*607dacd0Sqiaonuohanif test "$lzo" = "yes" ; then 4418*607dacd0Sqiaonuohan echo "CONFIG_LZO=y" >> $config_host_mak 4419*607dacd0Sqiaonuohanfi 4420*607dacd0Sqiaonuohan 4421*607dacd0Sqiaonuohanif test "$snappy" = "yes" ; then 4422*607dacd0Sqiaonuohan echo "CONFIG_SNAPPY=y" >> $config_host_mak 4423*607dacd0Sqiaonuohanfi 4424*607dacd0Sqiaonuohan 4425c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 4426d3399d7cSFam Zheng echo "CONFIG_LIBISCSI=m" >> $config_host_mak 4427219c2521SStefan Weil if test "$libiscsi_version" = "1.4.0"; then 4428219c2521SStefan Weil echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak 4429219c2521SStefan Weil fi 44306ebc91e5SFam Zheng echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak 44316ebc91e5SFam Zheng echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak 4432c589b249SRonnie Sahlbergfi 4433c589b249SRonnie Sahlberg 44346542aa9cSPeter Lievenif test "$libnfs" = "yes" ; then 44356542aa9cSPeter Lieven echo "CONFIG_LIBNFS=y" >> $config_host_mak 44366542aa9cSPeter Lievenfi 44376542aa9cSPeter Lieven 4438f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 4439f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 4440f794573eSEduardo Otubofi 4441f794573eSEduardo Otubo 444283fb7adfSbellard# XXX: suppress that 44437d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 44442358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 44457d3505c5Sbellardfi 44467d3505c5Sbellard 44472358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 4448c5937220Spbrook 444920ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 445020ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 445120ff6c80SAnthony Liguorifi 44523556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 44533556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 44543556c233SPaolo Bonzinifi 4455f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 4456d3399d7cSFam Zheng echo "CONFIG_RBD=m" >> $config_host_mak 44576ebc91e5SFam Zheng echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak 44586ebc91e5SFam Zheng echo "RBD_LIBS=$rbd_libs" >> $config_host_mak 4459f27aaf4bSChristian Brunnerfi 446020ff6c80SAnthony Liguori 44617c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 446270c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then 446370c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak 446470c60c08SStefan Hajnoczielse 446570c60c08SStefan Hajnoczi echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak 446670c60c08SStefan Hajnoczifi 4467d0e2fce5SAneesh Kumar K.V 4468d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 4469d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 4470d2042378SAneesh Kumar K.Vfi 4471d2042378SAneesh Kumar K.V 4472e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 4473e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 4474e06a765eSHarsh Prateek Borafi 4475e06a765eSHarsh Prateek Bora 4476cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then 4477cc6e3ca9SGerd Hoffmann echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 447806d71fa1SPeter Maydellfi 447906d71fa1SPeter Maydell 44803f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 44813f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 44823f4349dcSKevin Wolffi 44833f4349dcSKevin Wolf 44848ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 44858ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 44868ab1bf12SLuiz Capitulinofi 44878ab1bf12SLuiz Capitulino 448876a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 448976a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 449076a347e1SRichard Hendersonfi 449176a347e1SRichard Henderson 4492f540166bSRichard Hendersonif test "$int128" = "yes" ; then 4493f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 4494f540166bSRichard Hendersonfi 4495f540166bSRichard Henderson 44961e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 44971e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 44981e6e9acaSRichard Hendersonfi 44991e6e9acaSRichard Henderson 4500eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 4501d3399d7cSFam Zheng echo "CONFIG_GLUSTERFS=m" >> $config_host_mak 45026ebc91e5SFam Zheng echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak 45036ebc91e5SFam Zheng echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak 4504eb100396SBharata B Raofi 4505eb100396SBharata B Rao 45060c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 45070c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 45080c14fb47SBharata B Raofi 45090c14fb47SBharata B Rao 45107c815372SBharata B Raoif test "$glusterfs_zerofill" = "yes" ; then 45117c815372SBharata B Rao echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak 45127c815372SBharata B Raofi 45137c815372SBharata B Rao 45140a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then 4515d3399d7cSFam Zheng echo "CONFIG_LIBSSH2=m" >> $config_host_mak 45166ebc91e5SFam Zheng echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak 45176ebc91e5SFam Zheng echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak 45180a12ec87SRichard W.M. Jonesfi 45190a12ec87SRichard W.M. Jones 452095c6bff3SBenoît Canetif test "$quorum" = "yes" ; then 452195c6bff3SBenoît Canet echo "CONFIG_QUORUM=y" >> $config_host_mak 452295c6bff3SBenoît Canetfi 452395c6bff3SBenoît Canet 4524583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then 45256e790746SPaolo Bonzini echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak 4526583f6e7bSStefan Hajnoczifi 4527583f6e7bSStefan Hajnoczi 45284f18b782SJeff Codyif test "$vhdx" = "yes" ; then 45294f18b782SJeff Cody echo "CONFIG_VHDX=y" >> $config_host_mak 45304f18b782SJeff Codyfi 45314f18b782SJeff Cody 453268063649Sblueswir1# USB host support 4533b5613fdcSGerd Hoffmannif test "$libusb" = "yes"; then 45342b2325ffSGerd Hoffmann echo "HOST_USB=libusb legacy" >> $config_host_mak 4535b5613fdcSGerd Hoffmannelse 453698ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 4537b5613fdcSGerd Hoffmannfi 453868063649Sblueswir1 45393b8acc11SPaolo Bonzini# TPM passthrough support? 45403b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 45413b8acc11SPaolo Bonzini echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak 45423b8acc11SPaolo Bonzini if test "$tpm_passthrough" = "yes"; then 45433b8acc11SPaolo Bonzini echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak 45443b8acc11SPaolo Bonzini fi 45453b8acc11SPaolo Bonzinifi 45463b8acc11SPaolo Bonzini 4547e4858974SLluís# use default implementation for tracing backend-specific routines 4548e4858974SLluístrace_default=yes 454994a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 45506d8a764eSLluísif test "$trace_backend" = "nop"; then 45516d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 455222890ab5SPrerna Saxenafi 45539410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 45546d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 4555e4858974SLluís trace_default=no 45566d8a764eSLluís # Set the appropriate trace file. 4557953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 45589410b56cSPrerna Saxenafi 45596d8a764eSLluísif test "$trace_backend" = "stderr"; then 45606d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 45619a82b6a5SLluís trace_default=no 45626d8a764eSLluísfi 45636d8a764eSLluísif test "$trace_backend" = "ust"; then 45646d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 45656d8a764eSLluísfi 45666d8a764eSLluísif test "$trace_backend" = "dtrace"; then 45676d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 45686d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 45696d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 45706d8a764eSLluís fi 4571c276b17dSDaniel P. Berrangefi 4572781e9545SEiichi Tsukataif test "$trace_backend" = "ftrace"; then 4573781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 4574781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 4575781e9545SEiichi Tsukata trace_default=no 4576781e9545SEiichi Tsukata else 457721684af0SStewart Smith feature_not_found "ftrace(trace backend)" "ftrace requires Linux" 4578781e9545SEiichi Tsukata fi 4579781e9545SEiichi Tsukatafi 45809410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 4581e4858974SLluísif test "$trace_default" = "yes"; then 4582e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 4583e4858974SLluísfi 45849410b56cSPrerna Saxena 45852da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 45862da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 45872da776dbSMichael R. Hinesfi 45882da776dbSMichael R. Hines 45895b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 45905b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 45915b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 45925b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 45935b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 45945b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 4595c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then 45965b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 45975b5e3037SPaolo Bonzinielse 45985b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 45995b5e3037SPaolo Bonzinifi 46005b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES" 46015b5e3037SPaolo Bonzini 460298ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 460398ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 4604804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 4605804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 46061901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 46071901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 460821655882SPaolo Bonziniif test -n "$libtool"; then 460921655882SPaolo Bonzini echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak 461021655882SPaolo Bonzini echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak 461121655882SPaolo Bonzinielse 46121901cb14SBrad echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 461321655882SPaolo Bonzini echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 461421655882SPaolo Bonzinifi 4615c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 4616804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 4617a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then 4618a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_host_mak 4619a31a8642SMichael S. Tsirkinfi 46202b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 4621804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 462283f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak 46233c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 4624804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 462545d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak 46263dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak 46273dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 4628804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 4629804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 46309fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 463144dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 4632e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 463346eef33bSBradecho "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak 4634a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 4635f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 4636e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 4637e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 4638e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 4639e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 4640e39f0062SPaolo Bonzinifi 464142da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 464242da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 464342da6041SGerd Hoffmannelse 464442da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 464542da6041SGerd Hoffmannfi 4646e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 464746eef33bSBradecho "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak 464837746c5eSMarc-André Lureauecho "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak 464973da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 46503e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 4651804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 465217969268SFam Zhengecho "DSOSUF=$DSOSUF" >> $config_host_mak 465317969268SFam Zhengecho "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak 4654957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 465594dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 4656cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 46571d728c39SBlue Swirlif test "$gcov" = "yes" ; then 46581d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 46591d728c39SBlue Swirl echo "GCOV=$gcov_tool" >> $config_host_mak 46601d728c39SBlue Swirlfi 4661804edf29SJuan Quintela 46626efd7517SPeter Maydell# use included Linux headers 46636efd7517SPeter Maydellif test "$linux" = "yes" ; then 4664a307beb6SAndreas Färber mkdir -p linux-headers 46656efd7517SPeter Maydell case "$cpu" in 4666c72b26ecSRichard Henderson i386|x86_64|x32) 466708312a63SPeter Maydell linux_arch=x86 46686efd7517SPeter Maydell ;; 46696efd7517SPeter Maydell ppcemb|ppc|ppc64) 467008312a63SPeter Maydell linux_arch=powerpc 46716efd7517SPeter Maydell ;; 46726efd7517SPeter Maydell s390x) 467308312a63SPeter Maydell linux_arch=s390 467408312a63SPeter Maydell ;; 46751f080313SClaudio Fontana aarch64) 46761f080313SClaudio Fontana linux_arch=arm64 46771f080313SClaudio Fontana ;; 467808312a63SPeter Maydell *) 467908312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 468008312a63SPeter Maydell linux_arch="$cpu" 46816efd7517SPeter Maydell ;; 46826efd7517SPeter Maydell esac 468308312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 468408312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 468508312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 468608312a63SPeter Maydell fi 46876efd7517SPeter Maydellfi 46886efd7517SPeter Maydell 468997a847bcSbellardfor target in $target_list; do 469097a847bcSbellardtarget_dir="$target" 469125be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 4692c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1` 469397a847bcSbellardtarget_bigendian="no" 46941f3d3c8fSJuan Quintela 4695c1799a84SPaolo Bonzinicase "$target_name" in 4696d15a9c23SAnthony Green armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 4697ea2d6a39SJuan Quintela target_bigendian=yes 4698ea2d6a39SJuan Quintela ;; 4699ea2d6a39SJuan Quintelaesac 470097a847bcSbellardtarget_softmmu="no" 4701997344f3Sbellardtarget_user_only="no" 4702831b7825Sthstarget_linux_user="no" 470384778508Sblueswir1target_bsd_user="no" 47049e407a85Spbrookcase "$target" in 4705c1799a84SPaolo Bonzini ${target_name}-softmmu) 47069e407a85Spbrook target_softmmu="yes" 47079e407a85Spbrook ;; 4708c1799a84SPaolo Bonzini ${target_name}-linux-user) 47099c7a4202SBlue Swirl if test "$linux" != "yes" ; then 471076ad07a4SPeter Maydell error_exit "Target '$target' is only available on a Linux host" 47119c7a4202SBlue Swirl fi 47129e407a85Spbrook target_user_only="yes" 47139e407a85Spbrook target_linux_user="yes" 47149e407a85Spbrook ;; 4715c1799a84SPaolo Bonzini ${target_name}-bsd-user) 47169cf55765SBlue Swirl if test "$bsd" != "yes" ; then 471776ad07a4SPeter Maydell error_exit "Target '$target' is only available on a BSD host" 47189c7a4202SBlue Swirl fi 471984778508Sblueswir1 target_user_only="yes" 472084778508Sblueswir1 target_bsd_user="yes" 472184778508Sblueswir1 ;; 47229e407a85Spbrook *) 472376ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 47249e407a85Spbrook exit 1 47259e407a85Spbrook ;; 47269e407a85Spbrookesac 4727831b7825Sths 472897a847bcSbellardmkdir -p $target_dir 472925be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 473097a847bcSbellard 4731e5fe0c52Spbrookbflt="no" 4732c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"` 473356aebc89Spbrookgdb_xml_files="" 47347ba1e619Saliguori 4735c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 47366acff7daSJuan QuintelaTARGET_BASE_ARCH="" 4737e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 4738e73aae67SJuan Quintela 4739c1799a84SPaolo Bonzinicase "$target_name" in 47402408a527Saurel32 i386) 47412408a527Saurel32 ;; 47422408a527Saurel32 x86_64) 47436acff7daSJuan Quintela TARGET_BASE_ARCH=i386 47442408a527Saurel32 ;; 47452408a527Saurel32 alpha) 47462408a527Saurel32 ;; 47472408a527Saurel32 arm|armeb) 4748b498c8a0SJuan Quintela TARGET_ARCH=arm 4749e5fe0c52Spbrook bflt="yes" 475056aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 47512408a527Saurel32 ;; 47526a49fa95SAlexander Graf aarch64) 47536a49fa95SAlexander Graf TARGET_BASE_ARCH=arm 47546a49fa95SAlexander Graf bflt="yes" 47556a669427SPeter Maydell gdb_xml_files="aarch64-core.xml aarch64-fpu.xml" 47566a49fa95SAlexander Graf ;; 47572408a527Saurel32 cris) 47582408a527Saurel32 ;; 4759613a22c9SMichael Walle lm32) 4760613a22c9SMichael Walle ;; 47612408a527Saurel32 m68k) 47620938cda5Saurel32 bflt="yes" 476356aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 47642408a527Saurel32 ;; 4765877fdc12SEdgar E. Iglesias microblaze|microblazeel) 4766877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 476772b675caSEdgar E. Iglesias bflt="yes" 476872b675caSEdgar E. Iglesias ;; 47692408a527Saurel32 mips|mipsel) 4770b498c8a0SJuan Quintela TARGET_ARCH=mips 477125be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 47722408a527Saurel32 ;; 47732408a527Saurel32 mipsn32|mipsn32el) 4774597e2cecSRichard Henderson TARGET_ARCH=mips64 47756acff7daSJuan Quintela TARGET_BASE_ARCH=mips 477625be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 4777597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 47782408a527Saurel32 ;; 47792408a527Saurel32 mips64|mips64el) 4780b498c8a0SJuan Quintela TARGET_ARCH=mips64 47816acff7daSJuan Quintela TARGET_BASE_ARCH=mips 478225be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 47832408a527Saurel32 ;; 4784d15a9c23SAnthony Green moxie) 4785d15a9c23SAnthony Green ;; 4786e67db06eSJia Liu or32) 4787e67db06eSJia Liu TARGET_ARCH=openrisc 4788e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 4789e67db06eSJia Liu ;; 47902408a527Saurel32 ppc) 4791c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 47922408a527Saurel32 ;; 47932408a527Saurel32 ppcemb) 47946acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 4795e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 4796c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 47972408a527Saurel32 ;; 47982408a527Saurel32 ppc64) 47996acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 4800e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 4801c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 48022408a527Saurel32 ;; 48032408a527Saurel32 ppc64abi32) 4804b498c8a0SJuan Quintela TARGET_ARCH=ppc64 48056acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 4806e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 480725be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 4808c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 48092408a527Saurel32 ;; 48102408a527Saurel32 sh4|sh4eb) 4811b498c8a0SJuan Quintela TARGET_ARCH=sh4 48124dbed897Spbrook bflt="yes" 48132408a527Saurel32 ;; 48142408a527Saurel32 sparc) 48152408a527Saurel32 ;; 48162408a527Saurel32 sparc64) 48176acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 48182408a527Saurel32 ;; 48192408a527Saurel32 sparc32plus) 4820b498c8a0SJuan Quintela TARGET_ARCH=sparc64 48216acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 4822e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 482325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 48242408a527Saurel32 ;; 482524e804ecSAlexander Graf s390x) 482624e804ecSAlexander Graf ;; 4827d2fbca94SGuan Xuetao unicore32) 4828d2fbca94SGuan Xuetao ;; 4829cfa550c6SMax Filippov xtensa|xtensaeb) 4830cfa550c6SMax Filippov TARGET_ARCH=xtensa 4831cfa550c6SMax Filippov ;; 48322408a527Saurel32 *) 483376ad07a4SPeter Maydell error_exit "Unsupported target CPU" 48342408a527Saurel32 ;; 48352408a527Saurel32esac 48365e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 48375e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 48385e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 48395e8861a0SPaolo Bonzinifi 48405e8861a0SPaolo Bonzini 48415e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 48425e8861a0SPaolo Bonzini 484399afc91dSDaniel P. Berrangeupper() { 484499afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 484599afc91dSDaniel P. Berrange} 484699afc91dSDaniel P. Berrange 484799afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`" 484825be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 4849c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 485025be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 4851e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 4852e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 4853e6e91b9cSJuan Quintelafi 485425be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 4855c1799a84SPaolo Bonzinicase "$target_name" in 48561b0c87fcSJuan Quintela i386|x86_64) 48571b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 485825be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 4859eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 4860eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 4861eb6fda0fSAnthony PERARD fi 4862432d268cSJun Nakajima fi 486359d21e53SAlexander Graf ;; 486459d21e53SAlexander Graf *) 48651b0c87fcSJuan Quintelaesac 4866c1799a84SPaolo Bonzinicase "$target_name" in 486770a5f682SPeter Maydell aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x) 4868c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 4869c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 4870c1799a84SPaolo Bonzini \( "$target_name" = "$cpu" -o \ 4871c1799a84SPaolo Bonzini \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 4872c1799a84SPaolo Bonzini \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \ 4873c1799a84SPaolo Bonzini \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \ 4874c1799a84SPaolo Bonzini \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 4875c1799a84SPaolo Bonzini \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \ 4876c1799a84SPaolo Bonzini \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then 487725be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 48781ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 4879d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 4880d5970055SMichael S. Tsirkin fi 4881c59249f9SJuan Quintela fi 4882c59249f9SJuan Quintelaesac 4883de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 488425be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 488597a847bcSbellardfi 488697a847bcSbellardif test "$target_softmmu" = "yes" ; then 488725be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 4888de83cd02Sbellardfi 4889997344f3Sbellardif test "$target_user_only" = "yes" ; then 489025be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 4891a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 4892997344f3Sbellardfi 4893831b7825Sthsif test "$target_linux_user" = "yes" ; then 489425be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 4895831b7825Sthsfi 489656aebc89Spbrooklist="" 489756aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 489856aebc89Spbrook for x in $gdb_xml_files; do 489956aebc89Spbrook list="$list $source_path/gdb-xml/$x" 490056aebc89Spbrook done 490125be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 49023d0f1517SJuan Quintelafi 4903de83cd02Sbellard 4904e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 490525be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 4906e5fe0c52Spbrookfi 4907379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 490825be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 4909379f6698SPaul Brookfi 491084778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 491125be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 491284778508Sblueswir1fi 49135b0753e0Sbellard 49144afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 4915fa282484SJuan Quintela 49164afddb55SJuan Quintelacflags="" 4917fa282484SJuan Quintelaldflags="" 49189b8e111fSJuan Quintela 491964656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 492064656024SJuan Quintela case "$i" in 492164656024SJuan Quintela alpha) 492225be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 492376cad711SPaolo Bonzini echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak 492464656024SJuan Quintela ;; 492564656024SJuan Quintela arm) 492625be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 492776cad711SPaolo Bonzini echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak 4928999b53ecSClaudio Fontana if test -n "${cxx}"; then 4929999b53ecSClaudio Fontana echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak 4930999b53ecSClaudio Fontana echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak 4931999b53ecSClaudio Fontana fi 493264656024SJuan Quintela ;; 493364656024SJuan Quintela cris) 493425be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 493576cad711SPaolo Bonzini echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak 493664656024SJuan Quintela ;; 493764656024SJuan Quintela hppa) 493825be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 493976cad711SPaolo Bonzini echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak 494064656024SJuan Quintela ;; 4941c72b26ecSRichard Henderson i386|x86_64|x32) 494225be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 494376cad711SPaolo Bonzini echo "CONFIG_I386_DIS=y" >> config-all-disas.mak 494464656024SJuan Quintela ;; 4945903ec55cSAurelien Jarno ia64*) 4946903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 494776cad711SPaolo Bonzini echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak 4948903ec55cSAurelien Jarno ;; 494979368f49SMichael Walle lm32) 495079368f49SMichael Walle echo "CONFIG_LM32_DIS=y" >> $config_target_mak 495176cad711SPaolo Bonzini echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak 495279368f49SMichael Walle ;; 495364656024SJuan Quintela m68k) 495425be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 495576cad711SPaolo Bonzini echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak 495664656024SJuan Quintela ;; 4957877fdc12SEdgar E. Iglesias microblaze*) 495825be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 495976cad711SPaolo Bonzini echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak 496064656024SJuan Quintela ;; 496164656024SJuan Quintela mips*) 496225be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 496376cad711SPaolo Bonzini echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak 496464656024SJuan Quintela ;; 4965d15a9c23SAnthony Green moxie*) 4966d15a9c23SAnthony Green echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak 4967d15a9c23SAnthony Green echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak 4968d15a9c23SAnthony Green ;; 4969e67db06eSJia Liu or32) 4970e67db06eSJia Liu echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak 497176cad711SPaolo Bonzini echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak 4972e67db06eSJia Liu ;; 497364656024SJuan Quintela ppc*) 497425be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 497576cad711SPaolo Bonzini echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak 497664656024SJuan Quintela ;; 497724e804ecSAlexander Graf s390*) 497825be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 497976cad711SPaolo Bonzini echo "CONFIG_S390_DIS=y" >> config-all-disas.mak 498064656024SJuan Quintela ;; 498164656024SJuan Quintela sh4) 498225be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 498376cad711SPaolo Bonzini echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak 498464656024SJuan Quintela ;; 498564656024SJuan Quintela sparc*) 498625be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 498776cad711SPaolo Bonzini echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak 498864656024SJuan Quintela ;; 4989cfa550c6SMax Filippov xtensa*) 4990cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 499176cad711SPaolo Bonzini echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak 4992cfa550c6SMax Filippov ;; 499364656024SJuan Quintela esac 499464656024SJuan Quinteladone 49959195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 49969195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 499776cad711SPaolo Bonzini echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak 49989195b2c2SStefan Weilfi 499964656024SJuan Quintela 50006ee7126fSJuan Quintelacase "$ARCH" in 50016ee7126fSJuan Quintelaalpha) 50026ee7126fSJuan Quintela # Ensure there's only a single GP 50036ee7126fSJuan Quintela cflags="-msmall-data $cflags" 50046ee7126fSJuan Quintela;; 50056ee7126fSJuan Quintelaesac 50066ee7126fSJuan Quintela 5007d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 500825be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 5009d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 5010d02c1db3SJuan Quintela cflags="-p $cflags" 5011d02c1db3SJuan Quintela ldflags="-p $ldflags" 5012d02c1db3SJuan Quintela fi 5013d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 5014d02c1db3SJuan Quintela ldflags="-p $ldflags" 501525be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 5016d02c1db3SJuan Quintela fi 5017d02c1db3SJuan Quintelafi 5018d02c1db3SJuan Quintela 50199b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 5020964c6fa1SRichard Henderson ldflags="$ldflags $textseg_ldflags" 5021fa282484SJuan Quintelafi 5022fa282484SJuan Quintela 502325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 502425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 5025fa282484SJuan Quintela 502697a847bcSbellarddone # for target in $targets 50277d13299dSbellard 5028b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then 5029b776eca1SGerd Hoffmann echo "config-host.h: subdir-pixman" >> $config_host_mak 5030b776eca1SGerd Hoffmannfi 5031b776eca1SGerd Hoffmann 50322da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 50332da776dbSMichael R. Hinesecho "CONFIG_RDMA=y" >> $config_host_mak 50342da776dbSMichael R. Hinesfi 50352da776dbSMichael R. Hines 5036a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then 5037a540f158SPeter Crosthwaite echo "config-host.h: subdir-dtc" >> $config_host_mak 5038a540f158SPeter Crosthwaitefi 5039a540f158SPeter Crosthwaite 5040d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 5041f93296eaSWenchao XiaDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests" 50422b170effSMichael TokarevDIRS="$DIRS fsdev" 50439933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" 50442d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 50452dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated" 5046c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 5047c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 5048aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" 5049ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 5050446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 50519933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile" 50522d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 50534652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp" 5054753d11f2SRichard Hendersonfor bios_file in \ 5055753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 50565acc2ec0SGerd Hoffmann $source_path/pc-bios/*.aml \ 5057753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 5058753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 5059e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 5060753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 5061753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 5062753d11f2SRichard Hendersondo 50637ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 50647ea78b74SJan Kiszkadone 5065c2304b52SMarcel Apfelbaumfor test_file in `find $source_path/tests/acpi-test-data -type f` 5066c2304b52SMarcel Apfelbaumdo 5067c2304b52SMarcel Apfelbaum FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`" 5068c2304b52SMarcel Apfelbaumdone 5069d1807a4fSPaolo Bonzinimkdir -p $DIRS 50707d13299dSbellardfor f in $FILES ; do 507172b8b5a1SStefan Weil if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then 5072f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 5073f9245e10SPeter Maydell fi 50747d13299dSbellarddone 50751ad2134fSPaul Brook 5076c34ebfdcSAnthony Liguori# temporary config to build submodules 50772d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 5078c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 507937116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 5080c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 50813dd46c78SBlue Swirl echo "AS=$as" >> $config_mak 5082c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 5083c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 50843dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 5085c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 5086a31a8642SMichael S. Tsirkin echo "IASL=$iasl" >> $config_mak 5087c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 5088c34ebfdcSAnthony Liguoridone 5089c34ebfdcSAnthony Liguori 5090b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 5091b40292e7SJan Kiszka mkdir -p QMP 5092b40292e7SJan Kiszkafi 5093