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="" 136377529c0SPaolo Bonziniattr="" 1374f26f2b6SAvi Kivitylibattr="" 138377529c0SPaolo Bonzinixfs="" 139377529c0SPaolo Bonzini 140d41a75a2SBradvhost_net="no" 141d41a75a2SBradkvm="no" 142377529c0SPaolo Bonzinigprof="no" 143377529c0SPaolo Bonzinidebug_tcg="no" 144377529c0SPaolo Bonzinidebug_mon="no" 145377529c0SPaolo Bonzinidebug="no" 146377529c0SPaolo Bonzinistrip_opt="yes" 1479195b2c2SStefan Weiltcg_interpreter="no" 148377529c0SPaolo Bonzinibigendian="no" 149377529c0SPaolo Bonzinimingw32="no" 150377529c0SPaolo BonziniEXESUF="" 151377529c0SPaolo Bonziniprefix="/usr/local" 152377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 153377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu" 154377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 155377529c0SPaolo Bonzinibindir="\${prefix}/bin" 1563aa5d2beSAlon Levylibdir="\${prefix}/lib" 1570f94d6daSAlon Levyincludedir="\${prefix}/include" 158377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 159377529c0SPaolo Bonziniconfsuffix="/qemu" 160377529c0SPaolo Bonzinislirp="yes" 161377529c0SPaolo Bonzinifmod_lib="" 162377529c0SPaolo Bonzinifmod_inc="" 163377529c0SPaolo Bonzinioss_lib="" 164377529c0SPaolo Bonzinibsd="no" 165377529c0SPaolo Bonzinilinux="no" 166377529c0SPaolo Bonzinisolaris="no" 167377529c0SPaolo Bonziniprofiler="no" 168377529c0SPaolo Bonzinicocoa="no" 169377529c0SPaolo Bonzinisoftmmu="yes" 170377529c0SPaolo Bonzinilinux_user="no" 171377529c0SPaolo Bonzinidarwin_user="no" 172377529c0SPaolo Bonzinibsd_user="no" 173377529c0SPaolo Bonziniguest_base="" 174377529c0SPaolo Bonziniuname_release="" 175377529c0SPaolo Bonzinimixemu="no" 176377529c0SPaolo Bonziniaix="no" 177377529c0SPaolo Bonziniblobs="yes" 178377529c0SPaolo Bonzinipkgversion="" 17940d6444eSAvi Kivitypie="" 180377529c0SPaolo Bonzinizero_malloc="" 181377529c0SPaolo Bonzinitrace_backend="nop" 182377529c0SPaolo Bonzinitrace_file="trace" 183377529c0SPaolo Bonzinispice="" 184377529c0SPaolo Bonzinirbd="" 18536707144SAlon Levysmartcard="" 186111a38b0SRobert Relyeasmartcard_nss="" 18769354a83SHans de Goedeusb_redir="" 188430a3c18SMichael Walleopengl="" 1891ece9905SAlon Levyzlib="yes" 190d138cee9SMichael Rothguest_agent="yes" 191c589b249SRonnie Sahlberglibiscsi="" 192377529c0SPaolo Bonzini 193ac0df51dSaliguori# parse CC options first 194ac0df51dSaliguorifor opt do 195ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 196ac0df51dSaliguori case "$opt" in 197ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 198ac0df51dSaliguori ;; 1993d8df640SPaolo Bonzini --cc=*) CC="$optarg" 200ac0df51dSaliguori ;; 201ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 202ca4deeb1SPaolo Bonzini ;; 2032ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 2042ff6b91eSJuan Quintela ;; 205a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 206e2a2ed06SJuan Quintela ;; 207e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 208e2a2ed06SJuan Quintela ;; 20950e7b1a0SJuan Quintela --sparc_cpu=*) 21050e7b1a0SJuan Quintela sparc_cpu="$optarg" 21150e7b1a0SJuan Quintela case $sparc_cpu in 212ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 21350e7b1a0SJuan Quintela cpu="sparc" 21450e7b1a0SJuan Quintela ;; 21550e7b1a0SJuan Quintela v9) 21650e7b1a0SJuan Quintela cpu="sparc64" 21750e7b1a0SJuan Quintela ;; 21850e7b1a0SJuan Quintela *) 21950e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 22050e7b1a0SJuan Quintela exit 1 22150e7b1a0SJuan Quintela ;; 22250e7b1a0SJuan Quintela esac 22350e7b1a0SJuan Quintela ;; 224ac0df51dSaliguori esac 225ac0df51dSaliguoridone 226ac0df51dSaliguori# OS specific 227ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 228ac0df51dSaliguori# we can eliminate it's usage altogether 229ac0df51dSaliguori 230b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}" 231b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 232b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 233b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 2343f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}" 235b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 236b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 237b3198cc2SStuart Yoderpkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}" 238b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 239ac0df51dSaliguori 240be17dc90SMichael S. Tsirkin# default flags for all hosts 241be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 242be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 243f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 244be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 245be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 24684958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 247cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu" 248be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 249be17dc90SMichael S. Tsirkin 250ca4deeb1SPaolo Bonzini# make source path absolute 251ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 252ca4deeb1SPaolo Bonzini 253ac0df51dSaliguoricheck_define() { 254ac0df51dSaliguoricat > $TMPC <<EOF 255ac0df51dSaliguori#if !defined($1) 256fd786e1aSPeter Maydell#error $1 not defined 257ac0df51dSaliguori#endif 258ac0df51dSaliguoriint main(void) { return 0; } 259ac0df51dSaliguoriEOF 26052166aa0SJuan Quintela compile_object 261ac0df51dSaliguori} 262ac0df51dSaliguori 2632ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 2642ff6b91eSJuan Quintela # command line argument 2652ff6b91eSJuan Quintela : 2662ff6b91eSJuan Quintelaelif check_define __i386__ ; then 267ac0df51dSaliguori cpu="i386" 268ac0df51dSaliguorielif check_define __x86_64__ ; then 269ac0df51dSaliguori cpu="x86_64" 2703aa9bd6cSblueswir1elif check_define __sparc__ ; then 2713aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 2723aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 2733aa9bd6cSblueswir1 if check_define __arch64__ ; then 2743aa9bd6cSblueswir1 cpu="sparc64" 2753aa9bd6cSblueswir1 else 2763aa9bd6cSblueswir1 cpu="sparc" 2773aa9bd6cSblueswir1 fi 278fdf7ed96Smalcelif check_define _ARCH_PPC ; then 279fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 280fdf7ed96Smalc cpu="ppc64" 281ac0df51dSaliguori else 282fdf7ed96Smalc cpu="ppc" 283fdf7ed96Smalc fi 284afa05235SAurelien Jarnoelif check_define __mips__ ; then 285afa05235SAurelien Jarno cpu="mips" 286477ba620SAurelien Jarnoelif check_define __ia64__ ; then 287477ba620SAurelien Jarno cpu="ia64" 288d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 289d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 290d66ed0eaSAurelien Jarno cpu="s390x" 291d66ed0eaSAurelien Jarno else 292d66ed0eaSAurelien Jarno cpu="s390" 293d66ed0eaSAurelien Jarno fi 29421d89f84SPeter Maydellelif check_define __arm__ ; then 29521d89f84SPeter Maydell cpu="arm" 296f28ffed5SBradelif check_define __hppa__ ; then 297f28ffed5SBrad cpu="hppa" 298fdf7ed96Smalcelse 299fdf7ed96Smalc cpu=`uname -m` 300ac0df51dSaliguorifi 301ac0df51dSaliguori 302359bc95dSPeter MaydellARCH= 303359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 304359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 3057d13299dSbellardcase "$cpu" in 306359bc95dSPeter Maydell ia64|ppc|ppc64|s390|s390x|sparc64) 307ea8f20f8SJuan Quintela cpu="$cpu" 308ea8f20f8SJuan Quintela ;; 3097d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 31097a847bcSbellard cpu="i386" 3117d13299dSbellard ;; 312aaa5fa14Saurel32 x86_64|amd64) 313aaa5fa14Saurel32 cpu="x86_64" 314aaa5fa14Saurel32 ;; 31521d89f84SPeter Maydell armv*b|armv*l|arm) 31621d89f84SPeter Maydell cpu="arm" 3177d13299dSbellard ;; 318f28ffed5SBrad hppa|parisc|parisc64) 319f54b3f92Saurel32 cpu="hppa" 320f54b3f92Saurel32 ;; 321afa05235SAurelien Jarno mips*) 322afa05235SAurelien Jarno cpu="mips" 323afa05235SAurelien Jarno ;; 3243142255cSblueswir1 sparc|sun4[cdmuv]) 325ae228531Sbellard cpu="sparc" 326ae228531Sbellard ;; 3277d13299dSbellard *) 328359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 329359bc95dSPeter Maydell ARCH=unknown 3307d13299dSbellard ;; 3317d13299dSbellardesac 332359bc95dSPeter Maydellif test -z "$ARCH"; then 333359bc95dSPeter Maydell ARCH="$cpu" 334359bc95dSPeter Maydellfi 335e2d52ad3SJuan Quintela 3367d13299dSbellard# OS specific 337ac0df51dSaliguoriif check_define __linux__ ; then 338ac0df51dSaliguori targetos="Linux" 339ac0df51dSaliguorielif check_define _WIN32 ; then 340ac0df51dSaliguori targetos='MINGW32' 341169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 342169dc5d3Sblueswir1 targetos='OpenBSD' 343169dc5d3Sblueswir1elif check_define __sun__ ; then 344169dc5d3Sblueswir1 targetos='SunOS' 345179cf400SAndreas Färberelif check_define __HAIKU__ ; then 346179cf400SAndreas Färber targetos='Haiku' 347ac0df51dSaliguorielse 3487d13299dSbellard targetos=`uname -s` 349ac0df51dSaliguorifi 3500dbfc675SJuan Quintela 3517d13299dSbellardcase $targetos in 352c326e0afSbellardCYGWIN*) 353c326e0afSbellard mingw32="yes" 354a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 355d5631638Smalc audio_possible_drivers="winwave sdl" 356d5631638Smalc audio_drv_list="winwave" 357c326e0afSbellard;; 35867b915a5SbellardMINGW32*) 35967b915a5Sbellard mingw32="yes" 360d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 361d5631638Smalc audio_drv_list="winwave" 36267b915a5Sbellard;; 3635c40d2bdSthsGNU/kFreeBSD) 364a167ba50SAurelien Jarno bsd="yes" 3650c58ac1cSmalc audio_drv_list="oss" 366f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3675c40d2bdSths;; 3687d3505c5SbellardFreeBSD) 3697d3505c5Sbellard bsd="yes" 3700db4a067SPaolo Bonzini make="${MAKE-gmake}" 3710c58ac1cSmalc audio_drv_list="oss" 372f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 373f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 374f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3757d3505c5Sbellard;; 376c5e97233Sblueswir1DragonFly) 377c5e97233Sblueswir1 bsd="yes" 3780db4a067SPaolo Bonzini make="${MAKE-gmake}" 379c5e97233Sblueswir1 audio_drv_list="oss" 380c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 381c5e97233Sblueswir1;; 3827d3505c5SbellardNetBSD) 3837d3505c5Sbellard bsd="yes" 3840db4a067SPaolo Bonzini make="${MAKE-gmake}" 3850c58ac1cSmalc audio_drv_list="oss" 386c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3878ef92a88Sblueswir1 oss_lib="-lossaudio" 3887d3505c5Sbellard;; 3897d3505c5SbellardOpenBSD) 3907d3505c5Sbellard bsd="yes" 3910db4a067SPaolo Bonzini make="${MAKE-gmake}" 3920c58ac1cSmalc audio_drv_list="oss" 393c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3942f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3957d3505c5Sbellard;; 39683fb7adfSbellardDarwin) 39783fb7adfSbellard bsd="yes" 39883fb7adfSbellard darwin="yes" 3990dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 4000dbfc675SJuan Quintela # run 64-bit userspace code 401aab8588aSmalc if [ "$cpu" = "i386" ] ; then 4021b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 403aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 4041b0f9cc2Saliguori fi 4051b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 406a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4070c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4081b0f9cc2Saliguori else 409a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4101b0f9cc2Saliguori fi 411831b7825Sths darwin_user="yes" 412fd677642Sths cocoa="yes" 4130c58ac1cSmalc audio_drv_list="coreaudio" 414c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4150c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4167973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 41783fb7adfSbellard;; 418ec530c81SbellardSunOS) 419ec530c81Sbellard solaris="yes" 4200db4a067SPaolo Bonzini make="${MAKE-gmake}" 4210db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 422fa58948dSBlue Swirl ld="gld" 423e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 4240475a5caSths needs_libsunmath="no" 425c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 426ef18c883Sths # have to select again, because `uname -m` returns i86pc 427ef18c883Sths # even on an x86_64 box. 428ef18c883Sths solariscpu=`isainfo -k` 429ef18c883Sths if test "${solariscpu}" = "amd64" ; then 430ef18c883Sths cpu="x86_64" 431ef18c883Sths fi 432c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4330475a5caSths if test "$solarisrev" -le 9 ; then 4340475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4350475a5caSths needs_libsunmath="yes" 436f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 437f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 438f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4390475a5caSths else 4400475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4410475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4420475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4430475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4440475a5caSths exit 1 4450475a5caSths fi 4460475a5caSths fi 44786b2bd93Sths fi 4486b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4490c58ac1cSmalc audio_drv_list="oss" 4506b4d2ba1Sths fi 451c2de5c91Smalc audio_possible_drivers="oss sdl" 452d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 453d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 454d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 455d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 456a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 457e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 458ec530c81Sbellard;; 459b29fe3edSmalcAIX) 460b29fe3edSmalc aix="yes" 4610db4a067SPaolo Bonzini make="${MAKE-gmake}" 462b29fe3edSmalc;; 463179cf400SAndreas FärberHaiku) 464179cf400SAndreas Färber haiku="yes" 465179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 466179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 467179cf400SAndreas Färber;; 468fb065187Sbellard*) 4690c58ac1cSmalc audio_drv_list="oss" 470b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4715327cf48Sbellard linux="yes" 472831b7825Sths linux_user="yes" 47368063649Sblueswir1 usb="linux" 474af2be207SJan Kiszka kvm="yes" 475af2be207SJan Kiszka vhost_net="yes" 47607f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 477c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 478c9ec1fe4Sbellard fi 479fb065187Sbellard;; 4807d13299dSbellardesac 4817d13299dSbellard 4827d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 483b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 48468063649Sblueswir1 usb="bsd" 48583fb7adfSbellard fi 48684778508Sblueswir1 bsd_user="yes" 4877d3505c5Sbellardfi 4887d3505c5Sbellard 4890db4a067SPaolo Bonzini: ${make=${MAKE-make}} 4900db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 491c886edfbSBlue Swirl: ${python=${PYTHON-python}} 492e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 4930db4a067SPaolo Bonzini 4943457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4953457a3f8SJuan Quintela EXESUF=".exe" 496a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 497e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 498e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 49908f3896aSStefan Weil LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS" 500683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 501683035deSPaolo Bonzini mandir="\${prefix}" 502683035deSPaolo Bonzini datadir="\${prefix}" 503683035deSPaolo Bonzini docdir="\${prefix}" 504683035deSPaolo Bonzini bindir="\${prefix}" 505683035deSPaolo Bonzini sysconfdir="\${prefix}" 506683035deSPaolo Bonzini confsuffix="" 50783b2f0a0SStefan Weil guest_agent="no" 5083457a3f8SJuan Quintelafi 5093457a3f8SJuan Quintela 510487fefdbSAnthony Liguoriwerror="" 51185aa5189Sbellard 5127d13299dSbellardfor opt do 513a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 5147d13299dSbellard case "$opt" in 5152efc3265Sbellard --help|-h) show_help=yes 5162efc3265Sbellard ;; 51799123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 51899123e13SMike Frysinger ;; 519b1a550a0Spbrook --prefix=*) prefix="$optarg" 5207d13299dSbellard ;; 521b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 52232ce6337Sbellard ;; 523ca4deeb1SPaolo Bonzini --source-path=*) 5247d13299dSbellard ;; 525ac0df51dSaliguori --cross-prefix=*) 5267d13299dSbellard ;; 527ac0df51dSaliguori --cc=*) 5287d13299dSbellard ;; 529b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 53083469015Sbellard ;; 531b1a550a0Spbrook --make=*) make="$optarg" 5327d13299dSbellard ;; 5336a882643Spbrook --install=*) install="$optarg" 5346a882643Spbrook ;; 535c886edfbSBlue Swirl --python=*) python="$optarg" 536c886edfbSBlue Swirl ;; 537e2d8830eSBrad --smbd=*) smbd="$optarg" 538e2d8830eSBrad ;; 539e2a2ed06SJuan Quintela --extra-cflags=*) 5407d13299dSbellard ;; 541e2a2ed06SJuan Quintela --extra-ldflags=*) 5427d13299dSbellard ;; 5432ff6b91eSJuan Quintela --cpu=*) 5447d13299dSbellard ;; 545b1a550a0Spbrook --target-list=*) target_list="$optarg" 546de83cd02Sbellard ;; 54774242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 54894a420b1SStefan Hajnoczi ;; 54974242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5509410b56cSPrerna Saxena ;; 5517d13299dSbellard --enable-gprof) gprof="yes" 5527d13299dSbellard ;; 55379427693SLoïc Minier --static) 55479427693SLoïc Minier static="yes" 55579427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 55643ce4dfeSbellard ;; 5570b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5580b24e75fSPaolo Bonzini ;; 5590b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5600b24e75fSPaolo Bonzini ;; 5613aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 5623aa5d2beSAlon Levy ;; 5630f94d6daSAlon Levy --includedir=*) includedir="$optarg" 5640f94d6daSAlon Levy ;; 5650b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5660b24e75fSPaolo Bonzini ;; 5670b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5680b24e75fSPaolo Bonzini ;; 569ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 57007381cc1SAnthony Liguori ;; 571023ddd74SMax Filippov --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\ 572023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 573023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 574023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 575023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 576023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 577023ddd74SMax Filippov # lots of directory switches by default. 578023ddd74SMax Filippov ;; 57997a847bcSbellard --disable-sdl) sdl="no" 58097a847bcSbellard ;; 581c4198157SJuan Quintela --enable-sdl) sdl="yes" 582c4198157SJuan Quintela ;; 583821601eaSJes Sorensen --disable-vnc) vnc="no" 584821601eaSJes Sorensen ;; 585821601eaSJes Sorensen --enable-vnc) vnc="yes" 586821601eaSJes Sorensen ;; 587b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 588102a52e4Sbellard ;; 589c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 590c2de5c91Smalc ;; 5912f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5922f6a1ab0Sblueswir1 ;; 5932fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5940c58ac1cSmalc ;; 5950c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5960c58ac1cSmalc ;; 597eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 598eb852011SMarkus Armbruster ;; 599f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 600f8393946Saurel32 ;; 601f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 602f8393946Saurel32 ;; 603b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 604b4475aa2SLuiz Capitulino ;; 605b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 606b4475aa2SLuiz Capitulino ;; 607f3d08ee6SPaul Brook --enable-debug) 608f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 609f3d08ee6SPaul Brook debug_tcg="yes" 610b4475aa2SLuiz Capitulino debug_mon="yes" 611f3d08ee6SPaul Brook debug="yes" 612f3d08ee6SPaul Brook strip_opt="no" 613f3d08ee6SPaul Brook ;; 61403b4fe7dSaliguori --enable-sparse) sparse="yes" 61503b4fe7dSaliguori ;; 61603b4fe7dSaliguori --disable-sparse) sparse="no" 61703b4fe7dSaliguori ;; 6181625af87Saliguori --disable-strip) strip_opt="no" 6191625af87Saliguori ;; 6208d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 6218d5d2d4cSths ;; 6221be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 6231be10ad2SJuan Quintela ;; 6242f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 6252f9606b3Saliguori ;; 626ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 627ea784e3bSJuan Quintela ;; 6282f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 6292f6f5c7aSCorentin Chary ;; 6302f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 6312f6f5c7aSCorentin Chary ;; 632efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 633efe556adSCorentin Chary ;; 634efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 635efe556adSCorentin Chary ;; 636bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 637bd023f95SCorentin Chary ;; 638bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 639bd023f95SCorentin Chary ;; 640443f1376Sbellard --disable-slirp) slirp="no" 641c20709aaSbellard ;; 642ee682d27SStefan Weil --disable-uuid) uuid="no" 643ee682d27SStefan Weil ;; 644ee682d27SStefan Weil --enable-uuid) uuid="yes" 645ee682d27SStefan Weil ;; 646e0e6c8c0Saliguori --disable-vde) vde="no" 6478a16d273Sths ;; 648dfb278bdSJuan Quintela --enable-vde) vde="yes" 649dfb278bdSJuan Quintela ;; 650e37630caSaliguori --disable-xen) xen="no" 651e37630caSaliguori ;; 652fc321b4bSJuan Quintela --enable-xen) xen="yes" 653fc321b4bSJuan Quintela ;; 6542e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6552e4d9fb1Saurel32 ;; 6564ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6574ffcedb6SJuan Quintela ;; 658fb599c9aSbalrog --disable-bluez) bluez="no" 659fb599c9aSbalrog ;; 660a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 661a20a6f46SJuan Quintela ;; 6627ba1e619Saliguori --disable-kvm) kvm="no" 6637ba1e619Saliguori ;; 664b31a0277SJuan Quintela --enable-kvm) kvm="yes" 665b31a0277SJuan Quintela ;; 6669195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 6679195b2c2SStefan Weil ;; 6689195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 6699195b2c2SStefan Weil ;; 670cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 671cd4ec0b4SGerd Hoffmann ;; 672cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 673cd4ec0b4SGerd Hoffmann ;; 674c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 675c589b249SRonnie Sahlberg ;; 676c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 677c589b249SRonnie Sahlberg ;; 67805c2a3e7Sbellard --enable-profiler) profiler="yes" 67905c2a3e7Sbellard ;; 680c2de5c91Smalc --enable-cocoa) 681c2de5c91Smalc cocoa="yes" ; 682c2de5c91Smalc sdl="no" ; 683c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6845b0753e0Sbellard ;; 685cad25d69Spbrook --disable-system) softmmu="no" 6860a8e90f4Spbrook ;; 687cad25d69Spbrook --enable-system) softmmu="yes" 6880a8e90f4Spbrook ;; 6890953a80fSZachary Amsden --disable-user) 6900953a80fSZachary Amsden linux_user="no" ; 6910953a80fSZachary Amsden bsd_user="no" ; 6920953a80fSZachary Amsden darwin_user="no" 6930953a80fSZachary Amsden ;; 6940953a80fSZachary Amsden --enable-user) ;; 695831b7825Sths --disable-linux-user) linux_user="no" 6960a8e90f4Spbrook ;; 697831b7825Sths --enable-linux-user) linux_user="yes" 698831b7825Sths ;; 699831b7825Sths --disable-darwin-user) darwin_user="no" 700831b7825Sths ;; 701831b7825Sths --enable-darwin-user) darwin_user="yes" 7020a8e90f4Spbrook ;; 70384778508Sblueswir1 --disable-bsd-user) bsd_user="no" 70484778508Sblueswir1 ;; 70584778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 70684778508Sblueswir1 ;; 707379f6698SPaul Brook --enable-guest-base) guest_base="yes" 708379f6698SPaul Brook ;; 709379f6698SPaul Brook --disable-guest-base) guest_base="no" 710379f6698SPaul Brook ;; 71140d6444eSAvi Kivity --enable-pie) pie="yes" 71234005a00SKirill A. Shutemov ;; 71340d6444eSAvi Kivity --disable-pie) pie="no" 71434005a00SKirill A. Shutemov ;; 715c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 716c5937220Spbrook ;; 7173142255cSblueswir1 --sparc_cpu=*) 7183142255cSblueswir1 ;; 71985aa5189Sbellard --enable-werror) werror="yes" 72085aa5189Sbellard ;; 72185aa5189Sbellard --disable-werror) werror="no" 72285aa5189Sbellard ;; 7234d3b6f6eSbalrog --disable-curses) curses="no" 7244d3b6f6eSbalrog ;; 725c584a6d0SJuan Quintela --enable-curses) curses="yes" 726c584a6d0SJuan Quintela ;; 727769ce76dSAlexander Graf --disable-curl) curl="no" 728769ce76dSAlexander Graf ;; 729788c8196SJuan Quintela --enable-curl) curl="yes" 730788c8196SJuan Quintela ;; 7312df87df7SJuan Quintela --disable-fdt) fdt="no" 7322df87df7SJuan Quintela ;; 7332df87df7SJuan Quintela --enable-fdt) fdt="yes" 7342df87df7SJuan Quintela ;; 735bd0c5661Spbrook --disable-nptl) nptl="no" 736bd0c5661Spbrook ;; 737b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 738b0a47e79SJuan Quintela ;; 7398ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7408ff9cbf7Smalc ;; 7415c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7425c6c3a6cSChristoph Hellwig ;; 7435c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7445c6c3a6cSChristoph Hellwig ;; 745758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 746758e8e38SVenkateswararao Jujjuri (JV) ;; 747758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 748758e8e38SVenkateswararao Jujjuri (JV) ;; 74977755340Sths --disable-blobs) blobs="no" 75077755340Sths ;; 7514a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7524a19f1ecSpbrook ;; 753a25dba17SJuan Quintela --disable-docs) docs="no" 75470ec5dc0SAnthony Liguori ;; 755a25dba17SJuan Quintela --enable-docs) docs="yes" 75683a3ab8bSJuan Quintela ;; 757d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 758d5970055SMichael S. Tsirkin ;; 759d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 760d5970055SMichael S. Tsirkin ;; 76120ff075bSMichael Walle --disable-opengl) opengl="no" 76220ff075bSMichael Walle ;; 76320ff075bSMichael Walle --enable-opengl) opengl="yes" 76420ff075bSMichael Walle ;; 765f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 766f27aaf4bSChristian Brunner ;; 767f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 768f27aaf4bSChristian Brunner ;; 769*8c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 770*8c84cf11SSergei Trofimovich ;; 771*8c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 772*8c84cf11SSergei Trofimovich ;; 77336707144SAlon Levy --disable-smartcard) smartcard="no" 77436707144SAlon Levy ;; 77536707144SAlon Levy --enable-smartcard) smartcard="yes" 77636707144SAlon Levy ;; 777111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 778111a38b0SRobert Relyea ;; 779111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 780111a38b0SRobert Relyea ;; 78169354a83SHans de Goede --disable-usb-redir) usb_redir="no" 78269354a83SHans de Goede ;; 78369354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 78469354a83SHans de Goede ;; 7851ece9905SAlon Levy --disable-zlib-test) zlib="no" 7861ece9905SAlon Levy ;; 787d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 788d138cee9SMichael Roth ;; 789d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 790d138cee9SMichael Roth ;; 7917f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7927f1559c6Sbalrog ;; 7937d13299dSbellard esac 7947d13299dSbellarddone 7957d13299dSbellard 7963142255cSblueswir1# 7973142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 798a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7993142255cSblueswir1# 800379f6698SPaul Brookhost_guest_base="no" 80140293e58Sbellardcase "$cpu" in 802ed968ff1SJuan Quintela sparc) case $sparc_cpu in 803ed968ff1SJuan Quintela v7|v8) 804a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 805ed968ff1SJuan Quintela ;; 806ed968ff1SJuan Quintela v8plus|v8plusa) 807a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 808ed968ff1SJuan Quintela ;; 809ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 810a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 811ed968ff1SJuan Quintela esac 8120c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 813a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 814762e8230Sblueswir1 if test "$solaris" = "no" ; then 815a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 816c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 817762e8230Sblueswir1 fi 8183142255cSblueswir1 ;; 819ed968ff1SJuan Quintela sparc64) 820a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 8210c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 822a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 823ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 824a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 825762e8230Sblueswir1 fi 8263142255cSblueswir1 ;; 82776d83bdeSths s390) 82828d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 82928d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 83048bb3750SRichard Henderson host_guest_base="yes" 83128d7cc49SRichard Henderson ;; 83228d7cc49SRichard Henderson s390x) 83328d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 83428d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 83548bb3750SRichard Henderson host_guest_base="yes" 83676d83bdeSths ;; 83740293e58Sbellard i386) 838a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 8390c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 8402b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 841c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 842379f6698SPaul Brook host_guest_base="yes" 84340293e58Sbellard ;; 84440293e58Sbellard x86_64) 845a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 8460c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8472b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 848379f6698SPaul Brook host_guest_base="yes" 849379f6698SPaul Brook ;; 850379f6698SPaul Brook arm*) 851379f6698SPaul Brook host_guest_base="yes" 85240293e58Sbellard ;; 853f6548c0aSmalc ppc*) 854f6548c0aSmalc host_guest_base="yes" 855f6548c0aSmalc ;; 856cc01cc8eSAurelien Jarno mips*) 857cc01cc8eSAurelien Jarno host_guest_base="yes" 858cc01cc8eSAurelien Jarno ;; 859477ba620SAurelien Jarno ia64*) 860477ba620SAurelien Jarno host_guest_base="yes" 861477ba620SAurelien Jarno ;; 862fd76e73aSRichard Henderson hppa*) 863fd76e73aSRichard Henderson host_guest_base="yes" 864fd76e73aSRichard Henderson ;; 865d2fbca94SGuan Xuetao unicore32*) 866d2fbca94SGuan Xuetao host_guest_base="yes" 867d2fbca94SGuan Xuetao ;; 8683142255cSblueswir1esac 8693142255cSblueswir1 870379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 871379f6698SPaul Brook 87260e0df25SPeter Maydell 87360e0df25SPeter Maydelldefault_target_list="" 87460e0df25SPeter Maydell 87560e0df25SPeter Maydell# these targets are portable 87660e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 87760e0df25SPeter Maydell default_target_list="\ 87860e0df25SPeter Maydelli386-softmmu \ 87960e0df25SPeter Maydellx86_64-softmmu \ 88027cdad67SRichard Hendersonalpha-softmmu \ 88160e0df25SPeter Maydellarm-softmmu \ 88260e0df25SPeter Maydellcris-softmmu \ 88360e0df25SPeter Maydelllm32-softmmu \ 88460e0df25SPeter Maydellm68k-softmmu \ 88560e0df25SPeter Maydellmicroblaze-softmmu \ 88660e0df25SPeter Maydellmicroblazeel-softmmu \ 88760e0df25SPeter Maydellmips-softmmu \ 88860e0df25SPeter Maydellmipsel-softmmu \ 88960e0df25SPeter Maydellmips64-softmmu \ 89060e0df25SPeter Maydellmips64el-softmmu \ 89160e0df25SPeter Maydellppc-softmmu \ 89260e0df25SPeter Maydellppcemb-softmmu \ 89360e0df25SPeter Maydellppc64-softmmu \ 89460e0df25SPeter Maydellsh4-softmmu \ 89560e0df25SPeter Maydellsh4eb-softmmu \ 89660e0df25SPeter Maydellsparc-softmmu \ 89760e0df25SPeter Maydellsparc64-softmmu \ 8980f3301d4SAlexander Grafs390x-softmmu \ 899cfa550c6SMax Filippovxtensa-softmmu \ 900cfa550c6SMax Filippovxtensaeb-softmmu \ 90160e0df25SPeter Maydell" 90260e0df25SPeter Maydellfi 90360e0df25SPeter Maydell# the following are Linux specific 90460e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 90560e0df25SPeter Maydell default_target_list="${default_target_list}\ 90660e0df25SPeter Maydelli386-linux-user \ 90760e0df25SPeter Maydellx86_64-linux-user \ 90860e0df25SPeter Maydellalpha-linux-user \ 90960e0df25SPeter Maydellarm-linux-user \ 91060e0df25SPeter Maydellarmeb-linux-user \ 91160e0df25SPeter Maydellcris-linux-user \ 91260e0df25SPeter Maydellm68k-linux-user \ 91360e0df25SPeter Maydellmicroblaze-linux-user \ 91460e0df25SPeter Maydellmicroblazeel-linux-user \ 91560e0df25SPeter Maydellmips-linux-user \ 91660e0df25SPeter Maydellmipsel-linux-user \ 91760e0df25SPeter Maydellppc-linux-user \ 91860e0df25SPeter Maydellppc64-linux-user \ 91960e0df25SPeter Maydellppc64abi32-linux-user \ 92060e0df25SPeter Maydellsh4-linux-user \ 92160e0df25SPeter Maydellsh4eb-linux-user \ 92260e0df25SPeter Maydellsparc-linux-user \ 92360e0df25SPeter Maydellsparc64-linux-user \ 92460e0df25SPeter Maydellsparc32plus-linux-user \ 92560e0df25SPeter Maydellunicore32-linux-user \ 9260f3301d4SAlexander Grafs390x-linux-user \ 92760e0df25SPeter Maydell" 92860e0df25SPeter Maydellfi 92960e0df25SPeter Maydell# the following are Darwin specific 93060e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then 93160e0df25SPeter Maydell default_target_list="$default_target_list i386-darwin-user ppc-darwin-user " 93260e0df25SPeter Maydellfi 93360e0df25SPeter Maydell# the following are BSD specific 93460e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 93560e0df25SPeter Maydell default_target_list="${default_target_list}\ 93660e0df25SPeter Maydelli386-bsd-user \ 93760e0df25SPeter Maydellx86_64-bsd-user \ 93860e0df25SPeter Maydellsparc-bsd-user \ 93960e0df25SPeter Maydellsparc64-bsd-user \ 94060e0df25SPeter Maydell" 94160e0df25SPeter Maydellfi 94260e0df25SPeter Maydell 943af5db58eSpbrookif test x"$show_help" = x"yes" ; then 944af5db58eSpbrookcat << EOF 945af5db58eSpbrook 946af5db58eSpbrookUsage: configure [options] 947af5db58eSpbrookOptions: [defaults in brackets after descriptions] 948af5db58eSpbrook 949af5db58eSpbrookEOF 950af5db58eSpbrookecho "Standard options:" 951af5db58eSpbrookecho " --help print this message" 952af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 953af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 954af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 95560e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 95660e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 95760e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 958af5db58eSpbrookecho "" 959af5db58eSpbrookecho "Advanced options (experts only):" 960af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 961af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 962af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 9630bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 9640bfe8cc0SPaolo Bonziniecho " build time" 965a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 966e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 967af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 9686a882643Spbrookecho " --install=INSTALL use specified install [$install]" 969c886edfbSBlue Swirlecho " --python=PYTHON use specified python [$python]" 970e2d8830eSBradecho " --smbd=SMBD use specified smbd [$smbd]" 971af5db58eSpbrookecho " --static enable static build [$static]" 9720b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 9730b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 9740b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 9750b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 9760b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 977f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 978f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 97909695a4aSStefan Weilecho " --enable-debug enable common debug build options" 980890b1658Saliguoriecho " --enable-sparse enable sparse checker" 981890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 9821625af87Saliguoriecho " --disable-strip disable stripping binaries" 98385aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 984fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 985c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 986821601eaSJes Sorensenecho " --disable-vnc disable VNC" 987821601eaSJes Sorensenecho " --enable-vnc enable VNC" 988af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 989c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 990c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 9914c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 9924c9b53e3Smalcecho " Available cards: $audio_possible_cards" 993eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 994eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 9958ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 996e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 997fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 9982e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 9994ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 10008d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 10011be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 10022f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 1003ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 10042f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 10052f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 100696763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 1007efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 1008bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 1009bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 1010af896aaaSpbrookecho " --disable-curses disable curses output" 1011c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 1012769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 1013788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 10142df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 10152df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 1016fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 1017a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 10186093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 10197ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 1020b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 10219195b2c2SStefan Weilecho " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" 1022bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 1023e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 1024af5db58eSpbrookecho " --enable-system enable all system emulation targets" 1025af5db58eSpbrookecho " --disable-system disable all system emulation targets" 10260953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 10270953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 1028831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 1029831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 1030831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 1031831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 103284778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 103384778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 1034379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 1035379f6698SPaul Brookecho " emulation targets" 1036379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 103740d6444eSAvi Kivityecho " --enable-pie build Position Independent Executables" 103840d6444eSAvi Kivityecho " --disable-pie do not build Position Independent Executables" 1039af5db58eSpbrookecho " --fmod-lib path to FMOD library" 1040af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 10412f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 1042c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 1043235e510cS陳韋任echo " --cpu=CPU Build for host CPU [$cpu]" 10443142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 1045ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 1046ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 1047e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 1048dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 10495c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 10505c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 1051758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1052758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 105377755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1054d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1055d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1056d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1057d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1058320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1059320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 106074242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 10619410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1062cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1063cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1064f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 1065c589b249SRonnie Sahlbergecho " --disable-libiscsi disable iscsi support" 1066c589b249SRonnie Sahlbergecho " --enable-libiscsi enable iscsi support" 106736707144SAlon Levyecho " --disable-smartcard disable smartcard support" 106836707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1069111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1070111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 107169354a83SHans de Goedeecho " --disable-usb-redir disable usb network redirection support" 107269354a83SHans de Goedeecho " --enable-usb-redir enable usb network redirection support" 1073d138cee9SMichael Rothecho " --disable-guest-agent disable building of the QEMU Guest Agent" 1074d138cee9SMichael Rothecho " --enable-guest-agent enable building of the QEMU Guest Agent" 1075af5db58eSpbrookecho "" 10765bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1077af5db58eSpbrookexit 1 1078af5db58eSpbrookfi 1079af5db58eSpbrook 1080359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1081359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1082359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1083359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1084359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1085359bc95dSPeter Maydell ARCH=tci 1086359bc95dSPeter Maydell else 1087359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1088359bc95dSPeter Maydell exit 1 1089359bc95dSPeter Maydell fi 1090359bc95dSPeter Maydellfi 1091359bc95dSPeter Maydell 10928d05095cSPaolo Bonzini# check that the C compiler works. 10938d05095cSPaolo Bonzinicat > $TMPC <<EOF 109475cafad7SStefan Weilint main(void) { return 0; } 10958d05095cSPaolo BonziniEOF 10968d05095cSPaolo Bonzini 10978d05095cSPaolo Bonziniif compile_object ; then 10988d05095cSPaolo Bonzini : C compiler works ok 10998d05095cSPaolo Bonzinielse 11008d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 11018d05095cSPaolo Bonzini exit 1 11028d05095cSPaolo Bonzinifi 11038d05095cSPaolo Bonzini 11048d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 11058d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 11068d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1107f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 11088d05095cSPaolo Bonzinicat > $TMPC << EOF 11098d05095cSPaolo Bonziniint main(void) { return 0; } 11108d05095cSPaolo BonziniEOF 11118d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1112bd947d30SStefan Weil if compile_prog "-Werror $flag" "" ; then 11138d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 11148d05095cSPaolo Bonzini fi 11158d05095cSPaolo Bonzinidone 11168d05095cSPaolo Bonzini 111740d6444eSAvi Kivityif test "$static" = "yes" ; then 111840d6444eSAvi Kivity if test "$pie" = "yes" ; then 111940d6444eSAvi Kivity echo "static and pie are mutually incompatible" 112040d6444eSAvi Kivity exit 1 112140d6444eSAvi Kivity else 112240d6444eSAvi Kivity pie="no" 112340d6444eSAvi Kivity fi 112440d6444eSAvi Kivityfi 112540d6444eSAvi Kivity 112640d6444eSAvi Kivityif test "$pie" = ""; then 112740d6444eSAvi Kivity case "$cpu-$targetos" in 1128f9db31a2SBrad i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) 112940d6444eSAvi Kivity ;; 113040d6444eSAvi Kivity *) 113140d6444eSAvi Kivity pie="no" 113240d6444eSAvi Kivity ;; 113340d6444eSAvi Kivity esac 113440d6444eSAvi Kivityfi 113540d6444eSAvi Kivity 113640d6444eSAvi Kivityif test "$pie" != "no" ; then 113740d6444eSAvi Kivity cat > $TMPC << EOF 113821d4a791SAvi Kivity 113921d4a791SAvi Kivity#ifdef __linux__ 114021d4a791SAvi Kivity# define THREAD __thread 114121d4a791SAvi Kivity#else 114221d4a791SAvi Kivity# define THREAD 114321d4a791SAvi Kivity#endif 114421d4a791SAvi Kivity 114521d4a791SAvi Kivitystatic THREAD int tls_var; 114621d4a791SAvi Kivity 114721d4a791SAvi Kivityint main(void) { return tls_var; } 114821d4a791SAvi Kivity 114940d6444eSAvi KivityEOF 115040d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 115140d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 115240d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 115340d6444eSAvi Kivity pie="yes" 115440d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 115540d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 115640d6444eSAvi Kivity fi 115740d6444eSAvi Kivity else 115840d6444eSAvi Kivity if test "$pie" = "yes"; then 115940d6444eSAvi Kivity echo "PIE not available due to missing toolchain support" 116040d6444eSAvi Kivity exit 1 116140d6444eSAvi Kivity else 116240d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 116340d6444eSAvi Kivity pie="no" 116440d6444eSAvi Kivity fi 116540d6444eSAvi Kivity fi 116640d6444eSAvi Kivityfi 116740d6444eSAvi Kivity 1168ec530c81Sbellard# 1169ec530c81Sbellard# Solaris specific configure tool chain decisions 1170ec530c81Sbellard# 1171ec530c81Sbellardif test "$solaris" = "yes" ; then 11726792aa11SLoïc Minier if has $install; then 11736792aa11SLoïc Minier : 11746792aa11SLoïc Minier else 1175ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1176ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1177ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1178ec530c81Sbellard exit 1 1179ec530c81Sbellard fi 11806792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1181ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1182ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1183ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1184ec530c81Sbellard exit 1 1185ec530c81Sbellard fi 11866792aa11SLoïc Minier if has ar; then 11876792aa11SLoïc Minier : 11886792aa11SLoïc Minier else 1189ec530c81Sbellard echo "Error: No path includes ar" 1190ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1191ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1192ec530c81Sbellard fi 1193ec530c81Sbellard exit 1 1194ec530c81Sbellard fi 1195ec530c81Sbellardfi 1196ec530c81Sbellard 11977a3fc891SSebastian Herbsztif ! has $python; then 1198c886edfbSBlue Swirl echo "Python not found. Use --python=/path/to/python" 1199c886edfbSBlue Swirl exit 1 1200c886edfbSBlue Swirlfi 1201c886edfbSBlue Swirl 12025327cf48Sbellardif test -z "$target_list" ; then 120360e0df25SPeter Maydell target_list="$default_target_list" 12046e20a45fSbellardelse 1205b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 12065327cf48Sbellardfi 12070a8e90f4Spbrookif test -z "$target_list" ; then 12080a8e90f4Spbrook echo "No targets enabled" 12090a8e90f4Spbrook exit 1 12100a8e90f4Spbrookfi 1211f55fe278SPaolo Bonzini# see if system emulation was really requested 1212f55fe278SPaolo Bonzinicase " $target_list " in 1213f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1214f55fe278SPaolo Bonzini ;; 1215f55fe278SPaolo Bonzini *) softmmu=no 1216f55fe278SPaolo Bonzini ;; 1217f55fe278SPaolo Bonziniesac 12185327cf48Sbellard 1219249247c9SJuan Quintelafeature_not_found() { 1220249247c9SJuan Quintela feature=$1 1221249247c9SJuan Quintela 1222249247c9SJuan Quintela echo "ERROR" 1223249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 12249332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1225249247c9SJuan Quintela echo "ERROR" 1226249247c9SJuan Quintela exit 1; 1227249247c9SJuan Quintela} 1228249247c9SJuan Quintela 12297d13299dSbellardif test -z "$cross_prefix" ; then 12307d13299dSbellard 12317d13299dSbellard# --- 12327d13299dSbellard# big/little endian test 12337d13299dSbellardcat > $TMPC << EOF 12347d13299dSbellard#include <inttypes.h> 12357d13299dSbellardint main(int argc, char ** argv){ 12367d13299dSbellard volatile uint32_t i=0x01234567; 12377d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 12387d13299dSbellard} 12397d13299dSbellardEOF 12407d13299dSbellard 124152166aa0SJuan Quintelaif compile_prog "" "" ; then 12427d13299dSbellard$TMPE && bigendian="yes" 12437d13299dSbellardelse 12447d13299dSbellardecho big/little test failed 12457d13299dSbellardfi 12467d13299dSbellard 12477d13299dSbellardelse 12487d13299dSbellard 12497d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1250ea8f20f8SJuan Quintelacase "$cpu" in 125121d89f84SPeter Maydell arm) 125221d89f84SPeter Maydell # ARM can be either way; ask the compiler which one we are 125321d89f84SPeter Maydell if check_define __ARMEB__; then 125421d89f84SPeter Maydell bigendian=yes 125521d89f84SPeter Maydell fi 125621d89f84SPeter Maydell ;; 125721d89f84SPeter Maydell hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1258ea8f20f8SJuan Quintela bigendian=yes 1259ea8f20f8SJuan Quintela ;; 1260ea8f20f8SJuan Quintelaesac 12617d13299dSbellard 12627d13299dSbellardfi 12637d13299dSbellard 126470be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test 126570be1a2eSPaolo Bonzinicat > $TMPC << EOF 126670be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; 126770be1a2eSPaolo BonziniEOF 126870be1a2eSPaolo Bonziniif compile_object; then 1269ea8f20f8SJuan Quintelahostlongbits=64 127070be1a2eSPaolo Bonzinielse 127170be1a2eSPaolo Bonzinihostlongbits=32 127270be1a2eSPaolo Bonzinifi 1273b6853697Sbellard 1274b0a47e79SJuan Quintela 1275b0a47e79SJuan Quintela########################################## 1276b0a47e79SJuan Quintela# NPTL probe 1277b0a47e79SJuan Quintela 1278b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1279bd0c5661Spbrook cat > $TMPC <<EOF 1280bd0c5661Spbrook#include <sched.h> 128130813ceaSpbrook#include <linux/futex.h> 1282182eacc0SStefan Weilint main(void) { 1283bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1284bd0c5661Spbrook#error bork 1285bd0c5661Spbrook#endif 1286182eacc0SStefan Weil return 0; 1287bd0c5661Spbrook} 1288bd0c5661SpbrookEOF 1289bd0c5661Spbrook 129052166aa0SJuan Quintela if compile_object ; then 1291b0a47e79SJuan Quintela nptl=yes 1292bd0c5661Spbrook else 1293b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1294b0a47e79SJuan Quintela feature_not_found "nptl" 1295b0a47e79SJuan Quintela fi 1296b0a47e79SJuan Quintela nptl=no 1297b0a47e79SJuan Quintela fi 1298bd0c5661Spbrookfi 1299bd0c5661Spbrook 130011d9f695Sbellard########################################## 1301ac62922eSbalrog# zlib check 1302ac62922eSbalrog 13031ece9905SAlon Levyif test "$zlib" != "no" ; then 1304ac62922eSbalrog cat > $TMPC << EOF 1305ac62922eSbalrog#include <zlib.h> 1306ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1307ac62922eSbalrogEOF 130852166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1309ac62922eSbalrog : 1310ac62922eSbalrog else 1311ac62922eSbalrog echo 1312ac62922eSbalrog echo "Error: zlib check failed" 1313ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1314ac62922eSbalrog echo 1315ac62922eSbalrog exit 1 1316ac62922eSbalrog fi 13171ece9905SAlon Levyfi 1318ac62922eSbalrog 1319ac62922eSbalrog########################################## 1320e37630caSaliguori# xen probe 1321e37630caSaliguori 1322fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1323b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1324d5b93ddfSAnthony PERARD 132550ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 132650ced5b3SStefan Weil # If no, we are done and there is no Xen support. 132750ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 132850ced5b3SStefan Weil 132950ced5b3SStefan Weil # Xen (any) 133050ced5b3SStefan Weil cat > $TMPC <<EOF 133150ced5b3SStefan Weil#include <xenctrl.h> 133250ced5b3SStefan Weil#include <xs.h> 133350ced5b3SStefan Weilint main(void) { 133450ced5b3SStefan Weil return 0; 133550ced5b3SStefan Weil} 133650ced5b3SStefan WeilEOF 133750ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 133850ced5b3SStefan Weil # Xen not found 133950ced5b3SStefan Weil if test "$xen" = "yes" ; then 134050ced5b3SStefan Weil feature_not_found "xen" 134150ced5b3SStefan Weil fi 134250ced5b3SStefan Weil xen=no 134350ced5b3SStefan Weil 1344d5b93ddfSAnthony PERARD # Xen unstable 134550ced5b3SStefan Weil elif ( 1346e37630caSaliguori cat > $TMPC <<EOF 1347e37630caSaliguori#include <xenctrl.h> 1348e37630caSaliguori#include <xs.h> 1349d5b93ddfSAnthony PERARD#include <stdint.h> 1350d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1351d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1352d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1353d5b93ddfSAnthony PERARD#endif 1354d5b93ddfSAnthony PERARDint main(void) { 1355d5b93ddfSAnthony PERARD xc_interface *xc; 1356d5b93ddfSAnthony PERARD xs_daemon_open(); 1357d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1358d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1359d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1360b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1361d5b93ddfSAnthony PERARD return 0; 1362d5b93ddfSAnthony PERARD} 1363e37630caSaliguoriEOF 136450ced5b3SStefan Weil compile_prog "" "$xen_libs" 136550ced5b3SStefan Weil ) ; then 1366d5b93ddfSAnthony PERARD xen_ctrl_version=410 1367fc321b4bSJuan Quintela xen=yes 1368d5b93ddfSAnthony PERARD 1369d5b93ddfSAnthony PERARD # Xen 4.0.0 1370d5b93ddfSAnthony PERARD elif ( 1371d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1372d5b93ddfSAnthony PERARD#include <xenctrl.h> 1373d5b93ddfSAnthony PERARD#include <xs.h> 1374d5b93ddfSAnthony PERARD#include <stdint.h> 1375d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1376d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1377d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1378d5b93ddfSAnthony PERARD#endif 1379d5b93ddfSAnthony PERARDint main(void) { 1380b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1381b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1382b87de24eSAnthony PERARD }; 1383d5b93ddfSAnthony PERARD xs_daemon_open(); 1384d5b93ddfSAnthony PERARD xc_interface_open(); 1385d5b93ddfSAnthony PERARD xc_gnttab_open(); 1386d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1387b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1388d5b93ddfSAnthony PERARD return 0; 1389d5b93ddfSAnthony PERARD} 1390d5b93ddfSAnthony PERARDEOF 1391d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1392d5b93ddfSAnthony PERARD ) ; then 1393d5b93ddfSAnthony PERARD xen_ctrl_version=400 1394d5b93ddfSAnthony PERARD xen=yes 1395d5b93ddfSAnthony PERARD 1396b87de24eSAnthony PERARD # Xen 3.4.0 1397b87de24eSAnthony PERARD elif ( 1398b87de24eSAnthony PERARD cat > $TMPC <<EOF 1399b87de24eSAnthony PERARD#include <xenctrl.h> 1400b87de24eSAnthony PERARD#include <xs.h> 1401b87de24eSAnthony PERARDint main(void) { 1402b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1403b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1404b87de24eSAnthony PERARD }; 1405b87de24eSAnthony PERARD xs_daemon_open(); 1406b87de24eSAnthony PERARD xc_interface_open(); 1407b87de24eSAnthony PERARD xc_gnttab_open(); 1408b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1409b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1410b87de24eSAnthony PERARD return 0; 1411b87de24eSAnthony PERARD} 1412b87de24eSAnthony PERARDEOF 1413b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 1414b87de24eSAnthony PERARD ) ; then 1415b87de24eSAnthony PERARD xen_ctrl_version=340 1416b87de24eSAnthony PERARD xen=yes 1417b87de24eSAnthony PERARD 1418b87de24eSAnthony PERARD # Xen 3.3.0 1419d5b93ddfSAnthony PERARD elif ( 1420d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1421d5b93ddfSAnthony PERARD#include <xenctrl.h> 1422d5b93ddfSAnthony PERARD#include <xs.h> 1423d5b93ddfSAnthony PERARDint main(void) { 1424d5b93ddfSAnthony PERARD xs_daemon_open(); 1425d5b93ddfSAnthony PERARD xc_interface_open(); 1426d5b93ddfSAnthony PERARD xc_gnttab_open(); 1427d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1428d5b93ddfSAnthony PERARD return 0; 1429d5b93ddfSAnthony PERARD} 1430d5b93ddfSAnthony PERARDEOF 1431d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1432d5b93ddfSAnthony PERARD ) ; then 1433d5b93ddfSAnthony PERARD xen_ctrl_version=330 1434d5b93ddfSAnthony PERARD xen=yes 1435d5b93ddfSAnthony PERARD 143650ced5b3SStefan Weil # Xen version unsupported 1437e37630caSaliguori else 1438fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 143950ced5b3SStefan Weil feature_not_found "xen (unsupported version)" 1440fc321b4bSJuan Quintela fi 1441fc321b4bSJuan Quintela xen=no 1442e37630caSaliguori fi 1443d5b93ddfSAnthony PERARD 1444d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1445d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1446d5b93ddfSAnthony PERARD fi 1447e37630caSaliguorifi 1448e37630caSaliguori 1449e37630caSaliguori########################################## 1450a8bd70adSPaolo Bonzini# pkg-config probe 1451f91672e5SPaolo Bonzini 1452a8bd70adSPaolo Bonziniif ! has $pkg_config; then 1453a213fcb2SPeter Maydell echo "Error: pkg-config binary '$pkg_config' not found" 1454a213fcb2SPeter Maydell exit 1 1455f91672e5SPaolo Bonzinifi 1456f91672e5SPaolo Bonzini 1457f91672e5SPaolo Bonzini########################################## 145844dc0ca3SAlon Levy# libtool probe 145944dc0ca3SAlon Levy 14603f534581SBradif ! has $libtool; then 146144dc0ca3SAlon Levy libtool= 146244dc0ca3SAlon Levyfi 146344dc0ca3SAlon Levy 146444dc0ca3SAlon Levy########################################## 1465dfffc653SJuan Quintela# Sparse probe 1466dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 14670dba6195SLoïc Minier if has cgcc; then 1468dfffc653SJuan Quintela sparse=yes 1469dfffc653SJuan Quintela else 1470dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1471dfffc653SJuan Quintela feature_not_found "sparse" 1472dfffc653SJuan Quintela fi 1473dfffc653SJuan Quintela sparse=no 1474dfffc653SJuan Quintela fi 1475dfffc653SJuan Quintelafi 1476dfffc653SJuan Quintela 1477dfffc653SJuan Quintela########################################## 147811d9f695Sbellard# SDL probe 147911d9f695Sbellard 14803ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 14813ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 14823ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 14833ec87ffeSPaolo Bonzini sdl_config=sdl-config 14843ec87ffeSPaolo Bonzinifi 14853ec87ffeSPaolo Bonzini 14863ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1487a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1488fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 14893ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 14903ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 14919316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1492a0dfd8a4SLoïc Minierelse 1493a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1494a0dfd8a4SLoïc Minier feature_not_found "sdl" 1495a0dfd8a4SLoïc Minier fi 1496a0dfd8a4SLoïc Minier sdl=no 14979316f803SPaolo Bonzinifi 149829e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 14993ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 15003ec87ffeSPaolo Bonzinifi 150111d9f695Sbellard 15029316f803SPaolo Bonzinisdl_too_old=no 1503c4198157SJuan Quintelaif test "$sdl" != "no" ; then 150411d9f695Sbellard cat > $TMPC << EOF 150511d9f695Sbellard#include <SDL.h> 150611d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 150711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 150811d9f695SbellardEOF 15099316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 151074f42e18STeLeMan if test "$static" = "yes" ; then 151174f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 151274f42e18STeLeMan else 15139316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 151474f42e18STeLeMan fi 151552166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 151611d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 151711d9f695Sbellard sdl_too_old=yes 151811d9f695Sbellard else 1519fd677642Sths if test "$cocoa" = "no" ; then 152011d9f695Sbellard sdl=yes 152111d9f695Sbellard fi 1522fd677642Sths fi 15237c1f25b4Sbellard 152467c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 15251ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 152667c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1527f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1528f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 152911d9f695Sbellard fi 153052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 15311ac88f28SJuan Quintela : 15321ac88f28SJuan Quintela else 15331ac88f28SJuan Quintela sdl=no 15347c1f25b4Sbellard fi 15357c1f25b4Sbellard fi # static link 1536c4198157SJuan Quintela else # sdl not found 1537c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1538c4198157SJuan Quintela feature_not_found "sdl" 1539c4198157SJuan Quintela fi 1540c4198157SJuan Quintela sdl=no 15417c1f25b4Sbellard fi # sdl compile test 1542fd677642Sthsfi 154311d9f695Sbellard 15445368a422Saliguoriif test "$sdl" = "yes" ; then 15455368a422Saliguori cat > $TMPC <<EOF 15465368a422Saliguori#include <SDL.h> 15475368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 15485368a422Saliguori#include <X11/XKBlib.h> 15495368a422Saliguori#else 15505368a422Saliguori#error No x11 support 15515368a422Saliguori#endif 15525368a422Saliguoriint main(void) { return 0; } 15535368a422SaliguoriEOF 155452166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1555681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 15565368a422Saliguori fi 15570705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 15585368a422Saliguorifi 15595368a422Saliguori 15608f28f3fbSths########################################## 15618d5d2d4cSths# VNC TLS detection 1562821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1563ae6b5e5aSaliguori cat > $TMPC <<EOF 1564ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1565ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1566ae6b5e5aSaliguoriEOF 1567a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1568a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 156952166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 15701be10ad2SJuan Quintela vnc_tls=yes 1571a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1572ae6b5e5aSaliguori else 15731be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 15741be10ad2SJuan Quintela feature_not_found "vnc-tls" 15751be10ad2SJuan Quintela fi 15761be10ad2SJuan Quintela vnc_tls=no 15778d5d2d4cSths fi 15788d5d2d4cSthsfi 15798d5d2d4cSths 15808d5d2d4cSths########################################## 15812f9606b3Saliguori# VNC SASL detection 1582821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 15832f9606b3Saliguori cat > $TMPC <<EOF 15842f9606b3Saliguori#include <sasl/sasl.h> 15852f9606b3Saliguori#include <stdio.h> 15862f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 15872f9606b3SaliguoriEOF 15882f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 15892f9606b3Saliguori vnc_sasl_cflags="" 15902f9606b3Saliguori vnc_sasl_libs="-lsasl2" 159152166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1592ea784e3bSJuan Quintela vnc_sasl=yes 1593fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 15942f9606b3Saliguori else 1595ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1596ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1597ea784e3bSJuan Quintela fi 1598ea784e3bSJuan Quintela vnc_sasl=no 15992f9606b3Saliguori fi 16002f9606b3Saliguorifi 16012f9606b3Saliguori 16022f9606b3Saliguori########################################## 16032f6f5c7aSCorentin Chary# VNC JPEG detection 1604821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 16052f6f5c7aSCorentin Charycat > $TMPC <<EOF 16062f6f5c7aSCorentin Chary#include <stdio.h> 16072f6f5c7aSCorentin Chary#include <jpeglib.h> 16082f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 16092f6f5c7aSCorentin CharyEOF 16102f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 16112f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 16122f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 16132f6f5c7aSCorentin Chary vnc_jpeg=yes 16142f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 16152f6f5c7aSCorentin Chary else 16162f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 16172f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 16182f6f5c7aSCorentin Chary fi 16192f6f5c7aSCorentin Chary vnc_jpeg=no 16202f6f5c7aSCorentin Chary fi 16212f6f5c7aSCorentin Charyfi 16222f6f5c7aSCorentin Chary 16232f6f5c7aSCorentin Chary########################################## 1624efe556adSCorentin Chary# VNC PNG detection 1625821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1626efe556adSCorentin Charycat > $TMPC <<EOF 1627efe556adSCorentin Chary//#include <stdio.h> 1628efe556adSCorentin Chary#include <png.h> 1629832ce9c2SScott Wood#include <stddef.h> 1630efe556adSCorentin Charyint main(void) { 1631efe556adSCorentin Chary png_structp png_ptr; 1632efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1633efe556adSCorentin Chary return 0; 1634efe556adSCorentin Chary} 1635efe556adSCorentin CharyEOF 16369af8025eSBrad if $pkg_config libpng --modversion >/dev/null 2>&1; then 16379af8025eSBrad vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` 16389af8025eSBrad vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` 16399af8025eSBrad else 1640efe556adSCorentin Chary vnc_png_cflags="" 1641efe556adSCorentin Chary vnc_png_libs="-lpng" 16429af8025eSBrad fi 1643efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1644efe556adSCorentin Chary vnc_png=yes 1645efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 16469af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 1647efe556adSCorentin Chary else 1648efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1649efe556adSCorentin Chary feature_not_found "vnc-png" 1650efe556adSCorentin Chary fi 1651efe556adSCorentin Chary vnc_png=no 1652efe556adSCorentin Chary fi 1653efe556adSCorentin Charyfi 1654efe556adSCorentin Chary 1655efe556adSCorentin Chary########################################## 165676655d6dSaliguori# fnmatch() probe, used for ACL routines 165776655d6dSaliguorifnmatch="no" 165876655d6dSaliguoricat > $TMPC << EOF 165976655d6dSaliguori#include <fnmatch.h> 166076655d6dSaliguoriint main(void) 166176655d6dSaliguori{ 166276655d6dSaliguori fnmatch("foo", "foo", 0); 166376655d6dSaliguori return 0; 166476655d6dSaliguori} 166576655d6dSaliguoriEOF 166652166aa0SJuan Quintelaif compile_prog "" "" ; then 166776655d6dSaliguori fnmatch="yes" 166876655d6dSaliguorifi 166976655d6dSaliguori 167076655d6dSaliguori########################################## 1671ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1672ee682d27SStefan Weilif test "$uuid" != "no" ; then 1673ee682d27SStefan Weil uuid_libs="-luuid" 1674ee682d27SStefan Weil cat > $TMPC << EOF 1675ee682d27SStefan Weil#include <uuid/uuid.h> 1676ee682d27SStefan Weilint main(void) 1677ee682d27SStefan Weil{ 1678ee682d27SStefan Weil uuid_t my_uuid; 1679ee682d27SStefan Weil uuid_generate(my_uuid); 1680ee682d27SStefan Weil return 0; 1681ee682d27SStefan Weil} 1682ee682d27SStefan WeilEOF 1683ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1684ee682d27SStefan Weil uuid="yes" 1685ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1686ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1687ee682d27SStefan Weil else 1688ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1689ee682d27SStefan Weil feature_not_found "uuid" 1690ee682d27SStefan Weil fi 1691ee682d27SStefan Weil uuid=no 1692ee682d27SStefan Weil fi 1693ee682d27SStefan Weilfi 1694ee682d27SStefan Weil 1695ee682d27SStefan Weil########################################## 1696dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1697dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1698dce512deSChristoph Hellwig cat > $TMPC << EOF 1699ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 1700dce512deSChristoph Hellwig#include <xfs/xfs.h> 1701dce512deSChristoph Hellwigint main(void) 1702dce512deSChristoph Hellwig{ 1703dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1704dce512deSChristoph Hellwig return 0; 1705dce512deSChristoph Hellwig} 1706dce512deSChristoph HellwigEOF 1707dce512deSChristoph Hellwig if compile_prog "" "" ; then 1708dce512deSChristoph Hellwig xfs="yes" 1709dce512deSChristoph Hellwig else 1710dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1711dce512deSChristoph Hellwig feature_not_found "xfs" 1712dce512deSChristoph Hellwig fi 1713dce512deSChristoph Hellwig xfs=no 1714dce512deSChristoph Hellwig fi 1715dce512deSChristoph Hellwigfi 1716dce512deSChristoph Hellwig 1717dce512deSChristoph Hellwig########################################## 17188a16d273Sths# vde libraries probe 1719dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 17204baae0acSJuan Quintela vde_libs="-lvdeplug" 17218a16d273Sths cat > $TMPC << EOF 17228a16d273Sths#include <libvdeplug.h> 17234a7f0e06Spbrookint main(void) 17244a7f0e06Spbrook{ 17254a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 17264a7f0e06Spbrook vde_open("", "", &a); 17274a7f0e06Spbrook return 0; 17284a7f0e06Spbrook} 17298a16d273SthsEOF 173052166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 17314baae0acSJuan Quintela vde=yes 17328e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 17338e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1734dfb278bdSJuan Quintela else 1735dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1736dfb278bdSJuan Quintela feature_not_found "vde" 1737dfb278bdSJuan Quintela fi 1738dfb278bdSJuan Quintela vde=no 17398a16d273Sths fi 17408a16d273Sthsfi 17418a16d273Sths 17428a16d273Sths########################################## 1743c2de5c91Smalc# Sound support libraries probe 17448f28f3fbSths 1745c2de5c91Smalcaudio_drv_probe() 1746c2de5c91Smalc{ 1747c2de5c91Smalc drv=$1 1748c2de5c91Smalc hdr=$2 1749c2de5c91Smalc lib=$3 1750c2de5c91Smalc exp=$4 1751c2de5c91Smalc cfl=$5 17528f28f3fbSths cat > $TMPC << EOF 1753c2de5c91Smalc#include <$hdr> 1754c2de5c91Smalcint main(void) { $exp } 17558f28f3fbSthsEOF 175652166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 17578f28f3fbSths : 17588f28f3fbSths else 17598f28f3fbSths echo 1760c2de5c91Smalc echo "Error: $drv check failed" 1761c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 17628f28f3fbSths echo 17638f28f3fbSths exit 1 17648f28f3fbSths fi 1765c2de5c91Smalc} 1766c2de5c91Smalc 17672fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1768c2de5c91Smalcfor drv in $audio_drv_list; do 1769c2de5c91Smalc case $drv in 1770c2de5c91Smalc alsa) 1771c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1772c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1773a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1774c2de5c91Smalc ;; 1775c2de5c91Smalc 1776c2de5c91Smalc fmod) 1777c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1778c2de5c91Smalc echo 1779c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1780c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1781c2de5c91Smalc echo 1782c2de5c91Smalc exit 1 17838f28f3fbSths fi 1784c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1785a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1786c2de5c91Smalc ;; 1787c2de5c91Smalc 1788c2de5c91Smalc esd) 1789c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1790a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 179167f86e8eSJuan Quintela audio_pt_int="yes" 1792c2de5c91Smalc ;; 1793b8e59f18Smalc 1794b8e59f18Smalc pa) 1795493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 179620fa53ecSMarc-Antoine Perennou "pa_simple *s = 0; pa_simple_free(s); return 0;" 1797493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 179867f86e8eSJuan Quintela audio_pt_int="yes" 1799b8e59f18Smalc ;; 1800b8e59f18Smalc 1801997e690aSJuan Quintela coreaudio) 1802997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1803997e690aSJuan Quintela ;; 1804997e690aSJuan Quintela 1805a4bf6780SJuan Quintela dsound) 1806a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1807d5631638Smalc audio_win_int="yes" 1808a4bf6780SJuan Quintela ;; 1809a4bf6780SJuan Quintela 1810a4bf6780SJuan Quintela oss) 1811a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1812a4bf6780SJuan Quintela ;; 1813a4bf6780SJuan Quintela 1814a4bf6780SJuan Quintela sdl|wav) 18152f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 18162f6a1ab0Sblueswir1 ;; 18172f6a1ab0Sblueswir1 1818d5631638Smalc winwave) 1819d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1820d5631638Smalc audio_win_int="yes" 1821d5631638Smalc ;; 1822d5631638Smalc 1823e4c63a6aSmalc *) 18241c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1825e4c63a6aSmalc echo 1826e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1827e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1828e4c63a6aSmalc echo 1829e4c63a6aSmalc exit 1 1830e4c63a6aSmalc } 1831e4c63a6aSmalc ;; 1832c2de5c91Smalc esac 1833c2de5c91Smalcdone 18348f28f3fbSths 18354d3b6f6eSbalrog########################################## 18362e4d9fb1Saurel32# BrlAPI probe 18372e4d9fb1Saurel32 18384ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1839eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 18402e4d9fb1Saurel32 cat > $TMPC << EOF 18412e4d9fb1Saurel32#include <brlapi.h> 1842832ce9c2SScott Wood#include <stddef.h> 18432e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 18442e4d9fb1Saurel32EOF 184552166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 18462e4d9fb1Saurel32 brlapi=yes 1847264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 18484ffcedb6SJuan Quintela else 18494ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 18504ffcedb6SJuan Quintela feature_not_found "brlapi" 18514ffcedb6SJuan Quintela fi 18524ffcedb6SJuan Quintela brlapi=no 1853eb82284fSJuan Quintela fi 1854eb82284fSJuan Quintelafi 18552e4d9fb1Saurel32 18562e4d9fb1Saurel32########################################## 18574d3b6f6eSbalrog# curses probe 1858e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 1859e095e2f3SStefan Weil curses_list="-lpdcurses" 1860e095e2f3SStefan Weilelse 18614f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 1862e095e2f3SStefan Weilfi 18634d3b6f6eSbalrog 1864c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1865c584a6d0SJuan Quintela curses_found=no 18664d3b6f6eSbalrog cat > $TMPC << EOF 18674d3b6f6eSbalrog#include <curses.h> 18685a8ff3aaSblueswir1#ifdef __OpenBSD__ 18695a8ff3aaSblueswir1#define resize_term resizeterm 18705a8ff3aaSblueswir1#endif 1871ef9a2524SStefan Weilint main(void) { 1872ef9a2524SStefan Weil const char *s = curses_version(); 1873ef9a2524SStefan Weil resize_term(0, 0); 1874ef9a2524SStefan Weil return s != 0; 1875ef9a2524SStefan Weil} 18764d3b6f6eSbalrogEOF 18774f78ef9aSJuan Quintela for curses_lib in $curses_list; do 18784f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1879c584a6d0SJuan Quintela curses_found=yes 18804f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 18814f78ef9aSJuan Quintela break 18824d3b6f6eSbalrog fi 18834f78ef9aSJuan Quintela done 1884c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1885c584a6d0SJuan Quintela curses=yes 1886c584a6d0SJuan Quintela else 1887c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1888c584a6d0SJuan Quintela feature_not_found "curses" 1889c584a6d0SJuan Quintela fi 1890c584a6d0SJuan Quintela curses=no 1891c584a6d0SJuan Quintela fi 18924f78ef9aSJuan Quintelafi 18934d3b6f6eSbalrog 1894414f0dabSblueswir1########################################## 1895769ce76dSAlexander Graf# curl probe 1896769ce76dSAlexander Graf 1897a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1898a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 18994e2b0658SPaolo Bonzinielse 19004e2b0658SPaolo Bonzini curlconfig=curl-config 19014e2b0658SPaolo Bonzinifi 19024e2b0658SPaolo Bonzini 1903788c8196SJuan Quintelaif test "$curl" != "no" ; then 1904769ce76dSAlexander Graf cat > $TMPC << EOF 1905769ce76dSAlexander Graf#include <curl/curl.h> 19060b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 1907769ce76dSAlexander GrafEOF 19084e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 19094e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1910b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1911769ce76dSAlexander Graf curl=yes 1912f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1913f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1914788c8196SJuan Quintela else 1915788c8196SJuan Quintela if test "$curl" = "yes" ; then 1916788c8196SJuan Quintela feature_not_found "curl" 1917788c8196SJuan Quintela fi 1918788c8196SJuan Quintela curl=no 1919769ce76dSAlexander Graf fi 1920769ce76dSAlexander Graffi # test "$curl" 1921769ce76dSAlexander Graf 1922769ce76dSAlexander Graf########################################## 1923fb599c9aSbalrog# bluez support probe 1924a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1925e820e3f4Sbalrog cat > $TMPC << EOF 1926e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1927e820e3f4Sbalrogint main(void) { return bt_error(0); } 1928e820e3f4SbalrogEOF 1929a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1930a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 193152166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1932a20a6f46SJuan Quintela bluez=yes 1933e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1934e820e3f4Sbalrog else 1935a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1936a20a6f46SJuan Quintela feature_not_found "bluez" 1937a20a6f46SJuan Quintela fi 1938e820e3f4Sbalrog bluez="no" 1939e820e3f4Sbalrog fi 1940fb599c9aSbalrogfi 1941fb599c9aSbalrog 1942fb599c9aSbalrog########################################## 1943e18df141SAnthony Liguori# glib support probe 19444b76a481SStefan Hajnocziif $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then 19454b76a481SStefan Hajnoczi glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` 19464b76a481SStefan Hajnoczi glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` 194714015304SAnthony Liguori LIBS="$glib_libs $LIBS" 1948957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 1949e18df141SAnthony Liguorielse 1950e18df141SAnthony Liguori echo "glib-2.0 required to compile QEMU" 1951e18df141SAnthony Liguori exit 1 1952e18df141SAnthony Liguorifi 1953e18df141SAnthony Liguori 1954e18df141SAnthony Liguori########################################## 195517bff52bSM. Mohan Kumar# libcap probe 195617bff52bSM. Mohan Kumar 195717bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 195817bff52bSM. Mohan Kumar cat > $TMPC <<EOF 195917bff52bSM. Mohan Kumar#include <stdio.h> 196017bff52bSM. Mohan Kumar#include <sys/capability.h> 196117bff52bSM. Mohan Kumarint main(void) { cap_t caps; caps = cap_init(); } 196217bff52bSM. Mohan KumarEOF 196317bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 196417bff52bSM. Mohan Kumar cap=yes 196517bff52bSM. Mohan Kumar else 196617bff52bSM. Mohan Kumar cap=no 196717bff52bSM. Mohan Kumar fi 196817bff52bSM. Mohan Kumarfi 196917bff52bSM. Mohan Kumar 197017bff52bSM. Mohan Kumar########################################## 1971e5d355d1Saliguori# pthread probe 19724b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 19733c529d93Saliguori 1974e5d355d1Saliguoripthread=no 1975414f0dabSblueswir1cat > $TMPC << EOF 19763c529d93Saliguori#include <pthread.h> 19777a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 19787a42bbe4SStefan Weilint main(void) { 19797a42bbe4SStefan Weil pthread_t thread; 19807a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 19817a42bbe4SStefan Weil return 0; 19827a42bbe4SStefan Weil} 1983414f0dabSblueswir1EOF 1984bd00d539SAndreas Färberif compile_prog "" "" ; then 1985bd00d539SAndreas Färber pthread=yes 1986bd00d539SAndreas Färberelse 1987de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 198852166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1989e5d355d1Saliguori pthread=yes 19905572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1991de65fe0fSSebastian Herbszt break 1992414f0dabSblueswir1 fi 1993de65fe0fSSebastian Herbszt done 1994bd00d539SAndreas Färberfi 1995414f0dabSblueswir1 19964617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 19974dd75c70SChristoph Hellwig echo 19984dd75c70SChristoph Hellwig echo "Error: pthread check failed" 19994dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 20004dd75c70SChristoph Hellwig echo 20014dd75c70SChristoph Hellwig exit 1 2002e5d355d1Saliguorifi 2003e5d355d1Saliguori 2004bf9298b9Saliguori########################################## 2005f27aaf4bSChristian Brunner# rbd probe 2006f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2007f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2008f27aaf4bSChristian Brunner#include <stdio.h> 2009ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2010f27aaf4bSChristian Brunnerint main(void) { 2011ad32e9c0SJosh Durgin rados_t cluster; 2012ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2013f27aaf4bSChristian Brunner return 0; 2014f27aaf4bSChristian Brunner} 2015f27aaf4bSChristian BrunnerEOF 2016ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2017f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2018f27aaf4bSChristian Brunner rbd=yes 2019f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 2020f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 2021f27aaf4bSChristian Brunner else 2022f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 2023f27aaf4bSChristian Brunner feature_not_found "rados block device" 2024f27aaf4bSChristian Brunner fi 2025f27aaf4bSChristian Brunner rbd=no 2026f27aaf4bSChristian Brunner fi 2027f27aaf4bSChristian Brunnerfi 2028f27aaf4bSChristian Brunner 2029f27aaf4bSChristian Brunner########################################## 20305c6c3a6cSChristoph Hellwig# linux-aio probe 20315c6c3a6cSChristoph Hellwig 20325c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 20335c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 20345c6c3a6cSChristoph Hellwig#include <libaio.h> 20355c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2036832ce9c2SScott Wood#include <stddef.h> 20375c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 20385c6c3a6cSChristoph HellwigEOF 20395c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 20405c6c3a6cSChristoph Hellwig linux_aio=yes 2041048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 2042048d179fSPaul Brook libs_tools="$libs_tools -laio" 20435c6c3a6cSChristoph Hellwig else 20445c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 20455c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 20465c6c3a6cSChristoph Hellwig fi 20473cfcae3cSLuiz Capitulino linux_aio=no 20485c6c3a6cSChristoph Hellwig fi 20495c6c3a6cSChristoph Hellwigfi 20505c6c3a6cSChristoph Hellwig 20515c6c3a6cSChristoph Hellwig########################################## 2052758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2053758e8e38SVenkateswararao Jujjuri (JV) 2054758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2055758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2056758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2057758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2058f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2059f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2060f2338fb4SPavel Borzenkov#else 20614f26f2b6SAvi Kivity#include <sys/xattr.h> 2062f2338fb4SPavel Borzenkov#endif 2063758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2064758e8e38SVenkateswararao Jujjuri (JV)EOF 20654f26f2b6SAvi Kivity if compile_prog "" "" ; then 20664f26f2b6SAvi Kivity attr=yes 20674f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2068f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2069758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2070758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 20714f26f2b6SAvi Kivity libattr=yes 2072758e8e38SVenkateswararao Jujjuri (JV) else 2073758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2074758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 2075758e8e38SVenkateswararao Jujjuri (JV) fi 2076758e8e38SVenkateswararao Jujjuri (JV) attr=no 2077758e8e38SVenkateswararao Jujjuri (JV) fi 2078758e8e38SVenkateswararao Jujjuri (JV)fi 2079758e8e38SVenkateswararao Jujjuri (JV) 2080758e8e38SVenkateswararao Jujjuri (JV)########################################## 2081bf9298b9Saliguori# iovec probe 2082bf9298b9Saliguoricat > $TMPC <<EOF 2083db34f0b3Sblueswir1#include <sys/types.h> 2084bf9298b9Saliguori#include <sys/uio.h> 2085db34f0b3Sblueswir1#include <unistd.h> 2086f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2087bf9298b9SaliguoriEOF 2088bf9298b9Saliguoriiovec=no 208952166aa0SJuan Quintelaif compile_prog "" "" ; then 2090bf9298b9Saliguori iovec=yes 2091bf9298b9Saliguorifi 2092bf9298b9Saliguori 2093f652e6afSaurel32########################################## 2094ceb42de8Saliguori# preadv probe 2095ceb42de8Saliguoricat > $TMPC <<EOF 2096ceb42de8Saliguori#include <sys/types.h> 2097ceb42de8Saliguori#include <sys/uio.h> 2098ceb42de8Saliguori#include <unistd.h> 209984972cbbSStefan Weilint main(void) { return preadv == preadv; } 2100ceb42de8SaliguoriEOF 2101ceb42de8Saliguoripreadv=no 210252166aa0SJuan Quintelaif compile_prog "" "" ; then 2103ceb42de8Saliguori preadv=yes 2104ceb42de8Saliguorifi 2105ceb42de8Saliguori 2106ceb42de8Saliguori########################################## 2107f652e6afSaurel32# fdt probe 21082df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2109b41af4baSJuan Quintela fdt_libs="-lfdt" 2110f652e6afSaurel32 cat > $TMPC << EOF 2111f652e6afSaurel32int main(void) { return 0; } 2112f652e6afSaurel32EOF 211352166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2114f652e6afSaurel32 fdt=yes 21152df87df7SJuan Quintela else 21162df87df7SJuan Quintela if test "$fdt" = "yes" ; then 21172df87df7SJuan Quintela feature_not_found "fdt" 21182df87df7SJuan Quintela fi 2119de3a354aSMichael Walle fdt_libs= 21202df87df7SJuan Quintela fdt=no 2121f652e6afSaurel32 fi 2122f652e6afSaurel32fi 2123f652e6afSaurel32 212420ff075bSMichael Walle########################################## 212520ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 212620ff075bSMichael Walleif test "$opengl" != "no" ; then 212720ff075bSMichael Walle opengl_libs="-lGL" 212820ff075bSMichael Walle cat > $TMPC << EOF 212920ff075bSMichael Walle#include <X11/Xlib.h> 213020ff075bSMichael Walle#include <GL/gl.h> 213120ff075bSMichael Walle#include <GL/glx.h> 213284972cbbSStefan Weilint main(void) { return GL_VERSION != 0; } 213320ff075bSMichael WalleEOF 213420ff075bSMichael Walle if compile_prog "" "-lGL" ; then 213520ff075bSMichael Walle opengl=yes 213620ff075bSMichael Walle else 213720ff075bSMichael Walle if test "$opengl" = "yes" ; then 213820ff075bSMichael Walle feature_not_found "opengl" 213920ff075bSMichael Walle fi 2140de3a354aSMichael Walle opengl_libs= 214120ff075bSMichael Walle opengl=no 214220ff075bSMichael Walle fi 214320ff075bSMichael Wallefi 214420ff075bSMichael Walle 21453b3f24adSaurel32# 21463b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 21473b3f24adSaurel32# emulator. This is done because older glibc versions don't 21483b3f24adSaurel32# have syscall stubs for these implemented. 21493b3f24adSaurel32# 21503b3f24adSaurel32atfile=no 21513b3f24adSaurel32cat > $TMPC << EOF 21523b3f24adSaurel32#define _ATFILE_SOURCE 21533b3f24adSaurel32#include <sys/types.h> 21543b3f24adSaurel32#include <fcntl.h> 21553b3f24adSaurel32#include <unistd.h> 21563b3f24adSaurel32 21573b3f24adSaurel32int 21583b3f24adSaurel32main(void) 21593b3f24adSaurel32{ 21603b3f24adSaurel32 /* try to unlink nonexisting file */ 21613b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 21623b3f24adSaurel32} 21633b3f24adSaurel32EOF 216452166aa0SJuan Quintelaif compile_prog "" "" ; then 21653b3f24adSaurel32 atfile=yes 21663b3f24adSaurel32fi 21673b3f24adSaurel32 216839386ac7Saurel32# Check for inotify functions when we are building linux-user 21693b3f24adSaurel32# emulator. This is done because older glibc versions don't 21703b3f24adSaurel32# have syscall stubs for these implemented. In that case we 21713b3f24adSaurel32# don't provide them even if kernel supports them. 21723b3f24adSaurel32# 21733b3f24adSaurel32inotify=no 21743b3f24adSaurel32cat > $TMPC << EOF 21753b3f24adSaurel32#include <sys/inotify.h> 21763b3f24adSaurel32 21773b3f24adSaurel32int 21783b3f24adSaurel32main(void) 21793b3f24adSaurel32{ 21803b3f24adSaurel32 /* try to start inotify */ 21818690e420Saurel32 return inotify_init(); 21823b3f24adSaurel32} 21833b3f24adSaurel32EOF 218452166aa0SJuan Quintelaif compile_prog "" "" ; then 21853b3f24adSaurel32 inotify=yes 21863b3f24adSaurel32fi 21873b3f24adSaurel32 2188c05c7a73SRiku Voipioinotify1=no 2189c05c7a73SRiku Voipiocat > $TMPC << EOF 2190c05c7a73SRiku Voipio#include <sys/inotify.h> 2191c05c7a73SRiku Voipio 2192c05c7a73SRiku Voipioint 2193c05c7a73SRiku Voipiomain(void) 2194c05c7a73SRiku Voipio{ 2195c05c7a73SRiku Voipio /* try to start inotify */ 2196c05c7a73SRiku Voipio return inotify_init1(0); 2197c05c7a73SRiku Voipio} 2198c05c7a73SRiku VoipioEOF 2199c05c7a73SRiku Voipioif compile_prog "" "" ; then 2200c05c7a73SRiku Voipio inotify1=yes 2201c05c7a73SRiku Voipiofi 2202c05c7a73SRiku Voipio 2203ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2204ebc996f3SRiku Voipioutimens=no 2205ebc996f3SRiku Voipiocat > $TMPC << EOF 2206ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2207ebc996f3SRiku Voipio#include <stddef.h> 2208ebc996f3SRiku Voipio#include <fcntl.h> 2209ebc996f3SRiku Voipio 2210ebc996f3SRiku Voipioint main(void) 2211ebc996f3SRiku Voipio{ 2212ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2213ebc996f3SRiku Voipio futimens(0, NULL); 2214ebc996f3SRiku Voipio return 0; 2215ebc996f3SRiku Voipio} 2216ebc996f3SRiku VoipioEOF 221752166aa0SJuan Quintelaif compile_prog "" "" ; then 2218ebc996f3SRiku Voipio utimens=yes 2219ebc996f3SRiku Voipiofi 2220ebc996f3SRiku Voipio 2221099d6b0fSRiku Voipio# check if pipe2 is there 2222099d6b0fSRiku Voipiopipe2=no 2223099d6b0fSRiku Voipiocat > $TMPC << EOF 2224099d6b0fSRiku Voipio#include <unistd.h> 2225099d6b0fSRiku Voipio#include <fcntl.h> 2226099d6b0fSRiku Voipio 2227099d6b0fSRiku Voipioint main(void) 2228099d6b0fSRiku Voipio{ 2229099d6b0fSRiku Voipio int pipefd[2]; 2230099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2231099d6b0fSRiku Voipio return 0; 2232099d6b0fSRiku Voipio} 2233099d6b0fSRiku VoipioEOF 223452166aa0SJuan Quintelaif compile_prog "" "" ; then 2235099d6b0fSRiku Voipio pipe2=yes 2236099d6b0fSRiku Voipiofi 2237099d6b0fSRiku Voipio 223840ff6d7eSKevin Wolf# check if accept4 is there 223940ff6d7eSKevin Wolfaccept4=no 224040ff6d7eSKevin Wolfcat > $TMPC << EOF 224140ff6d7eSKevin Wolf#include <sys/socket.h> 224240ff6d7eSKevin Wolf#include <stddef.h> 224340ff6d7eSKevin Wolf 224440ff6d7eSKevin Wolfint main(void) 224540ff6d7eSKevin Wolf{ 224640ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 224740ff6d7eSKevin Wolf return 0; 224840ff6d7eSKevin Wolf} 224940ff6d7eSKevin WolfEOF 225040ff6d7eSKevin Wolfif compile_prog "" "" ; then 225140ff6d7eSKevin Wolf accept4=yes 225240ff6d7eSKevin Wolffi 225340ff6d7eSKevin Wolf 22543ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 22553ce34dfbSvibisreenivasansplice=no 22563ce34dfbSvibisreenivasancat > $TMPC << EOF 22573ce34dfbSvibisreenivasan#include <unistd.h> 22583ce34dfbSvibisreenivasan#include <fcntl.h> 22593ce34dfbSvibisreenivasan#include <limits.h> 22603ce34dfbSvibisreenivasan 22613ce34dfbSvibisreenivasanint main(void) 22623ce34dfbSvibisreenivasan{ 226366ea0f22SStefan Weil int len, fd = 0; 22643ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 22653ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 22663ce34dfbSvibisreenivasan return 0; 22673ce34dfbSvibisreenivasan} 22683ce34dfbSvibisreenivasanEOF 226952166aa0SJuan Quintelaif compile_prog "" "" ; then 22703ce34dfbSvibisreenivasan splice=yes 22713ce34dfbSvibisreenivasanfi 22723ce34dfbSvibisreenivasan 2273dcc38d1cSMarcelo Tosatti########################################## 2274dcc38d1cSMarcelo Tosatti# signalfd probe 2275dcc38d1cSMarcelo Tosattisignalfd="no" 2276dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2277dcc38d1cSMarcelo Tosatti#include <unistd.h> 2278dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2279dcc38d1cSMarcelo Tosatti#include <signal.h> 2280dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2281dcc38d1cSMarcelo TosattiEOF 2282dcc38d1cSMarcelo Tosatti 2283dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2284dcc38d1cSMarcelo Tosatti signalfd=yes 2285dcc38d1cSMarcelo Tosattifi 2286dcc38d1cSMarcelo Tosatti 2287c2882b96SRiku Voipio# check if eventfd is supported 2288c2882b96SRiku Voipioeventfd=no 2289c2882b96SRiku Voipiocat > $TMPC << EOF 2290c2882b96SRiku Voipio#include <sys/eventfd.h> 2291c2882b96SRiku Voipio 2292c2882b96SRiku Voipioint main(void) 2293c2882b96SRiku Voipio{ 229455cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 2295c2882b96SRiku Voipio} 2296c2882b96SRiku VoipioEOF 2297c2882b96SRiku Voipioif compile_prog "" "" ; then 2298c2882b96SRiku Voipio eventfd=yes 2299c2882b96SRiku Voipiofi 2300c2882b96SRiku Voipio 2301d0927938SUlrich Hecht# check for fallocate 2302d0927938SUlrich Hechtfallocate=no 2303d0927938SUlrich Hechtcat > $TMPC << EOF 2304d0927938SUlrich Hecht#include <fcntl.h> 2305d0927938SUlrich Hecht 2306d0927938SUlrich Hechtint main(void) 2307d0927938SUlrich Hecht{ 2308d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2309d0927938SUlrich Hecht return 0; 2310d0927938SUlrich Hecht} 2311d0927938SUlrich HechtEOF 2312be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2313d0927938SUlrich Hecht fallocate=yes 2314d0927938SUlrich Hechtfi 2315d0927938SUlrich Hecht 2316c727f47dSPeter Maydell# check for sync_file_range 2317c727f47dSPeter Maydellsync_file_range=no 2318c727f47dSPeter Maydellcat > $TMPC << EOF 2319c727f47dSPeter Maydell#include <fcntl.h> 2320c727f47dSPeter Maydell 2321c727f47dSPeter Maydellint main(void) 2322c727f47dSPeter Maydell{ 2323c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2324c727f47dSPeter Maydell return 0; 2325c727f47dSPeter Maydell} 2326c727f47dSPeter MaydellEOF 2327c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2328c727f47dSPeter Maydell sync_file_range=yes 2329c727f47dSPeter Maydellfi 2330c727f47dSPeter Maydell 2331dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2332dace20dcSPeter Maydellfiemap=no 2333dace20dcSPeter Maydellcat > $TMPC << EOF 2334dace20dcSPeter Maydell#include <sys/ioctl.h> 2335dace20dcSPeter Maydell#include <linux/fs.h> 2336dace20dcSPeter Maydell#include <linux/fiemap.h> 2337dace20dcSPeter Maydell 2338dace20dcSPeter Maydellint main(void) 2339dace20dcSPeter Maydell{ 2340dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2341dace20dcSPeter Maydell return 0; 2342dace20dcSPeter Maydell} 2343dace20dcSPeter MaydellEOF 2344dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2345dace20dcSPeter Maydell fiemap=yes 2346dace20dcSPeter Maydellfi 2347dace20dcSPeter Maydell 2348d0927938SUlrich Hecht# check for dup3 2349d0927938SUlrich Hechtdup3=no 2350d0927938SUlrich Hechtcat > $TMPC << EOF 2351d0927938SUlrich Hecht#include <unistd.h> 2352d0927938SUlrich Hecht 2353d0927938SUlrich Hechtint main(void) 2354d0927938SUlrich Hecht{ 2355d0927938SUlrich Hecht dup3(0, 0, 0); 2356d0927938SUlrich Hecht return 0; 2357d0927938SUlrich Hecht} 2358d0927938SUlrich HechtEOF 235978f5d726SJan Kiszkaif compile_prog "" "" ; then 2360d0927938SUlrich Hecht dup3=yes 2361d0927938SUlrich Hechtfi 2362d0927938SUlrich Hecht 23633b6edd16SPeter Maydell# check for epoll support 23643b6edd16SPeter Maydellepoll=no 23653b6edd16SPeter Maydellcat > $TMPC << EOF 23663b6edd16SPeter Maydell#include <sys/epoll.h> 23673b6edd16SPeter Maydell 23683b6edd16SPeter Maydellint main(void) 23693b6edd16SPeter Maydell{ 23703b6edd16SPeter Maydell epoll_create(0); 23713b6edd16SPeter Maydell return 0; 23723b6edd16SPeter Maydell} 23733b6edd16SPeter MaydellEOF 23743b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 23753b6edd16SPeter Maydell epoll=yes 23763b6edd16SPeter Maydellfi 23773b6edd16SPeter Maydell 23783b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 23793b6edd16SPeter Maydell# so we must check separately for their presence 23803b6edd16SPeter Maydellepoll_create1=no 23813b6edd16SPeter Maydellcat > $TMPC << EOF 23823b6edd16SPeter Maydell#include <sys/epoll.h> 23833b6edd16SPeter Maydell 23843b6edd16SPeter Maydellint main(void) 23853b6edd16SPeter Maydell{ 238619e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 238719e83f6bSPeter Maydell * a function being called. This is necessary so that on 238819e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 238919e83f6bSPeter Maydell * the library but not declared in the header file we will 239019e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 239119e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 239219e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 239319e83f6bSPeter Maydell */ 239484972cbbSStefan Weil return epoll_create1 == epoll_create1; 23953b6edd16SPeter Maydell} 23963b6edd16SPeter MaydellEOF 23973b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 23983b6edd16SPeter Maydell epoll_create1=yes 23993b6edd16SPeter Maydellfi 24003b6edd16SPeter Maydell 24013b6edd16SPeter Maydellepoll_pwait=no 24023b6edd16SPeter Maydellcat > $TMPC << EOF 24033b6edd16SPeter Maydell#include <sys/epoll.h> 24043b6edd16SPeter Maydell 24053b6edd16SPeter Maydellint main(void) 24063b6edd16SPeter Maydell{ 24073b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 24083b6edd16SPeter Maydell return 0; 24093b6edd16SPeter Maydell} 24103b6edd16SPeter MaydellEOF 24113b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24123b6edd16SPeter Maydell epoll_pwait=yes 24133b6edd16SPeter Maydellfi 24143b6edd16SPeter Maydell 2415cc8ae6deSpbrook# Check if tools are available to build documentation. 2416a25dba17SJuan Quintelaif test "$docs" != "no" ; then 241701668d98SStefan Weil if has makeinfo && has pod2man; then 2418a25dba17SJuan Quintela docs=yes 241983a3ab8bSJuan Quintela else 2420a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2421a25dba17SJuan Quintela feature_not_found "docs" 242283a3ab8bSJuan Quintela fi 2423a25dba17SJuan Quintela docs=no 242483a3ab8bSJuan Quintela fi 2425cc8ae6deSpbrookfi 2426cc8ae6deSpbrook 2427f514f41cSStefan Weil# Search for bswap_32 function 24286ae9a1f4SJuan Quintelabyteswap_h=no 24296ae9a1f4SJuan Quintelacat > $TMPC << EOF 24306ae9a1f4SJuan Quintela#include <byteswap.h> 24316ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 24326ae9a1f4SJuan QuintelaEOF 243352166aa0SJuan Quintelaif compile_prog "" "" ; then 24346ae9a1f4SJuan Quintela byteswap_h=yes 24356ae9a1f4SJuan Quintelafi 24366ae9a1f4SJuan Quintela 2437f514f41cSStefan Weil# Search for bswap_32 function 24386ae9a1f4SJuan Quintelabswap_h=no 24396ae9a1f4SJuan Quintelacat > $TMPC << EOF 24406ae9a1f4SJuan Quintela#include <sys/endian.h> 24416ae9a1f4SJuan Quintela#include <sys/types.h> 24426ae9a1f4SJuan Quintela#include <machine/bswap.h> 24436ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 24446ae9a1f4SJuan QuintelaEOF 244552166aa0SJuan Quintelaif compile_prog "" "" ; then 24466ae9a1f4SJuan Quintela bswap_h=yes 24476ae9a1f4SJuan Quintelafi 24486ae9a1f4SJuan Quintela 2449da93a1fdSaliguori########################################## 2450c589b249SRonnie Sahlberg# Do we have libiscsi 2451c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 2452c589b249SRonnie Sahlberg cat > $TMPC << EOF 2453c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 2454c589b249SRonnie Sahlbergint main(void) { iscsi_create_context(""); return 0; } 2455c589b249SRonnie SahlbergEOF 2456c589b249SRonnie Sahlberg if compile_prog "-Werror" "-liscsi" ; then 2457c589b249SRonnie Sahlberg libiscsi="yes" 2458c589b249SRonnie Sahlberg LIBS="$LIBS -liscsi" 2459c589b249SRonnie Sahlberg else 2460c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 2461c589b249SRonnie Sahlberg feature_not_found "libiscsi" 2462c589b249SRonnie Sahlberg fi 2463c589b249SRonnie Sahlberg libiscsi="no" 2464c589b249SRonnie Sahlberg fi 2465c589b249SRonnie Sahlbergfi 2466c589b249SRonnie Sahlberg 2467c589b249SRonnie Sahlberg 2468c589b249SRonnie Sahlberg########################################## 2469da93a1fdSaliguori# Do we need librt 2470da93a1fdSaliguoricat > $TMPC <<EOF 2471da93a1fdSaliguori#include <signal.h> 2472da93a1fdSaliguori#include <time.h> 247366ea0f22SStefan Weilint main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } 2474da93a1fdSaliguoriEOF 2475da93a1fdSaliguori 247652166aa0SJuan Quintelaif compile_prog "" "" ; then 247707ffa4bdSJuan Quintela : 247852166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 247907ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2480da93a1fdSaliguorifi 2481da93a1fdSaliguori 248231ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2483179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 24846362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 24856362a53fSJuan Quintelafi 24866362a53fSJuan Quintela 2487de5071c5SBlue Swirl########################################## 2488de5071c5SBlue Swirl# check if the compiler defines offsetof 2489de5071c5SBlue Swirl 2490de5071c5SBlue Swirlneed_offsetof=yes 2491de5071c5SBlue Swirlcat > $TMPC << EOF 2492de5071c5SBlue Swirl#include <stddef.h> 2493de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2494de5071c5SBlue SwirlEOF 2495de5071c5SBlue Swirlif compile_prog "" "" ; then 2496de5071c5SBlue Swirl need_offsetof=no 2497de5071c5SBlue Swirlfi 2498de5071c5SBlue Swirl 2499cd4ec0b4SGerd Hoffmann# spice probe 2500cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2501cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2502cd4ec0b4SGerd Hoffmann#include <spice.h> 2503cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2504cd4ec0b4SGerd HoffmannEOF 2505710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2506710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 2507012b80d3SGerd Hoffmann if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \ 2508cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2509cd4ec0b4SGerd Hoffmann spice="yes" 2510cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2511cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2512cd4ec0b4SGerd Hoffmann else 2513cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2514cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2515cd4ec0b4SGerd Hoffmann fi 2516cd4ec0b4SGerd Hoffmann spice="no" 2517cd4ec0b4SGerd Hoffmann fi 2518cd4ec0b4SGerd Hoffmannfi 2519cd4ec0b4SGerd Hoffmann 2520111a38b0SRobert Relyea# check for libcacard for smartcard support 2521111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2522111a38b0SRobert Relyea smartcard="yes" 2523111a38b0SRobert Relyea smartcard_cflags="" 2524111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2525111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 2526111a38b0SRobert Relyea if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then 2527111a38b0SRobert Relyea smartcard_nss="yes" 2528111a38b0SRobert Relyea smartcard_cflags="-I\$(SRC_PATH)/libcacard" 2529111a38b0SRobert Relyea libcacard_libs=$($pkg_config --libs nss 2>/dev/null) 2530111a38b0SRobert Relyea libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null) 2531111a38b0SRobert Relyea QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" 2532111a38b0SRobert Relyea LIBS="$libcacard_libs $LIBS" 2533111a38b0SRobert Relyea else 2534111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2535111a38b0SRobert Relyea feature_not_found "nss" 2536111a38b0SRobert Relyea fi 2537111a38b0SRobert Relyea smartcard_nss="no" 2538111a38b0SRobert Relyea fi 2539111a38b0SRobert Relyea fi 2540111a38b0SRobert Relyeafi 2541111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2542111a38b0SRobert Relyea smartcard_nss="no" 2543111a38b0SRobert Relyeafi 2544111a38b0SRobert Relyea 254569354a83SHans de Goede# check for usbredirparser for usb network redirection support 254669354a83SHans de Goedeif test "$usb_redir" != "no" ; then 254769354a83SHans de Goede if $pkg_config libusbredirparser >/dev/null 2>&1 ; then 254869354a83SHans de Goede usb_redir="yes" 254969354a83SHans de Goede usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) 255069354a83SHans de Goede usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null) 255169354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 255269354a83SHans de Goede LIBS="$LIBS $usb_redir_libs" 255369354a83SHans de Goede else 255469354a83SHans de Goede if test "$usb_redir" = "yes"; then 255569354a83SHans de Goede feature_not_found "usb-redir" 255669354a83SHans de Goede fi 255769354a83SHans de Goede usb_redir="no" 255869354a83SHans de Goede fi 255969354a83SHans de Goedefi 256069354a83SHans de Goede 2561cd4ec0b4SGerd Hoffmann########################################## 2562cd4ec0b4SGerd Hoffmann 2563747bbdf7SBlue Swirl########################################## 25645f6b9e8fSBlue Swirl# check if we have fdatasync 25655f6b9e8fSBlue Swirl 25665f6b9e8fSBlue Swirlfdatasync=no 25675f6b9e8fSBlue Swirlcat > $TMPC << EOF 25685f6b9e8fSBlue Swirl#include <unistd.h> 2569d1722a27SAlexandre Raymondint main(void) { 2570d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2571d1722a27SAlexandre Raymondreturn fdatasync(0); 2572d1722a27SAlexandre Raymond#else 2573d1722a27SAlexandre Raymond#abort Not supported 2574d1722a27SAlexandre Raymond#endif 2575d1722a27SAlexandre Raymond} 25765f6b9e8fSBlue SwirlEOF 25775f6b9e8fSBlue Swirlif compile_prog "" "" ; then 25785f6b9e8fSBlue Swirl fdatasync=yes 25795f6b9e8fSBlue Swirlfi 25805f6b9e8fSBlue Swirl 258194a420b1SStefan Hajnoczi########################################## 2582e78815a5SAndreas Färber# check if we have madvise 2583e78815a5SAndreas Färber 2584e78815a5SAndreas Färbermadvise=no 2585e78815a5SAndreas Färbercat > $TMPC << EOF 2586e78815a5SAndreas Färber#include <sys/types.h> 2587e78815a5SAndreas Färber#include <sys/mman.h> 2588832ce9c2SScott Wood#include <stddef.h> 2589e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2590e78815a5SAndreas FärberEOF 2591e78815a5SAndreas Färberif compile_prog "" "" ; then 2592e78815a5SAndreas Färber madvise=yes 2593e78815a5SAndreas Färberfi 2594e78815a5SAndreas Färber 2595e78815a5SAndreas Färber########################################## 2596e78815a5SAndreas Färber# check if we have posix_madvise 2597e78815a5SAndreas Färber 2598e78815a5SAndreas Färberposix_madvise=no 2599e78815a5SAndreas Färbercat > $TMPC << EOF 2600e78815a5SAndreas Färber#include <sys/mman.h> 2601832ce9c2SScott Wood#include <stddef.h> 2602e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2603e78815a5SAndreas FärberEOF 2604e78815a5SAndreas Färberif compile_prog "" "" ; then 2605e78815a5SAndreas Färber posix_madvise=yes 2606e78815a5SAndreas Färberfi 2607e78815a5SAndreas Färber 2608e78815a5SAndreas Färber########################################## 260994a420b1SStefan Hajnoczi# check if trace backend exists 261094a420b1SStefan Hajnoczi 26114c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 261294a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 261394a420b1SStefan Hajnoczi echo 261494a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 261594a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 261694a420b1SStefan Hajnoczi echo 261794a420b1SStefan Hajnoczi exit 1 261894a420b1SStefan Hajnoczifi 261994a420b1SStefan Hajnoczi 26207e24e92aSStefan Hajnoczi########################################## 26217e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 26227e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 26237e24e92aSStefan Hajnoczi cat > $TMPC << EOF 26247e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 26257e24e92aSStefan Hajnoczi#include <ust/marker.h> 26267e24e92aSStefan Hajnocziint main(void) { return 0; } 26277e24e92aSStefan HajnocziEOF 26287e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 26297e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 26307e24e92aSStefan Hajnoczi else 26317e24e92aSStefan Hajnoczi echo 26327e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 26337e24e92aSStefan Hajnoczi echo 26347e24e92aSStefan Hajnoczi exit 1 26357e24e92aSStefan Hajnoczi fi 26367e24e92aSStefan Hajnoczifi 2637b3d08c02SDaniel P. Berrange 2638b3d08c02SDaniel P. Berrange########################################## 2639b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2640b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2641b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2642b3d08c02SDaniel P. Berrange echo 2643b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2644b3d08c02SDaniel P. Berrange echo 2645b3d08c02SDaniel P. Berrange exit 1 2646b3d08c02SDaniel P. Berrange fi 2647c276b17dSDaniel P. Berrange trace_backend_stap="no" 2648c276b17dSDaniel P. Berrange if has 'stap' ; then 2649c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2650c276b17dSDaniel P. Berrange fi 2651b3d08c02SDaniel P. Berrangefi 2652b3d08c02SDaniel P. Berrange 26537e24e92aSStefan Hajnoczi########################################## 2654023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2655023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit 2656023367e6SWolfgang Mauerer# specification is necessary 26571ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then 2658023367e6SWolfgang Mauerer cat > $TMPC << EOF 2659023367e6SWolfgang Mauererint sfaa(unsigned *ptr) 2660023367e6SWolfgang Mauerer{ 2661023367e6SWolfgang Mauerer return __sync_fetch_and_and(ptr, 0); 2662023367e6SWolfgang Mauerer} 2663023367e6SWolfgang Mauerer 2664023367e6SWolfgang Mauererint main(int argc, char **argv) 2665023367e6SWolfgang Mauerer{ 2666023367e6SWolfgang Mauerer int val = 42; 2667023367e6SWolfgang Mauerer sfaa(&val); 2668023367e6SWolfgang Mauerer return val; 2669023367e6SWolfgang Mauerer} 2670023367e6SWolfgang MauererEOF 2671023367e6SWolfgang Mauerer if ! compile_prog "" "" ; then 2672023367e6SWolfgang Mauerer CFLAGS+="-march=i486" 2673023367e6SWolfgang Mauerer fi 2674023367e6SWolfgang Mauererfi 2675023367e6SWolfgang Mauerer 2676023367e6SWolfgang Mauerer########################################## 2677d0e2fce5SAneesh Kumar K.V# check if we have makecontext 2678d0e2fce5SAneesh Kumar K.V 2679d0e2fce5SAneesh Kumar K.Vucontext_coroutine=no 2680d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 2681d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2682d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 268375cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2684d0e2fce5SAneesh Kumar K.VEOF 2685d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 2686d0e2fce5SAneesh Kumar K.V ucontext_coroutine=yes 2687d0e2fce5SAneesh Kumar K.V fi 2688d0e2fce5SAneesh Kumar K.Vfi 2689d0e2fce5SAneesh Kumar K.V 2690d0e2fce5SAneesh Kumar K.V########################################## 2691d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 2692d2042378SAneesh Kumar K.V 2693d2042378SAneesh Kumar K.Vopen_by_hande_at=no 2694d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 2695d2042378SAneesh Kumar K.V#include <fcntl.h> 269675cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 2697d2042378SAneesh Kumar K.VEOF 2698d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 2699d2042378SAneesh Kumar K.V open_by_handle_at=yes 2700d2042378SAneesh Kumar K.Vfi 2701d2042378SAneesh Kumar K.V 2702e06a765eSHarsh Prateek Bora######################################## 2703e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 2704e06a765eSHarsh Prateek Bora 2705e06a765eSHarsh Prateek Boralinux_magic_h=no 2706e06a765eSHarsh Prateek Boracat > $TMPC << EOF 2707e06a765eSHarsh Prateek Bora#include <linux/magic.h> 2708e06a765eSHarsh Prateek Boraint main(void) { 270975cafad7SStefan Weil return 0; 2710e06a765eSHarsh Prateek Bora} 2711e06a765eSHarsh Prateek BoraEOF 2712e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 2713e06a765eSHarsh Prateek Bora linux_magic_h=yes 2714e06a765eSHarsh Prateek Borafi 2715e06a765eSHarsh Prateek Bora 2716d2042378SAneesh Kumar K.V########################################## 2717e86ecd4bSJuan Quintela# End of CC checks 2718e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2719e86ecd4bSJuan Quintela 2720e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 27211156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2722e86ecd4bSJuan Quintelafi 2723a316e378SJuan Quintela 2724e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2725e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2726e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 272720ff6c80SAnthony Liguori 272820ff6c80SAnthony Liguoriif test -z "$werror" ; then 2729e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2730e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2731e86ecd4bSJuan Quintela werror="yes" 2732e86ecd4bSJuan Quintela else 2733e86ecd4bSJuan Quintela werror="no" 2734e86ecd4bSJuan Quintela fi 2735e86ecd4bSJuan Quintelafi 2736e86ecd4bSJuan Quintela 273720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 273820ff6c80SAnthony Liguori# enable/disable 273920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 274020ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 274120ff6c80SAnthony Liguori zero_malloc="no" 274220ff6c80SAnthony Liguori else 274320ff6c80SAnthony Liguori zero_malloc="yes" 274420ff6c80SAnthony Liguori fi 274520ff6c80SAnthony Liguorifi 274620ff6c80SAnthony Liguori 2747e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2748a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2749e86ecd4bSJuan Quintelafi 2750e86ecd4bSJuan Quintela 2751e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2752e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 27531156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2754e86ecd4bSJuan Quintela fi 2755e86ecd4bSJuan Quintelafi 2756e86ecd4bSJuan Quintela 2757952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2758952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2759952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2760952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2761952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2762952afb71SBlue Swirl fi 2763952afb71SBlue Swirl done 2764952afb71SBlue Swirlfi 2765952afb71SBlue Swirl 2766190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 27675a67135aSbellard 2768ca35f780SPaolo Bonzinitools= 2769ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2770ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 277117bff52bSM. Mohan Kumar if [ "$cap" = "yes" -a "$linux" = "yes" ] ; then 277217bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 277317bff52bSM. Mohan Kumar fi 2774ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2775ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2776d138cee9SMichael Roth if [ "$guest_agent" = "yes" ]; then 277748ff7a62SMichael Roth tools="qemu-ga\$(EXESUF) $tools" 2778d138cee9SMichael Roth fi 2779ca35f780SPaolo Bonzini fi 2780ca35f780SPaolo Bonzinifi 2781ca35f780SPaolo Bonzini 2782ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2783ca35f780SPaolo Bonziniroms= 2784ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2785ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2786ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2787ca35f780SPaolo Bonzini roms="optionrom" 2788ca35f780SPaolo Bonzinifi 2789d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 279039ac8455SDavid Gibson roms="$roms spapr-rtas" 279139ac8455SDavid Gibsonfi 2792ca35f780SPaolo Bonzini 27937d13299dSbellardecho "Install prefix $prefix" 2794f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2795f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 27963aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 27970f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 27981c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 279911d9f695Sbellardif test "$mingw32" = "no" ; then 2800f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 280143ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 280211d9f695Sbellardfi 28035a67135aSbellardecho "Source path $source_path" 28047d13299dSbellardecho "C compiler $cc" 280583469015Sbellardecho "Host C compiler $host_cc" 28060c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2807a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 28080c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 28097d13299dSbellardecho "make $make" 28106a882643Spbrookecho "install $install" 2811c886edfbSBlue Swirlecho "python $python" 2812e2d8830eSBradif test "$slirp" = "yes" ; then 2813e2d8830eSBrad echo "smbd $smbd" 2814e2d8830eSBradfi 2815a98fd896Sbellardecho "host CPU $cpu" 2816de83cd02Sbellardecho "host big endian $bigendian" 281797a847bcSbellardecho "target list $target_list" 2818ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2819b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 28207d13299dSbellardecho "gprof enabled $gprof" 282103b4fe7dSaliguoriecho "sparse enabled $sparse" 28221625af87Saliguoriecho "strip binaries $strip_opt" 282305c2a3e7Sbellardecho "profiler $profiler" 282443ce4dfeSbellardecho "static build $static" 282585aa5189Sbellardecho "-Werror enabled $werror" 28265b0753e0Sbellardif test "$darwin" = "yes" ; then 28275b0753e0Sbellard echo "Cocoa support $cocoa" 28285b0753e0Sbellardfi 282997a847bcSbellardecho "SDL support $sdl" 28304d3b6f6eSbalrogecho "curses support $curses" 2831769ce76dSAlexander Grafecho "curl support $curl" 283267b915a5Sbellardecho "mingw32 support $mingw32" 28330c58ac1cSmalcecho "Audio drivers $audio_drv_list" 28340c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2835eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 28368ff9cbf7Smalcecho "Mixer emulation $mixemu" 2837821601eaSJes Sorensenecho "VNC support $vnc" 2838821601eaSJes Sorensenif test "$vnc" = "yes" ; then 28398d5d2d4cSths echo "VNC TLS support $vnc_tls" 28402f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 28412f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 2842efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 2843bd023f95SCorentin Chary echo "VNC thread $vnc_thread" 2844821601eaSJes Sorensenfi 28453142255cSblueswir1if test -n "$sparc_cpu"; then 28463142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 28473142255cSblueswir1fi 2848e37630caSaliguoriecho "xen support $xen" 28492e4d9fb1Saurel32echo "brlapi support $brlapi" 2850a20a6f46SJuan Quintelaecho "bluez support $bluez" 2851a25dba17SJuan Quintelaecho "Documentation $docs" 2852c5937220Spbrook[ ! -z "$uname_release" ] && \ 2853c5937220Spbrookecho "uname -r $uname_release" 2854bd0c5661Spbrookecho "NPTL support $nptl" 2855379f6698SPaul Brookecho "GUEST_BASE $guest_base" 285640d6444eSAvi Kivityecho "PIE $pie" 28578a16d273Sthsecho "vde support $vde" 28585c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2859758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 286077755340Sthsecho "Install blobs $blobs" 2861b31a0277SJuan Quintelaecho "KVM support $kvm" 28629195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 2863f652e6afSaurel32echo "fdt support $fdt" 2864ceb42de8Saliguoriecho "preadv support $preadv" 28655f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2866e78815a5SAndreas Färberecho "madvise $madvise" 2867e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2868ee682d27SStefan Weilecho "uuid support $uuid" 2869d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 287094a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 28719410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2872cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2873f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2874dce512deSChristoph Hellwigecho "xfsctl support $xfs" 2875111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 287669354a83SHans de Goedeecho "usb net redir $usb_redir" 287720ff075bSMichael Walleecho "OpenGL support $opengl" 2878c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 2879d138cee9SMichael Rothecho "build guest agent $guest_agent" 288067b915a5Sbellard 28811ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 288224b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2883e8cd23deSbellardfi 288497a847bcSbellard 288598ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 28864bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 288797a847bcSbellard 288898ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 288998ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 289098ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 289198ec69acSJuan Quintelaecho >> $config_host_mak 289298ec69acSJuan Quintela 2893e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 289499d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 289599d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 28963aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 28970f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 289899d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 289999d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 290099d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 290199d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 29021dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2903804edf29SJuan Quintela 290498ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2905f8393946Saurel32if test "$debug_tcg" = "yes" ; then 29062358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2907f8393946Saurel32fi 2908b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2909b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2910b4475aa2SLuiz Capitulinofi 2911f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 29122358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2913f3d08ee6SPaul Brookfi 29141625af87Saliguoriif test "$strip_opt" = "yes" ; then 291552ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 29161625af87Saliguorifi 29177d13299dSbellardif test "$bigendian" = "yes" ; then 2918e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 291997a847bcSbellardfi 29202358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 292167b915a5Sbellardif test "$mingw32" = "yes" ; then 292298ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 29239fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 29249fe6de94SBlue Swirl version_major=${rc_version%%.*} 29259fe6de94SBlue Swirl rc_version=${rc_version#*.} 29269fe6de94SBlue Swirl version_minor=${rc_version%%.*} 29279fe6de94SBlue Swirl rc_version=${rc_version#*.} 29289fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 29299fe6de94SBlue Swirl version_micro=0 29309fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 29319fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2932210fa556Spbrookelse 293335f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2934210fa556Spbrookfi 2935128ab2ffSblueswir1 2936dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2937dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2938dffcb71cSMark McLoughlinfi 2939dffcb71cSMark McLoughlin 294083fb7adfSbellardif test "$darwin" = "yes" ; then 294198ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 294283fb7adfSbellardfi 2943b29fe3edSmalc 2944b29fe3edSmalcif test "$aix" = "yes" ; then 294598ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2946b29fe3edSmalcfi 2947b29fe3edSmalc 2948ec530c81Sbellardif test "$solaris" = "yes" ; then 294998ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 29502358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 29510475a5caSths if test "$needs_libsunmath" = "yes" ; then 295275b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 29530475a5caSths fi 2954ec530c81Sbellardfi 2955179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2956179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2957179cf400SAndreas Färberfi 295897a847bcSbellardif test "$static" = "yes" ; then 295998ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 296097a847bcSbellardfi 29611ba16968SStefan Weilif test "$profiler" = "yes" ; then 29622358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 296305c2a3e7Sbellardfi 2964c20709aaSbellardif test "$slirp" = "yes" ; then 296598ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2966e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 2967f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 2968c20709aaSbellardfi 29698a16d273Sthsif test "$vde" = "yes" ; then 297098ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 29718a16d273Sthsfi 29720c58ac1cSmalcfor card in $audio_card_list; do 2973f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 297498ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 29750c58ac1cSmalcdone 29762358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 29770c58ac1cSmalcfor drv in $audio_drv_list; do 2978f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 297998ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2980923e4521Smalc if test "$drv" = "fmod"; then 29817aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2982fb065187Sbellard fi 29830c58ac1cSmalcdone 298467f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 298567f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 298667f86e8eSJuan Quintelafi 2987d5631638Smalcif test "$audio_win_int" = "yes" ; then 2988d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2989d5631638Smalcfi 2990eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 29918ff9cbf7Smalcif test "$mixemu" = "yes" ; then 299298ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 29938ff9cbf7Smalcfi 2994821601eaSJes Sorensenif test "$vnc" = "yes" ; then 2995821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 2996821601eaSJes Sorensenfi 29978d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 299898ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2999525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 30008d5d2d4cSthsfi 30012f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 300298ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 300360ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 30042f9606b3Saliguorifi 3005821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 30062f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 30072f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 30082f6f5c7aSCorentin Charyfi 3009821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 3010efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 3011efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 3012efe556adSCorentin Charyfi 3013821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then 3014bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 3015bd023f95SCorentin Charyfi 301676655d6dSaliguoriif test "$fnmatch" = "yes" ; then 30172358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 301876655d6dSaliguorifi 3019ee682d27SStefan Weilif test "$uuid" = "yes" ; then 3020ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 3021ee682d27SStefan Weilfi 3022dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3023dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3024dce512deSChristoph Hellwigfi 3025b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 302698ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 30272358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 302898ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 302998ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 3030a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 303198ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 3032cc8ae6deSpbrookfi 30331ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 303498ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 30358ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 303649ecc3faSbellardfi 303749ecc3faSbellardif test "$cocoa" = "yes" ; then 303898ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 303949ecc3faSbellardfi 30404d3b6f6eSbalrogif test "$curses" = "yes" ; then 304198ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 3042ab4e5602SJan Kiszkafi 30433b3f24adSaurel32if test "$atfile" = "yes" ; then 30442358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 30453b3f24adSaurel32fi 3046ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 30472358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 3048ebc996f3SRiku Voipiofi 3049099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 30502358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 3051099d6b0fSRiku Voipiofi 305240ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 305340ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 305440ff6d7eSKevin Wolffi 30553ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 30562358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 30573ce34dfbSvibisreenivasanfi 3058c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 3059c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 3060c2882b96SRiku Voipiofi 3061d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 3062d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 3063d0927938SUlrich Hechtfi 3064c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 3065c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 3066c727f47dSPeter Maydellfi 3067dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 3068dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 3069dace20dcSPeter Maydellfi 3070d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 3071d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 3072d0927938SUlrich Hechtfi 30733b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 30743b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 30753b6edd16SPeter Maydellfi 30763b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 30773b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 30783b6edd16SPeter Maydellfi 30793b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 30803b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 30813b6edd16SPeter Maydellfi 30823b3f24adSaurel32if test "$inotify" = "yes" ; then 30832358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 30843b3f24adSaurel32fi 3085c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 3086c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 3087c05c7a73SRiku Voipiofi 30886ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 30896ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 30906ae9a1f4SJuan Quintelafi 30916ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 30926ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 30936ae9a1f4SJuan Quintelafi 3094769ce76dSAlexander Grafif test "$curl" = "yes" ; then 309598ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 3096b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 3097769ce76dSAlexander Graffi 30982e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 309998ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 31002e4d9fb1Saurel32fi 3101fb599c9aSbalrogif test "$bluez" = "yes" ; then 310298ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 3103ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 3104fb599c9aSbalrogfi 3105e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3106e37630caSaliguoriif test "$xen" = "yes" ; then 31076dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3108d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3109e37630caSaliguorifi 31105c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 31115c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 31125c6c3a6cSChristoph Hellwigfi 3113758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 3114758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 3115758e8e38SVenkateswararao Jujjuri (JV)fi 31164f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 31174f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 31184f26f2b6SAvi Kivityfi 3119758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 3120758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 3121758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 3122758e8e38SVenkateswararao Jujjuri (JV) fi 3123758e8e38SVenkateswararao Jujjuri (JV)fi 312477755340Sthsif test "$blobs" = "yes" ; then 312598ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 312677755340Sthsfi 3127bf9298b9Saliguoriif test "$iovec" = "yes" ; then 31282358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 3129bf9298b9Saliguorifi 3130ceb42de8Saliguoriif test "$preadv" = "yes" ; then 31312358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 3132ceb42de8Saliguorifi 3133f652e6afSaurel32if test "$fdt" = "yes" ; then 31343f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 3135f652e6afSaurel32fi 3136dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 3137dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 3138dcc38d1cSMarcelo Tosattifi 31399195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 31409195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 31419195b2c2SStefan Weilfi 3142de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 3143de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 3144de5071c5SBlue Swirlfi 31455f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 31465f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 31475f6b9e8fSBlue Swirlfi 3148e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 3149e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 3150e78815a5SAndreas Färberfi 3151e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 3152e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 3153e78815a5SAndreas Färberfi 315497a847bcSbellard 3155cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 3156cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 3157cd4ec0b4SGerd Hoffmannfi 3158cd4ec0b4SGerd Hoffmann 315936707144SAlon Levyif test "$smartcard" = "yes" ; then 316036707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 316136707144SAlon Levyfi 316236707144SAlon Levy 3163111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3164111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 3165111a38b0SRobert Relyeafi 3166111a38b0SRobert Relyea 316769354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 316869354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 316969354a83SHans de Goedefi 317069354a83SHans de Goede 317120ff075bSMichael Walleif test "$opengl" = "yes" ; then 317220ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 317320ff075bSMichael Wallefi 317420ff075bSMichael Walle 3175c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 3176c589b249SRonnie Sahlberg echo "CONFIG_LIBISCSI=y" >> $config_host_mak 3177c589b249SRonnie Sahlbergfi 3178c589b249SRonnie Sahlberg 317983fb7adfSbellard# XXX: suppress that 31807d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 31812358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 31827d3505c5Sbellardfi 31837d3505c5Sbellard 31842358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 3185c5937220Spbrook 318620ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 318720ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 318820ff6c80SAnthony Liguorifi 3189f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 3190f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 3191f27aaf4bSChristian Brunnerfi 319220ff6c80SAnthony Liguori 3193d0e2fce5SAneesh Kumar K.Vif test "$ucontext_coroutine" = "yes" ; then 3194d0e2fce5SAneesh Kumar K.V echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak 3195d0e2fce5SAneesh Kumar K.Vfi 3196d0e2fce5SAneesh Kumar K.V 3197d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 3198d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 3199d2042378SAneesh Kumar K.Vfi 3200d2042378SAneesh Kumar K.V 3201e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 3202e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 3203e06a765eSHarsh Prateek Borafi 3204e06a765eSHarsh Prateek Bora 320568063649Sblueswir1# USB host support 320668063649Sblueswir1case "$usb" in 320768063649Sblueswir1linux) 320898ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 320968063649Sblueswir1;; 321068063649Sblueswir1bsd) 321198ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 321268063649Sblueswir1;; 321368063649Sblueswir1*) 321498ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 321568063649Sblueswir1;; 321668063649Sblueswir1esac 321768063649Sblueswir1 3218e4858974SLluís# use default implementation for tracing backend-specific routines 3219e4858974SLluístrace_default=yes 322094a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 32216d8a764eSLluísif test "$trace_backend" = "nop"; then 32226d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 322322890ab5SPrerna Saxenafi 32249410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 32256d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 3226e4858974SLluís trace_default=no 32276d8a764eSLluís # Set the appropriate trace file. 3228953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 32299410b56cSPrerna Saxenafi 32306d8a764eSLluísif test "$trace_backend" = "stderr"; then 32316d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 32329a82b6a5SLluís trace_default=no 32336d8a764eSLluísfi 32346d8a764eSLluísif test "$trace_backend" = "ust"; then 32356d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 32366d8a764eSLluísfi 32376d8a764eSLluísif test "$trace_backend" = "dtrace"; then 32386d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 32396d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 32406d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 32416d8a764eSLluís fi 3242c276b17dSDaniel P. Berrangefi 32439410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 3244e4858974SLluísif test "$trace_default" = "yes"; then 3245e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 3246e4858974SLluísfi 32479410b56cSPrerna Saxena 324898ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 324998ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3250804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3251804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 32521901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 32531901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 32541901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 3255c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 3256804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 32572b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 3258804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 3259804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3260804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3261804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 32629fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 326344dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 3264e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 3265a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 3266f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 3267e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 3268e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 3269e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 3270e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 3271e39f0062SPaolo Bonzinifi 3272c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 3273e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 3274a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 3275a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 327673da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 32773e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 3278804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3279957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 3280804edf29SJuan Quintela 32814bf6b55bSJuan Quintela# generate list of library paths for linker script 32824bf6b55bSJuan Quintela 32834bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 32844bf6b55bSJuan Quintela 32854bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 32864bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 32874bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 32884bf6b55bSJuan Quintela else 32894bf6b55bSJuan Quintela rm ${config_host_ld}~ 32904bf6b55bSJuan Quintela fi 32914bf6b55bSJuan Quintelafi 32924bf6b55bSJuan Quintela 32934d904533SBlue Swirlfor d in libdis libdis-user; do 32944d904533SBlue Swirl mkdir -p $d 329511568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 32964d904533SBlue Swirl echo > $d/config.mak 32974d904533SBlue Swirldone 32984d904533SBlue Swirl 32996efd7517SPeter Maydell# use included Linux headers 33006efd7517SPeter Maydellif test "$linux" = "yes" ; then 33016efd7517SPeter Maydell mkdir -p linux-headers 33026efd7517SPeter Maydell case "$cpu" in 33036efd7517SPeter Maydell i386|x86_64) 33046efd7517SPeter Maydell symlink $source_path/linux-headers/asm-x86 linux-headers/asm 33056efd7517SPeter Maydell ;; 33066efd7517SPeter Maydell ppcemb|ppc|ppc64) 33076efd7517SPeter Maydell symlink $source_path/linux-headers/asm-powerpc linux-headers/asm 33086efd7517SPeter Maydell ;; 33096efd7517SPeter Maydell s390x) 33106efd7517SPeter Maydell symlink $source_path/linux-headers/asm-s390 linux-headers/asm 33116efd7517SPeter Maydell ;; 33126efd7517SPeter Maydell esac 33136efd7517SPeter Maydellfi 33146efd7517SPeter Maydell 331597a847bcSbellardfor target in $target_list; do 331697a847bcSbellardtarget_dir="$target" 331725be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3318600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 331997a847bcSbellardtarget_bigendian="no" 33201f3d3c8fSJuan Quintela 3321ea2d6a39SJuan Quintelacase "$target_arch2" in 3322cfa550c6SMax Filippov armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 3323ea2d6a39SJuan Quintela target_bigendian=yes 3324ea2d6a39SJuan Quintela ;; 3325ea2d6a39SJuan Quintelaesac 332697a847bcSbellardtarget_softmmu="no" 3327997344f3Sbellardtarget_user_only="no" 3328831b7825Sthstarget_linux_user="no" 3329831b7825Sthstarget_darwin_user="no" 333084778508Sblueswir1target_bsd_user="no" 33319e407a85Spbrookcase "$target" in 3332600309b6SBlue Swirl ${target_arch2}-softmmu) 33339e407a85Spbrook target_softmmu="yes" 33349e407a85Spbrook ;; 3335600309b6SBlue Swirl ${target_arch2}-linux-user) 33369c7a4202SBlue Swirl if test "$linux" != "yes" ; then 33379c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 33389c7a4202SBlue Swirl exit 1 33399c7a4202SBlue Swirl fi 33409e407a85Spbrook target_user_only="yes" 33419e407a85Spbrook target_linux_user="yes" 33429e407a85Spbrook ;; 3343600309b6SBlue Swirl ${target_arch2}-darwin-user) 33449c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 33459c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 33469c7a4202SBlue Swirl exit 1 33479c7a4202SBlue Swirl fi 33489e407a85Spbrook target_user_only="yes" 3349831b7825Sths target_darwin_user="yes" 33509e407a85Spbrook ;; 3351600309b6SBlue Swirl ${target_arch2}-bsd-user) 33529cf55765SBlue Swirl if test "$bsd" != "yes" ; then 33539c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 33549c7a4202SBlue Swirl exit 1 33559c7a4202SBlue Swirl fi 335684778508Sblueswir1 target_user_only="yes" 335784778508Sblueswir1 target_bsd_user="yes" 335884778508Sblueswir1 ;; 33599e407a85Spbrook *) 33609e407a85Spbrook echo "ERROR: Target '$target' not recognised" 33619e407a85Spbrook exit 1 33629e407a85Spbrook ;; 33639e407a85Spbrookesac 3364831b7825Sths 336597a847bcSbellardmkdir -p $target_dir 3366158142c2Sbellardmkdir -p $target_dir/fpu 336757fec1feSbellardmkdir -p $target_dir/tcg 336859f2a787SGerd Hoffmannmkdir -p $target_dir/ide 3369353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs 33703b9a6ee5SJan Kiszkamkdir -p $target_dir/kvm 337184778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 337269de927cSbellard mkdir -p $target_dir/nwfpe 337369de927cSbellardfi 337411568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 3375ec530c81Sbellard 337697a847bcSbellard 337725be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 337897a847bcSbellard 3379e5fe0c52Spbrookbflt="no" 3380bd0c5661Spbrooktarget_nptl="no" 3381600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 338256aebc89Spbrookgdb_xml_files="" 3383c2e3dee6SLaurent Viviertarget_short_alignment=2 3384c2e3dee6SLaurent Viviertarget_int_alignment=4 3385c2e3dee6SLaurent Viviertarget_long_alignment=4 3386c2e3dee6SLaurent Viviertarget_llong_alignment=8 3387de3a354aSMichael Walletarget_libs_softmmu= 33887ba1e619Saliguori 3389938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 33906acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3391e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3392e73aae67SJuan Quintela 3393600309b6SBlue Swirlcase "$target_arch2" in 33942408a527Saurel32 i386) 339571deff27SAurelien Jarno target_phys_bits=64 33962408a527Saurel32 ;; 33972408a527Saurel32 x86_64) 33986acff7daSJuan Quintela TARGET_BASE_ARCH=i386 33991ad2134fSPaul Brook target_phys_bits=64 3400c2e3dee6SLaurent Vivier target_long_alignment=8 34012408a527Saurel32 ;; 34022408a527Saurel32 alpha) 34031ad2134fSPaul Brook target_phys_bits=64 3404c2e3dee6SLaurent Vivier target_long_alignment=8 3405a4b388ffSRichard Henderson target_nptl="yes" 34062408a527Saurel32 ;; 34072408a527Saurel32 arm|armeb) 3408b498c8a0SJuan Quintela TARGET_ARCH=arm 3409e5fe0c52Spbrook bflt="yes" 3410bd0c5661Spbrook target_nptl="yes" 341156aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 34121ad2134fSPaul Brook target_phys_bits=32 3413c2e3dee6SLaurent Vivier target_llong_alignment=4 34142408a527Saurel32 ;; 34152408a527Saurel32 cris) 3416253bd7f8Sedgar_igl target_nptl="yes" 34171ad2134fSPaul Brook target_phys_bits=32 34182408a527Saurel32 ;; 3419613a22c9SMichael Walle lm32) 3420613a22c9SMichael Walle target_phys_bits=32 3421de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3422613a22c9SMichael Walle ;; 34232408a527Saurel32 m68k) 34240938cda5Saurel32 bflt="yes" 342556aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 34261ad2134fSPaul Brook target_phys_bits=32 3427c2e3dee6SLaurent Vivier target_int_alignment=2 3428c2e3dee6SLaurent Vivier target_long_alignment=2 3429c2e3dee6SLaurent Vivier target_llong_alignment=2 34302408a527Saurel32 ;; 3431877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3432877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 343372b675caSEdgar E. Iglesias bflt="yes" 343472b675caSEdgar E. Iglesias target_nptl="yes" 343572b675caSEdgar E. Iglesias target_phys_bits=32 3436de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 343772b675caSEdgar E. Iglesias ;; 34382408a527Saurel32 mips|mipsel) 3439b498c8a0SJuan Quintela TARGET_ARCH=mips 344025be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3441f04dc72fSPaul Brook target_nptl="yes" 34421ad2134fSPaul Brook target_phys_bits=64 34432408a527Saurel32 ;; 34442408a527Saurel32 mipsn32|mipsn32el) 3445b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 34466acff7daSJuan Quintela TARGET_BASE_ARCH=mips 344725be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 34481ad2134fSPaul Brook target_phys_bits=64 34492408a527Saurel32 ;; 34502408a527Saurel32 mips64|mips64el) 3451b498c8a0SJuan Quintela TARGET_ARCH=mips64 34526acff7daSJuan Quintela TARGET_BASE_ARCH=mips 345325be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 34541ad2134fSPaul Brook target_phys_bits=64 3455c2e3dee6SLaurent Vivier target_long_alignment=8 34562408a527Saurel32 ;; 34572408a527Saurel32 ppc) 3458c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 34598b242ebaSAlexander Graf target_phys_bits=64 3460d6630708SNathan Froyd target_nptl="yes" 3461de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 34622408a527Saurel32 ;; 34632408a527Saurel32 ppcemb) 34646acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3465e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3466c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 34671ad2134fSPaul Brook target_phys_bits=64 3468d6630708SNathan Froyd target_nptl="yes" 3469de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 34702408a527Saurel32 ;; 34712408a527Saurel32 ppc64) 34726acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3473e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3474c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 34751ad2134fSPaul Brook target_phys_bits=64 3476c2e3dee6SLaurent Vivier target_long_alignment=8 3477de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 34782408a527Saurel32 ;; 34792408a527Saurel32 ppc64abi32) 3480b498c8a0SJuan Quintela TARGET_ARCH=ppc64 34816acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3482e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 348325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3484c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 34851ad2134fSPaul Brook target_phys_bits=64 3486de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 34872408a527Saurel32 ;; 34882408a527Saurel32 sh4|sh4eb) 3489b498c8a0SJuan Quintela TARGET_ARCH=sh4 34904dbed897Spbrook bflt="yes" 34910b6d3ae0Saurel32 target_nptl="yes" 34921ad2134fSPaul Brook target_phys_bits=32 34932408a527Saurel32 ;; 34942408a527Saurel32 sparc) 34951ad2134fSPaul Brook target_phys_bits=64 34962408a527Saurel32 ;; 34972408a527Saurel32 sparc64) 34986acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 34991ad2134fSPaul Brook target_phys_bits=64 3500c2e3dee6SLaurent Vivier target_long_alignment=8 35012408a527Saurel32 ;; 35022408a527Saurel32 sparc32plus) 3503b498c8a0SJuan Quintela TARGET_ARCH=sparc64 35046acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3505e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 350625be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 35071ad2134fSPaul Brook target_phys_bits=64 35082408a527Saurel32 ;; 350924e804ecSAlexander Graf s390x) 3510bc434676SUlrich Hecht target_nptl="yes" 351124e804ecSAlexander Graf target_phys_bits=64 35127b3da903SAlexander Graf target_long_alignment=8 351324e804ecSAlexander Graf ;; 3514d2fbca94SGuan Xuetao unicore32) 3515d2fbca94SGuan Xuetao target_phys_bits=32 3516d2fbca94SGuan Xuetao ;; 3517cfa550c6SMax Filippov xtensa|xtensaeb) 3518cfa550c6SMax Filippov TARGET_ARCH=xtensa 3519cfa550c6SMax Filippov target_phys_bits=32 3520cfa550c6SMax Filippov ;; 35212408a527Saurel32 *) 3522de83cd02Sbellard echo "Unsupported target CPU" 3523de83cd02Sbellard exit 1 35242408a527Saurel32 ;; 35252408a527Saurel32esac 3526c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3527c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3528c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3529c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 353025be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3531053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 353225be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 353325be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 353442bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 35356acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 35366acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 35376acff7daSJuan Quintelafi 353825be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3539e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3540e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3541e6e91b9cSJuan Quintelafi 354225be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 35431b0c87fcSJuan Quintelacase "$target_arch2" in 35441b0c87fcSJuan Quintela i386|x86_64) 35451b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 354664b3cfdbSAnthony PERARD target_phys_bits=64 354725be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 354859d21e53SAlexander Graf else 354959d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 3550432d268cSJun Nakajima fi 355159d21e53SAlexander Graf ;; 355259d21e53SAlexander Graf *) 355359d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 35541b0c87fcSJuan Quintelaesac 3555c59249f9SJuan Quintelacase "$target_arch2" in 35560e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3557c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3558c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3559c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3560c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 35615f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3562adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3563adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3564c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3565c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 356625be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 35671ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 3568d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3569d5970055SMichael S. Tsirkin fi 3570c59249f9SJuan Quintela fi 3571c59249f9SJuan Quintelaesac 35727f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then 35730a6b8ddeSAlexander Graf echo "CONFIG_PSERIES=y" >> $config_target_mak 35740a6b8ddeSAlexander Graffi 3575de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 357625be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 357797a847bcSbellardfi 357897a847bcSbellardif test "$target_softmmu" = "yes" ; then 3579b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 358025be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 3581de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 35820e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 35835791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3584de83cd02Sbellardfi 3585997344f3Sbellardif test "$target_user_only" = "yes" ; then 358625be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3587a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 3588997344f3Sbellardfi 3589831b7825Sthsif test "$target_linux_user" = "yes" ; then 359025be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3591831b7825Sthsfi 3592831b7825Sthsif test "$target_darwin_user" = "yes" ; then 359325be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3594831b7825Sthsfi 3595111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3596111a38b0SRobert Relyea echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3597111a38b0SRobert Relyea echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3598111a38b0SRobert Relyea echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3599111a38b0SRobert Relyeafi 360056aebc89Spbrooklist="" 360156aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 360256aebc89Spbrook for x in $gdb_xml_files; do 360356aebc89Spbrook list="$list $source_path/gdb-xml/$x" 360456aebc89Spbrook done 360525be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 36063d0f1517SJuan Quintelafi 3607de83cd02Sbellard 3608e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 360925be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3610e5fe0c52Spbrookfi 3611bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3612bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 361325be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3614bd0c5661Spbrookfi 3615379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 361625be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3617379f6698SPaul Brookfi 361884778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 361925be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 362084778508Sblueswir1fi 36215b0753e0Sbellard 36224afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3623fa282484SJuan Quintela 36244afddb55SJuan Quintelacflags="" 3625f9728943SPaolo Bonziniincludes="" 3626fa282484SJuan Quintelaldflags="" 36279b8e111fSJuan Quintela 36289195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then 36299195b2c2SStefan Weil includes="-I\$(SRC_PATH)/tcg/tci $includes" 36309195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then 3631f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 363224e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3633f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 36345d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3635f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 363657ddfbf7SJuan Quintelaelse 3637f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 363857ddfbf7SJuan Quintelafi 3639f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 364057ddfbf7SJuan Quintela 36416efd7517SPeter Maydellif test "$linux" = "yes" ; then 36426efd7517SPeter Maydell includes="-I\$(SRC_PATH)/linux-headers $includes" 36436efd7517SPeter Maydellfi 36446efd7517SPeter Maydell 36454d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 36464d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 36474d904533SBlue Swirlelse 36484d904533SBlue Swirl libdis_config_mak=libdis/config.mak 36494d904533SBlue Swirlfi 36504d904533SBlue Swirl 365164656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 365264656024SJuan Quintela case "$i" in 365364656024SJuan Quintela alpha) 365425be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 36554d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 365664656024SJuan Quintela ;; 365764656024SJuan Quintela arm) 365825be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 36594d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 366064656024SJuan Quintela ;; 366164656024SJuan Quintela cris) 366225be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 36634d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 366464656024SJuan Quintela ;; 366564656024SJuan Quintela hppa) 366625be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 36674d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 366864656024SJuan Quintela ;; 366964656024SJuan Quintela i386|x86_64) 367025be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 36714d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 367264656024SJuan Quintela ;; 3673903ec55cSAurelien Jarno ia64*) 3674903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3675903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3676903ec55cSAurelien Jarno ;; 367764656024SJuan Quintela m68k) 367825be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 36794d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 368064656024SJuan Quintela ;; 3681877fdc12SEdgar E. Iglesias microblaze*) 368225be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 36834d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 368464656024SJuan Quintela ;; 368564656024SJuan Quintela mips*) 368625be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 36874d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 368864656024SJuan Quintela ;; 368964656024SJuan Quintela ppc*) 369025be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 36914d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 369264656024SJuan Quintela ;; 369324e804ecSAlexander Graf s390*) 369425be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 36954d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 369664656024SJuan Quintela ;; 369764656024SJuan Quintela sh4) 369825be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 36994d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 370064656024SJuan Quintela ;; 370164656024SJuan Quintela sparc*) 370225be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 37034d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 370464656024SJuan Quintela ;; 3705cfa550c6SMax Filippov xtensa*) 3706cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 3707cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak 3708cfa550c6SMax Filippov ;; 370964656024SJuan Quintela esac 371064656024SJuan Quinteladone 37119195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 37129195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 37139195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak 37149195b2c2SStefan Weilfi 371564656024SJuan Quintela 37166ee7126fSJuan Quintelacase "$ARCH" in 37176ee7126fSJuan Quintelaalpha) 37186ee7126fSJuan Quintela # Ensure there's only a single GP 37196ee7126fSJuan Quintela cflags="-msmall-data $cflags" 37206ee7126fSJuan Quintela;; 37216ee7126fSJuan Quintelaesac 37226ee7126fSJuan Quintela 372355d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 372455d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 372555d9c04bSJuan Quintela arm) 372655d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 372755d9c04bSJuan Quintela ;; 372825a8bb96SMichael Walle lm32) 372925a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 373025a8bb96SMichael Walle ;; 373155d9c04bSJuan Quintela i386|mips|ppc) 373255d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 373355d9c04bSJuan Quintela ;; 373455d9c04bSJuan Quintela esac 373555d9c04bSJuan Quintelafi 373655d9c04bSJuan Quintela 3737471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3738471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3739471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 374025be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3741471857ddSJuan Quintelafi 3742471857ddSJuan Quintela 3743d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 374425be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3745d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3746d02c1db3SJuan Quintela cflags="-p $cflags" 3747d02c1db3SJuan Quintela ldflags="-p $ldflags" 3748d02c1db3SJuan Quintela fi 3749d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3750d02c1db3SJuan Quintela ldflags="-p $ldflags" 375125be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3752d02c1db3SJuan Quintela fi 3753d02c1db3SJuan Quintelafi 3754d02c1db3SJuan Quintela 37559195b2c2SStefan Weilif test "$ARCH" = "tci"; then 37569195b2c2SStefan Weil linker_script="" 37579195b2c2SStefan Weilelse 37586ee7126fSJuan Quintela linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 37599195b2c2SStefan Weilfi 37609195b2c2SStefan Weil 37619b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3762fa282484SJuan Quintela case "$ARCH" in 3763fa282484SJuan Quintela sparc) 3764fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3765322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3766fa282484SJuan Quintela ;; 37674d58be06SRichard Henderson alpha | s390x) 37684d58be06SRichard Henderson # The default placement of the application is fine. 37694d58be06SRichard Henderson ;; 3770fd76e73aSRichard Henderson *) 3771322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3772fa282484SJuan Quintela ;; 3773fa282484SJuan Quintela esac 3774fa282484SJuan Quintelafi 3775fa282484SJuan Quintela 377625be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 377725be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3778f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3779fa282484SJuan Quintela 378097a847bcSbellarddone # for target in $targets 37817d13299dSbellard 3782d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3783c09015ddSAnthony LiguoriDIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom" 3784446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas" 37852d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 37863e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 3787e098fc3fSMichael RothDIRS="$DIRS qapi qapi-generated" 3788d9cd446bSAnthony LiguoriDIRS="$DIRS qga trace" 3789c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 3790c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 3791ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 3792446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 37932d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 3794753d11f2SRichard Hendersonfor bios_file in \ 3795753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 3796753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 3797753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 3798753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 3799753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 3800753d11f2SRichard Hendersondo 38017ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 38027ea78b74SJan Kiszkadone 3803d1807a4fSPaolo Bonzinimkdir -p $DIRS 38047d13299dSbellardfor f in $FILES ; do 3805f9245e10SPeter Maydell if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then 3806f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 3807f9245e10SPeter Maydell fi 38087d13299dSbellarddone 38091ad2134fSPaul Brook 3810c34ebfdcSAnthony Liguori# temporary config to build submodules 38112d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3812c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 381337116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3814c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3815c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3816c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3817c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3818c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3819c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3820c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3821c34ebfdcSAnthony Liguoridone 3822c34ebfdcSAnthony Liguori 38231ad2134fSPaul Brookfor hwlib in 32 64; do 38241ad2134fSPaul Brook d=libhw$hwlib 38251ad2134fSPaul Brook mkdir -p $d 38269953b2fcSBlue Swirl mkdir -p $d/ide 382711568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 3828353ac78dSAneesh Kumar K.V mkdir -p $d/9pfs 382937116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 38301ad2134fSPaul Brookdone 3831add16157SBlue Swirl 3832111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then 3833111a38b0SRobert Relyea # out of tree build 3834111a38b0SRobert Relyea mkdir -p libcacard 3835111a38b0SRobert Relyea rm -f libcacard/Makefile 383644dc0ca3SAlon Levy symlink "$source_path/libcacard/Makefile" libcacard/Makefile 3837111a38b0SRobert Relyeafi 3838111a38b0SRobert Relyea 3839add16157SBlue Swirld=libuser 3840add16157SBlue Swirlmkdir -p $d 3841937b1258SLluís Vilanovamkdir -p $d/trace 384211568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3843b40292e7SJan Kiszka 3844b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3845b40292e7SJan Kiszka mkdir -p QMP 3846b40292e7SJan Kiszkafi 3847