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" 153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" 16a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" 177d13299dSbellard 180ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells; 190ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> 200ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM 21da1d85e3SGerd Hoffmannrm -f config.log 229ac81bbbSmalc 23b48e3611SPeter Maydell# Print a helpful header at the top of config.log 24b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 25979ae168SPeter Maydellprintf "# Configured with:" >> config.log 26979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 27979ae168SPeter Maydellecho >> config.log 28b48e3611SPeter Maydellecho "#" >> config.log 29b48e3611SPeter Maydell 3076ad07a4SPeter Maydellerror_exit() { 3176ad07a4SPeter Maydell echo 3276ad07a4SPeter Maydell echo "ERROR: $1" 3376ad07a4SPeter Maydell while test -n "$2"; do 3476ad07a4SPeter Maydell echo " $2" 3576ad07a4SPeter Maydell shift 3676ad07a4SPeter Maydell done 3776ad07a4SPeter Maydell echo 3876ad07a4SPeter Maydell exit 1 3976ad07a4SPeter Maydell} 4076ad07a4SPeter Maydell 418dc38a78SPeter Maydelldo_cc() { 428dc38a78SPeter Maydell # Run the compiler, capturing its output to the log. 438dc38a78SPeter Maydell echo $cc "$@" >> config.log 448dc38a78SPeter Maydell $cc "$@" >> config.log 2>&1 || return $? 458dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 468dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 478dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 488dc38a78SPeter Maydell # obvious to developers. 498dc38a78SPeter Maydell if test "$werror" != "yes"; then 508dc38a78SPeter Maydell return 0 518dc38a78SPeter Maydell fi 528dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 538dc38a78SPeter Maydell case "$*" in 548dc38a78SPeter Maydell *-Werror*) 558dc38a78SPeter Maydell return 0 568dc38a78SPeter Maydell ;; 578dc38a78SPeter Maydell esac 588dc38a78SPeter Maydell echo $cc -Werror "$@" >> config.log 598dc38a78SPeter Maydell $cc -Werror "$@" >> config.log 2>&1 && return $? 6076ad07a4SPeter Maydell error_exit "configure test passed without -Werror but failed with -Werror." \ 6176ad07a4SPeter Maydell "This is probably a bug in the configure script. The failing command" \ 6276ad07a4SPeter Maydell "will be at the bottom of config.log." \ 6376ad07a4SPeter Maydell "You can run configure with --disable-werror to bypass this check." 648dc38a78SPeter Maydell} 658dc38a78SPeter Maydell 6652166aa0SJuan Quintelacompile_object() { 678dc38a78SPeter Maydell do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC 6852166aa0SJuan Quintela} 6952166aa0SJuan Quintela 7052166aa0SJuan Quintelacompile_prog() { 7152166aa0SJuan Quintela local_cflags="$1" 7252166aa0SJuan Quintela local_ldflags="$2" 738dc38a78SPeter Maydell do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags 7452166aa0SJuan Quintela} 7552166aa0SJuan Quintela 7611568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 7711568d6dSPaolo Bonzinisymlink() { 7872b8b5a1SStefan Weil rm -rf "$2" 79ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 8072b8b5a1SStefan Weil ln -s "$1" "$2" 8111568d6dSPaolo Bonzini} 8211568d6dSPaolo Bonzini 830dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 840dba6195SLoïc Minier# executable or a builtin) 850dba6195SLoïc Minierhas() { 860dba6195SLoïc Minier type "$1" >/dev/null 2>&1 870dba6195SLoïc Minier} 880dba6195SLoïc Minier 890dba6195SLoïc Minier# search for an executable in PATH 900dba6195SLoïc Minierpath_of() { 910dba6195SLoïc Minier local_command="$1" 920dba6195SLoïc Minier local_ifs="$IFS" 930dba6195SLoïc Minier local_dir="" 940dba6195SLoïc Minier 950dba6195SLoïc Minier # pathname has a dir component? 960dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 970dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 980dba6195SLoïc Minier echo "$local_command" 990dba6195SLoïc Minier return 0 1000dba6195SLoïc Minier fi 1010dba6195SLoïc Minier fi 1020dba6195SLoïc Minier if [ -z "$local_command" ]; then 1030dba6195SLoïc Minier return 1 1040dba6195SLoïc Minier fi 1050dba6195SLoïc Minier 1060dba6195SLoïc Minier IFS=: 1070dba6195SLoïc Minier for local_dir in $PATH; do 1080dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 1090dba6195SLoïc Minier echo "$local_dir/$local_command" 1100dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1110dba6195SLoïc Minier return 0 1120dba6195SLoïc Minier fi 1130dba6195SLoïc Minier done 1140dba6195SLoïc Minier # not found 1150dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1160dba6195SLoïc Minier return 1 1170dba6195SLoïc Minier} 1180dba6195SLoïc Minier 1197d13299dSbellard# default parameters 120ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 1212ff6b91eSJuan Quintelacpu="" 1221e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 12343ce4dfeSbellardstatic="no" 1247d13299dSbellardcross_prefix="" 1250c58ac1cSmalcaudio_drv_list="" 126b64ec4e4SFam Zhengblock_drv_rw_whitelist="" 127b64ec4e4SFam Zhengblock_drv_ro_whitelist="" 128e49d021eSPeter Maydellhost_cc="cc" 12973da375eSJuan Quintelalibs_softmmu="" 1303e2e0e6bSJuan Quintelalibs_tools="" 13167f86e8eSJuan Quintelaaudio_pt_int="" 132d5631638Smalcaudio_win_int="" 1332b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 134957f1f99SMichael Rothlibs_qga="" 1355bc62e01SGerd Hoffmanndebug_info="yes" 136ac0df51dSaliguori 137afb63ebdSStefan Weil# Don't accept a target_list environment variable. 138afb63ebdSStefan Weilunset target_list 139377529c0SPaolo Bonzini 140377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 141377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 142377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 143377529c0SPaolo Bonzini# unless --disable-foo is given 144377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 145377529c0SPaolo Bonzini# feature will searched for, 146377529c0SPaolo Bonzini# if not found, configure exits with error 147377529c0SPaolo Bonzini# 148377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 149377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 150377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 151377529c0SPaolo Bonzini 152377529c0SPaolo Bonzinibluez="" 153377529c0SPaolo Bonzinibrlapi="" 154377529c0SPaolo Bonzinicurl="" 155377529c0SPaolo Bonzinicurses="" 156377529c0SPaolo Bonzinidocs="" 157377529c0SPaolo Bonzinifdt="" 158e2134eb9SGerd Hoffmannpixman="" 159377529c0SPaolo Bonzinisdl="" 160983eef5aSMeador Ingevirtfs="" 161821601eaSJes Sorensenvnc="yes" 162377529c0SPaolo Bonzinisparse="no" 163377529c0SPaolo Bonziniuuid="" 164377529c0SPaolo Bonzinivde="" 165377529c0SPaolo Bonzinivnc_tls="" 166377529c0SPaolo Bonzinivnc_sasl="" 167377529c0SPaolo Bonzinivnc_jpeg="" 168377529c0SPaolo Bonzinivnc_png="" 1697536ee4bSTim Hardeckvnc_ws="" 170377529c0SPaolo Bonzinixen="" 171d5b93ddfSAnthony PERARDxen_ctrl_version="" 172eb6fda0fSAnthony PERARDxen_pci_passthrough="" 173377529c0SPaolo Bonzinilinux_aio="" 17447e98658SCorey Bryantcap_ng="" 175377529c0SPaolo Bonziniattr="" 1764f26f2b6SAvi Kivitylibattr="" 177377529c0SPaolo Bonzinixfs="" 178377529c0SPaolo Bonzini 179d41a75a2SBradvhost_net="no" 1805e9be92dSNicholas Bellingervhost_scsi="no" 181d41a75a2SBradkvm="no" 1822da776dbSMichael R. Hinesrdma="" 183377529c0SPaolo Bonzinigprof="no" 184377529c0SPaolo Bonzinidebug_tcg="no" 185377529c0SPaolo Bonzinidebug="no" 186377529c0SPaolo Bonzinistrip_opt="yes" 1879195b2c2SStefan Weiltcg_interpreter="no" 188377529c0SPaolo Bonzinibigendian="no" 189377529c0SPaolo Bonzinimingw32="no" 1901d728c39SBlue Swirlgcov="no" 1911d728c39SBlue Swirlgcov_tool="gcov" 192377529c0SPaolo BonziniEXESUF="" 193377529c0SPaolo Bonziniprefix="/usr/local" 194377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 195528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 196850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 197377529c0SPaolo Bonzinibindir="\${prefix}/bin" 1983aa5d2beSAlon Levylibdir="\${prefix}/lib" 1998bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 2000f94d6daSAlon Levyincludedir="\${prefix}/include" 201377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 202785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 203377529c0SPaolo Bonziniconfsuffix="/qemu" 204377529c0SPaolo Bonzinislirp="yes" 205377529c0SPaolo Bonzinifmod_lib="" 206377529c0SPaolo Bonzinifmod_inc="" 207377529c0SPaolo Bonzinioss_lib="" 208377529c0SPaolo Bonzinibsd="no" 209377529c0SPaolo Bonzinilinux="no" 210377529c0SPaolo Bonzinisolaris="no" 211377529c0SPaolo Bonziniprofiler="no" 212377529c0SPaolo Bonzinicocoa="no" 213377529c0SPaolo Bonzinisoftmmu="yes" 214377529c0SPaolo Bonzinilinux_user="no" 215377529c0SPaolo Bonzinibsd_user="no" 21630163d89SPeter Maydellguest_base="yes" 217377529c0SPaolo Bonziniuname_release="" 218377529c0SPaolo Bonzinimixemu="no" 219377529c0SPaolo Bonziniaix="no" 220377529c0SPaolo Bonziniblobs="yes" 221377529c0SPaolo Bonzinipkgversion="" 22240d6444eSAvi Kivitypie="" 223377529c0SPaolo Bonzinizero_malloc="" 2243556c233SPaolo Bonziniqom_cast_debug="yes" 225377529c0SPaolo Bonzinitrace_backend="nop" 226377529c0SPaolo Bonzinitrace_file="trace" 227377529c0SPaolo Bonzinispice="" 228377529c0SPaolo Bonzinirbd="" 229111a38b0SRobert Relyeasmartcard_nss="" 2302b2325ffSGerd Hoffmannlibusb="" 23169354a83SHans de Goedeusb_redir="" 232b1e5fff4SMichael Walleglx="" 2331ece9905SAlon Levyzlib="yes" 234*e8ef31a3SMichael Tokarevguest_agent="" 2354b1c11fdSDaniel P. Berrangewant_tools="yes" 236c589b249SRonnie Sahlberglibiscsi="" 237519175a2SAlex Barcelocoroutine="" 238f794573eSEduardo Otuboseccomp="" 239eb100396SBharata B Raoglusterfs="" 2400c14fb47SBharata B Raoglusterfs_discard="no" 241583f6e7bSStefan Hajnoczivirtio_blk_data_plane="" 242a4ccabcfSAnthony Liguorigtk="" 243528de90aSDaniel P. Berrangegtkabi="2.0" 244ab214c29SStefan Bergertpm="no" 2450a12ec87SRichard W.M. Joneslibssh2="" 246377529c0SPaolo Bonzini 247ac0df51dSaliguori# parse CC options first 248ac0df51dSaliguorifor opt do 249ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 250ac0df51dSaliguori case "$opt" in 251ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 252ac0df51dSaliguori ;; 2533d8df640SPaolo Bonzini --cc=*) CC="$optarg" 254ac0df51dSaliguori ;; 255ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 256ca4deeb1SPaolo Bonzini ;; 2572ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 2582ff6b91eSJuan Quintela ;; 259a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 260f9943cd5SGerd Hoffmann EXTRA_CFLAGS="$optarg" 261e2a2ed06SJuan Quintela ;; 262e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 263f9943cd5SGerd Hoffmann EXTRA_LDFLAGS="$optarg" 264e2a2ed06SJuan Quintela ;; 2655bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 2665bc62e01SGerd Hoffmann ;; 2675bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 2685bc62e01SGerd Hoffmann ;; 269ac0df51dSaliguori esac 270ac0df51dSaliguoridone 271ac0df51dSaliguori# OS specific 272ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 27393148aa5SStefan Weil# we can eliminate its usage altogether. 274ac0df51dSaliguori 275e49d021eSPeter Maydell# Preferred compiler: 276e49d021eSPeter Maydell# ${CC} (if set) 277e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 278e49d021eSPeter Maydell# system compiler 279e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 280e49d021eSPeter Maydell cc="$host_cc" 281e49d021eSPeter Maydellelse 282b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 283e49d021eSPeter Maydellfi 284e49d021eSPeter Maydell 285b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 2863dd46c78SBlue Swirlas="${AS-${cross_prefix}as}" 2873dd46c78SBlue Swirlcpp="${CPP-$cc -E}" 288b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 289b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 2903f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}" 291b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 292b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 29317884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 29417884d7bSSergei Trofimovichquery_pkg_config() { 29517884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 29617884d7bSSergei Trofimovich} 29717884d7bSSergei Trofimovichpkg_config=query_pkg_config 298b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 299ac0df51dSaliguori 300be17dc90SMichael S. Tsirkin# default flags for all hosts 301be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 302f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 303c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 304be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 3056b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include" 3065bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 3075bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 308be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 3095bc62e01SGerd Hoffmannfi 310be17dc90SMichael S. Tsirkin 311ca4deeb1SPaolo Bonzini# make source path absolute 312ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 313ca4deeb1SPaolo Bonzini 314ac0df51dSaliguoricheck_define() { 315ac0df51dSaliguoricat > $TMPC <<EOF 316ac0df51dSaliguori#if !defined($1) 317fd786e1aSPeter Maydell#error $1 not defined 318ac0df51dSaliguori#endif 319ac0df51dSaliguoriint main(void) { return 0; } 320ac0df51dSaliguoriEOF 32152166aa0SJuan Quintela compile_object 322ac0df51dSaliguori} 323ac0df51dSaliguori 324bbea4050SPeter Maydellif check_define __linux__ ; then 325bbea4050SPeter Maydell targetos="Linux" 326bbea4050SPeter Maydellelif check_define _WIN32 ; then 327bbea4050SPeter Maydell targetos='MINGW32' 328bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 329bbea4050SPeter Maydell targetos='OpenBSD' 330bbea4050SPeter Maydellelif check_define __sun__ ; then 331bbea4050SPeter Maydell targetos='SunOS' 332bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 333bbea4050SPeter Maydell targetos='Haiku' 334bbea4050SPeter Maydellelse 335bbea4050SPeter Maydell targetos=`uname -s` 336bbea4050SPeter Maydellfi 337bbea4050SPeter Maydell 338bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 339bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 340bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 341bbea4050SPeter Maydell# the correct CPU with the --cpu option. 342bbea4050SPeter Maydellcase $targetos in 343bbea4050SPeter MaydellDarwin) 344bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 345bbea4050SPeter Maydell # run 64-bit userspace code. 346bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 347bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 348bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 349bbea4050SPeter Maydell cpu="x86_64" 350bbea4050SPeter Maydell fi 351bbea4050SPeter Maydell ;; 352bbea4050SPeter MaydellSunOS) 353bbea4050SPeter Maydell # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo 354bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 355bbea4050SPeter Maydell cpu="x86_64" 356bbea4050SPeter Maydell fi 357bbea4050SPeter Maydellesac 358bbea4050SPeter Maydell 3592ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 3602ff6b91eSJuan Quintela # command line argument 3612ff6b91eSJuan Quintela : 3622ff6b91eSJuan Quintelaelif check_define __i386__ ; then 363ac0df51dSaliguori cpu="i386" 364ac0df51dSaliguorielif check_define __x86_64__ ; then 365ac0df51dSaliguori cpu="x86_64" 3663aa9bd6cSblueswir1elif check_define __sparc__ ; then 3673aa9bd6cSblueswir1 if check_define __arch64__ ; then 3683aa9bd6cSblueswir1 cpu="sparc64" 3693aa9bd6cSblueswir1 else 3703aa9bd6cSblueswir1 cpu="sparc" 3713aa9bd6cSblueswir1 fi 372fdf7ed96Smalcelif check_define _ARCH_PPC ; then 373fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 374fdf7ed96Smalc cpu="ppc64" 375ac0df51dSaliguori else 376fdf7ed96Smalc cpu="ppc" 377fdf7ed96Smalc fi 378afa05235SAurelien Jarnoelif check_define __mips__ ; then 379afa05235SAurelien Jarno cpu="mips" 380477ba620SAurelien Jarnoelif check_define __ia64__ ; then 381477ba620SAurelien Jarno cpu="ia64" 382d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 383d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 384d66ed0eaSAurelien Jarno cpu="s390x" 385d66ed0eaSAurelien Jarno else 386d66ed0eaSAurelien Jarno cpu="s390" 387d66ed0eaSAurelien Jarno fi 38821d89f84SPeter Maydellelif check_define __arm__ ; then 38921d89f84SPeter Maydell cpu="arm" 3901f080313SClaudio Fontanaelif check_define __aarch64__ ; then 3911f080313SClaudio Fontana cpu="aarch64" 392f28ffed5SBradelif check_define __hppa__ ; then 393f28ffed5SBrad cpu="hppa" 394fdf7ed96Smalcelse 395fdf7ed96Smalc cpu=`uname -m` 396ac0df51dSaliguorifi 397ac0df51dSaliguori 398359bc95dSPeter MaydellARCH= 399359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 400359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 4017d13299dSbellardcase "$cpu" in 402359bc95dSPeter Maydell ia64|ppc|ppc64|s390|s390x|sparc64) 403ea8f20f8SJuan Quintela cpu="$cpu" 404ea8f20f8SJuan Quintela ;; 4057d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 40697a847bcSbellard cpu="i386" 4077d13299dSbellard ;; 408aaa5fa14Saurel32 x86_64|amd64) 409aaa5fa14Saurel32 cpu="x86_64" 410aaa5fa14Saurel32 ;; 41121d89f84SPeter Maydell armv*b|armv*l|arm) 41221d89f84SPeter Maydell cpu="arm" 4137d13299dSbellard ;; 4141f080313SClaudio Fontana aarch64) 4151f080313SClaudio Fontana cpu="aarch64" 4161f080313SClaudio Fontana ;; 417f28ffed5SBrad hppa|parisc|parisc64) 418f54b3f92Saurel32 cpu="hppa" 419f54b3f92Saurel32 ;; 420afa05235SAurelien Jarno mips*) 421afa05235SAurelien Jarno cpu="mips" 422afa05235SAurelien Jarno ;; 4233142255cSblueswir1 sparc|sun4[cdmuv]) 424ae228531Sbellard cpu="sparc" 425ae228531Sbellard ;; 4267d13299dSbellard *) 427359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 428359bc95dSPeter Maydell ARCH=unknown 4297d13299dSbellard ;; 4307d13299dSbellardesac 431359bc95dSPeter Maydellif test -z "$ARCH"; then 432359bc95dSPeter Maydell ARCH="$cpu" 433359bc95dSPeter Maydellfi 434e2d52ad3SJuan Quintela 4357d13299dSbellard# OS specific 4360dbfc675SJuan Quintela 4377d13299dSbellardcase $targetos in 438c326e0afSbellardCYGWIN*) 439c326e0afSbellard mingw32="yes" 440a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 441d5631638Smalc audio_possible_drivers="winwave sdl" 442d5631638Smalc audio_drv_list="winwave" 443c326e0afSbellard;; 44467b915a5SbellardMINGW32*) 44567b915a5Sbellard mingw32="yes" 446d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 447d5631638Smalc audio_drv_list="winwave" 44867b915a5Sbellard;; 4495c40d2bdSthsGNU/kFreeBSD) 450a167ba50SAurelien Jarno bsd="yes" 4510c58ac1cSmalc audio_drv_list="oss" 452f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 4535c40d2bdSths;; 4547d3505c5SbellardFreeBSD) 4557d3505c5Sbellard bsd="yes" 4560db4a067SPaolo Bonzini make="${MAKE-gmake}" 4570c58ac1cSmalc audio_drv_list="oss" 458f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 459f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 460f01576f1SJuergen Lock LIBS="-lutil $LIBS" 4617d3505c5Sbellard;; 462c5e97233Sblueswir1DragonFly) 463c5e97233Sblueswir1 bsd="yes" 4640db4a067SPaolo Bonzini make="${MAKE-gmake}" 465c5e97233Sblueswir1 audio_drv_list="oss" 466c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 467c5e97233Sblueswir1;; 4687d3505c5SbellardNetBSD) 4697d3505c5Sbellard bsd="yes" 4700db4a067SPaolo Bonzini make="${MAKE-gmake}" 4710c58ac1cSmalc audio_drv_list="oss" 472c2de5c91Smalc audio_possible_drivers="oss sdl esd" 4738ef92a88Sblueswir1 oss_lib="-lossaudio" 4747d3505c5Sbellard;; 4757d3505c5SbellardOpenBSD) 4767d3505c5Sbellard bsd="yes" 4770db4a067SPaolo Bonzini make="${MAKE-gmake}" 4784f6ab397SBrad Smith audio_drv_list="sdl" 4794f6ab397SBrad Smith audio_possible_drivers="sdl esd" 4807d3505c5Sbellard;; 48183fb7adfSbellardDarwin) 48283fb7adfSbellard bsd="yes" 48383fb7adfSbellard darwin="yes" 4841b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 485a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4860c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4871b0f9cc2Saliguori else 488a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4891b0f9cc2Saliguori fi 490fd677642Sths cocoa="yes" 4910c58ac1cSmalc audio_drv_list="coreaudio" 492c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4930c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4947973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 495a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 496a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 497a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 49883fb7adfSbellard;; 499ec530c81SbellardSunOS) 500ec530c81Sbellard solaris="yes" 5010db4a067SPaolo Bonzini make="${MAKE-gmake}" 5020db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 503fa58948dSBlue Swirl ld="gld" 504e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 5050475a5caSths needs_libsunmath="no" 506c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 507c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 5080475a5caSths if test "$solarisrev" -le 9 ; then 5090475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 5100475a5caSths needs_libsunmath="yes" 511f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 512f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 513f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 5140475a5caSths else 51576ad07a4SPeter Maydell error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \ 51676ad07a4SPeter Maydell "libsunmath from the Sun Studio compilers tools, due to a lack of" \ 51776ad07a4SPeter Maydell "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \ 51876ad07a4SPeter Maydell "Studio 11 can be downloaded from www.sun.com." 5190475a5caSths fi 5200475a5caSths fi 52186b2bd93Sths fi 5226b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 5230c58ac1cSmalc audio_drv_list="oss" 5246b4d2ba1Sths fi 525c2de5c91Smalc audio_possible_drivers="oss sdl" 526d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 527d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 528d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 529d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 530a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 531560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 532560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 533560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 534ec530c81Sbellard;; 535b29fe3edSmalcAIX) 536b29fe3edSmalc aix="yes" 5370db4a067SPaolo Bonzini make="${MAKE-gmake}" 538b29fe3edSmalc;; 539179cf400SAndreas FärberHaiku) 540179cf400SAndreas Färber haiku="yes" 541179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 542179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 543179cf400SAndreas Färber;; 544fb065187Sbellard*) 5450c58ac1cSmalc audio_drv_list="oss" 546b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 5475327cf48Sbellard linux="yes" 548831b7825Sths linux_user="yes" 54968063649Sblueswir1 usb="linux" 550af2be207SJan Kiszka kvm="yes" 551af2be207SJan Kiszka vhost_net="yes" 5525e9be92dSNicholas Bellinger vhost_scsi="yes" 55307f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 554c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 555c9ec1fe4Sbellard fi 556a585140dSAlexey Kardashevskiy QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" 557fb065187Sbellard;; 5587d13299dSbellardesac 5597d13299dSbellard 5607d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 561b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 56245f0b043SEd Maste if [ "$targetos" != "FreeBSD" ]; then 56368063649Sblueswir1 usb="bsd" 56445f0b043SEd Maste fi 56584778508Sblueswir1 bsd_user="yes" 5667d3505c5Sbellard fi 56708de3949SAndreas Färberfi 5687d3505c5Sbellard 5690db4a067SPaolo Bonzini: ${make=${MAKE-make}} 5700db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 571c886edfbSBlue Swirl: ${python=${PYTHON-python}} 572e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 5730db4a067SPaolo Bonzini 5743c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 5753c4a4d0dSPeter Maydellif has clang; then 5763c4a4d0dSPeter Maydell objcc=clang 5773c4a4d0dSPeter Maydellelse 5783c4a4d0dSPeter Maydell objcc="$cc" 5793c4a4d0dSPeter Maydellfi 5803c4a4d0dSPeter Maydell 5813457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 5823457a3f8SJuan Quintela EXESUF=".exe" 583a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 584e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 585e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 586f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 587f7cf5d5bSStefan Weilcat > $TMPC << EOF 588f7cf5d5bSStefan Weilint main(void) { return 0; } 589f7cf5d5bSStefan WeilEOF 590f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 591f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 592f7cf5d5bSStefan Weil fi 593c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 594683035deSPaolo Bonzini mandir="\${prefix}" 595528ae5b8SEduardo Habkost datadir="\${prefix}" 596850da188SEduardo Habkost qemu_docdir="\${prefix}" 597683035deSPaolo Bonzini bindir="\${prefix}" 598683035deSPaolo Bonzini sysconfdir="\${prefix}" 5995a699bbbSLaszlo Ersek local_statedir= 600683035deSPaolo Bonzini confsuffix="" 601368542b8SStefan Hajnoczi libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga" 6023457a3f8SJuan Quintelafi 6033457a3f8SJuan Quintela 604487fefdbSAnthony Liguoriwerror="" 60585aa5189Sbellard 6067d13299dSbellardfor opt do 607a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 6087d13299dSbellard case "$opt" in 6092efc3265Sbellard --help|-h) show_help=yes 6102efc3265Sbellard ;; 61199123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 61299123e13SMike Frysinger ;; 613b1a550a0Spbrook --prefix=*) prefix="$optarg" 6147d13299dSbellard ;; 615b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 61632ce6337Sbellard ;; 617ca4deeb1SPaolo Bonzini --source-path=*) 6187d13299dSbellard ;; 619ac0df51dSaliguori --cross-prefix=*) 6207d13299dSbellard ;; 621ac0df51dSaliguori --cc=*) 6227d13299dSbellard ;; 623b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 62483469015Sbellard ;; 6253c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 6263c4a4d0dSPeter Maydell ;; 627b1a550a0Spbrook --make=*) make="$optarg" 6287d13299dSbellard ;; 6296a882643Spbrook --install=*) install="$optarg" 6306a882643Spbrook ;; 631c886edfbSBlue Swirl --python=*) python="$optarg" 632c886edfbSBlue Swirl ;; 6331d728c39SBlue Swirl --gcov=*) gcov_tool="$optarg" 6341d728c39SBlue Swirl ;; 635e2d8830eSBrad --smbd=*) smbd="$optarg" 636e2d8830eSBrad ;; 637e2a2ed06SJuan Quintela --extra-cflags=*) 6387d13299dSbellard ;; 639e2a2ed06SJuan Quintela --extra-ldflags=*) 6407d13299dSbellard ;; 6415bc62e01SGerd Hoffmann --enable-debug-info) 6425bc62e01SGerd Hoffmann ;; 6435bc62e01SGerd Hoffmann --disable-debug-info) 6445bc62e01SGerd Hoffmann ;; 6452ff6b91eSJuan Quintela --cpu=*) 6467d13299dSbellard ;; 647b1a550a0Spbrook --target-list=*) target_list="$optarg" 648de83cd02Sbellard ;; 64974242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 65094a420b1SStefan Hajnoczi ;; 65174242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 6529410b56cSPrerna Saxena ;; 6537d13299dSbellard --enable-gprof) gprof="yes" 6547d13299dSbellard ;; 6551d728c39SBlue Swirl --enable-gcov) gcov="yes" 6561d728c39SBlue Swirl ;; 65779427693SLoïc Minier --static) 65879427693SLoïc Minier static="yes" 65979427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 66017884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 66143ce4dfeSbellard ;; 6620b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 6630b24e75fSPaolo Bonzini ;; 6640b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 6650b24e75fSPaolo Bonzini ;; 6663aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 6673aa5d2beSAlon Levy ;; 6688bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 6698bf188aaSMichael Tokarev ;; 6700f94d6daSAlon Levy --includedir=*) includedir="$optarg" 6710f94d6daSAlon Levy ;; 672528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 6730b24e75fSPaolo Bonzini ;; 674023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 675023d3d67SEduardo Habkost ;; 676850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 6770b24e75fSPaolo Bonzini ;; 678ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 67907381cc1SAnthony Liguori ;; 680785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 681785c23aeSLuiz Capitulino ;; 682785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 683023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 684023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 685023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 686023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 687023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 688023ddd74SMax Filippov # lots of directory switches by default. 689023ddd74SMax Filippov ;; 690e2134eb9SGerd Hoffmann --with-system-pixman) pixman="system" 691e2134eb9SGerd Hoffmann ;; 692e2134eb9SGerd Hoffmann --without-system-pixman) pixman="internal" 693e2134eb9SGerd Hoffmann ;; 69474880fe2SRobert Schiele --without-pixman) pixman="none" 69574880fe2SRobert Schiele ;; 69697a847bcSbellard --disable-sdl) sdl="no" 69797a847bcSbellard ;; 698c4198157SJuan Quintela --enable-sdl) sdl="yes" 699c4198157SJuan Quintela ;; 7003556c233SPaolo Bonzini --disable-qom-cast-debug) qom_cast_debug="no" 7013556c233SPaolo Bonzini ;; 7023556c233SPaolo Bonzini --enable-qom-cast-debug) qom_cast_debug="yes" 7033556c233SPaolo Bonzini ;; 704983eef5aSMeador Inge --disable-virtfs) virtfs="no" 705983eef5aSMeador Inge ;; 706983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 707983eef5aSMeador Inge ;; 708821601eaSJes Sorensen --disable-vnc) vnc="no" 709821601eaSJes Sorensen ;; 710821601eaSJes Sorensen --enable-vnc) vnc="yes" 711821601eaSJes Sorensen ;; 712b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 713102a52e4Sbellard ;; 714c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 715c2de5c91Smalc ;; 7162f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 7172f6a1ab0Sblueswir1 ;; 7180c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 7190c58ac1cSmalc ;; 720b64ec4e4SFam Zheng --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 721b64ec4e4SFam Zheng ;; 722b64ec4e4SFam Zheng --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 723eb852011SMarkus Armbruster ;; 724f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 725f8393946Saurel32 ;; 726f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 727f8393946Saurel32 ;; 728f3d08ee6SPaul Brook --enable-debug) 729f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 730f3d08ee6SPaul Brook debug_tcg="yes" 731f3d08ee6SPaul Brook debug="yes" 732f3d08ee6SPaul Brook strip_opt="no" 733f3d08ee6SPaul Brook ;; 73403b4fe7dSaliguori --enable-sparse) sparse="yes" 73503b4fe7dSaliguori ;; 73603b4fe7dSaliguori --disable-sparse) sparse="no" 73703b4fe7dSaliguori ;; 7381625af87Saliguori --disable-strip) strip_opt="no" 7391625af87Saliguori ;; 7408d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 7418d5d2d4cSths ;; 7421be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 7431be10ad2SJuan Quintela ;; 7442f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 7452f9606b3Saliguori ;; 746ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 747ea784e3bSJuan Quintela ;; 7482f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 7492f6f5c7aSCorentin Chary ;; 7502f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 7512f6f5c7aSCorentin Chary ;; 752efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 753efe556adSCorentin Chary ;; 754efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 755efe556adSCorentin Chary ;; 7567536ee4bSTim Hardeck --disable-vnc-ws) vnc_ws="no" 7577536ee4bSTim Hardeck ;; 7587536ee4bSTim Hardeck --enable-vnc-ws) vnc_ws="yes" 7597536ee4bSTim Hardeck ;; 760443f1376Sbellard --disable-slirp) slirp="no" 761c20709aaSbellard ;; 762ee682d27SStefan Weil --disable-uuid) uuid="no" 763ee682d27SStefan Weil ;; 764ee682d27SStefan Weil --enable-uuid) uuid="yes" 765ee682d27SStefan Weil ;; 766e0e6c8c0Saliguori --disable-vde) vde="no" 7678a16d273Sths ;; 768dfb278bdSJuan Quintela --enable-vde) vde="yes" 769dfb278bdSJuan Quintela ;; 770e37630caSaliguori --disable-xen) xen="no" 771e37630caSaliguori ;; 772fc321b4bSJuan Quintela --enable-xen) xen="yes" 773fc321b4bSJuan Quintela ;; 774eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 775eb6fda0fSAnthony PERARD ;; 776eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 777eb6fda0fSAnthony PERARD ;; 7782e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 7792e4d9fb1Saurel32 ;; 7804ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 7814ffcedb6SJuan Quintela ;; 782fb599c9aSbalrog --disable-bluez) bluez="no" 783fb599c9aSbalrog ;; 784a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 785a20a6f46SJuan Quintela ;; 7867ba1e619Saliguori --disable-kvm) kvm="no" 7877ba1e619Saliguori ;; 788b31a0277SJuan Quintela --enable-kvm) kvm="yes" 789b31a0277SJuan Quintela ;; 7909195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 7919195b2c2SStefan Weil ;; 7929195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 7939195b2c2SStefan Weil ;; 79447e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 79547e98658SCorey Bryant ;; 79647e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 79747e98658SCorey Bryant ;; 798cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 799cd4ec0b4SGerd Hoffmann ;; 800cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 801cd4ec0b4SGerd Hoffmann ;; 802c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 803c589b249SRonnie Sahlberg ;; 804c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 805c589b249SRonnie Sahlberg ;; 80605c2a3e7Sbellard --enable-profiler) profiler="yes" 80705c2a3e7Sbellard ;; 80814821030SPavel Borzenkov --disable-cocoa) cocoa="no" 80914821030SPavel Borzenkov ;; 810c2de5c91Smalc --enable-cocoa) 811c2de5c91Smalc cocoa="yes" ; 812c2de5c91Smalc sdl="no" ; 813c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 8145b0753e0Sbellard ;; 815cad25d69Spbrook --disable-system) softmmu="no" 8160a8e90f4Spbrook ;; 817cad25d69Spbrook --enable-system) softmmu="yes" 8180a8e90f4Spbrook ;; 8190953a80fSZachary Amsden --disable-user) 8200953a80fSZachary Amsden linux_user="no" ; 8210953a80fSZachary Amsden bsd_user="no" ; 8220953a80fSZachary Amsden ;; 8230953a80fSZachary Amsden --enable-user) ;; 824831b7825Sths --disable-linux-user) linux_user="no" 8250a8e90f4Spbrook ;; 826831b7825Sths --enable-linux-user) linux_user="yes" 827831b7825Sths ;; 82884778508Sblueswir1 --disable-bsd-user) bsd_user="no" 82984778508Sblueswir1 ;; 83084778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 83184778508Sblueswir1 ;; 832379f6698SPaul Brook --enable-guest-base) guest_base="yes" 833379f6698SPaul Brook ;; 834379f6698SPaul Brook --disable-guest-base) guest_base="no" 835379f6698SPaul Brook ;; 83640d6444eSAvi Kivity --enable-pie) pie="yes" 83734005a00SKirill A. Shutemov ;; 83840d6444eSAvi Kivity --disable-pie) pie="no" 83934005a00SKirill A. Shutemov ;; 840c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 841c5937220Spbrook ;; 84285aa5189Sbellard --enable-werror) werror="yes" 84385aa5189Sbellard ;; 84485aa5189Sbellard --disable-werror) werror="no" 84585aa5189Sbellard ;; 8464d3b6f6eSbalrog --disable-curses) curses="no" 8474d3b6f6eSbalrog ;; 848c584a6d0SJuan Quintela --enable-curses) curses="yes" 849c584a6d0SJuan Quintela ;; 850769ce76dSAlexander Graf --disable-curl) curl="no" 851769ce76dSAlexander Graf ;; 852788c8196SJuan Quintela --enable-curl) curl="yes" 853788c8196SJuan Quintela ;; 8542df87df7SJuan Quintela --disable-fdt) fdt="no" 8552df87df7SJuan Quintela ;; 8562df87df7SJuan Quintela --enable-fdt) fdt="yes" 8572df87df7SJuan Quintela ;; 8588ff9cbf7Smalc --enable-mixemu) mixemu="yes" 8598ff9cbf7Smalc ;; 8605c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 8615c6c3a6cSChristoph Hellwig ;; 8625c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 8635c6c3a6cSChristoph Hellwig ;; 864758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 865758e8e38SVenkateswararao Jujjuri (JV) ;; 866758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 867758e8e38SVenkateswararao Jujjuri (JV) ;; 86877755340Sths --disable-blobs) blobs="no" 86977755340Sths ;; 8704a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 8714a19f1ecSpbrook ;; 872519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 873519175a2SAlex Barcelo ;; 874a25dba17SJuan Quintela --disable-docs) docs="no" 87570ec5dc0SAnthony Liguori ;; 876a25dba17SJuan Quintela --enable-docs) docs="yes" 87783a3ab8bSJuan Quintela ;; 878d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 879d5970055SMichael S. Tsirkin ;; 880d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 881d5970055SMichael S. Tsirkin ;; 8825e9be92dSNicholas Bellinger --disable-vhost-scsi) vhost_scsi="no" 8835e9be92dSNicholas Bellinger ;; 8845e9be92dSNicholas Bellinger --enable-vhost-scsi) vhost_scsi="yes" 8855e9be92dSNicholas Bellinger ;; 886b1e5fff4SMichael Walle --disable-glx) glx="no" 88720ff075bSMichael Walle ;; 888b1e5fff4SMichael Walle --enable-glx) glx="yes" 88920ff075bSMichael Walle ;; 890f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 891f27aaf4bSChristian Brunner ;; 892f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 893f27aaf4bSChristian Brunner ;; 8948c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 8958c84cf11SSergei Trofimovich ;; 8968c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 8978c84cf11SSergei Trofimovich ;; 898111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 899111a38b0SRobert Relyea ;; 900111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 901111a38b0SRobert Relyea ;; 9022b2325ffSGerd Hoffmann --disable-libusb) libusb="no" 9032b2325ffSGerd Hoffmann ;; 9042b2325ffSGerd Hoffmann --enable-libusb) libusb="yes" 9052b2325ffSGerd Hoffmann ;; 90669354a83SHans de Goede --disable-usb-redir) usb_redir="no" 90769354a83SHans de Goede ;; 90869354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 90969354a83SHans de Goede ;; 9101ece9905SAlon Levy --disable-zlib-test) zlib="no" 9111ece9905SAlon Levy ;; 912d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 913d138cee9SMichael Roth ;; 914d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 915d138cee9SMichael Roth ;; 9164b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 9174b1c11fdSDaniel P. Berrange ;; 9184b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 9194b1c11fdSDaniel P. Berrange ;; 920f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 921f794573eSEduardo Otubo ;; 922f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 923f794573eSEduardo Otubo ;; 924eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 925eb100396SBharata B Rao ;; 926eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 927eb100396SBharata B Rao ;; 928583f6e7bSStefan Hajnoczi --disable-virtio-blk-data-plane) virtio_blk_data_plane="no" 929583f6e7bSStefan Hajnoczi ;; 930583f6e7bSStefan Hajnoczi --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes" 931583f6e7bSStefan Hajnoczi ;; 932a4ccabcfSAnthony Liguori --disable-gtk) gtk="no" 933a4ccabcfSAnthony Liguori ;; 934a4ccabcfSAnthony Liguori --enable-gtk) gtk="yes" 935a4ccabcfSAnthony Liguori ;; 9362da776dbSMichael R. Hines --enable-rdma) rdma="yes" 9372da776dbSMichael R. Hines ;; 9382da776dbSMichael R. Hines --disable-rdma) rdma="no" 9392da776dbSMichael R. Hines ;; 940528de90aSDaniel P. Berrange --with-gtkabi=*) gtkabi="$optarg" 941528de90aSDaniel P. Berrange ;; 942ab214c29SStefan Berger --enable-tpm) tpm="yes" 943ab214c29SStefan Berger ;; 9440a12ec87SRichard W.M. Jones --disable-libssh2) libssh2="no" 9450a12ec87SRichard W.M. Jones ;; 9460a12ec87SRichard W.M. Jones --enable-libssh2) libssh2="yes" 9470a12ec87SRichard W.M. Jones ;; 9487f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 9497f1559c6Sbalrog ;; 9507d13299dSbellard esac 9517d13299dSbellarddone 9527d13299dSbellard 95340293e58Sbellardcase "$cpu" in 9549b9c37c3SRichard Henderson sparc) 9550c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 95679f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32 -mcpu=ultrasparc" 9573142255cSblueswir1 ;; 958ed968ff1SJuan Quintela sparc64) 9590c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 96079f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -mcpu=ultrasparc" 9613142255cSblueswir1 ;; 96276d83bdeSths s390) 96379f3b12fSPeter Crosthwaite CPU_CFLAGS="-m31 -march=z990" 96428d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 96528d7cc49SRichard Henderson ;; 96628d7cc49SRichard Henderson s390x) 96779f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64 -march=z990" 96828d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 96976d83bdeSths ;; 97040293e58Sbellard i386) 97179f3b12fSPeter Crosthwaite CPU_CFLAGS="-m32" 9720c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 9732b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 97440293e58Sbellard ;; 97540293e58Sbellard x86_64) 97679f3b12fSPeter Crosthwaite CPU_CFLAGS="-m64" 9770c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 9782b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 979379f6698SPaul Brook ;; 98030163d89SPeter Maydell # No special flags required for other host CPUs 9813142255cSblueswir1esac 9823142255cSblueswir1 98379f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS" 98479f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS" 98579f3b12fSPeter Crosthwaite 98660e0df25SPeter Maydelldefault_target_list="" 98760e0df25SPeter Maydell 9886e92f823SPeter Maydellmak_wilds="" 9896e92f823SPeter Maydell 99060e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then 9916e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak" 99260e0df25SPeter Maydellfi 99360e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then 9946e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak" 99560e0df25SPeter Maydellfi 99660e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then 9976e92f823SPeter Maydell mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" 99860e0df25SPeter Maydellfi 99960e0df25SPeter Maydell 10006e92f823SPeter Maydellfor config in $mak_wilds; do 10016e92f823SPeter Maydell default_target_list="${default_target_list} $(basename "$config" .mak)" 10026e92f823SPeter Maydelldone 10036e92f823SPeter Maydell 1004af5db58eSpbrookif test x"$show_help" = x"yes" ; then 1005af5db58eSpbrookcat << EOF 1006af5db58eSpbrook 1007af5db58eSpbrookUsage: configure [options] 1008af5db58eSpbrookOptions: [defaults in brackets after descriptions] 1009af5db58eSpbrook 1010af5db58eSpbrookEOF 1011af5db58eSpbrookecho "Standard options:" 1012af5db58eSpbrookecho " --help print this message" 1013af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 1014af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 1015af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 101660e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 101760e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 101860e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 1019af5db58eSpbrookecho "" 1020af5db58eSpbrookecho "Advanced options (experts only):" 1021af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 1022af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 1023af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 10240bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 10250bfe8cc0SPaolo Bonziniecho " build time" 10263c4a4d0dSPeter Maydellecho " --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]" 1027a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 1028e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 1029af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 10306a882643Spbrookecho " --install=INSTALL use specified install [$install]" 1031c886edfbSBlue Swirlecho " --python=PYTHON use specified python [$python]" 1032e2d8830eSBradecho " --smbd=SMBD use specified smbd [$smbd]" 1033af5db58eSpbrookecho " --static enable static build [$static]" 10340b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 1035023d3d67SEduardo Habkostecho " --datadir=PATH install firmware in PATH$confsuffix" 1036023d3d67SEduardo Habkostecho " --docdir=PATH install documentation in PATH$confsuffix" 10370b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 1038a7b66fa7SDoug Goldsteinecho " --libdir=PATH install libraries in PATH" 1039023d3d67SEduardo Habkostecho " --sysconfdir=PATH install config in PATH$confsuffix" 10405a699bbbSLaszlo Ersekecho " --localstatedir=PATH install local state in PATH (set at runtime on win32)" 10412ae4748fSStefan Weilecho " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]" 1042f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 1043f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 10449941afdeSDunrong Huangecho " --enable-debug-info enable debugging information (default)" 10459941afdeSDunrong Huangecho " --disable-debug-info disable debugging information" 104609695a4aSStefan Weilecho " --enable-debug enable common debug build options" 1047890b1658Saliguoriecho " --enable-sparse enable sparse checker" 1048890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 10491625af87Saliguoriecho " --disable-strip disable stripping binaries" 105085aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 1051fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 1052c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 1053ab400449SHu Taoecho " --disable-gtk disable gtk UI" 1054ab400449SHu Taoecho " --enable-gtk enable gtk UI" 1055983eef5aSMeador Ingeecho " --disable-virtfs disable VirtFS" 1056983eef5aSMeador Ingeecho " --enable-virtfs enable VirtFS" 1057821601eaSJes Sorensenecho " --disable-vnc disable VNC" 1058821601eaSJes Sorensenecho " --enable-vnc enable VNC" 105914821030SPavel Borzenkovecho " --disable-cocoa disable Cocoa (Mac OS X only)" 106014821030SPavel Borzenkovecho " --enable-cocoa enable Cocoa (default on Mac OS X)" 1061c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 1062c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 1063b64ec4e4SFam Zhengecho " --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L" 1064b64ec4e4SFam Zhengecho " --block-drv-rw-whitelist=L" 1065b64ec4e4SFam Zhengecho " set block driver read-write whitelist" 1066b64ec4e4SFam Zhengecho " (affects only QEMU, not qemu-img)" 1067b64ec4e4SFam Zhengecho " --block-drv-ro-whitelist=L" 1068b64ec4e4SFam Zhengecho " set block driver read-only whitelist" 1069eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 10708ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 1071e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 1072fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 1073eb6fda0fSAnthony PERARDecho " --disable-xen-pci-passthrough" 1074eb6fda0fSAnthony PERARDecho " --enable-xen-pci-passthrough" 10752e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 10764ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 10778d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 10781be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 10792f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 1080ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 10812f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 10822f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 108396763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 1084efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 10857536ee4bSTim Hardeckecho " --disable-vnc-ws disable Websockets support for VNC server" 10867536ee4bSTim Hardeckecho " --enable-vnc-ws enable Websockets support for VNC server" 1087af896aaaSpbrookecho " --disable-curses disable curses output" 1088c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 1089769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 1090788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 10912df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 10922df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 1093fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 1094a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 10956093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 10967ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 1097b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 10982da776dbSMichael R. Hinesecho " --disable-rdma disable RDMA-based migration support" 10992da776dbSMichael R. Hinesecho " --enable-rdma enable RDMA-based migration support" 11009195b2c2SStefan Weilecho " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" 1101af5db58eSpbrookecho " --enable-system enable all system emulation targets" 1102af5db58eSpbrookecho " --disable-system disable all system emulation targets" 11030953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 11040953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 1105831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 1106831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 110784778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 110884778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 1109379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 1110379f6698SPaul Brookecho " emulation targets" 1111379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 111240d6444eSAvi Kivityecho " --enable-pie build Position Independent Executables" 111340d6444eSAvi Kivityecho " --disable-pie do not build Position Independent Executables" 1114af5db58eSpbrookecho " --fmod-lib path to FMOD library" 1115af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 11162f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 1117c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 1118235e510cS陳韋任echo " --cpu=CPU Build for host CPU [$cpu]" 1119ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 1120ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 1121e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 1122dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 11235c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 11245c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 112547e98658SCorey Bryantecho " --disable-cap-ng disable libcap-ng support" 112647e98658SCorey Bryantecho " --enable-cap-ng enable libcap-ng support" 1127758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1128758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 112977755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1130d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1131d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1132d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1133d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1134320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1135650ab98dSLluís Vilanovaecho " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends) 113674242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 11379410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1138cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1139cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1140f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 1141c589b249SRonnie Sahlbergecho " --disable-libiscsi disable iscsi support" 1142c589b249SRonnie Sahlbergecho " --enable-libiscsi enable iscsi support" 1143111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1144111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 11452b2325ffSGerd Hoffmannecho " --disable-libusb disable libusb (for usb passthrough)" 11462b2325ffSGerd Hoffmannecho " --enable-libusb enable libusb (for usb passthrough)" 114769354a83SHans de Goedeecho " --disable-usb-redir disable usb network redirection support" 114869354a83SHans de Goedeecho " --enable-usb-redir enable usb network redirection support" 1149d138cee9SMichael Rothecho " --disable-guest-agent disable building of the QEMU Guest Agent" 1150d138cee9SMichael Rothecho " --enable-guest-agent enable building of the QEMU Guest Agent" 1151f794573eSEduardo Otuboecho " --disable-seccomp disable seccomp support" 1152f794573eSEduardo Otuboecho " --enable-seccomp enables seccomp support" 1153519175a2SAlex Barceloecho " --with-coroutine=BACKEND coroutine backend. Supported options:" 1154fe91bfa8SAlex Barceloecho " gthread, ucontext, sigaltstack, windows" 1155eb100396SBharata B Raoecho " --enable-glusterfs enable GlusterFS backend" 1156eb100396SBharata B Raoecho " --disable-glusterfs disable GlusterFS backend" 11571d728c39SBlue Swirlecho " --enable-gcov enable test coverage analysis with gcov" 11581d728c39SBlue Swirlecho " --gcov=GCOV use specified gcov [$gcov_tool]" 1159ab214c29SStefan Bergerecho " --enable-tpm enable TPM support" 11600a12ec87SRichard W.M. Jonesecho " --disable-libssh2 disable ssh block device support" 11610a12ec87SRichard W.M. Jonesecho " --enable-libssh2 enable ssh block device support" 1162af5db58eSpbrookecho "" 11635bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1164af5db58eSpbrookexit 1 1165af5db58eSpbrookfi 1166af5db58eSpbrook 1167359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1168359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1169359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1170359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1171359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1172359bc95dSPeter Maydell ARCH=tci 1173359bc95dSPeter Maydell else 117476ad07a4SPeter Maydell error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1175359bc95dSPeter Maydell fi 1176359bc95dSPeter Maydellfi 1177359bc95dSPeter Maydell 11788d05095cSPaolo Bonzini# check that the C compiler works. 11798d05095cSPaolo Bonzinicat > $TMPC <<EOF 118075cafad7SStefan Weilint main(void) { return 0; } 11818d05095cSPaolo BonziniEOF 11828d05095cSPaolo Bonzini 11838d05095cSPaolo Bonziniif compile_object ; then 11848d05095cSPaolo Bonzini : C compiler works ok 11858d05095cSPaolo Bonzinielse 118676ad07a4SPeter Maydell error_exit "\"$cc\" either does not exist or does not work" 11878d05095cSPaolo Bonzinifi 11888d05095cSPaolo Bonzini 1189417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror 1190417c9d72SAlexander Graf# by default. Only enable by default for git builds 1191417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION` 1192417c9d72SAlexander Graf 1193417c9d72SAlexander Grafif test -z "$werror" ; then 11946c8fec83SAndreas Färber if test -d "$source_path/.git" -a \ 1195417c9d72SAlexander Graf "$linux" = "yes" ; then 1196417c9d72SAlexander Graf werror="yes" 1197417c9d72SAlexander Graf else 1198417c9d72SAlexander Graf werror="no" 1199417c9d72SAlexander Graf fi 1200417c9d72SAlexander Graffi 1201417c9d72SAlexander Graf 12028d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 12038d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 12048d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 120537746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags" 1206c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags" 12076ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 12086ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 12096ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 12106ca026cbSPeter Maydell# so it's too error prone. 12118d05095cSPaolo Bonzinicat > $TMPC << EOF 12128d05095cSPaolo Bonziniint main(void) { return 0; } 12138d05095cSPaolo BonziniEOF 12148d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1215a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1216a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1217a1d29d6cSPeter Maydell # warning options). 1218a1d29d6cSPeter Maydell optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')" 1219a1d29d6cSPeter Maydell if compile_prog "-Werror $optflag" "" ; then 12208d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 12218d05095cSPaolo Bonzini fi 12228d05095cSPaolo Bonzinidone 12238d05095cSPaolo Bonzini 122437746c5eSMarc-André Lureauif compile_prog "-Werror -fstack-protector-all" "" ; then 122537746c5eSMarc-André Lureau QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all" 122637746c5eSMarc-André Lureau LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all" 122737746c5eSMarc-André Lureaufi 122837746c5eSMarc-André Lureau 1229cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1230cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1231cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1232cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1233cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1234cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1235cbdd1999SPaolo Bonziniint main(void) { return 0; } 1236cbdd1999SPaolo Bonzini#else 1237cbdd1999SPaolo Bonzini#error No bug in this compiler. 1238cbdd1999SPaolo Bonzini#endif 1239cbdd1999SPaolo BonziniEOF 1240cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1241cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1242cbdd1999SPaolo Bonzinifi 1243cbdd1999SPaolo Bonzini 124440d6444eSAvi Kivityif test "$static" = "yes" ; then 124540d6444eSAvi Kivity if test "$pie" = "yes" ; then 124676ad07a4SPeter Maydell error_exit "static and pie are mutually incompatible" 124740d6444eSAvi Kivity else 124840d6444eSAvi Kivity pie="no" 124940d6444eSAvi Kivity fi 125040d6444eSAvi Kivityfi 125140d6444eSAvi Kivity 125240d6444eSAvi Kivityif test "$pie" = ""; then 125340d6444eSAvi Kivity case "$cpu-$targetos" in 1254f9db31a2SBrad i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) 125540d6444eSAvi Kivity ;; 125640d6444eSAvi Kivity *) 125740d6444eSAvi Kivity pie="no" 125840d6444eSAvi Kivity ;; 125940d6444eSAvi Kivity esac 126040d6444eSAvi Kivityfi 126140d6444eSAvi Kivity 126240d6444eSAvi Kivityif test "$pie" != "no" ; then 126340d6444eSAvi Kivity cat > $TMPC << EOF 126421d4a791SAvi Kivity 126521d4a791SAvi Kivity#ifdef __linux__ 126621d4a791SAvi Kivity# define THREAD __thread 126721d4a791SAvi Kivity#else 126821d4a791SAvi Kivity# define THREAD 126921d4a791SAvi Kivity#endif 127021d4a791SAvi Kivity 127121d4a791SAvi Kivitystatic THREAD int tls_var; 127221d4a791SAvi Kivity 127321d4a791SAvi Kivityint main(void) { return tls_var; } 127421d4a791SAvi Kivity 127540d6444eSAvi KivityEOF 127640d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 127740d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 127840d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 127940d6444eSAvi Kivity pie="yes" 128040d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 128140d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 128240d6444eSAvi Kivity fi 128340d6444eSAvi Kivity else 128440d6444eSAvi Kivity if test "$pie" = "yes"; then 128576ad07a4SPeter Maydell error_exit "PIE not available due to missing toolchain support" 128640d6444eSAvi Kivity else 128740d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 128840d6444eSAvi Kivity pie="no" 128940d6444eSAvi Kivity fi 129040d6444eSAvi Kivity fi 129140d6444eSAvi Kivityfi 129240d6444eSAvi Kivity 129309dada40SPaolo Bonzini########################################## 129409dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains 129509dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit 129609dada40SPaolo Bonzini# specification is necessary 129709dada40SPaolo Bonzini 129809dada40SPaolo Bonziniif test "$cpu" = "i386"; then 129909dada40SPaolo Bonzini cat > $TMPC << EOF 130009dada40SPaolo Bonzinistatic int sfaa(int *ptr) 130109dada40SPaolo Bonzini{ 130209dada40SPaolo Bonzini return __sync_fetch_and_and(ptr, 0); 130309dada40SPaolo Bonzini} 130409dada40SPaolo Bonzini 130509dada40SPaolo Bonziniint main(void) 130609dada40SPaolo Bonzini{ 130709dada40SPaolo Bonzini int val = 42; 13081405b629SStefan Weil val = __sync_val_compare_and_swap(&val, 0, 1); 130909dada40SPaolo Bonzini sfaa(&val); 131009dada40SPaolo Bonzini return val; 131109dada40SPaolo Bonzini} 131209dada40SPaolo BonziniEOF 131309dada40SPaolo Bonzini if ! compile_prog "" "" ; then 131409dada40SPaolo Bonzini QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 131509dada40SPaolo Bonzini fi 131609dada40SPaolo Bonzinifi 131709dada40SPaolo Bonzini 131809dada40SPaolo Bonzini######################################### 1319ec530c81Sbellard# Solaris specific configure tool chain decisions 132009dada40SPaolo Bonzini 1321ec530c81Sbellardif test "$solaris" = "yes" ; then 13226792aa11SLoïc Minier if has $install; then 13236792aa11SLoïc Minier : 13246792aa11SLoïc Minier else 132576ad07a4SPeter Maydell error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \ 132676ad07a4SPeter Maydell "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ 132776ad07a4SPeter Maydell "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1328ec530c81Sbellard fi 13296792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 133076ad07a4SPeter Maydell error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ 133176ad07a4SPeter Maydell "try ginstall from the GNU fileutils available from www.blastwave.org" \ 133276ad07a4SPeter Maydell "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1333ec530c81Sbellard fi 13346792aa11SLoïc Minier if has ar; then 13356792aa11SLoïc Minier : 13366792aa11SLoïc Minier else 1337ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 133876ad07a4SPeter Maydell error_exit "No path includes ar" \ 133976ad07a4SPeter Maydell "Add /usr/ccs/bin to your path and rerun configure" 1340ec530c81Sbellard fi 134176ad07a4SPeter Maydell error_exit "No path includes ar" 1342ec530c81Sbellard fi 1343ec530c81Sbellardfi 1344ec530c81Sbellard 13457a3fc891SSebastian Herbsztif ! has $python; then 134676ad07a4SPeter Maydell error_exit "Python not found. Use --python=/path/to/python" 1347c886edfbSBlue Swirlfi 1348c886edfbSBlue Swirl 13496ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit 13506ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value. 1351e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then 135276ad07a4SPeter Maydell error_exit "Cannot use '$python', Python 2.4 or later is required." \ 135376ad07a4SPeter Maydell "Note that Python 3 or later is not yet supported." \ 135476ad07a4SPeter Maydell "Use --python=/path/to/python to specify a supported Python." 13556ccea1e4SPeter Maydellfi 13566ccea1e4SPeter Maydell 1357afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1358121afa9eSAnthony Liguori target_list="$default_target_list" 1359121afa9eSAnthony Liguorielse 1360121afa9eSAnthony Liguori target_list=`echo "$target_list" | sed -e 's/,/ /g'` 13615327cf48Sbellardfi 136225b48338SPeter Maydell 136325b48338SPeter Maydell# Check that we recognised the target name; this allows a more 136425b48338SPeter Maydell# friendly error message than if we let it fall through. 136525b48338SPeter Maydellfor target in $target_list; do 136625b48338SPeter Maydell case " $default_target_list " in 136725b48338SPeter Maydell *" $target "*) 136825b48338SPeter Maydell ;; 136925b48338SPeter Maydell *) 137025b48338SPeter Maydell error_exit "Unknown target name '$target'" 137125b48338SPeter Maydell ;; 137225b48338SPeter Maydell esac 137325b48338SPeter Maydelldone 137425b48338SPeter Maydell 1375f55fe278SPaolo Bonzini# see if system emulation was really requested 1376f55fe278SPaolo Bonzinicase " $target_list " in 1377f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1378f55fe278SPaolo Bonzini ;; 1379f55fe278SPaolo Bonzini *) softmmu=no 1380f55fe278SPaolo Bonzini ;; 1381f55fe278SPaolo Bonziniesac 13825327cf48Sbellard 1383249247c9SJuan Quintelafeature_not_found() { 1384249247c9SJuan Quintela feature=$1 1385249247c9SJuan Quintela 138676ad07a4SPeter Maydell error_exit "User requested feature $feature" \ 138776ad07a4SPeter Maydell "configure was not able to find it" 1388249247c9SJuan Quintela} 1389249247c9SJuan Quintela 13907d13299dSbellardif test -z "$cross_prefix" ; then 13917d13299dSbellard 13927d13299dSbellard# --- 13937d13299dSbellard# big/little endian test 13947d13299dSbellardcat > $TMPC << EOF 13957d13299dSbellard#include <inttypes.h> 1396abab1a0fSStefan Weilint main(void) { 13977d13299dSbellard volatile uint32_t i=0x01234567; 13987d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 13997d13299dSbellard} 14007d13299dSbellardEOF 14017d13299dSbellard 140252166aa0SJuan Quintelaif compile_prog "" "" ; then 14037d13299dSbellard$TMPE && bigendian="yes" 14047d13299dSbellardelse 14057d13299dSbellardecho big/little test failed 14067d13299dSbellardfi 14077d13299dSbellard 14087d13299dSbellardelse 14097d13299dSbellard 14107d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1411ea8f20f8SJuan Quintelacase "$cpu" in 141221d89f84SPeter Maydell arm) 141321d89f84SPeter Maydell # ARM can be either way; ask the compiler which one we are 141421d89f84SPeter Maydell if check_define __ARMEB__; then 141521d89f84SPeter Maydell bigendian=yes 141621d89f84SPeter Maydell fi 141721d89f84SPeter Maydell ;; 141821d89f84SPeter Maydell hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1419ea8f20f8SJuan Quintela bigendian=yes 1420ea8f20f8SJuan Quintela ;; 1421ea8f20f8SJuan Quintelaesac 14227d13299dSbellard 14237d13299dSbellardfi 14247d13299dSbellard 1425b0a47e79SJuan Quintela########################################## 1426779ab5e3SStefan Weil# pkg-config probe 1427779ab5e3SStefan Weil 1428779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 142976ad07a4SPeter Maydell error_exit "pkg-config binary '$pkg_config_exe' not found" 1430779ab5e3SStefan Weilfi 1431779ab5e3SStefan Weil 1432779ab5e3SStefan Weil########################################## 1433b0a47e79SJuan Quintela# NPTL probe 1434b0a47e79SJuan Quintela 143524cb36a6SPeter Maydellif test "$linux_user" = "yes"; then 1436bd0c5661Spbrook cat > $TMPC <<EOF 1437bd0c5661Spbrook#include <sched.h> 143830813ceaSpbrook#include <linux/futex.h> 1439182eacc0SStefan Weilint main(void) { 1440bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1441bd0c5661Spbrook#error bork 1442bd0c5661Spbrook#endif 1443182eacc0SStefan Weil return 0; 1444bd0c5661Spbrook} 1445bd0c5661SpbrookEOF 144624cb36a6SPeter Maydell if ! compile_object ; then 1447b0a47e79SJuan Quintela feature_not_found "nptl" 1448b0a47e79SJuan Quintela fi 1449bd0c5661Spbrookfi 1450bd0c5661Spbrook 145111d9f695Sbellard########################################## 1452ac62922eSbalrog# zlib check 1453ac62922eSbalrog 14541ece9905SAlon Levyif test "$zlib" != "no" ; then 1455ac62922eSbalrog cat > $TMPC << EOF 1456ac62922eSbalrog#include <zlib.h> 1457ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1458ac62922eSbalrogEOF 145952166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1460ac62922eSbalrog : 1461ac62922eSbalrog else 146276ad07a4SPeter Maydell error_exit "zlib check failed" \ 146376ad07a4SPeter Maydell "Make sure to have the zlib libs and headers installed." 1464ac62922eSbalrog fi 14651ece9905SAlon Levyfi 1466f544a488SPaolo Bonzinilibs_softmmu="$libs_softmmu -lz" 1467ac62922eSbalrog 1468ac62922eSbalrog########################################## 1469f794573eSEduardo Otubo# libseccomp check 1470f794573eSEduardo Otubo 1471f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 14727d7b2ad4SEduardo Otubo if $pkg_config --atleast-version=2.1.0 libseccomp --modversion >/dev/null 2>&1; then 1473b4451996SMichael Tokarev libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`" 1474372e47e9SAndreas Färber QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`" 1475f794573eSEduardo Otubo seccomp="yes" 1476f794573eSEduardo Otubo else 1477f794573eSEduardo Otubo if test "$seccomp" = "yes"; then 1478f794573eSEduardo Otubo feature_not_found "libseccomp" 1479f794573eSEduardo Otubo fi 1480e84d5956SYann E. MORIN seccomp="no" 1481f794573eSEduardo Otubo fi 1482f794573eSEduardo Otubofi 1483f794573eSEduardo Otubo########################################## 1484e37630caSaliguori# xen probe 1485e37630caSaliguori 1486fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1487b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1488d5b93ddfSAnthony PERARD 148950ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 149050ced5b3SStefan Weil # If no, we are done and there is no Xen support. 149150ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 149250ced5b3SStefan Weil 149350ced5b3SStefan Weil # Xen (any) 149450ced5b3SStefan Weil cat > $TMPC <<EOF 149550ced5b3SStefan Weil#include <xenctrl.h> 149650ced5b3SStefan Weilint main(void) { 149750ced5b3SStefan Weil return 0; 149850ced5b3SStefan Weil} 149950ced5b3SStefan WeilEOF 150050ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 150150ced5b3SStefan Weil # Xen not found 150250ced5b3SStefan Weil if test "$xen" = "yes" ; then 150350ced5b3SStefan Weil feature_not_found "xen" 150450ced5b3SStefan Weil fi 150550ced5b3SStefan Weil xen=no 150650ced5b3SStefan Weil 1507d5b93ddfSAnthony PERARD # Xen unstable 150869deef08SPeter Maydell elif 150969deef08SPeter Maydell cat > $TMPC <<EOF && 1510e37630caSaliguori#include <xenctrl.h> 1511e108a3c1SAnthony PERARD#include <xenstore.h> 1512d5b93ddfSAnthony PERARD#include <stdint.h> 1513d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1514d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1515d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1516d5b93ddfSAnthony PERARD#endif 1517d5b93ddfSAnthony PERARDint main(void) { 1518d5b93ddfSAnthony PERARD xc_interface *xc; 1519d5b93ddfSAnthony PERARD xs_daemon_open(); 1520d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1521d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1522d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1523b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 15248688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 15258688e065SStefano Stabellini return 0; 15268688e065SStefano Stabellini} 15278688e065SStefano StabelliniEOF 15288688e065SStefano Stabellini compile_prog "" "$xen_libs" 152969deef08SPeter Maydell then 15308688e065SStefano Stabellini xen_ctrl_version=420 15318688e065SStefano Stabellini xen=yes 15328688e065SStefano Stabellini 153369deef08SPeter Maydell elif 153469deef08SPeter Maydell cat > $TMPC <<EOF && 15358688e065SStefano Stabellini#include <xenctrl.h> 15368688e065SStefano Stabellini#include <xs.h> 15378688e065SStefano Stabellini#include <stdint.h> 15388688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h> 15398688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS) 15408688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined 15418688e065SStefano Stabellini#endif 15428688e065SStefano Stabelliniint main(void) { 15438688e065SStefano Stabellini xs_daemon_open(); 15449b4c0b56SPeter Maydell xc_interface_open(0, 0, 0); 15458688e065SStefano Stabellini xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 15468688e065SStefano Stabellini xc_gnttab_open(NULL, 0); 15478688e065SStefano Stabellini xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1548d5b93ddfSAnthony PERARD return 0; 1549d5b93ddfSAnthony PERARD} 1550e37630caSaliguoriEOF 155150ced5b3SStefan Weil compile_prog "" "$xen_libs" 155269deef08SPeter Maydell then 1553d5b93ddfSAnthony PERARD xen_ctrl_version=410 1554fc321b4bSJuan Quintela xen=yes 1555d5b93ddfSAnthony PERARD 1556d5b93ddfSAnthony PERARD # Xen 4.0.0 155769deef08SPeter Maydell elif 155869deef08SPeter Maydell cat > $TMPC <<EOF && 1559d5b93ddfSAnthony PERARD#include <xenctrl.h> 1560d5b93ddfSAnthony PERARD#include <xs.h> 1561d5b93ddfSAnthony PERARD#include <stdint.h> 1562d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1563d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1564d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1565d5b93ddfSAnthony PERARD#endif 1566d5b93ddfSAnthony PERARDint main(void) { 1567b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1568b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1569b87de24eSAnthony PERARD }; 1570d5b93ddfSAnthony PERARD xs_daemon_open(); 1571d5b93ddfSAnthony PERARD xc_interface_open(); 1572d5b93ddfSAnthony PERARD xc_gnttab_open(); 1573d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1574b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1575d5b93ddfSAnthony PERARD return 0; 1576d5b93ddfSAnthony PERARD} 1577d5b93ddfSAnthony PERARDEOF 1578d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 157969deef08SPeter Maydell then 1580d5b93ddfSAnthony PERARD xen_ctrl_version=400 1581d5b93ddfSAnthony PERARD xen=yes 1582d5b93ddfSAnthony PERARD 1583b87de24eSAnthony PERARD # Xen 3.4.0 158469deef08SPeter Maydell elif 158569deef08SPeter Maydell cat > $TMPC <<EOF && 1586b87de24eSAnthony PERARD#include <xenctrl.h> 1587b87de24eSAnthony PERARD#include <xs.h> 1588b87de24eSAnthony PERARDint main(void) { 1589b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1590b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1591b87de24eSAnthony PERARD }; 1592b87de24eSAnthony PERARD xs_daemon_open(); 1593b87de24eSAnthony PERARD xc_interface_open(); 1594b87de24eSAnthony PERARD xc_gnttab_open(); 1595b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1596b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1597b87de24eSAnthony PERARD return 0; 1598b87de24eSAnthony PERARD} 1599b87de24eSAnthony PERARDEOF 1600b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 160169deef08SPeter Maydell then 1602b87de24eSAnthony PERARD xen_ctrl_version=340 1603b87de24eSAnthony PERARD xen=yes 1604b87de24eSAnthony PERARD 1605b87de24eSAnthony PERARD # Xen 3.3.0 160669deef08SPeter Maydell elif 160769deef08SPeter Maydell cat > $TMPC <<EOF && 1608d5b93ddfSAnthony PERARD#include <xenctrl.h> 1609d5b93ddfSAnthony PERARD#include <xs.h> 1610d5b93ddfSAnthony PERARDint main(void) { 1611d5b93ddfSAnthony PERARD xs_daemon_open(); 1612d5b93ddfSAnthony PERARD xc_interface_open(); 1613d5b93ddfSAnthony PERARD xc_gnttab_open(); 1614d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1615d5b93ddfSAnthony PERARD return 0; 1616d5b93ddfSAnthony PERARD} 1617d5b93ddfSAnthony PERARDEOF 1618d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 161969deef08SPeter Maydell then 1620d5b93ddfSAnthony PERARD xen_ctrl_version=330 1621d5b93ddfSAnthony PERARD xen=yes 1622d5b93ddfSAnthony PERARD 162350ced5b3SStefan Weil # Xen version unsupported 1624e37630caSaliguori else 1625fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 162650ced5b3SStefan Weil feature_not_found "xen (unsupported version)" 1627fc321b4bSJuan Quintela fi 1628fc321b4bSJuan Quintela xen=no 1629e37630caSaliguori fi 1630d5b93ddfSAnthony PERARD 1631d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1632d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1633d5b93ddfSAnthony PERARD fi 1634e37630caSaliguorifi 1635e37630caSaliguori 1636eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 1637eb6fda0fSAnthony PERARD if test "$xen" = "yes" && test "$linux" = "yes" && 1638eb6fda0fSAnthony PERARD test "$xen_ctrl_version" -ge 340; then 1639eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 1640eb6fda0fSAnthony PERARD else 1641eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 1642eb6fda0fSAnthony PERARD if test "$xen_ctrl_version" -lt 340; then 164376ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 164476ad07a4SPeter Maydell "This feature does not work with Xen 3.3" 1645eb6fda0fSAnthony PERARD fi 164676ad07a4SPeter Maydell error_exit "User requested feature Xen PCI Passthrough" \ 164776ad07a4SPeter Maydell " but this feature requires /sys from Linux" 1648eb6fda0fSAnthony PERARD fi 1649eb6fda0fSAnthony PERARD xen_pci_passthrough=no 1650eb6fda0fSAnthony PERARD fi 1651eb6fda0fSAnthony PERARDfi 1652eb6fda0fSAnthony PERARD 1653e37630caSaliguori########################################## 165444dc0ca3SAlon Levy# libtool probe 165544dc0ca3SAlon Levy 16563f534581SBradif ! has $libtool; then 165744dc0ca3SAlon Levy libtool= 165844dc0ca3SAlon Levyfi 165944dc0ca3SAlon Levy 16608e515b12SPeter Maydell# MacOSX ships with a libtool which isn't the GNU one; weed this 16618e515b12SPeter Maydell# out by checking whether libtool supports the --version switch 16628e515b12SPeter Maydellif test -n "$libtool"; then 16638e515b12SPeter Maydell if ! "$libtool" --version >/dev/null 2>&1; then 16648e515b12SPeter Maydell libtool= 16658e515b12SPeter Maydell fi 16668e515b12SPeter Maydellfi 16678e515b12SPeter Maydell 166844dc0ca3SAlon Levy########################################## 1669dfffc653SJuan Quintela# Sparse probe 1670dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 16710dba6195SLoïc Minier if has cgcc; then 1672dfffc653SJuan Quintela sparse=yes 1673dfffc653SJuan Quintela else 1674dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1675dfffc653SJuan Quintela feature_not_found "sparse" 1676dfffc653SJuan Quintela fi 1677dfffc653SJuan Quintela sparse=no 1678dfffc653SJuan Quintela fi 1679dfffc653SJuan Quintelafi 1680dfffc653SJuan Quintela 1681dfffc653SJuan Quintela########################################## 1682a4ccabcfSAnthony Liguori# GTK probe 1683a4ccabcfSAnthony Liguori 1684a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then 1685528de90aSDaniel P. Berrange gtkpackage="gtk+-$gtkabi" 1686528de90aSDaniel P. Berrange if test "$gtkabi" = "3.0" ; then 1687528de90aSDaniel P. Berrange gtkversion="3.0.0" 1688528de90aSDaniel P. Berrange vtepackage="vte-2.90" 1689528de90aSDaniel P. Berrange vteversion="0.32.0" 1690528de90aSDaniel P. Berrange else 1691528de90aSDaniel P. Berrange gtkversion="2.18.0" 1692528de90aSDaniel P. Berrange vtepackage="vte" 1693528de90aSDaniel P. Berrange vteversion="0.24.0" 1694528de90aSDaniel P. Berrange fi 16950d185e63SPeter Maydell if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then 16960d185e63SPeter Maydell if test "$gtk" = "yes" ; then 16970d185e63SPeter Maydell feature_not_found "gtk" 16980d185e63SPeter Maydell fi 16990d185e63SPeter Maydell gtk="no" 17000d185e63SPeter Maydell elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then 17010d185e63SPeter Maydell if test "$gtk" = "yes" ; then 17020d185e63SPeter Maydell error_exit "libvte not found (required for gtk support)" 17030d185e63SPeter Maydell fi 17040d185e63SPeter Maydell gtk="no" 17050d185e63SPeter Maydell else 1706528de90aSDaniel P. Berrange gtk_cflags=`$pkg_config --cflags $gtkpackage 2>/dev/null` 1707528de90aSDaniel P. Berrange gtk_libs=`$pkg_config --libs $gtkpackage 2>/dev/null` 1708528de90aSDaniel P. Berrange vte_cflags=`$pkg_config --cflags $vtepackage 2>/dev/null` 1709528de90aSDaniel P. Berrange vte_libs=`$pkg_config --libs $vtepackage 2>/dev/null` 1710a4ccabcfSAnthony Liguori libs_softmmu="$gtk_libs $vte_libs $libs_softmmu" 1711a4ccabcfSAnthony Liguori gtk="yes" 1712a4ccabcfSAnthony Liguori fi 1713a4ccabcfSAnthony Liguorifi 1714a4ccabcfSAnthony Liguori 1715a4ccabcfSAnthony Liguori########################################## 171611d9f695Sbellard# SDL probe 171711d9f695Sbellard 17183ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 17193ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 17203ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 17213ec87ffeSPaolo Bonzini sdl_config=sdl-config 17223ec87ffeSPaolo Bonzinifi 17233ec87ffeSPaolo Bonzini 17243ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1725a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1726fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 17273ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 17283ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 17299316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1730a0dfd8a4SLoïc Minierelse 1731a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1732a0dfd8a4SLoïc Minier feature_not_found "sdl" 1733a0dfd8a4SLoïc Minier fi 1734a0dfd8a4SLoïc Minier sdl=no 17359316f803SPaolo Bonzinifi 173629e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 17373ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 17383ec87ffeSPaolo Bonzinifi 173911d9f695Sbellard 17409316f803SPaolo Bonzinisdl_too_old=no 1741c4198157SJuan Quintelaif test "$sdl" != "no" ; then 174211d9f695Sbellard cat > $TMPC << EOF 174311d9f695Sbellard#include <SDL.h> 174411d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 174511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 174611d9f695SbellardEOF 17479316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 174874f42e18STeLeMan if test "$static" = "yes" ; then 174974f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 175074f42e18STeLeMan else 17519316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 175274f42e18STeLeMan fi 175352166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 175411d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 175511d9f695Sbellard sdl_too_old=yes 175611d9f695Sbellard else 1757fd677642Sths if test "$cocoa" = "no" ; then 175811d9f695Sbellard sdl=yes 175911d9f695Sbellard fi 1760fd677642Sths fi 17617c1f25b4Sbellard 176267c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 17631ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 176467c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1765f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1766f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 176711d9f695Sbellard fi 176852166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 17691ac88f28SJuan Quintela : 17701ac88f28SJuan Quintela else 17711ac88f28SJuan Quintela sdl=no 17727c1f25b4Sbellard fi 17737c1f25b4Sbellard fi # static link 1774c4198157SJuan Quintela else # sdl not found 1775c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1776c4198157SJuan Quintela feature_not_found "sdl" 1777c4198157SJuan Quintela fi 1778c4198157SJuan Quintela sdl=no 17797c1f25b4Sbellard fi # sdl compile test 1780fd677642Sthsfi 178111d9f695Sbellard 17825368a422Saliguoriif test "$sdl" = "yes" ; then 17835368a422Saliguori cat > $TMPC <<EOF 17845368a422Saliguori#include <SDL.h> 17855368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 17865368a422Saliguori#include <X11/XKBlib.h> 17875368a422Saliguori#else 17885368a422Saliguori#error No x11 support 17895368a422Saliguori#endif 17905368a422Saliguoriint main(void) { return 0; } 17915368a422SaliguoriEOF 179252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1793681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 17945368a422Saliguori fi 17950705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 17965368a422Saliguorifi 17975368a422Saliguori 17988f28f3fbSths########################################## 17992da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries 18002da776dbSMichael R. Hinesif test "$rdma" != "no" ; then 18012da776dbSMichael R. Hines cat > $TMPC <<EOF 18022da776dbSMichael R. Hines#include <rdma/rdma_cma.h> 18032da776dbSMichael R. Hinesint main(void) { return 0; } 18042da776dbSMichael R. HinesEOF 18052da776dbSMichael R. Hines rdma_libs="-lrdmacm -libverbs" 18062da776dbSMichael R. Hines if compile_prog "" "$rdma_libs" ; then 18072da776dbSMichael R. Hines rdma="yes" 18082da776dbSMichael R. Hines libs_softmmu="$libs_softmmu $rdma_libs" 18092da776dbSMichael R. Hines else 18102da776dbSMichael R. Hines if test "$rdma" = "yes" ; then 18112da776dbSMichael R. Hines error_exit \ 18122da776dbSMichael R. Hines " OpenFabrics librdmacm/libibverbs not present." \ 18132da776dbSMichael R. Hines " Your options:" \ 18142da776dbSMichael R. Hines " (1) Fast: Install infiniband packages from your distro." \ 18152da776dbSMichael R. Hines " (2) Cleanest: Install libraries from www.openfabrics.org" \ 18162da776dbSMichael R. Hines " (3) Also: Install softiwarp if you don't have RDMA hardware" 18172da776dbSMichael R. Hines fi 18182da776dbSMichael R. Hines rdma="no" 18192da776dbSMichael R. Hines fi 18202da776dbSMichael R. Hinesfi 18212da776dbSMichael R. Hines 18222da776dbSMichael R. Hines########################################## 18237536ee4bSTim Hardeck# VNC TLS/WS detection 18247536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then 1825ae6b5e5aSaliguori cat > $TMPC <<EOF 1826ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1827ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1828ae6b5e5aSaliguoriEOF 1829a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1830a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 183152166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 18327536ee4bSTim Hardeck if test "$vnc_tls" != "no" ; then 18331be10ad2SJuan Quintela vnc_tls=yes 18347536ee4bSTim Hardeck fi 18357536ee4bSTim Hardeck if test "$vnc_ws" != "no" ; then 18367536ee4bSTim Hardeck vnc_ws=yes 18377536ee4bSTim Hardeck fi 1838a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1839ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags" 1840ae6b5e5aSaliguori else 18411be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 18421be10ad2SJuan Quintela feature_not_found "vnc-tls" 18431be10ad2SJuan Quintela fi 18447536ee4bSTim Hardeck if test "$vnc_ws" = "yes" ; then 18457536ee4bSTim Hardeck feature_not_found "vnc-ws" 18467536ee4bSTim Hardeck fi 18471be10ad2SJuan Quintela vnc_tls=no 18487536ee4bSTim Hardeck vnc_ws=no 18498d5d2d4cSths fi 18508d5d2d4cSthsfi 18518d5d2d4cSths 18528d5d2d4cSths########################################## 18532f9606b3Saliguori# VNC SASL detection 1854821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 18552f9606b3Saliguori cat > $TMPC <<EOF 18562f9606b3Saliguori#include <sasl/sasl.h> 18572f9606b3Saliguori#include <stdio.h> 18582f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 18592f9606b3SaliguoriEOF 18602f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 18612f9606b3Saliguori vnc_sasl_cflags="" 18622f9606b3Saliguori vnc_sasl_libs="-lsasl2" 186352166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1864ea784e3bSJuan Quintela vnc_sasl=yes 1865fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 1866ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 18672f9606b3Saliguori else 1868ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1869ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1870ea784e3bSJuan Quintela fi 1871ea784e3bSJuan Quintela vnc_sasl=no 18722f9606b3Saliguori fi 18732f9606b3Saliguorifi 18742f9606b3Saliguori 18752f9606b3Saliguori########################################## 18762f6f5c7aSCorentin Chary# VNC JPEG detection 1877821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 18782f6f5c7aSCorentin Charycat > $TMPC <<EOF 18792f6f5c7aSCorentin Chary#include <stdio.h> 18802f6f5c7aSCorentin Chary#include <jpeglib.h> 18812f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 18822f6f5c7aSCorentin CharyEOF 18832f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 18842f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 18852f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 18862f6f5c7aSCorentin Chary vnc_jpeg=yes 18872f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 1888ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 18892f6f5c7aSCorentin Chary else 18902f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 18912f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 18922f6f5c7aSCorentin Chary fi 18932f6f5c7aSCorentin Chary vnc_jpeg=no 18942f6f5c7aSCorentin Chary fi 18952f6f5c7aSCorentin Charyfi 18962f6f5c7aSCorentin Chary 18972f6f5c7aSCorentin Chary########################################## 1898efe556adSCorentin Chary# VNC PNG detection 1899821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1900efe556adSCorentin Charycat > $TMPC <<EOF 1901efe556adSCorentin Chary//#include <stdio.h> 1902efe556adSCorentin Chary#include <png.h> 1903832ce9c2SScott Wood#include <stddef.h> 1904efe556adSCorentin Charyint main(void) { 1905efe556adSCorentin Chary png_structp png_ptr; 1906efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 19077edc3fedSPeter Maydell return png_ptr != 0; 1908efe556adSCorentin Chary} 1909efe556adSCorentin CharyEOF 19109af8025eSBrad if $pkg_config libpng --modversion >/dev/null 2>&1; then 19119af8025eSBrad vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` 19129af8025eSBrad vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` 19139af8025eSBrad else 1914efe556adSCorentin Chary vnc_png_cflags="" 1915efe556adSCorentin Chary vnc_png_libs="-lpng" 19169af8025eSBrad fi 1917efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1918efe556adSCorentin Chary vnc_png=yes 1919efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 19209af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 1921efe556adSCorentin Chary else 1922efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1923efe556adSCorentin Chary feature_not_found "vnc-png" 1924efe556adSCorentin Chary fi 1925efe556adSCorentin Chary vnc_png=no 1926efe556adSCorentin Chary fi 1927efe556adSCorentin Charyfi 1928efe556adSCorentin Chary 1929efe556adSCorentin Chary########################################## 193076655d6dSaliguori# fnmatch() probe, used for ACL routines 193176655d6dSaliguorifnmatch="no" 193276655d6dSaliguoricat > $TMPC << EOF 193376655d6dSaliguori#include <fnmatch.h> 193476655d6dSaliguoriint main(void) 193576655d6dSaliguori{ 193676655d6dSaliguori fnmatch("foo", "foo", 0); 193776655d6dSaliguori return 0; 193876655d6dSaliguori} 193976655d6dSaliguoriEOF 194052166aa0SJuan Quintelaif compile_prog "" "" ; then 194176655d6dSaliguori fnmatch="yes" 194276655d6dSaliguorifi 194376655d6dSaliguori 194476655d6dSaliguori########################################## 1945ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 19462d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library 19472d16c8e9SPeter Maydell# need be linked to get the uuid functions. 1948ee682d27SStefan Weilif test "$uuid" != "no" ; then 1949ee682d27SStefan Weil uuid_libs="-luuid" 1950ee682d27SStefan Weil cat > $TMPC << EOF 1951ee682d27SStefan Weil#include <uuid/uuid.h> 1952ee682d27SStefan Weilint main(void) 1953ee682d27SStefan Weil{ 1954ee682d27SStefan Weil uuid_t my_uuid; 1955ee682d27SStefan Weil uuid_generate(my_uuid); 1956ee682d27SStefan Weil return 0; 1957ee682d27SStefan Weil} 1958ee682d27SStefan WeilEOF 19592d16c8e9SPeter Maydell if compile_prog "" "" ; then 19602d16c8e9SPeter Maydell uuid="yes" 19612d16c8e9SPeter Maydell elif compile_prog "" "$uuid_libs" ; then 1962ee682d27SStefan Weil uuid="yes" 1963ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1964ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1965ee682d27SStefan Weil else 1966ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1967ee682d27SStefan Weil feature_not_found "uuid" 1968ee682d27SStefan Weil fi 1969ee682d27SStefan Weil uuid=no 1970ee682d27SStefan Weil fi 1971ee682d27SStefan Weilfi 1972ee682d27SStefan Weil 1973ee682d27SStefan Weil########################################## 1974dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1975dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1976dce512deSChristoph Hellwig cat > $TMPC << EOF 1977ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 1978dce512deSChristoph Hellwig#include <xfs/xfs.h> 1979dce512deSChristoph Hellwigint main(void) 1980dce512deSChristoph Hellwig{ 1981dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1982dce512deSChristoph Hellwig return 0; 1983dce512deSChristoph Hellwig} 1984dce512deSChristoph HellwigEOF 1985dce512deSChristoph Hellwig if compile_prog "" "" ; then 1986dce512deSChristoph Hellwig xfs="yes" 1987dce512deSChristoph Hellwig else 1988dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1989dce512deSChristoph Hellwig feature_not_found "xfs" 1990dce512deSChristoph Hellwig fi 1991dce512deSChristoph Hellwig xfs=no 1992dce512deSChristoph Hellwig fi 1993dce512deSChristoph Hellwigfi 1994dce512deSChristoph Hellwig 1995dce512deSChristoph Hellwig########################################## 19968a16d273Sths# vde libraries probe 1997dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 19984baae0acSJuan Quintela vde_libs="-lvdeplug" 19998a16d273Sths cat > $TMPC << EOF 20008a16d273Sths#include <libvdeplug.h> 20014a7f0e06Spbrookint main(void) 20024a7f0e06Spbrook{ 20034a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 2004fea08e08SPeter Maydell char s[] = ""; 2005fea08e08SPeter Maydell vde_open(s, s, &a); 20064a7f0e06Spbrook return 0; 20074a7f0e06Spbrook} 20088a16d273SthsEOF 200952166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 20104baae0acSJuan Quintela vde=yes 20118e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 20128e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 2013dfb278bdSJuan Quintela else 2014dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 2015dfb278bdSJuan Quintela feature_not_found "vde" 2016dfb278bdSJuan Quintela fi 2017dfb278bdSJuan Quintela vde=no 20188a16d273Sths fi 20198a16d273Sthsfi 20208a16d273Sths 20218a16d273Sths########################################## 202247e98658SCorey Bryant# libcap-ng library probe 202347e98658SCorey Bryantif test "$cap_ng" != "no" ; then 202447e98658SCorey Bryant cap_libs="-lcap-ng" 202547e98658SCorey Bryant cat > $TMPC << EOF 202647e98658SCorey Bryant#include <cap-ng.h> 202747e98658SCorey Bryantint main(void) 202847e98658SCorey Bryant{ 202947e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 203047e98658SCorey Bryant return 0; 203147e98658SCorey Bryant} 203247e98658SCorey BryantEOF 203347e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 203447e98658SCorey Bryant cap_ng=yes 203547e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 203647e98658SCorey Bryant else 203747e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 203847e98658SCorey Bryant feature_not_found "cap_ng" 203947e98658SCorey Bryant fi 204047e98658SCorey Bryant cap_ng=no 204147e98658SCorey Bryant fi 204247e98658SCorey Bryantfi 204347e98658SCorey Bryant 204447e98658SCorey Bryant########################################## 2045c2de5c91Smalc# Sound support libraries probe 20468f28f3fbSths 2047c2de5c91Smalcaudio_drv_probe() 2048c2de5c91Smalc{ 2049c2de5c91Smalc drv=$1 2050c2de5c91Smalc hdr=$2 2051c2de5c91Smalc lib=$3 2052c2de5c91Smalc exp=$4 2053c2de5c91Smalc cfl=$5 20548f28f3fbSths cat > $TMPC << EOF 2055c2de5c91Smalc#include <$hdr> 2056c2de5c91Smalcint main(void) { $exp } 20578f28f3fbSthsEOF 205852166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 20598f28f3fbSths : 20608f28f3fbSths else 206176ad07a4SPeter Maydell error_exit "$drv check failed" \ 206276ad07a4SPeter Maydell "Make sure to have the $drv libs and headers installed." 20638f28f3fbSths fi 2064c2de5c91Smalc} 2065c2de5c91Smalc 20662fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 2067c2de5c91Smalcfor drv in $audio_drv_list; do 2068c2de5c91Smalc case $drv in 2069c2de5c91Smalc alsa) 2070c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 2071e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 2072a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 2073c2de5c91Smalc ;; 2074c2de5c91Smalc 2075c2de5c91Smalc fmod) 2076c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 207776ad07a4SPeter Maydell error_exit "You must specify path to FMOD library and headers" \ 207876ad07a4SPeter Maydell "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 20798f28f3fbSths fi 2080c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 2081a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 2082c2de5c91Smalc ;; 2083c2de5c91Smalc 2084c2de5c91Smalc esd) 2085c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 2086a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 208767f86e8eSJuan Quintela audio_pt_int="yes" 2088c2de5c91Smalc ;; 2089b8e59f18Smalc 2090b8e59f18Smalc pa) 2091a394aed2SMarc-André Lureau audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ 2092a394aed2SMarc-André Lureau "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" 2093a394aed2SMarc-André Lureau libs_softmmu="-lpulse $libs_softmmu" 209467f86e8eSJuan Quintela audio_pt_int="yes" 2095b8e59f18Smalc ;; 2096b8e59f18Smalc 2097997e690aSJuan Quintela coreaudio) 2098997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 2099997e690aSJuan Quintela ;; 2100997e690aSJuan Quintela 2101a4bf6780SJuan Quintela dsound) 2102a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 2103d5631638Smalc audio_win_int="yes" 2104a4bf6780SJuan Quintela ;; 2105a4bf6780SJuan Quintela 2106a4bf6780SJuan Quintela oss) 2107a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 2108a4bf6780SJuan Quintela ;; 2109a4bf6780SJuan Quintela 2110a4bf6780SJuan Quintela sdl|wav) 21112f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 21122f6a1ab0Sblueswir1 ;; 21132f6a1ab0Sblueswir1 2114d5631638Smalc winwave) 2115d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 2116d5631638Smalc audio_win_int="yes" 2117d5631638Smalc ;; 2118d5631638Smalc 2119e4c63a6aSmalc *) 21201c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 212176ad07a4SPeter Maydell error_exit "Unknown driver '$drv' selected" \ 212276ad07a4SPeter Maydell "Possible drivers are: $audio_possible_drivers" 2123e4c63a6aSmalc } 2124e4c63a6aSmalc ;; 2125c2de5c91Smalc esac 2126c2de5c91Smalcdone 21278f28f3fbSths 21284d3b6f6eSbalrog########################################## 21292e4d9fb1Saurel32# BrlAPI probe 21302e4d9fb1Saurel32 21314ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 2132eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 21332e4d9fb1Saurel32 cat > $TMPC << EOF 21342e4d9fb1Saurel32#include <brlapi.h> 2135832ce9c2SScott Wood#include <stddef.h> 21362e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 21372e4d9fb1Saurel32EOF 213852166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 21392e4d9fb1Saurel32 brlapi=yes 2140264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 21414ffcedb6SJuan Quintela else 21424ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 21434ffcedb6SJuan Quintela feature_not_found "brlapi" 21444ffcedb6SJuan Quintela fi 21454ffcedb6SJuan Quintela brlapi=no 2146eb82284fSJuan Quintela fi 2147eb82284fSJuan Quintelafi 21482e4d9fb1Saurel32 21492e4d9fb1Saurel32########################################## 21504d3b6f6eSbalrog# curses probe 2151a3605bf6SMichael Tokarevif test "$curses" != "no" ; then 2152e095e2f3SStefan Weil if test "$mingw32" = "yes" ; then 2153e095e2f3SStefan Weil curses_list="-lpdcurses" 2154e095e2f3SStefan Weil else 2155cfeda5f4SEd Maste curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses" 2156e095e2f3SStefan Weil fi 2157c584a6d0SJuan Quintela curses_found=no 21584d3b6f6eSbalrog cat > $TMPC << EOF 21594d3b6f6eSbalrog#include <curses.h> 2160ef9a2524SStefan Weilint main(void) { 2161ef9a2524SStefan Weil const char *s = curses_version(); 2162ef9a2524SStefan Weil resize_term(0, 0); 2163ef9a2524SStefan Weil return s != 0; 2164ef9a2524SStefan Weil} 21654d3b6f6eSbalrogEOF 2166ecbe251fSVadim Evard IFS=: 21674f78ef9aSJuan Quintela for curses_lib in $curses_list; do 2168ecbe251fSVadim Evard unset IFS 21694f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 2170c584a6d0SJuan Quintela curses_found=yes 21714f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 21724f78ef9aSJuan Quintela break 21734d3b6f6eSbalrog fi 21744f78ef9aSJuan Quintela done 2175ecbe251fSVadim Evard unset IFS 2176c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 2177c584a6d0SJuan Quintela curses=yes 2178c584a6d0SJuan Quintela else 2179c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 2180c584a6d0SJuan Quintela feature_not_found "curses" 2181c584a6d0SJuan Quintela fi 2182c584a6d0SJuan Quintela curses=no 2183c584a6d0SJuan Quintela fi 21844f78ef9aSJuan Quintelafi 21854d3b6f6eSbalrog 2186414f0dabSblueswir1########################################## 2187769ce76dSAlexander Graf# curl probe 2188a3605bf6SMichael Tokarevif test "$curl" != "no" ; then 2189a8bd70adSPaolo Bonzini if $pkg_config libcurl --modversion >/dev/null 2>&1; then 2190a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 21914e2b0658SPaolo Bonzini else 21924e2b0658SPaolo Bonzini curlconfig=curl-config 21934e2b0658SPaolo Bonzini fi 2194769ce76dSAlexander Graf cat > $TMPC << EOF 2195769ce76dSAlexander Graf#include <curl/curl.h> 21960b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 2197769ce76dSAlexander GrafEOF 21984e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 21994e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 2200b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 2201769ce76dSAlexander Graf curl=yes 2202f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 2203f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 2204788c8196SJuan Quintela else 2205788c8196SJuan Quintela if test "$curl" = "yes" ; then 2206788c8196SJuan Quintela feature_not_found "curl" 2207788c8196SJuan Quintela fi 2208788c8196SJuan Quintela curl=no 2209769ce76dSAlexander Graf fi 2210769ce76dSAlexander Graffi # test "$curl" 2211769ce76dSAlexander Graf 2212769ce76dSAlexander Graf########################################## 2213fb599c9aSbalrog# bluez support probe 2214a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 2215e820e3f4Sbalrog cat > $TMPC << EOF 2216e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 2217e820e3f4Sbalrogint main(void) { return bt_error(0); } 2218e820e3f4SbalrogEOF 2219a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 2220a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 222152166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 2222a20a6f46SJuan Quintela bluez=yes 2223e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 2224e820e3f4Sbalrog else 2225a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 2226a20a6f46SJuan Quintela feature_not_found "bluez" 2227a20a6f46SJuan Quintela fi 2228e820e3f4Sbalrog bluez="no" 2229e820e3f4Sbalrog fi 2230fb599c9aSbalrogfi 2231fb599c9aSbalrog 2232fb599c9aSbalrog########################################## 2233e18df141SAnthony Liguori# glib support probe 2234a52d28afSPaolo Bonzini 2235a52d28afSPaolo Bonziniif test "$mingw32" = yes; then 2236a52d28afSPaolo Bonzini # g_poll is required in order to integrate with the glib main loop. 2237a52d28afSPaolo Bonzini glib_req_ver=2.20 2238a52d28afSPaolo Bonzinielse 2239a52d28afSPaolo Bonzini glib_req_ver=2.12 2240a52d28afSPaolo Bonzinifi 2241a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1 2242a52d28afSPaolo Bonzinithen 22434b76a481SStefan Hajnoczi glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` 22444b76a481SStefan Hajnoczi glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` 224514015304SAnthony Liguori LIBS="$glib_libs $LIBS" 2246957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 2247e18df141SAnthony Liguorielse 224876ad07a4SPeter Maydell error_exit "glib-$glib_req_ver required to compile QEMU" 2249e18df141SAnthony Liguorifi 2250e18df141SAnthony Liguori 2251e18df141SAnthony Liguori########################################## 2252e2134eb9SGerd Hoffmann# pixman support probe 2253e2134eb9SGerd Hoffmann 2254e2134eb9SGerd Hoffmannif test "$pixman" = ""; then 225574880fe2SRobert Schiele if test "$want_tools" = "no" -a "$softmmu" = "no"; then 225674880fe2SRobert Schiele pixman="none" 225774880fe2SRobert Schiele elif $pkg_config pixman-1 > /dev/null 2>&1; then 2258e2134eb9SGerd Hoffmann pixman="system" 2259e2134eb9SGerd Hoffmann else 2260e2134eb9SGerd Hoffmann pixman="internal" 2261e2134eb9SGerd Hoffmann fi 2262e2134eb9SGerd Hoffmannfi 226374880fe2SRobert Schieleif test "$pixman" = "none"; then 226474880fe2SRobert Schiele if test "$want_tools" != "no" -o "$softmmu" != "no"; then 226576ad07a4SPeter Maydell error_exit "pixman disabled but system emulation or tools build" \ 226676ad07a4SPeter Maydell "enabled. You can turn off pixman only if you also" \ 226776ad07a4SPeter Maydell "disable all system emulation targets and the tools" \ 226876ad07a4SPeter Maydell "build with '--disable-tools --disable-system'." 226974880fe2SRobert Schiele fi 227074880fe2SRobert Schiele pixman_cflags= 227174880fe2SRobert Schiele pixman_libs= 227274880fe2SRobert Schieleelif test "$pixman" = "system"; then 2273e2134eb9SGerd Hoffmann pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null` 2274e2134eb9SGerd Hoffmann pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null` 2275e2134eb9SGerd Hoffmannelse 2276e2134eb9SGerd Hoffmann if test ! -d ${source_path}/pixman/pixman; then 227776ad07a4SPeter Maydell error_exit "pixman not present. Your options:" \ 227876ad07a4SPeter Maydell " (1) Preferred: Install the pixman devel package (any recent" \ 227976ad07a4SPeter Maydell " distro should have packages as Xorg needs pixman too)." \ 228076ad07a4SPeter Maydell " (2) Fetch the pixman submodule, using:" \ 228176ad07a4SPeter Maydell " git submodule update --init pixman" 2282e2134eb9SGerd Hoffmann fi 22835ca9388aSGerd Hoffmann mkdir -p pixman/pixman 22845ca9388aSGerd Hoffmann pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman" 22855ca9388aSGerd Hoffmann pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1" 2286e2134eb9SGerd Hoffmannfi 2287e2134eb9SGerd Hoffmann 2288e2134eb9SGerd Hoffmann########################################## 228917bff52bSM. Mohan Kumar# libcap probe 229017bff52bSM. Mohan Kumar 229117bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 229217bff52bSM. Mohan Kumar cat > $TMPC <<EOF 229317bff52bSM. Mohan Kumar#include <stdio.h> 229417bff52bSM. Mohan Kumar#include <sys/capability.h> 2295cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 229617bff52bSM. Mohan KumarEOF 229717bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 229817bff52bSM. Mohan Kumar cap=yes 229917bff52bSM. Mohan Kumar else 230017bff52bSM. Mohan Kumar cap=no 230117bff52bSM. Mohan Kumar fi 230217bff52bSM. Mohan Kumarfi 230317bff52bSM. Mohan Kumar 230417bff52bSM. Mohan Kumar########################################## 2305e5d355d1Saliguori# pthread probe 23064b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 23073c529d93Saliguori 2308e5d355d1Saliguoripthread=no 2309414f0dabSblueswir1cat > $TMPC << EOF 23103c529d93Saliguori#include <pthread.h> 23117a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 23127a42bbe4SStefan Weilint main(void) { 23137a42bbe4SStefan Weil pthread_t thread; 23147a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 23157a42bbe4SStefan Weil return 0; 23167a42bbe4SStefan Weil} 2317414f0dabSblueswir1EOF 2318bd00d539SAndreas Färberif compile_prog "" "" ; then 2319bd00d539SAndreas Färber pthread=yes 2320bd00d539SAndreas Färberelse 2321de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 232252166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 2323e5d355d1Saliguori pthread=yes 2324e3c56761SPeter Portante found=no 2325e3c56761SPeter Portante for lib_entry in $LIBS; do 2326e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 2327e3c56761SPeter Portante found=yes 2328e3c56761SPeter Portante break 2329e3c56761SPeter Portante fi 2330e3c56761SPeter Portante done 2331e3c56761SPeter Portante if test "$found" = "no"; then 23325572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 2333e3c56761SPeter Portante fi 2334de65fe0fSSebastian Herbszt break 2335414f0dabSblueswir1 fi 2336de65fe0fSSebastian Herbszt done 2337bd00d539SAndreas Färberfi 2338414f0dabSblueswir1 23394617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 234076ad07a4SPeter Maydell error_exit "pthread check failed" \ 234176ad07a4SPeter Maydell "Make sure to have the pthread libs and headers installed." 2342e5d355d1Saliguorifi 2343e5d355d1Saliguori 2344bf9298b9Saliguori########################################## 2345f27aaf4bSChristian Brunner# rbd probe 2346f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2347f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2348f27aaf4bSChristian Brunner#include <stdio.h> 2349ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2350f27aaf4bSChristian Brunnerint main(void) { 2351ad32e9c0SJosh Durgin rados_t cluster; 2352ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2353f27aaf4bSChristian Brunner return 0; 2354f27aaf4bSChristian Brunner} 2355f27aaf4bSChristian BrunnerEOF 2356ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2357f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2358f27aaf4bSChristian Brunner rbd=yes 2359f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 2360f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 2361f27aaf4bSChristian Brunner else 2362f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 2363f27aaf4bSChristian Brunner feature_not_found "rados block device" 2364f27aaf4bSChristian Brunner fi 2365f27aaf4bSChristian Brunner rbd=no 2366f27aaf4bSChristian Brunner fi 2367f27aaf4bSChristian Brunnerfi 2368f27aaf4bSChristian Brunner 2369f27aaf4bSChristian Brunner########################################## 23700a12ec87SRichard W.M. Jones# libssh2 probe 23714fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8 23720a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then 23734fc16838SRichard W.M. Jones if $pkg_config --atleast-version=$min_libssh2_version libssh2 >/dev/null 2>&1 23744fc16838SRichard W.M. Jones then 23750a12ec87SRichard W.M. Jones libssh2_cflags=`$pkg_config libssh2 --cflags` 23760a12ec87SRichard W.M. Jones libssh2_libs=`$pkg_config libssh2 --libs` 23770a12ec87SRichard W.M. Jones libssh2=yes 23780a12ec87SRichard W.M. Jones libs_tools="$libssh2_libs $libs_tools" 23790a12ec87SRichard W.M. Jones libs_softmmu="$libssh2_libs $libs_softmmu" 23800a12ec87SRichard W.M. Jones QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags" 23810a12ec87SRichard W.M. Jones else 23820a12ec87SRichard W.M. Jones if test "$libssh2" = "yes" ; then 23834fc16838SRichard W.M. Jones error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2" 23840a12ec87SRichard W.M. Jones fi 23850a12ec87SRichard W.M. Jones libssh2=no 23860a12ec87SRichard W.M. Jones fi 23870a12ec87SRichard W.M. Jonesfi 23880a12ec87SRichard W.M. Jones 23890a12ec87SRichard W.M. Jones########################################## 23909a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe 23919a2d462eSRichard W.M. Jones 23929a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then 23939a2d462eSRichard W.M. Jones cat > $TMPC <<EOF 23949a2d462eSRichard W.M. Jones#include <stdio.h> 23959a2d462eSRichard W.M. Jones#include <libssh2.h> 23969a2d462eSRichard W.M. Jones#include <libssh2_sftp.h> 23979a2d462eSRichard W.M. Jonesint main(void) { 23989a2d462eSRichard W.M. Jones LIBSSH2_SESSION *session; 23999a2d462eSRichard W.M. Jones LIBSSH2_SFTP *sftp; 24009a2d462eSRichard W.M. Jones LIBSSH2_SFTP_HANDLE *sftp_handle; 24019a2d462eSRichard W.M. Jones session = libssh2_session_init (); 24029a2d462eSRichard W.M. Jones sftp = libssh2_sftp_init (session); 24039a2d462eSRichard W.M. Jones sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0); 24049a2d462eSRichard W.M. Jones libssh2_sftp_fsync (sftp_handle); 24059a2d462eSRichard W.M. Jones return 0; 24069a2d462eSRichard W.M. Jones} 24079a2d462eSRichard W.M. JonesEOF 24089a2d462eSRichard W.M. Jones # libssh2_cflags/libssh2_libs defined in previous test. 24099a2d462eSRichard W.M. Jones if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then 24109a2d462eSRichard W.M. Jones QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS" 24119a2d462eSRichard W.M. Jones fi 24129a2d462eSRichard W.M. Jonesfi 24139a2d462eSRichard W.M. Jones 24149a2d462eSRichard W.M. Jones########################################## 24155c6c3a6cSChristoph Hellwig# linux-aio probe 24165c6c3a6cSChristoph Hellwig 24175c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 24185c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 24195c6c3a6cSChristoph Hellwig#include <libaio.h> 24205c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2421832ce9c2SScott Wood#include <stddef.h> 24225c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 24235c6c3a6cSChristoph HellwigEOF 24245c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 24255c6c3a6cSChristoph Hellwig linux_aio=yes 2426048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 2427048d179fSPaul Brook libs_tools="$libs_tools -laio" 24285c6c3a6cSChristoph Hellwig else 24295c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 24305c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 24315c6c3a6cSChristoph Hellwig fi 24323cfcae3cSLuiz Capitulino linux_aio=no 24335c6c3a6cSChristoph Hellwig fi 24345c6c3a6cSChristoph Hellwigfi 24355c6c3a6cSChristoph Hellwig 24365c6c3a6cSChristoph Hellwig########################################## 24373b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux 24383b8acc11SPaolo Bonzini 24393b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then 24403b8acc11SPaolo Bonzini tpm_passthrough=$tpm 24413b8acc11SPaolo Bonzinielse 24423b8acc11SPaolo Bonzini tpm_passthrough=no 24433b8acc11SPaolo Bonzinifi 24443b8acc11SPaolo Bonzini 24453b8acc11SPaolo Bonzini########################################## 2446583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio 2447583f6e7bSStefan Hajnoczi 2448583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \ 2449583f6e7bSStefan Hajnoczi "$linux_aio" != "yes" ; then 245076ad07a4SPeter Maydell error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio" 2451583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then 2452583f6e7bSStefan Hajnoczi virtio_blk_data_plane=$linux_aio 2453583f6e7bSStefan Hajnoczifi 2454583f6e7bSStefan Hajnoczi 2455583f6e7bSStefan Hajnoczi########################################## 2456758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2457758e8e38SVenkateswararao Jujjuri (JV) 2458758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2459758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2460758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2461758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2462f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2463f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2464f2338fb4SPavel Borzenkov#else 24654f26f2b6SAvi Kivity#include <sys/xattr.h> 2466f2338fb4SPavel Borzenkov#endif 2467758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2468758e8e38SVenkateswararao Jujjuri (JV)EOF 24694f26f2b6SAvi Kivity if compile_prog "" "" ; then 24704f26f2b6SAvi Kivity attr=yes 24714f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2472f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2473758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2474758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 24754f26f2b6SAvi Kivity libattr=yes 2476758e8e38SVenkateswararao Jujjuri (JV) else 2477758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2478758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 2479758e8e38SVenkateswararao Jujjuri (JV) fi 2480758e8e38SVenkateswararao Jujjuri (JV) attr=no 2481758e8e38SVenkateswararao Jujjuri (JV) fi 2482758e8e38SVenkateswararao Jujjuri (JV)fi 2483758e8e38SVenkateswararao Jujjuri (JV) 2484758e8e38SVenkateswararao Jujjuri (JV)########################################## 2485bf9298b9Saliguori# iovec probe 2486bf9298b9Saliguoricat > $TMPC <<EOF 2487db34f0b3Sblueswir1#include <sys/types.h> 2488bf9298b9Saliguori#include <sys/uio.h> 2489db34f0b3Sblueswir1#include <unistd.h> 2490f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2491bf9298b9SaliguoriEOF 2492bf9298b9Saliguoriiovec=no 249352166aa0SJuan Quintelaif compile_prog "" "" ; then 2494bf9298b9Saliguori iovec=yes 2495bf9298b9Saliguorifi 2496bf9298b9Saliguori 2497f652e6afSaurel32########################################## 2498ceb42de8Saliguori# preadv probe 2499ceb42de8Saliguoricat > $TMPC <<EOF 2500ceb42de8Saliguori#include <sys/types.h> 2501ceb42de8Saliguori#include <sys/uio.h> 2502ceb42de8Saliguori#include <unistd.h> 2503c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 2504ceb42de8SaliguoriEOF 2505ceb42de8Saliguoripreadv=no 250652166aa0SJuan Quintelaif compile_prog "" "" ; then 2507ceb42de8Saliguori preadv=yes 2508ceb42de8Saliguorifi 2509ceb42de8Saliguori 2510ceb42de8Saliguori########################################## 2511f652e6afSaurel32# fdt probe 2512e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures, 2513e169e1e1SPeter Maydell# so insist on it if we're building those system emulators. 2514e169e1e1SPeter Maydellfdt_required=no 2515e169e1e1SPeter Maydellfor target in $target_list; do 2516e169e1e1SPeter Maydell case $target in 2517e169e1e1SPeter Maydell arm*-softmmu|ppc*-softmmu|microblaze*-softmmu) 2518e169e1e1SPeter Maydell fdt_required=yes 2519e169e1e1SPeter Maydell ;; 2520e169e1e1SPeter Maydell esac 2521e169e1e1SPeter Maydelldone 2522e169e1e1SPeter Maydell 2523e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then 2524e169e1e1SPeter Maydell if test "$fdt" = "no"; then 2525e169e1e1SPeter Maydell error_exit "fdt disabled but some requested targets require it." \ 2526e169e1e1SPeter Maydell "You can turn off fdt only if you also disable all the system emulation" \ 2527e169e1e1SPeter Maydell "targets which need it (by specifying a cut down --target-list)." 2528e169e1e1SPeter Maydell fi 2529e169e1e1SPeter Maydell fdt=yes 2530e169e1e1SPeter Maydellfi 2531e169e1e1SPeter Maydell 25322df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2533b41af4baSJuan Quintela fdt_libs="-lfdt" 253496ce6545SPeter Crosthwaite # explicitly check for libfdt_env.h as it is missing in some stable installs 2535f652e6afSaurel32 cat > $TMPC << EOF 253696ce6545SPeter Crosthwaite#include <libfdt_env.h> 2537f652e6afSaurel32int main(void) { return 0; } 2538f652e6afSaurel32EOF 253952166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2540a540f158SPeter Crosthwaite # system DTC is good - use it 2541f652e6afSaurel32 fdt=yes 2542a540f158SPeter Crosthwaite elif test -d ${source_path}/dtc/libfdt ; then 2543a540f158SPeter Crosthwaite # have submodule DTC - use it 2544a540f158SPeter Crosthwaite fdt=yes 2545a540f158SPeter Crosthwaite dtc_internal="yes" 2546a540f158SPeter Crosthwaite mkdir -p dtc 2547a540f158SPeter Crosthwaite if [ "$source_path" != `pwd` ] ; then 2548a540f158SPeter Crosthwaite symlink "$source_path/dtc/Makefile" "dtc/Makefile" 2549a540f158SPeter Crosthwaite symlink "$source_path/dtc/scripts" "dtc/scripts" 25502df87df7SJuan Quintela fi 2551a540f158SPeter Crosthwaite fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" 2552a540f158SPeter Crosthwaite fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" 2553a540f158SPeter Crosthwaite elif test "$fdt" = "yes" ; then 2554a540f158SPeter Crosthwaite # have neither and want - prompt for system/submodule install 2555f2c4ddd9SAndreas Färber error_exit "DTC not present. Your options:" \ 2556a540f158SPeter Crosthwaite " (1) Preferred: Install the DTC devel package" \ 2557a540f158SPeter Crosthwaite " (2) Fetch the DTC submodule, using:" \ 2558a540f158SPeter Crosthwaite " git submodule update --init dtc" 2559a540f158SPeter Crosthwaite else 2560a540f158SPeter Crosthwaite # don't have and don't want 2561de3a354aSMichael Walle fdt_libs= 25622df87df7SJuan Quintela fdt=no 2563f652e6afSaurel32 fi 2564f652e6afSaurel32fi 2565f652e6afSaurel32 2566a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs" 2567a540f158SPeter Crosthwaite 256820ff075bSMichael Walle########################################## 2569b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2 2570b1e5fff4SMichael Walleif test "$glx" != "no" ; then 2571b1e5fff4SMichael Walle glx_libs="-lGL -lX11" 257220ff075bSMichael Walle cat > $TMPC << EOF 257320ff075bSMichael Walle#include <X11/Xlib.h> 257420ff075bSMichael Walle#include <GL/gl.h> 257520ff075bSMichael Walle#include <GL/glx.h> 2576d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; } 257720ff075bSMichael WalleEOF 2578d3fcbb16SMichael Walle if compile_prog "" "-lGL -lX11" ; then 2579b1e5fff4SMichael Walle glx=yes 258020ff075bSMichael Walle else 2581b1e5fff4SMichael Walle if test "$glx" = "yes" ; then 2582b1e5fff4SMichael Walle feature_not_found "glx" 258320ff075bSMichael Walle fi 2584b1e5fff4SMichael Walle glx_libs= 2585b1e5fff4SMichael Walle glx=no 258620ff075bSMichael Walle fi 258720ff075bSMichael Wallefi 258820ff075bSMichael Walle 2589eb100396SBharata B Rao########################################## 2590eb100396SBharata B Rao# glusterfs probe 2591eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 2592e01bee08SBharata B Rao if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then 2593e01bee08SBharata B Rao glusterfs="yes" 2594e01bee08SBharata B Rao glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null` 2595e01bee08SBharata B Rao glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null` 2596e01bee08SBharata B Rao CFLAGS="$CFLAGS $glusterfs_cflags" 2597eb100396SBharata B Rao libs_tools="$glusterfs_libs $libs_tools" 2598eb100396SBharata B Rao libs_softmmu="$glusterfs_libs $libs_softmmu" 25990c14fb47SBharata B Rao if $pkg_config --atleast-version=5 glusterfs-api >/dev/null 2>&1; then 26000c14fb47SBharata B Rao glusterfs_discard="yes" 26010c14fb47SBharata B Rao fi 2602eb100396SBharata B Rao else 2603eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 2604eb100396SBharata B Rao feature_not_found "GlusterFS backend support" 2605eb100396SBharata B Rao fi 2606e01bee08SBharata B Rao glusterfs="no" 2607eb100396SBharata B Rao fi 2608eb100396SBharata B Raofi 2609eb100396SBharata B Rao 261039386ac7Saurel32# Check for inotify functions when we are building linux-user 26113b3f24adSaurel32# emulator. This is done because older glibc versions don't 26123b3f24adSaurel32# have syscall stubs for these implemented. In that case we 26133b3f24adSaurel32# don't provide them even if kernel supports them. 26143b3f24adSaurel32# 26153b3f24adSaurel32inotify=no 26163b3f24adSaurel32cat > $TMPC << EOF 26173b3f24adSaurel32#include <sys/inotify.h> 26183b3f24adSaurel32 26193b3f24adSaurel32int 26203b3f24adSaurel32main(void) 26213b3f24adSaurel32{ 26223b3f24adSaurel32 /* try to start inotify */ 26238690e420Saurel32 return inotify_init(); 26243b3f24adSaurel32} 26253b3f24adSaurel32EOF 262652166aa0SJuan Quintelaif compile_prog "" "" ; then 26273b3f24adSaurel32 inotify=yes 26283b3f24adSaurel32fi 26293b3f24adSaurel32 2630c05c7a73SRiku Voipioinotify1=no 2631c05c7a73SRiku Voipiocat > $TMPC << EOF 2632c05c7a73SRiku Voipio#include <sys/inotify.h> 2633c05c7a73SRiku Voipio 2634c05c7a73SRiku Voipioint 2635c05c7a73SRiku Voipiomain(void) 2636c05c7a73SRiku Voipio{ 2637c05c7a73SRiku Voipio /* try to start inotify */ 2638c05c7a73SRiku Voipio return inotify_init1(0); 2639c05c7a73SRiku Voipio} 2640c05c7a73SRiku VoipioEOF 2641c05c7a73SRiku Voipioif compile_prog "" "" ; then 2642c05c7a73SRiku Voipio inotify1=yes 2643c05c7a73SRiku Voipiofi 2644c05c7a73SRiku Voipio 2645ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2646ebc996f3SRiku Voipioutimens=no 2647ebc996f3SRiku Voipiocat > $TMPC << EOF 2648ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2649ebc996f3SRiku Voipio#include <stddef.h> 2650ebc996f3SRiku Voipio#include <fcntl.h> 26513014ee00SPeter Maydell#include <sys/stat.h> 2652ebc996f3SRiku Voipio 2653ebc996f3SRiku Voipioint main(void) 2654ebc996f3SRiku Voipio{ 2655ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2656ebc996f3SRiku Voipio futimens(0, NULL); 2657ebc996f3SRiku Voipio return 0; 2658ebc996f3SRiku Voipio} 2659ebc996f3SRiku VoipioEOF 266052166aa0SJuan Quintelaif compile_prog "" "" ; then 2661ebc996f3SRiku Voipio utimens=yes 2662ebc996f3SRiku Voipiofi 2663ebc996f3SRiku Voipio 2664099d6b0fSRiku Voipio# check if pipe2 is there 2665099d6b0fSRiku Voipiopipe2=no 2666099d6b0fSRiku Voipiocat > $TMPC << EOF 2667099d6b0fSRiku Voipio#include <unistd.h> 2668099d6b0fSRiku Voipio#include <fcntl.h> 2669099d6b0fSRiku Voipio 2670099d6b0fSRiku Voipioint main(void) 2671099d6b0fSRiku Voipio{ 2672099d6b0fSRiku Voipio int pipefd[2]; 26739bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 2674099d6b0fSRiku Voipio} 2675099d6b0fSRiku VoipioEOF 267652166aa0SJuan Quintelaif compile_prog "" "" ; then 2677099d6b0fSRiku Voipio pipe2=yes 2678099d6b0fSRiku Voipiofi 2679099d6b0fSRiku Voipio 268040ff6d7eSKevin Wolf# check if accept4 is there 268140ff6d7eSKevin Wolfaccept4=no 268240ff6d7eSKevin Wolfcat > $TMPC << EOF 268340ff6d7eSKevin Wolf#include <sys/socket.h> 268440ff6d7eSKevin Wolf#include <stddef.h> 268540ff6d7eSKevin Wolf 268640ff6d7eSKevin Wolfint main(void) 268740ff6d7eSKevin Wolf{ 268840ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 268940ff6d7eSKevin Wolf return 0; 269040ff6d7eSKevin Wolf} 269140ff6d7eSKevin WolfEOF 269240ff6d7eSKevin Wolfif compile_prog "" "" ; then 269340ff6d7eSKevin Wolf accept4=yes 269440ff6d7eSKevin Wolffi 269540ff6d7eSKevin Wolf 26963ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 26973ce34dfbSvibisreenivasansplice=no 26983ce34dfbSvibisreenivasancat > $TMPC << EOF 26993ce34dfbSvibisreenivasan#include <unistd.h> 27003ce34dfbSvibisreenivasan#include <fcntl.h> 27013ce34dfbSvibisreenivasan#include <limits.h> 27023ce34dfbSvibisreenivasan 27033ce34dfbSvibisreenivasanint main(void) 27043ce34dfbSvibisreenivasan{ 270566ea0f22SStefan Weil int len, fd = 0; 27063ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 27073ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 27083ce34dfbSvibisreenivasan return 0; 27093ce34dfbSvibisreenivasan} 27103ce34dfbSvibisreenivasanEOF 271152166aa0SJuan Quintelaif compile_prog "" "" ; then 27123ce34dfbSvibisreenivasan splice=yes 27133ce34dfbSvibisreenivasanfi 27143ce34dfbSvibisreenivasan 2715dcc38d1cSMarcelo Tosatti########################################## 2716dcc38d1cSMarcelo Tosatti# signalfd probe 2717dcc38d1cSMarcelo Tosattisignalfd="no" 2718dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2719dcc38d1cSMarcelo Tosatti#include <unistd.h> 2720dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2721dcc38d1cSMarcelo Tosatti#include <signal.h> 2722dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2723dcc38d1cSMarcelo TosattiEOF 2724dcc38d1cSMarcelo Tosatti 2725dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2726dcc38d1cSMarcelo Tosatti signalfd=yes 2727dcc38d1cSMarcelo Tosattifi 2728dcc38d1cSMarcelo Tosatti 2729c2882b96SRiku Voipio# check if eventfd is supported 2730c2882b96SRiku Voipioeventfd=no 2731c2882b96SRiku Voipiocat > $TMPC << EOF 2732c2882b96SRiku Voipio#include <sys/eventfd.h> 2733c2882b96SRiku Voipio 2734c2882b96SRiku Voipioint main(void) 2735c2882b96SRiku Voipio{ 273655cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 2737c2882b96SRiku Voipio} 2738c2882b96SRiku VoipioEOF 2739c2882b96SRiku Voipioif compile_prog "" "" ; then 2740c2882b96SRiku Voipio eventfd=yes 2741c2882b96SRiku Voipiofi 2742c2882b96SRiku Voipio 2743d0927938SUlrich Hecht# check for fallocate 2744d0927938SUlrich Hechtfallocate=no 2745d0927938SUlrich Hechtcat > $TMPC << EOF 2746d0927938SUlrich Hecht#include <fcntl.h> 2747d0927938SUlrich Hecht 2748d0927938SUlrich Hechtint main(void) 2749d0927938SUlrich Hecht{ 2750d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2751d0927938SUlrich Hecht return 0; 2752d0927938SUlrich Hecht} 2753d0927938SUlrich HechtEOF 27548fb03151SPeter Maydellif compile_prog "" "" ; then 2755d0927938SUlrich Hecht fallocate=yes 2756d0927938SUlrich Hechtfi 2757d0927938SUlrich Hecht 27583d4fa43eSKusanagi Kouichi# check for fallocate hole punching 27593d4fa43eSKusanagi Kouichifallocate_punch_hole=no 27603d4fa43eSKusanagi Kouichicat > $TMPC << EOF 27613d4fa43eSKusanagi Kouichi#include <fcntl.h> 27623d4fa43eSKusanagi Kouichi#include <linux/falloc.h> 27633d4fa43eSKusanagi Kouichi 27643d4fa43eSKusanagi Kouichiint main(void) 27653d4fa43eSKusanagi Kouichi{ 27663d4fa43eSKusanagi Kouichi fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0); 27673d4fa43eSKusanagi Kouichi return 0; 27683d4fa43eSKusanagi Kouichi} 27693d4fa43eSKusanagi KouichiEOF 27703d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then 27713d4fa43eSKusanagi Kouichi fallocate_punch_hole=yes 27723d4fa43eSKusanagi Kouichifi 27733d4fa43eSKusanagi Kouichi 2774c727f47dSPeter Maydell# check for sync_file_range 2775c727f47dSPeter Maydellsync_file_range=no 2776c727f47dSPeter Maydellcat > $TMPC << EOF 2777c727f47dSPeter Maydell#include <fcntl.h> 2778c727f47dSPeter Maydell 2779c727f47dSPeter Maydellint main(void) 2780c727f47dSPeter Maydell{ 2781c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2782c727f47dSPeter Maydell return 0; 2783c727f47dSPeter Maydell} 2784c727f47dSPeter MaydellEOF 27858fb03151SPeter Maydellif compile_prog "" "" ; then 2786c727f47dSPeter Maydell sync_file_range=yes 2787c727f47dSPeter Maydellfi 2788c727f47dSPeter Maydell 2789dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2790dace20dcSPeter Maydellfiemap=no 2791dace20dcSPeter Maydellcat > $TMPC << EOF 2792dace20dcSPeter Maydell#include <sys/ioctl.h> 2793dace20dcSPeter Maydell#include <linux/fs.h> 2794dace20dcSPeter Maydell#include <linux/fiemap.h> 2795dace20dcSPeter Maydell 2796dace20dcSPeter Maydellint main(void) 2797dace20dcSPeter Maydell{ 2798dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2799dace20dcSPeter Maydell return 0; 2800dace20dcSPeter Maydell} 2801dace20dcSPeter MaydellEOF 28028fb03151SPeter Maydellif compile_prog "" "" ; then 2803dace20dcSPeter Maydell fiemap=yes 2804dace20dcSPeter Maydellfi 2805dace20dcSPeter Maydell 2806d0927938SUlrich Hecht# check for dup3 2807d0927938SUlrich Hechtdup3=no 2808d0927938SUlrich Hechtcat > $TMPC << EOF 2809d0927938SUlrich Hecht#include <unistd.h> 2810d0927938SUlrich Hecht 2811d0927938SUlrich Hechtint main(void) 2812d0927938SUlrich Hecht{ 2813d0927938SUlrich Hecht dup3(0, 0, 0); 2814d0927938SUlrich Hecht return 0; 2815d0927938SUlrich Hecht} 2816d0927938SUlrich HechtEOF 281778f5d726SJan Kiszkaif compile_prog "" "" ; then 2818d0927938SUlrich Hecht dup3=yes 2819d0927938SUlrich Hechtfi 2820d0927938SUlrich Hecht 28213b6edd16SPeter Maydell# check for epoll support 28223b6edd16SPeter Maydellepoll=no 28233b6edd16SPeter Maydellcat > $TMPC << EOF 28243b6edd16SPeter Maydell#include <sys/epoll.h> 28253b6edd16SPeter Maydell 28263b6edd16SPeter Maydellint main(void) 28273b6edd16SPeter Maydell{ 28283b6edd16SPeter Maydell epoll_create(0); 28293b6edd16SPeter Maydell return 0; 28303b6edd16SPeter Maydell} 28313b6edd16SPeter MaydellEOF 28328fb03151SPeter Maydellif compile_prog "" "" ; then 28333b6edd16SPeter Maydell epoll=yes 28343b6edd16SPeter Maydellfi 28353b6edd16SPeter Maydell 28363b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 28373b6edd16SPeter Maydell# so we must check separately for their presence 28383b6edd16SPeter Maydellepoll_create1=no 28393b6edd16SPeter Maydellcat > $TMPC << EOF 28403b6edd16SPeter Maydell#include <sys/epoll.h> 28413b6edd16SPeter Maydell 28423b6edd16SPeter Maydellint main(void) 28433b6edd16SPeter Maydell{ 284419e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 284519e83f6bSPeter Maydell * a function being called. This is necessary so that on 284619e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 284719e83f6bSPeter Maydell * the library but not declared in the header file we will 284819e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 284919e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 285019e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 285119e83f6bSPeter Maydell */ 2852c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 28533b6edd16SPeter Maydell} 28543b6edd16SPeter MaydellEOF 28558fb03151SPeter Maydellif compile_prog "" "" ; then 28563b6edd16SPeter Maydell epoll_create1=yes 28573b6edd16SPeter Maydellfi 28583b6edd16SPeter Maydell 28593b6edd16SPeter Maydellepoll_pwait=no 28603b6edd16SPeter Maydellcat > $TMPC << EOF 28613b6edd16SPeter Maydell#include <sys/epoll.h> 28623b6edd16SPeter Maydell 28633b6edd16SPeter Maydellint main(void) 28643b6edd16SPeter Maydell{ 28653b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 28663b6edd16SPeter Maydell return 0; 28673b6edd16SPeter Maydell} 28683b6edd16SPeter MaydellEOF 28698fb03151SPeter Maydellif compile_prog "" "" ; then 28703b6edd16SPeter Maydell epoll_pwait=yes 28713b6edd16SPeter Maydellfi 28723b6edd16SPeter Maydell 2873a8fd1abaSPeter Maydell# check for sendfile support 2874a8fd1abaSPeter Maydellsendfile=no 2875a8fd1abaSPeter Maydellcat > $TMPC << EOF 2876a8fd1abaSPeter Maydell#include <sys/sendfile.h> 2877a8fd1abaSPeter Maydell 2878a8fd1abaSPeter Maydellint main(void) 2879a8fd1abaSPeter Maydell{ 2880a8fd1abaSPeter Maydell return sendfile(0, 0, 0, 0); 2881a8fd1abaSPeter Maydell} 2882a8fd1abaSPeter MaydellEOF 2883a8fd1abaSPeter Maydellif compile_prog "" "" ; then 2884a8fd1abaSPeter Maydell sendfile=yes 2885a8fd1abaSPeter Maydellfi 2886a8fd1abaSPeter Maydell 2887cc8ae6deSpbrook# Check if tools are available to build documentation. 2888a25dba17SJuan Quintelaif test "$docs" != "no" ; then 288901668d98SStefan Weil if has makeinfo && has pod2man; then 2890a25dba17SJuan Quintela docs=yes 289183a3ab8bSJuan Quintela else 2892a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2893a25dba17SJuan Quintela feature_not_found "docs" 289483a3ab8bSJuan Quintela fi 2895a25dba17SJuan Quintela docs=no 289683a3ab8bSJuan Quintela fi 2897cc8ae6deSpbrookfi 2898cc8ae6deSpbrook 2899f514f41cSStefan Weil# Search for bswap_32 function 29006ae9a1f4SJuan Quintelabyteswap_h=no 29016ae9a1f4SJuan Quintelacat > $TMPC << EOF 29026ae9a1f4SJuan Quintela#include <byteswap.h> 29036ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 29046ae9a1f4SJuan QuintelaEOF 290552166aa0SJuan Quintelaif compile_prog "" "" ; then 29066ae9a1f4SJuan Quintela byteswap_h=yes 29076ae9a1f4SJuan Quintelafi 29086ae9a1f4SJuan Quintela 290975f13596SStefan Weil# Search for bswap32 function 29106ae9a1f4SJuan Quintelabswap_h=no 29116ae9a1f4SJuan Quintelacat > $TMPC << EOF 29126ae9a1f4SJuan Quintela#include <sys/endian.h> 29136ae9a1f4SJuan Quintela#include <sys/types.h> 29146ae9a1f4SJuan Quintela#include <machine/bswap.h> 29156ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 29166ae9a1f4SJuan QuintelaEOF 291752166aa0SJuan Quintelaif compile_prog "" "" ; then 29186ae9a1f4SJuan Quintela bswap_h=yes 29196ae9a1f4SJuan Quintelafi 29206ae9a1f4SJuan Quintela 2921da93a1fdSaliguori########################################## 2922c589b249SRonnie Sahlberg# Do we have libiscsi 2923fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a 2924fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi. 2925c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 2926c589b249SRonnie Sahlberg cat > $TMPC << EOF 2927fa6acb0cSRonnie Sahlberg#include <stdio.h> 2928c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 2929fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; } 2930c589b249SRonnie SahlbergEOF 29313c33ea96SPaolo Bonzini if $pkg_config --atleast-version=1.7.0 libiscsi --modversion >/dev/null 2>&1; then 29323c33ea96SPaolo Bonzini libiscsi="yes" 29333c33ea96SPaolo Bonzini libiscsi_cflags=$($pkg_config --cflags libiscsi 2>/dev/null) 29343c33ea96SPaolo Bonzini libiscsi_libs=$($pkg_config --libs libiscsi 2>/dev/null) 29353c33ea96SPaolo Bonzini CFLAGS="$CFLAGS $libiscsi_cflags" 29363c33ea96SPaolo Bonzini LIBS="$LIBS $libiscsi_libs" 29373c33ea96SPaolo Bonzini elif compile_prog "" "-liscsi" ; then 2938c589b249SRonnie Sahlberg libiscsi="yes" 2939c589b249SRonnie Sahlberg LIBS="$LIBS -liscsi" 2940c589b249SRonnie Sahlberg else 2941c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 2942c589b249SRonnie Sahlberg feature_not_found "libiscsi" 2943c589b249SRonnie Sahlberg fi 2944c589b249SRonnie Sahlberg libiscsi="no" 2945c589b249SRonnie Sahlberg fi 2946c589b249SRonnie Sahlbergfi 2947c589b249SRonnie Sahlberg 2948c589b249SRonnie Sahlberg 2949c589b249SRonnie Sahlberg########################################## 29508bacde8dSNatanael Copa# Do we need libm 29518bacde8dSNatanael Copacat > $TMPC << EOF 29528bacde8dSNatanael Copa#include <math.h> 29538bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); } 29548bacde8dSNatanael CopaEOF 29558bacde8dSNatanael Copaif compile_prog "" "" ; then 29568bacde8dSNatanael Copa : 29578bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 29588bacde8dSNatanael Copa LIBS="-lm $LIBS" 29598bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 29608bacde8dSNatanael Copaelse 296176ad07a4SPeter Maydell error_exit "libm check failed" 29628bacde8dSNatanael Copafi 29638bacde8dSNatanael Copa 29648bacde8dSNatanael Copa########################################## 2965da93a1fdSaliguori# Do we need librt 29668bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 29678bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 29688bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 29698bacde8dSNatanael Copa# function in addition. 2970da93a1fdSaliguoricat > $TMPC <<EOF 2971da93a1fdSaliguori#include <signal.h> 2972da93a1fdSaliguori#include <time.h> 29738bacde8dSNatanael Copaint main(void) { 29748bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 29758bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 29768bacde8dSNatanael Copa} 2977da93a1fdSaliguoriEOF 2978da93a1fdSaliguori 297952166aa0SJuan Quintelaif compile_prog "" "" ; then 298007ffa4bdSJuan Quintela : 29818bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 29828bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then 298307ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 29848bacde8dSNatanael Copa libs_qga="-lrt $libs_qga" 2985da93a1fdSaliguorifi 2986da93a1fdSaliguori 298731ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2988179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 29896362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 29906362a53fSJuan Quintelafi 29916362a53fSJuan Quintela 2992de5071c5SBlue Swirl########################################## 2993cd4ec0b4SGerd Hoffmann# spice probe 2994cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2995cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2996cd4ec0b4SGerd Hoffmann#include <spice.h> 2997cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2998cd4ec0b4SGerd HoffmannEOF 2999710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 3000710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 300167be6726SGerd Hoffmann if $pkg_config --atleast-version=0.12.0 spice-server >/dev/null 2>&1 && \ 3002358689feSMichal Privoznik $pkg_config --atleast-version=0.12.3 spice-protocol > /dev/null 2>&1 && \ 3003cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 3004cd4ec0b4SGerd Hoffmann spice="yes" 3005cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 3006cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 30072e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 30082e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 3009cd4ec0b4SGerd Hoffmann else 3010cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 3011cd4ec0b4SGerd Hoffmann feature_not_found "spice" 3012cd4ec0b4SGerd Hoffmann fi 3013cd4ec0b4SGerd Hoffmann spice="no" 3014cd4ec0b4SGerd Hoffmann fi 3015cd4ec0b4SGerd Hoffmannfi 3016cd4ec0b4SGerd Hoffmann 3017111a38b0SRobert Relyea# check for libcacard for smartcard support 3018111a38b0SRobert Relyeasmartcard_cflags="" 3019111a38b0SRobert Relyea# TODO - what's the minimal nss version we support? 3020111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then 30215f01e06fSSergei Trofimovich cat > $TMPC << EOF 30225f01e06fSSergei Trofimovich#include <pk11pub.h> 30235f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; } 30245f01e06fSSergei TrofimovichEOF 30250b22ef0fSPeter Maydell smartcard_includes="-I\$(SRC_PATH)/libcacard" 30268c741c22SAlon Levy libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" 30278c741c22SAlon Levy libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" 30286ca026cbSPeter Maydell test_cflags="$libcacard_cflags" 30296ca026cbSPeter Maydell # The header files in nss < 3.13.3 have a bug which causes them to 30306ca026cbSPeter Maydell # emit a warning. If we're going to compile QEMU with -Werror, then 30316ca026cbSPeter Maydell # test that the headers don't have this bug. Otherwise we would pass 30326ca026cbSPeter Maydell # the configure test but fail to compile QEMU later. 30336ca026cbSPeter Maydell if test "$werror" = "yes"; then 30346ca026cbSPeter Maydell test_cflags="-Werror $test_cflags" 30356ca026cbSPeter Maydell fi 3036b6fc675bSPaolo Bonzini if test -n "$libtool" && 3037b6fc675bSPaolo Bonzini $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ 30386ca026cbSPeter Maydell compile_prog "$test_cflags" "$libcacard_libs"; then 30395f01e06fSSergei Trofimovich smartcard_nss="yes" 30400b22ef0fSPeter Maydell QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" 30410b22ef0fSPeter Maydell QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes" 3042ad4cf3f6SPaul Brook libs_softmmu="$libcacard_libs $libs_softmmu" 3043111a38b0SRobert Relyea else 3044111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 3045111a38b0SRobert Relyea feature_not_found "nss" 3046111a38b0SRobert Relyea fi 3047111a38b0SRobert Relyea smartcard_nss="no" 3048111a38b0SRobert Relyea fi 3049111a38b0SRobert Relyeafi 3050111a38b0SRobert Relyea 30512b2325ffSGerd Hoffmann# check for libusb 30522b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then 30533f5cc97eSGerd Hoffmann if $pkg_config --atleast-version=1.0.13 libusb-1.0 >/dev/null 2>&1 ; then 30542b2325ffSGerd Hoffmann libusb="yes" 30552b2325ffSGerd Hoffmann usb="libusb" 30562b2325ffSGerd Hoffmann libusb_cflags=$($pkg_config --cflags libusb-1.0 2>/dev/null) 30572b2325ffSGerd Hoffmann libusb_libs=$($pkg_config --libs libusb-1.0 2>/dev/null) 30582b2325ffSGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags" 30592b2325ffSGerd Hoffmann libs_softmmu="$libs_softmmu $libusb_libs" 30602b2325ffSGerd Hoffmann else 30612b2325ffSGerd Hoffmann if test "$libusb" = "yes"; then 30622b2325ffSGerd Hoffmann feature_not_found "libusb" 30632b2325ffSGerd Hoffmann fi 30642b2325ffSGerd Hoffmann libusb="no" 30652b2325ffSGerd Hoffmann fi 30662b2325ffSGerd Hoffmannfi 30672b2325ffSGerd Hoffmann 306869354a83SHans de Goede# check for usbredirparser for usb network redirection support 306969354a83SHans de Goedeif test "$usb_redir" != "no" ; then 3070b2d1fe67SHans de Goede if $pkg_config --atleast-version=0.6 libusbredirparser-0.5 >/dev/null 2>&1 ; then 307169354a83SHans de Goede usb_redir="yes" 30728b626aa7SHans de Goede usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5 2>/dev/null) 30738b626aa7SHans de Goede usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5 2>/dev/null) 307469354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 307556ab2ad1SAurelien Jarno libs_softmmu="$libs_softmmu $usb_redir_libs" 307669354a83SHans de Goede else 307769354a83SHans de Goede if test "$usb_redir" = "yes"; then 307869354a83SHans de Goede feature_not_found "usb-redir" 307969354a83SHans de Goede fi 308069354a83SHans de Goede usb_redir="no" 308169354a83SHans de Goede fi 308269354a83SHans de Goedefi 308369354a83SHans de Goede 3084cd4ec0b4SGerd Hoffmann########################################## 3085cd4ec0b4SGerd Hoffmann 3086747bbdf7SBlue Swirl########################################## 30875f6b9e8fSBlue Swirl# check if we have fdatasync 30885f6b9e8fSBlue Swirl 30895f6b9e8fSBlue Swirlfdatasync=no 30905f6b9e8fSBlue Swirlcat > $TMPC << EOF 30915f6b9e8fSBlue Swirl#include <unistd.h> 3092d1722a27SAlexandre Raymondint main(void) { 3093d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 3094d1722a27SAlexandre Raymondreturn fdatasync(0); 3095d1722a27SAlexandre Raymond#else 3096e172fe11SStefan Weil#error Not supported 3097d1722a27SAlexandre Raymond#endif 3098d1722a27SAlexandre Raymond} 30995f6b9e8fSBlue SwirlEOF 31005f6b9e8fSBlue Swirlif compile_prog "" "" ; then 31015f6b9e8fSBlue Swirl fdatasync=yes 31025f6b9e8fSBlue Swirlfi 31035f6b9e8fSBlue Swirl 310494a420b1SStefan Hajnoczi########################################## 3105e78815a5SAndreas Färber# check if we have madvise 3106e78815a5SAndreas Färber 3107e78815a5SAndreas Färbermadvise=no 3108e78815a5SAndreas Färbercat > $TMPC << EOF 3109e78815a5SAndreas Färber#include <sys/types.h> 3110e78815a5SAndreas Färber#include <sys/mman.h> 3111832ce9c2SScott Wood#include <stddef.h> 3112e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 3113e78815a5SAndreas FärberEOF 3114e78815a5SAndreas Färberif compile_prog "" "" ; then 3115e78815a5SAndreas Färber madvise=yes 3116e78815a5SAndreas Färberfi 3117e78815a5SAndreas Färber 3118e78815a5SAndreas Färber########################################## 3119e78815a5SAndreas Färber# check if we have posix_madvise 3120e78815a5SAndreas Färber 3121e78815a5SAndreas Färberposix_madvise=no 3122e78815a5SAndreas Färbercat > $TMPC << EOF 3123e78815a5SAndreas Färber#include <sys/mman.h> 3124832ce9c2SScott Wood#include <stddef.h> 3125e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 3126e78815a5SAndreas FärberEOF 3127e78815a5SAndreas Färberif compile_prog "" "" ; then 3128e78815a5SAndreas Färber posix_madvise=yes 3129e78815a5SAndreas Färberfi 3130e78815a5SAndreas Färber 3131e78815a5SAndreas Färber########################################## 31321e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID 31331e9737daSRichard Henderson 31341e9737daSRichard Hendersonsigev_thread_id=no 31351e9737daSRichard Hendersoncat > $TMPC << EOF 31361e9737daSRichard Henderson#include <signal.h> 31371e9737daSRichard Hendersonint main(void) { 31381e9737daSRichard Henderson struct sigevent ev; 31391e9737daSRichard Henderson ev.sigev_notify = SIGEV_THREAD_ID; 31401e9737daSRichard Henderson ev._sigev_un._tid = 0; 31411e9737daSRichard Henderson asm volatile("" : : "g"(&ev)); 31421e9737daSRichard Henderson return 0; 31431e9737daSRichard Henderson} 31441e9737daSRichard HendersonEOF 31451e9737daSRichard Hendersonif compile_prog "" "" ; then 31461e9737daSRichard Henderson sigev_thread_id=yes 31471e9737daSRichard Hendersonfi 31481e9737daSRichard Henderson 31491e9737daSRichard Henderson########################################## 315094a420b1SStefan Hajnoczi# check if trace backend exists 315194a420b1SStefan Hajnoczi 3152650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null 315394a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 315476ad07a4SPeter Maydell error_exit "invalid trace backend" \ 315576ad07a4SPeter Maydell "Please choose a supported trace backend." 315694a420b1SStefan Hajnoczifi 315794a420b1SStefan Hajnoczi 31587e24e92aSStefan Hajnoczi########################################## 31597e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 31607e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 31617e24e92aSStefan Hajnoczi cat > $TMPC << EOF 31627e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 31637e24e92aSStefan Hajnoczi#include <ust/marker.h> 31647e24e92aSStefan Hajnocziint main(void) { return 0; } 31657e24e92aSStefan HajnocziEOF 31667e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 316794b4fefaSLluís Vilanova LIBS="-lust -lurcu-bp $LIBS" 3168c9a2e37cSLluís Vilanova libs_qga="-lust -lurcu-bp $libs_qga" 31697e24e92aSStefan Hajnoczi else 317076ad07a4SPeter Maydell error_exit "Trace backend 'ust' missing libust header files" 31717e24e92aSStefan Hajnoczi fi 31727e24e92aSStefan Hajnoczifi 3173b3d08c02SDaniel P. Berrange 3174b3d08c02SDaniel P. Berrange########################################## 3175b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 3176b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 3177b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 317876ad07a4SPeter Maydell error_exit "dtrace command is not found in PATH $PATH" 3179b3d08c02SDaniel P. Berrange fi 3180c276b17dSDaniel P. Berrange trace_backend_stap="no" 3181c276b17dSDaniel P. Berrange if has 'stap' ; then 3182c276b17dSDaniel P. Berrange trace_backend_stap="yes" 3183c276b17dSDaniel P. Berrange fi 3184b3d08c02SDaniel P. Berrangefi 3185b3d08c02SDaniel P. Berrange 31867e24e92aSStefan Hajnoczi########################################## 3187519175a2SAlex Barcelo# check and set a backend for coroutine 3188d0e2fce5SAneesh Kumar K.V 31897c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback 31907c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because 31917c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally 31927c2acc70SPeter Maydell# useful for debugging purposes.) On Windows the only valid backend 31937c2acc70SPeter Maydell# is the Windows-specific one. 31947c2acc70SPeter Maydell 31957c2acc70SPeter Maydellucontext_works=no 3196d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 3197d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 3198d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 3199cdf84806SPeter Maydell#ifdef __stub_makecontext 3200cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 3201cdf84806SPeter Maydell#endif 320275cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 3203d0e2fce5SAneesh Kumar K.VEOF 3204d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 32057c2acc70SPeter Maydell ucontext_works=yes 3206d0e2fce5SAneesh Kumar K.V fi 3207519175a2SAlex Barcelofi 32087c2acc70SPeter Maydell 32097c2acc70SPeter Maydellif test "$coroutine" = ""; then 32107c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 32117c2acc70SPeter Maydell coroutine=win32 32127c2acc70SPeter Maydell elif test "$ucontext_works" = "yes"; then 32137c2acc70SPeter Maydell coroutine=ucontext 3214519175a2SAlex Barcelo else 32157c2acc70SPeter Maydell coroutine=sigaltstack 32167c2acc70SPeter Maydell fi 32177c2acc70SPeter Maydellelse 32187c2acc70SPeter Maydell case $coroutine in 32197c2acc70SPeter Maydell windows) 32207c2acc70SPeter Maydell if test "$mingw32" != "yes"; then 32217c2acc70SPeter Maydell error_exit "'windows' coroutine backend only valid for Windows" 32227c2acc70SPeter Maydell fi 32237c2acc70SPeter Maydell # Unfortunately the user visible backend name doesn't match the 32247c2acc70SPeter Maydell # coroutine-*.c filename for this case, so we have to adjust it here. 32257c2acc70SPeter Maydell coroutine=win32 32267c2acc70SPeter Maydell ;; 32277c2acc70SPeter Maydell ucontext) 32287c2acc70SPeter Maydell if test "$ucontext_works" != "yes"; then 32297c2acc70SPeter Maydell feature_not_found "ucontext" 32307c2acc70SPeter Maydell fi 32317c2acc70SPeter Maydell ;; 32327c2acc70SPeter Maydell gthread|sigaltstack) 32337c2acc70SPeter Maydell if test "$mingw32" = "yes"; then 32347c2acc70SPeter Maydell error_exit "only the 'windows' coroutine backend is valid for Windows" 32357c2acc70SPeter Maydell fi 32367c2acc70SPeter Maydell ;; 32377c2acc70SPeter Maydell *) 323876ad07a4SPeter Maydell error_exit "unknown coroutine backend $coroutine" 32397c2acc70SPeter Maydell ;; 32407c2acc70SPeter Maydell esac 3241d0e2fce5SAneesh Kumar K.Vfi 3242d0e2fce5SAneesh Kumar K.V 3243d0e2fce5SAneesh Kumar K.V########################################## 3244d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 3245d2042378SAneesh Kumar K.V 32464e1797f9SStefan Weilopen_by_handle_at=no 3247d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 3248d2042378SAneesh Kumar K.V#include <fcntl.h> 3249acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 3250acc55ba8SStefan Weil# error missing definition 3251acc55ba8SStefan Weil#else 325275cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 3253acc55ba8SStefan Weil#endif 3254d2042378SAneesh Kumar K.VEOF 3255d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 3256d2042378SAneesh Kumar K.V open_by_handle_at=yes 3257d2042378SAneesh Kumar K.Vfi 3258d2042378SAneesh Kumar K.V 3259e06a765eSHarsh Prateek Bora######################################## 3260e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 3261e06a765eSHarsh Prateek Bora 3262e06a765eSHarsh Prateek Boralinux_magic_h=no 3263e06a765eSHarsh Prateek Boracat > $TMPC << EOF 3264e06a765eSHarsh Prateek Bora#include <linux/magic.h> 3265e06a765eSHarsh Prateek Boraint main(void) { 326675cafad7SStefan Weil return 0; 3267e06a765eSHarsh Prateek Bora} 3268e06a765eSHarsh Prateek BoraEOF 3269e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 3270e06a765eSHarsh Prateek Bora linux_magic_h=yes 3271e06a765eSHarsh Prateek Borafi 3272e06a765eSHarsh Prateek Bora 32738ab1bf12SLuiz Capitulino######################################## 3274c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed 3275c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries). 3276c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is 3277c95e3080SKevin Wolf# only a warning. 3278c95e3080SKevin Wolf# 3279c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that 3280c95e3080SKevin Wolf# the build doesn't fail anyway. 3281c95e3080SKevin Wolf 328206d71fa1SPeter Maydellpragma_disable_unused_but_set=no 328306d71fa1SPeter Maydellcat > $TMPC << EOF 3284e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push 328506d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable" 3286c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes" 3287e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop 3288c95e3080SKevin Wolf 328906d71fa1SPeter Maydellint main(void) { 329006d71fa1SPeter Maydell return 0; 329106d71fa1SPeter Maydell} 329206d71fa1SPeter MaydellEOF 329306d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 3294cc6e3ca9SGerd Hoffmann pragma_diagnostic_available=yes 3295c95e3080SKevin Wolfelse 3296c95e3080SKevin Wolf werror=no 329706d71fa1SPeter Maydellfi 329806d71fa1SPeter Maydell 329906d71fa1SPeter Maydell######################################## 330062fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h 33013f4349dcSKevin Wolf 33023f4349dcSKevin Wolfvalgrind_h=no 33033f4349dcSKevin Wolfcat > $TMPC << EOF 33043f4349dcSKevin Wolf#include <valgrind/valgrind.h> 330562fe8331SChristian Borntraeger#include <valgrind/memcheck.h> 33063f4349dcSKevin Wolfint main(void) { 33073f4349dcSKevin Wolf return 0; 33083f4349dcSKevin Wolf} 33093f4349dcSKevin WolfEOF 33103f4349dcSKevin Wolfif compile_prog "" "" ; then 33113f4349dcSKevin Wolf valgrind_h=yes 33123f4349dcSKevin Wolffi 33133f4349dcSKevin Wolf 33143f4349dcSKevin Wolf######################################## 33158ab1bf12SLuiz Capitulino# check if environ is declared 33168ab1bf12SLuiz Capitulino 33178ab1bf12SLuiz Capitulinohas_environ=no 33188ab1bf12SLuiz Capitulinocat > $TMPC << EOF 33198ab1bf12SLuiz Capitulino#include <unistd.h> 33208ab1bf12SLuiz Capitulinoint main(void) { 3321c075a723SBlue Swirl environ = 0; 33228ab1bf12SLuiz Capitulino return 0; 33238ab1bf12SLuiz Capitulino} 33248ab1bf12SLuiz CapitulinoEOF 33258ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 33268ab1bf12SLuiz Capitulino has_environ=yes 33278ab1bf12SLuiz Capitulinofi 33288ab1bf12SLuiz Capitulino 332976a347e1SRichard Henderson######################################## 333076a347e1SRichard Henderson# check if cpuid.h is usable. 333176a347e1SRichard Henderson 333276a347e1SRichard Hendersoncpuid_h=no 333376a347e1SRichard Hendersoncat > $TMPC << EOF 333476a347e1SRichard Henderson#include <cpuid.h> 333576a347e1SRichard Hendersonint main(void) { 333676a347e1SRichard Henderson return 0; 333776a347e1SRichard Henderson} 333876a347e1SRichard HendersonEOF 333976a347e1SRichard Hendersonif compile_prog "" "" ; then 334076a347e1SRichard Henderson cpuid_h=yes 334176a347e1SRichard Hendersonfi 334276a347e1SRichard Henderson 3343f540166bSRichard Henderson######################################## 3344f540166bSRichard Henderson# check if __[u]int128_t is usable. 3345f540166bSRichard Henderson 3346f540166bSRichard Hendersonint128=no 3347f540166bSRichard Hendersoncat > $TMPC << EOF 3348f540166bSRichard Henderson__int128_t a; 3349f540166bSRichard Henderson__uint128_t b; 3350f540166bSRichard Hendersonint main (void) { 3351f540166bSRichard Henderson a = a + b; 3352f540166bSRichard Henderson b = a * b; 3353464e3671SPeter Maydell a = a * a; 3354f540166bSRichard Henderson return 0; 3355f540166bSRichard Henderson} 3356f540166bSRichard HendersonEOF 3357f540166bSRichard Hendersonif compile_prog "" "" ; then 3358f540166bSRichard Henderson int128=yes 3359f540166bSRichard Hendersonfi 336076a347e1SRichard Henderson 33611e6e9acaSRichard Henderson######################################## 33621e6e9acaSRichard Henderson# check if getauxval is available. 33631e6e9acaSRichard Henderson 33641e6e9acaSRichard Hendersongetauxval=no 33651e6e9acaSRichard Hendersoncat > $TMPC << EOF 33661e6e9acaSRichard Henderson#include <sys/auxv.h> 33671e6e9acaSRichard Hendersonint main(void) { 33681e6e9acaSRichard Henderson return getauxval(AT_HWCAP) == 0; 33691e6e9acaSRichard Henderson} 33701e6e9acaSRichard HendersonEOF 33711e6e9acaSRichard Hendersonif compile_prog "" "" ; then 33721e6e9acaSRichard Henderson getauxval=yes 33731e6e9acaSRichard Hendersonfi 33741e6e9acaSRichard Henderson 3375d2042378SAneesh Kumar K.V########################################## 3376e86ecd4bSJuan Quintela# End of CC checks 3377e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3378e86ecd4bSJuan Quintela 33791d728c39SBlue Swirlif test "$gcov" = "yes" ; then 33801d728c39SBlue Swirl CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" 33811d728c39SBlue Swirl LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" 33821d728c39SBlue Swirlelif test "$debug" = "no" ; then 33838be74dc0SAvi Kivity CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS" 3384e86ecd4bSJuan Quintelafi 3385a316e378SJuan Quintela 33861d728c39SBlue Swirl 338720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 338820ff6c80SAnthony Liguori# enable/disable 338920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 339020ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 339120ff6c80SAnthony Liguori zero_malloc="no" 339220ff6c80SAnthony Liguori else 339320ff6c80SAnthony Liguori zero_malloc="yes" 339420ff6c80SAnthony Liguori fi 339520ff6c80SAnthony Liguorifi 339620ff6c80SAnthony Liguori 33976ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 33986ca026cbSPeter Maydellif test "$werror" = "yes"; then 33996ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 34006ca026cbSPeter Maydellfi 34016ca026cbSPeter Maydell 3402e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 3403e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 34041156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 3405e86ecd4bSJuan Quintela fi 3406e86ecd4bSJuan Quintelafi 3407e86ecd4bSJuan Quintela 340894dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 340994dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 341094dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 341194dd53c5SGerd Hoffmannelse 341294dd53c5SGerd Hoffmann POD2MAN="pod2man" 341394dd53c5SGerd Hoffmannfi 341494dd53c5SGerd Hoffmann 3415952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3416952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3417952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 3418952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 3419952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 3420952afb71SBlue Swirl fi 3421952afb71SBlue Swirl done 3422952afb71SBlue Swirlfi 3423952afb71SBlue Swirl 342410ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 3425528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 3426834574eaSAnthony Liguoriqemu_localedir="$datadir/locale" 34275a67135aSbellard 34284b1c11fdSDaniel P. Berrangetools="" 34294b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 3430ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 34314b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 34324b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 34334b1c11fdSDaniel P. Berrange fi 34344b1c11fdSDaniel P. Berrangefi 34354b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 3436983eef5aSMeador Inge if test "$virtfs" != no ; then 3437be5ea8edSAnthony Liguori if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then 3438983eef5aSMeador Inge virtfs=yes 343917bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 3440983eef5aSMeador Inge else 3441983eef5aSMeador Inge if test "$virtfs" = yes; then 344276ad07a4SPeter Maydell error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel" 3443983eef5aSMeador Inge fi 344417500370SAndreas Färber virtfs=no 3445983eef5aSMeador Inge fi 344617bff52bSM. Mohan Kumar fi 3447d138cee9SMichael Rothfi 3448*e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then 3449*e8ef31a3SMichael Tokarev if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 3450*e8ef31a3SMichael Tokarev tools="qemu-ga\$(EXESUF) $tools" 3451*e8ef31a3SMichael Tokarev guest_agent=yes 3452*e8ef31a3SMichael Tokarev elif [ "$guest_agent" != yes ]; then 3453*e8ef31a3SMichael Tokarev guest_agent=no 3454*e8ef31a3SMichael Tokarev else 3455*e8ef31a3SMichael Tokarev error_exit "Guest agent is not supported on this platform" 3456ca35f780SPaolo Bonzini fi 34574b1c11fdSDaniel P. Berrangefi 3458ca35f780SPaolo Bonzini 3459ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3460ca35f780SPaolo Bonziniroms= 3461ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 3462ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 3463ca35f780SPaolo Bonzini "$softmmu" = yes ; then 3464ca35f780SPaolo Bonzini roms="optionrom" 3465ca35f780SPaolo Bonzinifi 3466d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 346739ac8455SDavid Gibson roms="$roms spapr-rtas" 346839ac8455SDavid Gibsonfi 3469ca35f780SPaolo Bonzini 34709933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then 34719933c305SChristian Borntraeger roms="$roms s390-ccw" 34729933c305SChristian Borntraegerfi 34739933c305SChristian Borntraeger 3474964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary. 3475964c6fa1SRichard Hendersonif test "$pie" = "no" ; then 3476964c6fa1SRichard Henderson textseg_addr= 3477964c6fa1SRichard Henderson case "$cpu" in 3478964c6fa1SRichard Henderson arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64) 3479964c6fa1SRichard Henderson textseg_addr=0x60000000 3480964c6fa1SRichard Henderson ;; 3481964c6fa1SRichard Henderson mips) 3482964c6fa1SRichard Henderson textseg_addr=0x400000 3483964c6fa1SRichard Henderson ;; 3484964c6fa1SRichard Henderson esac 3485964c6fa1SRichard Henderson if [ -n "$textseg_addr" ]; then 3486964c6fa1SRichard Henderson cat > $TMPC <<EOF 3487964c6fa1SRichard Henderson int main(void) { return 0; } 3488964c6fa1SRichard HendersonEOF 3489964c6fa1SRichard Henderson textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" 3490964c6fa1SRichard Henderson if ! compile_prog "" "$textseg_ldflags"; then 3491964c6fa1SRichard Henderson # In case ld does not support -Ttext-segment, edit the default linker 3492964c6fa1SRichard Henderson # script via sed to set the .text start addr. This is needed on FreeBSD 3493964c6fa1SRichard Henderson # at least. 3494964c6fa1SRichard Henderson $ld --verbose | sed \ 3495964c6fa1SRichard Henderson -e '1,/==================================================/d' \ 3496964c6fa1SRichard Henderson -e '/==================================================/,$d' \ 3497964c6fa1SRichard Henderson -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ 3498964c6fa1SRichard Henderson -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld 3499964c6fa1SRichard Henderson textseg_ldflags="-Wl,-T../config-host.ld" 3500964c6fa1SRichard Henderson fi 3501964c6fa1SRichard Henderson fi 3502964c6fa1SRichard Hendersonfi 3503964c6fa1SRichard Henderson 35045ca9388aSGerd Hoffmann# add pixman flags after all config tests are done 3505a540f158SPeter CrosthwaiteQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags" 35065ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs" 35075ca9388aSGerd Hoffmann 35087d13299dSbellardecho "Install prefix $prefix" 3509c00b2808SEduardo Habkostecho "BIOS directory `eval echo $qemu_datadir`" 3510f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 35113aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 35128bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`" 35130f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 35141c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 351511d9f695Sbellardif test "$mingw32" = "no" ; then 35165a699bbbSLaszlo Ersekecho "local state directory `eval echo $local_statedir`" 3517f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 351843ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 35195a699bbbSLaszlo Ersekelse 35205a699bbbSLaszlo Ersekecho "local state directory queried at runtime" 352111d9f695Sbellardfi 35225a67135aSbellardecho "Source path $source_path" 35237d13299dSbellardecho "C compiler $cc" 352483469015Sbellardecho "Host C compiler $host_cc" 35253c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 35260c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 3527a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 35280c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 35297d13299dSbellardecho "make $make" 35306a882643Spbrookecho "install $install" 3531c886edfbSBlue Swirlecho "python $python" 3532e2d8830eSBradif test "$slirp" = "yes" ; then 3533e2d8830eSBrad echo "smbd $smbd" 3534e2d8830eSBradfi 3535a98fd896Sbellardecho "host CPU $cpu" 3536de83cd02Sbellardecho "host big endian $bigendian" 353797a847bcSbellardecho "target list $target_list" 3538ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 35397d13299dSbellardecho "gprof enabled $gprof" 354003b4fe7dSaliguoriecho "sparse enabled $sparse" 35411625af87Saliguoriecho "strip binaries $strip_opt" 354205c2a3e7Sbellardecho "profiler $profiler" 354343ce4dfeSbellardecho "static build $static" 354485aa5189Sbellardecho "-Werror enabled $werror" 35455b0753e0Sbellardif test "$darwin" = "yes" ; then 35465b0753e0Sbellard echo "Cocoa support $cocoa" 35475b0753e0Sbellardfi 3548e2134eb9SGerd Hoffmannecho "pixman $pixman" 354997a847bcSbellardecho "SDL support $sdl" 3550a4ccabcfSAnthony Liguoriecho "GTK support $gtk" 35514d3b6f6eSbalrogecho "curses support $curses" 3552769ce76dSAlexander Grafecho "curl support $curl" 355367b915a5Sbellardecho "mingw32 support $mingw32" 35540c58ac1cSmalcecho "Audio drivers $audio_drv_list" 3555b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist" 3556b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist" 35578ff9cbf7Smalcecho "Mixer emulation $mixemu" 3558983eef5aSMeador Ingeecho "VirtFS support $virtfs" 3559821601eaSJes Sorensenecho "VNC support $vnc" 3560821601eaSJes Sorensenif test "$vnc" = "yes" ; then 35618d5d2d4cSths echo "VNC TLS support $vnc_tls" 35622f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 35632f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 3564efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 35657536ee4bSTim Hardeck echo "VNC WS support $vnc_ws" 3566821601eaSJes Sorensenfi 35673142255cSblueswir1if test -n "$sparc_cpu"; then 35683142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 35693142255cSblueswir1fi 3570e37630caSaliguoriecho "xen support $xen" 35712e4d9fb1Saurel32echo "brlapi support $brlapi" 3572a20a6f46SJuan Quintelaecho "bluez support $bluez" 3573a25dba17SJuan Quintelaecho "Documentation $docs" 3574c5937220Spbrook[ ! -z "$uname_release" ] && \ 3575c5937220Spbrookecho "uname -r $uname_release" 3576379f6698SPaul Brookecho "GUEST_BASE $guest_base" 357740d6444eSAvi Kivityecho "PIE $pie" 35788a16d273Sthsecho "vde support $vde" 35795c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 3580758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 358177755340Sthsecho "Install blobs $blobs" 3582b31a0277SJuan Quintelaecho "KVM support $kvm" 35832da776dbSMichael R. Hinesecho "RDMA support $rdma" 35849195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 3585f652e6afSaurel32echo "fdt support $fdt" 3586ceb42de8Saliguoriecho "preadv support $preadv" 35875f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 3588e78815a5SAndreas Färberecho "madvise $madvise" 3589e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 35901e9737daSRichard Hendersonecho "sigev_thread_id $sigev_thread_id" 3591ee682d27SStefan Weilecho "uuid support $uuid" 359247e98658SCorey Bryantecho "libcap-ng support $cap_ng" 3593d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 35945e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi" 359594a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 35969410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 35972e0e3c39SAlon Levyecho "spice support $spice ($spice_protocol_version/$spice_server_version)" 3598f27aaf4bSChristian Brunnerecho "rbd support $rbd" 3599dce512deSChristoph Hellwigecho "xfsctl support $xfs" 3600111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 36012b2325ffSGerd Hoffmannecho "libusb $libusb" 360269354a83SHans de Goedeecho "usb net redir $usb_redir" 3603b1e5fff4SMichael Walleecho "GLX support $glx" 3604c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 3605d138cee9SMichael Rothecho "build guest agent $guest_agent" 3606f794573eSEduardo Otuboecho "seccomp support $seccomp" 36077c2acc70SPeter Maydellecho "coroutine backend $coroutine" 3608eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 3609583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane" 36101d728c39SBlue Swirlecho "gcov $gcov_tool" 36111d728c39SBlue Swirlecho "gcov enabled $gcov" 3612ab214c29SStefan Bergerecho "TPM support $tpm" 36130a12ec87SRichard W.M. Jonesecho "libssh2 support $libssh2" 36143b8acc11SPaolo Bonziniecho "TPM passthrough $tpm_passthrough" 36153556c233SPaolo Bonziniecho "QOM debugging $qom_cast_debug" 361667b915a5Sbellard 36171ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 361824b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 3619e8cd23deSbellardfi 362097a847bcSbellard 362198ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 362297a847bcSbellard 3623dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak 3624dbd99ae3SStefan Weil 362598ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 362698ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 362798ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 362898ec69acSJuan Quintelaecho >> $config_host_mak 362998ec69acSJuan Quintela 3630e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 363199d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 363299d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 36333aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 36348bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 36350f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 363699d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 363799d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 363822d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 36399afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 36409afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 36415a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then 3642785c23aeSLuiz Capitulino echo "qemu_localstatedir=$local_statedir" >> $config_host_mak 36435a699bbbSLaszlo Ersekfi 3644f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 3645f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak 3646f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak 3647834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak 3648f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak 3649804edf29SJuan Quintela 365098ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 3651727e5283SPaolo Bonzini 3652727e5283SPaolo Bonzinicase "$cpu" in 3653c6d8ed24SJani Kokkonen arm|i386|x86_64|ppc|aarch64) 3654727e5283SPaolo Bonzini # The TCG interpreter currently does not support ld/st optimization. 3655727e5283SPaolo Bonzini if test "$tcg_interpreter" = "no" ; then 3656727e5283SPaolo Bonzini echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_host_mak 3657727e5283SPaolo Bonzini fi 3658727e5283SPaolo Bonzini ;; 3659727e5283SPaolo Bonziniesac 3660f8393946Saurel32if test "$debug_tcg" = "yes" ; then 36612358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 3662f8393946Saurel32fi 36631625af87Saliguoriif test "$strip_opt" = "yes" ; then 366452ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 36651625af87Saliguorifi 36667d13299dSbellardif test "$bigendian" = "yes" ; then 3667e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 366897a847bcSbellardfi 366967b915a5Sbellardif test "$mingw32" = "yes" ; then 367098ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 36719fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 36729fe6de94SBlue Swirl version_major=${rc_version%%.*} 36739fe6de94SBlue Swirl rc_version=${rc_version#*.} 36749fe6de94SBlue Swirl version_minor=${rc_version%%.*} 36759fe6de94SBlue Swirl rc_version=${rc_version#*.} 36769fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 36779fe6de94SBlue Swirl version_micro=0 36789fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 36799fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 3680210fa556Spbrookelse 368135f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 3682210fa556Spbrookfi 3683128ab2ffSblueswir1 3684dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 3685dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 3686dffcb71cSMark McLoughlinfi 3687dffcb71cSMark McLoughlin 368883fb7adfSbellardif test "$darwin" = "yes" ; then 368998ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 369083fb7adfSbellardfi 3691b29fe3edSmalc 3692b29fe3edSmalcif test "$aix" = "yes" ; then 369398ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 3694b29fe3edSmalcfi 3695b29fe3edSmalc 3696ec530c81Sbellardif test "$solaris" = "yes" ; then 369798ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 36982358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 36990475a5caSths if test "$needs_libsunmath" = "yes" ; then 370075b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 37010475a5caSths fi 3702ec530c81Sbellardfi 3703179cf400SAndreas Färberif test "$haiku" = "yes" ; then 3704179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 3705179cf400SAndreas Färberfi 370697a847bcSbellardif test "$static" = "yes" ; then 370798ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 370897a847bcSbellardfi 37091ba16968SStefan Weilif test "$profiler" = "yes" ; then 37102358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 371105c2a3e7Sbellardfi 3712c20709aaSbellardif test "$slirp" = "yes" ; then 371398ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 3714e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3715c20709aaSbellardfi 37168a16d273Sthsif test "$vde" = "yes" ; then 371798ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 37188a16d273Sthsfi 371947e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 372047e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 372147e98658SCorey Bryantfi 37222358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 37230c58ac1cSmalcfor drv in $audio_drv_list; do 3724bb55b712SStefan Weil def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` 372598ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 3726923e4521Smalc if test "$drv" = "fmod"; then 37277aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 3728fb065187Sbellard fi 37290c58ac1cSmalcdone 373067f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 373167f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 373267f86e8eSJuan Quintelafi 3733d5631638Smalcif test "$audio_win_int" = "yes" ; then 3734d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 3735d5631638Smalcfi 3736b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak 3737b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak 37388ff9cbf7Smalcif test "$mixemu" = "yes" ; then 373998ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 37408ff9cbf7Smalcfi 3741821601eaSJes Sorensenif test "$vnc" = "yes" ; then 3742821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 3743821601eaSJes Sorensenfi 37448d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 374598ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 37468d5d2d4cSthsfi 37472f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 374898ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 37492f9606b3Saliguorifi 3750821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 37512f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 37522f6f5c7aSCorentin Charyfi 3753821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 3754efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 3755efe556adSCorentin Charyfi 37567536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then 37577536ee4bSTim Hardeck echo "CONFIG_VNC_WS=y" >> $config_host_mak 37587536ee4bSTim Hardeck echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak 37597536ee4bSTim Hardeckfi 376076655d6dSaliguoriif test "$fnmatch" = "yes" ; then 37612358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 376276655d6dSaliguorifi 3763ee682d27SStefan Weilif test "$uuid" = "yes" ; then 3764ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 3765ee682d27SStefan Weilfi 3766dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3767dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3768dce512deSChristoph Hellwigfi 3769b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 377098ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 37712358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 377298ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 377398ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 3774a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 377598ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 3776cc8ae6deSpbrookfi 37771ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 377898ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 37798ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 378049ecc3faSbellardfi 378149ecc3faSbellardif test "$cocoa" = "yes" ; then 378298ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 378349ecc3faSbellardfi 37844d3b6f6eSbalrogif test "$curses" = "yes" ; then 378598ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 3786ab4e5602SJan Kiszkafi 3787ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 37882358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 3789ebc996f3SRiku Voipiofi 3790099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 37912358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 3792099d6b0fSRiku Voipiofi 379340ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 379440ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 379540ff6d7eSKevin Wolffi 37963ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 37972358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 37983ce34dfbSvibisreenivasanfi 3799c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 3800c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 3801c2882b96SRiku Voipiofi 3802d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 3803d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 3804d0927938SUlrich Hechtfi 38053d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then 38063d4fa43eSKusanagi Kouichi echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak 38073d4fa43eSKusanagi Kouichifi 3808c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 3809c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 3810c727f47dSPeter Maydellfi 3811dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 3812dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 3813dace20dcSPeter Maydellfi 3814d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 3815d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 3816d0927938SUlrich Hechtfi 38173b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 38183b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 38193b6edd16SPeter Maydellfi 38203b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 38213b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 38223b6edd16SPeter Maydellfi 38233b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 38243b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 38253b6edd16SPeter Maydellfi 3826a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then 3827a8fd1abaSPeter Maydell echo "CONFIG_SENDFILE=y" >> $config_host_mak 3828a8fd1abaSPeter Maydellfi 38293b3f24adSaurel32if test "$inotify" = "yes" ; then 38302358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 38313b3f24adSaurel32fi 3832c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 3833c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 3834c05c7a73SRiku Voipiofi 38356ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 38366ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 38376ae9a1f4SJuan Quintelafi 38386ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 38396ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 38406ae9a1f4SJuan Quintelafi 3841769ce76dSAlexander Grafif test "$curl" = "yes" ; then 384298ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 3843b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 3844769ce76dSAlexander Graffi 38452e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 384698ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 38472e4d9fb1Saurel32fi 3848fb599c9aSbalrogif test "$bluez" = "yes" ; then 384998ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 3850ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 3851fb599c9aSbalrogfi 3852e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3853a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then 3854a4ccabcfSAnthony Liguori echo "CONFIG_GTK=y" >> $config_host_mak 3855a4ccabcfSAnthony Liguori echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak 3856a4ccabcfSAnthony Liguori echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak 3857a4ccabcfSAnthony Liguorifi 3858e37630caSaliguoriif test "$xen" = "yes" ; then 38596dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3860d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3861e37630caSaliguorifi 38625c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 38635c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 38645c6c3a6cSChristoph Hellwigfi 3865758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 3866758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 3867758e8e38SVenkateswararao Jujjuri (JV)fi 38684f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 38694f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 38704f26f2b6SAvi Kivityfi 3871983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 3872758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 3873758e8e38SVenkateswararao Jujjuri (JV)fi 38745e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then 38755e9be92dSNicholas Bellinger echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak 38765e9be92dSNicholas Bellingerfi 387777755340Sthsif test "$blobs" = "yes" ; then 387898ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 387977755340Sthsfi 3880bf9298b9Saliguoriif test "$iovec" = "yes" ; then 38812358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 3882bf9298b9Saliguorifi 3883ceb42de8Saliguoriif test "$preadv" = "yes" ; then 38842358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 3885ceb42de8Saliguorifi 3886f652e6afSaurel32if test "$fdt" = "yes" ; then 38873f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 3888f652e6afSaurel32fi 3889dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 3890dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 3891dcc38d1cSMarcelo Tosattifi 38929195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 38939195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 38949195b2c2SStefan Weilfi 38955f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 38965f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 38975f6b9e8fSBlue Swirlfi 3898e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 3899e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 3900e78815a5SAndreas Färberfi 3901e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 3902e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 3903e78815a5SAndreas Färberfi 39041e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then 39051e9737daSRichard Henderson echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak 39061e9737daSRichard Hendersonfi 390797a847bcSbellard 3908cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 3909cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 3910cd4ec0b4SGerd Hoffmannfi 3911cd4ec0b4SGerd Hoffmann 3912111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3913111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 3914ad4cf3f6SPaul Brook echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3915ad4cf3f6SPaul Brook echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3916111a38b0SRobert Relyeafi 3917111a38b0SRobert Relyea 39182b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then 39192b2325ffSGerd Hoffmann echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak 39202b2325ffSGerd Hoffmannfi 39212b2325ffSGerd Hoffmann 392269354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 392369354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 392469354a83SHans de Goedefi 392569354a83SHans de Goede 3926b1e5fff4SMichael Walleif test "$glx" = "yes" ; then 3927b1e5fff4SMichael Walle echo "CONFIG_GLX=y" >> $config_host_mak 39282b6b7099SPaolo Bonzini echo "GLX_LIBS=$glx_libs" >> $config_host_mak 392920ff075bSMichael Wallefi 393020ff075bSMichael Walle 3931c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 3932c589b249SRonnie Sahlberg echo "CONFIG_LIBISCSI=y" >> $config_host_mak 3933c589b249SRonnie Sahlbergfi 3934c589b249SRonnie Sahlberg 3935f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 3936f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 3937f794573eSEduardo Otubofi 3938f794573eSEduardo Otubo 393983fb7adfSbellard# XXX: suppress that 39407d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 39412358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 39427d3505c5Sbellardfi 39437d3505c5Sbellard 39442358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 3945c5937220Spbrook 394620ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 394720ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 394820ff6c80SAnthony Liguorifi 39493556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then 39503556c233SPaolo Bonzini echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak 39513556c233SPaolo Bonzinifi 3952f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 3953f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 3954f27aaf4bSChristian Brunnerfi 395520ff6c80SAnthony Liguori 39567c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak 3957d0e2fce5SAneesh Kumar K.V 3958d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 3959d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 3960d2042378SAneesh Kumar K.Vfi 3961d2042378SAneesh Kumar K.V 3962e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 3963e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 3964e06a765eSHarsh Prateek Borafi 3965e06a765eSHarsh Prateek Bora 3966cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then 3967cc6e3ca9SGerd Hoffmann echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak 396806d71fa1SPeter Maydellfi 396906d71fa1SPeter Maydell 39703f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 39713f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 39723f4349dcSKevin Wolffi 39733f4349dcSKevin Wolf 39748ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 39758ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 39768ab1bf12SLuiz Capitulinofi 39778ab1bf12SLuiz Capitulino 397876a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 397976a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 398076a347e1SRichard Hendersonfi 398176a347e1SRichard Henderson 3982f540166bSRichard Hendersonif test "$int128" = "yes" ; then 3983f540166bSRichard Henderson echo "CONFIG_INT128=y" >> $config_host_mak 3984f540166bSRichard Hendersonfi 3985f540166bSRichard Henderson 39861e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then 39871e6e9acaSRichard Henderson echo "CONFIG_GETAUXVAL=y" >> $config_host_mak 39881e6e9acaSRichard Hendersonfi 39891e6e9acaSRichard Henderson 3990eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 3991eb100396SBharata B Rao echo "CONFIG_GLUSTERFS=y" >> $config_host_mak 3992eb100396SBharata B Raofi 3993eb100396SBharata B Rao 39940c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then 39950c14fb47SBharata B Rao echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak 39960c14fb47SBharata B Raofi 39970c14fb47SBharata B Rao 39980a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then 39990a12ec87SRichard W.M. Jones echo "CONFIG_LIBSSH2=y" >> $config_host_mak 40000a12ec87SRichard W.M. Jonesfi 40010a12ec87SRichard W.M. Jones 4002583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then 40036e790746SPaolo Bonzini echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak 4004583f6e7bSStefan Hajnoczifi 4005583f6e7bSStefan Hajnoczi 400668063649Sblueswir1# USB host support 400768063649Sblueswir1case "$usb" in 400868063649Sblueswir1linux) 40094075975dSGerd Hoffmann echo "HOST_USB=linux legacy" >> $config_host_mak 401068063649Sblueswir1;; 401168063649Sblueswir1bsd) 401298ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 401368063649Sblueswir1;; 40142b2325ffSGerd Hoffmannlibusb) 40152b2325ffSGerd Hoffmann if test "$linux" = "yes"; then 40162b2325ffSGerd Hoffmann echo "HOST_USB=libusb linux legacy" >> $config_host_mak 40172b2325ffSGerd Hoffmann else 40182b2325ffSGerd Hoffmann echo "HOST_USB=libusb legacy" >> $config_host_mak 40192b2325ffSGerd Hoffmann fi 40202b2325ffSGerd Hoffmann;; 402168063649Sblueswir1*) 402298ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 402368063649Sblueswir1;; 402468063649Sblueswir1esac 402568063649Sblueswir1 40263b8acc11SPaolo Bonzini# TPM passthrough support? 40273b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then 40283b8acc11SPaolo Bonzini echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak 40293b8acc11SPaolo Bonzini if test "$tpm_passthrough" = "yes"; then 40303b8acc11SPaolo Bonzini echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak 40313b8acc11SPaolo Bonzini fi 40323b8acc11SPaolo Bonzinifi 40333b8acc11SPaolo Bonzini 4034e4858974SLluís# use default implementation for tracing backend-specific routines 4035e4858974SLluístrace_default=yes 403694a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 40376d8a764eSLluísif test "$trace_backend" = "nop"; then 40386d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 403922890ab5SPrerna Saxenafi 40409410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 40416d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 4042e4858974SLluís trace_default=no 40436d8a764eSLluís # Set the appropriate trace file. 4044953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 40459410b56cSPrerna Saxenafi 40466d8a764eSLluísif test "$trace_backend" = "stderr"; then 40476d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 40489a82b6a5SLluís trace_default=no 40496d8a764eSLluísfi 40506d8a764eSLluísif test "$trace_backend" = "ust"; then 40516d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 40526d8a764eSLluísfi 40536d8a764eSLluísif test "$trace_backend" = "dtrace"; then 40546d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 40556d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 40566d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 40576d8a764eSLluís fi 4058c276b17dSDaniel P. Berrangefi 4059781e9545SEiichi Tsukataif test "$trace_backend" = "ftrace"; then 4060781e9545SEiichi Tsukata if test "$linux" = "yes" ; then 4061781e9545SEiichi Tsukata echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak 4062781e9545SEiichi Tsukata trace_default=no 4063781e9545SEiichi Tsukata else 4064781e9545SEiichi Tsukata feature_not_found "ftrace(trace backend)" 4065781e9545SEiichi Tsukata fi 4066781e9545SEiichi Tsukatafi 40679410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 4068e4858974SLluísif test "$trace_default" = "yes"; then 4069e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 4070e4858974SLluísfi 40719410b56cSPrerna Saxena 40722da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 40732da776dbSMichael R. Hines echo "CONFIG_RDMA=y" >> $config_host_mak 40742da776dbSMichael R. Hinesfi 40752da776dbSMichael R. Hines 40765b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then 40775b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" 40785b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then 40795b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES" 40805b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then 40815b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES" 40825b5e3037SPaolo Bonzinielif test "$ARCH" = "x86_64" ; then 40835b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" 40845b5e3037SPaolo Bonzinielse 40855b5e3037SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" 40865b5e3037SPaolo Bonzinifi 40875b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES" 40885b5e3037SPaolo Bonzini 408998ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 409098ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 4091804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 4092804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 40931901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 40941901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 409521655882SPaolo Bonziniif test -n "$libtool"; then 409621655882SPaolo Bonzini echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak 409721655882SPaolo Bonzini echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak 409821655882SPaolo Bonzinielse 40991901cb14SBrad echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 410021655882SPaolo Bonzini echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak 410121655882SPaolo Bonzinifi 4102c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 4103804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 41042b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 4105804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 41063c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 4107804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 41083dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak 41093dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak 4110804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 4111804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 41129fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 411344dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 4114e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 4115a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 4116f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 4117e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 4118e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 4119e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 4120e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 4121e39f0062SPaolo Bonzinifi 412242da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 412342da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 412442da6041SGerd Hoffmannelse 412542da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 412642da6041SGerd Hoffmannfi 4127e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 412837746c5eSMarc-André Lureauecho "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak 412973da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 41303e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 4131804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 4132957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 413394dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 4134cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 41351d728c39SBlue Swirlif test "$gcov" = "yes" ; then 41361d728c39SBlue Swirl echo "CONFIG_GCOV=y" >> $config_host_mak 41371d728c39SBlue Swirl echo "GCOV=$gcov_tool" >> $config_host_mak 41381d728c39SBlue Swirlfi 4139804edf29SJuan Quintela 41406efd7517SPeter Maydell# use included Linux headers 41416efd7517SPeter Maydellif test "$linux" = "yes" ; then 4142a307beb6SAndreas Färber mkdir -p linux-headers 41436efd7517SPeter Maydell case "$cpu" in 41446efd7517SPeter Maydell i386|x86_64) 414508312a63SPeter Maydell linux_arch=x86 41466efd7517SPeter Maydell ;; 41476efd7517SPeter Maydell ppcemb|ppc|ppc64) 414808312a63SPeter Maydell linux_arch=powerpc 41496efd7517SPeter Maydell ;; 41506efd7517SPeter Maydell s390x) 415108312a63SPeter Maydell linux_arch=s390 415208312a63SPeter Maydell ;; 41531f080313SClaudio Fontana aarch64) 41541f080313SClaudio Fontana linux_arch=arm64 41551f080313SClaudio Fontana ;; 415608312a63SPeter Maydell *) 415708312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 415808312a63SPeter Maydell linux_arch="$cpu" 41596efd7517SPeter Maydell ;; 41606efd7517SPeter Maydell esac 416108312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 416208312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 416308312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 416408312a63SPeter Maydell fi 41656efd7517SPeter Maydellfi 41666efd7517SPeter Maydell 416797a847bcSbellardfor target in $target_list; do 416897a847bcSbellardtarget_dir="$target" 416925be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 4170c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1` 417197a847bcSbellardtarget_bigendian="no" 41721f3d3c8fSJuan Quintela 4173c1799a84SPaolo Bonzinicase "$target_name" in 4174d15a9c23SAnthony Green armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 4175ea2d6a39SJuan Quintela target_bigendian=yes 4176ea2d6a39SJuan Quintela ;; 4177ea2d6a39SJuan Quintelaesac 417897a847bcSbellardtarget_softmmu="no" 4179997344f3Sbellardtarget_user_only="no" 4180831b7825Sthstarget_linux_user="no" 418184778508Sblueswir1target_bsd_user="no" 41829e407a85Spbrookcase "$target" in 4183c1799a84SPaolo Bonzini ${target_name}-softmmu) 41849e407a85Spbrook target_softmmu="yes" 41859e407a85Spbrook ;; 4186c1799a84SPaolo Bonzini ${target_name}-linux-user) 41879c7a4202SBlue Swirl if test "$linux" != "yes" ; then 418876ad07a4SPeter Maydell error_exit "Target '$target' is only available on a Linux host" 41899c7a4202SBlue Swirl fi 41909e407a85Spbrook target_user_only="yes" 41919e407a85Spbrook target_linux_user="yes" 41929e407a85Spbrook ;; 4193c1799a84SPaolo Bonzini ${target_name}-bsd-user) 41949cf55765SBlue Swirl if test "$bsd" != "yes" ; then 419576ad07a4SPeter Maydell error_exit "Target '$target' is only available on a BSD host" 41969c7a4202SBlue Swirl fi 419784778508Sblueswir1 target_user_only="yes" 419884778508Sblueswir1 target_bsd_user="yes" 419984778508Sblueswir1 ;; 42009e407a85Spbrook *) 420176ad07a4SPeter Maydell error_exit "Target '$target' not recognised" 42029e407a85Spbrook exit 1 42039e407a85Spbrook ;; 42049e407a85Spbrookesac 4205831b7825Sths 420697a847bcSbellardmkdir -p $target_dir 420725be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 420897a847bcSbellard 4209e5fe0c52Spbrookbflt="no" 4210c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"` 421156aebc89Spbrookgdb_xml_files="" 42127ba1e619Saliguori 4213c1799a84SPaolo BonziniTARGET_ARCH="$target_name" 42146acff7daSJuan QuintelaTARGET_BASE_ARCH="" 4215e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 4216e73aae67SJuan Quintela 4217c1799a84SPaolo Bonzinicase "$target_name" in 42182408a527Saurel32 i386) 42192408a527Saurel32 ;; 42202408a527Saurel32 x86_64) 42216acff7daSJuan Quintela TARGET_BASE_ARCH=i386 42222408a527Saurel32 ;; 42232408a527Saurel32 alpha) 42242408a527Saurel32 ;; 42252408a527Saurel32 arm|armeb) 4226b498c8a0SJuan Quintela TARGET_ARCH=arm 4227e5fe0c52Spbrook bflt="yes" 422856aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 42292408a527Saurel32 ;; 42302408a527Saurel32 cris) 42312408a527Saurel32 ;; 4232613a22c9SMichael Walle lm32) 4233613a22c9SMichael Walle ;; 42342408a527Saurel32 m68k) 42350938cda5Saurel32 bflt="yes" 423656aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 42372408a527Saurel32 ;; 4238877fdc12SEdgar E. Iglesias microblaze|microblazeel) 4239877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 424072b675caSEdgar E. Iglesias bflt="yes" 424172b675caSEdgar E. Iglesias ;; 42422408a527Saurel32 mips|mipsel) 4243b498c8a0SJuan Quintela TARGET_ARCH=mips 424425be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 42452408a527Saurel32 ;; 42462408a527Saurel32 mipsn32|mipsn32el) 4247597e2cecSRichard Henderson TARGET_ARCH=mips64 42486acff7daSJuan Quintela TARGET_BASE_ARCH=mips 424925be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 4250597e2cecSRichard Henderson echo "TARGET_ABI32=y" >> $config_target_mak 42512408a527Saurel32 ;; 42522408a527Saurel32 mips64|mips64el) 4253b498c8a0SJuan Quintela TARGET_ARCH=mips64 42546acff7daSJuan Quintela TARGET_BASE_ARCH=mips 425525be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 42562408a527Saurel32 ;; 4257d15a9c23SAnthony Green moxie) 4258d15a9c23SAnthony Green ;; 4259e67db06eSJia Liu or32) 4260e67db06eSJia Liu TARGET_ARCH=openrisc 4261e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 4262e67db06eSJia Liu ;; 42632408a527Saurel32 ppc) 4264c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 42652408a527Saurel32 ;; 42662408a527Saurel32 ppcemb) 42676acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 4268e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 4269c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 42702408a527Saurel32 ;; 42712408a527Saurel32 ppc64) 42726acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 4273e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 4274c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 42752408a527Saurel32 ;; 42762408a527Saurel32 ppc64abi32) 4277b498c8a0SJuan Quintela TARGET_ARCH=ppc64 42786acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 4279e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 428025be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 4281c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 42822408a527Saurel32 ;; 42832408a527Saurel32 sh4|sh4eb) 4284b498c8a0SJuan Quintela TARGET_ARCH=sh4 42854dbed897Spbrook bflt="yes" 42862408a527Saurel32 ;; 42872408a527Saurel32 sparc) 42882408a527Saurel32 ;; 42892408a527Saurel32 sparc64) 42906acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 42912408a527Saurel32 ;; 42922408a527Saurel32 sparc32plus) 4293b498c8a0SJuan Quintela TARGET_ARCH=sparc64 42946acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 4295e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 429625be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 42972408a527Saurel32 ;; 429824e804ecSAlexander Graf s390x) 429924e804ecSAlexander Graf ;; 4300d2fbca94SGuan Xuetao unicore32) 4301d2fbca94SGuan Xuetao ;; 4302cfa550c6SMax Filippov xtensa|xtensaeb) 4303cfa550c6SMax Filippov TARGET_ARCH=xtensa 4304cfa550c6SMax Filippov ;; 43052408a527Saurel32 *) 430676ad07a4SPeter Maydell error_exit "Unsupported target CPU" 43072408a527Saurel32 ;; 43082408a527Saurel32esac 43095e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 43105e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 43115e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 43125e8861a0SPaolo Bonzinifi 43135e8861a0SPaolo Bonzini 43145e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 43155e8861a0SPaolo Bonzini 431699afc91dSDaniel P. Berrangeupper() { 431799afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 431899afc91dSDaniel P. Berrange} 431999afc91dSDaniel P. Berrange 432099afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`" 432125be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 4322c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak 432325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 4324e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 4325e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 4326e6e91b9cSJuan Quintelafi 432725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 4328c1799a84SPaolo Bonzinicase "$target_name" in 43291b0c87fcSJuan Quintela i386|x86_64) 43301b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 433125be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 4332eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 4333eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 4334eb6fda0fSAnthony PERARD fi 4335432d268cSJun Nakajima fi 433659d21e53SAlexander Graf ;; 433759d21e53SAlexander Graf *) 43381b0c87fcSJuan Quintelaesac 4339c1799a84SPaolo Bonzinicase "$target_name" in 434068b05c42SPeter Maydell arm|i386|x86_64|ppcemb|ppc|ppc64|s390x) 4341c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 4342c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 4343c1799a84SPaolo Bonzini \( "$target_name" = "$cpu" -o \ 4344c1799a84SPaolo Bonzini \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 4345c1799a84SPaolo Bonzini \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \ 4346c1799a84SPaolo Bonzini \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \ 4347c1799a84SPaolo Bonzini \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 4348c1799a84SPaolo Bonzini \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \ 4349c1799a84SPaolo Bonzini \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then 435025be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 43511ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 4352d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 4353d5970055SMichael S. Tsirkin fi 4354c59249f9SJuan Quintela fi 4355c59249f9SJuan Quintelaesac 4356de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 435725be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 435897a847bcSbellardfi 435997a847bcSbellardif test "$target_softmmu" = "yes" ; then 436025be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 4361de83cd02Sbellardfi 4362997344f3Sbellardif test "$target_user_only" = "yes" ; then 436325be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 4364a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 4365997344f3Sbellardfi 4366831b7825Sthsif test "$target_linux_user" = "yes" ; then 436725be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 4368831b7825Sthsfi 436956aebc89Spbrooklist="" 437056aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 437156aebc89Spbrook for x in $gdb_xml_files; do 437256aebc89Spbrook list="$list $source_path/gdb-xml/$x" 437356aebc89Spbrook done 437425be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 43753d0f1517SJuan Quintelafi 4376de83cd02Sbellard 4377e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 437825be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 4379e5fe0c52Spbrookfi 4380379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 438125be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 4382379f6698SPaul Brookfi 438384778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 438425be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 438584778508Sblueswir1fi 43865b0753e0Sbellard 43874afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 4388fa282484SJuan Quintela 43894afddb55SJuan Quintelacflags="" 4390fa282484SJuan Quintelaldflags="" 43919b8e111fSJuan Quintela 439264656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 439364656024SJuan Quintela case "$i" in 439464656024SJuan Quintela alpha) 439525be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 439676cad711SPaolo Bonzini echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak 439764656024SJuan Quintela ;; 439864656024SJuan Quintela arm) 439925be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 440076cad711SPaolo Bonzini echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak 440164656024SJuan Quintela ;; 440264656024SJuan Quintela cris) 440325be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 440476cad711SPaolo Bonzini echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak 440564656024SJuan Quintela ;; 440664656024SJuan Quintela hppa) 440725be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 440876cad711SPaolo Bonzini echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak 440964656024SJuan Quintela ;; 441064656024SJuan Quintela i386|x86_64) 441125be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 441276cad711SPaolo Bonzini echo "CONFIG_I386_DIS=y" >> config-all-disas.mak 441364656024SJuan Quintela ;; 4414903ec55cSAurelien Jarno ia64*) 4415903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 441676cad711SPaolo Bonzini echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak 4417903ec55cSAurelien Jarno ;; 441879368f49SMichael Walle lm32) 441979368f49SMichael Walle echo "CONFIG_LM32_DIS=y" >> $config_target_mak 442076cad711SPaolo Bonzini echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak 442179368f49SMichael Walle ;; 442264656024SJuan Quintela m68k) 442325be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 442476cad711SPaolo Bonzini echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak 442564656024SJuan Quintela ;; 4426877fdc12SEdgar E. Iglesias microblaze*) 442725be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 442876cad711SPaolo Bonzini echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak 442964656024SJuan Quintela ;; 443064656024SJuan Quintela mips*) 443125be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 443276cad711SPaolo Bonzini echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak 443364656024SJuan Quintela ;; 4434d15a9c23SAnthony Green moxie*) 4435d15a9c23SAnthony Green echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak 4436d15a9c23SAnthony Green echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak 4437d15a9c23SAnthony Green ;; 4438e67db06eSJia Liu or32) 4439e67db06eSJia Liu echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak 444076cad711SPaolo Bonzini echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak 4441e67db06eSJia Liu ;; 444264656024SJuan Quintela ppc*) 444325be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 444476cad711SPaolo Bonzini echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak 444564656024SJuan Quintela ;; 444624e804ecSAlexander Graf s390*) 444725be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 444876cad711SPaolo Bonzini echo "CONFIG_S390_DIS=y" >> config-all-disas.mak 444964656024SJuan Quintela ;; 445064656024SJuan Quintela sh4) 445125be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 445276cad711SPaolo Bonzini echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak 445364656024SJuan Quintela ;; 445464656024SJuan Quintela sparc*) 445525be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 445676cad711SPaolo Bonzini echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak 445764656024SJuan Quintela ;; 4458cfa550c6SMax Filippov xtensa*) 4459cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 446076cad711SPaolo Bonzini echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak 4461cfa550c6SMax Filippov ;; 446264656024SJuan Quintela esac 446364656024SJuan Quinteladone 44649195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 44659195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 446676cad711SPaolo Bonzini echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak 44679195b2c2SStefan Weilfi 446864656024SJuan Quintela 44696ee7126fSJuan Quintelacase "$ARCH" in 44706ee7126fSJuan Quintelaalpha) 44716ee7126fSJuan Quintela # Ensure there's only a single GP 44726ee7126fSJuan Quintela cflags="-msmall-data $cflags" 44736ee7126fSJuan Quintela;; 44746ee7126fSJuan Quintelaesac 44756ee7126fSJuan Quintela 4476d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 447725be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 4478d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 4479d02c1db3SJuan Quintela cflags="-p $cflags" 4480d02c1db3SJuan Quintela ldflags="-p $ldflags" 4481d02c1db3SJuan Quintela fi 4482d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 4483d02c1db3SJuan Quintela ldflags="-p $ldflags" 448425be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 4485d02c1db3SJuan Quintela fi 4486d02c1db3SJuan Quintelafi 4487d02c1db3SJuan Quintela 44889b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 4489964c6fa1SRichard Henderson ldflags="$ldflags $textseg_ldflags" 4490fa282484SJuan Quintelafi 4491fa282484SJuan Quintela 449225be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 449325be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 4494fa282484SJuan Quintela 449597a847bcSbellarddone # for target in $targets 44967d13299dSbellard 4497b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then 4498b776eca1SGerd Hoffmann echo "config-host.h: subdir-pixman" >> $config_host_mak 4499b776eca1SGerd Hoffmannfi 4500b776eca1SGerd Hoffmann 45012da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then 45022da776dbSMichael R. Hinesecho "CONFIG_RDMA=y" >> $config_host_mak 45032da776dbSMichael R. Hinesfi 45042da776dbSMichael R. Hines 4505a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then 4506a540f158SPeter Crosthwaite echo "config-host.h: subdir-dtc" >> $config_host_mak 4507a540f158SPeter Crosthwaitefi 4508a540f158SPeter Crosthwaite 4509d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 451098626572SMarkus ArmbrusterDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema" 45119933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" 45122d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 45132dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated" 4514c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 4515c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 4516834574eaSAnthony LiguoriFILES="$FILES tests/tcg/lm32/Makefile po/Makefile" 4517ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 4518446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 45199933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile" 45202d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 45214652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp" 4522753d11f2SRichard Hendersonfor bios_file in \ 4523753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 45245acc2ec0SGerd Hoffmann $source_path/pc-bios/*.aml \ 4525753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 4526753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 4527e89e33e1SDominik Dingel $source_path/pc-bios/*.img \ 4528753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 4529753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 4530753d11f2SRichard Hendersondo 45317ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 45327ea78b74SJan Kiszkadone 4533d1807a4fSPaolo Bonzinimkdir -p $DIRS 45347d13299dSbellardfor f in $FILES ; do 453572b8b5a1SStefan Weil if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then 4536f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 4537f9245e10SPeter Maydell fi 45387d13299dSbellarddone 45391ad2134fSPaul Brook 4540c34ebfdcSAnthony Liguori# temporary config to build submodules 45412d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 4542c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 454337116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 4544c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 45453dd46c78SBlue Swirl echo "AS=$as" >> $config_mak 4546c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 4547c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 45483dd46c78SBlue Swirl echo "CPP=$cpp" >> $config_mak 4549c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 4550c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 4551c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 4552c34ebfdcSAnthony Liguoridone 4553c34ebfdcSAnthony Liguori 4554b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 4555b40292e7SJan Kiszka mkdir -p QMP 4556b40292e7SJan Kiszkafi 4557