17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 57d13299dSbellard# set temporary file name 67d13299dSbellardif test ! -z "$TMPDIR" ; then 77d13299dSbellard TMPDIR1="${TMPDIR}" 87d13299dSbellardelif test ! -z "$TEMPDIR" ; then 97d13299dSbellard TMPDIR1="${TEMPDIR}" 107d13299dSbellardelse 117d13299dSbellard TMPDIR1="/tmp" 127d13299dSbellardfi 137d13299dSbellard 143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" 153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" 16a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" 177d13299dSbellard 180ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells; 190ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> 200ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM 21da1d85e3SGerd Hoffmannrm -f config.log 229ac81bbbSmalc 23b48e3611SPeter Maydell# Print a helpful header at the top of config.log 24b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 25979ae168SPeter Maydellprintf "# Configured with:" >> config.log 26979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 27979ae168SPeter Maydellecho >> config.log 28b48e3611SPeter Maydellecho "#" >> config.log 29b48e3611SPeter Maydell 3052166aa0SJuan Quintelacompile_object() { 31da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 32da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1 3352166aa0SJuan Quintela} 3452166aa0SJuan Quintela 3552166aa0SJuan Quintelacompile_prog() { 3652166aa0SJuan Quintela local_cflags="$1" 3752166aa0SJuan Quintela local_ldflags="$2" 38da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 39da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 4052166aa0SJuan Quintela} 4152166aa0SJuan Quintela 4211568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 4311568d6dSPaolo Bonzinisymlink() { 4411568d6dSPaolo Bonzini rm -f $2 4511568d6dSPaolo Bonzini ln -s $1 $2 4611568d6dSPaolo Bonzini} 4711568d6dSPaolo Bonzini 480dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 490dba6195SLoïc Minier# executable or a builtin) 500dba6195SLoïc Minierhas() { 510dba6195SLoïc Minier type "$1" >/dev/null 2>&1 520dba6195SLoïc Minier} 530dba6195SLoïc Minier 540dba6195SLoïc Minier# search for an executable in PATH 550dba6195SLoïc Minierpath_of() { 560dba6195SLoïc Minier local_command="$1" 570dba6195SLoïc Minier local_ifs="$IFS" 580dba6195SLoïc Minier local_dir="" 590dba6195SLoïc Minier 600dba6195SLoïc Minier # pathname has a dir component? 610dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 620dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 630dba6195SLoïc Minier echo "$local_command" 640dba6195SLoïc Minier return 0 650dba6195SLoïc Minier fi 660dba6195SLoïc Minier fi 670dba6195SLoïc Minier if [ -z "$local_command" ]; then 680dba6195SLoïc Minier return 1 690dba6195SLoïc Minier fi 700dba6195SLoïc Minier 710dba6195SLoïc Minier IFS=: 720dba6195SLoïc Minier for local_dir in $PATH; do 730dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 740dba6195SLoïc Minier echo "$local_dir/$local_command" 750dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 760dba6195SLoïc Minier return 0 770dba6195SLoïc Minier fi 780dba6195SLoïc Minier done 790dba6195SLoïc Minier # not found 800dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 810dba6195SLoïc Minier return 1 820dba6195SLoïc Minier} 830dba6195SLoïc Minier 847d13299dSbellard# default parameters 85ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 862ff6b91eSJuan Quintelacpu="" 871e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 8843ce4dfeSbellardstatic="no" 89ed968ff1SJuan Quintelasparc_cpu="" 907d13299dSbellardcross_prefix="" 910c58ac1cSmalcaudio_drv_list="" 92d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda" 93d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" 94eb852011SMarkus Armbrusterblock_drv_whitelist="" 957d13299dSbellardhost_cc="gcc" 96c81da56eSJuan Quintelahelper_cflags="" 9773da375eSJuan Quintelalibs_softmmu="" 983e2e0e6bSJuan Quintelalibs_tools="" 9967f86e8eSJuan Quintelaaudio_pt_int="" 100d5631638Smalcaudio_win_int="" 1012b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 102957f1f99SMichael Rothlibs_qga="" 1035bc62e01SGerd Hoffmanndebug_info="yes" 104ac0df51dSaliguori 105377529c0SPaolo Bonzinitarget_list="" 106377529c0SPaolo Bonzini 107377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 108377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 109377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 110377529c0SPaolo Bonzini# unless --disable-foo is given 111377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 112377529c0SPaolo Bonzini# feature will searched for, 113377529c0SPaolo Bonzini# if not found, configure exits with error 114377529c0SPaolo Bonzini# 115377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 116377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 117377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 118377529c0SPaolo Bonzini 119377529c0SPaolo Bonzinibluez="" 120377529c0SPaolo Bonzinibrlapi="" 121377529c0SPaolo Bonzinicurl="" 122377529c0SPaolo Bonzinicurses="" 123377529c0SPaolo Bonzinidocs="" 124377529c0SPaolo Bonzinifdt="" 125377529c0SPaolo Bonzininptl="" 126377529c0SPaolo Bonzinisdl="" 127983eef5aSMeador Ingevirtfs="" 128821601eaSJes Sorensenvnc="yes" 129377529c0SPaolo Bonzinisparse="no" 130377529c0SPaolo Bonziniuuid="" 131377529c0SPaolo Bonzinivde="" 132377529c0SPaolo Bonzinivnc_tls="" 133377529c0SPaolo Bonzinivnc_sasl="" 134377529c0SPaolo Bonzinivnc_jpeg="" 135377529c0SPaolo Bonzinivnc_png="" 136377529c0SPaolo Bonzinivnc_thread="no" 137377529c0SPaolo Bonzinixen="" 138d5b93ddfSAnthony PERARDxen_ctrl_version="" 139377529c0SPaolo Bonzinilinux_aio="" 14047e98658SCorey Bryantcap_ng="" 141377529c0SPaolo Bonziniattr="" 1424f26f2b6SAvi Kivitylibattr="" 143377529c0SPaolo Bonzinixfs="" 144377529c0SPaolo Bonzini 145d41a75a2SBradvhost_net="no" 146d41a75a2SBradkvm="no" 147377529c0SPaolo Bonzinigprof="no" 148377529c0SPaolo Bonzinidebug_tcg="no" 149377529c0SPaolo Bonzinidebug_mon="no" 150377529c0SPaolo Bonzinidebug="no" 151377529c0SPaolo Bonzinistrip_opt="yes" 1529195b2c2SStefan Weiltcg_interpreter="no" 153377529c0SPaolo Bonzinibigendian="no" 154377529c0SPaolo Bonzinimingw32="no" 155377529c0SPaolo BonziniEXESUF="" 156377529c0SPaolo Bonziniprefix="/usr/local" 157377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 158377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu" 159377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 160377529c0SPaolo Bonzinibindir="\${prefix}/bin" 1613aa5d2beSAlon Levylibdir="\${prefix}/lib" 1620f94d6daSAlon Levyincludedir="\${prefix}/include" 163377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 164377529c0SPaolo Bonziniconfsuffix="/qemu" 165377529c0SPaolo Bonzinislirp="yes" 166377529c0SPaolo Bonzinifmod_lib="" 167377529c0SPaolo Bonzinifmod_inc="" 168377529c0SPaolo Bonzinioss_lib="" 169377529c0SPaolo Bonzinibsd="no" 170377529c0SPaolo Bonzinilinux="no" 171377529c0SPaolo Bonzinisolaris="no" 172377529c0SPaolo Bonziniprofiler="no" 173377529c0SPaolo Bonzinicocoa="no" 174377529c0SPaolo Bonzinisoftmmu="yes" 175377529c0SPaolo Bonzinilinux_user="no" 176377529c0SPaolo Bonzinidarwin_user="no" 177377529c0SPaolo Bonzinibsd_user="no" 178377529c0SPaolo Bonziniguest_base="" 179377529c0SPaolo Bonziniuname_release="" 180377529c0SPaolo Bonzinimixemu="no" 181377529c0SPaolo Bonziniaix="no" 182377529c0SPaolo Bonziniblobs="yes" 183377529c0SPaolo Bonzinipkgversion="" 18440d6444eSAvi Kivitypie="" 185377529c0SPaolo Bonzinizero_malloc="" 186377529c0SPaolo Bonzinitrace_backend="nop" 187377529c0SPaolo Bonzinitrace_file="trace" 188377529c0SPaolo Bonzinispice="" 189377529c0SPaolo Bonzinirbd="" 19036707144SAlon Levysmartcard="" 191111a38b0SRobert Relyeasmartcard_nss="" 19269354a83SHans de Goedeusb_redir="" 193430a3c18SMichael Walleopengl="" 1941ece9905SAlon Levyzlib="yes" 195d138cee9SMichael Rothguest_agent="yes" 196c589b249SRonnie Sahlberglibiscsi="" 197377529c0SPaolo Bonzini 198ac0df51dSaliguori# parse CC options first 199ac0df51dSaliguorifor opt do 200ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 201ac0df51dSaliguori case "$opt" in 202ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 203ac0df51dSaliguori ;; 2043d8df640SPaolo Bonzini --cc=*) CC="$optarg" 205ac0df51dSaliguori ;; 206ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 207ca4deeb1SPaolo Bonzini ;; 2082ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 2092ff6b91eSJuan Quintela ;; 210a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 211e2a2ed06SJuan Quintela ;; 212e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 213e2a2ed06SJuan Quintela ;; 2145bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 2155bc62e01SGerd Hoffmann ;; 2165bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 2175bc62e01SGerd Hoffmann ;; 21850e7b1a0SJuan Quintela --sparc_cpu=*) 21950e7b1a0SJuan Quintela sparc_cpu="$optarg" 22050e7b1a0SJuan Quintela case $sparc_cpu in 221ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 22250e7b1a0SJuan Quintela cpu="sparc" 22350e7b1a0SJuan Quintela ;; 22450e7b1a0SJuan Quintela v9) 22550e7b1a0SJuan Quintela cpu="sparc64" 22650e7b1a0SJuan Quintela ;; 22750e7b1a0SJuan Quintela *) 22850e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 22950e7b1a0SJuan Quintela exit 1 23050e7b1a0SJuan Quintela ;; 23150e7b1a0SJuan Quintela esac 23250e7b1a0SJuan Quintela ;; 233ac0df51dSaliguori esac 234ac0df51dSaliguoridone 235ac0df51dSaliguori# OS specific 236ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 23793148aa5SStefan Weil# we can eliminate its usage altogether. 238ac0df51dSaliguori 239b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}" 240b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 241b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 242b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 2433f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}" 244b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 245b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 24617884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 24717884d7bSSergei Trofimovichquery_pkg_config() { 24817884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 24917884d7bSSergei Trofimovich} 25017884d7bSSergei Trofimovichpkg_config=query_pkg_config 251b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 252ac0df51dSaliguori 253be17dc90SMichael S. Tsirkin# default flags for all hosts 254be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 255f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 256be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 257be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 25884958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 259cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu" 2605bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 2615bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 262be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 2635bc62e01SGerd Hoffmannfi 264be17dc90SMichael S. Tsirkin 265ca4deeb1SPaolo Bonzini# make source path absolute 266ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 267ca4deeb1SPaolo Bonzini 268ac0df51dSaliguoricheck_define() { 269ac0df51dSaliguoricat > $TMPC <<EOF 270ac0df51dSaliguori#if !defined($1) 271fd786e1aSPeter Maydell#error $1 not defined 272ac0df51dSaliguori#endif 273ac0df51dSaliguoriint main(void) { return 0; } 274ac0df51dSaliguoriEOF 27552166aa0SJuan Quintela compile_object 276ac0df51dSaliguori} 277ac0df51dSaliguori 2782ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 2792ff6b91eSJuan Quintela # command line argument 2802ff6b91eSJuan Quintela : 2812ff6b91eSJuan Quintelaelif check_define __i386__ ; then 282ac0df51dSaliguori cpu="i386" 283ac0df51dSaliguorielif check_define __x86_64__ ; then 284ac0df51dSaliguori cpu="x86_64" 2853aa9bd6cSblueswir1elif check_define __sparc__ ; then 2863aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 2873aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 2883aa9bd6cSblueswir1 if check_define __arch64__ ; then 2893aa9bd6cSblueswir1 cpu="sparc64" 2903aa9bd6cSblueswir1 else 2913aa9bd6cSblueswir1 cpu="sparc" 2923aa9bd6cSblueswir1 fi 293fdf7ed96Smalcelif check_define _ARCH_PPC ; then 294fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 295fdf7ed96Smalc cpu="ppc64" 296ac0df51dSaliguori else 297fdf7ed96Smalc cpu="ppc" 298fdf7ed96Smalc fi 299afa05235SAurelien Jarnoelif check_define __mips__ ; then 300afa05235SAurelien Jarno cpu="mips" 301477ba620SAurelien Jarnoelif check_define __ia64__ ; then 302477ba620SAurelien Jarno cpu="ia64" 303d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 304d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 305d66ed0eaSAurelien Jarno cpu="s390x" 306d66ed0eaSAurelien Jarno else 307d66ed0eaSAurelien Jarno cpu="s390" 308d66ed0eaSAurelien Jarno fi 30921d89f84SPeter Maydellelif check_define __arm__ ; then 31021d89f84SPeter Maydell cpu="arm" 311f28ffed5SBradelif check_define __hppa__ ; then 312f28ffed5SBrad cpu="hppa" 313fdf7ed96Smalcelse 314fdf7ed96Smalc cpu=`uname -m` 315ac0df51dSaliguorifi 316ac0df51dSaliguori 317359bc95dSPeter MaydellARCH= 318359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 319359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 3207d13299dSbellardcase "$cpu" in 321359bc95dSPeter Maydell ia64|ppc|ppc64|s390|s390x|sparc64) 322ea8f20f8SJuan Quintela cpu="$cpu" 323ea8f20f8SJuan Quintela ;; 3247d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 32597a847bcSbellard cpu="i386" 3267d13299dSbellard ;; 327aaa5fa14Saurel32 x86_64|amd64) 328aaa5fa14Saurel32 cpu="x86_64" 329aaa5fa14Saurel32 ;; 33021d89f84SPeter Maydell armv*b|armv*l|arm) 33121d89f84SPeter Maydell cpu="arm" 3327d13299dSbellard ;; 333f28ffed5SBrad hppa|parisc|parisc64) 334f54b3f92Saurel32 cpu="hppa" 335f54b3f92Saurel32 ;; 336afa05235SAurelien Jarno mips*) 337afa05235SAurelien Jarno cpu="mips" 338afa05235SAurelien Jarno ;; 3393142255cSblueswir1 sparc|sun4[cdmuv]) 340ae228531Sbellard cpu="sparc" 341ae228531Sbellard ;; 3427d13299dSbellard *) 343359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 344359bc95dSPeter Maydell ARCH=unknown 3457d13299dSbellard ;; 3467d13299dSbellardesac 347359bc95dSPeter Maydellif test -z "$ARCH"; then 348359bc95dSPeter Maydell ARCH="$cpu" 349359bc95dSPeter Maydellfi 350e2d52ad3SJuan Quintela 3517d13299dSbellard# OS specific 352ac0df51dSaliguoriif check_define __linux__ ; then 353ac0df51dSaliguori targetos="Linux" 354ac0df51dSaliguorielif check_define _WIN32 ; then 355ac0df51dSaliguori targetos='MINGW32' 356169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 357169dc5d3Sblueswir1 targetos='OpenBSD' 358169dc5d3Sblueswir1elif check_define __sun__ ; then 359169dc5d3Sblueswir1 targetos='SunOS' 360179cf400SAndreas Färberelif check_define __HAIKU__ ; then 361179cf400SAndreas Färber targetos='Haiku' 362ac0df51dSaliguorielse 3637d13299dSbellard targetos=`uname -s` 364ac0df51dSaliguorifi 3650dbfc675SJuan Quintela 3667d13299dSbellardcase $targetos in 367c326e0afSbellardCYGWIN*) 368c326e0afSbellard mingw32="yes" 369a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 370d5631638Smalc audio_possible_drivers="winwave sdl" 371d5631638Smalc audio_drv_list="winwave" 372c326e0afSbellard;; 37367b915a5SbellardMINGW32*) 37467b915a5Sbellard mingw32="yes" 375d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 376d5631638Smalc audio_drv_list="winwave" 37767b915a5Sbellard;; 3785c40d2bdSthsGNU/kFreeBSD) 379a167ba50SAurelien Jarno bsd="yes" 3800c58ac1cSmalc audio_drv_list="oss" 381f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3825c40d2bdSths;; 3837d3505c5SbellardFreeBSD) 3847d3505c5Sbellard bsd="yes" 3850db4a067SPaolo Bonzini make="${MAKE-gmake}" 3860c58ac1cSmalc audio_drv_list="oss" 387f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 388f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 389f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3907d3505c5Sbellard;; 391c5e97233Sblueswir1DragonFly) 392c5e97233Sblueswir1 bsd="yes" 3930db4a067SPaolo Bonzini make="${MAKE-gmake}" 394c5e97233Sblueswir1 audio_drv_list="oss" 395c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 396c5e97233Sblueswir1;; 3977d3505c5SbellardNetBSD) 3987d3505c5Sbellard bsd="yes" 3990db4a067SPaolo Bonzini make="${MAKE-gmake}" 4000c58ac1cSmalc audio_drv_list="oss" 401c2de5c91Smalc audio_possible_drivers="oss sdl esd" 4028ef92a88Sblueswir1 oss_lib="-lossaudio" 4037d3505c5Sbellard;; 4047d3505c5SbellardOpenBSD) 4057d3505c5Sbellard bsd="yes" 4060db4a067SPaolo Bonzini make="${MAKE-gmake}" 4070c58ac1cSmalc audio_drv_list="oss" 408c2de5c91Smalc audio_possible_drivers="oss sdl esd" 4092f6a1ab0Sblueswir1 oss_lib="-lossaudio" 4107d3505c5Sbellard;; 41183fb7adfSbellardDarwin) 41283fb7adfSbellard bsd="yes" 41383fb7adfSbellard darwin="yes" 4140dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 4150dbfc675SJuan Quintela # run 64-bit userspace code 416aab8588aSmalc if [ "$cpu" = "i386" ] ; then 4171b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 418aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 4191b0f9cc2Saliguori fi 4201b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 421a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4220c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4231b0f9cc2Saliguori else 424a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4251b0f9cc2Saliguori fi 426831b7825Sths darwin_user="yes" 427fd677642Sths cocoa="yes" 4280c58ac1cSmalc audio_drv_list="coreaudio" 429c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4300c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4317973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 43283fb7adfSbellard;; 433ec530c81SbellardSunOS) 434ec530c81Sbellard solaris="yes" 4350db4a067SPaolo Bonzini make="${MAKE-gmake}" 4360db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 437fa58948dSBlue Swirl ld="gld" 438e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 4390475a5caSths needs_libsunmath="no" 440c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 441ef18c883Sths # have to select again, because `uname -m` returns i86pc 442ef18c883Sths # even on an x86_64 box. 443ef18c883Sths solariscpu=`isainfo -k` 444ef18c883Sths if test "${solariscpu}" = "amd64" ; then 445ef18c883Sths cpu="x86_64" 446ef18c883Sths fi 447c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4480475a5caSths if test "$solarisrev" -le 9 ; then 4490475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4500475a5caSths needs_libsunmath="yes" 451f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 452f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 453f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4540475a5caSths else 4550475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4560475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4570475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4580475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4590475a5caSths exit 1 4600475a5caSths fi 4610475a5caSths fi 46286b2bd93Sths fi 4636b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4640c58ac1cSmalc audio_drv_list="oss" 4656b4d2ba1Sths fi 466c2de5c91Smalc audio_possible_drivers="oss sdl" 467d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 468d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 469d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 470d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 471a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 472e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 473ec530c81Sbellard;; 474b29fe3edSmalcAIX) 475b29fe3edSmalc aix="yes" 4760db4a067SPaolo Bonzini make="${MAKE-gmake}" 477b29fe3edSmalc;; 478179cf400SAndreas FärberHaiku) 479179cf400SAndreas Färber haiku="yes" 480179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 481179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 482179cf400SAndreas Färber;; 483fb065187Sbellard*) 4840c58ac1cSmalc audio_drv_list="oss" 485b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4865327cf48Sbellard linux="yes" 487831b7825Sths linux_user="yes" 48868063649Sblueswir1 usb="linux" 489af2be207SJan Kiszka kvm="yes" 490af2be207SJan Kiszka vhost_net="yes" 49107f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 492c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 493c9ec1fe4Sbellard fi 494fb065187Sbellard;; 4957d13299dSbellardesac 4967d13299dSbellard 4977d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 498b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 49968063649Sblueswir1 usb="bsd" 50083fb7adfSbellard fi 50184778508Sblueswir1 bsd_user="yes" 5027d3505c5Sbellardfi 5037d3505c5Sbellard 5040db4a067SPaolo Bonzini: ${make=${MAKE-make}} 5050db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 506c886edfbSBlue Swirl: ${python=${PYTHON-python}} 507e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 5080db4a067SPaolo Bonzini 5093457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 5103457a3f8SJuan Quintela EXESUF=".exe" 511a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 512e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 513e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 514f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 515f7cf5d5bSStefan Weilcat > $TMPC << EOF 516f7cf5d5bSStefan Weilint main(void) { return 0; } 517f7cf5d5bSStefan WeilEOF 518f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 519f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 520f7cf5d5bSStefan Weil fi 521683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 522683035deSPaolo Bonzini mandir="\${prefix}" 523683035deSPaolo Bonzini datadir="\${prefix}" 524683035deSPaolo Bonzini docdir="\${prefix}" 525683035deSPaolo Bonzini bindir="\${prefix}" 526683035deSPaolo Bonzini sysconfdir="\${prefix}" 527683035deSPaolo Bonzini confsuffix="" 528*aa59637eSGal Hammer libs_qga="-lws2_32 -lwinmm -lpowrprof $lib_qga" 5293457a3f8SJuan Quintelafi 5303457a3f8SJuan Quintela 531487fefdbSAnthony Liguoriwerror="" 53285aa5189Sbellard 5337d13299dSbellardfor opt do 534a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 5357d13299dSbellard case "$opt" in 5362efc3265Sbellard --help|-h) show_help=yes 5372efc3265Sbellard ;; 53899123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 53999123e13SMike Frysinger ;; 540b1a550a0Spbrook --prefix=*) prefix="$optarg" 5417d13299dSbellard ;; 542b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 54332ce6337Sbellard ;; 544ca4deeb1SPaolo Bonzini --source-path=*) 5457d13299dSbellard ;; 546ac0df51dSaliguori --cross-prefix=*) 5477d13299dSbellard ;; 548ac0df51dSaliguori --cc=*) 5497d13299dSbellard ;; 550b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 55183469015Sbellard ;; 552b1a550a0Spbrook --make=*) make="$optarg" 5537d13299dSbellard ;; 5546a882643Spbrook --install=*) install="$optarg" 5556a882643Spbrook ;; 556c886edfbSBlue Swirl --python=*) python="$optarg" 557c886edfbSBlue Swirl ;; 558e2d8830eSBrad --smbd=*) smbd="$optarg" 559e2d8830eSBrad ;; 560e2a2ed06SJuan Quintela --extra-cflags=*) 5617d13299dSbellard ;; 562e2a2ed06SJuan Quintela --extra-ldflags=*) 5637d13299dSbellard ;; 5645bc62e01SGerd Hoffmann --enable-debug-info) 5655bc62e01SGerd Hoffmann ;; 5665bc62e01SGerd Hoffmann --disable-debug-info) 5675bc62e01SGerd Hoffmann ;; 5682ff6b91eSJuan Quintela --cpu=*) 5697d13299dSbellard ;; 570b1a550a0Spbrook --target-list=*) target_list="$optarg" 571de83cd02Sbellard ;; 57274242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 57394a420b1SStefan Hajnoczi ;; 57474242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5759410b56cSPrerna Saxena ;; 5767d13299dSbellard --enable-gprof) gprof="yes" 5777d13299dSbellard ;; 57879427693SLoïc Minier --static) 57979427693SLoïc Minier static="yes" 58079427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 58117884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 58243ce4dfeSbellard ;; 5830b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5840b24e75fSPaolo Bonzini ;; 5850b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5860b24e75fSPaolo Bonzini ;; 5873aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 5883aa5d2beSAlon Levy ;; 5890f94d6daSAlon Levy --includedir=*) includedir="$optarg" 5900f94d6daSAlon Levy ;; 5910b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5920b24e75fSPaolo Bonzini ;; 5930b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5940b24e75fSPaolo Bonzini ;; 595ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 59607381cc1SAnthony Liguori ;; 597023ddd74SMax Filippov --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\ 598023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 599023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 600023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 601023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 602023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 603023ddd74SMax Filippov # lots of directory switches by default. 604023ddd74SMax Filippov ;; 60597a847bcSbellard --disable-sdl) sdl="no" 60697a847bcSbellard ;; 607c4198157SJuan Quintela --enable-sdl) sdl="yes" 608c4198157SJuan Quintela ;; 609983eef5aSMeador Inge --disable-virtfs) virtfs="no" 610983eef5aSMeador Inge ;; 611983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 612983eef5aSMeador Inge ;; 613821601eaSJes Sorensen --disable-vnc) vnc="no" 614821601eaSJes Sorensen ;; 615821601eaSJes Sorensen --enable-vnc) vnc="yes" 616821601eaSJes Sorensen ;; 617b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 618102a52e4Sbellard ;; 619c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 620c2de5c91Smalc ;; 6212f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 6222f6a1ab0Sblueswir1 ;; 6232fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 6240c58ac1cSmalc ;; 6250c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 6260c58ac1cSmalc ;; 627eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 628eb852011SMarkus Armbruster ;; 629f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 630f8393946Saurel32 ;; 631f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 632f8393946Saurel32 ;; 633b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 634b4475aa2SLuiz Capitulino ;; 635b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 636b4475aa2SLuiz Capitulino ;; 637f3d08ee6SPaul Brook --enable-debug) 638f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 639f3d08ee6SPaul Brook debug_tcg="yes" 640b4475aa2SLuiz Capitulino debug_mon="yes" 641f3d08ee6SPaul Brook debug="yes" 642f3d08ee6SPaul Brook strip_opt="no" 643f3d08ee6SPaul Brook ;; 64403b4fe7dSaliguori --enable-sparse) sparse="yes" 64503b4fe7dSaliguori ;; 64603b4fe7dSaliguori --disable-sparse) sparse="no" 64703b4fe7dSaliguori ;; 6481625af87Saliguori --disable-strip) strip_opt="no" 6491625af87Saliguori ;; 6508d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 6518d5d2d4cSths ;; 6521be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 6531be10ad2SJuan Quintela ;; 6542f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 6552f9606b3Saliguori ;; 656ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 657ea784e3bSJuan Quintela ;; 6582f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 6592f6f5c7aSCorentin Chary ;; 6602f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 6612f6f5c7aSCorentin Chary ;; 662efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 663efe556adSCorentin Chary ;; 664efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 665efe556adSCorentin Chary ;; 666bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 667bd023f95SCorentin Chary ;; 668bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 669bd023f95SCorentin Chary ;; 670443f1376Sbellard --disable-slirp) slirp="no" 671c20709aaSbellard ;; 672ee682d27SStefan Weil --disable-uuid) uuid="no" 673ee682d27SStefan Weil ;; 674ee682d27SStefan Weil --enable-uuid) uuid="yes" 675ee682d27SStefan Weil ;; 676e0e6c8c0Saliguori --disable-vde) vde="no" 6778a16d273Sths ;; 678dfb278bdSJuan Quintela --enable-vde) vde="yes" 679dfb278bdSJuan Quintela ;; 680e37630caSaliguori --disable-xen) xen="no" 681e37630caSaliguori ;; 682fc321b4bSJuan Quintela --enable-xen) xen="yes" 683fc321b4bSJuan Quintela ;; 6842e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6852e4d9fb1Saurel32 ;; 6864ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6874ffcedb6SJuan Quintela ;; 688fb599c9aSbalrog --disable-bluez) bluez="no" 689fb599c9aSbalrog ;; 690a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 691a20a6f46SJuan Quintela ;; 6927ba1e619Saliguori --disable-kvm) kvm="no" 6937ba1e619Saliguori ;; 694b31a0277SJuan Quintela --enable-kvm) kvm="yes" 695b31a0277SJuan Quintela ;; 6969195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 6979195b2c2SStefan Weil ;; 6989195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 6999195b2c2SStefan Weil ;; 70047e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 70147e98658SCorey Bryant ;; 70247e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 70347e98658SCorey Bryant ;; 704cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 705cd4ec0b4SGerd Hoffmann ;; 706cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 707cd4ec0b4SGerd Hoffmann ;; 708c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 709c589b249SRonnie Sahlberg ;; 710c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 711c589b249SRonnie Sahlberg ;; 71205c2a3e7Sbellard --enable-profiler) profiler="yes" 71305c2a3e7Sbellard ;; 714c2de5c91Smalc --enable-cocoa) 715c2de5c91Smalc cocoa="yes" ; 716c2de5c91Smalc sdl="no" ; 717c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 7185b0753e0Sbellard ;; 719cad25d69Spbrook --disable-system) softmmu="no" 7200a8e90f4Spbrook ;; 721cad25d69Spbrook --enable-system) softmmu="yes" 7220a8e90f4Spbrook ;; 7230953a80fSZachary Amsden --disable-user) 7240953a80fSZachary Amsden linux_user="no" ; 7250953a80fSZachary Amsden bsd_user="no" ; 7260953a80fSZachary Amsden darwin_user="no" 7270953a80fSZachary Amsden ;; 7280953a80fSZachary Amsden --enable-user) ;; 729831b7825Sths --disable-linux-user) linux_user="no" 7300a8e90f4Spbrook ;; 731831b7825Sths --enable-linux-user) linux_user="yes" 732831b7825Sths ;; 733831b7825Sths --disable-darwin-user) darwin_user="no" 734831b7825Sths ;; 735831b7825Sths --enable-darwin-user) darwin_user="yes" 7360a8e90f4Spbrook ;; 73784778508Sblueswir1 --disable-bsd-user) bsd_user="no" 73884778508Sblueswir1 ;; 73984778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 74084778508Sblueswir1 ;; 741379f6698SPaul Brook --enable-guest-base) guest_base="yes" 742379f6698SPaul Brook ;; 743379f6698SPaul Brook --disable-guest-base) guest_base="no" 744379f6698SPaul Brook ;; 74540d6444eSAvi Kivity --enable-pie) pie="yes" 74634005a00SKirill A. Shutemov ;; 74740d6444eSAvi Kivity --disable-pie) pie="no" 74834005a00SKirill A. Shutemov ;; 749c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 750c5937220Spbrook ;; 7513142255cSblueswir1 --sparc_cpu=*) 7523142255cSblueswir1 ;; 75385aa5189Sbellard --enable-werror) werror="yes" 75485aa5189Sbellard ;; 75585aa5189Sbellard --disable-werror) werror="no" 75685aa5189Sbellard ;; 7574d3b6f6eSbalrog --disable-curses) curses="no" 7584d3b6f6eSbalrog ;; 759c584a6d0SJuan Quintela --enable-curses) curses="yes" 760c584a6d0SJuan Quintela ;; 761769ce76dSAlexander Graf --disable-curl) curl="no" 762769ce76dSAlexander Graf ;; 763788c8196SJuan Quintela --enable-curl) curl="yes" 764788c8196SJuan Quintela ;; 7652df87df7SJuan Quintela --disable-fdt) fdt="no" 7662df87df7SJuan Quintela ;; 7672df87df7SJuan Quintela --enable-fdt) fdt="yes" 7682df87df7SJuan Quintela ;; 769bd0c5661Spbrook --disable-nptl) nptl="no" 770bd0c5661Spbrook ;; 771b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 772b0a47e79SJuan Quintela ;; 7738ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7748ff9cbf7Smalc ;; 7755c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7765c6c3a6cSChristoph Hellwig ;; 7775c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7785c6c3a6cSChristoph Hellwig ;; 779758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 780758e8e38SVenkateswararao Jujjuri (JV) ;; 781758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 782758e8e38SVenkateswararao Jujjuri (JV) ;; 78377755340Sths --disable-blobs) blobs="no" 78477755340Sths ;; 7854a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7864a19f1ecSpbrook ;; 787a25dba17SJuan Quintela --disable-docs) docs="no" 78870ec5dc0SAnthony Liguori ;; 789a25dba17SJuan Quintela --enable-docs) docs="yes" 79083a3ab8bSJuan Quintela ;; 791d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 792d5970055SMichael S. Tsirkin ;; 793d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 794d5970055SMichael S. Tsirkin ;; 79520ff075bSMichael Walle --disable-opengl) opengl="no" 79620ff075bSMichael Walle ;; 79720ff075bSMichael Walle --enable-opengl) opengl="yes" 79820ff075bSMichael Walle ;; 799f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 800f27aaf4bSChristian Brunner ;; 801f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 802f27aaf4bSChristian Brunner ;; 8038c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 8048c84cf11SSergei Trofimovich ;; 8058c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 8068c84cf11SSergei Trofimovich ;; 80736707144SAlon Levy --disable-smartcard) smartcard="no" 80836707144SAlon Levy ;; 80936707144SAlon Levy --enable-smartcard) smartcard="yes" 81036707144SAlon Levy ;; 811111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 812111a38b0SRobert Relyea ;; 813111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 814111a38b0SRobert Relyea ;; 81569354a83SHans de Goede --disable-usb-redir) usb_redir="no" 81669354a83SHans de Goede ;; 81769354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 81869354a83SHans de Goede ;; 8191ece9905SAlon Levy --disable-zlib-test) zlib="no" 8201ece9905SAlon Levy ;; 821d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 822d138cee9SMichael Roth ;; 823d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 824d138cee9SMichael Roth ;; 8257f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 8267f1559c6Sbalrog ;; 8277d13299dSbellard esac 8287d13299dSbellarddone 8297d13299dSbellard 8303142255cSblueswir1# 8313142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 832a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 8333142255cSblueswir1# 834379f6698SPaul Brookhost_guest_base="no" 83540293e58Sbellardcase "$cpu" in 836ed968ff1SJuan Quintela sparc) case $sparc_cpu in 837ed968ff1SJuan Quintela v7|v8) 838a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 839ed968ff1SJuan Quintela ;; 840ed968ff1SJuan Quintela v8plus|v8plusa) 841a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 842ed968ff1SJuan Quintela ;; 843ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 844a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 845ed968ff1SJuan Quintela esac 8460c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 847a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 848762e8230Sblueswir1 if test "$solaris" = "no" ; then 849a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 850c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 851762e8230Sblueswir1 fi 8523142255cSblueswir1 ;; 853ed968ff1SJuan Quintela sparc64) 854a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 8550c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 856a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 857ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 858a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 859762e8230Sblueswir1 fi 8603142255cSblueswir1 ;; 86176d83bdeSths s390) 86228d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 86328d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 86448bb3750SRichard Henderson host_guest_base="yes" 86528d7cc49SRichard Henderson ;; 86628d7cc49SRichard Henderson s390x) 86728d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 86828d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 86948bb3750SRichard Henderson host_guest_base="yes" 87076d83bdeSths ;; 87140293e58Sbellard i386) 872a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 8730c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 8742b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 875c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 876379f6698SPaul Brook host_guest_base="yes" 87740293e58Sbellard ;; 87840293e58Sbellard x86_64) 879a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 8800c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8812b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 882379f6698SPaul Brook host_guest_base="yes" 883379f6698SPaul Brook ;; 884379f6698SPaul Brook arm*) 885379f6698SPaul Brook host_guest_base="yes" 88640293e58Sbellard ;; 887f6548c0aSmalc ppc*) 888f6548c0aSmalc host_guest_base="yes" 889f6548c0aSmalc ;; 890cc01cc8eSAurelien Jarno mips*) 891cc01cc8eSAurelien Jarno host_guest_base="yes" 892cc01cc8eSAurelien Jarno ;; 893477ba620SAurelien Jarno ia64*) 894477ba620SAurelien Jarno host_guest_base="yes" 895477ba620SAurelien Jarno ;; 896fd76e73aSRichard Henderson hppa*) 897fd76e73aSRichard Henderson host_guest_base="yes" 898fd76e73aSRichard Henderson ;; 899d2fbca94SGuan Xuetao unicore32*) 900d2fbca94SGuan Xuetao host_guest_base="yes" 901d2fbca94SGuan Xuetao ;; 9023142255cSblueswir1esac 9033142255cSblueswir1 904379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 905379f6698SPaul Brook 90660e0df25SPeter Maydell 90760e0df25SPeter Maydelldefault_target_list="" 90860e0df25SPeter Maydell 90960e0df25SPeter Maydell# these targets are portable 91060e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 91160e0df25SPeter Maydell default_target_list="\ 91260e0df25SPeter Maydelli386-softmmu \ 91360e0df25SPeter Maydellx86_64-softmmu \ 91427cdad67SRichard Hendersonalpha-softmmu \ 91560e0df25SPeter Maydellarm-softmmu \ 91660e0df25SPeter Maydellcris-softmmu \ 91760e0df25SPeter Maydelllm32-softmmu \ 91860e0df25SPeter Maydellm68k-softmmu \ 91960e0df25SPeter Maydellmicroblaze-softmmu \ 92060e0df25SPeter Maydellmicroblazeel-softmmu \ 92160e0df25SPeter Maydellmips-softmmu \ 92260e0df25SPeter Maydellmipsel-softmmu \ 92360e0df25SPeter Maydellmips64-softmmu \ 92460e0df25SPeter Maydellmips64el-softmmu \ 92560e0df25SPeter Maydellppc-softmmu \ 92660e0df25SPeter Maydellppcemb-softmmu \ 92760e0df25SPeter Maydellppc64-softmmu \ 92860e0df25SPeter Maydellsh4-softmmu \ 92960e0df25SPeter Maydellsh4eb-softmmu \ 93060e0df25SPeter Maydellsparc-softmmu \ 93160e0df25SPeter Maydellsparc64-softmmu \ 9320f3301d4SAlexander Grafs390x-softmmu \ 933cfa550c6SMax Filippovxtensa-softmmu \ 934cfa550c6SMax Filippovxtensaeb-softmmu \ 93560e0df25SPeter Maydell" 93660e0df25SPeter Maydellfi 93760e0df25SPeter Maydell# the following are Linux specific 93860e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 93960e0df25SPeter Maydell default_target_list="${default_target_list}\ 94060e0df25SPeter Maydelli386-linux-user \ 94160e0df25SPeter Maydellx86_64-linux-user \ 94260e0df25SPeter Maydellalpha-linux-user \ 94360e0df25SPeter Maydellarm-linux-user \ 94460e0df25SPeter Maydellarmeb-linux-user \ 94560e0df25SPeter Maydellcris-linux-user \ 94660e0df25SPeter Maydellm68k-linux-user \ 94760e0df25SPeter Maydellmicroblaze-linux-user \ 94860e0df25SPeter Maydellmicroblazeel-linux-user \ 94960e0df25SPeter Maydellmips-linux-user \ 95060e0df25SPeter Maydellmipsel-linux-user \ 95160e0df25SPeter Maydellppc-linux-user \ 95260e0df25SPeter Maydellppc64-linux-user \ 95360e0df25SPeter Maydellppc64abi32-linux-user \ 95460e0df25SPeter Maydellsh4-linux-user \ 95560e0df25SPeter Maydellsh4eb-linux-user \ 95660e0df25SPeter Maydellsparc-linux-user \ 95760e0df25SPeter Maydellsparc64-linux-user \ 95860e0df25SPeter Maydellsparc32plus-linux-user \ 95960e0df25SPeter Maydellunicore32-linux-user \ 9600f3301d4SAlexander Grafs390x-linux-user \ 96160e0df25SPeter Maydell" 96260e0df25SPeter Maydellfi 96360e0df25SPeter Maydell# the following are Darwin specific 96460e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then 96560e0df25SPeter Maydell default_target_list="$default_target_list i386-darwin-user ppc-darwin-user " 96660e0df25SPeter Maydellfi 96760e0df25SPeter Maydell# the following are BSD specific 96860e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 96960e0df25SPeter Maydell default_target_list="${default_target_list}\ 97060e0df25SPeter Maydelli386-bsd-user \ 97160e0df25SPeter Maydellx86_64-bsd-user \ 97260e0df25SPeter Maydellsparc-bsd-user \ 97360e0df25SPeter Maydellsparc64-bsd-user \ 97460e0df25SPeter Maydell" 97560e0df25SPeter Maydellfi 97660e0df25SPeter Maydell 977af5db58eSpbrookif test x"$show_help" = x"yes" ; then 978af5db58eSpbrookcat << EOF 979af5db58eSpbrook 980af5db58eSpbrookUsage: configure [options] 981af5db58eSpbrookOptions: [defaults in brackets after descriptions] 982af5db58eSpbrook 983af5db58eSpbrookEOF 984af5db58eSpbrookecho "Standard options:" 985af5db58eSpbrookecho " --help print this message" 986af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 987af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 988af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 98960e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 99060e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 99160e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 992af5db58eSpbrookecho "" 993af5db58eSpbrookecho "Advanced options (experts only):" 994af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 995af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 996af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 9970bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 9980bfe8cc0SPaolo Bonziniecho " build time" 999a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 1000e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 1001af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 10026a882643Spbrookecho " --install=INSTALL use specified install [$install]" 1003c886edfbSBlue Swirlecho " --python=PYTHON use specified python [$python]" 1004e2d8830eSBradecho " --smbd=SMBD use specified smbd [$smbd]" 1005af5db58eSpbrookecho " --static enable static build [$static]" 10060b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 10070b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 10080b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 10090b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 10100b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 1011f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 1012f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 101309695a4aSStefan Weilecho " --enable-debug enable common debug build options" 1014890b1658Saliguoriecho " --enable-sparse enable sparse checker" 1015890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 10161625af87Saliguoriecho " --disable-strip disable stripping binaries" 101785aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 1018fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 1019c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 1020983eef5aSMeador Ingeecho " --disable-virtfs disable VirtFS" 1021983eef5aSMeador Ingeecho " --enable-virtfs enable VirtFS" 1022821601eaSJes Sorensenecho " --disable-vnc disable VNC" 1023821601eaSJes Sorensenecho " --enable-vnc enable VNC" 1024af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 1025c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 1026c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 10274c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 10284c9b53e3Smalcecho " Available cards: $audio_possible_cards" 1029eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 1030eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 10318ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 1032e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 1033fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 10342e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 10354ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 10368d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 10371be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 10382f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 1039ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 10402f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 10412f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 104296763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 1043efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 1044bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 1045bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 1046af896aaaSpbrookecho " --disable-curses disable curses output" 1047c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 1048769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 1049788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 10502df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 10512df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 1052fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 1053a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 10546093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 10557ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 1056b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 10579195b2c2SStefan Weilecho " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" 1058bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 1059e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 1060af5db58eSpbrookecho " --enable-system enable all system emulation targets" 1061af5db58eSpbrookecho " --disable-system disable all system emulation targets" 10620953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 10630953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 1064831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 1065831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 1066831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 1067831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 106884778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 106984778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 1070379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 1071379f6698SPaul Brookecho " emulation targets" 1072379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 107340d6444eSAvi Kivityecho " --enable-pie build Position Independent Executables" 107440d6444eSAvi Kivityecho " --disable-pie do not build Position Independent Executables" 1075af5db58eSpbrookecho " --fmod-lib path to FMOD library" 1076af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 10772f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 1078c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 1079235e510cS陳韋任echo " --cpu=CPU Build for host CPU [$cpu]" 10803142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 1081ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 1082ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 1083e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 1084dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 10855c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 10865c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 108747e98658SCorey Bryantecho " --disable-cap-ng disable libcap-ng support" 108847e98658SCorey Bryantecho " --enable-cap-ng enable libcap-ng support" 1089758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1090758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 109177755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1092d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1093d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1094d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1095d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1096320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1097320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 109874242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 10999410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1100cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1101cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1102f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 1103c589b249SRonnie Sahlbergecho " --disable-libiscsi disable iscsi support" 1104c589b249SRonnie Sahlbergecho " --enable-libiscsi enable iscsi support" 110536707144SAlon Levyecho " --disable-smartcard disable smartcard support" 110636707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1107111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1108111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 110969354a83SHans de Goedeecho " --disable-usb-redir disable usb network redirection support" 111069354a83SHans de Goedeecho " --enable-usb-redir enable usb network redirection support" 1111d138cee9SMichael Rothecho " --disable-guest-agent disable building of the QEMU Guest Agent" 1112d138cee9SMichael Rothecho " --enable-guest-agent enable building of the QEMU Guest Agent" 1113af5db58eSpbrookecho "" 11145bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1115af5db58eSpbrookexit 1 1116af5db58eSpbrookfi 1117af5db58eSpbrook 1118359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1119359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1120359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1121359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1122359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1123359bc95dSPeter Maydell ARCH=tci 1124359bc95dSPeter Maydell else 1125359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1126359bc95dSPeter Maydell exit 1 1127359bc95dSPeter Maydell fi 1128359bc95dSPeter Maydellfi 1129359bc95dSPeter Maydell 11308d05095cSPaolo Bonzini# check that the C compiler works. 11318d05095cSPaolo Bonzinicat > $TMPC <<EOF 113275cafad7SStefan Weilint main(void) { return 0; } 11338d05095cSPaolo BonziniEOF 11348d05095cSPaolo Bonzini 11358d05095cSPaolo Bonziniif compile_object ; then 11368d05095cSPaolo Bonzini : C compiler works ok 11378d05095cSPaolo Bonzinielse 11388d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 11398d05095cSPaolo Bonzini exit 1 11408d05095cSPaolo Bonzinifi 11418d05095cSPaolo Bonzini 11428d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 11438d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 11448d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1145f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 11468d05095cSPaolo Bonzinicat > $TMPC << EOF 11478d05095cSPaolo Bonziniint main(void) { return 0; } 11488d05095cSPaolo BonziniEOF 11498d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1150bd947d30SStefan Weil if compile_prog "-Werror $flag" "" ; then 11518d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 11528d05095cSPaolo Bonzini fi 11538d05095cSPaolo Bonzinidone 11548d05095cSPaolo Bonzini 115540d6444eSAvi Kivityif test "$static" = "yes" ; then 115640d6444eSAvi Kivity if test "$pie" = "yes" ; then 115740d6444eSAvi Kivity echo "static and pie are mutually incompatible" 115840d6444eSAvi Kivity exit 1 115940d6444eSAvi Kivity else 116040d6444eSAvi Kivity pie="no" 116140d6444eSAvi Kivity fi 116240d6444eSAvi Kivityfi 116340d6444eSAvi Kivity 116440d6444eSAvi Kivityif test "$pie" = ""; then 116540d6444eSAvi Kivity case "$cpu-$targetos" in 1166f9db31a2SBrad i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) 116740d6444eSAvi Kivity ;; 116840d6444eSAvi Kivity *) 116940d6444eSAvi Kivity pie="no" 117040d6444eSAvi Kivity ;; 117140d6444eSAvi Kivity esac 117240d6444eSAvi Kivityfi 117340d6444eSAvi Kivity 117440d6444eSAvi Kivityif test "$pie" != "no" ; then 117540d6444eSAvi Kivity cat > $TMPC << EOF 117621d4a791SAvi Kivity 117721d4a791SAvi Kivity#ifdef __linux__ 117821d4a791SAvi Kivity# define THREAD __thread 117921d4a791SAvi Kivity#else 118021d4a791SAvi Kivity# define THREAD 118121d4a791SAvi Kivity#endif 118221d4a791SAvi Kivity 118321d4a791SAvi Kivitystatic THREAD int tls_var; 118421d4a791SAvi Kivity 118521d4a791SAvi Kivityint main(void) { return tls_var; } 118621d4a791SAvi Kivity 118740d6444eSAvi KivityEOF 118840d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 118940d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 119040d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 119140d6444eSAvi Kivity pie="yes" 119240d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 119340d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 119440d6444eSAvi Kivity fi 119540d6444eSAvi Kivity else 119640d6444eSAvi Kivity if test "$pie" = "yes"; then 119740d6444eSAvi Kivity echo "PIE not available due to missing toolchain support" 119840d6444eSAvi Kivity exit 1 119940d6444eSAvi Kivity else 120040d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 120140d6444eSAvi Kivity pie="no" 120240d6444eSAvi Kivity fi 120340d6444eSAvi Kivity fi 120440d6444eSAvi Kivityfi 120540d6444eSAvi Kivity 1206ec530c81Sbellard# 1207ec530c81Sbellard# Solaris specific configure tool chain decisions 1208ec530c81Sbellard# 1209ec530c81Sbellardif test "$solaris" = "yes" ; then 12106792aa11SLoïc Minier if has $install; then 12116792aa11SLoïc Minier : 12126792aa11SLoïc Minier else 1213ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1214ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1215ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1216ec530c81Sbellard exit 1 1217ec530c81Sbellard fi 12186792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1219ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1220ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1221ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1222ec530c81Sbellard exit 1 1223ec530c81Sbellard fi 12246792aa11SLoïc Minier if has ar; then 12256792aa11SLoïc Minier : 12266792aa11SLoïc Minier else 1227ec530c81Sbellard echo "Error: No path includes ar" 1228ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1229ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1230ec530c81Sbellard fi 1231ec530c81Sbellard exit 1 1232ec530c81Sbellard fi 1233ec530c81Sbellardfi 1234ec530c81Sbellard 12357a3fc891SSebastian Herbsztif ! has $python; then 1236c886edfbSBlue Swirl echo "Python not found. Use --python=/path/to/python" 1237c886edfbSBlue Swirl exit 1 1238c886edfbSBlue Swirlfi 1239c886edfbSBlue Swirl 12405327cf48Sbellardif test -z "$target_list" ; then 124160e0df25SPeter Maydell target_list="$default_target_list" 12426e20a45fSbellardelse 1243b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 12445327cf48Sbellardfi 12450a8e90f4Spbrookif test -z "$target_list" ; then 12460a8e90f4Spbrook echo "No targets enabled" 12470a8e90f4Spbrook exit 1 12480a8e90f4Spbrookfi 1249f55fe278SPaolo Bonzini# see if system emulation was really requested 1250f55fe278SPaolo Bonzinicase " $target_list " in 1251f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1252f55fe278SPaolo Bonzini ;; 1253f55fe278SPaolo Bonzini *) softmmu=no 1254f55fe278SPaolo Bonzini ;; 1255f55fe278SPaolo Bonziniesac 12565327cf48Sbellard 1257249247c9SJuan Quintelafeature_not_found() { 1258249247c9SJuan Quintela feature=$1 1259249247c9SJuan Quintela 1260249247c9SJuan Quintela echo "ERROR" 1261249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 12629332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1263249247c9SJuan Quintela echo "ERROR" 1264249247c9SJuan Quintela exit 1; 1265249247c9SJuan Quintela} 1266249247c9SJuan Quintela 12677d13299dSbellardif test -z "$cross_prefix" ; then 12687d13299dSbellard 12697d13299dSbellard# --- 12707d13299dSbellard# big/little endian test 12717d13299dSbellardcat > $TMPC << EOF 12727d13299dSbellard#include <inttypes.h> 12737d13299dSbellardint main(int argc, char ** argv){ 12747d13299dSbellard volatile uint32_t i=0x01234567; 12757d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 12767d13299dSbellard} 12777d13299dSbellardEOF 12787d13299dSbellard 127952166aa0SJuan Quintelaif compile_prog "" "" ; then 12807d13299dSbellard$TMPE && bigendian="yes" 12817d13299dSbellardelse 12827d13299dSbellardecho big/little test failed 12837d13299dSbellardfi 12847d13299dSbellard 12857d13299dSbellardelse 12867d13299dSbellard 12877d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1288ea8f20f8SJuan Quintelacase "$cpu" in 128921d89f84SPeter Maydell arm) 129021d89f84SPeter Maydell # ARM can be either way; ask the compiler which one we are 129121d89f84SPeter Maydell if check_define __ARMEB__; then 129221d89f84SPeter Maydell bigendian=yes 129321d89f84SPeter Maydell fi 129421d89f84SPeter Maydell ;; 129521d89f84SPeter Maydell hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1296ea8f20f8SJuan Quintela bigendian=yes 1297ea8f20f8SJuan Quintela ;; 1298ea8f20f8SJuan Quintelaesac 12997d13299dSbellard 13007d13299dSbellardfi 13017d13299dSbellard 1302b0a47e79SJuan Quintela########################################## 1303b0a47e79SJuan Quintela# NPTL probe 1304b0a47e79SJuan Quintela 1305b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1306bd0c5661Spbrook cat > $TMPC <<EOF 1307bd0c5661Spbrook#include <sched.h> 130830813ceaSpbrook#include <linux/futex.h> 1309182eacc0SStefan Weilint main(void) { 1310bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1311bd0c5661Spbrook#error bork 1312bd0c5661Spbrook#endif 1313182eacc0SStefan Weil return 0; 1314bd0c5661Spbrook} 1315bd0c5661SpbrookEOF 1316bd0c5661Spbrook 131752166aa0SJuan Quintela if compile_object ; then 1318b0a47e79SJuan Quintela nptl=yes 1319bd0c5661Spbrook else 1320b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1321b0a47e79SJuan Quintela feature_not_found "nptl" 1322b0a47e79SJuan Quintela fi 1323b0a47e79SJuan Quintela nptl=no 1324b0a47e79SJuan Quintela fi 1325bd0c5661Spbrookfi 1326bd0c5661Spbrook 132711d9f695Sbellard########################################## 1328ac62922eSbalrog# zlib check 1329ac62922eSbalrog 13301ece9905SAlon Levyif test "$zlib" != "no" ; then 1331ac62922eSbalrog cat > $TMPC << EOF 1332ac62922eSbalrog#include <zlib.h> 1333ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1334ac62922eSbalrogEOF 133552166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1336ac62922eSbalrog : 1337ac62922eSbalrog else 1338ac62922eSbalrog echo 1339ac62922eSbalrog echo "Error: zlib check failed" 1340ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1341ac62922eSbalrog echo 1342ac62922eSbalrog exit 1 1343ac62922eSbalrog fi 13441ece9905SAlon Levyfi 1345ac62922eSbalrog 1346ac62922eSbalrog########################################## 1347e37630caSaliguori# xen probe 1348e37630caSaliguori 1349fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1350b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1351d5b93ddfSAnthony PERARD 135250ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 135350ced5b3SStefan Weil # If no, we are done and there is no Xen support. 135450ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 135550ced5b3SStefan Weil 135650ced5b3SStefan Weil # Xen (any) 135750ced5b3SStefan Weil cat > $TMPC <<EOF 135850ced5b3SStefan Weil#include <xenctrl.h> 135950ced5b3SStefan Weil#include <xs.h> 136050ced5b3SStefan Weilint main(void) { 136150ced5b3SStefan Weil return 0; 136250ced5b3SStefan Weil} 136350ced5b3SStefan WeilEOF 136450ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 136550ced5b3SStefan Weil # Xen not found 136650ced5b3SStefan Weil if test "$xen" = "yes" ; then 136750ced5b3SStefan Weil feature_not_found "xen" 136850ced5b3SStefan Weil fi 136950ced5b3SStefan Weil xen=no 137050ced5b3SStefan Weil 1371d5b93ddfSAnthony PERARD # Xen unstable 137250ced5b3SStefan Weil elif ( 1373e37630caSaliguori cat > $TMPC <<EOF 1374e37630caSaliguori#include <xenctrl.h> 1375e37630caSaliguori#include <xs.h> 1376d5b93ddfSAnthony PERARD#include <stdint.h> 1377d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1378d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1379d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1380d5b93ddfSAnthony PERARD#endif 1381d5b93ddfSAnthony PERARDint main(void) { 1382d5b93ddfSAnthony PERARD xc_interface *xc; 1383d5b93ddfSAnthony PERARD xs_daemon_open(); 1384d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1385d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1386d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1387b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1388d5b93ddfSAnthony PERARD return 0; 1389d5b93ddfSAnthony PERARD} 1390e37630caSaliguoriEOF 139150ced5b3SStefan Weil compile_prog "" "$xen_libs" 139250ced5b3SStefan Weil ) ; then 1393d5b93ddfSAnthony PERARD xen_ctrl_version=410 1394fc321b4bSJuan Quintela xen=yes 1395d5b93ddfSAnthony PERARD 1396d5b93ddfSAnthony PERARD # Xen 4.0.0 1397d5b93ddfSAnthony PERARD elif ( 1398d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1399d5b93ddfSAnthony PERARD#include <xenctrl.h> 1400d5b93ddfSAnthony PERARD#include <xs.h> 1401d5b93ddfSAnthony PERARD#include <stdint.h> 1402d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1403d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1404d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1405d5b93ddfSAnthony PERARD#endif 1406d5b93ddfSAnthony PERARDint main(void) { 1407b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1408b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1409b87de24eSAnthony PERARD }; 1410d5b93ddfSAnthony PERARD xs_daemon_open(); 1411d5b93ddfSAnthony PERARD xc_interface_open(); 1412d5b93ddfSAnthony PERARD xc_gnttab_open(); 1413d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1414b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1415d5b93ddfSAnthony PERARD return 0; 1416d5b93ddfSAnthony PERARD} 1417d5b93ddfSAnthony PERARDEOF 1418d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1419d5b93ddfSAnthony PERARD ) ; then 1420d5b93ddfSAnthony PERARD xen_ctrl_version=400 1421d5b93ddfSAnthony PERARD xen=yes 1422d5b93ddfSAnthony PERARD 1423b87de24eSAnthony PERARD # Xen 3.4.0 1424b87de24eSAnthony PERARD elif ( 1425b87de24eSAnthony PERARD cat > $TMPC <<EOF 1426b87de24eSAnthony PERARD#include <xenctrl.h> 1427b87de24eSAnthony PERARD#include <xs.h> 1428b87de24eSAnthony PERARDint main(void) { 1429b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1430b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1431b87de24eSAnthony PERARD }; 1432b87de24eSAnthony PERARD xs_daemon_open(); 1433b87de24eSAnthony PERARD xc_interface_open(); 1434b87de24eSAnthony PERARD xc_gnttab_open(); 1435b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1436b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1437b87de24eSAnthony PERARD return 0; 1438b87de24eSAnthony PERARD} 1439b87de24eSAnthony PERARDEOF 1440b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 1441b87de24eSAnthony PERARD ) ; then 1442b87de24eSAnthony PERARD xen_ctrl_version=340 1443b87de24eSAnthony PERARD xen=yes 1444b87de24eSAnthony PERARD 1445b87de24eSAnthony PERARD # Xen 3.3.0 1446d5b93ddfSAnthony PERARD elif ( 1447d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1448d5b93ddfSAnthony PERARD#include <xenctrl.h> 1449d5b93ddfSAnthony PERARD#include <xs.h> 1450d5b93ddfSAnthony PERARDint main(void) { 1451d5b93ddfSAnthony PERARD xs_daemon_open(); 1452d5b93ddfSAnthony PERARD xc_interface_open(); 1453d5b93ddfSAnthony PERARD xc_gnttab_open(); 1454d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1455d5b93ddfSAnthony PERARD return 0; 1456d5b93ddfSAnthony PERARD} 1457d5b93ddfSAnthony PERARDEOF 1458d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1459d5b93ddfSAnthony PERARD ) ; then 1460d5b93ddfSAnthony PERARD xen_ctrl_version=330 1461d5b93ddfSAnthony PERARD xen=yes 1462d5b93ddfSAnthony PERARD 146350ced5b3SStefan Weil # Xen version unsupported 1464e37630caSaliguori else 1465fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 146650ced5b3SStefan Weil feature_not_found "xen (unsupported version)" 1467fc321b4bSJuan Quintela fi 1468fc321b4bSJuan Quintela xen=no 1469e37630caSaliguori fi 1470d5b93ddfSAnthony PERARD 1471d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1472d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1473d5b93ddfSAnthony PERARD fi 1474e37630caSaliguorifi 1475e37630caSaliguori 1476e37630caSaliguori########################################## 1477a8bd70adSPaolo Bonzini# pkg-config probe 1478f91672e5SPaolo Bonzini 147917884d7bSSergei Trofimovichif ! has "$pkg_config_exe"; then 148017884d7bSSergei Trofimovich echo "Error: pkg-config binary '$pkg_config_exe' not found" 1481a213fcb2SPeter Maydell exit 1 1482f91672e5SPaolo Bonzinifi 1483f91672e5SPaolo Bonzini 1484f91672e5SPaolo Bonzini########################################## 148544dc0ca3SAlon Levy# libtool probe 148644dc0ca3SAlon Levy 14873f534581SBradif ! has $libtool; then 148844dc0ca3SAlon Levy libtool= 148944dc0ca3SAlon Levyfi 149044dc0ca3SAlon Levy 149144dc0ca3SAlon Levy########################################## 1492dfffc653SJuan Quintela# Sparse probe 1493dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 14940dba6195SLoïc Minier if has cgcc; then 1495dfffc653SJuan Quintela sparse=yes 1496dfffc653SJuan Quintela else 1497dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1498dfffc653SJuan Quintela feature_not_found "sparse" 1499dfffc653SJuan Quintela fi 1500dfffc653SJuan Quintela sparse=no 1501dfffc653SJuan Quintela fi 1502dfffc653SJuan Quintelafi 1503dfffc653SJuan Quintela 1504dfffc653SJuan Quintela########################################## 150511d9f695Sbellard# SDL probe 150611d9f695Sbellard 15073ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 15083ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 15093ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 15103ec87ffeSPaolo Bonzini sdl_config=sdl-config 15113ec87ffeSPaolo Bonzinifi 15123ec87ffeSPaolo Bonzini 15133ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1514a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1515fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 15163ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 15173ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 15189316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1519a0dfd8a4SLoïc Minierelse 1520a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1521a0dfd8a4SLoïc Minier feature_not_found "sdl" 1522a0dfd8a4SLoïc Minier fi 1523a0dfd8a4SLoïc Minier sdl=no 15249316f803SPaolo Bonzinifi 152529e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 15263ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 15273ec87ffeSPaolo Bonzinifi 152811d9f695Sbellard 15299316f803SPaolo Bonzinisdl_too_old=no 1530c4198157SJuan Quintelaif test "$sdl" != "no" ; then 153111d9f695Sbellard cat > $TMPC << EOF 153211d9f695Sbellard#include <SDL.h> 153311d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 153411d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 153511d9f695SbellardEOF 15369316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 153774f42e18STeLeMan if test "$static" = "yes" ; then 153874f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 153974f42e18STeLeMan else 15409316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 154174f42e18STeLeMan fi 154252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 154311d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 154411d9f695Sbellard sdl_too_old=yes 154511d9f695Sbellard else 1546fd677642Sths if test "$cocoa" = "no" ; then 154711d9f695Sbellard sdl=yes 154811d9f695Sbellard fi 1549fd677642Sths fi 15507c1f25b4Sbellard 155167c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 15521ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 155367c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1554f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1555f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 155611d9f695Sbellard fi 155752166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 15581ac88f28SJuan Quintela : 15591ac88f28SJuan Quintela else 15601ac88f28SJuan Quintela sdl=no 15617c1f25b4Sbellard fi 15627c1f25b4Sbellard fi # static link 1563c4198157SJuan Quintela else # sdl not found 1564c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1565c4198157SJuan Quintela feature_not_found "sdl" 1566c4198157SJuan Quintela fi 1567c4198157SJuan Quintela sdl=no 15687c1f25b4Sbellard fi # sdl compile test 1569fd677642Sthsfi 157011d9f695Sbellard 15715368a422Saliguoriif test "$sdl" = "yes" ; then 15725368a422Saliguori cat > $TMPC <<EOF 15735368a422Saliguori#include <SDL.h> 15745368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 15755368a422Saliguori#include <X11/XKBlib.h> 15765368a422Saliguori#else 15775368a422Saliguori#error No x11 support 15785368a422Saliguori#endif 15795368a422Saliguoriint main(void) { return 0; } 15805368a422SaliguoriEOF 158152166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1582681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 15835368a422Saliguori fi 15840705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 15855368a422Saliguorifi 15865368a422Saliguori 15878f28f3fbSths########################################## 15888d5d2d4cSths# VNC TLS detection 1589821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1590ae6b5e5aSaliguori cat > $TMPC <<EOF 1591ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1592ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1593ae6b5e5aSaliguoriEOF 1594a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1595a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 159652166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 15971be10ad2SJuan Quintela vnc_tls=yes 1598a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1599ae6b5e5aSaliguori else 16001be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 16011be10ad2SJuan Quintela feature_not_found "vnc-tls" 16021be10ad2SJuan Quintela fi 16031be10ad2SJuan Quintela vnc_tls=no 16048d5d2d4cSths fi 16058d5d2d4cSthsfi 16068d5d2d4cSths 16078d5d2d4cSths########################################## 16082f9606b3Saliguori# VNC SASL detection 1609821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 16102f9606b3Saliguori cat > $TMPC <<EOF 16112f9606b3Saliguori#include <sasl/sasl.h> 16122f9606b3Saliguori#include <stdio.h> 16132f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 16142f9606b3SaliguoriEOF 16152f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 16162f9606b3Saliguori vnc_sasl_cflags="" 16172f9606b3Saliguori vnc_sasl_libs="-lsasl2" 161852166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1619ea784e3bSJuan Quintela vnc_sasl=yes 1620fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 16212f9606b3Saliguori else 1622ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1623ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1624ea784e3bSJuan Quintela fi 1625ea784e3bSJuan Quintela vnc_sasl=no 16262f9606b3Saliguori fi 16272f9606b3Saliguorifi 16282f9606b3Saliguori 16292f9606b3Saliguori########################################## 16302f6f5c7aSCorentin Chary# VNC JPEG detection 1631821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 16322f6f5c7aSCorentin Charycat > $TMPC <<EOF 16332f6f5c7aSCorentin Chary#include <stdio.h> 16342f6f5c7aSCorentin Chary#include <jpeglib.h> 16352f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 16362f6f5c7aSCorentin CharyEOF 16372f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 16382f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 16392f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 16402f6f5c7aSCorentin Chary vnc_jpeg=yes 16412f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 16422f6f5c7aSCorentin Chary else 16432f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 16442f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 16452f6f5c7aSCorentin Chary fi 16462f6f5c7aSCorentin Chary vnc_jpeg=no 16472f6f5c7aSCorentin Chary fi 16482f6f5c7aSCorentin Charyfi 16492f6f5c7aSCorentin Chary 16502f6f5c7aSCorentin Chary########################################## 1651efe556adSCorentin Chary# VNC PNG detection 1652821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1653efe556adSCorentin Charycat > $TMPC <<EOF 1654efe556adSCorentin Chary//#include <stdio.h> 1655efe556adSCorentin Chary#include <png.h> 1656832ce9c2SScott Wood#include <stddef.h> 1657efe556adSCorentin Charyint main(void) { 1658efe556adSCorentin Chary png_structp png_ptr; 1659efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1660efe556adSCorentin Chary return 0; 1661efe556adSCorentin Chary} 1662efe556adSCorentin CharyEOF 16639af8025eSBrad if $pkg_config libpng --modversion >/dev/null 2>&1; then 16649af8025eSBrad vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` 16659af8025eSBrad vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` 16669af8025eSBrad else 1667efe556adSCorentin Chary vnc_png_cflags="" 1668efe556adSCorentin Chary vnc_png_libs="-lpng" 16699af8025eSBrad fi 1670efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1671efe556adSCorentin Chary vnc_png=yes 1672efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 16739af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 1674efe556adSCorentin Chary else 1675efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1676efe556adSCorentin Chary feature_not_found "vnc-png" 1677efe556adSCorentin Chary fi 1678efe556adSCorentin Chary vnc_png=no 1679efe556adSCorentin Chary fi 1680efe556adSCorentin Charyfi 1681efe556adSCorentin Chary 1682efe556adSCorentin Chary########################################## 168376655d6dSaliguori# fnmatch() probe, used for ACL routines 168476655d6dSaliguorifnmatch="no" 168576655d6dSaliguoricat > $TMPC << EOF 168676655d6dSaliguori#include <fnmatch.h> 168776655d6dSaliguoriint main(void) 168876655d6dSaliguori{ 168976655d6dSaliguori fnmatch("foo", "foo", 0); 169076655d6dSaliguori return 0; 169176655d6dSaliguori} 169276655d6dSaliguoriEOF 169352166aa0SJuan Quintelaif compile_prog "" "" ; then 169476655d6dSaliguori fnmatch="yes" 169576655d6dSaliguorifi 169676655d6dSaliguori 169776655d6dSaliguori########################################## 1698ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1699ee682d27SStefan Weilif test "$uuid" != "no" ; then 1700ee682d27SStefan Weil uuid_libs="-luuid" 1701ee682d27SStefan Weil cat > $TMPC << EOF 1702ee682d27SStefan Weil#include <uuid/uuid.h> 1703ee682d27SStefan Weilint main(void) 1704ee682d27SStefan Weil{ 1705ee682d27SStefan Weil uuid_t my_uuid; 1706ee682d27SStefan Weil uuid_generate(my_uuid); 1707ee682d27SStefan Weil return 0; 1708ee682d27SStefan Weil} 1709ee682d27SStefan WeilEOF 1710ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1711ee682d27SStefan Weil uuid="yes" 1712ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1713ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1714ee682d27SStefan Weil else 1715ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1716ee682d27SStefan Weil feature_not_found "uuid" 1717ee682d27SStefan Weil fi 1718ee682d27SStefan Weil uuid=no 1719ee682d27SStefan Weil fi 1720ee682d27SStefan Weilfi 1721ee682d27SStefan Weil 1722ee682d27SStefan Weil########################################## 1723dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1724dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1725dce512deSChristoph Hellwig cat > $TMPC << EOF 1726ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 1727dce512deSChristoph Hellwig#include <xfs/xfs.h> 1728dce512deSChristoph Hellwigint main(void) 1729dce512deSChristoph Hellwig{ 1730dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1731dce512deSChristoph Hellwig return 0; 1732dce512deSChristoph Hellwig} 1733dce512deSChristoph HellwigEOF 1734dce512deSChristoph Hellwig if compile_prog "" "" ; then 1735dce512deSChristoph Hellwig xfs="yes" 1736dce512deSChristoph Hellwig else 1737dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1738dce512deSChristoph Hellwig feature_not_found "xfs" 1739dce512deSChristoph Hellwig fi 1740dce512deSChristoph Hellwig xfs=no 1741dce512deSChristoph Hellwig fi 1742dce512deSChristoph Hellwigfi 1743dce512deSChristoph Hellwig 1744dce512deSChristoph Hellwig########################################## 17458a16d273Sths# vde libraries probe 1746dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 17474baae0acSJuan Quintela vde_libs="-lvdeplug" 17488a16d273Sths cat > $TMPC << EOF 17498a16d273Sths#include <libvdeplug.h> 17504a7f0e06Spbrookint main(void) 17514a7f0e06Spbrook{ 17524a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 17534a7f0e06Spbrook vde_open("", "", &a); 17544a7f0e06Spbrook return 0; 17554a7f0e06Spbrook} 17568a16d273SthsEOF 175752166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 17584baae0acSJuan Quintela vde=yes 17598e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 17608e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1761dfb278bdSJuan Quintela else 1762dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1763dfb278bdSJuan Quintela feature_not_found "vde" 1764dfb278bdSJuan Quintela fi 1765dfb278bdSJuan Quintela vde=no 17668a16d273Sths fi 17678a16d273Sthsfi 17688a16d273Sths 17698a16d273Sths########################################## 177047e98658SCorey Bryant# libcap-ng library probe 177147e98658SCorey Bryantif test "$cap_ng" != "no" ; then 177247e98658SCorey Bryant cap_libs="-lcap-ng" 177347e98658SCorey Bryant cat > $TMPC << EOF 177447e98658SCorey Bryant#include <cap-ng.h> 177547e98658SCorey Bryantint main(void) 177647e98658SCorey Bryant{ 177747e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 177847e98658SCorey Bryant return 0; 177947e98658SCorey Bryant} 178047e98658SCorey BryantEOF 178147e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 178247e98658SCorey Bryant cap_ng=yes 178347e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 178447e98658SCorey Bryant else 178547e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 178647e98658SCorey Bryant feature_not_found "cap_ng" 178747e98658SCorey Bryant fi 178847e98658SCorey Bryant cap_ng=no 178947e98658SCorey Bryant fi 179047e98658SCorey Bryantfi 179147e98658SCorey Bryant 179247e98658SCorey Bryant########################################## 1793c2de5c91Smalc# Sound support libraries probe 17948f28f3fbSths 1795c2de5c91Smalcaudio_drv_probe() 1796c2de5c91Smalc{ 1797c2de5c91Smalc drv=$1 1798c2de5c91Smalc hdr=$2 1799c2de5c91Smalc lib=$3 1800c2de5c91Smalc exp=$4 1801c2de5c91Smalc cfl=$5 18028f28f3fbSths cat > $TMPC << EOF 1803c2de5c91Smalc#include <$hdr> 1804c2de5c91Smalcint main(void) { $exp } 18058f28f3fbSthsEOF 180652166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 18078f28f3fbSths : 18088f28f3fbSths else 18098f28f3fbSths echo 1810c2de5c91Smalc echo "Error: $drv check failed" 1811c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 18128f28f3fbSths echo 18138f28f3fbSths exit 1 18148f28f3fbSths fi 1815c2de5c91Smalc} 1816c2de5c91Smalc 18172fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1818c2de5c91Smalcfor drv in $audio_drv_list; do 1819c2de5c91Smalc case $drv in 1820c2de5c91Smalc alsa) 1821c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1822c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1823a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1824c2de5c91Smalc ;; 1825c2de5c91Smalc 1826c2de5c91Smalc fmod) 1827c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1828c2de5c91Smalc echo 1829c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1830c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1831c2de5c91Smalc echo 1832c2de5c91Smalc exit 1 18338f28f3fbSths fi 1834c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1835a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1836c2de5c91Smalc ;; 1837c2de5c91Smalc 1838c2de5c91Smalc esd) 1839c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1840a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 184167f86e8eSJuan Quintela audio_pt_int="yes" 1842c2de5c91Smalc ;; 1843b8e59f18Smalc 1844b8e59f18Smalc pa) 1845493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 184620fa53ecSMarc-Antoine Perennou "pa_simple *s = 0; pa_simple_free(s); return 0;" 1847493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 184867f86e8eSJuan Quintela audio_pt_int="yes" 1849b8e59f18Smalc ;; 1850b8e59f18Smalc 1851997e690aSJuan Quintela coreaudio) 1852997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1853997e690aSJuan Quintela ;; 1854997e690aSJuan Quintela 1855a4bf6780SJuan Quintela dsound) 1856a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1857d5631638Smalc audio_win_int="yes" 1858a4bf6780SJuan Quintela ;; 1859a4bf6780SJuan Quintela 1860a4bf6780SJuan Quintela oss) 1861a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1862a4bf6780SJuan Quintela ;; 1863a4bf6780SJuan Quintela 1864a4bf6780SJuan Quintela sdl|wav) 18652f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 18662f6a1ab0Sblueswir1 ;; 18672f6a1ab0Sblueswir1 1868d5631638Smalc winwave) 1869d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1870d5631638Smalc audio_win_int="yes" 1871d5631638Smalc ;; 1872d5631638Smalc 1873e4c63a6aSmalc *) 18741c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1875e4c63a6aSmalc echo 1876e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1877e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1878e4c63a6aSmalc echo 1879e4c63a6aSmalc exit 1 1880e4c63a6aSmalc } 1881e4c63a6aSmalc ;; 1882c2de5c91Smalc esac 1883c2de5c91Smalcdone 18848f28f3fbSths 18854d3b6f6eSbalrog########################################## 18862e4d9fb1Saurel32# BrlAPI probe 18872e4d9fb1Saurel32 18884ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1889eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 18902e4d9fb1Saurel32 cat > $TMPC << EOF 18912e4d9fb1Saurel32#include <brlapi.h> 1892832ce9c2SScott Wood#include <stddef.h> 18932e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 18942e4d9fb1Saurel32EOF 189552166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 18962e4d9fb1Saurel32 brlapi=yes 1897264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 18984ffcedb6SJuan Quintela else 18994ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 19004ffcedb6SJuan Quintela feature_not_found "brlapi" 19014ffcedb6SJuan Quintela fi 19024ffcedb6SJuan Quintela brlapi=no 1903eb82284fSJuan Quintela fi 1904eb82284fSJuan Quintelafi 19052e4d9fb1Saurel32 19062e4d9fb1Saurel32########################################## 19074d3b6f6eSbalrog# curses probe 1908e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 1909e095e2f3SStefan Weil curses_list="-lpdcurses" 1910e095e2f3SStefan Weilelse 19114f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 1912e095e2f3SStefan Weilfi 19134d3b6f6eSbalrog 1914c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1915c584a6d0SJuan Quintela curses_found=no 19164d3b6f6eSbalrog cat > $TMPC << EOF 19174d3b6f6eSbalrog#include <curses.h> 1918ef9a2524SStefan Weilint main(void) { 1919ef9a2524SStefan Weil const char *s = curses_version(); 1920ef9a2524SStefan Weil resize_term(0, 0); 1921ef9a2524SStefan Weil return s != 0; 1922ef9a2524SStefan Weil} 19234d3b6f6eSbalrogEOF 19244f78ef9aSJuan Quintela for curses_lib in $curses_list; do 19254f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1926c584a6d0SJuan Quintela curses_found=yes 19274f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 19284f78ef9aSJuan Quintela break 19294d3b6f6eSbalrog fi 19304f78ef9aSJuan Quintela done 1931c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1932c584a6d0SJuan Quintela curses=yes 1933c584a6d0SJuan Quintela else 1934c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1935c584a6d0SJuan Quintela feature_not_found "curses" 1936c584a6d0SJuan Quintela fi 1937c584a6d0SJuan Quintela curses=no 1938c584a6d0SJuan Quintela fi 19394f78ef9aSJuan Quintelafi 19404d3b6f6eSbalrog 1941414f0dabSblueswir1########################################## 1942769ce76dSAlexander Graf# curl probe 1943769ce76dSAlexander Graf 1944a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1945a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 19464e2b0658SPaolo Bonzinielse 19474e2b0658SPaolo Bonzini curlconfig=curl-config 19484e2b0658SPaolo Bonzinifi 19494e2b0658SPaolo Bonzini 1950788c8196SJuan Quintelaif test "$curl" != "no" ; then 1951769ce76dSAlexander Graf cat > $TMPC << EOF 1952769ce76dSAlexander Graf#include <curl/curl.h> 19530b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 1954769ce76dSAlexander GrafEOF 19554e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 19564e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1957b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1958769ce76dSAlexander Graf curl=yes 1959f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1960f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1961788c8196SJuan Quintela else 1962788c8196SJuan Quintela if test "$curl" = "yes" ; then 1963788c8196SJuan Quintela feature_not_found "curl" 1964788c8196SJuan Quintela fi 1965788c8196SJuan Quintela curl=no 1966769ce76dSAlexander Graf fi 1967769ce76dSAlexander Graffi # test "$curl" 1968769ce76dSAlexander Graf 1969769ce76dSAlexander Graf########################################## 1970fb599c9aSbalrog# bluez support probe 1971a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1972e820e3f4Sbalrog cat > $TMPC << EOF 1973e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1974e820e3f4Sbalrogint main(void) { return bt_error(0); } 1975e820e3f4SbalrogEOF 1976a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1977a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 197852166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1979a20a6f46SJuan Quintela bluez=yes 1980e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1981e820e3f4Sbalrog else 1982a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1983a20a6f46SJuan Quintela feature_not_found "bluez" 1984a20a6f46SJuan Quintela fi 1985e820e3f4Sbalrog bluez="no" 1986e820e3f4Sbalrog fi 1987fb599c9aSbalrogfi 1988fb599c9aSbalrog 1989fb599c9aSbalrog########################################## 1990e18df141SAnthony Liguori# glib support probe 19914b76a481SStefan Hajnocziif $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then 19924b76a481SStefan Hajnoczi glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` 19934b76a481SStefan Hajnoczi glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` 199414015304SAnthony Liguori LIBS="$glib_libs $LIBS" 1995957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 1996e18df141SAnthony Liguorielse 1997e18df141SAnthony Liguori echo "glib-2.0 required to compile QEMU" 1998e18df141SAnthony Liguori exit 1 1999e18df141SAnthony Liguorifi 2000e18df141SAnthony Liguori 2001e18df141SAnthony Liguori########################################## 200217bff52bSM. Mohan Kumar# libcap probe 200317bff52bSM. Mohan Kumar 200417bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 200517bff52bSM. Mohan Kumar cat > $TMPC <<EOF 200617bff52bSM. Mohan Kumar#include <stdio.h> 200717bff52bSM. Mohan Kumar#include <sys/capability.h> 200817bff52bSM. Mohan Kumarint main(void) { cap_t caps; caps = cap_init(); } 200917bff52bSM. Mohan KumarEOF 201017bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 201117bff52bSM. Mohan Kumar cap=yes 201217bff52bSM. Mohan Kumar else 201317bff52bSM. Mohan Kumar cap=no 201417bff52bSM. Mohan Kumar fi 201517bff52bSM. Mohan Kumarfi 201617bff52bSM. Mohan Kumar 201717bff52bSM. Mohan Kumar########################################## 2018e5d355d1Saliguori# pthread probe 20194b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 20203c529d93Saliguori 2021e5d355d1Saliguoripthread=no 2022414f0dabSblueswir1cat > $TMPC << EOF 20233c529d93Saliguori#include <pthread.h> 20247a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 20257a42bbe4SStefan Weilint main(void) { 20267a42bbe4SStefan Weil pthread_t thread; 20277a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 20287a42bbe4SStefan Weil return 0; 20297a42bbe4SStefan Weil} 2030414f0dabSblueswir1EOF 2031bd00d539SAndreas Färberif compile_prog "" "" ; then 2032bd00d539SAndreas Färber pthread=yes 2033bd00d539SAndreas Färberelse 2034de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 203552166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 2036e5d355d1Saliguori pthread=yes 20375572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 2038de65fe0fSSebastian Herbszt break 2039414f0dabSblueswir1 fi 2040de65fe0fSSebastian Herbszt done 2041bd00d539SAndreas Färberfi 2042414f0dabSblueswir1 20434617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 20444dd75c70SChristoph Hellwig echo 20454dd75c70SChristoph Hellwig echo "Error: pthread check failed" 20464dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 20474dd75c70SChristoph Hellwig echo 20484dd75c70SChristoph Hellwig exit 1 2049e5d355d1Saliguorifi 2050e5d355d1Saliguori 2051bf9298b9Saliguori########################################## 2052f27aaf4bSChristian Brunner# rbd probe 2053f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2054f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2055f27aaf4bSChristian Brunner#include <stdio.h> 2056ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2057f27aaf4bSChristian Brunnerint main(void) { 2058ad32e9c0SJosh Durgin rados_t cluster; 2059ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2060f27aaf4bSChristian Brunner return 0; 2061f27aaf4bSChristian Brunner} 2062f27aaf4bSChristian BrunnerEOF 2063ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2064f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2065f27aaf4bSChristian Brunner rbd=yes 2066f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 2067f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 2068f27aaf4bSChristian Brunner else 2069f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 2070f27aaf4bSChristian Brunner feature_not_found "rados block device" 2071f27aaf4bSChristian Brunner fi 2072f27aaf4bSChristian Brunner rbd=no 2073f27aaf4bSChristian Brunner fi 2074f27aaf4bSChristian Brunnerfi 2075f27aaf4bSChristian Brunner 2076f27aaf4bSChristian Brunner########################################## 20775c6c3a6cSChristoph Hellwig# linux-aio probe 20785c6c3a6cSChristoph Hellwig 20795c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 20805c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 20815c6c3a6cSChristoph Hellwig#include <libaio.h> 20825c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2083832ce9c2SScott Wood#include <stddef.h> 20845c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 20855c6c3a6cSChristoph HellwigEOF 20865c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 20875c6c3a6cSChristoph Hellwig linux_aio=yes 2088048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 2089048d179fSPaul Brook libs_tools="$libs_tools -laio" 20905c6c3a6cSChristoph Hellwig else 20915c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 20925c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 20935c6c3a6cSChristoph Hellwig fi 20943cfcae3cSLuiz Capitulino linux_aio=no 20955c6c3a6cSChristoph Hellwig fi 20965c6c3a6cSChristoph Hellwigfi 20975c6c3a6cSChristoph Hellwig 20985c6c3a6cSChristoph Hellwig########################################## 2099758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2100758e8e38SVenkateswararao Jujjuri (JV) 2101758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2102758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2103758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2104758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2105f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2106f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2107f2338fb4SPavel Borzenkov#else 21084f26f2b6SAvi Kivity#include <sys/xattr.h> 2109f2338fb4SPavel Borzenkov#endif 2110758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2111758e8e38SVenkateswararao Jujjuri (JV)EOF 21124f26f2b6SAvi Kivity if compile_prog "" "" ; then 21134f26f2b6SAvi Kivity attr=yes 21144f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2115f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2116758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2117758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 21184f26f2b6SAvi Kivity libattr=yes 2119758e8e38SVenkateswararao Jujjuri (JV) else 2120758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2121758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 2122758e8e38SVenkateswararao Jujjuri (JV) fi 2123758e8e38SVenkateswararao Jujjuri (JV) attr=no 2124758e8e38SVenkateswararao Jujjuri (JV) fi 2125758e8e38SVenkateswararao Jujjuri (JV)fi 2126758e8e38SVenkateswararao Jujjuri (JV) 2127758e8e38SVenkateswararao Jujjuri (JV)########################################## 2128bf9298b9Saliguori# iovec probe 2129bf9298b9Saliguoricat > $TMPC <<EOF 2130db34f0b3Sblueswir1#include <sys/types.h> 2131bf9298b9Saliguori#include <sys/uio.h> 2132db34f0b3Sblueswir1#include <unistd.h> 2133f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2134bf9298b9SaliguoriEOF 2135bf9298b9Saliguoriiovec=no 213652166aa0SJuan Quintelaif compile_prog "" "" ; then 2137bf9298b9Saliguori iovec=yes 2138bf9298b9Saliguorifi 2139bf9298b9Saliguori 2140f652e6afSaurel32########################################## 2141ceb42de8Saliguori# preadv probe 2142ceb42de8Saliguoricat > $TMPC <<EOF 2143ceb42de8Saliguori#include <sys/types.h> 2144ceb42de8Saliguori#include <sys/uio.h> 2145ceb42de8Saliguori#include <unistd.h> 214684972cbbSStefan Weilint main(void) { return preadv == preadv; } 2147ceb42de8SaliguoriEOF 2148ceb42de8Saliguoripreadv=no 214952166aa0SJuan Quintelaif compile_prog "" "" ; then 2150ceb42de8Saliguori preadv=yes 2151ceb42de8Saliguorifi 2152ceb42de8Saliguori 2153ceb42de8Saliguori########################################## 2154f652e6afSaurel32# fdt probe 21552df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2156b41af4baSJuan Quintela fdt_libs="-lfdt" 2157f652e6afSaurel32 cat > $TMPC << EOF 2158f652e6afSaurel32int main(void) { return 0; } 2159f652e6afSaurel32EOF 216052166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2161f652e6afSaurel32 fdt=yes 21622df87df7SJuan Quintela else 21632df87df7SJuan Quintela if test "$fdt" = "yes" ; then 21642df87df7SJuan Quintela feature_not_found "fdt" 21652df87df7SJuan Quintela fi 2166de3a354aSMichael Walle fdt_libs= 21672df87df7SJuan Quintela fdt=no 2168f652e6afSaurel32 fi 2169f652e6afSaurel32fi 2170f652e6afSaurel32 217120ff075bSMichael Walle########################################## 217220ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 217320ff075bSMichael Walleif test "$opengl" != "no" ; then 217420ff075bSMichael Walle opengl_libs="-lGL" 217520ff075bSMichael Walle cat > $TMPC << EOF 217620ff075bSMichael Walle#include <X11/Xlib.h> 217720ff075bSMichael Walle#include <GL/gl.h> 217820ff075bSMichael Walle#include <GL/glx.h> 217984972cbbSStefan Weilint main(void) { return GL_VERSION != 0; } 218020ff075bSMichael WalleEOF 218120ff075bSMichael Walle if compile_prog "" "-lGL" ; then 218220ff075bSMichael Walle opengl=yes 218320ff075bSMichael Walle else 218420ff075bSMichael Walle if test "$opengl" = "yes" ; then 218520ff075bSMichael Walle feature_not_found "opengl" 218620ff075bSMichael Walle fi 2187de3a354aSMichael Walle opengl_libs= 218820ff075bSMichael Walle opengl=no 218920ff075bSMichael Walle fi 219020ff075bSMichael Wallefi 219120ff075bSMichael Walle 21923b3f24adSaurel32# 21933b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 21943b3f24adSaurel32# emulator. This is done because older glibc versions don't 21953b3f24adSaurel32# have syscall stubs for these implemented. 21963b3f24adSaurel32# 21973b3f24adSaurel32atfile=no 21983b3f24adSaurel32cat > $TMPC << EOF 21993b3f24adSaurel32#define _ATFILE_SOURCE 22003b3f24adSaurel32#include <sys/types.h> 22013b3f24adSaurel32#include <fcntl.h> 22023b3f24adSaurel32#include <unistd.h> 22033b3f24adSaurel32 22043b3f24adSaurel32int 22053b3f24adSaurel32main(void) 22063b3f24adSaurel32{ 22073b3f24adSaurel32 /* try to unlink nonexisting file */ 22083b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 22093b3f24adSaurel32} 22103b3f24adSaurel32EOF 221152166aa0SJuan Quintelaif compile_prog "" "" ; then 22123b3f24adSaurel32 atfile=yes 22133b3f24adSaurel32fi 22143b3f24adSaurel32 221539386ac7Saurel32# Check for inotify functions when we are building linux-user 22163b3f24adSaurel32# emulator. This is done because older glibc versions don't 22173b3f24adSaurel32# have syscall stubs for these implemented. In that case we 22183b3f24adSaurel32# don't provide them even if kernel supports them. 22193b3f24adSaurel32# 22203b3f24adSaurel32inotify=no 22213b3f24adSaurel32cat > $TMPC << EOF 22223b3f24adSaurel32#include <sys/inotify.h> 22233b3f24adSaurel32 22243b3f24adSaurel32int 22253b3f24adSaurel32main(void) 22263b3f24adSaurel32{ 22273b3f24adSaurel32 /* try to start inotify */ 22288690e420Saurel32 return inotify_init(); 22293b3f24adSaurel32} 22303b3f24adSaurel32EOF 223152166aa0SJuan Quintelaif compile_prog "" "" ; then 22323b3f24adSaurel32 inotify=yes 22333b3f24adSaurel32fi 22343b3f24adSaurel32 2235c05c7a73SRiku Voipioinotify1=no 2236c05c7a73SRiku Voipiocat > $TMPC << EOF 2237c05c7a73SRiku Voipio#include <sys/inotify.h> 2238c05c7a73SRiku Voipio 2239c05c7a73SRiku Voipioint 2240c05c7a73SRiku Voipiomain(void) 2241c05c7a73SRiku Voipio{ 2242c05c7a73SRiku Voipio /* try to start inotify */ 2243c05c7a73SRiku Voipio return inotify_init1(0); 2244c05c7a73SRiku Voipio} 2245c05c7a73SRiku VoipioEOF 2246c05c7a73SRiku Voipioif compile_prog "" "" ; then 2247c05c7a73SRiku Voipio inotify1=yes 2248c05c7a73SRiku Voipiofi 2249c05c7a73SRiku Voipio 2250ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2251ebc996f3SRiku Voipioutimens=no 2252ebc996f3SRiku Voipiocat > $TMPC << EOF 2253ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2254ebc996f3SRiku Voipio#include <stddef.h> 2255ebc996f3SRiku Voipio#include <fcntl.h> 2256ebc996f3SRiku Voipio 2257ebc996f3SRiku Voipioint main(void) 2258ebc996f3SRiku Voipio{ 2259ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2260ebc996f3SRiku Voipio futimens(0, NULL); 2261ebc996f3SRiku Voipio return 0; 2262ebc996f3SRiku Voipio} 2263ebc996f3SRiku VoipioEOF 226452166aa0SJuan Quintelaif compile_prog "" "" ; then 2265ebc996f3SRiku Voipio utimens=yes 2266ebc996f3SRiku Voipiofi 2267ebc996f3SRiku Voipio 2268099d6b0fSRiku Voipio# check if pipe2 is there 2269099d6b0fSRiku Voipiopipe2=no 2270099d6b0fSRiku Voipiocat > $TMPC << EOF 2271099d6b0fSRiku Voipio#include <unistd.h> 2272099d6b0fSRiku Voipio#include <fcntl.h> 2273099d6b0fSRiku Voipio 2274099d6b0fSRiku Voipioint main(void) 2275099d6b0fSRiku Voipio{ 2276099d6b0fSRiku Voipio int pipefd[2]; 2277099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2278099d6b0fSRiku Voipio return 0; 2279099d6b0fSRiku Voipio} 2280099d6b0fSRiku VoipioEOF 228152166aa0SJuan Quintelaif compile_prog "" "" ; then 2282099d6b0fSRiku Voipio pipe2=yes 2283099d6b0fSRiku Voipiofi 2284099d6b0fSRiku Voipio 228540ff6d7eSKevin Wolf# check if accept4 is there 228640ff6d7eSKevin Wolfaccept4=no 228740ff6d7eSKevin Wolfcat > $TMPC << EOF 228840ff6d7eSKevin Wolf#include <sys/socket.h> 228940ff6d7eSKevin Wolf#include <stddef.h> 229040ff6d7eSKevin Wolf 229140ff6d7eSKevin Wolfint main(void) 229240ff6d7eSKevin Wolf{ 229340ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 229440ff6d7eSKevin Wolf return 0; 229540ff6d7eSKevin Wolf} 229640ff6d7eSKevin WolfEOF 229740ff6d7eSKevin Wolfif compile_prog "" "" ; then 229840ff6d7eSKevin Wolf accept4=yes 229940ff6d7eSKevin Wolffi 230040ff6d7eSKevin Wolf 23013ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 23023ce34dfbSvibisreenivasansplice=no 23033ce34dfbSvibisreenivasancat > $TMPC << EOF 23043ce34dfbSvibisreenivasan#include <unistd.h> 23053ce34dfbSvibisreenivasan#include <fcntl.h> 23063ce34dfbSvibisreenivasan#include <limits.h> 23073ce34dfbSvibisreenivasan 23083ce34dfbSvibisreenivasanint main(void) 23093ce34dfbSvibisreenivasan{ 231066ea0f22SStefan Weil int len, fd = 0; 23113ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 23123ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 23133ce34dfbSvibisreenivasan return 0; 23143ce34dfbSvibisreenivasan} 23153ce34dfbSvibisreenivasanEOF 231652166aa0SJuan Quintelaif compile_prog "" "" ; then 23173ce34dfbSvibisreenivasan splice=yes 23183ce34dfbSvibisreenivasanfi 23193ce34dfbSvibisreenivasan 2320dcc38d1cSMarcelo Tosatti########################################## 2321dcc38d1cSMarcelo Tosatti# signalfd probe 2322dcc38d1cSMarcelo Tosattisignalfd="no" 2323dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2324dcc38d1cSMarcelo Tosatti#include <unistd.h> 2325dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2326dcc38d1cSMarcelo Tosatti#include <signal.h> 2327dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2328dcc38d1cSMarcelo TosattiEOF 2329dcc38d1cSMarcelo Tosatti 2330dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2331dcc38d1cSMarcelo Tosatti signalfd=yes 2332dcc38d1cSMarcelo Tosattifi 2333dcc38d1cSMarcelo Tosatti 2334c2882b96SRiku Voipio# check if eventfd is supported 2335c2882b96SRiku Voipioeventfd=no 2336c2882b96SRiku Voipiocat > $TMPC << EOF 2337c2882b96SRiku Voipio#include <sys/eventfd.h> 2338c2882b96SRiku Voipio 2339c2882b96SRiku Voipioint main(void) 2340c2882b96SRiku Voipio{ 234155cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 2342c2882b96SRiku Voipio} 2343c2882b96SRiku VoipioEOF 2344c2882b96SRiku Voipioif compile_prog "" "" ; then 2345c2882b96SRiku Voipio eventfd=yes 2346c2882b96SRiku Voipiofi 2347c2882b96SRiku Voipio 2348d0927938SUlrich Hecht# check for fallocate 2349d0927938SUlrich Hechtfallocate=no 2350d0927938SUlrich Hechtcat > $TMPC << EOF 2351d0927938SUlrich Hecht#include <fcntl.h> 2352d0927938SUlrich Hecht 2353d0927938SUlrich Hechtint main(void) 2354d0927938SUlrich Hecht{ 2355d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2356d0927938SUlrich Hecht return 0; 2357d0927938SUlrich Hecht} 2358d0927938SUlrich HechtEOF 2359be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2360d0927938SUlrich Hecht fallocate=yes 2361d0927938SUlrich Hechtfi 2362d0927938SUlrich Hecht 2363c727f47dSPeter Maydell# check for sync_file_range 2364c727f47dSPeter Maydellsync_file_range=no 2365c727f47dSPeter Maydellcat > $TMPC << EOF 2366c727f47dSPeter Maydell#include <fcntl.h> 2367c727f47dSPeter Maydell 2368c727f47dSPeter Maydellint main(void) 2369c727f47dSPeter Maydell{ 2370c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2371c727f47dSPeter Maydell return 0; 2372c727f47dSPeter Maydell} 2373c727f47dSPeter MaydellEOF 2374c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2375c727f47dSPeter Maydell sync_file_range=yes 2376c727f47dSPeter Maydellfi 2377c727f47dSPeter Maydell 2378dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2379dace20dcSPeter Maydellfiemap=no 2380dace20dcSPeter Maydellcat > $TMPC << EOF 2381dace20dcSPeter Maydell#include <sys/ioctl.h> 2382dace20dcSPeter Maydell#include <linux/fs.h> 2383dace20dcSPeter Maydell#include <linux/fiemap.h> 2384dace20dcSPeter Maydell 2385dace20dcSPeter Maydellint main(void) 2386dace20dcSPeter Maydell{ 2387dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2388dace20dcSPeter Maydell return 0; 2389dace20dcSPeter Maydell} 2390dace20dcSPeter MaydellEOF 2391dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2392dace20dcSPeter Maydell fiemap=yes 2393dace20dcSPeter Maydellfi 2394dace20dcSPeter Maydell 2395d0927938SUlrich Hecht# check for dup3 2396d0927938SUlrich Hechtdup3=no 2397d0927938SUlrich Hechtcat > $TMPC << EOF 2398d0927938SUlrich Hecht#include <unistd.h> 2399d0927938SUlrich Hecht 2400d0927938SUlrich Hechtint main(void) 2401d0927938SUlrich Hecht{ 2402d0927938SUlrich Hecht dup3(0, 0, 0); 2403d0927938SUlrich Hecht return 0; 2404d0927938SUlrich Hecht} 2405d0927938SUlrich HechtEOF 240678f5d726SJan Kiszkaif compile_prog "" "" ; then 2407d0927938SUlrich Hecht dup3=yes 2408d0927938SUlrich Hechtfi 2409d0927938SUlrich Hecht 24103b6edd16SPeter Maydell# check for epoll support 24113b6edd16SPeter Maydellepoll=no 24123b6edd16SPeter Maydellcat > $TMPC << EOF 24133b6edd16SPeter Maydell#include <sys/epoll.h> 24143b6edd16SPeter Maydell 24153b6edd16SPeter Maydellint main(void) 24163b6edd16SPeter Maydell{ 24173b6edd16SPeter Maydell epoll_create(0); 24183b6edd16SPeter Maydell return 0; 24193b6edd16SPeter Maydell} 24203b6edd16SPeter MaydellEOF 24213b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24223b6edd16SPeter Maydell epoll=yes 24233b6edd16SPeter Maydellfi 24243b6edd16SPeter Maydell 24253b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 24263b6edd16SPeter Maydell# so we must check separately for their presence 24273b6edd16SPeter Maydellepoll_create1=no 24283b6edd16SPeter Maydellcat > $TMPC << EOF 24293b6edd16SPeter Maydell#include <sys/epoll.h> 24303b6edd16SPeter Maydell 24313b6edd16SPeter Maydellint main(void) 24323b6edd16SPeter Maydell{ 243319e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 243419e83f6bSPeter Maydell * a function being called. This is necessary so that on 243519e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 243619e83f6bSPeter Maydell * the library but not declared in the header file we will 243719e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 243819e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 243919e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 244019e83f6bSPeter Maydell */ 244184972cbbSStefan Weil return epoll_create1 == epoll_create1; 24423b6edd16SPeter Maydell} 24433b6edd16SPeter MaydellEOF 24443b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24453b6edd16SPeter Maydell epoll_create1=yes 24463b6edd16SPeter Maydellfi 24473b6edd16SPeter Maydell 24483b6edd16SPeter Maydellepoll_pwait=no 24493b6edd16SPeter Maydellcat > $TMPC << EOF 24503b6edd16SPeter Maydell#include <sys/epoll.h> 24513b6edd16SPeter Maydell 24523b6edd16SPeter Maydellint main(void) 24533b6edd16SPeter Maydell{ 24543b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 24553b6edd16SPeter Maydell return 0; 24563b6edd16SPeter Maydell} 24573b6edd16SPeter MaydellEOF 24583b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 24593b6edd16SPeter Maydell epoll_pwait=yes 24603b6edd16SPeter Maydellfi 24613b6edd16SPeter Maydell 2462cc8ae6deSpbrook# Check if tools are available to build documentation. 2463a25dba17SJuan Quintelaif test "$docs" != "no" ; then 246401668d98SStefan Weil if has makeinfo && has pod2man; then 2465a25dba17SJuan Quintela docs=yes 246683a3ab8bSJuan Quintela else 2467a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2468a25dba17SJuan Quintela feature_not_found "docs" 246983a3ab8bSJuan Quintela fi 2470a25dba17SJuan Quintela docs=no 247183a3ab8bSJuan Quintela fi 2472cc8ae6deSpbrookfi 2473cc8ae6deSpbrook 2474f514f41cSStefan Weil# Search for bswap_32 function 24756ae9a1f4SJuan Quintelabyteswap_h=no 24766ae9a1f4SJuan Quintelacat > $TMPC << EOF 24776ae9a1f4SJuan Quintela#include <byteswap.h> 24786ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 24796ae9a1f4SJuan QuintelaEOF 248052166aa0SJuan Quintelaif compile_prog "" "" ; then 24816ae9a1f4SJuan Quintela byteswap_h=yes 24826ae9a1f4SJuan Quintelafi 24836ae9a1f4SJuan Quintela 2484f514f41cSStefan Weil# Search for bswap_32 function 24856ae9a1f4SJuan Quintelabswap_h=no 24866ae9a1f4SJuan Quintelacat > $TMPC << EOF 24876ae9a1f4SJuan Quintela#include <sys/endian.h> 24886ae9a1f4SJuan Quintela#include <sys/types.h> 24896ae9a1f4SJuan Quintela#include <machine/bswap.h> 24906ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 24916ae9a1f4SJuan QuintelaEOF 249252166aa0SJuan Quintelaif compile_prog "" "" ; then 24936ae9a1f4SJuan Quintela bswap_h=yes 24946ae9a1f4SJuan Quintelafi 24956ae9a1f4SJuan Quintela 2496da93a1fdSaliguori########################################## 2497c589b249SRonnie Sahlberg# Do we have libiscsi 2498c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 2499c589b249SRonnie Sahlberg cat > $TMPC << EOF 2500c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 2501c589b249SRonnie Sahlbergint main(void) { iscsi_create_context(""); return 0; } 2502c589b249SRonnie SahlbergEOF 2503c589b249SRonnie Sahlberg if compile_prog "-Werror" "-liscsi" ; then 2504c589b249SRonnie Sahlberg libiscsi="yes" 2505c589b249SRonnie Sahlberg LIBS="$LIBS -liscsi" 2506c589b249SRonnie Sahlberg else 2507c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 2508c589b249SRonnie Sahlberg feature_not_found "libiscsi" 2509c589b249SRonnie Sahlberg fi 2510c589b249SRonnie Sahlberg libiscsi="no" 2511c589b249SRonnie Sahlberg fi 2512c589b249SRonnie Sahlbergfi 2513c589b249SRonnie Sahlberg 2514c589b249SRonnie Sahlberg 2515c589b249SRonnie Sahlberg########################################## 2516da93a1fdSaliguori# Do we need librt 2517da93a1fdSaliguoricat > $TMPC <<EOF 2518da93a1fdSaliguori#include <signal.h> 2519da93a1fdSaliguori#include <time.h> 252066ea0f22SStefan Weilint main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } 2521da93a1fdSaliguoriEOF 2522da93a1fdSaliguori 252352166aa0SJuan Quintelaif compile_prog "" "" ; then 252407ffa4bdSJuan Quintela : 252552166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 252607ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2527da93a1fdSaliguorifi 2528da93a1fdSaliguori 252931ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2530179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 25316362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 25326362a53fSJuan Quintelafi 25336362a53fSJuan Quintela 2534de5071c5SBlue Swirl########################################## 2535cd4ec0b4SGerd Hoffmann# spice probe 2536cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2537cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2538cd4ec0b4SGerd Hoffmann#include <spice.h> 2539cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2540cd4ec0b4SGerd HoffmannEOF 2541710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2542710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 25434295e15aSAlon Levy if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \ 2544cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2545cd4ec0b4SGerd Hoffmann spice="yes" 2546cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2547cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2548cd4ec0b4SGerd Hoffmann else 2549cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2550cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2551cd4ec0b4SGerd Hoffmann fi 2552cd4ec0b4SGerd Hoffmann spice="no" 2553cd4ec0b4SGerd Hoffmann fi 2554cd4ec0b4SGerd Hoffmannfi 2555cd4ec0b4SGerd Hoffmann 2556111a38b0SRobert Relyea# check for libcacard for smartcard support 2557111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2558111a38b0SRobert Relyea smartcard="yes" 2559111a38b0SRobert Relyea smartcard_cflags="" 2560111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2561111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 25625f01e06fSSergei Trofimovich cat > $TMPC << EOF 25635f01e06fSSergei Trofimovich#include <pk11pub.h> 25645f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; } 25655f01e06fSSergei TrofimovichEOF 2566111a38b0SRobert Relyea smartcard_cflags="-I\$(SRC_PATH)/libcacard" 25678c741c22SAlon Levy libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" 25688c741c22SAlon Levy libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" 25695f01e06fSSergei Trofimovich if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ 25705f01e06fSSergei Trofimovich compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then 25715f01e06fSSergei Trofimovich smartcard_nss="yes" 2572111a38b0SRobert Relyea QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" 2573ad4cf3f6SPaul Brook libs_softmmu="$libcacard_libs $libs_softmmu" 2574111a38b0SRobert Relyea else 2575111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2576111a38b0SRobert Relyea feature_not_found "nss" 2577111a38b0SRobert Relyea fi 2578111a38b0SRobert Relyea smartcard_nss="no" 2579111a38b0SRobert Relyea fi 2580111a38b0SRobert Relyea fi 2581111a38b0SRobert Relyeafi 2582111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2583111a38b0SRobert Relyea smartcard_nss="no" 2584111a38b0SRobert Relyeafi 2585111a38b0SRobert Relyea 258669354a83SHans de Goede# check for usbredirparser for usb network redirection support 258769354a83SHans de Goedeif test "$usb_redir" != "no" ; then 2588097a66efSHans de Goede if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then 258969354a83SHans de Goede usb_redir="yes" 259069354a83SHans de Goede usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) 259169354a83SHans de Goede usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null) 259269354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 259369354a83SHans de Goede LIBS="$LIBS $usb_redir_libs" 259469354a83SHans de Goede else 259569354a83SHans de Goede if test "$usb_redir" = "yes"; then 259669354a83SHans de Goede feature_not_found "usb-redir" 259769354a83SHans de Goede fi 259869354a83SHans de Goede usb_redir="no" 259969354a83SHans de Goede fi 260069354a83SHans de Goedefi 260169354a83SHans de Goede 2602cd4ec0b4SGerd Hoffmann########################################## 2603cd4ec0b4SGerd Hoffmann 2604747bbdf7SBlue Swirl########################################## 26055f6b9e8fSBlue Swirl# check if we have fdatasync 26065f6b9e8fSBlue Swirl 26075f6b9e8fSBlue Swirlfdatasync=no 26085f6b9e8fSBlue Swirlcat > $TMPC << EOF 26095f6b9e8fSBlue Swirl#include <unistd.h> 2610d1722a27SAlexandre Raymondint main(void) { 2611d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2612d1722a27SAlexandre Raymondreturn fdatasync(0); 2613d1722a27SAlexandre Raymond#else 2614d1722a27SAlexandre Raymond#abort Not supported 2615d1722a27SAlexandre Raymond#endif 2616d1722a27SAlexandre Raymond} 26175f6b9e8fSBlue SwirlEOF 26185f6b9e8fSBlue Swirlif compile_prog "" "" ; then 26195f6b9e8fSBlue Swirl fdatasync=yes 26205f6b9e8fSBlue Swirlfi 26215f6b9e8fSBlue Swirl 262294a420b1SStefan Hajnoczi########################################## 2623e78815a5SAndreas Färber# check if we have madvise 2624e78815a5SAndreas Färber 2625e78815a5SAndreas Färbermadvise=no 2626e78815a5SAndreas Färbercat > $TMPC << EOF 2627e78815a5SAndreas Färber#include <sys/types.h> 2628e78815a5SAndreas Färber#include <sys/mman.h> 2629832ce9c2SScott Wood#include <stddef.h> 2630e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2631e78815a5SAndreas FärberEOF 2632e78815a5SAndreas Färberif compile_prog "" "" ; then 2633e78815a5SAndreas Färber madvise=yes 2634e78815a5SAndreas Färberfi 2635e78815a5SAndreas Färber 2636e78815a5SAndreas Färber########################################## 2637e78815a5SAndreas Färber# check if we have posix_madvise 2638e78815a5SAndreas Färber 2639e78815a5SAndreas Färberposix_madvise=no 2640e78815a5SAndreas Färbercat > $TMPC << EOF 2641e78815a5SAndreas Färber#include <sys/mman.h> 2642832ce9c2SScott Wood#include <stddef.h> 2643e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2644e78815a5SAndreas FärberEOF 2645e78815a5SAndreas Färberif compile_prog "" "" ; then 2646e78815a5SAndreas Färber posix_madvise=yes 2647e78815a5SAndreas Färberfi 2648e78815a5SAndreas Färber 2649e78815a5SAndreas Färber########################################## 265094a420b1SStefan Hajnoczi# check if trace backend exists 265194a420b1SStefan Hajnoczi 26524c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 265394a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 265494a420b1SStefan Hajnoczi echo 265594a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 265694a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 265794a420b1SStefan Hajnoczi echo 265894a420b1SStefan Hajnoczi exit 1 265994a420b1SStefan Hajnoczifi 266094a420b1SStefan Hajnoczi 26617e24e92aSStefan Hajnoczi########################################## 26627e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 26637e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 26647e24e92aSStefan Hajnoczi cat > $TMPC << EOF 26657e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 26667e24e92aSStefan Hajnoczi#include <ust/marker.h> 26677e24e92aSStefan Hajnocziint main(void) { return 0; } 26687e24e92aSStefan HajnocziEOF 26697e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 26707e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 26717e24e92aSStefan Hajnoczi else 26727e24e92aSStefan Hajnoczi echo 26737e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 26747e24e92aSStefan Hajnoczi echo 26757e24e92aSStefan Hajnoczi exit 1 26767e24e92aSStefan Hajnoczi fi 26777e24e92aSStefan Hajnoczifi 2678b3d08c02SDaniel P. Berrange 2679b3d08c02SDaniel P. Berrange########################################## 2680b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2681b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2682b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2683b3d08c02SDaniel P. Berrange echo 2684b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2685b3d08c02SDaniel P. Berrange echo 2686b3d08c02SDaniel P. Berrange exit 1 2687b3d08c02SDaniel P. Berrange fi 2688c276b17dSDaniel P. Berrange trace_backend_stap="no" 2689c276b17dSDaniel P. Berrange if has 'stap' ; then 2690c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2691c276b17dSDaniel P. Berrange fi 2692b3d08c02SDaniel P. Berrangefi 2693b3d08c02SDaniel P. Berrange 26947e24e92aSStefan Hajnoczi########################################## 2695023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2696023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit 2697023367e6SWolfgang Mauerer# specification is necessary 26981ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then 2699023367e6SWolfgang Mauerer cat > $TMPC << EOF 2700023367e6SWolfgang Mauererint sfaa(unsigned *ptr) 2701023367e6SWolfgang Mauerer{ 2702023367e6SWolfgang Mauerer return __sync_fetch_and_and(ptr, 0); 2703023367e6SWolfgang Mauerer} 2704023367e6SWolfgang Mauerer 2705023367e6SWolfgang Mauererint main(int argc, char **argv) 2706023367e6SWolfgang Mauerer{ 2707023367e6SWolfgang Mauerer int val = 42; 2708023367e6SWolfgang Mauerer sfaa(&val); 2709023367e6SWolfgang Mauerer return val; 2710023367e6SWolfgang Mauerer} 2711023367e6SWolfgang MauererEOF 2712023367e6SWolfgang Mauerer if ! compile_prog "" "" ; then 2713023367e6SWolfgang Mauerer CFLAGS+="-march=i486" 2714023367e6SWolfgang Mauerer fi 2715023367e6SWolfgang Mauererfi 2716023367e6SWolfgang Mauerer 2717023367e6SWolfgang Mauerer########################################## 2718d0e2fce5SAneesh Kumar K.V# check if we have makecontext 2719cdf84806SPeter Maydell# (and that it's not a glibc stub which always returns -1) 2720d0e2fce5SAneesh Kumar K.V 2721d0e2fce5SAneesh Kumar K.Vucontext_coroutine=no 2722d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then 2723d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2724d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 2725cdf84806SPeter Maydell#ifdef __stub_makecontext 2726cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 2727cdf84806SPeter Maydell#endif 272875cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2729d0e2fce5SAneesh Kumar K.VEOF 2730d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 2731d0e2fce5SAneesh Kumar K.V ucontext_coroutine=yes 2732d0e2fce5SAneesh Kumar K.V fi 2733d0e2fce5SAneesh Kumar K.Vfi 2734d0e2fce5SAneesh Kumar K.V 2735d0e2fce5SAneesh Kumar K.V########################################## 2736d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 2737d2042378SAneesh Kumar K.V 2738d2042378SAneesh Kumar K.Vopen_by_hande_at=no 2739d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 2740d2042378SAneesh Kumar K.V#include <fcntl.h> 274175cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 2742d2042378SAneesh Kumar K.VEOF 2743d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 2744d2042378SAneesh Kumar K.V open_by_handle_at=yes 2745d2042378SAneesh Kumar K.Vfi 2746d2042378SAneesh Kumar K.V 2747e06a765eSHarsh Prateek Bora######################################## 2748e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 2749e06a765eSHarsh Prateek Bora 2750e06a765eSHarsh Prateek Boralinux_magic_h=no 2751e06a765eSHarsh Prateek Boracat > $TMPC << EOF 2752e06a765eSHarsh Prateek Bora#include <linux/magic.h> 2753e06a765eSHarsh Prateek Boraint main(void) { 275475cafad7SStefan Weil return 0; 2755e06a765eSHarsh Prateek Bora} 2756e06a765eSHarsh Prateek BoraEOF 2757e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 2758e06a765eSHarsh Prateek Bora linux_magic_h=yes 2759e06a765eSHarsh Prateek Borafi 2760e06a765eSHarsh Prateek Bora 2761d2042378SAneesh Kumar K.V########################################## 2762e86ecd4bSJuan Quintela# End of CC checks 2763e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2764e86ecd4bSJuan Quintela 2765e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 27661156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2767e86ecd4bSJuan Quintelafi 2768a316e378SJuan Quintela 2769e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2770e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2771e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 277220ff6c80SAnthony Liguori 277320ff6c80SAnthony Liguoriif test -z "$werror" ; then 2774e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2775e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2776e86ecd4bSJuan Quintela werror="yes" 2777e86ecd4bSJuan Quintela else 2778e86ecd4bSJuan Quintela werror="no" 2779e86ecd4bSJuan Quintela fi 2780e86ecd4bSJuan Quintelafi 2781e86ecd4bSJuan Quintela 278220ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 278320ff6c80SAnthony Liguori# enable/disable 278420ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 278520ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 278620ff6c80SAnthony Liguori zero_malloc="no" 278720ff6c80SAnthony Liguori else 278820ff6c80SAnthony Liguori zero_malloc="yes" 278920ff6c80SAnthony Liguori fi 279020ff6c80SAnthony Liguorifi 279120ff6c80SAnthony Liguori 2792e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2793a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2794e86ecd4bSJuan Quintelafi 2795e86ecd4bSJuan Quintela 2796e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2797e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 27981156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2799e86ecd4bSJuan Quintela fi 2800e86ecd4bSJuan Quintelafi 2801e86ecd4bSJuan Quintela 2802952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2803952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2804952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2805952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2806952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2807952afb71SBlue Swirl fi 2808952afb71SBlue Swirl done 2809952afb71SBlue Swirlfi 2810952afb71SBlue Swirl 2811190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 28125a67135aSbellard 2813ca35f780SPaolo Bonzinitools= 2814ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2815ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2816983eef5aSMeador Inge if test "$virtfs" != no ; then 2817983eef5aSMeador Inge if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then 2818983eef5aSMeador Inge virtfs=yes 281917bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 2820983eef5aSMeador Inge else 2821983eef5aSMeador Inge if test "$virtfs" = yes; then 2822983eef5aSMeador Inge feature_not_found "virtfs" 2823983eef5aSMeador Inge fi 2824983eef5aSMeador Inge fi 282517bff52bSM. Mohan Kumar fi 2826ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2827ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2828d138cee9SMichael Roth if [ "$guest_agent" = "yes" ]; then 282948ff7a62SMichael Roth tools="qemu-ga\$(EXESUF) $tools" 2830d138cee9SMichael Roth fi 2831ca35f780SPaolo Bonzini fi 2832ca35f780SPaolo Bonzinifi 2833ca35f780SPaolo Bonzini 2834ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2835ca35f780SPaolo Bonziniroms= 2836ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2837ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2838ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2839ca35f780SPaolo Bonzini roms="optionrom" 2840ca35f780SPaolo Bonzinifi 2841d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 284239ac8455SDavid Gibson roms="$roms spapr-rtas" 284339ac8455SDavid Gibsonfi 2844ca35f780SPaolo Bonzini 28457d13299dSbellardecho "Install prefix $prefix" 2846f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2847f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 28483aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 28490f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 28501c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 285111d9f695Sbellardif test "$mingw32" = "no" ; then 2852f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 285343ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 285411d9f695Sbellardfi 28555a67135aSbellardecho "Source path $source_path" 28567d13299dSbellardecho "C compiler $cc" 285783469015Sbellardecho "Host C compiler $host_cc" 28580c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2859a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 28600c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 28617d13299dSbellardecho "make $make" 28626a882643Spbrookecho "install $install" 2863c886edfbSBlue Swirlecho "python $python" 2864e2d8830eSBradif test "$slirp" = "yes" ; then 2865e2d8830eSBrad echo "smbd $smbd" 2866e2d8830eSBradfi 2867a98fd896Sbellardecho "host CPU $cpu" 2868de83cd02Sbellardecho "host big endian $bigendian" 286997a847bcSbellardecho "target list $target_list" 2870ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2871b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 28727d13299dSbellardecho "gprof enabled $gprof" 287303b4fe7dSaliguoriecho "sparse enabled $sparse" 28741625af87Saliguoriecho "strip binaries $strip_opt" 287505c2a3e7Sbellardecho "profiler $profiler" 287643ce4dfeSbellardecho "static build $static" 287785aa5189Sbellardecho "-Werror enabled $werror" 28785b0753e0Sbellardif test "$darwin" = "yes" ; then 28795b0753e0Sbellard echo "Cocoa support $cocoa" 28805b0753e0Sbellardfi 288197a847bcSbellardecho "SDL support $sdl" 28824d3b6f6eSbalrogecho "curses support $curses" 2883769ce76dSAlexander Grafecho "curl support $curl" 288467b915a5Sbellardecho "mingw32 support $mingw32" 28850c58ac1cSmalcecho "Audio drivers $audio_drv_list" 28860c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2887eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 28888ff9cbf7Smalcecho "Mixer emulation $mixemu" 2889983eef5aSMeador Ingeecho "VirtFS support $virtfs" 2890821601eaSJes Sorensenecho "VNC support $vnc" 2891821601eaSJes Sorensenif test "$vnc" = "yes" ; then 28928d5d2d4cSths echo "VNC TLS support $vnc_tls" 28932f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 28942f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 2895efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 2896bd023f95SCorentin Chary echo "VNC thread $vnc_thread" 2897821601eaSJes Sorensenfi 28983142255cSblueswir1if test -n "$sparc_cpu"; then 28993142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 29003142255cSblueswir1fi 2901e37630caSaliguoriecho "xen support $xen" 29022e4d9fb1Saurel32echo "brlapi support $brlapi" 2903a20a6f46SJuan Quintelaecho "bluez support $bluez" 2904a25dba17SJuan Quintelaecho "Documentation $docs" 2905c5937220Spbrook[ ! -z "$uname_release" ] && \ 2906c5937220Spbrookecho "uname -r $uname_release" 2907bd0c5661Spbrookecho "NPTL support $nptl" 2908379f6698SPaul Brookecho "GUEST_BASE $guest_base" 290940d6444eSAvi Kivityecho "PIE $pie" 29108a16d273Sthsecho "vde support $vde" 29115c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2912758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 291377755340Sthsecho "Install blobs $blobs" 2914b31a0277SJuan Quintelaecho "KVM support $kvm" 29159195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 2916f652e6afSaurel32echo "fdt support $fdt" 2917ceb42de8Saliguoriecho "preadv support $preadv" 29185f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2919e78815a5SAndreas Färberecho "madvise $madvise" 2920e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2921ee682d27SStefan Weilecho "uuid support $uuid" 292247e98658SCorey Bryantecho "libcap-ng support $cap_ng" 2923d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 292494a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 29259410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2926cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2927f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2928dce512deSChristoph Hellwigecho "xfsctl support $xfs" 2929111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 293069354a83SHans de Goedeecho "usb net redir $usb_redir" 293120ff075bSMichael Walleecho "OpenGL support $opengl" 2932c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 2933d138cee9SMichael Rothecho "build guest agent $guest_agent" 293467b915a5Sbellard 29351ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 293624b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2937e8cd23deSbellardfi 293897a847bcSbellard 293998ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 29404bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 294197a847bcSbellard 294298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 294398ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 294498ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 294598ec69acSJuan Quintelaecho >> $config_host_mak 294698ec69acSJuan Quintela 2947e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 294899d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 294999d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 29503aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 29510f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 295299d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 295399d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 295499d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 295599d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 29561dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 29577b93fadfSCorey Bryantecho "libexecdir=\${prefix}/libexec" >> $config_host_mak 2958a7c36ee4SCorey Bryantecho "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak 2959a7c36ee4SCorey Bryantecho "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak 2960804edf29SJuan Quintela 296198ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2962f8393946Saurel32if test "$debug_tcg" = "yes" ; then 29632358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2964f8393946Saurel32fi 2965b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2966b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2967b4475aa2SLuiz Capitulinofi 2968f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 29692358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2970f3d08ee6SPaul Brookfi 29711625af87Saliguoriif test "$strip_opt" = "yes" ; then 297252ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 29731625af87Saliguorifi 29747d13299dSbellardif test "$bigendian" = "yes" ; then 2975e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 297697a847bcSbellardfi 297767b915a5Sbellardif test "$mingw32" = "yes" ; then 297898ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 29799fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 29809fe6de94SBlue Swirl version_major=${rc_version%%.*} 29819fe6de94SBlue Swirl rc_version=${rc_version#*.} 29829fe6de94SBlue Swirl version_minor=${rc_version%%.*} 29839fe6de94SBlue Swirl rc_version=${rc_version#*.} 29849fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 29859fe6de94SBlue Swirl version_micro=0 29869fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 29879fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2988210fa556Spbrookelse 298935f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2990210fa556Spbrookfi 2991128ab2ffSblueswir1 2992dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2993dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2994dffcb71cSMark McLoughlinfi 2995dffcb71cSMark McLoughlin 299683fb7adfSbellardif test "$darwin" = "yes" ; then 299798ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 299883fb7adfSbellardfi 2999b29fe3edSmalc 3000b29fe3edSmalcif test "$aix" = "yes" ; then 300198ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 3002b29fe3edSmalcfi 3003b29fe3edSmalc 3004ec530c81Sbellardif test "$solaris" = "yes" ; then 300598ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 30062358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 30070475a5caSths if test "$needs_libsunmath" = "yes" ; then 300875b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 30090475a5caSths fi 3010ec530c81Sbellardfi 3011179cf400SAndreas Färberif test "$haiku" = "yes" ; then 3012179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 3013179cf400SAndreas Färberfi 301497a847bcSbellardif test "$static" = "yes" ; then 301598ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 301697a847bcSbellardfi 30171ba16968SStefan Weilif test "$profiler" = "yes" ; then 30182358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 301905c2a3e7Sbellardfi 3020c20709aaSbellardif test "$slirp" = "yes" ; then 302198ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 3022e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3023f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 3024c20709aaSbellardfi 30258a16d273Sthsif test "$vde" = "yes" ; then 302698ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 30278a16d273Sthsfi 302847e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 302947e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 303047e98658SCorey Bryantfi 30310c58ac1cSmalcfor card in $audio_card_list; do 3032f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 303398ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 30340c58ac1cSmalcdone 30352358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 30360c58ac1cSmalcfor drv in $audio_drv_list; do 3037f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 303898ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 3039923e4521Smalc if test "$drv" = "fmod"; then 30407aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 3041fb065187Sbellard fi 30420c58ac1cSmalcdone 304367f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 304467f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 304567f86e8eSJuan Quintelafi 3046d5631638Smalcif test "$audio_win_int" = "yes" ; then 3047d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 3048d5631638Smalcfi 3049eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 30508ff9cbf7Smalcif test "$mixemu" = "yes" ; then 305198ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 30528ff9cbf7Smalcfi 3053821601eaSJes Sorensenif test "$vnc" = "yes" ; then 3054821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 3055821601eaSJes Sorensenfi 30568d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 305798ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 3058525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 30598d5d2d4cSthsfi 30602f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 306198ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 306260ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 30632f9606b3Saliguorifi 3064821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 30652f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 30662f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 30672f6f5c7aSCorentin Charyfi 3068821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 3069efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 3070efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 3071efe556adSCorentin Charyfi 3072821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then 3073bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 3074bd023f95SCorentin Charyfi 307576655d6dSaliguoriif test "$fnmatch" = "yes" ; then 30762358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 307776655d6dSaliguorifi 3078ee682d27SStefan Weilif test "$uuid" = "yes" ; then 3079ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 3080ee682d27SStefan Weilfi 3081dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3082dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3083dce512deSChristoph Hellwigfi 3084b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 308598ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 30862358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 308798ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 308898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 3089a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 309098ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 3091cc8ae6deSpbrookfi 30921ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 309398ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 30948ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 309549ecc3faSbellardfi 309649ecc3faSbellardif test "$cocoa" = "yes" ; then 309798ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 309849ecc3faSbellardfi 30994d3b6f6eSbalrogif test "$curses" = "yes" ; then 310098ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 3101ab4e5602SJan Kiszkafi 31023b3f24adSaurel32if test "$atfile" = "yes" ; then 31032358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 31043b3f24adSaurel32fi 3105ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 31062358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 3107ebc996f3SRiku Voipiofi 3108099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 31092358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 3110099d6b0fSRiku Voipiofi 311140ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 311240ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 311340ff6d7eSKevin Wolffi 31143ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 31152358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 31163ce34dfbSvibisreenivasanfi 3117c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 3118c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 3119c2882b96SRiku Voipiofi 3120d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 3121d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 3122d0927938SUlrich Hechtfi 3123c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 3124c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 3125c727f47dSPeter Maydellfi 3126dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 3127dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 3128dace20dcSPeter Maydellfi 3129d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 3130d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 3131d0927938SUlrich Hechtfi 31323b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 31333b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 31343b6edd16SPeter Maydellfi 31353b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 31363b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 31373b6edd16SPeter Maydellfi 31383b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 31393b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 31403b6edd16SPeter Maydellfi 31413b3f24adSaurel32if test "$inotify" = "yes" ; then 31422358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 31433b3f24adSaurel32fi 3144c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 3145c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 3146c05c7a73SRiku Voipiofi 31476ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 31486ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 31496ae9a1f4SJuan Quintelafi 31506ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 31516ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 31526ae9a1f4SJuan Quintelafi 3153769ce76dSAlexander Grafif test "$curl" = "yes" ; then 315498ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 3155b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 3156769ce76dSAlexander Graffi 31572e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 315898ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 31592e4d9fb1Saurel32fi 3160fb599c9aSbalrogif test "$bluez" = "yes" ; then 316198ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 3162ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 3163fb599c9aSbalrogfi 3164e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3165e37630caSaliguoriif test "$xen" = "yes" ; then 31666dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3167d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3168e37630caSaliguorifi 31695c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 31705c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 31715c6c3a6cSChristoph Hellwigfi 3172758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 3173758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 3174758e8e38SVenkateswararao Jujjuri (JV)fi 31754f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 31764f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 31774f26f2b6SAvi Kivityfi 3178983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 3179758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 3180758e8e38SVenkateswararao Jujjuri (JV)fi 318177755340Sthsif test "$blobs" = "yes" ; then 318298ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 318377755340Sthsfi 3184bf9298b9Saliguoriif test "$iovec" = "yes" ; then 31852358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 3186bf9298b9Saliguorifi 3187ceb42de8Saliguoriif test "$preadv" = "yes" ; then 31882358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 3189ceb42de8Saliguorifi 3190f652e6afSaurel32if test "$fdt" = "yes" ; then 31913f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 3192f652e6afSaurel32fi 3193dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 3194dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 3195dcc38d1cSMarcelo Tosattifi 31969195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 31979195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 31989195b2c2SStefan Weilfi 31995f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 32005f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 32015f6b9e8fSBlue Swirlfi 3202e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 3203e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 3204e78815a5SAndreas Färberfi 3205e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 3206e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 3207e78815a5SAndreas Färberfi 320897a847bcSbellard 3209cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 3210cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 3211cd4ec0b4SGerd Hoffmannfi 3212cd4ec0b4SGerd Hoffmann 321336707144SAlon Levyif test "$smartcard" = "yes" ; then 321436707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 321536707144SAlon Levyfi 321636707144SAlon Levy 3217111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3218111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 3219ad4cf3f6SPaul Brook echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3220ad4cf3f6SPaul Brook echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3221111a38b0SRobert Relyeafi 3222111a38b0SRobert Relyea 322369354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 322469354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 322569354a83SHans de Goedefi 322669354a83SHans de Goede 322720ff075bSMichael Walleif test "$opengl" = "yes" ; then 322820ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 322920ff075bSMichael Wallefi 323020ff075bSMichael Walle 3231c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 3232c589b249SRonnie Sahlberg echo "CONFIG_LIBISCSI=y" >> $config_host_mak 3233c589b249SRonnie Sahlbergfi 3234c589b249SRonnie Sahlberg 323583fb7adfSbellard# XXX: suppress that 32367d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 32372358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 32387d3505c5Sbellardfi 32397d3505c5Sbellard 32402358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 3241c5937220Spbrook 324220ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 324320ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 324420ff6c80SAnthony Liguorifi 3245f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 3246f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 3247f27aaf4bSChristian Brunnerfi 324820ff6c80SAnthony Liguori 3249d0e2fce5SAneesh Kumar K.Vif test "$ucontext_coroutine" = "yes" ; then 3250d0e2fce5SAneesh Kumar K.V echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak 3251d0e2fce5SAneesh Kumar K.Vfi 3252d0e2fce5SAneesh Kumar K.V 3253d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 3254d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 3255d2042378SAneesh Kumar K.Vfi 3256d2042378SAneesh Kumar K.V 3257e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 3258e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 3259e06a765eSHarsh Prateek Borafi 3260e06a765eSHarsh Prateek Bora 326168063649Sblueswir1# USB host support 326268063649Sblueswir1case "$usb" in 326368063649Sblueswir1linux) 326498ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 326568063649Sblueswir1;; 326668063649Sblueswir1bsd) 326798ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 326868063649Sblueswir1;; 326968063649Sblueswir1*) 327098ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 327168063649Sblueswir1;; 327268063649Sblueswir1esac 327368063649Sblueswir1 3274e4858974SLluís# use default implementation for tracing backend-specific routines 3275e4858974SLluístrace_default=yes 327694a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 32776d8a764eSLluísif test "$trace_backend" = "nop"; then 32786d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 327922890ab5SPrerna Saxenafi 32809410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 32816d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 3282e4858974SLluís trace_default=no 32836d8a764eSLluís # Set the appropriate trace file. 3284953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 32859410b56cSPrerna Saxenafi 32866d8a764eSLluísif test "$trace_backend" = "stderr"; then 32876d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 32889a82b6a5SLluís trace_default=no 32896d8a764eSLluísfi 32906d8a764eSLluísif test "$trace_backend" = "ust"; then 32916d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 32926d8a764eSLluísfi 32936d8a764eSLluísif test "$trace_backend" = "dtrace"; then 32946d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 32956d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 32966d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 32976d8a764eSLluís fi 3298c276b17dSDaniel P. Berrangefi 32999410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 3300e4858974SLluísif test "$trace_default" = "yes"; then 3301e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 3302e4858974SLluísfi 33039410b56cSPrerna Saxena 330498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 330598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3306804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3307804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 33081901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 33091901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 33101901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 3311c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 3312804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 33132b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 3314804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 3315804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3316804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3317804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 33189fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 331944dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 3320e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 3321a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 3322f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 3323e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 3324e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 3325e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 3326e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 3327e39f0062SPaolo Bonzinifi 3328c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 3329e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 3330a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 3331a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 333273da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 33333e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 3334804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3335957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 3336804edf29SJuan Quintela 33374bf6b55bSJuan Quintela# generate list of library paths for linker script 33384bf6b55bSJuan Quintela 33394bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 33404bf6b55bSJuan Quintela 33414bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 33424bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 33434bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 33444bf6b55bSJuan Quintela else 33454bf6b55bSJuan Quintela rm ${config_host_ld}~ 33464bf6b55bSJuan Quintela fi 33474bf6b55bSJuan Quintelafi 33484bf6b55bSJuan Quintela 33494d904533SBlue Swirlfor d in libdis libdis-user; do 33504d904533SBlue Swirl mkdir -p $d 335111568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 33524d904533SBlue Swirl echo > $d/config.mak 33534d904533SBlue Swirldone 33544d904533SBlue Swirl 33556efd7517SPeter Maydell# use included Linux headers 33566efd7517SPeter Maydellif test "$linux" = "yes" ; then 33576efd7517SPeter Maydell mkdir -p linux-headers 33586efd7517SPeter Maydell case "$cpu" in 33596efd7517SPeter Maydell i386|x86_64) 33606efd7517SPeter Maydell symlink $source_path/linux-headers/asm-x86 linux-headers/asm 33616efd7517SPeter Maydell ;; 33626efd7517SPeter Maydell ppcemb|ppc|ppc64) 33636efd7517SPeter Maydell symlink $source_path/linux-headers/asm-powerpc linux-headers/asm 33646efd7517SPeter Maydell ;; 33656efd7517SPeter Maydell s390x) 33666efd7517SPeter Maydell symlink $source_path/linux-headers/asm-s390 linux-headers/asm 33676efd7517SPeter Maydell ;; 33686efd7517SPeter Maydell esac 33696efd7517SPeter Maydellfi 33706efd7517SPeter Maydell 337197a847bcSbellardfor target in $target_list; do 337297a847bcSbellardtarget_dir="$target" 337325be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3374600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 337597a847bcSbellardtarget_bigendian="no" 33761f3d3c8fSJuan Quintela 3377ea2d6a39SJuan Quintelacase "$target_arch2" in 3378cfa550c6SMax Filippov armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 3379ea2d6a39SJuan Quintela target_bigendian=yes 3380ea2d6a39SJuan Quintela ;; 3381ea2d6a39SJuan Quintelaesac 338297a847bcSbellardtarget_softmmu="no" 3383997344f3Sbellardtarget_user_only="no" 3384831b7825Sthstarget_linux_user="no" 3385831b7825Sthstarget_darwin_user="no" 338684778508Sblueswir1target_bsd_user="no" 33879e407a85Spbrookcase "$target" in 3388600309b6SBlue Swirl ${target_arch2}-softmmu) 33899e407a85Spbrook target_softmmu="yes" 33909e407a85Spbrook ;; 3391600309b6SBlue Swirl ${target_arch2}-linux-user) 33929c7a4202SBlue Swirl if test "$linux" != "yes" ; then 33939c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 33949c7a4202SBlue Swirl exit 1 33959c7a4202SBlue Swirl fi 33969e407a85Spbrook target_user_only="yes" 33979e407a85Spbrook target_linux_user="yes" 33989e407a85Spbrook ;; 3399600309b6SBlue Swirl ${target_arch2}-darwin-user) 34009c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 34019c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 34029c7a4202SBlue Swirl exit 1 34039c7a4202SBlue Swirl fi 34049e407a85Spbrook target_user_only="yes" 3405831b7825Sths target_darwin_user="yes" 34069e407a85Spbrook ;; 3407600309b6SBlue Swirl ${target_arch2}-bsd-user) 34089cf55765SBlue Swirl if test "$bsd" != "yes" ; then 34099c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 34109c7a4202SBlue Swirl exit 1 34119c7a4202SBlue Swirl fi 341284778508Sblueswir1 target_user_only="yes" 341384778508Sblueswir1 target_bsd_user="yes" 341484778508Sblueswir1 ;; 34159e407a85Spbrook *) 34169e407a85Spbrook echo "ERROR: Target '$target' not recognised" 34179e407a85Spbrook exit 1 34189e407a85Spbrook ;; 34199e407a85Spbrookesac 3420831b7825Sths 342197a847bcSbellardmkdir -p $target_dir 3422158142c2Sbellardmkdir -p $target_dir/fpu 342357fec1feSbellardmkdir -p $target_dir/tcg 342459f2a787SGerd Hoffmannmkdir -p $target_dir/ide 3425353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs 34263b9a6ee5SJan Kiszkamkdir -p $target_dir/kvm 342784778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 342869de927cSbellard mkdir -p $target_dir/nwfpe 342969de927cSbellardfi 343011568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 3431ec530c81Sbellard 343297a847bcSbellard 343325be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 343497a847bcSbellard 3435e5fe0c52Spbrookbflt="no" 3436bd0c5661Spbrooktarget_nptl="no" 3437600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 343856aebc89Spbrookgdb_xml_files="" 3439c2e3dee6SLaurent Viviertarget_short_alignment=2 3440c2e3dee6SLaurent Viviertarget_int_alignment=4 3441c2e3dee6SLaurent Viviertarget_long_alignment=4 3442c2e3dee6SLaurent Viviertarget_llong_alignment=8 3443de3a354aSMichael Walletarget_libs_softmmu= 34447ba1e619Saliguori 3445938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 34466acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3447e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3448e73aae67SJuan Quintela 3449600309b6SBlue Swirlcase "$target_arch2" in 34502408a527Saurel32 i386) 345171deff27SAurelien Jarno target_phys_bits=64 34522408a527Saurel32 ;; 34532408a527Saurel32 x86_64) 34546acff7daSJuan Quintela TARGET_BASE_ARCH=i386 34551ad2134fSPaul Brook target_phys_bits=64 3456c2e3dee6SLaurent Vivier target_long_alignment=8 34572408a527Saurel32 ;; 34582408a527Saurel32 alpha) 34591ad2134fSPaul Brook target_phys_bits=64 3460c2e3dee6SLaurent Vivier target_long_alignment=8 3461a4b388ffSRichard Henderson target_nptl="yes" 34622408a527Saurel32 ;; 34632408a527Saurel32 arm|armeb) 3464b498c8a0SJuan Quintela TARGET_ARCH=arm 3465e5fe0c52Spbrook bflt="yes" 3466bd0c5661Spbrook target_nptl="yes" 346756aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 34681ad2134fSPaul Brook target_phys_bits=32 3469c2e3dee6SLaurent Vivier target_llong_alignment=4 3470412beee6SGrant Likely target_libs_softmmu="$fdt_libs" 34712408a527Saurel32 ;; 34722408a527Saurel32 cris) 3473253bd7f8Sedgar_igl target_nptl="yes" 34741ad2134fSPaul Brook target_phys_bits=32 34752408a527Saurel32 ;; 3476613a22c9SMichael Walle lm32) 3477613a22c9SMichael Walle target_phys_bits=32 3478de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3479613a22c9SMichael Walle ;; 34802408a527Saurel32 m68k) 34810938cda5Saurel32 bflt="yes" 348256aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 34831ad2134fSPaul Brook target_phys_bits=32 3484c2e3dee6SLaurent Vivier target_int_alignment=2 3485c2e3dee6SLaurent Vivier target_long_alignment=2 3486c2e3dee6SLaurent Vivier target_llong_alignment=2 34872408a527Saurel32 ;; 3488877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3489877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 349072b675caSEdgar E. Iglesias bflt="yes" 349172b675caSEdgar E. Iglesias target_nptl="yes" 349272b675caSEdgar E. Iglesias target_phys_bits=32 3493de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 349472b675caSEdgar E. Iglesias ;; 34952408a527Saurel32 mips|mipsel) 3496b498c8a0SJuan Quintela TARGET_ARCH=mips 349725be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3498f04dc72fSPaul Brook target_nptl="yes" 34991ad2134fSPaul Brook target_phys_bits=64 35002408a527Saurel32 ;; 35012408a527Saurel32 mipsn32|mipsn32el) 3502b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 35036acff7daSJuan Quintela TARGET_BASE_ARCH=mips 350425be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 35051ad2134fSPaul Brook target_phys_bits=64 35062408a527Saurel32 ;; 35072408a527Saurel32 mips64|mips64el) 3508b498c8a0SJuan Quintela TARGET_ARCH=mips64 35096acff7daSJuan Quintela TARGET_BASE_ARCH=mips 351025be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 35111ad2134fSPaul Brook target_phys_bits=64 3512c2e3dee6SLaurent Vivier target_long_alignment=8 35132408a527Saurel32 ;; 35142408a527Saurel32 ppc) 3515c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35168b242ebaSAlexander Graf target_phys_bits=64 3517d6630708SNathan Froyd target_nptl="yes" 3518de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35192408a527Saurel32 ;; 35202408a527Saurel32 ppcemb) 35216acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3522e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3523c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35241ad2134fSPaul Brook target_phys_bits=64 3525d6630708SNathan Froyd target_nptl="yes" 3526de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35272408a527Saurel32 ;; 35282408a527Saurel32 ppc64) 35296acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3530e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3531c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35321ad2134fSPaul Brook target_phys_bits=64 3533c2e3dee6SLaurent Vivier target_long_alignment=8 3534de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35352408a527Saurel32 ;; 35362408a527Saurel32 ppc64abi32) 3537b498c8a0SJuan Quintela TARGET_ARCH=ppc64 35386acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3539e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 354025be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3541c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 35421ad2134fSPaul Brook target_phys_bits=64 3543de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 35442408a527Saurel32 ;; 35452408a527Saurel32 sh4|sh4eb) 3546b498c8a0SJuan Quintela TARGET_ARCH=sh4 35474dbed897Spbrook bflt="yes" 35480b6d3ae0Saurel32 target_nptl="yes" 35491ad2134fSPaul Brook target_phys_bits=32 35502408a527Saurel32 ;; 35512408a527Saurel32 sparc) 35521ad2134fSPaul Brook target_phys_bits=64 35532408a527Saurel32 ;; 35542408a527Saurel32 sparc64) 35556acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 35561ad2134fSPaul Brook target_phys_bits=64 3557c2e3dee6SLaurent Vivier target_long_alignment=8 35582408a527Saurel32 ;; 35592408a527Saurel32 sparc32plus) 3560b498c8a0SJuan Quintela TARGET_ARCH=sparc64 35616acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3562e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 356325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 35641ad2134fSPaul Brook target_phys_bits=64 35652408a527Saurel32 ;; 356624e804ecSAlexander Graf s390x) 3567bc434676SUlrich Hecht target_nptl="yes" 356824e804ecSAlexander Graf target_phys_bits=64 35697b3da903SAlexander Graf target_long_alignment=8 357024e804ecSAlexander Graf ;; 3571d2fbca94SGuan Xuetao unicore32) 3572d2fbca94SGuan Xuetao target_phys_bits=32 3573d2fbca94SGuan Xuetao ;; 3574cfa550c6SMax Filippov xtensa|xtensaeb) 3575cfa550c6SMax Filippov TARGET_ARCH=xtensa 3576cfa550c6SMax Filippov target_phys_bits=32 3577cfa550c6SMax Filippov ;; 35782408a527Saurel32 *) 3579de83cd02Sbellard echo "Unsupported target CPU" 3580de83cd02Sbellard exit 1 35812408a527Saurel32 ;; 35822408a527Saurel32esac 3583c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3584c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3585c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3586c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 358725be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3588053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 358925be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 359025be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 359142bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 35926acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 35936acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 35946acff7daSJuan Quintelafi 359525be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3596e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3597e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3598e6e91b9cSJuan Quintelafi 359925be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 36001b0c87fcSJuan Quintelacase "$target_arch2" in 36011b0c87fcSJuan Quintela i386|x86_64) 36021b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 360364b3cfdbSAnthony PERARD target_phys_bits=64 360425be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 360559d21e53SAlexander Graf else 360659d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 3607432d268cSJun Nakajima fi 360859d21e53SAlexander Graf ;; 360959d21e53SAlexander Graf *) 361059d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 36111b0c87fcSJuan Quintelaesac 3612c59249f9SJuan Quintelacase "$target_arch2" in 36130e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3614c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3615c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3616c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3617c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 36185f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3619adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3620adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3621c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3622c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 362325be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 36241ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 3625d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3626d5970055SMichael S. Tsirkin fi 3627c59249f9SJuan Quintela fi 3628c59249f9SJuan Quintelaesac 36297f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then 36300a6b8ddeSAlexander Graf echo "CONFIG_PSERIES=y" >> $config_target_mak 36310a6b8ddeSAlexander Graffi 3632de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 363325be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 363497a847bcSbellardfi 363597a847bcSbellardif test "$target_softmmu" = "yes" ; then 3636b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 363725be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 3638de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 36390e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 36405791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3641ad4cf3f6SPaul Brook if test "$smartcard_nss" = "yes" ; then 3642ad4cf3f6SPaul Brook echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3643ad4cf3f6SPaul Brook fi 3644de83cd02Sbellardfi 3645997344f3Sbellardif test "$target_user_only" = "yes" ; then 364625be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3647a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 3648997344f3Sbellardfi 3649831b7825Sthsif test "$target_linux_user" = "yes" ; then 365025be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3651831b7825Sthsfi 3652831b7825Sthsif test "$target_darwin_user" = "yes" ; then 365325be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3654831b7825Sthsfi 365556aebc89Spbrooklist="" 365656aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 365756aebc89Spbrook for x in $gdb_xml_files; do 365856aebc89Spbrook list="$list $source_path/gdb-xml/$x" 365956aebc89Spbrook done 366025be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 36613d0f1517SJuan Quintelafi 3662de83cd02Sbellard 3663e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 366425be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3665e5fe0c52Spbrookfi 3666bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3667bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 366825be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3669bd0c5661Spbrookfi 3670379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 367125be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3672379f6698SPaul Brookfi 367384778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 367425be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 367584778508Sblueswir1fi 36765b0753e0Sbellard 36774afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3678fa282484SJuan Quintela 36794afddb55SJuan Quintelacflags="" 3680f9728943SPaolo Bonziniincludes="" 3681fa282484SJuan Quintelaldflags="" 36829b8e111fSJuan Quintela 36839195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then 36849195b2c2SStefan Weil includes="-I\$(SRC_PATH)/tcg/tci $includes" 36859195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then 3686f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 368724e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3688f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 36895d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3690f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 369157ddfbf7SJuan Quintelaelse 3692f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 369357ddfbf7SJuan Quintelafi 3694f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 369557ddfbf7SJuan Quintela 36966efd7517SPeter Maydellif test "$linux" = "yes" ; then 36976efd7517SPeter Maydell includes="-I\$(SRC_PATH)/linux-headers $includes" 36986efd7517SPeter Maydellfi 36996efd7517SPeter Maydell 37004d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 37014d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 37024d904533SBlue Swirlelse 37034d904533SBlue Swirl libdis_config_mak=libdis/config.mak 37044d904533SBlue Swirlfi 37054d904533SBlue Swirl 370664656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 370764656024SJuan Quintela case "$i" in 370864656024SJuan Quintela alpha) 370925be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 37104d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 371164656024SJuan Quintela ;; 371264656024SJuan Quintela arm) 371325be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 37144d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 371564656024SJuan Quintela ;; 371664656024SJuan Quintela cris) 371725be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 37184d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 371964656024SJuan Quintela ;; 372064656024SJuan Quintela hppa) 372125be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 37224d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 372364656024SJuan Quintela ;; 372464656024SJuan Quintela i386|x86_64) 372525be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 37264d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 372764656024SJuan Quintela ;; 3728903ec55cSAurelien Jarno ia64*) 3729903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3730903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3731903ec55cSAurelien Jarno ;; 373264656024SJuan Quintela m68k) 373325be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 37344d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 373564656024SJuan Quintela ;; 3736877fdc12SEdgar E. Iglesias microblaze*) 373725be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 37384d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 373964656024SJuan Quintela ;; 374064656024SJuan Quintela mips*) 374125be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 37424d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 374364656024SJuan Quintela ;; 374464656024SJuan Quintela ppc*) 374525be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 37464d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 374764656024SJuan Quintela ;; 374824e804ecSAlexander Graf s390*) 374925be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 37504d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 375164656024SJuan Quintela ;; 375264656024SJuan Quintela sh4) 375325be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 37544d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 375564656024SJuan Quintela ;; 375664656024SJuan Quintela sparc*) 375725be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 37584d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 375964656024SJuan Quintela ;; 3760cfa550c6SMax Filippov xtensa*) 3761cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 3762cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak 3763cfa550c6SMax Filippov ;; 376464656024SJuan Quintela esac 376564656024SJuan Quinteladone 37669195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 37679195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 37689195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak 37699195b2c2SStefan Weilfi 377064656024SJuan Quintela 37716ee7126fSJuan Quintelacase "$ARCH" in 37726ee7126fSJuan Quintelaalpha) 37736ee7126fSJuan Quintela # Ensure there's only a single GP 37746ee7126fSJuan Quintela cflags="-msmall-data $cflags" 37756ee7126fSJuan Quintela;; 37766ee7126fSJuan Quintelaesac 37776ee7126fSJuan Quintela 377855d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 377955d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 378055d9c04bSJuan Quintela arm) 378155d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 378255d9c04bSJuan Quintela ;; 378325a8bb96SMichael Walle lm32) 378425a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 378525a8bb96SMichael Walle ;; 378655d9c04bSJuan Quintela i386|mips|ppc) 378755d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 378855d9c04bSJuan Quintela ;; 378955d9c04bSJuan Quintela esac 379055d9c04bSJuan Quintelafi 379155d9c04bSJuan Quintela 3792471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3793471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3794471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 379525be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3796471857ddSJuan Quintelafi 3797471857ddSJuan Quintela 3798d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 379925be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3800d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3801d02c1db3SJuan Quintela cflags="-p $cflags" 3802d02c1db3SJuan Quintela ldflags="-p $ldflags" 3803d02c1db3SJuan Quintela fi 3804d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3805d02c1db3SJuan Quintela ldflags="-p $ldflags" 380625be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3807d02c1db3SJuan Quintela fi 3808d02c1db3SJuan Quintelafi 3809d02c1db3SJuan Quintela 38109195b2c2SStefan Weilif test "$ARCH" = "tci"; then 38119195b2c2SStefan Weil linker_script="" 38129195b2c2SStefan Weilelse 38136ee7126fSJuan Quintela linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 38149195b2c2SStefan Weilfi 38159195b2c2SStefan Weil 38169b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3817fa282484SJuan Quintela case "$ARCH" in 3818fa282484SJuan Quintela sparc) 3819fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3820322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3821fa282484SJuan Quintela ;; 38224d58be06SRichard Henderson alpha | s390x) 38234d58be06SRichard Henderson # The default placement of the application is fine. 38244d58be06SRichard Henderson ;; 3825fd76e73aSRichard Henderson *) 3826322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3827fa282484SJuan Quintela ;; 3828fa282484SJuan Quintela esac 3829fa282484SJuan Quintelafi 3830fa282484SJuan Quintela 383125be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 383225be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3833f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3834fa282484SJuan Quintela 383597a847bcSbellarddone # for target in $targets 38367d13299dSbellard 3837d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3838c09015ddSAnthony LiguoriDIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom" 3839446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas" 38402d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 38413e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 3842e098fc3fSMichael RothDIRS="$DIRS qapi qapi-generated" 38432f28d2ffSAnthony LiguoriDIRS="$DIRS qga trace qom" 3844c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 3845c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 3846ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 3847446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 38482d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 3849753d11f2SRichard Hendersonfor bios_file in \ 3850753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 3851753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 3852753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 3853753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 3854753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 3855753d11f2SRichard Hendersondo 38567ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 38577ea78b74SJan Kiszkadone 3858d1807a4fSPaolo Bonzinimkdir -p $DIRS 38597d13299dSbellardfor f in $FILES ; do 3860f9245e10SPeter Maydell if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then 3861f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 3862f9245e10SPeter Maydell fi 38637d13299dSbellarddone 38641ad2134fSPaul Brook 3865c34ebfdcSAnthony Liguori# temporary config to build submodules 38662d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3867c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 386837116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3869c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3870c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3871c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3872c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3873c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3874c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3875c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3876c34ebfdcSAnthony Liguoridone 3877c34ebfdcSAnthony Liguori 38781ad2134fSPaul Brookfor hwlib in 32 64; do 38791ad2134fSPaul Brook d=libhw$hwlib 38801ad2134fSPaul Brook mkdir -p $d 38819953b2fcSBlue Swirl mkdir -p $d/ide 388211568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 3883353ac78dSAneesh Kumar K.V mkdir -p $d/9pfs 388437116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 38851ad2134fSPaul Brookdone 3886add16157SBlue Swirl 3887111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then 3888111a38b0SRobert Relyea # out of tree build 3889111a38b0SRobert Relyea mkdir -p libcacard 3890111a38b0SRobert Relyea rm -f libcacard/Makefile 389144dc0ca3SAlon Levy symlink "$source_path/libcacard/Makefile" libcacard/Makefile 3892111a38b0SRobert Relyeafi 3893111a38b0SRobert Relyea 3894add16157SBlue Swirld=libuser 3895add16157SBlue Swirlmkdir -p $d 3896937b1258SLluís Vilanovamkdir -p $d/trace 389711568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3898b40292e7SJan Kiszka 3899b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3900b40292e7SJan Kiszka mkdir -p QMP 3901b40292e7SJan Kiszkafi 3902