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 25b48e3611SPeter Maydellecho "# produced by $0 $*" >> config.log 26b48e3611SPeter Maydellecho "#" >> config.log 27b48e3611SPeter Maydell 2852166aa0SJuan Quintelacompile_object() { 29da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 30da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1 3152166aa0SJuan Quintela} 3252166aa0SJuan Quintela 3352166aa0SJuan Quintelacompile_prog() { 3452166aa0SJuan Quintela local_cflags="$1" 3552166aa0SJuan Quintela local_ldflags="$2" 36da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 37da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 3852166aa0SJuan Quintela} 3952166aa0SJuan Quintela 4011568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 4111568d6dSPaolo Bonzinisymlink() { 4211568d6dSPaolo Bonzini rm -f $2 4311568d6dSPaolo Bonzini ln -s $1 $2 4411568d6dSPaolo Bonzini} 4511568d6dSPaolo Bonzini 460dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 470dba6195SLoïc Minier# executable or a builtin) 480dba6195SLoïc Minierhas() { 490dba6195SLoïc Minier type "$1" >/dev/null 2>&1 500dba6195SLoïc Minier} 510dba6195SLoïc Minier 520dba6195SLoïc Minier# search for an executable in PATH 530dba6195SLoïc Minierpath_of() { 540dba6195SLoïc Minier local_command="$1" 550dba6195SLoïc Minier local_ifs="$IFS" 560dba6195SLoïc Minier local_dir="" 570dba6195SLoïc Minier 580dba6195SLoïc Minier # pathname has a dir component? 590dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 600dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 610dba6195SLoïc Minier echo "$local_command" 620dba6195SLoïc Minier return 0 630dba6195SLoïc Minier fi 640dba6195SLoïc Minier fi 650dba6195SLoïc Minier if [ -z "$local_command" ]; then 660dba6195SLoïc Minier return 1 670dba6195SLoïc Minier fi 680dba6195SLoïc Minier 690dba6195SLoïc Minier IFS=: 700dba6195SLoïc Minier for local_dir in $PATH; do 710dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 720dba6195SLoïc Minier echo "$local_dir/$local_command" 730dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 740dba6195SLoïc Minier return 0 750dba6195SLoïc Minier fi 760dba6195SLoïc Minier done 770dba6195SLoïc Minier # not found 780dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 790dba6195SLoïc Minier return 1 800dba6195SLoïc Minier} 810dba6195SLoïc Minier 827d13299dSbellard# default parameters 83ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 842ff6b91eSJuan Quintelacpu="" 851e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 8643ce4dfeSbellardstatic="no" 87ed968ff1SJuan Quintelasparc_cpu="" 887d13299dSbellardcross_prefix="" 890c58ac1cSmalcaudio_drv_list="" 90d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda" 91d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" 92eb852011SMarkus Armbrusterblock_drv_whitelist="" 937d13299dSbellardhost_cc="gcc" 94c81da56eSJuan Quintelahelper_cflags="" 9573da375eSJuan Quintelalibs_softmmu="" 963e2e0e6bSJuan Quintelalibs_tools="" 9767f86e8eSJuan Quintelaaudio_pt_int="" 98d5631638Smalcaudio_win_int="" 992b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 100957f1f99SMichael Rothlibs_qga="" 101ac0df51dSaliguori 102377529c0SPaolo Bonzinitarget_list="" 103377529c0SPaolo Bonzini 104377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 105377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 106377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 107377529c0SPaolo Bonzini# unless --disable-foo is given 108377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 109377529c0SPaolo Bonzini# feature will searched for, 110377529c0SPaolo Bonzini# if not found, configure exits with error 111377529c0SPaolo Bonzini# 112377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 113377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 114377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 115377529c0SPaolo Bonzini 116377529c0SPaolo Bonzinibluez="" 117377529c0SPaolo Bonzinibrlapi="" 118377529c0SPaolo Bonzinicurl="" 119377529c0SPaolo Bonzinicurses="" 120377529c0SPaolo Bonzinidocs="" 121377529c0SPaolo Bonzinifdt="" 122377529c0SPaolo Bonzininptl="" 123377529c0SPaolo Bonzinisdl="" 124821601eaSJes Sorensenvnc="yes" 125377529c0SPaolo Bonzinisparse="no" 126377529c0SPaolo Bonziniuuid="" 127377529c0SPaolo Bonzinivde="" 128377529c0SPaolo Bonzinivnc_tls="" 129377529c0SPaolo Bonzinivnc_sasl="" 130377529c0SPaolo Bonzinivnc_jpeg="" 131377529c0SPaolo Bonzinivnc_png="" 132377529c0SPaolo Bonzinivnc_thread="no" 133377529c0SPaolo Bonzinixen="" 134d5b93ddfSAnthony PERARDxen_ctrl_version="" 135377529c0SPaolo Bonzinilinux_aio="" 13647e98658SCorey Bryantcap_ng="" 137377529c0SPaolo Bonziniattr="" 1384f26f2b6SAvi Kivitylibattr="" 139377529c0SPaolo Bonzinixfs="" 140377529c0SPaolo Bonzini 141d41a75a2SBradvhost_net="no" 142d41a75a2SBradkvm="no" 143377529c0SPaolo Bonzinigprof="no" 144377529c0SPaolo Bonzinidebug_tcg="no" 145377529c0SPaolo Bonzinidebug_mon="no" 146377529c0SPaolo Bonzinidebug="no" 147377529c0SPaolo Bonzinistrip_opt="yes" 1489195b2c2SStefan Weiltcg_interpreter="no" 149377529c0SPaolo Bonzinibigendian="no" 150377529c0SPaolo Bonzinimingw32="no" 151377529c0SPaolo BonziniEXESUF="" 152377529c0SPaolo Bonziniprefix="/usr/local" 153377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 154377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu" 155377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 156377529c0SPaolo Bonzinibindir="\${prefix}/bin" 1573aa5d2beSAlon Levylibdir="\${prefix}/lib" 1580f94d6daSAlon Levyincludedir="\${prefix}/include" 159377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 160377529c0SPaolo Bonziniconfsuffix="/qemu" 161377529c0SPaolo Bonzinislirp="yes" 162377529c0SPaolo Bonzinifmod_lib="" 163377529c0SPaolo Bonzinifmod_inc="" 164377529c0SPaolo Bonzinioss_lib="" 165377529c0SPaolo Bonzinibsd="no" 166377529c0SPaolo Bonzinilinux="no" 167377529c0SPaolo Bonzinisolaris="no" 168377529c0SPaolo Bonziniprofiler="no" 169377529c0SPaolo Bonzinicocoa="no" 170377529c0SPaolo Bonzinisoftmmu="yes" 171377529c0SPaolo Bonzinilinux_user="no" 172377529c0SPaolo Bonzinidarwin_user="no" 173377529c0SPaolo Bonzinibsd_user="no" 174377529c0SPaolo Bonziniguest_base="" 175377529c0SPaolo Bonziniuname_release="" 176377529c0SPaolo Bonzinimixemu="no" 177377529c0SPaolo Bonziniaix="no" 178377529c0SPaolo Bonziniblobs="yes" 179377529c0SPaolo Bonzinipkgversion="" 18040d6444eSAvi Kivitypie="" 181377529c0SPaolo Bonzinizero_malloc="" 182377529c0SPaolo Bonzinitrace_backend="nop" 183377529c0SPaolo Bonzinitrace_file="trace" 184377529c0SPaolo Bonzinispice="" 185377529c0SPaolo Bonzinirbd="" 18636707144SAlon Levysmartcard="" 187111a38b0SRobert Relyeasmartcard_nss="" 18869354a83SHans de Goedeusb_redir="" 189430a3c18SMichael Walleopengl="" 1901ece9905SAlon Levyzlib="yes" 191d138cee9SMichael Rothguest_agent="yes" 192c589b249SRonnie Sahlberglibiscsi="" 193377529c0SPaolo Bonzini 194ac0df51dSaliguori# parse CC options first 195ac0df51dSaliguorifor opt do 196ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 197ac0df51dSaliguori case "$opt" in 198ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 199ac0df51dSaliguori ;; 2003d8df640SPaolo Bonzini --cc=*) CC="$optarg" 201ac0df51dSaliguori ;; 202ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 203ca4deeb1SPaolo Bonzini ;; 2042ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 2052ff6b91eSJuan Quintela ;; 206a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 207e2a2ed06SJuan Quintela ;; 208e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 209e2a2ed06SJuan Quintela ;; 21050e7b1a0SJuan Quintela --sparc_cpu=*) 21150e7b1a0SJuan Quintela sparc_cpu="$optarg" 21250e7b1a0SJuan Quintela case $sparc_cpu in 213ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 21450e7b1a0SJuan Quintela cpu="sparc" 21550e7b1a0SJuan Quintela ;; 21650e7b1a0SJuan Quintela v9) 21750e7b1a0SJuan Quintela cpu="sparc64" 21850e7b1a0SJuan Quintela ;; 21950e7b1a0SJuan Quintela *) 22050e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 22150e7b1a0SJuan Quintela exit 1 22250e7b1a0SJuan Quintela ;; 22350e7b1a0SJuan Quintela esac 22450e7b1a0SJuan Quintela ;; 225ac0df51dSaliguori esac 226ac0df51dSaliguoridone 227ac0df51dSaliguori# OS specific 228ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 229ac0df51dSaliguori# we can eliminate it's usage altogether 230ac0df51dSaliguori 231b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}" 232b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 233b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 234b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 2353f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}" 236b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 237b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 23817884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 23917884d7bSSergei Trofimovichquery_pkg_config() { 24017884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 24117884d7bSSergei Trofimovich} 24217884d7bSSergei Trofimovichpkg_config=query_pkg_config 243b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 244ac0df51dSaliguori 245be17dc90SMichael S. Tsirkin# default flags for all hosts 246be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 247be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 248f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 249be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 250be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 25184958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 252cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu" 253be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 254be17dc90SMichael S. Tsirkin 255ca4deeb1SPaolo Bonzini# make source path absolute 256ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 257ca4deeb1SPaolo Bonzini 258ac0df51dSaliguoricheck_define() { 259ac0df51dSaliguoricat > $TMPC <<EOF 260ac0df51dSaliguori#if !defined($1) 261fd786e1aSPeter Maydell#error $1 not defined 262ac0df51dSaliguori#endif 263ac0df51dSaliguoriint main(void) { return 0; } 264ac0df51dSaliguoriEOF 26552166aa0SJuan Quintela compile_object 266ac0df51dSaliguori} 267ac0df51dSaliguori 2682ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 2692ff6b91eSJuan Quintela # command line argument 2702ff6b91eSJuan Quintela : 2712ff6b91eSJuan Quintelaelif check_define __i386__ ; then 272ac0df51dSaliguori cpu="i386" 273ac0df51dSaliguorielif check_define __x86_64__ ; then 274ac0df51dSaliguori cpu="x86_64" 2753aa9bd6cSblueswir1elif check_define __sparc__ ; then 2763aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 2773aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 2783aa9bd6cSblueswir1 if check_define __arch64__ ; then 2793aa9bd6cSblueswir1 cpu="sparc64" 2803aa9bd6cSblueswir1 else 2813aa9bd6cSblueswir1 cpu="sparc" 2823aa9bd6cSblueswir1 fi 283fdf7ed96Smalcelif check_define _ARCH_PPC ; then 284fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 285fdf7ed96Smalc cpu="ppc64" 286ac0df51dSaliguori else 287fdf7ed96Smalc cpu="ppc" 288fdf7ed96Smalc fi 289afa05235SAurelien Jarnoelif check_define __mips__ ; then 290afa05235SAurelien Jarno cpu="mips" 291477ba620SAurelien Jarnoelif check_define __ia64__ ; then 292477ba620SAurelien Jarno cpu="ia64" 293d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 294d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 295d66ed0eaSAurelien Jarno cpu="s390x" 296d66ed0eaSAurelien Jarno else 297d66ed0eaSAurelien Jarno cpu="s390" 298d66ed0eaSAurelien Jarno fi 29921d89f84SPeter Maydellelif check_define __arm__ ; then 30021d89f84SPeter Maydell cpu="arm" 301f28ffed5SBradelif check_define __hppa__ ; then 302f28ffed5SBrad cpu="hppa" 303fdf7ed96Smalcelse 304fdf7ed96Smalc cpu=`uname -m` 305ac0df51dSaliguorifi 306ac0df51dSaliguori 307359bc95dSPeter MaydellARCH= 308359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 309359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 3107d13299dSbellardcase "$cpu" in 311359bc95dSPeter Maydell ia64|ppc|ppc64|s390|s390x|sparc64) 312ea8f20f8SJuan Quintela cpu="$cpu" 313ea8f20f8SJuan Quintela ;; 3147d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 31597a847bcSbellard cpu="i386" 3167d13299dSbellard ;; 317aaa5fa14Saurel32 x86_64|amd64) 318aaa5fa14Saurel32 cpu="x86_64" 319aaa5fa14Saurel32 ;; 32021d89f84SPeter Maydell armv*b|armv*l|arm) 32121d89f84SPeter Maydell cpu="arm" 3227d13299dSbellard ;; 323f28ffed5SBrad hppa|parisc|parisc64) 324f54b3f92Saurel32 cpu="hppa" 325f54b3f92Saurel32 ;; 326afa05235SAurelien Jarno mips*) 327afa05235SAurelien Jarno cpu="mips" 328afa05235SAurelien Jarno ;; 3293142255cSblueswir1 sparc|sun4[cdmuv]) 330ae228531Sbellard cpu="sparc" 331ae228531Sbellard ;; 3327d13299dSbellard *) 333359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 334359bc95dSPeter Maydell ARCH=unknown 3357d13299dSbellard ;; 3367d13299dSbellardesac 337359bc95dSPeter Maydellif test -z "$ARCH"; then 338359bc95dSPeter Maydell ARCH="$cpu" 339359bc95dSPeter Maydellfi 340e2d52ad3SJuan Quintela 3417d13299dSbellard# OS specific 342ac0df51dSaliguoriif check_define __linux__ ; then 343ac0df51dSaliguori targetos="Linux" 344ac0df51dSaliguorielif check_define _WIN32 ; then 345ac0df51dSaliguori targetos='MINGW32' 346169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 347169dc5d3Sblueswir1 targetos='OpenBSD' 348169dc5d3Sblueswir1elif check_define __sun__ ; then 349169dc5d3Sblueswir1 targetos='SunOS' 350179cf400SAndreas Färberelif check_define __HAIKU__ ; then 351179cf400SAndreas Färber targetos='Haiku' 352ac0df51dSaliguorielse 3537d13299dSbellard targetos=`uname -s` 354ac0df51dSaliguorifi 3550dbfc675SJuan Quintela 3567d13299dSbellardcase $targetos in 357c326e0afSbellardCYGWIN*) 358c326e0afSbellard mingw32="yes" 359a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 360d5631638Smalc audio_possible_drivers="winwave sdl" 361d5631638Smalc audio_drv_list="winwave" 362c326e0afSbellard;; 36367b915a5SbellardMINGW32*) 36467b915a5Sbellard mingw32="yes" 365d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 366d5631638Smalc audio_drv_list="winwave" 36767b915a5Sbellard;; 3685c40d2bdSthsGNU/kFreeBSD) 369a167ba50SAurelien Jarno bsd="yes" 3700c58ac1cSmalc audio_drv_list="oss" 371f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3725c40d2bdSths;; 3737d3505c5SbellardFreeBSD) 3747d3505c5Sbellard bsd="yes" 3750db4a067SPaolo Bonzini make="${MAKE-gmake}" 3760c58ac1cSmalc audio_drv_list="oss" 377f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 378f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 379f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3807d3505c5Sbellard;; 381c5e97233Sblueswir1DragonFly) 382c5e97233Sblueswir1 bsd="yes" 3830db4a067SPaolo Bonzini make="${MAKE-gmake}" 384c5e97233Sblueswir1 audio_drv_list="oss" 385c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 386c5e97233Sblueswir1;; 3877d3505c5SbellardNetBSD) 3887d3505c5Sbellard bsd="yes" 3890db4a067SPaolo Bonzini make="${MAKE-gmake}" 3900c58ac1cSmalc audio_drv_list="oss" 391c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3928ef92a88Sblueswir1 oss_lib="-lossaudio" 3937d3505c5Sbellard;; 3947d3505c5SbellardOpenBSD) 3957d3505c5Sbellard bsd="yes" 3960db4a067SPaolo Bonzini make="${MAKE-gmake}" 3970c58ac1cSmalc audio_drv_list="oss" 398c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3992f6a1ab0Sblueswir1 oss_lib="-lossaudio" 4007d3505c5Sbellard;; 40183fb7adfSbellardDarwin) 40283fb7adfSbellard bsd="yes" 40383fb7adfSbellard darwin="yes" 4040dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 4050dbfc675SJuan Quintela # run 64-bit userspace code 406aab8588aSmalc if [ "$cpu" = "i386" ] ; then 4071b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 408aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 4091b0f9cc2Saliguori fi 4101b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 411a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4120c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4131b0f9cc2Saliguori else 414a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4151b0f9cc2Saliguori fi 416831b7825Sths darwin_user="yes" 417fd677642Sths cocoa="yes" 4180c58ac1cSmalc audio_drv_list="coreaudio" 419c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4200c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4217973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 42283fb7adfSbellard;; 423ec530c81SbellardSunOS) 424ec530c81Sbellard solaris="yes" 4250db4a067SPaolo Bonzini make="${MAKE-gmake}" 4260db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 427fa58948dSBlue Swirl ld="gld" 428e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 4290475a5caSths needs_libsunmath="no" 430c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 431ef18c883Sths # have to select again, because `uname -m` returns i86pc 432ef18c883Sths # even on an x86_64 box. 433ef18c883Sths solariscpu=`isainfo -k` 434ef18c883Sths if test "${solariscpu}" = "amd64" ; then 435ef18c883Sths cpu="x86_64" 436ef18c883Sths fi 437c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4380475a5caSths if test "$solarisrev" -le 9 ; then 4390475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4400475a5caSths needs_libsunmath="yes" 441f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 442f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 443f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4440475a5caSths else 4450475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4460475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4470475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4480475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4490475a5caSths exit 1 4500475a5caSths fi 4510475a5caSths fi 45286b2bd93Sths fi 4536b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4540c58ac1cSmalc audio_drv_list="oss" 4556b4d2ba1Sths fi 456c2de5c91Smalc audio_possible_drivers="oss sdl" 457d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 458d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 459d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 460d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 461a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 462e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 463ec530c81Sbellard;; 464b29fe3edSmalcAIX) 465b29fe3edSmalc aix="yes" 4660db4a067SPaolo Bonzini make="${MAKE-gmake}" 467b29fe3edSmalc;; 468179cf400SAndreas FärberHaiku) 469179cf400SAndreas Färber haiku="yes" 470179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 471179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 472179cf400SAndreas Färber;; 473fb065187Sbellard*) 4740c58ac1cSmalc audio_drv_list="oss" 475b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4765327cf48Sbellard linux="yes" 477831b7825Sths linux_user="yes" 47868063649Sblueswir1 usb="linux" 479af2be207SJan Kiszka kvm="yes" 480af2be207SJan Kiszka vhost_net="yes" 48107f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 482c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 483c9ec1fe4Sbellard fi 484fb065187Sbellard;; 4857d13299dSbellardesac 4867d13299dSbellard 4877d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 488b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 48968063649Sblueswir1 usb="bsd" 49083fb7adfSbellard fi 49184778508Sblueswir1 bsd_user="yes" 4927d3505c5Sbellardfi 4937d3505c5Sbellard 4940db4a067SPaolo Bonzini: ${make=${MAKE-make}} 4950db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 496c886edfbSBlue Swirl: ${python=${PYTHON-python}} 497e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 4980db4a067SPaolo Bonzini 4993457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 5003457a3f8SJuan Quintela EXESUF=".exe" 501a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 502e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 503e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 50408f3896aSStefan Weil LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS" 505683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 506683035deSPaolo Bonzini mandir="\${prefix}" 507683035deSPaolo Bonzini datadir="\${prefix}" 508683035deSPaolo Bonzini docdir="\${prefix}" 509683035deSPaolo Bonzini bindir="\${prefix}" 510683035deSPaolo Bonzini sysconfdir="\${prefix}" 511683035deSPaolo Bonzini confsuffix="" 51283b2f0a0SStefan Weil guest_agent="no" 5133457a3f8SJuan Quintelafi 5143457a3f8SJuan Quintela 515487fefdbSAnthony Liguoriwerror="" 51685aa5189Sbellard 5177d13299dSbellardfor opt do 518a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 5197d13299dSbellard case "$opt" in 5202efc3265Sbellard --help|-h) show_help=yes 5212efc3265Sbellard ;; 52299123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 52399123e13SMike Frysinger ;; 524b1a550a0Spbrook --prefix=*) prefix="$optarg" 5257d13299dSbellard ;; 526b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 52732ce6337Sbellard ;; 528ca4deeb1SPaolo Bonzini --source-path=*) 5297d13299dSbellard ;; 530ac0df51dSaliguori --cross-prefix=*) 5317d13299dSbellard ;; 532ac0df51dSaliguori --cc=*) 5337d13299dSbellard ;; 534b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 53583469015Sbellard ;; 536b1a550a0Spbrook --make=*) make="$optarg" 5377d13299dSbellard ;; 5386a882643Spbrook --install=*) install="$optarg" 5396a882643Spbrook ;; 540c886edfbSBlue Swirl --python=*) python="$optarg" 541c886edfbSBlue Swirl ;; 542e2d8830eSBrad --smbd=*) smbd="$optarg" 543e2d8830eSBrad ;; 544e2a2ed06SJuan Quintela --extra-cflags=*) 5457d13299dSbellard ;; 546e2a2ed06SJuan Quintela --extra-ldflags=*) 5477d13299dSbellard ;; 5482ff6b91eSJuan Quintela --cpu=*) 5497d13299dSbellard ;; 550b1a550a0Spbrook --target-list=*) target_list="$optarg" 551de83cd02Sbellard ;; 55274242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 55394a420b1SStefan Hajnoczi ;; 55474242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5559410b56cSPrerna Saxena ;; 5567d13299dSbellard --enable-gprof) gprof="yes" 5577d13299dSbellard ;; 55879427693SLoïc Minier --static) 55979427693SLoïc Minier static="yes" 56079427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 56117884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 56243ce4dfeSbellard ;; 5630b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5640b24e75fSPaolo Bonzini ;; 5650b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5660b24e75fSPaolo Bonzini ;; 5673aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 5683aa5d2beSAlon Levy ;; 5690f94d6daSAlon Levy --includedir=*) includedir="$optarg" 5700f94d6daSAlon Levy ;; 5710b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5720b24e75fSPaolo Bonzini ;; 5730b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5740b24e75fSPaolo Bonzini ;; 575ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 57607381cc1SAnthony Liguori ;; 577023ddd74SMax Filippov --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\ 578023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 579023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 580023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 581023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 582023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 583023ddd74SMax Filippov # lots of directory switches by default. 584023ddd74SMax Filippov ;; 58597a847bcSbellard --disable-sdl) sdl="no" 58697a847bcSbellard ;; 587c4198157SJuan Quintela --enable-sdl) sdl="yes" 588c4198157SJuan Quintela ;; 589821601eaSJes Sorensen --disable-vnc) vnc="no" 590821601eaSJes Sorensen ;; 591821601eaSJes Sorensen --enable-vnc) vnc="yes" 592821601eaSJes Sorensen ;; 593b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 594102a52e4Sbellard ;; 595c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 596c2de5c91Smalc ;; 5972f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5982f6a1ab0Sblueswir1 ;; 5992fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 6000c58ac1cSmalc ;; 6010c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 6020c58ac1cSmalc ;; 603eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 604eb852011SMarkus Armbruster ;; 605f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 606f8393946Saurel32 ;; 607f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 608f8393946Saurel32 ;; 609b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 610b4475aa2SLuiz Capitulino ;; 611b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 612b4475aa2SLuiz Capitulino ;; 613f3d08ee6SPaul Brook --enable-debug) 614f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 615f3d08ee6SPaul Brook debug_tcg="yes" 616b4475aa2SLuiz Capitulino debug_mon="yes" 617f3d08ee6SPaul Brook debug="yes" 618f3d08ee6SPaul Brook strip_opt="no" 619f3d08ee6SPaul Brook ;; 62003b4fe7dSaliguori --enable-sparse) sparse="yes" 62103b4fe7dSaliguori ;; 62203b4fe7dSaliguori --disable-sparse) sparse="no" 62303b4fe7dSaliguori ;; 6241625af87Saliguori --disable-strip) strip_opt="no" 6251625af87Saliguori ;; 6268d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 6278d5d2d4cSths ;; 6281be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 6291be10ad2SJuan Quintela ;; 6302f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 6312f9606b3Saliguori ;; 632ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 633ea784e3bSJuan Quintela ;; 6342f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 6352f6f5c7aSCorentin Chary ;; 6362f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 6372f6f5c7aSCorentin Chary ;; 638efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 639efe556adSCorentin Chary ;; 640efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 641efe556adSCorentin Chary ;; 642bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 643bd023f95SCorentin Chary ;; 644bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 645bd023f95SCorentin Chary ;; 646443f1376Sbellard --disable-slirp) slirp="no" 647c20709aaSbellard ;; 648ee682d27SStefan Weil --disable-uuid) uuid="no" 649ee682d27SStefan Weil ;; 650ee682d27SStefan Weil --enable-uuid) uuid="yes" 651ee682d27SStefan Weil ;; 652e0e6c8c0Saliguori --disable-vde) vde="no" 6538a16d273Sths ;; 654dfb278bdSJuan Quintela --enable-vde) vde="yes" 655dfb278bdSJuan Quintela ;; 656e37630caSaliguori --disable-xen) xen="no" 657e37630caSaliguori ;; 658fc321b4bSJuan Quintela --enable-xen) xen="yes" 659fc321b4bSJuan Quintela ;; 6602e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6612e4d9fb1Saurel32 ;; 6624ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6634ffcedb6SJuan Quintela ;; 664fb599c9aSbalrog --disable-bluez) bluez="no" 665fb599c9aSbalrog ;; 666a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 667a20a6f46SJuan Quintela ;; 6687ba1e619Saliguori --disable-kvm) kvm="no" 6697ba1e619Saliguori ;; 670b31a0277SJuan Quintela --enable-kvm) kvm="yes" 671b31a0277SJuan Quintela ;; 6729195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 6739195b2c2SStefan Weil ;; 6749195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 6759195b2c2SStefan Weil ;; 67647e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 67747e98658SCorey Bryant ;; 67847e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 67947e98658SCorey Bryant ;; 680cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 681cd4ec0b4SGerd Hoffmann ;; 682cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 683cd4ec0b4SGerd Hoffmann ;; 684c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 685c589b249SRonnie Sahlberg ;; 686c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 687c589b249SRonnie Sahlberg ;; 68805c2a3e7Sbellard --enable-profiler) profiler="yes" 68905c2a3e7Sbellard ;; 690c2de5c91Smalc --enable-cocoa) 691c2de5c91Smalc cocoa="yes" ; 692c2de5c91Smalc sdl="no" ; 693c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6945b0753e0Sbellard ;; 695cad25d69Spbrook --disable-system) softmmu="no" 6960a8e90f4Spbrook ;; 697cad25d69Spbrook --enable-system) softmmu="yes" 6980a8e90f4Spbrook ;; 6990953a80fSZachary Amsden --disable-user) 7000953a80fSZachary Amsden linux_user="no" ; 7010953a80fSZachary Amsden bsd_user="no" ; 7020953a80fSZachary Amsden darwin_user="no" 7030953a80fSZachary Amsden ;; 7040953a80fSZachary Amsden --enable-user) ;; 705831b7825Sths --disable-linux-user) linux_user="no" 7060a8e90f4Spbrook ;; 707831b7825Sths --enable-linux-user) linux_user="yes" 708831b7825Sths ;; 709831b7825Sths --disable-darwin-user) darwin_user="no" 710831b7825Sths ;; 711831b7825Sths --enable-darwin-user) darwin_user="yes" 7120a8e90f4Spbrook ;; 71384778508Sblueswir1 --disable-bsd-user) bsd_user="no" 71484778508Sblueswir1 ;; 71584778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 71684778508Sblueswir1 ;; 717379f6698SPaul Brook --enable-guest-base) guest_base="yes" 718379f6698SPaul Brook ;; 719379f6698SPaul Brook --disable-guest-base) guest_base="no" 720379f6698SPaul Brook ;; 72140d6444eSAvi Kivity --enable-pie) pie="yes" 72234005a00SKirill A. Shutemov ;; 72340d6444eSAvi Kivity --disable-pie) pie="no" 72434005a00SKirill A. Shutemov ;; 725c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 726c5937220Spbrook ;; 7273142255cSblueswir1 --sparc_cpu=*) 7283142255cSblueswir1 ;; 72985aa5189Sbellard --enable-werror) werror="yes" 73085aa5189Sbellard ;; 73185aa5189Sbellard --disable-werror) werror="no" 73285aa5189Sbellard ;; 7334d3b6f6eSbalrog --disable-curses) curses="no" 7344d3b6f6eSbalrog ;; 735c584a6d0SJuan Quintela --enable-curses) curses="yes" 736c584a6d0SJuan Quintela ;; 737769ce76dSAlexander Graf --disable-curl) curl="no" 738769ce76dSAlexander Graf ;; 739788c8196SJuan Quintela --enable-curl) curl="yes" 740788c8196SJuan Quintela ;; 7412df87df7SJuan Quintela --disable-fdt) fdt="no" 7422df87df7SJuan Quintela ;; 7432df87df7SJuan Quintela --enable-fdt) fdt="yes" 7442df87df7SJuan Quintela ;; 745bd0c5661Spbrook --disable-nptl) nptl="no" 746bd0c5661Spbrook ;; 747b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 748b0a47e79SJuan Quintela ;; 7498ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7508ff9cbf7Smalc ;; 7515c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7525c6c3a6cSChristoph Hellwig ;; 7535c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7545c6c3a6cSChristoph Hellwig ;; 755758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 756758e8e38SVenkateswararao Jujjuri (JV) ;; 757758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 758758e8e38SVenkateswararao Jujjuri (JV) ;; 75977755340Sths --disable-blobs) blobs="no" 76077755340Sths ;; 7614a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7624a19f1ecSpbrook ;; 763a25dba17SJuan Quintela --disable-docs) docs="no" 76470ec5dc0SAnthony Liguori ;; 765a25dba17SJuan Quintela --enable-docs) docs="yes" 76683a3ab8bSJuan Quintela ;; 767d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 768d5970055SMichael S. Tsirkin ;; 769d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 770d5970055SMichael S. Tsirkin ;; 77120ff075bSMichael Walle --disable-opengl) opengl="no" 77220ff075bSMichael Walle ;; 77320ff075bSMichael Walle --enable-opengl) opengl="yes" 77420ff075bSMichael Walle ;; 775f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 776f27aaf4bSChristian Brunner ;; 777f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 778f27aaf4bSChristian Brunner ;; 7798c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 7808c84cf11SSergei Trofimovich ;; 7818c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 7828c84cf11SSergei Trofimovich ;; 78336707144SAlon Levy --disable-smartcard) smartcard="no" 78436707144SAlon Levy ;; 78536707144SAlon Levy --enable-smartcard) smartcard="yes" 78636707144SAlon Levy ;; 787111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 788111a38b0SRobert Relyea ;; 789111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 790111a38b0SRobert Relyea ;; 79169354a83SHans de Goede --disable-usb-redir) usb_redir="no" 79269354a83SHans de Goede ;; 79369354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 79469354a83SHans de Goede ;; 7951ece9905SAlon Levy --disable-zlib-test) zlib="no" 7961ece9905SAlon Levy ;; 797d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 798d138cee9SMichael Roth ;; 799d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 800d138cee9SMichael Roth ;; 8017f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 8027f1559c6Sbalrog ;; 8037d13299dSbellard esac 8047d13299dSbellarddone 8057d13299dSbellard 8063142255cSblueswir1# 8073142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 808a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 8093142255cSblueswir1# 810379f6698SPaul Brookhost_guest_base="no" 81140293e58Sbellardcase "$cpu" in 812ed968ff1SJuan Quintela sparc) case $sparc_cpu in 813ed968ff1SJuan Quintela v7|v8) 814a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 815ed968ff1SJuan Quintela ;; 816ed968ff1SJuan Quintela v8plus|v8plusa) 817a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 818ed968ff1SJuan Quintela ;; 819ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 820a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 821ed968ff1SJuan Quintela esac 8220c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 823a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 824762e8230Sblueswir1 if test "$solaris" = "no" ; then 825a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 826c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 827762e8230Sblueswir1 fi 8283142255cSblueswir1 ;; 829ed968ff1SJuan Quintela sparc64) 830a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 8310c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 832a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 833ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 834a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 835762e8230Sblueswir1 fi 8363142255cSblueswir1 ;; 83776d83bdeSths s390) 83828d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 83928d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 84048bb3750SRichard Henderson host_guest_base="yes" 84128d7cc49SRichard Henderson ;; 84228d7cc49SRichard Henderson s390x) 84328d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 84428d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 84548bb3750SRichard Henderson host_guest_base="yes" 84676d83bdeSths ;; 84740293e58Sbellard i386) 848a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 8490c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 8502b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 851c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 852379f6698SPaul Brook host_guest_base="yes" 85340293e58Sbellard ;; 85440293e58Sbellard x86_64) 855a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 8560c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8572b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 858379f6698SPaul Brook host_guest_base="yes" 859379f6698SPaul Brook ;; 860379f6698SPaul Brook arm*) 861379f6698SPaul Brook host_guest_base="yes" 86240293e58Sbellard ;; 863f6548c0aSmalc ppc*) 864f6548c0aSmalc host_guest_base="yes" 865f6548c0aSmalc ;; 866cc01cc8eSAurelien Jarno mips*) 867cc01cc8eSAurelien Jarno host_guest_base="yes" 868cc01cc8eSAurelien Jarno ;; 869477ba620SAurelien Jarno ia64*) 870477ba620SAurelien Jarno host_guest_base="yes" 871477ba620SAurelien Jarno ;; 872fd76e73aSRichard Henderson hppa*) 873fd76e73aSRichard Henderson host_guest_base="yes" 874fd76e73aSRichard Henderson ;; 875d2fbca94SGuan Xuetao unicore32*) 876d2fbca94SGuan Xuetao host_guest_base="yes" 877d2fbca94SGuan Xuetao ;; 8783142255cSblueswir1esac 8793142255cSblueswir1 880379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 881379f6698SPaul Brook 88260e0df25SPeter Maydell 88360e0df25SPeter Maydelldefault_target_list="" 88460e0df25SPeter Maydell 88560e0df25SPeter Maydell# these targets are portable 88660e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 88760e0df25SPeter Maydell default_target_list="\ 88860e0df25SPeter Maydelli386-softmmu \ 88960e0df25SPeter Maydellx86_64-softmmu \ 89027cdad67SRichard Hendersonalpha-softmmu \ 89160e0df25SPeter Maydellarm-softmmu \ 89260e0df25SPeter Maydellcris-softmmu \ 89360e0df25SPeter Maydelllm32-softmmu \ 89460e0df25SPeter Maydellm68k-softmmu \ 89560e0df25SPeter Maydellmicroblaze-softmmu \ 89660e0df25SPeter Maydellmicroblazeel-softmmu \ 89760e0df25SPeter Maydellmips-softmmu \ 89860e0df25SPeter Maydellmipsel-softmmu \ 89960e0df25SPeter Maydellmips64-softmmu \ 90060e0df25SPeter Maydellmips64el-softmmu \ 90160e0df25SPeter Maydellppc-softmmu \ 90260e0df25SPeter Maydellppcemb-softmmu \ 90360e0df25SPeter Maydellppc64-softmmu \ 90460e0df25SPeter Maydellsh4-softmmu \ 90560e0df25SPeter Maydellsh4eb-softmmu \ 90660e0df25SPeter Maydellsparc-softmmu \ 90760e0df25SPeter Maydellsparc64-softmmu \ 9080f3301d4SAlexander Grafs390x-softmmu \ 909cfa550c6SMax Filippovxtensa-softmmu \ 910cfa550c6SMax Filippovxtensaeb-softmmu \ 91160e0df25SPeter Maydell" 91260e0df25SPeter Maydellfi 91360e0df25SPeter Maydell# the following are Linux specific 91460e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 91560e0df25SPeter Maydell default_target_list="${default_target_list}\ 91660e0df25SPeter Maydelli386-linux-user \ 91760e0df25SPeter Maydellx86_64-linux-user \ 91860e0df25SPeter Maydellalpha-linux-user \ 91960e0df25SPeter Maydellarm-linux-user \ 92060e0df25SPeter Maydellarmeb-linux-user \ 92160e0df25SPeter Maydellcris-linux-user \ 92260e0df25SPeter Maydellm68k-linux-user \ 92360e0df25SPeter Maydellmicroblaze-linux-user \ 92460e0df25SPeter Maydellmicroblazeel-linux-user \ 92560e0df25SPeter Maydellmips-linux-user \ 92660e0df25SPeter Maydellmipsel-linux-user \ 92760e0df25SPeter Maydellppc-linux-user \ 92860e0df25SPeter Maydellppc64-linux-user \ 92960e0df25SPeter Maydellppc64abi32-linux-user \ 93060e0df25SPeter Maydellsh4-linux-user \ 93160e0df25SPeter Maydellsh4eb-linux-user \ 93260e0df25SPeter Maydellsparc-linux-user \ 93360e0df25SPeter Maydellsparc64-linux-user \ 93460e0df25SPeter Maydellsparc32plus-linux-user \ 93560e0df25SPeter Maydellunicore32-linux-user \ 9360f3301d4SAlexander Grafs390x-linux-user \ 93760e0df25SPeter Maydell" 93860e0df25SPeter Maydellfi 93960e0df25SPeter Maydell# the following are Darwin specific 94060e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then 94160e0df25SPeter Maydell default_target_list="$default_target_list i386-darwin-user ppc-darwin-user " 94260e0df25SPeter Maydellfi 94360e0df25SPeter Maydell# the following are BSD specific 94460e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 94560e0df25SPeter Maydell default_target_list="${default_target_list}\ 94660e0df25SPeter Maydelli386-bsd-user \ 94760e0df25SPeter Maydellx86_64-bsd-user \ 94860e0df25SPeter Maydellsparc-bsd-user \ 94960e0df25SPeter Maydellsparc64-bsd-user \ 95060e0df25SPeter Maydell" 95160e0df25SPeter Maydellfi 95260e0df25SPeter Maydell 953af5db58eSpbrookif test x"$show_help" = x"yes" ; then 954af5db58eSpbrookcat << EOF 955af5db58eSpbrook 956af5db58eSpbrookUsage: configure [options] 957af5db58eSpbrookOptions: [defaults in brackets after descriptions] 958af5db58eSpbrook 959af5db58eSpbrookEOF 960af5db58eSpbrookecho "Standard options:" 961af5db58eSpbrookecho " --help print this message" 962af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 963af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 964af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 96560e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 96660e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 96760e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 968af5db58eSpbrookecho "" 969af5db58eSpbrookecho "Advanced options (experts only):" 970af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 971af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 972af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 9730bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 9740bfe8cc0SPaolo Bonziniecho " build time" 975a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 976e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 977af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 9786a882643Spbrookecho " --install=INSTALL use specified install [$install]" 979c886edfbSBlue Swirlecho " --python=PYTHON use specified python [$python]" 980e2d8830eSBradecho " --smbd=SMBD use specified smbd [$smbd]" 981af5db58eSpbrookecho " --static enable static build [$static]" 9820b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 9830b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 9840b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 9850b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 9860b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 987f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 988f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 98909695a4aSStefan Weilecho " --enable-debug enable common debug build options" 990890b1658Saliguoriecho " --enable-sparse enable sparse checker" 991890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 9921625af87Saliguoriecho " --disable-strip disable stripping binaries" 99385aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 994fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 995c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 996821601eaSJes Sorensenecho " --disable-vnc disable VNC" 997821601eaSJes Sorensenecho " --enable-vnc enable VNC" 998af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 999c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 1000c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 10014c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 10024c9b53e3Smalcecho " Available cards: $audio_possible_cards" 1003eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 1004eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 10058ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 1006e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 1007fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 10082e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 10094ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 10108d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 10111be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 10122f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 1013ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 10142f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 10152f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 101696763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 1017efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 1018bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 1019bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 1020af896aaaSpbrookecho " --disable-curses disable curses output" 1021c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 1022769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 1023788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 10242df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 10252df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 1026fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 1027a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 10286093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 10297ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 1030b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 10319195b2c2SStefan Weilecho " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" 1032bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 1033e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 1034af5db58eSpbrookecho " --enable-system enable all system emulation targets" 1035af5db58eSpbrookecho " --disable-system disable all system emulation targets" 10360953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 10370953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 1038831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 1039831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 1040831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 1041831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 104284778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 104384778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 1044379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 1045379f6698SPaul Brookecho " emulation targets" 1046379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 104740d6444eSAvi Kivityecho " --enable-pie build Position Independent Executables" 104840d6444eSAvi Kivityecho " --disable-pie do not build Position Independent Executables" 1049af5db58eSpbrookecho " --fmod-lib path to FMOD library" 1050af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 10512f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 1052c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 1053235e510cS陳韋任echo " --cpu=CPU Build for host CPU [$cpu]" 10543142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 1055ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 1056ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 1057e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 1058dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 10595c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 10605c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 106147e98658SCorey Bryantecho " --disable-cap-ng disable libcap-ng support" 106247e98658SCorey Bryantecho " --enable-cap-ng enable libcap-ng support" 1063758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1064758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 106577755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1066d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1067d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1068d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1069d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1070320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1071320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 107274242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 10739410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1074cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1075cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1076f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 1077c589b249SRonnie Sahlbergecho " --disable-libiscsi disable iscsi support" 1078c589b249SRonnie Sahlbergecho " --enable-libiscsi enable iscsi support" 107936707144SAlon Levyecho " --disable-smartcard disable smartcard support" 108036707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1081111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1082111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 108369354a83SHans de Goedeecho " --disable-usb-redir disable usb network redirection support" 108469354a83SHans de Goedeecho " --enable-usb-redir enable usb network redirection support" 1085d138cee9SMichael Rothecho " --disable-guest-agent disable building of the QEMU Guest Agent" 1086d138cee9SMichael Rothecho " --enable-guest-agent enable building of the QEMU Guest Agent" 1087af5db58eSpbrookecho "" 10885bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1089af5db58eSpbrookexit 1 1090af5db58eSpbrookfi 1091af5db58eSpbrook 1092359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1093359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1094359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1095359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1096359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1097359bc95dSPeter Maydell ARCH=tci 1098359bc95dSPeter Maydell else 1099359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1100359bc95dSPeter Maydell exit 1 1101359bc95dSPeter Maydell fi 1102359bc95dSPeter Maydellfi 1103359bc95dSPeter Maydell 11048d05095cSPaolo Bonzini# check that the C compiler works. 11058d05095cSPaolo Bonzinicat > $TMPC <<EOF 110675cafad7SStefan Weilint main(void) { return 0; } 11078d05095cSPaolo BonziniEOF 11088d05095cSPaolo Bonzini 11098d05095cSPaolo Bonziniif compile_object ; then 11108d05095cSPaolo Bonzini : C compiler works ok 11118d05095cSPaolo Bonzinielse 11128d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 11138d05095cSPaolo Bonzini exit 1 11148d05095cSPaolo Bonzinifi 11158d05095cSPaolo Bonzini 11168d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 11178d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 11188d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1119f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 11208d05095cSPaolo Bonzinicat > $TMPC << EOF 11218d05095cSPaolo Bonziniint main(void) { return 0; } 11228d05095cSPaolo BonziniEOF 11238d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1124bd947d30SStefan Weil if compile_prog "-Werror $flag" "" ; then 11258d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 11268d05095cSPaolo Bonzini fi 11278d05095cSPaolo Bonzinidone 11288d05095cSPaolo Bonzini 112940d6444eSAvi Kivityif test "$static" = "yes" ; then 113040d6444eSAvi Kivity if test "$pie" = "yes" ; then 113140d6444eSAvi Kivity echo "static and pie are mutually incompatible" 113240d6444eSAvi Kivity exit 1 113340d6444eSAvi Kivity else 113440d6444eSAvi Kivity pie="no" 113540d6444eSAvi Kivity fi 113640d6444eSAvi Kivityfi 113740d6444eSAvi Kivity 113840d6444eSAvi Kivityif test "$pie" = ""; then 113940d6444eSAvi Kivity case "$cpu-$targetos" in 1140f9db31a2SBrad i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) 114140d6444eSAvi Kivity ;; 114240d6444eSAvi Kivity *) 114340d6444eSAvi Kivity pie="no" 114440d6444eSAvi Kivity ;; 114540d6444eSAvi Kivity esac 114640d6444eSAvi Kivityfi 114740d6444eSAvi Kivity 114840d6444eSAvi Kivityif test "$pie" != "no" ; then 114940d6444eSAvi Kivity cat > $TMPC << EOF 115021d4a791SAvi Kivity 115121d4a791SAvi Kivity#ifdef __linux__ 115221d4a791SAvi Kivity# define THREAD __thread 115321d4a791SAvi Kivity#else 115421d4a791SAvi Kivity# define THREAD 115521d4a791SAvi Kivity#endif 115621d4a791SAvi Kivity 115721d4a791SAvi Kivitystatic THREAD int tls_var; 115821d4a791SAvi Kivity 115921d4a791SAvi Kivityint main(void) { return tls_var; } 116021d4a791SAvi Kivity 116140d6444eSAvi KivityEOF 116240d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 116340d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 116440d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 116540d6444eSAvi Kivity pie="yes" 116640d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 116740d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 116840d6444eSAvi Kivity fi 116940d6444eSAvi Kivity else 117040d6444eSAvi Kivity if test "$pie" = "yes"; then 117140d6444eSAvi Kivity echo "PIE not available due to missing toolchain support" 117240d6444eSAvi Kivity exit 1 117340d6444eSAvi Kivity else 117440d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 117540d6444eSAvi Kivity pie="no" 117640d6444eSAvi Kivity fi 117740d6444eSAvi Kivity fi 117840d6444eSAvi Kivityfi 117940d6444eSAvi Kivity 1180ec530c81Sbellard# 1181ec530c81Sbellard# Solaris specific configure tool chain decisions 1182ec530c81Sbellard# 1183ec530c81Sbellardif test "$solaris" = "yes" ; then 11846792aa11SLoïc Minier if has $install; then 11856792aa11SLoïc Minier : 11866792aa11SLoïc Minier else 1187ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1188ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1189ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1190ec530c81Sbellard exit 1 1191ec530c81Sbellard fi 11926792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1193ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1194ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1195ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1196ec530c81Sbellard exit 1 1197ec530c81Sbellard fi 11986792aa11SLoïc Minier if has ar; then 11996792aa11SLoïc Minier : 12006792aa11SLoïc Minier else 1201ec530c81Sbellard echo "Error: No path includes ar" 1202ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1203ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1204ec530c81Sbellard fi 1205ec530c81Sbellard exit 1 1206ec530c81Sbellard fi 1207ec530c81Sbellardfi 1208ec530c81Sbellard 12097a3fc891SSebastian Herbsztif ! has $python; then 1210c886edfbSBlue Swirl echo "Python not found. Use --python=/path/to/python" 1211c886edfbSBlue Swirl exit 1 1212c886edfbSBlue Swirlfi 1213c886edfbSBlue Swirl 12145327cf48Sbellardif test -z "$target_list" ; then 121560e0df25SPeter Maydell target_list="$default_target_list" 12166e20a45fSbellardelse 1217b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 12185327cf48Sbellardfi 12190a8e90f4Spbrookif test -z "$target_list" ; then 12200a8e90f4Spbrook echo "No targets enabled" 12210a8e90f4Spbrook exit 1 12220a8e90f4Spbrookfi 1223f55fe278SPaolo Bonzini# see if system emulation was really requested 1224f55fe278SPaolo Bonzinicase " $target_list " in 1225f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1226f55fe278SPaolo Bonzini ;; 1227f55fe278SPaolo Bonzini *) softmmu=no 1228f55fe278SPaolo Bonzini ;; 1229f55fe278SPaolo Bonziniesac 12305327cf48Sbellard 1231249247c9SJuan Quintelafeature_not_found() { 1232249247c9SJuan Quintela feature=$1 1233249247c9SJuan Quintela 1234249247c9SJuan Quintela echo "ERROR" 1235249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 12369332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1237249247c9SJuan Quintela echo "ERROR" 1238249247c9SJuan Quintela exit 1; 1239249247c9SJuan Quintela} 1240249247c9SJuan Quintela 12417d13299dSbellardif test -z "$cross_prefix" ; then 12427d13299dSbellard 12437d13299dSbellard# --- 12447d13299dSbellard# big/little endian test 12457d13299dSbellardcat > $TMPC << EOF 12467d13299dSbellard#include <inttypes.h> 12477d13299dSbellardint main(int argc, char ** argv){ 12487d13299dSbellard volatile uint32_t i=0x01234567; 12497d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 12507d13299dSbellard} 12517d13299dSbellardEOF 12527d13299dSbellard 125352166aa0SJuan Quintelaif compile_prog "" "" ; then 12547d13299dSbellard$TMPE && bigendian="yes" 12557d13299dSbellardelse 12567d13299dSbellardecho big/little test failed 12577d13299dSbellardfi 12587d13299dSbellard 12597d13299dSbellardelse 12607d13299dSbellard 12617d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1262ea8f20f8SJuan Quintelacase "$cpu" in 126321d89f84SPeter Maydell arm) 126421d89f84SPeter Maydell # ARM can be either way; ask the compiler which one we are 126521d89f84SPeter Maydell if check_define __ARMEB__; then 126621d89f84SPeter Maydell bigendian=yes 126721d89f84SPeter Maydell fi 126821d89f84SPeter Maydell ;; 126921d89f84SPeter Maydell hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1270ea8f20f8SJuan Quintela bigendian=yes 1271ea8f20f8SJuan Quintela ;; 1272ea8f20f8SJuan Quintelaesac 12737d13299dSbellard 12747d13299dSbellardfi 12757d13299dSbellard 127670be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test 127770be1a2eSPaolo Bonzinicat > $TMPC << EOF 127870be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; 127970be1a2eSPaolo BonziniEOF 128070be1a2eSPaolo Bonziniif compile_object; then 1281ea8f20f8SJuan Quintelahostlongbits=64 128270be1a2eSPaolo Bonzinielse 128370be1a2eSPaolo Bonzinihostlongbits=32 128470be1a2eSPaolo Bonzinifi 1285b6853697Sbellard 1286b0a47e79SJuan Quintela 1287b0a47e79SJuan Quintela########################################## 1288b0a47e79SJuan Quintela# NPTL probe 1289b0a47e79SJuan Quintela 1290b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1291bd0c5661Spbrook cat > $TMPC <<EOF 1292bd0c5661Spbrook#include <sched.h> 129330813ceaSpbrook#include <linux/futex.h> 1294182eacc0SStefan Weilint main(void) { 1295bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1296bd0c5661Spbrook#error bork 1297bd0c5661Spbrook#endif 1298182eacc0SStefan Weil return 0; 1299bd0c5661Spbrook} 1300bd0c5661SpbrookEOF 1301bd0c5661Spbrook 130252166aa0SJuan Quintela if compile_object ; then 1303b0a47e79SJuan Quintela nptl=yes 1304bd0c5661Spbrook else 1305b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1306b0a47e79SJuan Quintela feature_not_found "nptl" 1307b0a47e79SJuan Quintela fi 1308b0a47e79SJuan Quintela nptl=no 1309b0a47e79SJuan Quintela fi 1310bd0c5661Spbrookfi 1311bd0c5661Spbrook 131211d9f695Sbellard########################################## 1313ac62922eSbalrog# zlib check 1314ac62922eSbalrog 13151ece9905SAlon Levyif test "$zlib" != "no" ; then 1316ac62922eSbalrog cat > $TMPC << EOF 1317ac62922eSbalrog#include <zlib.h> 1318ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1319ac62922eSbalrogEOF 132052166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1321ac62922eSbalrog : 1322ac62922eSbalrog else 1323ac62922eSbalrog echo 1324ac62922eSbalrog echo "Error: zlib check failed" 1325ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1326ac62922eSbalrog echo 1327ac62922eSbalrog exit 1 1328ac62922eSbalrog fi 13291ece9905SAlon Levyfi 1330ac62922eSbalrog 1331ac62922eSbalrog########################################## 1332e37630caSaliguori# xen probe 1333e37630caSaliguori 1334fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1335b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1336d5b93ddfSAnthony PERARD 133750ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 133850ced5b3SStefan Weil # If no, we are done and there is no Xen support. 133950ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 134050ced5b3SStefan Weil 134150ced5b3SStefan Weil # Xen (any) 134250ced5b3SStefan Weil cat > $TMPC <<EOF 134350ced5b3SStefan Weil#include <xenctrl.h> 134450ced5b3SStefan Weil#include <xs.h> 134550ced5b3SStefan Weilint main(void) { 134650ced5b3SStefan Weil return 0; 134750ced5b3SStefan Weil} 134850ced5b3SStefan WeilEOF 134950ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 135050ced5b3SStefan Weil # Xen not found 135150ced5b3SStefan Weil if test "$xen" = "yes" ; then 135250ced5b3SStefan Weil feature_not_found "xen" 135350ced5b3SStefan Weil fi 135450ced5b3SStefan Weil xen=no 135550ced5b3SStefan Weil 1356d5b93ddfSAnthony PERARD # Xen unstable 135750ced5b3SStefan Weil elif ( 1358e37630caSaliguori cat > $TMPC <<EOF 1359e37630caSaliguori#include <xenctrl.h> 1360e37630caSaliguori#include <xs.h> 1361d5b93ddfSAnthony PERARD#include <stdint.h> 1362d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1363d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1364d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1365d5b93ddfSAnthony PERARD#endif 1366d5b93ddfSAnthony PERARDint main(void) { 1367d5b93ddfSAnthony PERARD xc_interface *xc; 1368d5b93ddfSAnthony PERARD xs_daemon_open(); 1369d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1370d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1371d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1372b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1373d5b93ddfSAnthony PERARD return 0; 1374d5b93ddfSAnthony PERARD} 1375e37630caSaliguoriEOF 137650ced5b3SStefan Weil compile_prog "" "$xen_libs" 137750ced5b3SStefan Weil ) ; then 1378d5b93ddfSAnthony PERARD xen_ctrl_version=410 1379fc321b4bSJuan Quintela xen=yes 1380d5b93ddfSAnthony PERARD 1381d5b93ddfSAnthony PERARD # Xen 4.0.0 1382d5b93ddfSAnthony PERARD elif ( 1383d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1384d5b93ddfSAnthony PERARD#include <xenctrl.h> 1385d5b93ddfSAnthony PERARD#include <xs.h> 1386d5b93ddfSAnthony PERARD#include <stdint.h> 1387d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1388d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1389d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1390d5b93ddfSAnthony PERARD#endif 1391d5b93ddfSAnthony PERARDint main(void) { 1392b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1393b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1394b87de24eSAnthony PERARD }; 1395d5b93ddfSAnthony PERARD xs_daemon_open(); 1396d5b93ddfSAnthony PERARD xc_interface_open(); 1397d5b93ddfSAnthony PERARD xc_gnttab_open(); 1398d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1399b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1400d5b93ddfSAnthony PERARD return 0; 1401d5b93ddfSAnthony PERARD} 1402d5b93ddfSAnthony PERARDEOF 1403d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1404d5b93ddfSAnthony PERARD ) ; then 1405d5b93ddfSAnthony PERARD xen_ctrl_version=400 1406d5b93ddfSAnthony PERARD xen=yes 1407d5b93ddfSAnthony PERARD 1408b87de24eSAnthony PERARD # Xen 3.4.0 1409b87de24eSAnthony PERARD elif ( 1410b87de24eSAnthony PERARD cat > $TMPC <<EOF 1411b87de24eSAnthony PERARD#include <xenctrl.h> 1412b87de24eSAnthony PERARD#include <xs.h> 1413b87de24eSAnthony PERARDint main(void) { 1414b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1415b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1416b87de24eSAnthony PERARD }; 1417b87de24eSAnthony PERARD xs_daemon_open(); 1418b87de24eSAnthony PERARD xc_interface_open(); 1419b87de24eSAnthony PERARD xc_gnttab_open(); 1420b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1421b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1422b87de24eSAnthony PERARD return 0; 1423b87de24eSAnthony PERARD} 1424b87de24eSAnthony PERARDEOF 1425b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 1426b87de24eSAnthony PERARD ) ; then 1427b87de24eSAnthony PERARD xen_ctrl_version=340 1428b87de24eSAnthony PERARD xen=yes 1429b87de24eSAnthony PERARD 1430b87de24eSAnthony PERARD # Xen 3.3.0 1431d5b93ddfSAnthony PERARD elif ( 1432d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1433d5b93ddfSAnthony PERARD#include <xenctrl.h> 1434d5b93ddfSAnthony PERARD#include <xs.h> 1435d5b93ddfSAnthony PERARDint main(void) { 1436d5b93ddfSAnthony PERARD xs_daemon_open(); 1437d5b93ddfSAnthony PERARD xc_interface_open(); 1438d5b93ddfSAnthony PERARD xc_gnttab_open(); 1439d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1440d5b93ddfSAnthony PERARD return 0; 1441d5b93ddfSAnthony PERARD} 1442d5b93ddfSAnthony PERARDEOF 1443d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1444d5b93ddfSAnthony PERARD ) ; then 1445d5b93ddfSAnthony PERARD xen_ctrl_version=330 1446d5b93ddfSAnthony PERARD xen=yes 1447d5b93ddfSAnthony PERARD 144850ced5b3SStefan Weil # Xen version unsupported 1449e37630caSaliguori else 1450fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 145150ced5b3SStefan Weil feature_not_found "xen (unsupported version)" 1452fc321b4bSJuan Quintela fi 1453fc321b4bSJuan Quintela xen=no 1454e37630caSaliguori fi 1455d5b93ddfSAnthony PERARD 1456d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1457d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1458d5b93ddfSAnthony PERARD fi 1459e37630caSaliguorifi 1460e37630caSaliguori 1461e37630caSaliguori########################################## 1462a8bd70adSPaolo Bonzini# pkg-config probe 1463f91672e5SPaolo Bonzini 146417884d7bSSergei Trofimovichif ! has "$pkg_config_exe"; then 146517884d7bSSergei Trofimovich echo "Error: pkg-config binary '$pkg_config_exe' not found" 1466a213fcb2SPeter Maydell exit 1 1467f91672e5SPaolo Bonzinifi 1468f91672e5SPaolo Bonzini 1469f91672e5SPaolo Bonzini########################################## 147044dc0ca3SAlon Levy# libtool probe 147144dc0ca3SAlon Levy 14723f534581SBradif ! has $libtool; then 147344dc0ca3SAlon Levy libtool= 147444dc0ca3SAlon Levyfi 147544dc0ca3SAlon Levy 147644dc0ca3SAlon Levy########################################## 1477dfffc653SJuan Quintela# Sparse probe 1478dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 14790dba6195SLoïc Minier if has cgcc; then 1480dfffc653SJuan Quintela sparse=yes 1481dfffc653SJuan Quintela else 1482dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1483dfffc653SJuan Quintela feature_not_found "sparse" 1484dfffc653SJuan Quintela fi 1485dfffc653SJuan Quintela sparse=no 1486dfffc653SJuan Quintela fi 1487dfffc653SJuan Quintelafi 1488dfffc653SJuan Quintela 1489dfffc653SJuan Quintela########################################## 149011d9f695Sbellard# SDL probe 149111d9f695Sbellard 14923ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 14933ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 14943ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 14953ec87ffeSPaolo Bonzini sdl_config=sdl-config 14963ec87ffeSPaolo Bonzinifi 14973ec87ffeSPaolo Bonzini 14983ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1499a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1500fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 15013ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 15023ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 15039316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1504a0dfd8a4SLoïc Minierelse 1505a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1506a0dfd8a4SLoïc Minier feature_not_found "sdl" 1507a0dfd8a4SLoïc Minier fi 1508a0dfd8a4SLoïc Minier sdl=no 15099316f803SPaolo Bonzinifi 151029e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 15113ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 15123ec87ffeSPaolo Bonzinifi 151311d9f695Sbellard 15149316f803SPaolo Bonzinisdl_too_old=no 1515c4198157SJuan Quintelaif test "$sdl" != "no" ; then 151611d9f695Sbellard cat > $TMPC << EOF 151711d9f695Sbellard#include <SDL.h> 151811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 151911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 152011d9f695SbellardEOF 15219316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 152274f42e18STeLeMan if test "$static" = "yes" ; then 152374f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 152474f42e18STeLeMan else 15259316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 152674f42e18STeLeMan fi 152752166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 152811d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 152911d9f695Sbellard sdl_too_old=yes 153011d9f695Sbellard else 1531fd677642Sths if test "$cocoa" = "no" ; then 153211d9f695Sbellard sdl=yes 153311d9f695Sbellard fi 1534fd677642Sths fi 15357c1f25b4Sbellard 153667c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 15371ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 153867c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1539f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1540f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 154111d9f695Sbellard fi 154252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 15431ac88f28SJuan Quintela : 15441ac88f28SJuan Quintela else 15451ac88f28SJuan Quintela sdl=no 15467c1f25b4Sbellard fi 15477c1f25b4Sbellard fi # static link 1548c4198157SJuan Quintela else # sdl not found 1549c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1550c4198157SJuan Quintela feature_not_found "sdl" 1551c4198157SJuan Quintela fi 1552c4198157SJuan Quintela sdl=no 15537c1f25b4Sbellard fi # sdl compile test 1554fd677642Sthsfi 155511d9f695Sbellard 15565368a422Saliguoriif test "$sdl" = "yes" ; then 15575368a422Saliguori cat > $TMPC <<EOF 15585368a422Saliguori#include <SDL.h> 15595368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 15605368a422Saliguori#include <X11/XKBlib.h> 15615368a422Saliguori#else 15625368a422Saliguori#error No x11 support 15635368a422Saliguori#endif 15645368a422Saliguoriint main(void) { return 0; } 15655368a422SaliguoriEOF 156652166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1567681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 15685368a422Saliguori fi 15690705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 15705368a422Saliguorifi 15715368a422Saliguori 15728f28f3fbSths########################################## 15738d5d2d4cSths# VNC TLS detection 1574821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1575ae6b5e5aSaliguori cat > $TMPC <<EOF 1576ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1577ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1578ae6b5e5aSaliguoriEOF 1579a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1580a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 158152166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 15821be10ad2SJuan Quintela vnc_tls=yes 1583a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1584ae6b5e5aSaliguori else 15851be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 15861be10ad2SJuan Quintela feature_not_found "vnc-tls" 15871be10ad2SJuan Quintela fi 15881be10ad2SJuan Quintela vnc_tls=no 15898d5d2d4cSths fi 15908d5d2d4cSthsfi 15918d5d2d4cSths 15928d5d2d4cSths########################################## 15932f9606b3Saliguori# VNC SASL detection 1594821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 15952f9606b3Saliguori cat > $TMPC <<EOF 15962f9606b3Saliguori#include <sasl/sasl.h> 15972f9606b3Saliguori#include <stdio.h> 15982f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 15992f9606b3SaliguoriEOF 16002f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 16012f9606b3Saliguori vnc_sasl_cflags="" 16022f9606b3Saliguori vnc_sasl_libs="-lsasl2" 160352166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1604ea784e3bSJuan Quintela vnc_sasl=yes 1605fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 16062f9606b3Saliguori else 1607ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1608ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1609ea784e3bSJuan Quintela fi 1610ea784e3bSJuan Quintela vnc_sasl=no 16112f9606b3Saliguori fi 16122f9606b3Saliguorifi 16132f9606b3Saliguori 16142f9606b3Saliguori########################################## 16152f6f5c7aSCorentin Chary# VNC JPEG detection 1616821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 16172f6f5c7aSCorentin Charycat > $TMPC <<EOF 16182f6f5c7aSCorentin Chary#include <stdio.h> 16192f6f5c7aSCorentin Chary#include <jpeglib.h> 16202f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 16212f6f5c7aSCorentin CharyEOF 16222f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 16232f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 16242f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 16252f6f5c7aSCorentin Chary vnc_jpeg=yes 16262f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 16272f6f5c7aSCorentin Chary else 16282f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 16292f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 16302f6f5c7aSCorentin Chary fi 16312f6f5c7aSCorentin Chary vnc_jpeg=no 16322f6f5c7aSCorentin Chary fi 16332f6f5c7aSCorentin Charyfi 16342f6f5c7aSCorentin Chary 16352f6f5c7aSCorentin Chary########################################## 1636efe556adSCorentin Chary# VNC PNG detection 1637821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1638efe556adSCorentin Charycat > $TMPC <<EOF 1639efe556adSCorentin Chary//#include <stdio.h> 1640efe556adSCorentin Chary#include <png.h> 1641832ce9c2SScott Wood#include <stddef.h> 1642efe556adSCorentin Charyint main(void) { 1643efe556adSCorentin Chary png_structp png_ptr; 1644efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1645efe556adSCorentin Chary return 0; 1646efe556adSCorentin Chary} 1647efe556adSCorentin CharyEOF 16489af8025eSBrad if $pkg_config libpng --modversion >/dev/null 2>&1; then 16499af8025eSBrad vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` 16509af8025eSBrad vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` 16519af8025eSBrad else 1652efe556adSCorentin Chary vnc_png_cflags="" 1653efe556adSCorentin Chary vnc_png_libs="-lpng" 16549af8025eSBrad fi 1655efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1656efe556adSCorentin Chary vnc_png=yes 1657efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 16589af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 1659efe556adSCorentin Chary else 1660efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1661efe556adSCorentin Chary feature_not_found "vnc-png" 1662efe556adSCorentin Chary fi 1663efe556adSCorentin Chary vnc_png=no 1664efe556adSCorentin Chary fi 1665efe556adSCorentin Charyfi 1666efe556adSCorentin Chary 1667efe556adSCorentin Chary########################################## 166876655d6dSaliguori# fnmatch() probe, used for ACL routines 166976655d6dSaliguorifnmatch="no" 167076655d6dSaliguoricat > $TMPC << EOF 167176655d6dSaliguori#include <fnmatch.h> 167276655d6dSaliguoriint main(void) 167376655d6dSaliguori{ 167476655d6dSaliguori fnmatch("foo", "foo", 0); 167576655d6dSaliguori return 0; 167676655d6dSaliguori} 167776655d6dSaliguoriEOF 167852166aa0SJuan Quintelaif compile_prog "" "" ; then 167976655d6dSaliguori fnmatch="yes" 168076655d6dSaliguorifi 168176655d6dSaliguori 168276655d6dSaliguori########################################## 1683ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1684ee682d27SStefan Weilif test "$uuid" != "no" ; then 1685ee682d27SStefan Weil uuid_libs="-luuid" 1686ee682d27SStefan Weil cat > $TMPC << EOF 1687ee682d27SStefan Weil#include <uuid/uuid.h> 1688ee682d27SStefan Weilint main(void) 1689ee682d27SStefan Weil{ 1690ee682d27SStefan Weil uuid_t my_uuid; 1691ee682d27SStefan Weil uuid_generate(my_uuid); 1692ee682d27SStefan Weil return 0; 1693ee682d27SStefan Weil} 1694ee682d27SStefan WeilEOF 1695ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1696ee682d27SStefan Weil uuid="yes" 1697ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1698ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1699ee682d27SStefan Weil else 1700ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1701ee682d27SStefan Weil feature_not_found "uuid" 1702ee682d27SStefan Weil fi 1703ee682d27SStefan Weil uuid=no 1704ee682d27SStefan Weil fi 1705ee682d27SStefan Weilfi 1706ee682d27SStefan Weil 1707ee682d27SStefan Weil########################################## 1708dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1709dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1710dce512deSChristoph Hellwig cat > $TMPC << EOF 1711ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 1712dce512deSChristoph Hellwig#include <xfs/xfs.h> 1713dce512deSChristoph Hellwigint main(void) 1714dce512deSChristoph Hellwig{ 1715dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1716dce512deSChristoph Hellwig return 0; 1717dce512deSChristoph Hellwig} 1718dce512deSChristoph HellwigEOF 1719dce512deSChristoph Hellwig if compile_prog "" "" ; then 1720dce512deSChristoph Hellwig xfs="yes" 1721dce512deSChristoph Hellwig else 1722dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1723dce512deSChristoph Hellwig feature_not_found "xfs" 1724dce512deSChristoph Hellwig fi 1725dce512deSChristoph Hellwig xfs=no 1726dce512deSChristoph Hellwig fi 1727dce512deSChristoph Hellwigfi 1728dce512deSChristoph Hellwig 1729dce512deSChristoph Hellwig########################################## 17308a16d273Sths# vde libraries probe 1731dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 17324baae0acSJuan Quintela vde_libs="-lvdeplug" 17338a16d273Sths cat > $TMPC << EOF 17348a16d273Sths#include <libvdeplug.h> 17354a7f0e06Spbrookint main(void) 17364a7f0e06Spbrook{ 17374a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 17384a7f0e06Spbrook vde_open("", "", &a); 17394a7f0e06Spbrook return 0; 17404a7f0e06Spbrook} 17418a16d273SthsEOF 174252166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 17434baae0acSJuan Quintela vde=yes 17448e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 17458e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1746dfb278bdSJuan Quintela else 1747dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1748dfb278bdSJuan Quintela feature_not_found "vde" 1749dfb278bdSJuan Quintela fi 1750dfb278bdSJuan Quintela vde=no 17518a16d273Sths fi 17528a16d273Sthsfi 17538a16d273Sths 17548a16d273Sths########################################## 175547e98658SCorey Bryant# libcap-ng library probe 175647e98658SCorey Bryantif test "$cap_ng" != "no" ; then 175747e98658SCorey Bryant cap_libs="-lcap-ng" 175847e98658SCorey Bryant cat > $TMPC << EOF 175947e98658SCorey Bryant#include <cap-ng.h> 176047e98658SCorey Bryantint main(void) 176147e98658SCorey Bryant{ 176247e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 176347e98658SCorey Bryant return 0; 176447e98658SCorey Bryant} 176547e98658SCorey BryantEOF 176647e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 176747e98658SCorey Bryant cap_ng=yes 176847e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 176947e98658SCorey Bryant else 177047e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 177147e98658SCorey Bryant feature_not_found "cap_ng" 177247e98658SCorey Bryant fi 177347e98658SCorey Bryant cap_ng=no 177447e98658SCorey Bryant fi 177547e98658SCorey Bryantfi 177647e98658SCorey Bryant 177747e98658SCorey Bryant########################################## 1778c2de5c91Smalc# Sound support libraries probe 17798f28f3fbSths 1780c2de5c91Smalcaudio_drv_probe() 1781c2de5c91Smalc{ 1782c2de5c91Smalc drv=$1 1783c2de5c91Smalc hdr=$2 1784c2de5c91Smalc lib=$3 1785c2de5c91Smalc exp=$4 1786c2de5c91Smalc cfl=$5 17878f28f3fbSths cat > $TMPC << EOF 1788c2de5c91Smalc#include <$hdr> 1789c2de5c91Smalcint main(void) { $exp } 17908f28f3fbSthsEOF 179152166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 17928f28f3fbSths : 17938f28f3fbSths else 17948f28f3fbSths echo 1795c2de5c91Smalc echo "Error: $drv check failed" 1796c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 17978f28f3fbSths echo 17988f28f3fbSths exit 1 17998f28f3fbSths fi 1800c2de5c91Smalc} 1801c2de5c91Smalc 18022fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1803c2de5c91Smalcfor drv in $audio_drv_list; do 1804c2de5c91Smalc case $drv in 1805c2de5c91Smalc alsa) 1806c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1807c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1808a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1809c2de5c91Smalc ;; 1810c2de5c91Smalc 1811c2de5c91Smalc fmod) 1812c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1813c2de5c91Smalc echo 1814c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1815c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1816c2de5c91Smalc echo 1817c2de5c91Smalc exit 1 18188f28f3fbSths fi 1819c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1820a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1821c2de5c91Smalc ;; 1822c2de5c91Smalc 1823c2de5c91Smalc esd) 1824c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1825a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 182667f86e8eSJuan Quintela audio_pt_int="yes" 1827c2de5c91Smalc ;; 1828b8e59f18Smalc 1829b8e59f18Smalc pa) 1830493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 183120fa53ecSMarc-Antoine Perennou "pa_simple *s = 0; pa_simple_free(s); return 0;" 1832493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 183367f86e8eSJuan Quintela audio_pt_int="yes" 1834b8e59f18Smalc ;; 1835b8e59f18Smalc 1836997e690aSJuan Quintela coreaudio) 1837997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1838997e690aSJuan Quintela ;; 1839997e690aSJuan Quintela 1840a4bf6780SJuan Quintela dsound) 1841a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1842d5631638Smalc audio_win_int="yes" 1843a4bf6780SJuan Quintela ;; 1844a4bf6780SJuan Quintela 1845a4bf6780SJuan Quintela oss) 1846a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1847a4bf6780SJuan Quintela ;; 1848a4bf6780SJuan Quintela 1849a4bf6780SJuan Quintela sdl|wav) 18502f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 18512f6a1ab0Sblueswir1 ;; 18522f6a1ab0Sblueswir1 1853d5631638Smalc winwave) 1854d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1855d5631638Smalc audio_win_int="yes" 1856d5631638Smalc ;; 1857d5631638Smalc 1858e4c63a6aSmalc *) 18591c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1860e4c63a6aSmalc echo 1861e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1862e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1863e4c63a6aSmalc echo 1864e4c63a6aSmalc exit 1 1865e4c63a6aSmalc } 1866e4c63a6aSmalc ;; 1867c2de5c91Smalc esac 1868c2de5c91Smalcdone 18698f28f3fbSths 18704d3b6f6eSbalrog########################################## 18712e4d9fb1Saurel32# BrlAPI probe 18722e4d9fb1Saurel32 18734ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1874eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 18752e4d9fb1Saurel32 cat > $TMPC << EOF 18762e4d9fb1Saurel32#include <brlapi.h> 1877832ce9c2SScott Wood#include <stddef.h> 18782e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 18792e4d9fb1Saurel32EOF 188052166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 18812e4d9fb1Saurel32 brlapi=yes 1882264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 18834ffcedb6SJuan Quintela else 18844ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 18854ffcedb6SJuan Quintela feature_not_found "brlapi" 18864ffcedb6SJuan Quintela fi 18874ffcedb6SJuan Quintela brlapi=no 1888eb82284fSJuan Quintela fi 1889eb82284fSJuan Quintelafi 18902e4d9fb1Saurel32 18912e4d9fb1Saurel32########################################## 18924d3b6f6eSbalrog# curses probe 1893e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 1894e095e2f3SStefan Weil curses_list="-lpdcurses" 1895e095e2f3SStefan Weilelse 18964f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 1897e095e2f3SStefan Weilfi 18984d3b6f6eSbalrog 1899c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1900c584a6d0SJuan Quintela curses_found=no 19014d3b6f6eSbalrog cat > $TMPC << EOF 19024d3b6f6eSbalrog#include <curses.h> 19035a8ff3aaSblueswir1#ifdef __OpenBSD__ 19045a8ff3aaSblueswir1#define resize_term resizeterm 19055a8ff3aaSblueswir1#endif 1906ef9a2524SStefan Weilint main(void) { 1907ef9a2524SStefan Weil const char *s = curses_version(); 1908ef9a2524SStefan Weil resize_term(0, 0); 1909ef9a2524SStefan Weil return s != 0; 1910ef9a2524SStefan Weil} 19114d3b6f6eSbalrogEOF 19124f78ef9aSJuan Quintela for curses_lib in $curses_list; do 19134f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1914c584a6d0SJuan Quintela curses_found=yes 19154f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 19164f78ef9aSJuan Quintela break 19174d3b6f6eSbalrog fi 19184f78ef9aSJuan Quintela done 1919c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1920c584a6d0SJuan Quintela curses=yes 1921c584a6d0SJuan Quintela else 1922c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1923c584a6d0SJuan Quintela feature_not_found "curses" 1924c584a6d0SJuan Quintela fi 1925c584a6d0SJuan Quintela curses=no 1926c584a6d0SJuan Quintela fi 19274f78ef9aSJuan Quintelafi 19284d3b6f6eSbalrog 1929414f0dabSblueswir1########################################## 1930769ce76dSAlexander Graf# curl probe 1931769ce76dSAlexander Graf 1932a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1933a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 19344e2b0658SPaolo Bonzinielse 19354e2b0658SPaolo Bonzini curlconfig=curl-config 19364e2b0658SPaolo Bonzinifi 19374e2b0658SPaolo Bonzini 1938788c8196SJuan Quintelaif test "$curl" != "no" ; then 1939769ce76dSAlexander Graf cat > $TMPC << EOF 1940769ce76dSAlexander Graf#include <curl/curl.h> 19410b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 1942769ce76dSAlexander GrafEOF 19434e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 19444e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1945b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1946769ce76dSAlexander Graf curl=yes 1947f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1948f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1949788c8196SJuan Quintela else 1950788c8196SJuan Quintela if test "$curl" = "yes" ; then 1951788c8196SJuan Quintela feature_not_found "curl" 1952788c8196SJuan Quintela fi 1953788c8196SJuan Quintela curl=no 1954769ce76dSAlexander Graf fi 1955769ce76dSAlexander Graffi # test "$curl" 1956769ce76dSAlexander Graf 1957769ce76dSAlexander Graf########################################## 1958fb599c9aSbalrog# bluez support probe 1959a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1960e820e3f4Sbalrog cat > $TMPC << EOF 1961e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1962e820e3f4Sbalrogint main(void) { return bt_error(0); } 1963e820e3f4SbalrogEOF 1964a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1965a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 196652166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1967a20a6f46SJuan Quintela bluez=yes 1968e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1969e820e3f4Sbalrog else 1970a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1971a20a6f46SJuan Quintela feature_not_found "bluez" 1972a20a6f46SJuan Quintela fi 1973e820e3f4Sbalrog bluez="no" 1974e820e3f4Sbalrog fi 1975fb599c9aSbalrogfi 1976fb599c9aSbalrog 1977fb599c9aSbalrog########################################## 1978e18df141SAnthony Liguori# glib support probe 19794b76a481SStefan Hajnocziif $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then 19804b76a481SStefan Hajnoczi glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` 19814b76a481SStefan Hajnoczi glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` 198214015304SAnthony Liguori LIBS="$glib_libs $LIBS" 1983957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 1984e18df141SAnthony Liguorielse 1985e18df141SAnthony Liguori echo "glib-2.0 required to compile QEMU" 1986e18df141SAnthony Liguori exit 1 1987e18df141SAnthony Liguorifi 1988e18df141SAnthony Liguori 1989e18df141SAnthony Liguori########################################## 199017bff52bSM. Mohan Kumar# libcap probe 199117bff52bSM. Mohan Kumar 199217bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 199317bff52bSM. Mohan Kumar cat > $TMPC <<EOF 199417bff52bSM. Mohan Kumar#include <stdio.h> 199517bff52bSM. Mohan Kumar#include <sys/capability.h> 199617bff52bSM. Mohan Kumarint main(void) { cap_t caps; caps = cap_init(); } 199717bff52bSM. Mohan KumarEOF 199817bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 199917bff52bSM. Mohan Kumar cap=yes 200017bff52bSM. Mohan Kumar else 200117bff52bSM. Mohan Kumar cap=no 200217bff52bSM. Mohan Kumar fi 200317bff52bSM. Mohan Kumarfi 200417bff52bSM. Mohan Kumar 200517bff52bSM. Mohan Kumar########################################## 2006e5d355d1Saliguori# pthread probe 20074b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 20083c529d93Saliguori 2009e5d355d1Saliguoripthread=no 2010414f0dabSblueswir1cat > $TMPC << EOF 20113c529d93Saliguori#include <pthread.h> 20127a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 20137a42bbe4SStefan Weilint main(void) { 20147a42bbe4SStefan Weil pthread_t thread; 20157a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 20167a42bbe4SStefan Weil return 0; 20177a42bbe4SStefan Weil} 2018414f0dabSblueswir1EOF 2019bd00d539SAndreas Färberif compile_prog "" "" ; then 2020bd00d539SAndreas Färber pthread=yes 2021bd00d539SAndreas Färberelse 2022de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 202352166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 2024e5d355d1Saliguori pthread=yes 20255572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 2026de65fe0fSSebastian Herbszt break 2027414f0dabSblueswir1 fi 2028de65fe0fSSebastian Herbszt done 2029bd00d539SAndreas Färberfi 2030414f0dabSblueswir1 20314617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 20324dd75c70SChristoph Hellwig echo 20334dd75c70SChristoph Hellwig echo "Error: pthread check failed" 20344dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 20354dd75c70SChristoph Hellwig echo 20364dd75c70SChristoph Hellwig exit 1 2037e5d355d1Saliguorifi 2038e5d355d1Saliguori 2039bf9298b9Saliguori########################################## 2040f27aaf4bSChristian Brunner# rbd probe 2041f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2042f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2043f27aaf4bSChristian Brunner#include <stdio.h> 2044ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2045f27aaf4bSChristian Brunnerint main(void) { 2046ad32e9c0SJosh Durgin rados_t cluster; 2047ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2048f27aaf4bSChristian Brunner return 0; 2049f27aaf4bSChristian Brunner} 2050f27aaf4bSChristian BrunnerEOF 2051ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2052f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2053f27aaf4bSChristian Brunner rbd=yes 2054f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 2055f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 2056f27aaf4bSChristian Brunner else 2057f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 2058f27aaf4bSChristian Brunner feature_not_found "rados block device" 2059f27aaf4bSChristian Brunner fi 2060f27aaf4bSChristian Brunner rbd=no 2061f27aaf4bSChristian Brunner fi 2062f27aaf4bSChristian Brunnerfi 2063f27aaf4bSChristian Brunner 2064f27aaf4bSChristian Brunner########################################## 20655c6c3a6cSChristoph Hellwig# linux-aio probe 20665c6c3a6cSChristoph Hellwig 20675c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 20685c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 20695c6c3a6cSChristoph Hellwig#include <libaio.h> 20705c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2071832ce9c2SScott Wood#include <stddef.h> 20725c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 20735c6c3a6cSChristoph HellwigEOF 20745c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 20755c6c3a6cSChristoph Hellwig linux_aio=yes 2076048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 2077048d179fSPaul Brook libs_tools="$libs_tools -laio" 20785c6c3a6cSChristoph Hellwig else 20795c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 20805c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 20815c6c3a6cSChristoph Hellwig fi 20823cfcae3cSLuiz Capitulino linux_aio=no 20835c6c3a6cSChristoph Hellwig fi 20845c6c3a6cSChristoph Hellwigfi 20855c6c3a6cSChristoph Hellwig 20865c6c3a6cSChristoph Hellwig########################################## 2087758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2088758e8e38SVenkateswararao Jujjuri (JV) 2089758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2090758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2091758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2092758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2093f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2094f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2095f2338fb4SPavel Borzenkov#else 20964f26f2b6SAvi Kivity#include <sys/xattr.h> 2097f2338fb4SPavel Borzenkov#endif 2098758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2099758e8e38SVenkateswararao Jujjuri (JV)EOF 21004f26f2b6SAvi Kivity if compile_prog "" "" ; then 21014f26f2b6SAvi Kivity attr=yes 21024f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2103f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2104758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2105758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 21064f26f2b6SAvi Kivity libattr=yes 2107758e8e38SVenkateswararao Jujjuri (JV) else 2108758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2109758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 2110758e8e38SVenkateswararao Jujjuri (JV) fi 2111758e8e38SVenkateswararao Jujjuri (JV) attr=no 2112758e8e38SVenkateswararao Jujjuri (JV) fi 2113758e8e38SVenkateswararao Jujjuri (JV)fi 2114758e8e38SVenkateswararao Jujjuri (JV) 2115758e8e38SVenkateswararao Jujjuri (JV)########################################## 2116bf9298b9Saliguori# iovec probe 2117bf9298b9Saliguoricat > $TMPC <<EOF 2118db34f0b3Sblueswir1#include <sys/types.h> 2119bf9298b9Saliguori#include <sys/uio.h> 2120db34f0b3Sblueswir1#include <unistd.h> 2121f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2122bf9298b9SaliguoriEOF 2123bf9298b9Saliguoriiovec=no 212452166aa0SJuan Quintelaif compile_prog "" "" ; then 2125bf9298b9Saliguori iovec=yes 2126bf9298b9Saliguorifi 2127bf9298b9Saliguori 2128f652e6afSaurel32########################################## 2129ceb42de8Saliguori# preadv probe 2130ceb42de8Saliguoricat > $TMPC <<EOF 2131ceb42de8Saliguori#include <sys/types.h> 2132ceb42de8Saliguori#include <sys/uio.h> 2133ceb42de8Saliguori#include <unistd.h> 213484972cbbSStefan Weilint main(void) { return preadv == preadv; } 2135ceb42de8SaliguoriEOF 2136ceb42de8Saliguoripreadv=no 213752166aa0SJuan Quintelaif compile_prog "" "" ; then 2138ceb42de8Saliguori preadv=yes 2139ceb42de8Saliguorifi 2140ceb42de8Saliguori 2141ceb42de8Saliguori########################################## 2142f652e6afSaurel32# fdt probe 21432df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2144b41af4baSJuan Quintela fdt_libs="-lfdt" 2145f652e6afSaurel32 cat > $TMPC << EOF 2146f652e6afSaurel32int main(void) { return 0; } 2147f652e6afSaurel32EOF 214852166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2149f652e6afSaurel32 fdt=yes 21502df87df7SJuan Quintela else 21512df87df7SJuan Quintela if test "$fdt" = "yes" ; then 21522df87df7SJuan Quintela feature_not_found "fdt" 21532df87df7SJuan Quintela fi 2154de3a354aSMichael Walle fdt_libs= 21552df87df7SJuan Quintela fdt=no 2156f652e6afSaurel32 fi 2157f652e6afSaurel32fi 2158f652e6afSaurel32 215920ff075bSMichael Walle########################################## 216020ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 216120ff075bSMichael Walleif test "$opengl" != "no" ; then 216220ff075bSMichael Walle opengl_libs="-lGL" 216320ff075bSMichael Walle cat > $TMPC << EOF 216420ff075bSMichael Walle#include <X11/Xlib.h> 216520ff075bSMichael Walle#include <GL/gl.h> 216620ff075bSMichael Walle#include <GL/glx.h> 216784972cbbSStefan Weilint main(void) { return GL_VERSION != 0; } 216820ff075bSMichael WalleEOF 216920ff075bSMichael Walle if compile_prog "" "-lGL" ; then 217020ff075bSMichael Walle opengl=yes 217120ff075bSMichael Walle else 217220ff075bSMichael Walle if test "$opengl" = "yes" ; then 217320ff075bSMichael Walle feature_not_found "opengl" 217420ff075bSMichael Walle fi 2175de3a354aSMichael Walle opengl_libs= 217620ff075bSMichael Walle opengl=no 217720ff075bSMichael Walle fi 217820ff075bSMichael Wallefi 217920ff075bSMichael Walle 21803b3f24adSaurel32# 21813b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 21823b3f24adSaurel32# emulator. This is done because older glibc versions don't 21833b3f24adSaurel32# have syscall stubs for these implemented. 21843b3f24adSaurel32# 21853b3f24adSaurel32atfile=no 21863b3f24adSaurel32cat > $TMPC << EOF 21873b3f24adSaurel32#define _ATFILE_SOURCE 21883b3f24adSaurel32#include <sys/types.h> 21893b3f24adSaurel32#include <fcntl.h> 21903b3f24adSaurel32#include <unistd.h> 21913b3f24adSaurel32 21923b3f24adSaurel32int 21933b3f24adSaurel32main(void) 21943b3f24adSaurel32{ 21953b3f24adSaurel32 /* try to unlink nonexisting file */ 21963b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 21973b3f24adSaurel32} 21983b3f24adSaurel32EOF 219952166aa0SJuan Quintelaif compile_prog "" "" ; then 22003b3f24adSaurel32 atfile=yes 22013b3f24adSaurel32fi 22023b3f24adSaurel32 220339386ac7Saurel32# Check for inotify functions when we are building linux-user 22043b3f24adSaurel32# emulator. This is done because older glibc versions don't 22053b3f24adSaurel32# have syscall stubs for these implemented. In that case we 22063b3f24adSaurel32# don't provide them even if kernel supports them. 22073b3f24adSaurel32# 22083b3f24adSaurel32inotify=no 22093b3f24adSaurel32cat > $TMPC << EOF 22103b3f24adSaurel32#include <sys/inotify.h> 22113b3f24adSaurel32 22123b3f24adSaurel32int 22133b3f24adSaurel32main(void) 22143b3f24adSaurel32{ 22153b3f24adSaurel32 /* try to start inotify */ 22168690e420Saurel32 return inotify_init(); 22173b3f24adSaurel32} 22183b3f24adSaurel32EOF 221952166aa0SJuan Quintelaif compile_prog "" "" ; then 22203b3f24adSaurel32 inotify=yes 22213b3f24adSaurel32fi 22223b3f24adSaurel32 2223c05c7a73SRiku Voipioinotify1=no 2224c05c7a73SRiku Voipiocat > $TMPC << EOF 2225c05c7a73SRiku Voipio#include <sys/inotify.h> 2226c05c7a73SRiku Voipio 2227c05c7a73SRiku Voipioint 2228c05c7a73SRiku Voipiomain(void) 2229c05c7a73SRiku Voipio{ 2230c05c7a73SRiku Voipio /* try to start inotify */ 2231c05c7a73SRiku Voipio return inotify_init1(0); 2232c05c7a73SRiku Voipio} 2233c05c7a73SRiku VoipioEOF 2234c05c7a73SRiku Voipioif compile_prog "" "" ; then 2235c05c7a73SRiku Voipio inotify1=yes 2236c05c7a73SRiku Voipiofi 2237c05c7a73SRiku Voipio 2238ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2239ebc996f3SRiku Voipioutimens=no 2240ebc996f3SRiku Voipiocat > $TMPC << EOF 2241ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2242ebc996f3SRiku Voipio#include <stddef.h> 2243ebc996f3SRiku Voipio#include <fcntl.h> 2244ebc996f3SRiku Voipio 2245ebc996f3SRiku Voipioint main(void) 2246ebc996f3SRiku Voipio{ 2247ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2248ebc996f3SRiku Voipio futimens(0, NULL); 2249ebc996f3SRiku Voipio return 0; 2250ebc996f3SRiku Voipio} 2251ebc996f3SRiku VoipioEOF 225252166aa0SJuan Quintelaif compile_prog "" "" ; then 2253ebc996f3SRiku Voipio utimens=yes 2254ebc996f3SRiku Voipiofi 2255ebc996f3SRiku Voipio 2256099d6b0fSRiku Voipio# check if pipe2 is there 2257099d6b0fSRiku Voipiopipe2=no 2258099d6b0fSRiku Voipiocat > $TMPC << EOF 2259099d6b0fSRiku Voipio#include <unistd.h> 2260099d6b0fSRiku Voipio#include <fcntl.h> 2261099d6b0fSRiku Voipio 2262099d6b0fSRiku Voipioint main(void) 2263099d6b0fSRiku Voipio{ 2264099d6b0fSRiku Voipio int pipefd[2]; 2265099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2266099d6b0fSRiku Voipio return 0; 2267099d6b0fSRiku Voipio} 2268099d6b0fSRiku VoipioEOF 226952166aa0SJuan Quintelaif compile_prog "" "" ; then 2270099d6b0fSRiku Voipio pipe2=yes 2271099d6b0fSRiku Voipiofi 2272099d6b0fSRiku Voipio 227340ff6d7eSKevin Wolf# check if accept4 is there 227440ff6d7eSKevin Wolfaccept4=no 227540ff6d7eSKevin Wolfcat > $TMPC << EOF 227640ff6d7eSKevin Wolf#include <sys/socket.h> 227740ff6d7eSKevin Wolf#include <stddef.h> 227840ff6d7eSKevin Wolf 227940ff6d7eSKevin Wolfint main(void) 228040ff6d7eSKevin Wolf{ 228140ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 228240ff6d7eSKevin Wolf return 0; 228340ff6d7eSKevin Wolf} 228440ff6d7eSKevin WolfEOF 228540ff6d7eSKevin Wolfif compile_prog "" "" ; then 228640ff6d7eSKevin Wolf accept4=yes 228740ff6d7eSKevin Wolffi 228840ff6d7eSKevin Wolf 22893ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 22903ce34dfbSvibisreenivasansplice=no 22913ce34dfbSvibisreenivasancat > $TMPC << EOF 22923ce34dfbSvibisreenivasan#include <unistd.h> 22933ce34dfbSvibisreenivasan#include <fcntl.h> 22943ce34dfbSvibisreenivasan#include <limits.h> 22953ce34dfbSvibisreenivasan 22963ce34dfbSvibisreenivasanint main(void) 22973ce34dfbSvibisreenivasan{ 229866ea0f22SStefan Weil int len, fd = 0; 22993ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 23003ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 23013ce34dfbSvibisreenivasan return 0; 23023ce34dfbSvibisreenivasan} 23033ce34dfbSvibisreenivasanEOF 230452166aa0SJuan Quintelaif compile_prog "" "" ; then 23053ce34dfbSvibisreenivasan splice=yes 23063ce34dfbSvibisreenivasanfi 23073ce34dfbSvibisreenivasan 2308dcc38d1cSMarcelo Tosatti########################################## 2309dcc38d1cSMarcelo Tosatti# signalfd probe 2310dcc38d1cSMarcelo Tosattisignalfd="no" 2311dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2312dcc38d1cSMarcelo Tosatti#include <unistd.h> 2313dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2314dcc38d1cSMarcelo Tosatti#include <signal.h> 2315dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2316dcc38d1cSMarcelo TosattiEOF 2317dcc38d1cSMarcelo Tosatti 2318dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2319dcc38d1cSMarcelo Tosatti signalfd=yes 2320dcc38d1cSMarcelo Tosattifi 2321dcc38d1cSMarcelo Tosatti 2322c2882b96SRiku Voipio# check if eventfd is supported 2323c2882b96SRiku Voipioeventfd=no 2324c2882b96SRiku Voipiocat > $TMPC << EOF 2325c2882b96SRiku Voipio#include <sys/eventfd.h> 2326c2882b96SRiku Voipio 2327c2882b96SRiku Voipioint main(void) 2328c2882b96SRiku Voipio{ 232955cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 2330c2882b96SRiku Voipio} 2331c2882b96SRiku VoipioEOF 2332c2882b96SRiku Voipioif compile_prog "" "" ; then 2333c2882b96SRiku Voipio eventfd=yes 2334c2882b96SRiku Voipiofi 2335c2882b96SRiku Voipio 2336d0927938SUlrich Hecht# check for fallocate 2337d0927938SUlrich Hechtfallocate=no 2338d0927938SUlrich Hechtcat > $TMPC << EOF 2339d0927938SUlrich Hecht#include <fcntl.h> 2340d0927938SUlrich Hecht 2341d0927938SUlrich Hechtint main(void) 2342d0927938SUlrich Hecht{ 2343d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2344d0927938SUlrich Hecht return 0; 2345d0927938SUlrich Hecht} 2346d0927938SUlrich HechtEOF 2347be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2348d0927938SUlrich Hecht fallocate=yes 2349d0927938SUlrich Hechtfi 2350d0927938SUlrich Hecht 2351c727f47dSPeter Maydell# check for sync_file_range 2352c727f47dSPeter Maydellsync_file_range=no 2353c727f47dSPeter Maydellcat > $TMPC << EOF 2354c727f47dSPeter Maydell#include <fcntl.h> 2355c727f47dSPeter Maydell 2356c727f47dSPeter Maydellint main(void) 2357c727f47dSPeter Maydell{ 2358c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2359c727f47dSPeter Maydell return 0; 2360c727f47dSPeter Maydell} 2361c727f47dSPeter MaydellEOF 2362c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2363c727f47dSPeter Maydell sync_file_range=yes 2364c727f47dSPeter Maydellfi 2365c727f47dSPeter Maydell 2366dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2367dace20dcSPeter Maydellfiemap=no 2368dace20dcSPeter Maydellcat > $TMPC << EOF 2369dace20dcSPeter Maydell#include <sys/ioctl.h> 2370dace20dcSPeter Maydell#include <linux/fs.h> 2371dace20dcSPeter Maydell#include <linux/fiemap.h> 2372dace20dcSPeter Maydell 2373dace20dcSPeter Maydellint main(void) 2374dace20dcSPeter Maydell{ 2375dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2376dace20dcSPeter Maydell return 0; 2377dace20dcSPeter Maydell} 2378dace20dcSPeter MaydellEOF 2379dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2380dace20dcSPeter Maydell fiemap=yes 2381dace20dcSPeter Maydellfi 2382dace20dcSPeter Maydell 2383d0927938SUlrich Hecht# check for dup3 2384d0927938SUlrich Hechtdup3=no 2385d0927938SUlrich Hechtcat > $TMPC << EOF 2386d0927938SUlrich Hecht#include <unistd.h> 2387d0927938SUlrich Hecht 2388d0927938SUlrich Hechtint main(void) 2389d0927938SUlrich Hecht{ 2390d0927938SUlrich Hecht dup3(0, 0, 0); 2391d0927938SUlrich Hecht return 0; 2392d0927938SUlrich Hecht} 2393d0927938SUlrich HechtEOF 239478f5d726SJan Kiszkaif compile_prog "" "" ; then 2395d0927938SUlrich Hecht dup3=yes 2396d0927938SUlrich Hechtfi 2397d0927938SUlrich Hecht 23983b6edd16SPeter Maydell# check for epoll support 23993b6edd16SPeter Maydellepoll=no 24003b6edd16SPeter Maydellcat > $TMPC << EOF 24013b6edd16SPeter Maydell#include <sys/epoll.h> 24023b6edd16SPeter Maydell 24033b6edd16SPeter Maydellint main(void) 24043b6edd16SPeter Maydell{ 24053b6edd16SPeter Maydell epoll_create(0); 24063b6edd16SPeter Maydell return 0; 24073b6edd16SPeter Maydell} 24083b6edd16SPeter MaydellEOF 24093b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24103b6edd16SPeter Maydell epoll=yes 24113b6edd16SPeter Maydellfi 24123b6edd16SPeter Maydell 24133b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 24143b6edd16SPeter Maydell# so we must check separately for their presence 24153b6edd16SPeter Maydellepoll_create1=no 24163b6edd16SPeter Maydellcat > $TMPC << EOF 24173b6edd16SPeter Maydell#include <sys/epoll.h> 24183b6edd16SPeter Maydell 24193b6edd16SPeter Maydellint main(void) 24203b6edd16SPeter Maydell{ 242119e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 242219e83f6bSPeter Maydell * a function being called. This is necessary so that on 242319e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 242419e83f6bSPeter Maydell * the library but not declared in the header file we will 242519e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 242619e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 242719e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 242819e83f6bSPeter Maydell */ 242984972cbbSStefan Weil return epoll_create1 == epoll_create1; 24303b6edd16SPeter Maydell} 24313b6edd16SPeter MaydellEOF 24323b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24333b6edd16SPeter Maydell epoll_create1=yes 24343b6edd16SPeter Maydellfi 24353b6edd16SPeter Maydell 24363b6edd16SPeter Maydellepoll_pwait=no 24373b6edd16SPeter Maydellcat > $TMPC << EOF 24383b6edd16SPeter Maydell#include <sys/epoll.h> 24393b6edd16SPeter Maydell 24403b6edd16SPeter Maydellint main(void) 24413b6edd16SPeter Maydell{ 24423b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 24433b6edd16SPeter Maydell return 0; 24443b6edd16SPeter Maydell} 24453b6edd16SPeter MaydellEOF 24463b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24473b6edd16SPeter Maydell epoll_pwait=yes 24483b6edd16SPeter Maydellfi 24493b6edd16SPeter Maydell 2450cc8ae6deSpbrook# Check if tools are available to build documentation. 2451a25dba17SJuan Quintelaif test "$docs" != "no" ; then 245201668d98SStefan Weil if has makeinfo && has pod2man; then 2453a25dba17SJuan Quintela docs=yes 245483a3ab8bSJuan Quintela else 2455a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2456a25dba17SJuan Quintela feature_not_found "docs" 245783a3ab8bSJuan Quintela fi 2458a25dba17SJuan Quintela docs=no 245983a3ab8bSJuan Quintela fi 2460cc8ae6deSpbrookfi 2461cc8ae6deSpbrook 2462f514f41cSStefan Weil# Search for bswap_32 function 24636ae9a1f4SJuan Quintelabyteswap_h=no 24646ae9a1f4SJuan Quintelacat > $TMPC << EOF 24656ae9a1f4SJuan Quintela#include <byteswap.h> 24666ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 24676ae9a1f4SJuan QuintelaEOF 246852166aa0SJuan Quintelaif compile_prog "" "" ; then 24696ae9a1f4SJuan Quintela byteswap_h=yes 24706ae9a1f4SJuan Quintelafi 24716ae9a1f4SJuan Quintela 2472f514f41cSStefan Weil# Search for bswap_32 function 24736ae9a1f4SJuan Quintelabswap_h=no 24746ae9a1f4SJuan Quintelacat > $TMPC << EOF 24756ae9a1f4SJuan Quintela#include <sys/endian.h> 24766ae9a1f4SJuan Quintela#include <sys/types.h> 24776ae9a1f4SJuan Quintela#include <machine/bswap.h> 24786ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 24796ae9a1f4SJuan QuintelaEOF 248052166aa0SJuan Quintelaif compile_prog "" "" ; then 24816ae9a1f4SJuan Quintela bswap_h=yes 24826ae9a1f4SJuan Quintelafi 24836ae9a1f4SJuan Quintela 2484da93a1fdSaliguori########################################## 2485c589b249SRonnie Sahlberg# Do we have libiscsi 2486c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 2487c589b249SRonnie Sahlberg cat > $TMPC << EOF 2488c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 2489c589b249SRonnie Sahlbergint main(void) { iscsi_create_context(""); return 0; } 2490c589b249SRonnie SahlbergEOF 2491c589b249SRonnie Sahlberg if compile_prog "-Werror" "-liscsi" ; then 2492c589b249SRonnie Sahlberg libiscsi="yes" 2493c589b249SRonnie Sahlberg LIBS="$LIBS -liscsi" 2494c589b249SRonnie Sahlberg else 2495c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 2496c589b249SRonnie Sahlberg feature_not_found "libiscsi" 2497c589b249SRonnie Sahlberg fi 2498c589b249SRonnie Sahlberg libiscsi="no" 2499c589b249SRonnie Sahlberg fi 2500c589b249SRonnie Sahlbergfi 2501c589b249SRonnie Sahlberg 2502c589b249SRonnie Sahlberg 2503c589b249SRonnie Sahlberg########################################## 2504da93a1fdSaliguori# Do we need librt 2505da93a1fdSaliguoricat > $TMPC <<EOF 2506da93a1fdSaliguori#include <signal.h> 2507da93a1fdSaliguori#include <time.h> 250866ea0f22SStefan Weilint main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } 2509da93a1fdSaliguoriEOF 2510da93a1fdSaliguori 251152166aa0SJuan Quintelaif compile_prog "" "" ; then 251207ffa4bdSJuan Quintela : 251352166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 251407ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2515da93a1fdSaliguorifi 2516da93a1fdSaliguori 251731ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2518179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 25196362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 25206362a53fSJuan Quintelafi 25216362a53fSJuan Quintela 2522de5071c5SBlue Swirl########################################## 2523de5071c5SBlue Swirl# check if the compiler defines offsetof 2524de5071c5SBlue Swirl 2525de5071c5SBlue Swirlneed_offsetof=yes 2526de5071c5SBlue Swirlcat > $TMPC << EOF 2527de5071c5SBlue Swirl#include <stddef.h> 2528de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2529de5071c5SBlue SwirlEOF 2530de5071c5SBlue Swirlif compile_prog "" "" ; then 2531de5071c5SBlue Swirl need_offsetof=no 2532de5071c5SBlue Swirlfi 2533de5071c5SBlue Swirl 2534cd4ec0b4SGerd Hoffmann# spice probe 2535cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2536cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2537cd4ec0b4SGerd Hoffmann#include <spice.h> 2538cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2539cd4ec0b4SGerd HoffmannEOF 2540710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2541710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 2542012b80d3SGerd Hoffmann if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \ 2543cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2544cd4ec0b4SGerd Hoffmann spice="yes" 2545cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2546cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2547cd4ec0b4SGerd Hoffmann else 2548cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2549cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2550cd4ec0b4SGerd Hoffmann fi 2551cd4ec0b4SGerd Hoffmann spice="no" 2552cd4ec0b4SGerd Hoffmann fi 2553cd4ec0b4SGerd Hoffmannfi 2554cd4ec0b4SGerd Hoffmann 2555111a38b0SRobert Relyea# check for libcacard for smartcard support 2556111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2557111a38b0SRobert Relyea smartcard="yes" 2558111a38b0SRobert Relyea smartcard_cflags="" 2559111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2560111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 25615f01e06fSSergei Trofimovich cat > $TMPC << EOF 25625f01e06fSSergei Trofimovich#include <pk11pub.h> 25635f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; } 25645f01e06fSSergei TrofimovichEOF 2565111a38b0SRobert Relyea smartcard_cflags="-I\$(SRC_PATH)/libcacard" 2566111a38b0SRobert Relyea libcacard_libs=$($pkg_config --libs nss 2>/dev/null) 2567111a38b0SRobert Relyea libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null) 25685f01e06fSSergei Trofimovich if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ 25695f01e06fSSergei Trofimovich compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then 25705f01e06fSSergei Trofimovich smartcard_nss="yes" 2571111a38b0SRobert Relyea QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" 2572111a38b0SRobert Relyea LIBS="$libcacard_libs $LIBS" 2573111a38b0SRobert Relyea else 2574111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2575111a38b0SRobert Relyea feature_not_found "nss" 2576111a38b0SRobert Relyea fi 2577111a38b0SRobert Relyea smartcard_nss="no" 2578111a38b0SRobert Relyea fi 2579111a38b0SRobert Relyea fi 2580111a38b0SRobert Relyeafi 2581111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2582111a38b0SRobert Relyea smartcard_nss="no" 2583111a38b0SRobert Relyeafi 2584111a38b0SRobert Relyea 258569354a83SHans de Goede# check for usbredirparser for usb network redirection support 258669354a83SHans de Goedeif test "$usb_redir" != "no" ; then 258769354a83SHans de Goede if $pkg_config libusbredirparser >/dev/null 2>&1 ; then 258869354a83SHans de Goede usb_redir="yes" 258969354a83SHans de Goede usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) 259069354a83SHans de Goede usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null) 259169354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 259269354a83SHans de Goede LIBS="$LIBS $usb_redir_libs" 259369354a83SHans de Goede else 259469354a83SHans de Goede if test "$usb_redir" = "yes"; then 259569354a83SHans de Goede feature_not_found "usb-redir" 259669354a83SHans de Goede fi 259769354a83SHans de Goede usb_redir="no" 259869354a83SHans de Goede fi 259969354a83SHans de Goedefi 260069354a83SHans de Goede 2601cd4ec0b4SGerd Hoffmann########################################## 2602cd4ec0b4SGerd Hoffmann 2603747bbdf7SBlue Swirl########################################## 26045f6b9e8fSBlue Swirl# check if we have fdatasync 26055f6b9e8fSBlue Swirl 26065f6b9e8fSBlue Swirlfdatasync=no 26075f6b9e8fSBlue Swirlcat > $TMPC << EOF 26085f6b9e8fSBlue Swirl#include <unistd.h> 2609d1722a27SAlexandre Raymondint main(void) { 2610d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2611d1722a27SAlexandre Raymondreturn fdatasync(0); 2612d1722a27SAlexandre Raymond#else 2613d1722a27SAlexandre Raymond#abort Not supported 2614d1722a27SAlexandre Raymond#endif 2615d1722a27SAlexandre Raymond} 26165f6b9e8fSBlue SwirlEOF 26175f6b9e8fSBlue Swirlif compile_prog "" "" ; then 26185f6b9e8fSBlue Swirl fdatasync=yes 26195f6b9e8fSBlue Swirlfi 26205f6b9e8fSBlue Swirl 262194a420b1SStefan Hajnoczi########################################## 2622e78815a5SAndreas Färber# check if we have madvise 2623e78815a5SAndreas Färber 2624e78815a5SAndreas Färbermadvise=no 2625e78815a5SAndreas Färbercat > $TMPC << EOF 2626e78815a5SAndreas Färber#include <sys/types.h> 2627e78815a5SAndreas Färber#include <sys/mman.h> 2628832ce9c2SScott Wood#include <stddef.h> 2629e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2630e78815a5SAndreas FärberEOF 2631e78815a5SAndreas Färberif compile_prog "" "" ; then 2632e78815a5SAndreas Färber madvise=yes 2633e78815a5SAndreas Färberfi 2634e78815a5SAndreas Färber 2635e78815a5SAndreas Färber########################################## 2636e78815a5SAndreas Färber# check if we have posix_madvise 2637e78815a5SAndreas Färber 2638e78815a5SAndreas Färberposix_madvise=no 2639e78815a5SAndreas Färbercat > $TMPC << EOF 2640e78815a5SAndreas Färber#include <sys/mman.h> 2641832ce9c2SScott Wood#include <stddef.h> 2642e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2643e78815a5SAndreas FärberEOF 2644e78815a5SAndreas Färberif compile_prog "" "" ; then 2645e78815a5SAndreas Färber posix_madvise=yes 2646e78815a5SAndreas Färberfi 2647e78815a5SAndreas Färber 2648e78815a5SAndreas Färber########################################## 264994a420b1SStefan Hajnoczi# check if trace backend exists 265094a420b1SStefan Hajnoczi 26514c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 265294a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 265394a420b1SStefan Hajnoczi echo 265494a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 265594a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 265694a420b1SStefan Hajnoczi echo 265794a420b1SStefan Hajnoczi exit 1 265894a420b1SStefan Hajnoczifi 265994a420b1SStefan Hajnoczi 26607e24e92aSStefan Hajnoczi########################################## 26617e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 26627e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 26637e24e92aSStefan Hajnoczi cat > $TMPC << EOF 26647e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 26657e24e92aSStefan Hajnoczi#include <ust/marker.h> 26667e24e92aSStefan Hajnocziint main(void) { return 0; } 26677e24e92aSStefan HajnocziEOF 26687e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 26697e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 26707e24e92aSStefan Hajnoczi else 26717e24e92aSStefan Hajnoczi echo 26727e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 26737e24e92aSStefan Hajnoczi echo 26747e24e92aSStefan Hajnoczi exit 1 26757e24e92aSStefan Hajnoczi fi 26767e24e92aSStefan Hajnoczifi 2677b3d08c02SDaniel P. Berrange 2678b3d08c02SDaniel P. Berrange########################################## 2679b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2680b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2681b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2682b3d08c02SDaniel P. Berrange echo 2683b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2684b3d08c02SDaniel P. Berrange echo 2685b3d08c02SDaniel P. Berrange exit 1 2686b3d08c02SDaniel P. Berrange fi 2687c276b17dSDaniel P. Berrange trace_backend_stap="no" 2688c276b17dSDaniel P. Berrange if has 'stap' ; then 2689c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2690c276b17dSDaniel P. Berrange fi 2691b3d08c02SDaniel P. Berrangefi 2692b3d08c02SDaniel P. Berrange 26937e24e92aSStefan Hajnoczi########################################## 2694023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2695023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit 2696023367e6SWolfgang Mauerer# specification is necessary 26971ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then 2698023367e6SWolfgang Mauerer cat > $TMPC << EOF 2699023367e6SWolfgang Mauererint sfaa(unsigned *ptr) 2700023367e6SWolfgang Mauerer{ 2701023367e6SWolfgang Mauerer return __sync_fetch_and_and(ptr, 0); 2702023367e6SWolfgang Mauerer} 2703023367e6SWolfgang Mauerer 2704023367e6SWolfgang Mauererint main(int argc, char **argv) 2705023367e6SWolfgang Mauerer{ 2706023367e6SWolfgang Mauerer int val = 42; 2707023367e6SWolfgang Mauerer sfaa(&val); 2708023367e6SWolfgang Mauerer return val; 2709023367e6SWolfgang Mauerer} 2710023367e6SWolfgang MauererEOF 2711023367e6SWolfgang Mauerer if ! compile_prog "" "" ; then 2712023367e6SWolfgang Mauerer CFLAGS+="-march=i486" 2713023367e6SWolfgang Mauerer fi 2714023367e6SWolfgang Mauererfi 2715023367e6SWolfgang Mauerer 2716023367e6SWolfgang Mauerer########################################## 2717d0e2fce5SAneesh Kumar K.V# check if we have makecontext 2718d0e2fce5SAneesh Kumar K.V 2719d0e2fce5SAneesh Kumar K.Vucontext_coroutine=no 2720d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 2721d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2722d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 272375cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2724d0e2fce5SAneesh Kumar K.VEOF 2725d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 2726d0e2fce5SAneesh Kumar K.V ucontext_coroutine=yes 2727d0e2fce5SAneesh Kumar K.V fi 2728d0e2fce5SAneesh Kumar K.Vfi 2729d0e2fce5SAneesh Kumar K.V 2730d0e2fce5SAneesh Kumar K.V########################################## 2731d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 2732d2042378SAneesh Kumar K.V 2733d2042378SAneesh Kumar K.Vopen_by_hande_at=no 2734d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 2735d2042378SAneesh Kumar K.V#include <fcntl.h> 273675cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 2737d2042378SAneesh Kumar K.VEOF 2738d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 2739d2042378SAneesh Kumar K.V open_by_handle_at=yes 2740d2042378SAneesh Kumar K.Vfi 2741d2042378SAneesh Kumar K.V 2742e06a765eSHarsh Prateek Bora######################################## 2743e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 2744e06a765eSHarsh Prateek Bora 2745e06a765eSHarsh Prateek Boralinux_magic_h=no 2746e06a765eSHarsh Prateek Boracat > $TMPC << EOF 2747e06a765eSHarsh Prateek Bora#include <linux/magic.h> 2748e06a765eSHarsh Prateek Boraint main(void) { 274975cafad7SStefan Weil return 0; 2750e06a765eSHarsh Prateek Bora} 2751e06a765eSHarsh Prateek BoraEOF 2752e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 2753e06a765eSHarsh Prateek Bora linux_magic_h=yes 2754e06a765eSHarsh Prateek Borafi 2755e06a765eSHarsh Prateek Bora 2756d2042378SAneesh Kumar K.V########################################## 2757e86ecd4bSJuan Quintela# End of CC checks 2758e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2759e86ecd4bSJuan Quintela 2760e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 27611156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2762e86ecd4bSJuan Quintelafi 2763a316e378SJuan Quintela 2764e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2765e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2766e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 276720ff6c80SAnthony Liguori 276820ff6c80SAnthony Liguoriif test -z "$werror" ; then 2769e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2770e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2771e86ecd4bSJuan Quintela werror="yes" 2772e86ecd4bSJuan Quintela else 2773e86ecd4bSJuan Quintela werror="no" 2774e86ecd4bSJuan Quintela fi 2775e86ecd4bSJuan Quintelafi 2776e86ecd4bSJuan Quintela 277720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 277820ff6c80SAnthony Liguori# enable/disable 277920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 278020ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 278120ff6c80SAnthony Liguori zero_malloc="no" 278220ff6c80SAnthony Liguori else 278320ff6c80SAnthony Liguori zero_malloc="yes" 278420ff6c80SAnthony Liguori fi 278520ff6c80SAnthony Liguorifi 278620ff6c80SAnthony Liguori 2787e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2788a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2789e86ecd4bSJuan Quintelafi 2790e86ecd4bSJuan Quintela 2791e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2792e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 27931156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2794e86ecd4bSJuan Quintela fi 2795e86ecd4bSJuan Quintelafi 2796e86ecd4bSJuan Quintela 2797952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2798952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2799952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2800952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2801952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2802952afb71SBlue Swirl fi 2803952afb71SBlue Swirl done 2804952afb71SBlue Swirlfi 2805952afb71SBlue Swirl 2806190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 28075a67135aSbellard 2808ca35f780SPaolo Bonzinitools= 2809ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2810ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 281117bff52bSM. Mohan Kumar if [ "$cap" = "yes" -a "$linux" = "yes" ] ; then 281217bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 281317bff52bSM. Mohan Kumar fi 2814ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2815ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2816d138cee9SMichael Roth if [ "$guest_agent" = "yes" ]; then 281748ff7a62SMichael Roth tools="qemu-ga\$(EXESUF) $tools" 2818d138cee9SMichael Roth fi 2819ca35f780SPaolo Bonzini fi 2820ca35f780SPaolo Bonzinifi 2821ca35f780SPaolo Bonzini 2822ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2823ca35f780SPaolo Bonziniroms= 2824ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2825ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2826ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2827ca35f780SPaolo Bonzini roms="optionrom" 2828ca35f780SPaolo Bonzinifi 2829d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 283039ac8455SDavid Gibson roms="$roms spapr-rtas" 283139ac8455SDavid Gibsonfi 2832ca35f780SPaolo Bonzini 28337d13299dSbellardecho "Install prefix $prefix" 2834f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2835f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 28363aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 28370f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 28381c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 283911d9f695Sbellardif test "$mingw32" = "no" ; then 2840f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 284143ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 284211d9f695Sbellardfi 28435a67135aSbellardecho "Source path $source_path" 28447d13299dSbellardecho "C compiler $cc" 284583469015Sbellardecho "Host C compiler $host_cc" 28460c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2847a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 28480c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 28497d13299dSbellardecho "make $make" 28506a882643Spbrookecho "install $install" 2851c886edfbSBlue Swirlecho "python $python" 2852e2d8830eSBradif test "$slirp" = "yes" ; then 2853e2d8830eSBrad echo "smbd $smbd" 2854e2d8830eSBradfi 2855a98fd896Sbellardecho "host CPU $cpu" 2856de83cd02Sbellardecho "host big endian $bigendian" 285797a847bcSbellardecho "target list $target_list" 2858ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2859b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 28607d13299dSbellardecho "gprof enabled $gprof" 286103b4fe7dSaliguoriecho "sparse enabled $sparse" 28621625af87Saliguoriecho "strip binaries $strip_opt" 286305c2a3e7Sbellardecho "profiler $profiler" 286443ce4dfeSbellardecho "static build $static" 286585aa5189Sbellardecho "-Werror enabled $werror" 28665b0753e0Sbellardif test "$darwin" = "yes" ; then 28675b0753e0Sbellard echo "Cocoa support $cocoa" 28685b0753e0Sbellardfi 286997a847bcSbellardecho "SDL support $sdl" 28704d3b6f6eSbalrogecho "curses support $curses" 2871769ce76dSAlexander Grafecho "curl support $curl" 287267b915a5Sbellardecho "mingw32 support $mingw32" 28730c58ac1cSmalcecho "Audio drivers $audio_drv_list" 28740c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2875eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 28768ff9cbf7Smalcecho "Mixer emulation $mixemu" 2877821601eaSJes Sorensenecho "VNC support $vnc" 2878821601eaSJes Sorensenif test "$vnc" = "yes" ; then 28798d5d2d4cSths echo "VNC TLS support $vnc_tls" 28802f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 28812f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 2882efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 2883bd023f95SCorentin Chary echo "VNC thread $vnc_thread" 2884821601eaSJes Sorensenfi 28853142255cSblueswir1if test -n "$sparc_cpu"; then 28863142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 28873142255cSblueswir1fi 2888e37630caSaliguoriecho "xen support $xen" 28892e4d9fb1Saurel32echo "brlapi support $brlapi" 2890a20a6f46SJuan Quintelaecho "bluez support $bluez" 2891a25dba17SJuan Quintelaecho "Documentation $docs" 2892c5937220Spbrook[ ! -z "$uname_release" ] && \ 2893c5937220Spbrookecho "uname -r $uname_release" 2894bd0c5661Spbrookecho "NPTL support $nptl" 2895379f6698SPaul Brookecho "GUEST_BASE $guest_base" 289640d6444eSAvi Kivityecho "PIE $pie" 28978a16d273Sthsecho "vde support $vde" 28985c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2899758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 290077755340Sthsecho "Install blobs $blobs" 2901b31a0277SJuan Quintelaecho "KVM support $kvm" 29029195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 2903f652e6afSaurel32echo "fdt support $fdt" 2904ceb42de8Saliguoriecho "preadv support $preadv" 29055f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2906e78815a5SAndreas Färberecho "madvise $madvise" 2907e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2908ee682d27SStefan Weilecho "uuid support $uuid" 290947e98658SCorey Bryantecho "libcap-ng support $cap_ng" 2910d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 291194a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 29129410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2913cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2914f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2915dce512deSChristoph Hellwigecho "xfsctl support $xfs" 2916111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 291769354a83SHans de Goedeecho "usb net redir $usb_redir" 291820ff075bSMichael Walleecho "OpenGL support $opengl" 2919c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 2920d138cee9SMichael Rothecho "build guest agent $guest_agent" 292167b915a5Sbellard 29221ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 292324b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2924e8cd23deSbellardfi 292597a847bcSbellard 292698ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 29274bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 292897a847bcSbellard 292998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 293098ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 293198ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 293298ec69acSJuan Quintelaecho >> $config_host_mak 293398ec69acSJuan Quintela 2934e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 293599d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 293699d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 29373aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 29380f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 293999d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 294099d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 294199d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 294299d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 29431dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 29447b93fadfSCorey Bryantecho "libexecdir=\${prefix}/libexec" >> $config_host_mak 2945*a7c36ee4SCorey Bryantecho "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak 2946*a7c36ee4SCorey Bryantecho "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak 2947804edf29SJuan Quintela 294898ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2949f8393946Saurel32if test "$debug_tcg" = "yes" ; then 29502358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2951f8393946Saurel32fi 2952b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2953b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2954b4475aa2SLuiz Capitulinofi 2955f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 29562358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2957f3d08ee6SPaul Brookfi 29581625af87Saliguoriif test "$strip_opt" = "yes" ; then 295952ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 29601625af87Saliguorifi 29617d13299dSbellardif test "$bigendian" = "yes" ; then 2962e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 296397a847bcSbellardfi 29642358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 296567b915a5Sbellardif test "$mingw32" = "yes" ; then 296698ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 29679fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 29689fe6de94SBlue Swirl version_major=${rc_version%%.*} 29699fe6de94SBlue Swirl rc_version=${rc_version#*.} 29709fe6de94SBlue Swirl version_minor=${rc_version%%.*} 29719fe6de94SBlue Swirl rc_version=${rc_version#*.} 29729fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 29739fe6de94SBlue Swirl version_micro=0 29749fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 29759fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2976210fa556Spbrookelse 297735f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2978210fa556Spbrookfi 2979128ab2ffSblueswir1 2980dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2981dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2982dffcb71cSMark McLoughlinfi 2983dffcb71cSMark McLoughlin 298483fb7adfSbellardif test "$darwin" = "yes" ; then 298598ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 298683fb7adfSbellardfi 2987b29fe3edSmalc 2988b29fe3edSmalcif test "$aix" = "yes" ; then 298998ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2990b29fe3edSmalcfi 2991b29fe3edSmalc 2992ec530c81Sbellardif test "$solaris" = "yes" ; then 299398ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 29942358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 29950475a5caSths if test "$needs_libsunmath" = "yes" ; then 299675b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 29970475a5caSths fi 2998ec530c81Sbellardfi 2999179cf400SAndreas Färberif test "$haiku" = "yes" ; then 3000179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 3001179cf400SAndreas Färberfi 300297a847bcSbellardif test "$static" = "yes" ; then 300398ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 300497a847bcSbellardfi 30051ba16968SStefan Weilif test "$profiler" = "yes" ; then 30062358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 300705c2a3e7Sbellardfi 3008c20709aaSbellardif test "$slirp" = "yes" ; then 300998ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 3010e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3011f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 3012c20709aaSbellardfi 30138a16d273Sthsif test "$vde" = "yes" ; then 301498ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 30158a16d273Sthsfi 301647e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 301747e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 301847e98658SCorey Bryantfi 30190c58ac1cSmalcfor card in $audio_card_list; do 3020f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 302198ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 30220c58ac1cSmalcdone 30232358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 30240c58ac1cSmalcfor drv in $audio_drv_list; do 3025f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 302698ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 3027923e4521Smalc if test "$drv" = "fmod"; then 30287aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 3029fb065187Sbellard fi 30300c58ac1cSmalcdone 303167f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 303267f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 303367f86e8eSJuan Quintelafi 3034d5631638Smalcif test "$audio_win_int" = "yes" ; then 3035d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 3036d5631638Smalcfi 3037eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 30388ff9cbf7Smalcif test "$mixemu" = "yes" ; then 303998ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 30408ff9cbf7Smalcfi 3041821601eaSJes Sorensenif test "$vnc" = "yes" ; then 3042821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 3043821601eaSJes Sorensenfi 30448d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 304598ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 3046525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 30478d5d2d4cSthsfi 30482f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 304998ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 305060ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 30512f9606b3Saliguorifi 3052821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 30532f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 30542f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 30552f6f5c7aSCorentin Charyfi 3056821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 3057efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 3058efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 3059efe556adSCorentin Charyfi 3060821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then 3061bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 3062bd023f95SCorentin Charyfi 306376655d6dSaliguoriif test "$fnmatch" = "yes" ; then 30642358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 306576655d6dSaliguorifi 3066ee682d27SStefan Weilif test "$uuid" = "yes" ; then 3067ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 3068ee682d27SStefan Weilfi 3069dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3070dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3071dce512deSChristoph Hellwigfi 3072b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 307398ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 30742358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 307598ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 307698ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 3077a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 307898ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 3079cc8ae6deSpbrookfi 30801ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 308198ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 30828ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 308349ecc3faSbellardfi 308449ecc3faSbellardif test "$cocoa" = "yes" ; then 308598ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 308649ecc3faSbellardfi 30874d3b6f6eSbalrogif test "$curses" = "yes" ; then 308898ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 3089ab4e5602SJan Kiszkafi 30903b3f24adSaurel32if test "$atfile" = "yes" ; then 30912358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 30923b3f24adSaurel32fi 3093ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 30942358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 3095ebc996f3SRiku Voipiofi 3096099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 30972358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 3098099d6b0fSRiku Voipiofi 309940ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 310040ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 310140ff6d7eSKevin Wolffi 31023ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 31032358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 31043ce34dfbSvibisreenivasanfi 3105c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 3106c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 3107c2882b96SRiku Voipiofi 3108d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 3109d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 3110d0927938SUlrich Hechtfi 3111c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 3112c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 3113c727f47dSPeter Maydellfi 3114dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 3115dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 3116dace20dcSPeter Maydellfi 3117d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 3118d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 3119d0927938SUlrich Hechtfi 31203b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 31213b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 31223b6edd16SPeter Maydellfi 31233b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 31243b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 31253b6edd16SPeter Maydellfi 31263b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 31273b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 31283b6edd16SPeter Maydellfi 31293b3f24adSaurel32if test "$inotify" = "yes" ; then 31302358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 31313b3f24adSaurel32fi 3132c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 3133c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 3134c05c7a73SRiku Voipiofi 31356ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 31366ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 31376ae9a1f4SJuan Quintelafi 31386ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 31396ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 31406ae9a1f4SJuan Quintelafi 3141769ce76dSAlexander Grafif test "$curl" = "yes" ; then 314298ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 3143b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 3144769ce76dSAlexander Graffi 31452e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 314698ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 31472e4d9fb1Saurel32fi 3148fb599c9aSbalrogif test "$bluez" = "yes" ; then 314998ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 3150ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 3151fb599c9aSbalrogfi 3152e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3153e37630caSaliguoriif test "$xen" = "yes" ; then 31546dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3155d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3156e37630caSaliguorifi 31575c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 31585c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 31595c6c3a6cSChristoph Hellwigfi 3160758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 3161758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 3162758e8e38SVenkateswararao Jujjuri (JV)fi 31634f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 31644f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 31654f26f2b6SAvi Kivityfi 3166758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 3167758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 3168758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 3169758e8e38SVenkateswararao Jujjuri (JV) fi 3170758e8e38SVenkateswararao Jujjuri (JV)fi 317177755340Sthsif test "$blobs" = "yes" ; then 317298ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 317377755340Sthsfi 3174bf9298b9Saliguoriif test "$iovec" = "yes" ; then 31752358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 3176bf9298b9Saliguorifi 3177ceb42de8Saliguoriif test "$preadv" = "yes" ; then 31782358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 3179ceb42de8Saliguorifi 3180f652e6afSaurel32if test "$fdt" = "yes" ; then 31813f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 3182f652e6afSaurel32fi 3183dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 3184dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 3185dcc38d1cSMarcelo Tosattifi 31869195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 31879195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 31889195b2c2SStefan Weilfi 3189de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 3190de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 3191de5071c5SBlue Swirlfi 31925f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 31935f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 31945f6b9e8fSBlue Swirlfi 3195e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 3196e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 3197e78815a5SAndreas Färberfi 3198e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 3199e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 3200e78815a5SAndreas Färberfi 320197a847bcSbellard 3202cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 3203cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 3204cd4ec0b4SGerd Hoffmannfi 3205cd4ec0b4SGerd Hoffmann 320636707144SAlon Levyif test "$smartcard" = "yes" ; then 320736707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 320836707144SAlon Levyfi 320936707144SAlon Levy 3210111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3211111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 3212111a38b0SRobert Relyeafi 3213111a38b0SRobert Relyea 321469354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 321569354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 321669354a83SHans de Goedefi 321769354a83SHans de Goede 321820ff075bSMichael Walleif test "$opengl" = "yes" ; then 321920ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 322020ff075bSMichael Wallefi 322120ff075bSMichael Walle 3222c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 3223c589b249SRonnie Sahlberg echo "CONFIG_LIBISCSI=y" >> $config_host_mak 3224c589b249SRonnie Sahlbergfi 3225c589b249SRonnie Sahlberg 322683fb7adfSbellard# XXX: suppress that 32277d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 32282358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 32297d3505c5Sbellardfi 32307d3505c5Sbellard 32312358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 3232c5937220Spbrook 323320ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 323420ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 323520ff6c80SAnthony Liguorifi 3236f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 3237f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 3238f27aaf4bSChristian Brunnerfi 323920ff6c80SAnthony Liguori 3240d0e2fce5SAneesh Kumar K.Vif test "$ucontext_coroutine" = "yes" ; then 3241d0e2fce5SAneesh Kumar K.V echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak 3242d0e2fce5SAneesh Kumar K.Vfi 3243d0e2fce5SAneesh Kumar K.V 3244d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 3245d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 3246d2042378SAneesh Kumar K.Vfi 3247d2042378SAneesh Kumar K.V 3248e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 3249e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 3250e06a765eSHarsh Prateek Borafi 3251e06a765eSHarsh Prateek Bora 325268063649Sblueswir1# USB host support 325368063649Sblueswir1case "$usb" in 325468063649Sblueswir1linux) 325598ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 325668063649Sblueswir1;; 325768063649Sblueswir1bsd) 325898ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 325968063649Sblueswir1;; 326068063649Sblueswir1*) 326198ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 326268063649Sblueswir1;; 326368063649Sblueswir1esac 326468063649Sblueswir1 3265e4858974SLluís# use default implementation for tracing backend-specific routines 3266e4858974SLluístrace_default=yes 326794a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 32686d8a764eSLluísif test "$trace_backend" = "nop"; then 32696d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 327022890ab5SPrerna Saxenafi 32719410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 32726d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 3273e4858974SLluís trace_default=no 32746d8a764eSLluís # Set the appropriate trace file. 3275953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 32769410b56cSPrerna Saxenafi 32776d8a764eSLluísif test "$trace_backend" = "stderr"; then 32786d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 32799a82b6a5SLluís trace_default=no 32806d8a764eSLluísfi 32816d8a764eSLluísif test "$trace_backend" = "ust"; then 32826d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 32836d8a764eSLluísfi 32846d8a764eSLluísif test "$trace_backend" = "dtrace"; then 32856d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 32866d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 32876d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 32886d8a764eSLluís fi 3289c276b17dSDaniel P. Berrangefi 32909410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 3291e4858974SLluísif test "$trace_default" = "yes"; then 3292e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 3293e4858974SLluísfi 32949410b56cSPrerna Saxena 329598ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 329698ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3297804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3298804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 32991901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 33001901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 33011901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 3302c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 3303804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 33042b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 3305804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 3306804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3307804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3308804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 33099fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 331044dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 3311e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 3312a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 3313f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 3314e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 3315e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 3316e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 3317e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 3318e39f0062SPaolo Bonzinifi 3319c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 3320e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 3321a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 3322a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 332373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 33243e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 3325804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3326957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 3327804edf29SJuan Quintela 33284bf6b55bSJuan Quintela# generate list of library paths for linker script 33294bf6b55bSJuan Quintela 33304bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 33314bf6b55bSJuan Quintela 33324bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 33334bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 33344bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 33354bf6b55bSJuan Quintela else 33364bf6b55bSJuan Quintela rm ${config_host_ld}~ 33374bf6b55bSJuan Quintela fi 33384bf6b55bSJuan Quintelafi 33394bf6b55bSJuan Quintela 33404d904533SBlue Swirlfor d in libdis libdis-user; do 33414d904533SBlue Swirl mkdir -p $d 334211568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 33434d904533SBlue Swirl echo > $d/config.mak 33444d904533SBlue Swirldone 33454d904533SBlue Swirl 33466efd7517SPeter Maydell# use included Linux headers 33476efd7517SPeter Maydellif test "$linux" = "yes" ; then 33486efd7517SPeter Maydell mkdir -p linux-headers 33496efd7517SPeter Maydell case "$cpu" in 33506efd7517SPeter Maydell i386|x86_64) 33516efd7517SPeter Maydell symlink $source_path/linux-headers/asm-x86 linux-headers/asm 33526efd7517SPeter Maydell ;; 33536efd7517SPeter Maydell ppcemb|ppc|ppc64) 33546efd7517SPeter Maydell symlink $source_path/linux-headers/asm-powerpc linux-headers/asm 33556efd7517SPeter Maydell ;; 33566efd7517SPeter Maydell s390x) 33576efd7517SPeter Maydell symlink $source_path/linux-headers/asm-s390 linux-headers/asm 33586efd7517SPeter Maydell ;; 33596efd7517SPeter Maydell esac 33606efd7517SPeter Maydellfi 33616efd7517SPeter Maydell 336297a847bcSbellardfor target in $target_list; do 336397a847bcSbellardtarget_dir="$target" 336425be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3365600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 336697a847bcSbellardtarget_bigendian="no" 33671f3d3c8fSJuan Quintela 3368ea2d6a39SJuan Quintelacase "$target_arch2" in 3369cfa550c6SMax Filippov armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 3370ea2d6a39SJuan Quintela target_bigendian=yes 3371ea2d6a39SJuan Quintela ;; 3372ea2d6a39SJuan Quintelaesac 337397a847bcSbellardtarget_softmmu="no" 3374997344f3Sbellardtarget_user_only="no" 3375831b7825Sthstarget_linux_user="no" 3376831b7825Sthstarget_darwin_user="no" 337784778508Sblueswir1target_bsd_user="no" 33789e407a85Spbrookcase "$target" in 3379600309b6SBlue Swirl ${target_arch2}-softmmu) 33809e407a85Spbrook target_softmmu="yes" 33819e407a85Spbrook ;; 3382600309b6SBlue Swirl ${target_arch2}-linux-user) 33839c7a4202SBlue Swirl if test "$linux" != "yes" ; then 33849c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 33859c7a4202SBlue Swirl exit 1 33869c7a4202SBlue Swirl fi 33879e407a85Spbrook target_user_only="yes" 33889e407a85Spbrook target_linux_user="yes" 33899e407a85Spbrook ;; 3390600309b6SBlue Swirl ${target_arch2}-darwin-user) 33919c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 33929c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 33939c7a4202SBlue Swirl exit 1 33949c7a4202SBlue Swirl fi 33959e407a85Spbrook target_user_only="yes" 3396831b7825Sths target_darwin_user="yes" 33979e407a85Spbrook ;; 3398600309b6SBlue Swirl ${target_arch2}-bsd-user) 33999cf55765SBlue Swirl if test "$bsd" != "yes" ; then 34009c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 34019c7a4202SBlue Swirl exit 1 34029c7a4202SBlue Swirl fi 340384778508Sblueswir1 target_user_only="yes" 340484778508Sblueswir1 target_bsd_user="yes" 340584778508Sblueswir1 ;; 34069e407a85Spbrook *) 34079e407a85Spbrook echo "ERROR: Target '$target' not recognised" 34089e407a85Spbrook exit 1 34099e407a85Spbrook ;; 34109e407a85Spbrookesac 3411831b7825Sths 341297a847bcSbellardmkdir -p $target_dir 3413158142c2Sbellardmkdir -p $target_dir/fpu 341457fec1feSbellardmkdir -p $target_dir/tcg 341559f2a787SGerd Hoffmannmkdir -p $target_dir/ide 3416353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs 34173b9a6ee5SJan Kiszkamkdir -p $target_dir/kvm 341884778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 341969de927cSbellard mkdir -p $target_dir/nwfpe 342069de927cSbellardfi 342111568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 3422ec530c81Sbellard 342397a847bcSbellard 342425be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 342597a847bcSbellard 3426e5fe0c52Spbrookbflt="no" 3427bd0c5661Spbrooktarget_nptl="no" 3428600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 342956aebc89Spbrookgdb_xml_files="" 3430c2e3dee6SLaurent Viviertarget_short_alignment=2 3431c2e3dee6SLaurent Viviertarget_int_alignment=4 3432c2e3dee6SLaurent Viviertarget_long_alignment=4 3433c2e3dee6SLaurent Viviertarget_llong_alignment=8 3434de3a354aSMichael Walletarget_libs_softmmu= 34357ba1e619Saliguori 3436938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 34376acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3438e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3439e73aae67SJuan Quintela 3440600309b6SBlue Swirlcase "$target_arch2" in 34412408a527Saurel32 i386) 344271deff27SAurelien Jarno target_phys_bits=64 34432408a527Saurel32 ;; 34442408a527Saurel32 x86_64) 34456acff7daSJuan Quintela TARGET_BASE_ARCH=i386 34461ad2134fSPaul Brook target_phys_bits=64 3447c2e3dee6SLaurent Vivier target_long_alignment=8 34482408a527Saurel32 ;; 34492408a527Saurel32 alpha) 34501ad2134fSPaul Brook target_phys_bits=64 3451c2e3dee6SLaurent Vivier target_long_alignment=8 3452a4b388ffSRichard Henderson target_nptl="yes" 34532408a527Saurel32 ;; 34542408a527Saurel32 arm|armeb) 3455b498c8a0SJuan Quintela TARGET_ARCH=arm 3456e5fe0c52Spbrook bflt="yes" 3457bd0c5661Spbrook target_nptl="yes" 345856aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 34591ad2134fSPaul Brook target_phys_bits=32 3460c2e3dee6SLaurent Vivier target_llong_alignment=4 34612408a527Saurel32 ;; 34622408a527Saurel32 cris) 3463253bd7f8Sedgar_igl target_nptl="yes" 34641ad2134fSPaul Brook target_phys_bits=32 34652408a527Saurel32 ;; 3466613a22c9SMichael Walle lm32) 3467613a22c9SMichael Walle target_phys_bits=32 3468de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3469613a22c9SMichael Walle ;; 34702408a527Saurel32 m68k) 34710938cda5Saurel32 bflt="yes" 347256aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 34731ad2134fSPaul Brook target_phys_bits=32 3474c2e3dee6SLaurent Vivier target_int_alignment=2 3475c2e3dee6SLaurent Vivier target_long_alignment=2 3476c2e3dee6SLaurent Vivier target_llong_alignment=2 34772408a527Saurel32 ;; 3478877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3479877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 348072b675caSEdgar E. Iglesias bflt="yes" 348172b675caSEdgar E. Iglesias target_nptl="yes" 348272b675caSEdgar E. Iglesias target_phys_bits=32 3483de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 348472b675caSEdgar E. Iglesias ;; 34852408a527Saurel32 mips|mipsel) 3486b498c8a0SJuan Quintela TARGET_ARCH=mips 348725be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3488f04dc72fSPaul Brook target_nptl="yes" 34891ad2134fSPaul Brook target_phys_bits=64 34902408a527Saurel32 ;; 34912408a527Saurel32 mipsn32|mipsn32el) 3492b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 34936acff7daSJuan Quintela TARGET_BASE_ARCH=mips 349425be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 34951ad2134fSPaul Brook target_phys_bits=64 34962408a527Saurel32 ;; 34972408a527Saurel32 mips64|mips64el) 3498b498c8a0SJuan Quintela TARGET_ARCH=mips64 34996acff7daSJuan Quintela TARGET_BASE_ARCH=mips 350025be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 35011ad2134fSPaul Brook target_phys_bits=64 3502c2e3dee6SLaurent Vivier target_long_alignment=8 35032408a527Saurel32 ;; 35042408a527Saurel32 ppc) 3505c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35068b242ebaSAlexander Graf target_phys_bits=64 3507d6630708SNathan Froyd target_nptl="yes" 3508de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35092408a527Saurel32 ;; 35102408a527Saurel32 ppcemb) 35116acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3512e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3513c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35141ad2134fSPaul Brook target_phys_bits=64 3515d6630708SNathan Froyd target_nptl="yes" 3516de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35172408a527Saurel32 ;; 35182408a527Saurel32 ppc64) 35196acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3520e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3521c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35221ad2134fSPaul Brook target_phys_bits=64 3523c2e3dee6SLaurent Vivier target_long_alignment=8 3524de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35252408a527Saurel32 ;; 35262408a527Saurel32 ppc64abi32) 3527b498c8a0SJuan Quintela TARGET_ARCH=ppc64 35286acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3529e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 353025be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3531c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35321ad2134fSPaul Brook target_phys_bits=64 3533de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35342408a527Saurel32 ;; 35352408a527Saurel32 sh4|sh4eb) 3536b498c8a0SJuan Quintela TARGET_ARCH=sh4 35374dbed897Spbrook bflt="yes" 35380b6d3ae0Saurel32 target_nptl="yes" 35391ad2134fSPaul Brook target_phys_bits=32 35402408a527Saurel32 ;; 35412408a527Saurel32 sparc) 35421ad2134fSPaul Brook target_phys_bits=64 35432408a527Saurel32 ;; 35442408a527Saurel32 sparc64) 35456acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 35461ad2134fSPaul Brook target_phys_bits=64 3547c2e3dee6SLaurent Vivier target_long_alignment=8 35482408a527Saurel32 ;; 35492408a527Saurel32 sparc32plus) 3550b498c8a0SJuan Quintela TARGET_ARCH=sparc64 35516acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3552e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 355325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 35541ad2134fSPaul Brook target_phys_bits=64 35552408a527Saurel32 ;; 355624e804ecSAlexander Graf s390x) 3557bc434676SUlrich Hecht target_nptl="yes" 355824e804ecSAlexander Graf target_phys_bits=64 35597b3da903SAlexander Graf target_long_alignment=8 356024e804ecSAlexander Graf ;; 3561d2fbca94SGuan Xuetao unicore32) 3562d2fbca94SGuan Xuetao target_phys_bits=32 3563d2fbca94SGuan Xuetao ;; 3564cfa550c6SMax Filippov xtensa|xtensaeb) 3565cfa550c6SMax Filippov TARGET_ARCH=xtensa 3566cfa550c6SMax Filippov target_phys_bits=32 3567cfa550c6SMax Filippov ;; 35682408a527Saurel32 *) 3569de83cd02Sbellard echo "Unsupported target CPU" 3570de83cd02Sbellard exit 1 35712408a527Saurel32 ;; 35722408a527Saurel32esac 3573c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3574c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3575c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3576c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 357725be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3578053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 357925be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 358025be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 358142bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 35826acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 35836acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 35846acff7daSJuan Quintelafi 358525be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3586e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3587e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3588e6e91b9cSJuan Quintelafi 358925be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 35901b0c87fcSJuan Quintelacase "$target_arch2" in 35911b0c87fcSJuan Quintela i386|x86_64) 35921b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 359364b3cfdbSAnthony PERARD target_phys_bits=64 359425be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 359559d21e53SAlexander Graf else 359659d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 3597432d268cSJun Nakajima fi 359859d21e53SAlexander Graf ;; 359959d21e53SAlexander Graf *) 360059d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 36011b0c87fcSJuan Quintelaesac 3602c59249f9SJuan Quintelacase "$target_arch2" in 36030e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3604c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3605c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3606c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3607c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 36085f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3609adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3610adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3611c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3612c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 361325be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 36141ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 3615d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3616d5970055SMichael S. Tsirkin fi 3617c59249f9SJuan Quintela fi 3618c59249f9SJuan Quintelaesac 36197f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then 36200a6b8ddeSAlexander Graf echo "CONFIG_PSERIES=y" >> $config_target_mak 36210a6b8ddeSAlexander Graffi 3622de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 362325be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 362497a847bcSbellardfi 362597a847bcSbellardif test "$target_softmmu" = "yes" ; then 3626b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 362725be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 3628de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 36290e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 36305791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3631de83cd02Sbellardfi 3632997344f3Sbellardif test "$target_user_only" = "yes" ; then 363325be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3634a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 3635997344f3Sbellardfi 3636831b7825Sthsif test "$target_linux_user" = "yes" ; then 363725be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3638831b7825Sthsfi 3639831b7825Sthsif test "$target_darwin_user" = "yes" ; then 364025be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3641831b7825Sthsfi 3642111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3643111a38b0SRobert Relyea echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3644111a38b0SRobert Relyea echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3645111a38b0SRobert Relyea echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3646111a38b0SRobert Relyeafi 364756aebc89Spbrooklist="" 364856aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 364956aebc89Spbrook for x in $gdb_xml_files; do 365056aebc89Spbrook list="$list $source_path/gdb-xml/$x" 365156aebc89Spbrook done 365225be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 36533d0f1517SJuan Quintelafi 3654de83cd02Sbellard 3655e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 365625be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3657e5fe0c52Spbrookfi 3658bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3659bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 366025be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3661bd0c5661Spbrookfi 3662379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 366325be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3664379f6698SPaul Brookfi 366584778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 366625be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 366784778508Sblueswir1fi 36685b0753e0Sbellard 36694afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3670fa282484SJuan Quintela 36714afddb55SJuan Quintelacflags="" 3672f9728943SPaolo Bonziniincludes="" 3673fa282484SJuan Quintelaldflags="" 36749b8e111fSJuan Quintela 36759195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then 36769195b2c2SStefan Weil includes="-I\$(SRC_PATH)/tcg/tci $includes" 36779195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then 3678f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 367924e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3680f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 36815d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3682f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 368357ddfbf7SJuan Quintelaelse 3684f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 368557ddfbf7SJuan Quintelafi 3686f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 368757ddfbf7SJuan Quintela 36886efd7517SPeter Maydellif test "$linux" = "yes" ; then 36896efd7517SPeter Maydell includes="-I\$(SRC_PATH)/linux-headers $includes" 36906efd7517SPeter Maydellfi 36916efd7517SPeter Maydell 36924d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 36934d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 36944d904533SBlue Swirlelse 36954d904533SBlue Swirl libdis_config_mak=libdis/config.mak 36964d904533SBlue Swirlfi 36974d904533SBlue Swirl 369864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 369964656024SJuan Quintela case "$i" in 370064656024SJuan Quintela alpha) 370125be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 37024d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 370364656024SJuan Quintela ;; 370464656024SJuan Quintela arm) 370525be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 37064d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 370764656024SJuan Quintela ;; 370864656024SJuan Quintela cris) 370925be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 37104d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 371164656024SJuan Quintela ;; 371264656024SJuan Quintela hppa) 371325be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 37144d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 371564656024SJuan Quintela ;; 371664656024SJuan Quintela i386|x86_64) 371725be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 37184d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 371964656024SJuan Quintela ;; 3720903ec55cSAurelien Jarno ia64*) 3721903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3722903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3723903ec55cSAurelien Jarno ;; 372464656024SJuan Quintela m68k) 372525be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 37264d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 372764656024SJuan Quintela ;; 3728877fdc12SEdgar E. Iglesias microblaze*) 372925be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 37304d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 373164656024SJuan Quintela ;; 373264656024SJuan Quintela mips*) 373325be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 37344d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 373564656024SJuan Quintela ;; 373664656024SJuan Quintela ppc*) 373725be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 37384d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 373964656024SJuan Quintela ;; 374024e804ecSAlexander Graf s390*) 374125be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 37424d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 374364656024SJuan Quintela ;; 374464656024SJuan Quintela sh4) 374525be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 37464d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 374764656024SJuan Quintela ;; 374864656024SJuan Quintela sparc*) 374925be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 37504d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 375164656024SJuan Quintela ;; 3752cfa550c6SMax Filippov xtensa*) 3753cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 3754cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak 3755cfa550c6SMax Filippov ;; 375664656024SJuan Quintela esac 375764656024SJuan Quinteladone 37589195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 37599195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 37609195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak 37619195b2c2SStefan Weilfi 376264656024SJuan Quintela 37636ee7126fSJuan Quintelacase "$ARCH" in 37646ee7126fSJuan Quintelaalpha) 37656ee7126fSJuan Quintela # Ensure there's only a single GP 37666ee7126fSJuan Quintela cflags="-msmall-data $cflags" 37676ee7126fSJuan Quintela;; 37686ee7126fSJuan Quintelaesac 37696ee7126fSJuan Quintela 377055d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 377155d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 377255d9c04bSJuan Quintela arm) 377355d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 377455d9c04bSJuan Quintela ;; 377525a8bb96SMichael Walle lm32) 377625a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 377725a8bb96SMichael Walle ;; 377855d9c04bSJuan Quintela i386|mips|ppc) 377955d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 378055d9c04bSJuan Quintela ;; 378155d9c04bSJuan Quintela esac 378255d9c04bSJuan Quintelafi 378355d9c04bSJuan Quintela 3784471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3785471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3786471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 378725be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3788471857ddSJuan Quintelafi 3789471857ddSJuan Quintela 3790d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 379125be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3792d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3793d02c1db3SJuan Quintela cflags="-p $cflags" 3794d02c1db3SJuan Quintela ldflags="-p $ldflags" 3795d02c1db3SJuan Quintela fi 3796d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3797d02c1db3SJuan Quintela ldflags="-p $ldflags" 379825be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3799d02c1db3SJuan Quintela fi 3800d02c1db3SJuan Quintelafi 3801d02c1db3SJuan Quintela 38029195b2c2SStefan Weilif test "$ARCH" = "tci"; then 38039195b2c2SStefan Weil linker_script="" 38049195b2c2SStefan Weilelse 38056ee7126fSJuan Quintela linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 38069195b2c2SStefan Weilfi 38079195b2c2SStefan Weil 38089b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3809fa282484SJuan Quintela case "$ARCH" in 3810fa282484SJuan Quintela sparc) 3811fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3812322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3813fa282484SJuan Quintela ;; 38144d58be06SRichard Henderson alpha | s390x) 38154d58be06SRichard Henderson # The default placement of the application is fine. 38164d58be06SRichard Henderson ;; 3817fd76e73aSRichard Henderson *) 3818322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3819fa282484SJuan Quintela ;; 3820fa282484SJuan Quintela esac 3821fa282484SJuan Quintelafi 3822fa282484SJuan Quintela 382325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 382425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3825f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3826fa282484SJuan Quintela 382797a847bcSbellarddone # for target in $targets 38287d13299dSbellard 3829d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3830c09015ddSAnthony LiguoriDIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom" 3831446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas" 38322d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 38333e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 3834e098fc3fSMichael RothDIRS="$DIRS qapi qapi-generated" 38352f28d2ffSAnthony LiguoriDIRS="$DIRS qga trace qom" 3836c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 3837c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 3838ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 3839446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 38402d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 3841753d11f2SRichard Hendersonfor bios_file in \ 3842753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 3843753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 3844753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 3845753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 3846753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 3847753d11f2SRichard Hendersondo 38487ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 38497ea78b74SJan Kiszkadone 3850d1807a4fSPaolo Bonzinimkdir -p $DIRS 38517d13299dSbellardfor f in $FILES ; do 3852f9245e10SPeter Maydell if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then 3853f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 3854f9245e10SPeter Maydell fi 38557d13299dSbellarddone 38561ad2134fSPaul Brook 3857c34ebfdcSAnthony Liguori# temporary config to build submodules 38582d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3859c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 386037116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3861c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3862c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3863c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3864c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3865c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3866c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3867c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3868c34ebfdcSAnthony Liguoridone 3869c34ebfdcSAnthony Liguori 38701ad2134fSPaul Brookfor hwlib in 32 64; do 38711ad2134fSPaul Brook d=libhw$hwlib 38721ad2134fSPaul Brook mkdir -p $d 38739953b2fcSBlue Swirl mkdir -p $d/ide 387411568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 3875353ac78dSAneesh Kumar K.V mkdir -p $d/9pfs 387637116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 38771ad2134fSPaul Brookdone 3878add16157SBlue Swirl 3879111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then 3880111a38b0SRobert Relyea # out of tree build 3881111a38b0SRobert Relyea mkdir -p libcacard 3882111a38b0SRobert Relyea rm -f libcacard/Makefile 388344dc0ca3SAlon Levy symlink "$source_path/libcacard/Makefile" libcacard/Makefile 3884111a38b0SRobert Relyeafi 3885111a38b0SRobert Relyea 3886add16157SBlue Swirld=libuser 3887add16157SBlue Swirlmkdir -p $d 3888937b1258SLluís Vilanovamkdir -p $d/trace 388911568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3890b40292e7SJan Kiszka 3891b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3892b40292e7SJan Kiszka mkdir -p QMP 3893b40292e7SJan Kiszkafi 3894