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 2352166aa0SJuan Quintelacompile_object() { 24da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 25da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1 2652166aa0SJuan Quintela} 2752166aa0SJuan Quintela 2852166aa0SJuan Quintelacompile_prog() { 2952166aa0SJuan Quintela local_cflags="$1" 3052166aa0SJuan Quintela local_ldflags="$2" 31da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 32da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 3352166aa0SJuan Quintela} 3452166aa0SJuan Quintela 350dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 360dba6195SLoïc Minier# executable or a builtin) 370dba6195SLoïc Minierhas() { 380dba6195SLoïc Minier type "$1" >/dev/null 2>&1 390dba6195SLoïc Minier} 400dba6195SLoïc Minier 410dba6195SLoïc Minier# search for an executable in PATH 420dba6195SLoïc Minierpath_of() { 430dba6195SLoïc Minier local_command="$1" 440dba6195SLoïc Minier local_ifs="$IFS" 450dba6195SLoïc Minier local_dir="" 460dba6195SLoïc Minier 470dba6195SLoïc Minier # pathname has a dir component? 480dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 490dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 500dba6195SLoïc Minier echo "$local_command" 510dba6195SLoïc Minier return 0 520dba6195SLoïc Minier fi 530dba6195SLoïc Minier fi 540dba6195SLoïc Minier if [ -z "$local_command" ]; then 550dba6195SLoïc Minier return 1 560dba6195SLoïc Minier fi 570dba6195SLoïc Minier 580dba6195SLoïc Minier IFS=: 590dba6195SLoïc Minier for local_dir in $PATH; do 600dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 610dba6195SLoïc Minier echo "$local_dir/$local_command" 620dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 630dba6195SLoïc Minier return 0 640dba6195SLoïc Minier fi 650dba6195SLoïc Minier done 660dba6195SLoïc Minier # not found 670dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 680dba6195SLoïc Minier return 1 690dba6195SLoïc Minier} 700dba6195SLoïc Minier 717d13299dSbellard# default parameters 722ff6b91eSJuan Quintelacpu="" 731e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 7443ce4dfeSbellardstatic="no" 75ed968ff1SJuan Quintelasparc_cpu="" 767d13299dSbellardcross_prefix="" 777d13299dSbellardcc="gcc" 780c58ac1cSmalcaudio_drv_list="" 79d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda" 80d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" 81eb852011SMarkus Armbrusterblock_drv_whitelist="" 827d13299dSbellardhost_cc="gcc" 837d13299dSbellardar="ar" 847d13299dSbellardmake="make" 856a882643Spbrookinstall="install" 867aa486feSAnthony Liguoriobjcopy="objcopy" 877aa486feSAnthony Liguorild="ld" 8852ba784dSHollis Blanchardstrip="strip" 899fe6de94SBlue Swirlwindres="windres" 90c81da56eSJuan Quintelahelper_cflags="" 9173da375eSJuan Quintelalibs_softmmu="" 923e2e0e6bSJuan Quintelalibs_tools="" 9367f86e8eSJuan Quintelaaudio_pt_int="" 94d5631638Smalcaudio_win_int="" 952b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 96ac0df51dSaliguori 97ac0df51dSaliguori# parse CC options first 98ac0df51dSaliguorifor opt do 99ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 100ac0df51dSaliguori case "$opt" in 101ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 102ac0df51dSaliguori ;; 103ac0df51dSaliguori --cc=*) cc="$optarg" 104ac0df51dSaliguori ;; 1052ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 1062ff6b91eSJuan Quintela ;; 107a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 108e2a2ed06SJuan Quintela ;; 109e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 110e2a2ed06SJuan Quintela ;; 11150e7b1a0SJuan Quintela --sparc_cpu=*) 11250e7b1a0SJuan Quintela sparc_cpu="$optarg" 11350e7b1a0SJuan Quintela case $sparc_cpu in 114ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 11550e7b1a0SJuan Quintela cpu="sparc" 11650e7b1a0SJuan Quintela ;; 11750e7b1a0SJuan Quintela v9) 11850e7b1a0SJuan Quintela cpu="sparc64" 11950e7b1a0SJuan Quintela ;; 12050e7b1a0SJuan Quintela *) 12150e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 12250e7b1a0SJuan Quintela exit 1 12350e7b1a0SJuan Quintela ;; 12450e7b1a0SJuan Quintela esac 12550e7b1a0SJuan Quintela ;; 126ac0df51dSaliguori esac 127ac0df51dSaliguoridone 128ac0df51dSaliguori# OS specific 129ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 130ac0df51dSaliguori# we can eliminate it's usage altogether 131ac0df51dSaliguori 132ac0df51dSaliguoricc="${cross_prefix}${cc}" 133ac0df51dSaliguoriar="${cross_prefix}${ar}" 1347aa486feSAnthony Liguoriobjcopy="${cross_prefix}${objcopy}" 1357aa486feSAnthony Liguorild="${cross_prefix}${ld}" 13652ba784dSHollis Blanchardstrip="${cross_prefix}${strip}" 1379fe6de94SBlue Swirlwindres="${cross_prefix}${windres}" 138ac0df51dSaliguori 139be17dc90SMichael S. Tsirkin# default flags for all hosts 140be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 141be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 142be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 143be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 144be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 14584958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 146be17dc90SMichael S. TsirkinQEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" 147be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 148be17dc90SMichael S. Tsirkin 149a21493e0SBlue Swirlgcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 150a21493e0SBlue Swirlgcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 1510b65b9e1SBlue Swirlgcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 152a21493e0SBlue Swirlgcc_flags="-fstack-protector-all $gcc_flags" 153be17dc90SMichael S. Tsirkincat > $TMPC << EOF 154aa527b65SAurelien Jarnoint main(void) { return 0; } 155be17dc90SMichael S. TsirkinEOF 156be17dc90SMichael S. Tsirkinfor flag in $gcc_flags; do 157aa527b65SAurelien Jarno if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 1581e027be7SMarkus Armbruster QEMU_CFLAGS="$QEMU_CFLAGS $flag" 159be17dc90SMichael S. Tsirkin fi 160be17dc90SMichael S. Tsirkindone 161be17dc90SMichael S. Tsirkin 162ac0df51dSaliguori# check that the C compiler works. 163ac0df51dSaliguoricat > $TMPC <<EOF 164ac0df51dSaliguoriint main(void) {} 165ac0df51dSaliguoriEOF 166ac0df51dSaliguori 16752166aa0SJuan Quintelaif compile_object ; then 168ac0df51dSaliguori : C compiler works ok 169ac0df51dSaliguorielse 170ac0df51dSaliguori echo "ERROR: \"$cc\" either does not exist or does not work" 171ac0df51dSaliguori exit 1 172ac0df51dSaliguorifi 173ac0df51dSaliguori 174ac0df51dSaliguoricheck_define() { 175ac0df51dSaliguoricat > $TMPC <<EOF 176ac0df51dSaliguori#if !defined($1) 177ac0df51dSaliguori#error Not defined 178ac0df51dSaliguori#endif 179ac0df51dSaliguoriint main(void) { return 0; } 180ac0df51dSaliguoriEOF 18152166aa0SJuan Quintela compile_object 182ac0df51dSaliguori} 183ac0df51dSaliguori 1842ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 1852ff6b91eSJuan Quintela # command line argument 1862ff6b91eSJuan Quintela : 1872ff6b91eSJuan Quintelaelif check_define __i386__ ; then 188ac0df51dSaliguori cpu="i386" 189ac0df51dSaliguorielif check_define __x86_64__ ; then 190ac0df51dSaliguori cpu="x86_64" 1913aa9bd6cSblueswir1elif check_define __sparc__ ; then 1923aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 1933aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 1943aa9bd6cSblueswir1 if check_define __arch64__ ; then 1953aa9bd6cSblueswir1 cpu="sparc64" 1963aa9bd6cSblueswir1 else 1973aa9bd6cSblueswir1 cpu="sparc" 1983aa9bd6cSblueswir1 fi 199fdf7ed96Smalcelif check_define _ARCH_PPC ; then 200fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 201fdf7ed96Smalc cpu="ppc64" 202ac0df51dSaliguori else 203fdf7ed96Smalc cpu="ppc" 204fdf7ed96Smalc fi 205afa05235SAurelien Jarnoelif check_define __mips__ ; then 206afa05235SAurelien Jarno cpu="mips" 207477ba620SAurelien Jarnoelif check_define __ia64__ ; then 208477ba620SAurelien Jarno cpu="ia64" 209d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 210d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 211d66ed0eaSAurelien Jarno cpu="s390x" 212d66ed0eaSAurelien Jarno else 213d66ed0eaSAurelien Jarno cpu="s390" 214d66ed0eaSAurelien Jarno fi 215fdf7ed96Smalcelse 216fdf7ed96Smalc cpu=`uname -m` 217ac0df51dSaliguorifi 218ac0df51dSaliguori 2195327cf48Sbellardtarget_list="" 2207d13299dSbellardcase "$cpu" in 221afa05235SAurelien Jarno alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64) 222ea8f20f8SJuan Quintela cpu="$cpu" 223ea8f20f8SJuan Quintela ;; 2247d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 22597a847bcSbellard cpu="i386" 2267d13299dSbellard ;; 227aaa5fa14Saurel32 x86_64|amd64) 228aaa5fa14Saurel32 cpu="x86_64" 229aaa5fa14Saurel32 ;; 230ba68055eSbellard armv*b) 231808c4954Sbellard cpu="armv4b" 232808c4954Sbellard ;; 233ba68055eSbellard armv*l) 2347d13299dSbellard cpu="armv4l" 2357d13299dSbellard ;; 236f54b3f92Saurel32 parisc|parisc64) 237f54b3f92Saurel32 cpu="hppa" 238f54b3f92Saurel32 ;; 239afa05235SAurelien Jarno mips*) 240afa05235SAurelien Jarno cpu="mips" 241afa05235SAurelien Jarno ;; 24224e804ecSAlexander Graf s390) 243fb3e5849Sbellard cpu="s390" 244fb3e5849Sbellard ;; 24524e804ecSAlexander Graf s390x) 24624e804ecSAlexander Graf cpu="s390x" 24724e804ecSAlexander Graf ;; 2483142255cSblueswir1 sparc|sun4[cdmuv]) 249ae228531Sbellard cpu="sparc" 250ae228531Sbellard ;; 2517d13299dSbellard *) 252a447d4dcSPaolo Bonzini echo "Unsupported CPU = $cpu" 253a447d4dcSPaolo Bonzini exit 1 2547d13299dSbellard ;; 2557d13299dSbellardesac 256e2d52ad3SJuan Quintela 2573a3fb96dSStefan Weil# Default value for a variable defining feature "foo". 2583a3fb96dSStefan Weil# * foo="no" feature will only be used if --enable-foo arg is given 2593a3fb96dSStefan Weil# * foo="" feature will be searched for, and if found, will be used 2603a3fb96dSStefan Weil# unless --disable-foo is given 2613a3fb96dSStefan Weil# * foo="yes" this value will only be set by --enable-foo flag. 2623a3fb96dSStefan Weil# feature will searched for, 2633a3fb96dSStefan Weil# if not found, configure exits with error 264e2d52ad3SJuan Quintela# 2653a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args. 2663a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it 2673a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found. 268e2d52ad3SJuan Quintela 269a20a6f46SJuan Quintelabluez="" 2704ffcedb6SJuan Quintelabrlapi="" 271788c8196SJuan Quintelacurl="" 272c584a6d0SJuan Quintelacurses="" 273a25dba17SJuan Quinteladocs="" 2742df87df7SJuan Quintelafdt="" 275b31a0277SJuan Quintelakvm="" 276dae5079aSJan Kiszkakvm_para="" 277b0a47e79SJuan Quintelanptl="" 278c4198157SJuan Quintelasdl="" 279dfffc653SJuan Quintelasparse="no" 280ee682d27SStefan Weiluuid="" 281dfb278bdSJuan Quintelavde="" 2821be10ad2SJuan Quintelavnc_tls="" 283ea784e3bSJuan Quintelavnc_sasl="" 2842f6f5c7aSCorentin Charyvnc_jpeg="" 285efe556adSCorentin Charyvnc_png="" 28696763cf9SCorentin Charyvnc_thread="no" 287fc321b4bSJuan Quintelaxen="" 2885c6c3a6cSChristoph Hellwiglinux_aio="" 289758e8e38SVenkateswararao Jujjuri (JV)attr="" 290d5970055SMichael S. Tsirkinvhost_net="" 291dce512deSChristoph Hellwigxfs="" 292dfb278bdSJuan Quintela 2937d13299dSbellardgprof="no" 294f8393946Saurel32debug_tcg="no" 295b4475aa2SLuiz Capitulinodebug_mon="no" 296f3d08ee6SPaul Brookdebug="no" 2971625af87Saliguoristrip_opt="yes" 2987d13299dSbellardbigendian="no" 29967b915a5Sbellardmingw32="no" 30067b915a5SbellardEXESUF="" 301683035deSPaolo Bonziniprefix="/usr/local" 302683035deSPaolo Bonzinimandir="\${prefix}/share/man" 303683035deSPaolo Bonzinidatadir="\${prefix}/share/qemu" 304683035deSPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 305683035deSPaolo Bonzinibindir="\${prefix}/bin" 306683035deSPaolo Bonzinisysconfdir="\${prefix}/etc" 307683035deSPaolo Bonziniconfsuffix="/qemu" 308443f1376Sbellardslirp="yes" 309102a52e4Sbellardfmod_lib="" 310102a52e4Sbellardfmod_inc="" 3112f6a1ab0Sblueswir1oss_lib="" 312b1a550a0Spbrookbsd="no" 3135327cf48Sbellardlinux="no" 314d2c7c9b8Sblueswir1solaris="no" 31505c2a3e7Sbellardprofiler="no" 3165b0753e0Sbellardcocoa="no" 3170a8e90f4Spbrooksoftmmu="yes" 318831b7825Sthslinux_user="no" 319831b7825Sthsdarwin_user="no" 32084778508Sblueswir1bsd_user="no" 321379f6698SPaul Brookguest_base="" 322c5937220Spbrookuname_release="" 323e5d355d1Saliguoriio_thread="no" 3248ff9cbf7Smalcmixemu="no" 325eac30262Saliguorikerneldir="" 326b29fe3edSmalcaix="no" 327179cf400SAndreas Färberhaiku="no" 32877755340Sthsblobs="yes" 3294a19f1ecSpbrookpkgversion="" 3305495ed11SLuiz Capitulinocheck_utests="no" 33134005a00SKirill A. Shutemovuser_pie="no" 33220ff6c80SAnthony Liguorizero_malloc="" 33394a420b1SStefan Hajnoczitrace_backend="nop" 3349410b56cSPrerna Saxenatrace_file="trace" 335cd4ec0b4SGerd Hoffmannspice="" 336f27aaf4bSChristian Brunnerrbd="" 3377d13299dSbellard 3387d13299dSbellard# OS specific 339ac0df51dSaliguoriif check_define __linux__ ; then 340ac0df51dSaliguori targetos="Linux" 341ac0df51dSaliguorielif check_define _WIN32 ; then 342ac0df51dSaliguori targetos='MINGW32' 343169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 344169dc5d3Sblueswir1 targetos='OpenBSD' 345169dc5d3Sblueswir1elif check_define __sun__ ; then 346169dc5d3Sblueswir1 targetos='SunOS' 347179cf400SAndreas Färberelif check_define __HAIKU__ ; then 348179cf400SAndreas Färber targetos='Haiku' 349ac0df51dSaliguorielse 3507d13299dSbellard targetos=`uname -s` 351ac0df51dSaliguorifi 3520dbfc675SJuan Quintela 3537d13299dSbellardcase $targetos in 354c326e0afSbellardCYGWIN*) 355c326e0afSbellard mingw32="yes" 356a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 357d5631638Smalc audio_possible_drivers="winwave sdl" 358d5631638Smalc audio_drv_list="winwave" 359c326e0afSbellard;; 36067b915a5SbellardMINGW32*) 36167b915a5Sbellard mingw32="yes" 362d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 363d5631638Smalc audio_drv_list="winwave" 36467b915a5Sbellard;; 3655c40d2bdSthsGNU/kFreeBSD) 366a167ba50SAurelien Jarno bsd="yes" 3670c58ac1cSmalc audio_drv_list="oss" 368f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3695c40d2bdSths;; 3707d3505c5SbellardFreeBSD) 3717d3505c5Sbellard bsd="yes" 372a167ba50SAurelien Jarno make="gmake" 3730c58ac1cSmalc audio_drv_list="oss" 374f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 375f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 376f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3777d3505c5Sbellard;; 378c5e97233Sblueswir1DragonFly) 379c5e97233Sblueswir1 bsd="yes" 380a167ba50SAurelien Jarno make="gmake" 381c5e97233Sblueswir1 audio_drv_list="oss" 382c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 383c5e97233Sblueswir1;; 3847d3505c5SbellardNetBSD) 3857d3505c5Sbellard bsd="yes" 386a167ba50SAurelien Jarno make="gmake" 3870c58ac1cSmalc audio_drv_list="oss" 388c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3898ef92a88Sblueswir1 oss_lib="-lossaudio" 3907d3505c5Sbellard;; 3917d3505c5SbellardOpenBSD) 3927d3505c5Sbellard bsd="yes" 393a167ba50SAurelien Jarno make="gmake" 3940c58ac1cSmalc audio_drv_list="oss" 395c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3962f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3977d3505c5Sbellard;; 39883fb7adfSbellardDarwin) 39983fb7adfSbellard bsd="yes" 40083fb7adfSbellard darwin="yes" 4010dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 4020dbfc675SJuan Quintela # run 64-bit userspace code 403aab8588aSmalc if [ "$cpu" = "i386" ] ; then 4041b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 405aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 4061b0f9cc2Saliguori fi 4071b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 408a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4090c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4101b0f9cc2Saliguori else 411a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4121b0f9cc2Saliguori fi 413831b7825Sths darwin_user="yes" 414fd677642Sths cocoa="yes" 4150c58ac1cSmalc audio_drv_list="coreaudio" 416c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4170c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4187973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 41983fb7adfSbellard;; 420ec530c81SbellardSunOS) 421ec530c81Sbellard solaris="yes" 422c2b84fabSths make="gmake" 423c2b84fabSths install="ginstall" 424fa58948dSBlue Swirl ld="gld" 4250475a5caSths needs_libsunmath="no" 426c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 427ef18c883Sths # have to select again, because `uname -m` returns i86pc 428ef18c883Sths # even on an x86_64 box. 429ef18c883Sths solariscpu=`isainfo -k` 430ef18c883Sths if test "${solariscpu}" = "amd64" ; then 431ef18c883Sths cpu="x86_64" 432ef18c883Sths fi 433c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4340475a5caSths if test "$solarisrev" -le 9 ; then 4350475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4360475a5caSths needs_libsunmath="yes" 437f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 438f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 439f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4400475a5caSths else 4410475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4420475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4430475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4440475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4450475a5caSths exit 1 4460475a5caSths fi 4470475a5caSths fi 44886b2bd93Sths fi 4496b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4500c58ac1cSmalc audio_drv_list="oss" 4516b4d2ba1Sths fi 452c2de5c91Smalc audio_possible_drivers="oss sdl" 453d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 454d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 455d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 456d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 457a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 458e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 459ec530c81Sbellard;; 460b29fe3edSmalcAIX) 461b29fe3edSmalc aix="yes" 462b29fe3edSmalc make="gmake" 463b29fe3edSmalc;; 464179cf400SAndreas FärberHaiku) 465179cf400SAndreas Färber haiku="yes" 466179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 467179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 468179cf400SAndreas Färber;; 469fb065187Sbellard*) 4700c58ac1cSmalc audio_drv_list="oss" 471b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4725327cf48Sbellard linux="yes" 473831b7825Sths linux_user="yes" 47468063649Sblueswir1 usb="linux" 47507f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 476c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 477c9ec1fe4Sbellard fi 478fb065187Sbellard;; 4797d13299dSbellardesac 4807d13299dSbellard 4817d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 482b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 48368063649Sblueswir1 usb="bsd" 48483fb7adfSbellard fi 48584778508Sblueswir1 bsd_user="yes" 4867d3505c5Sbellardfi 4877d3505c5Sbellard 4883457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4893457a3f8SJuan Quintela EXESUF=".exe" 490a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 491e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 492e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 493884044aaSJuan Quintela LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 494683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 495683035deSPaolo Bonzini mandir="\${prefix}" 496683035deSPaolo Bonzini datadir="\${prefix}" 497683035deSPaolo Bonzini docdir="\${prefix}" 498683035deSPaolo Bonzini bindir="\${prefix}" 499683035deSPaolo Bonzini sysconfdir="\${prefix}" 500683035deSPaolo Bonzini confsuffix="" 5013457a3f8SJuan Quintelafi 5023457a3f8SJuan Quintela 5037d13299dSbellard# find source path 504ad064840Spbrooksource_path=`dirname "$0"` 50559faef3aSbalrogsource_path_used="no" 50659faef3aSbalrogworkdir=`pwd` 507ad064840Spbrookif [ -z "$source_path" ]; then 50859faef3aSbalrog source_path=$workdir 509ad064840Spbrookelse 510ad064840Spbrook source_path=`cd "$source_path"; pwd` 5117d13299dSbellardfi 512724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes" 5137d13299dSbellard 514487fefdbSAnthony Liguoriwerror="" 51585aa5189Sbellard 5167d13299dSbellardfor opt do 517a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 5187d13299dSbellard case "$opt" in 5192efc3265Sbellard --help|-h) show_help=yes 5202efc3265Sbellard ;; 521b1a550a0Spbrook --prefix=*) prefix="$optarg" 5227d13299dSbellard ;; 523b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 52432ce6337Sbellard ;; 525b1a550a0Spbrook --source-path=*) source_path="$optarg" 526ad064840Spbrook source_path_used="yes" 5277d13299dSbellard ;; 528ac0df51dSaliguori --cross-prefix=*) 5297d13299dSbellard ;; 530ac0df51dSaliguori --cc=*) 5317d13299dSbellard ;; 532b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 53383469015Sbellard ;; 534b1a550a0Spbrook --make=*) make="$optarg" 5357d13299dSbellard ;; 5366a882643Spbrook --install=*) install="$optarg" 5376a882643Spbrook ;; 538e2a2ed06SJuan Quintela --extra-cflags=*) 5397d13299dSbellard ;; 540e2a2ed06SJuan Quintela --extra-ldflags=*) 5417d13299dSbellard ;; 5422ff6b91eSJuan Quintela --cpu=*) 5437d13299dSbellard ;; 544b1a550a0Spbrook --target-list=*) target_list="$optarg" 545de83cd02Sbellard ;; 54694a420b1SStefan Hajnoczi --trace-backend=*) trace_backend="$optarg" 54794a420b1SStefan Hajnoczi ;; 5489410b56cSPrerna Saxena --trace-file=*) trace_file="$optarg" 5499410b56cSPrerna Saxena ;; 5507d13299dSbellard --enable-gprof) gprof="yes" 5517d13299dSbellard ;; 55279427693SLoïc Minier --static) 55379427693SLoïc Minier static="yes" 55479427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 55543ce4dfeSbellard ;; 5560b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5570b24e75fSPaolo Bonzini ;; 5580b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5590b24e75fSPaolo Bonzini ;; 5600b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5610b24e75fSPaolo Bonzini ;; 5620b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5630b24e75fSPaolo Bonzini ;; 564ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 56507381cc1SAnthony Liguori ;; 56697a847bcSbellard --disable-sdl) sdl="no" 56797a847bcSbellard ;; 568c4198157SJuan Quintela --enable-sdl) sdl="yes" 569c4198157SJuan Quintela ;; 570b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 571102a52e4Sbellard ;; 572c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 573c2de5c91Smalc ;; 5742f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5752f6a1ab0Sblueswir1 ;; 5762fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5770c58ac1cSmalc ;; 5780c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5790c58ac1cSmalc ;; 580eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 581eb852011SMarkus Armbruster ;; 582f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 583f8393946Saurel32 ;; 584f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 585f8393946Saurel32 ;; 586b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 587b4475aa2SLuiz Capitulino ;; 588b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 589b4475aa2SLuiz Capitulino ;; 590f3d08ee6SPaul Brook --enable-debug) 591f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 592f3d08ee6SPaul Brook debug_tcg="yes" 593b4475aa2SLuiz Capitulino debug_mon="yes" 594f3d08ee6SPaul Brook debug="yes" 595f3d08ee6SPaul Brook strip_opt="no" 596f3d08ee6SPaul Brook ;; 59703b4fe7dSaliguori --enable-sparse) sparse="yes" 59803b4fe7dSaliguori ;; 59903b4fe7dSaliguori --disable-sparse) sparse="no" 60003b4fe7dSaliguori ;; 6011625af87Saliguori --disable-strip) strip_opt="no" 6021625af87Saliguori ;; 6038d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 6048d5d2d4cSths ;; 6051be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 6061be10ad2SJuan Quintela ;; 6072f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 6082f9606b3Saliguori ;; 609ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 610ea784e3bSJuan Quintela ;; 6112f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 6122f6f5c7aSCorentin Chary ;; 6132f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 6142f6f5c7aSCorentin Chary ;; 615efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 616efe556adSCorentin Chary ;; 617efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 618efe556adSCorentin Chary ;; 619bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 620bd023f95SCorentin Chary ;; 621bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 622bd023f95SCorentin Chary ;; 623443f1376Sbellard --disable-slirp) slirp="no" 624c20709aaSbellard ;; 625ee682d27SStefan Weil --disable-uuid) uuid="no" 626ee682d27SStefan Weil ;; 627ee682d27SStefan Weil --enable-uuid) uuid="yes" 628ee682d27SStefan Weil ;; 629e0e6c8c0Saliguori --disable-vde) vde="no" 6308a16d273Sths ;; 631dfb278bdSJuan Quintela --enable-vde) vde="yes" 632dfb278bdSJuan Quintela ;; 633e37630caSaliguori --disable-xen) xen="no" 634e37630caSaliguori ;; 635fc321b4bSJuan Quintela --enable-xen) xen="yes" 636fc321b4bSJuan Quintela ;; 6372e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6382e4d9fb1Saurel32 ;; 6394ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6404ffcedb6SJuan Quintela ;; 641fb599c9aSbalrog --disable-bluez) bluez="no" 642fb599c9aSbalrog ;; 643a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 644a20a6f46SJuan Quintela ;; 6457ba1e619Saliguori --disable-kvm) kvm="no" 6467ba1e619Saliguori ;; 647b31a0277SJuan Quintela --enable-kvm) kvm="yes" 648b31a0277SJuan Quintela ;; 649cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 650cd4ec0b4SGerd Hoffmann ;; 651cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 652cd4ec0b4SGerd Hoffmann ;; 65305c2a3e7Sbellard --enable-profiler) profiler="yes" 65405c2a3e7Sbellard ;; 655c2de5c91Smalc --enable-cocoa) 656c2de5c91Smalc cocoa="yes" ; 657c2de5c91Smalc sdl="no" ; 658c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6595b0753e0Sbellard ;; 660cad25d69Spbrook --disable-system) softmmu="no" 6610a8e90f4Spbrook ;; 662cad25d69Spbrook --enable-system) softmmu="yes" 6630a8e90f4Spbrook ;; 6640953a80fSZachary Amsden --disable-user) 6650953a80fSZachary Amsden linux_user="no" ; 6660953a80fSZachary Amsden bsd_user="no" ; 6670953a80fSZachary Amsden darwin_user="no" 6680953a80fSZachary Amsden ;; 6690953a80fSZachary Amsden --enable-user) ;; 670831b7825Sths --disable-linux-user) linux_user="no" 6710a8e90f4Spbrook ;; 672831b7825Sths --enable-linux-user) linux_user="yes" 673831b7825Sths ;; 674831b7825Sths --disable-darwin-user) darwin_user="no" 675831b7825Sths ;; 676831b7825Sths --enable-darwin-user) darwin_user="yes" 6770a8e90f4Spbrook ;; 67884778508Sblueswir1 --disable-bsd-user) bsd_user="no" 67984778508Sblueswir1 ;; 68084778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 68184778508Sblueswir1 ;; 682379f6698SPaul Brook --enable-guest-base) guest_base="yes" 683379f6698SPaul Brook ;; 684379f6698SPaul Brook --disable-guest-base) guest_base="no" 685379f6698SPaul Brook ;; 68634005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 68734005a00SKirill A. Shutemov ;; 68834005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 68934005a00SKirill A. Shutemov ;; 690c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 691c5937220Spbrook ;; 6923142255cSblueswir1 --sparc_cpu=*) 6933142255cSblueswir1 ;; 69485aa5189Sbellard --enable-werror) werror="yes" 69585aa5189Sbellard ;; 69685aa5189Sbellard --disable-werror) werror="no" 69785aa5189Sbellard ;; 6984d3b6f6eSbalrog --disable-curses) curses="no" 6994d3b6f6eSbalrog ;; 700c584a6d0SJuan Quintela --enable-curses) curses="yes" 701c584a6d0SJuan Quintela ;; 702769ce76dSAlexander Graf --disable-curl) curl="no" 703769ce76dSAlexander Graf ;; 704788c8196SJuan Quintela --enable-curl) curl="yes" 705788c8196SJuan Quintela ;; 7062df87df7SJuan Quintela --disable-fdt) fdt="no" 7072df87df7SJuan Quintela ;; 7082df87df7SJuan Quintela --enable-fdt) fdt="yes" 7092df87df7SJuan Quintela ;; 7105495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 7115495ed11SLuiz Capitulino ;; 7125495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 7135495ed11SLuiz Capitulino ;; 714bd0c5661Spbrook --disable-nptl) nptl="no" 715bd0c5661Spbrook ;; 716b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 717b0a47e79SJuan Quintela ;; 7188ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7198ff9cbf7Smalc ;; 7205c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7215c6c3a6cSChristoph Hellwig ;; 7225c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7235c6c3a6cSChristoph Hellwig ;; 724758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 725758e8e38SVenkateswararao Jujjuri (JV) ;; 726758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 727758e8e38SVenkateswararao Jujjuri (JV) ;; 728e5d355d1Saliguori --enable-io-thread) io_thread="yes" 729e5d355d1Saliguori ;; 73077755340Sths --disable-blobs) blobs="no" 73177755340Sths ;; 732eac30262Saliguori --kerneldir=*) kerneldir="$optarg" 733eac30262Saliguori ;; 7344a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7354a19f1ecSpbrook ;; 736a25dba17SJuan Quintela --disable-docs) docs="no" 73770ec5dc0SAnthony Liguori ;; 738a25dba17SJuan Quintela --enable-docs) docs="yes" 73983a3ab8bSJuan Quintela ;; 740d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 741d5970055SMichael S. Tsirkin ;; 742d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 743d5970055SMichael S. Tsirkin ;; 7446bde81cbSPaolo Bonzini --*dir) 7456bde81cbSPaolo Bonzini ;; 746f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 747f27aaf4bSChristian Brunner ;; 748f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 749f27aaf4bSChristian Brunner ;; 7507f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7517f1559c6Sbalrog ;; 7527d13299dSbellard esac 7537d13299dSbellarddone 7547d13299dSbellard 7553142255cSblueswir1# 7563142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 757a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7583142255cSblueswir1# 759379f6698SPaul Brookhost_guest_base="no" 76040293e58Sbellardcase "$cpu" in 761ed968ff1SJuan Quintela sparc) case $sparc_cpu in 762ed968ff1SJuan Quintela v7|v8) 763a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 764ed968ff1SJuan Quintela ;; 765ed968ff1SJuan Quintela v8plus|v8plusa) 766a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 767ed968ff1SJuan Quintela ;; 768ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 769a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 770ed968ff1SJuan Quintela esac 7710c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 772a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 773762e8230Sblueswir1 if test "$solaris" = "no" ; then 774a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 775c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 776762e8230Sblueswir1 fi 7773142255cSblueswir1 ;; 778ed968ff1SJuan Quintela sparc64) 779a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 7800c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 781a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 782ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 783a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 784762e8230Sblueswir1 fi 7853142255cSblueswir1 ;; 78676d83bdeSths s390) 78728d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 78828d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 78948bb3750SRichard Henderson host_guest_base="yes" 79028d7cc49SRichard Henderson ;; 79128d7cc49SRichard Henderson s390x) 79228d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 79328d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 79448bb3750SRichard Henderson host_guest_base="yes" 79576d83bdeSths ;; 79640293e58Sbellard i386) 797a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 7980c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 7992b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 800c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 801379f6698SPaul Brook host_guest_base="yes" 80240293e58Sbellard ;; 80340293e58Sbellard x86_64) 804a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 8050c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8062b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 807379f6698SPaul Brook host_guest_base="yes" 808379f6698SPaul Brook ;; 809379f6698SPaul Brook arm*) 810379f6698SPaul Brook host_guest_base="yes" 81140293e58Sbellard ;; 812f6548c0aSmalc ppc*) 813f6548c0aSmalc host_guest_base="yes" 814f6548c0aSmalc ;; 815cc01cc8eSAurelien Jarno mips*) 816cc01cc8eSAurelien Jarno host_guest_base="yes" 817cc01cc8eSAurelien Jarno ;; 818477ba620SAurelien Jarno ia64*) 819477ba620SAurelien Jarno host_guest_base="yes" 820477ba620SAurelien Jarno ;; 821fd76e73aSRichard Henderson hppa*) 822fd76e73aSRichard Henderson host_guest_base="yes" 823fd76e73aSRichard Henderson ;; 8243142255cSblueswir1esac 8253142255cSblueswir1 826379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 827379f6698SPaul Brook 828af5db58eSpbrookif test x"$show_help" = x"yes" ; then 829af5db58eSpbrookcat << EOF 830af5db58eSpbrook 831af5db58eSpbrookUsage: configure [options] 832af5db58eSpbrookOptions: [defaults in brackets after descriptions] 833af5db58eSpbrook 834af5db58eSpbrookEOF 835af5db58eSpbrookecho "Standard options:" 836af5db58eSpbrookecho " --help print this message" 837af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 838af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 839af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 840af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 841af5db58eSpbrookecho "" 842af5db58eSpbrookecho "Advanced options (experts only):" 843af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 844af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 845af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 8460bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 8470bfe8cc0SPaolo Bonziniecho " build time" 848a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 849e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 850af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 8516a882643Spbrookecho " --install=INSTALL use specified install [$install]" 852af5db58eSpbrookecho " --static enable static build [$static]" 8530b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 8540b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 8550b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 8560b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 8570b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 858f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 859f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 86009695a4aSStefan Weilecho " --enable-debug enable common debug build options" 861890b1658Saliguoriecho " --enable-sparse enable sparse checker" 862890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 8631625af87Saliguoriecho " --disable-strip disable stripping binaries" 86485aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 865fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 866c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 867af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 868c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 869c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 8704c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 8714c9b53e3Smalcecho " Available cards: $audio_possible_cards" 872eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 873eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 8748ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 875e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 876fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 8772e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 8784ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 8798d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 8801be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 8812f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 882ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 8832f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 8842f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 88596763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 886efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 887bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 888bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 889af896aaaSpbrookecho " --disable-curses disable curses output" 890c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 891769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 892788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 8932df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 8942df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 8955495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 8965495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 897fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 898a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 8997ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 900b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 901bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 902e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 903af5db58eSpbrookecho " --enable-system enable all system emulation targets" 904af5db58eSpbrookecho " --disable-system disable all system emulation targets" 9050953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 9060953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 907831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 908831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 909831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 910831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 91184778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 91284778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 913379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 914379f6698SPaul Brookecho " emulation targets" 915379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 91634005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 91734005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 918af5db58eSpbrookecho " --fmod-lib path to FMOD library" 919af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 9202f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 921c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 9223142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 923ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 924ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 925e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 926dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 9275c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 9285c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 929758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 930758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 931e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 93277755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 933eac30262Saliguoriecho " --kerneldir=PATH look for kernel includes in PATH" 934d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 935d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 936d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 937d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 938b3d08c02SDaniel P. Berrangeecho " --trace-backend=B Trace backend nop simple ust dtrace" 9399410b56cSPrerna Saxenaecho " --trace-file=NAME Full PATH,NAME of file to store traces" 9409410b56cSPrerna Saxenaecho " Default:trace-<pid>" 941cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 942cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 943f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 944af5db58eSpbrookecho "" 9455bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 946af5db58eSpbrookexit 1 947af5db58eSpbrookfi 948af5db58eSpbrook 949ec530c81Sbellard# 950ec530c81Sbellard# Solaris specific configure tool chain decisions 951ec530c81Sbellard# 952ec530c81Sbellardif test "$solaris" = "yes" ; then 9536792aa11SLoïc Minier if has $install; then 9546792aa11SLoïc Minier : 9556792aa11SLoïc Minier else 956ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 957ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 958ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 959ec530c81Sbellard exit 1 960ec530c81Sbellard fi 9616792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 962ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 963ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 964ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 965ec530c81Sbellard exit 1 966ec530c81Sbellard fi 9676792aa11SLoïc Minier if has ar; then 9686792aa11SLoïc Minier : 9696792aa11SLoïc Minier else 970ec530c81Sbellard echo "Error: No path includes ar" 971ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 972ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 973ec530c81Sbellard fi 974ec530c81Sbellard exit 1 975ec530c81Sbellard fi 976ec530c81Sbellardfi 977ec530c81Sbellard 978ec530c81Sbellard 9795327cf48Sbellardif test -z "$target_list" ; then 9805327cf48Sbellard# these targets are portable 9810a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 9822408a527Saurel32 target_list="\ 9832408a527Saurel32i386-softmmu \ 9842408a527Saurel32x86_64-softmmu \ 9852408a527Saurel32arm-softmmu \ 9862408a527Saurel32cris-softmmu \ 9872408a527Saurel32m68k-softmmu \ 98872b675caSEdgar E. Iglesiasmicroblaze-softmmu \ 9892408a527Saurel32mips-softmmu \ 9902408a527Saurel32mipsel-softmmu \ 9912408a527Saurel32mips64-softmmu \ 9922408a527Saurel32mips64el-softmmu \ 9932408a527Saurel32ppc-softmmu \ 9942408a527Saurel32ppcemb-softmmu \ 9952408a527Saurel32ppc64-softmmu \ 9962408a527Saurel32sh4-softmmu \ 9972408a527Saurel32sh4eb-softmmu \ 9982408a527Saurel32sparc-softmmu \ 9991b64fcaeSIgor V. Kovalenkosparc64-softmmu \ 10002408a527Saurel32" 10010a8e90f4Spbrook fi 10025327cf48Sbellard# the following are Linux specific 1003831b7825Sths if [ "$linux_user" = "yes" ] ; then 10042408a527Saurel32 target_list="${target_list}\ 10052408a527Saurel32i386-linux-user \ 10062408a527Saurel32x86_64-linux-user \ 10072408a527Saurel32alpha-linux-user \ 10082408a527Saurel32arm-linux-user \ 10092408a527Saurel32armeb-linux-user \ 10102408a527Saurel32cris-linux-user \ 10112408a527Saurel32m68k-linux-user \ 101272b675caSEdgar E. Iglesiasmicroblaze-linux-user \ 10132408a527Saurel32mips-linux-user \ 10142408a527Saurel32mipsel-linux-user \ 10152408a527Saurel32ppc-linux-user \ 10162408a527Saurel32ppc64-linux-user \ 10172408a527Saurel32ppc64abi32-linux-user \ 10182408a527Saurel32sh4-linux-user \ 10192408a527Saurel32sh4eb-linux-user \ 10202408a527Saurel32sparc-linux-user \ 10212408a527Saurel32sparc64-linux-user \ 10222408a527Saurel32sparc32plus-linux-user \ 10232408a527Saurel32" 1024831b7825Sths fi 1025831b7825Sths# the following are Darwin specific 1026831b7825Sths if [ "$darwin_user" = "yes" ] ; then 10272408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user " 10285327cf48Sbellard fi 102984778508Sblueswir1# the following are BSD specific 103084778508Sblueswir1 if [ "$bsd_user" = "yes" ] ; then 103184778508Sblueswir1 target_list="${target_list}\ 103231fc12dfSblueswir1i386-bsd-user \ 103331fc12dfSblueswir1x86_64-bsd-user \ 103431fc12dfSblueswir1sparc-bsd-user \ 103584778508Sblueswir1sparc64-bsd-user \ 103684778508Sblueswir1" 103784778508Sblueswir1 fi 10386e20a45fSbellardelse 1039b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 10405327cf48Sbellardfi 10410a8e90f4Spbrookif test -z "$target_list" ; then 10420a8e90f4Spbrook echo "No targets enabled" 10430a8e90f4Spbrook exit 1 10440a8e90f4Spbrookfi 1045f55fe278SPaolo Bonzini# see if system emulation was really requested 1046f55fe278SPaolo Bonzinicase " $target_list " in 1047f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1048f55fe278SPaolo Bonzini ;; 1049f55fe278SPaolo Bonzini *) softmmu=no 1050f55fe278SPaolo Bonzini ;; 1051f55fe278SPaolo Bonziniesac 10525327cf48Sbellard 1053249247c9SJuan Quintelafeature_not_found() { 1054249247c9SJuan Quintela feature=$1 1055249247c9SJuan Quintela 1056249247c9SJuan Quintela echo "ERROR" 1057249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 10589332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1059249247c9SJuan Quintela echo "ERROR" 1060249247c9SJuan Quintela exit 1; 1061249247c9SJuan Quintela} 1062249247c9SJuan Quintela 10637d13299dSbellardif test -z "$cross_prefix" ; then 10647d13299dSbellard 10657d13299dSbellard# --- 10667d13299dSbellard# big/little endian test 10677d13299dSbellardcat > $TMPC << EOF 10687d13299dSbellard#include <inttypes.h> 10697d13299dSbellardint main(int argc, char ** argv){ 10707d13299dSbellard volatile uint32_t i=0x01234567; 10717d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 10727d13299dSbellard} 10737d13299dSbellardEOF 10747d13299dSbellard 107552166aa0SJuan Quintelaif compile_prog "" "" ; then 10767d13299dSbellard$TMPE && bigendian="yes" 10777d13299dSbellardelse 10787d13299dSbellardecho big/little test failed 10797d13299dSbellardfi 10807d13299dSbellard 10817d13299dSbellardelse 10827d13299dSbellard 10837d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1084ea8f20f8SJuan Quintelacase "$cpu" in 108524e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1086ea8f20f8SJuan Quintela bigendian=yes 1087ea8f20f8SJuan Quintela ;; 1088ea8f20f8SJuan Quintelaesac 10897d13299dSbellard 10907d13299dSbellardfi 10917d13299dSbellard 1092b6853697Sbellard# host long bits test 1093b6853697Sbellardhostlongbits="32" 1094ea8f20f8SJuan Quintelacase "$cpu" in 109524e804ecSAlexander Graf x86_64|alpha|ia64|sparc64|ppc64|s390x) 1096ea8f20f8SJuan Quintela hostlongbits=64 1097ea8f20f8SJuan Quintela ;; 1098ea8f20f8SJuan Quintelaesac 1099b6853697Sbellard 1100b0a47e79SJuan Quintela 1101b0a47e79SJuan Quintela########################################## 1102b0a47e79SJuan Quintela# NPTL probe 1103b0a47e79SJuan Quintela 1104b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1105bd0c5661Spbrook cat > $TMPC <<EOF 1106bd0c5661Spbrook#include <sched.h> 110730813ceaSpbrook#include <linux/futex.h> 1108bd0c5661Spbrookvoid foo() 1109bd0c5661Spbrook{ 1110bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1111bd0c5661Spbrook#error bork 1112bd0c5661Spbrook#endif 1113bd0c5661Spbrook} 1114bd0c5661SpbrookEOF 1115bd0c5661Spbrook 111652166aa0SJuan Quintela if compile_object ; then 1117b0a47e79SJuan Quintela nptl=yes 1118bd0c5661Spbrook else 1119b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1120b0a47e79SJuan Quintela feature_not_found "nptl" 1121b0a47e79SJuan Quintela fi 1122b0a47e79SJuan Quintela nptl=no 1123b0a47e79SJuan Quintela fi 1124bd0c5661Spbrookfi 1125bd0c5661Spbrook 112611d9f695Sbellard########################################## 1127ac62922eSbalrog# zlib check 1128ac62922eSbalrog 1129ac62922eSbalrogcat > $TMPC << EOF 1130ac62922eSbalrog#include <zlib.h> 1131ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1132ac62922eSbalrogEOF 113352166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 1134ac62922eSbalrog : 1135ac62922eSbalrogelse 1136ac62922eSbalrog echo 1137ac62922eSbalrog echo "Error: zlib check failed" 1138ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1139ac62922eSbalrog echo 1140ac62922eSbalrog exit 1 1141ac62922eSbalrogfi 1142ac62922eSbalrog 1143ac62922eSbalrog########################################## 1144e37630caSaliguori# xen probe 1145e37630caSaliguori 1146fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1147b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1148e37630caSaliguori cat > $TMPC <<EOF 1149e37630caSaliguori#include <xenctrl.h> 1150e37630caSaliguori#include <xs.h> 1151df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; } 1152e37630caSaliguoriEOF 115352166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1154fc321b4bSJuan Quintela xen=yes 11553efd632bSJuan Quintela libs_softmmu="$xen_libs $libs_softmmu" 1156e37630caSaliguori else 1157fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1158fc321b4bSJuan Quintela feature_not_found "xen" 1159fc321b4bSJuan Quintela fi 1160fc321b4bSJuan Quintela xen=no 1161e37630caSaliguori fi 1162e37630caSaliguorifi 1163e37630caSaliguori 1164e37630caSaliguori########################################## 1165f91672e5SPaolo Bonzini# pkgconfig probe 1166f91672e5SPaolo Bonzini 1167f91672e5SPaolo Bonzinipkgconfig="${cross_prefix}pkg-config" 11680dba6195SLoïc Minierif ! has $pkgconfig; then 1169f91672e5SPaolo Bonzini # likely not cross compiling, or hope for the best 1170f91672e5SPaolo Bonzini pkgconfig=pkg-config 1171f91672e5SPaolo Bonzinifi 1172f91672e5SPaolo Bonzini 1173f91672e5SPaolo Bonzini########################################## 1174dfffc653SJuan Quintela# Sparse probe 1175dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 11760dba6195SLoïc Minier if has cgcc; then 1177dfffc653SJuan Quintela sparse=yes 1178dfffc653SJuan Quintela else 1179dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1180dfffc653SJuan Quintela feature_not_found "sparse" 1181dfffc653SJuan Quintela fi 1182dfffc653SJuan Quintela sparse=no 1183dfffc653SJuan Quintela fi 1184dfffc653SJuan Quintelafi 1185dfffc653SJuan Quintela 1186dfffc653SJuan Quintela########################################## 118711d9f695Sbellard# SDL probe 118811d9f695Sbellard 1189fec0e3e8SStefan Weil# Look for sdl configuration program (pkg-config or sdl-config). 1190fec0e3e8SStefan Weil# Prefer variant with cross prefix if cross compiling, 1191fec0e3e8SStefan Weil# and favour pkg-config with sdl over sdl-config. 1192fec0e3e8SStefan Weilif test -n "$cross_prefix" -a $pkgconfig != pkg-config && \ 1193fec0e3e8SStefan Weil $pkgconfig sdl --modversion >/dev/null 2>&1; then 1194fec0e3e8SStefan Weil sdlconfig="$pkgconfig sdl" 1195fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 1196fec0e3e8SStefan Weilelif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then 1197fec0e3e8SStefan Weil sdlconfig="${cross_prefix}sdl-config" 1198fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1199fec0e3e8SStefan Weilelif $pkgconfig sdl --modversion >/dev/null 2>&1; then 12009316f803SPaolo Bonzini sdlconfig="$pkgconfig sdl" 12019316f803SPaolo Bonzini _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 12020dba6195SLoïc Minierelif has sdl-config; then 12039316f803SPaolo Bonzini sdlconfig='sdl-config' 12049316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1205a0dfd8a4SLoïc Minierelse 1206a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1207a0dfd8a4SLoïc Minier feature_not_found "sdl" 1208a0dfd8a4SLoïc Minier fi 1209a0dfd8a4SLoïc Minier sdl=no 12109316f803SPaolo Bonzinifi 121111d9f695Sbellard 12129316f803SPaolo Bonzinisdl_too_old=no 1213c4198157SJuan Quintelaif test "$sdl" != "no" ; then 121411d9f695Sbellard cat > $TMPC << EOF 121511d9f695Sbellard#include <SDL.h> 121611d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 121711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 121811d9f695SbellardEOF 12199316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 122074f42e18STeLeMan if test "$static" = "yes" ; then 122174f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 122274f42e18STeLeMan else 12239316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 122474f42e18STeLeMan fi 122552166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 122611d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 122711d9f695Sbellard sdl_too_old=yes 122811d9f695Sbellard else 1229fd677642Sths if test "$cocoa" = "no" ; then 123011d9f695Sbellard sdl=yes 123111d9f695Sbellard fi 1232fd677642Sths fi 12337c1f25b4Sbellard 123467c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 12351ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 123667c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1237f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1238f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 123911d9f695Sbellard fi 124052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 12411ac88f28SJuan Quintela : 12421ac88f28SJuan Quintela else 12431ac88f28SJuan Quintela sdl=no 12447c1f25b4Sbellard fi 12457c1f25b4Sbellard fi # static link 1246c4198157SJuan Quintela else # sdl not found 1247c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1248c4198157SJuan Quintela feature_not_found "sdl" 1249c4198157SJuan Quintela fi 1250c4198157SJuan Quintela sdl=no 12517c1f25b4Sbellard fi # sdl compile test 1252fd677642Sthsfi 125311d9f695Sbellard 12545368a422Saliguoriif test "$sdl" = "yes" ; then 12555368a422Saliguori cat > $TMPC <<EOF 12565368a422Saliguori#include <SDL.h> 12575368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 12585368a422Saliguori#include <X11/XKBlib.h> 12595368a422Saliguori#else 12605368a422Saliguori#error No x11 support 12615368a422Saliguori#endif 12625368a422Saliguoriint main(void) { return 0; } 12635368a422SaliguoriEOF 126452166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1265681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 12665368a422Saliguori fi 126707d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 126807d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 126907d9ac44SJuan Quintela fi 12700705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 12715368a422Saliguorifi 12725368a422Saliguori 12738f28f3fbSths########################################## 12748d5d2d4cSths# VNC TLS detection 12751be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then 1276ae6b5e5aSaliguori cat > $TMPC <<EOF 1277ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1278ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1279ae6b5e5aSaliguoriEOF 1280f91672e5SPaolo Bonzini vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null` 1281f91672e5SPaolo Bonzini vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null` 128252166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 12831be10ad2SJuan Quintela vnc_tls=yes 1284a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1285ae6b5e5aSaliguori else 12861be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 12871be10ad2SJuan Quintela feature_not_found "vnc-tls" 12881be10ad2SJuan Quintela fi 12891be10ad2SJuan Quintela vnc_tls=no 12908d5d2d4cSths fi 12918d5d2d4cSthsfi 12928d5d2d4cSths 12938d5d2d4cSths########################################## 12942f9606b3Saliguori# VNC SASL detection 12953aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then 12962f9606b3Saliguori cat > $TMPC <<EOF 12972f9606b3Saliguori#include <sasl/sasl.h> 12982f9606b3Saliguori#include <stdio.h> 12992f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 13002f9606b3SaliguoriEOF 13012f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 13022f9606b3Saliguori vnc_sasl_cflags="" 13032f9606b3Saliguori vnc_sasl_libs="-lsasl2" 130452166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1305ea784e3bSJuan Quintela vnc_sasl=yes 1306fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 13072f9606b3Saliguori else 1308ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1309ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1310ea784e3bSJuan Quintela fi 1311ea784e3bSJuan Quintela vnc_sasl=no 13122f9606b3Saliguori fi 13132f9606b3Saliguorifi 13142f9606b3Saliguori 13152f9606b3Saliguori########################################## 13162f6f5c7aSCorentin Chary# VNC JPEG detection 131796763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then 13182f6f5c7aSCorentin Charycat > $TMPC <<EOF 13192f6f5c7aSCorentin Chary#include <stdio.h> 13202f6f5c7aSCorentin Chary#include <jpeglib.h> 13212f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 13222f6f5c7aSCorentin CharyEOF 13232f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 13242f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 13252f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 13262f6f5c7aSCorentin Chary vnc_jpeg=yes 13272f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 13282f6f5c7aSCorentin Chary else 13292f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 13302f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 13312f6f5c7aSCorentin Chary fi 13322f6f5c7aSCorentin Chary vnc_jpeg=no 13332f6f5c7aSCorentin Chary fi 13342f6f5c7aSCorentin Charyfi 13352f6f5c7aSCorentin Chary 13362f6f5c7aSCorentin Chary########################################## 1337efe556adSCorentin Chary# VNC PNG detection 133896763cf9SCorentin Charyif test "$vnc_png" != "no" ; then 1339efe556adSCorentin Charycat > $TMPC <<EOF 1340efe556adSCorentin Chary//#include <stdio.h> 1341efe556adSCorentin Chary#include <png.h> 1342832ce9c2SScott Wood#include <stddef.h> 1343efe556adSCorentin Charyint main(void) { 1344efe556adSCorentin Chary png_structp png_ptr; 1345efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1346efe556adSCorentin Chary return 0; 1347efe556adSCorentin Chary} 1348efe556adSCorentin CharyEOF 1349efe556adSCorentin Chary vnc_png_cflags="" 1350efe556adSCorentin Chary vnc_png_libs="-lpng" 1351efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1352efe556adSCorentin Chary vnc_png=yes 1353efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 1354efe556adSCorentin Chary else 1355efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1356efe556adSCorentin Chary feature_not_found "vnc-png" 1357efe556adSCorentin Chary fi 1358efe556adSCorentin Chary vnc_png=no 1359efe556adSCorentin Chary fi 1360efe556adSCorentin Charyfi 1361efe556adSCorentin Chary 1362efe556adSCorentin Chary########################################## 136376655d6dSaliguori# fnmatch() probe, used for ACL routines 136476655d6dSaliguorifnmatch="no" 136576655d6dSaliguoricat > $TMPC << EOF 136676655d6dSaliguori#include <fnmatch.h> 136776655d6dSaliguoriint main(void) 136876655d6dSaliguori{ 136976655d6dSaliguori fnmatch("foo", "foo", 0); 137076655d6dSaliguori return 0; 137176655d6dSaliguori} 137276655d6dSaliguoriEOF 137352166aa0SJuan Quintelaif compile_prog "" "" ; then 137476655d6dSaliguori fnmatch="yes" 137576655d6dSaliguorifi 137676655d6dSaliguori 137776655d6dSaliguori########################################## 1378ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1379ee682d27SStefan Weilif test "$uuid" != "no" ; then 1380ee682d27SStefan Weil uuid_libs="-luuid" 1381ee682d27SStefan Weil cat > $TMPC << EOF 1382ee682d27SStefan Weil#include <uuid/uuid.h> 1383ee682d27SStefan Weilint main(void) 1384ee682d27SStefan Weil{ 1385ee682d27SStefan Weil uuid_t my_uuid; 1386ee682d27SStefan Weil uuid_generate(my_uuid); 1387ee682d27SStefan Weil return 0; 1388ee682d27SStefan Weil} 1389ee682d27SStefan WeilEOF 1390ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1391ee682d27SStefan Weil uuid="yes" 1392ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1393ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1394ee682d27SStefan Weil else 1395ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1396ee682d27SStefan Weil feature_not_found "uuid" 1397ee682d27SStefan Weil fi 1398ee682d27SStefan Weil uuid=no 1399ee682d27SStefan Weil fi 1400ee682d27SStefan Weilfi 1401ee682d27SStefan Weil 1402ee682d27SStefan Weil########################################## 1403dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1404dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1405dce512deSChristoph Hellwig cat > $TMPC << EOF 1406dce512deSChristoph Hellwig#include <xfs/xfs.h> 1407dce512deSChristoph Hellwigint main(void) 1408dce512deSChristoph Hellwig{ 1409dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1410dce512deSChristoph Hellwig return 0; 1411dce512deSChristoph Hellwig} 1412dce512deSChristoph HellwigEOF 1413dce512deSChristoph Hellwig if compile_prog "" "" ; then 1414dce512deSChristoph Hellwig xfs="yes" 1415dce512deSChristoph Hellwig else 1416dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1417dce512deSChristoph Hellwig feature_not_found "xfs" 1418dce512deSChristoph Hellwig fi 1419dce512deSChristoph Hellwig xfs=no 1420dce512deSChristoph Hellwig fi 1421dce512deSChristoph Hellwigfi 1422dce512deSChristoph Hellwig 1423dce512deSChristoph Hellwig########################################## 14248a16d273Sths# vde libraries probe 1425dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 14264baae0acSJuan Quintela vde_libs="-lvdeplug" 14278a16d273Sths cat > $TMPC << EOF 14288a16d273Sths#include <libvdeplug.h> 14294a7f0e06Spbrookint main(void) 14304a7f0e06Spbrook{ 14314a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 14324a7f0e06Spbrook vde_open("", "", &a); 14334a7f0e06Spbrook return 0; 14344a7f0e06Spbrook} 14358a16d273SthsEOF 143652166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 14374baae0acSJuan Quintela vde=yes 14388e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 14398e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1440dfb278bdSJuan Quintela else 1441dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1442dfb278bdSJuan Quintela feature_not_found "vde" 1443dfb278bdSJuan Quintela fi 1444dfb278bdSJuan Quintela vde=no 14458a16d273Sths fi 14468a16d273Sthsfi 14478a16d273Sths 14488a16d273Sths########################################## 1449c2de5c91Smalc# Sound support libraries probe 14508f28f3fbSths 1451c2de5c91Smalcaudio_drv_probe() 1452c2de5c91Smalc{ 1453c2de5c91Smalc drv=$1 1454c2de5c91Smalc hdr=$2 1455c2de5c91Smalc lib=$3 1456c2de5c91Smalc exp=$4 1457c2de5c91Smalc cfl=$5 14588f28f3fbSths cat > $TMPC << EOF 1459c2de5c91Smalc#include <$hdr> 1460c2de5c91Smalcint main(void) { $exp } 14618f28f3fbSthsEOF 146252166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 14638f28f3fbSths : 14648f28f3fbSths else 14658f28f3fbSths echo 1466c2de5c91Smalc echo "Error: $drv check failed" 1467c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 14688f28f3fbSths echo 14698f28f3fbSths exit 1 14708f28f3fbSths fi 1471c2de5c91Smalc} 1472c2de5c91Smalc 14732fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1474c2de5c91Smalcfor drv in $audio_drv_list; do 1475c2de5c91Smalc case $drv in 1476c2de5c91Smalc alsa) 1477c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1478c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1479a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1480c2de5c91Smalc ;; 1481c2de5c91Smalc 1482c2de5c91Smalc fmod) 1483c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1484c2de5c91Smalc echo 1485c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1486c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1487c2de5c91Smalc echo 1488c2de5c91Smalc exit 1 14898f28f3fbSths fi 1490c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1491a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1492c2de5c91Smalc ;; 1493c2de5c91Smalc 1494c2de5c91Smalc esd) 1495c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1496a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 149767f86e8eSJuan Quintela audio_pt_int="yes" 1498c2de5c91Smalc ;; 1499b8e59f18Smalc 1500b8e59f18Smalc pa) 1501493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1502b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1503493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 150467f86e8eSJuan Quintela audio_pt_int="yes" 1505b8e59f18Smalc ;; 1506b8e59f18Smalc 1507997e690aSJuan Quintela coreaudio) 1508997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1509997e690aSJuan Quintela ;; 1510997e690aSJuan Quintela 1511a4bf6780SJuan Quintela dsound) 1512a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1513d5631638Smalc audio_win_int="yes" 1514a4bf6780SJuan Quintela ;; 1515a4bf6780SJuan Quintela 1516a4bf6780SJuan Quintela oss) 1517a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1518a4bf6780SJuan Quintela ;; 1519a4bf6780SJuan Quintela 1520a4bf6780SJuan Quintela sdl|wav) 15212f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 15222f6a1ab0Sblueswir1 ;; 15232f6a1ab0Sblueswir1 1524d5631638Smalc winwave) 1525d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1526d5631638Smalc audio_win_int="yes" 1527d5631638Smalc ;; 1528d5631638Smalc 1529e4c63a6aSmalc *) 15301c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1531e4c63a6aSmalc echo 1532e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1533e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1534e4c63a6aSmalc echo 1535e4c63a6aSmalc exit 1 1536e4c63a6aSmalc } 1537e4c63a6aSmalc ;; 1538c2de5c91Smalc esac 1539c2de5c91Smalcdone 15408f28f3fbSths 15414d3b6f6eSbalrog########################################## 15422e4d9fb1Saurel32# BrlAPI probe 15432e4d9fb1Saurel32 15444ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1545eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 15462e4d9fb1Saurel32 cat > $TMPC << EOF 15472e4d9fb1Saurel32#include <brlapi.h> 1548832ce9c2SScott Wood#include <stddef.h> 15492e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 15502e4d9fb1Saurel32EOF 155152166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 15522e4d9fb1Saurel32 brlapi=yes 1553264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 15544ffcedb6SJuan Quintela else 15554ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 15564ffcedb6SJuan Quintela feature_not_found "brlapi" 15574ffcedb6SJuan Quintela fi 15584ffcedb6SJuan Quintela brlapi=no 1559eb82284fSJuan Quintela fi 1560eb82284fSJuan Quintelafi 15612e4d9fb1Saurel32 15622e4d9fb1Saurel32########################################## 15634d3b6f6eSbalrog# curses probe 15644f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses" 15654d3b6f6eSbalrog 1566c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1567c584a6d0SJuan Quintela curses_found=no 15684d3b6f6eSbalrog cat > $TMPC << EOF 15694d3b6f6eSbalrog#include <curses.h> 15705a8ff3aaSblueswir1#ifdef __OpenBSD__ 15715a8ff3aaSblueswir1#define resize_term resizeterm 15725a8ff3aaSblueswir1#endif 15735a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 15744d3b6f6eSbalrogEOF 15754f78ef9aSJuan Quintela for curses_lib in $curses_list; do 15764f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1577c584a6d0SJuan Quintela curses_found=yes 15784f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 15794f78ef9aSJuan Quintela break 15804d3b6f6eSbalrog fi 15814f78ef9aSJuan Quintela done 1582c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1583c584a6d0SJuan Quintela curses=yes 1584c584a6d0SJuan Quintela else 1585c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1586c584a6d0SJuan Quintela feature_not_found "curses" 1587c584a6d0SJuan Quintela fi 1588c584a6d0SJuan Quintela curses=no 1589c584a6d0SJuan Quintela fi 15904f78ef9aSJuan Quintelafi 15914d3b6f6eSbalrog 1592414f0dabSblueswir1########################################## 1593769ce76dSAlexander Graf# curl probe 1594769ce76dSAlexander Graf 15954e2b0658SPaolo Bonziniif $pkgconfig libcurl --modversion >/dev/null 2>&1; then 15964e2b0658SPaolo Bonzini curlconfig="$pkgconfig libcurl" 15974e2b0658SPaolo Bonzinielse 15984e2b0658SPaolo Bonzini curlconfig=curl-config 15994e2b0658SPaolo Bonzinifi 16004e2b0658SPaolo Bonzini 1601788c8196SJuan Quintelaif test "$curl" != "no" ; then 1602769ce76dSAlexander Graf cat > $TMPC << EOF 1603769ce76dSAlexander Graf#include <curl/curl.h> 1604769ce76dSAlexander Grafint main(void) { return curl_easy_init(); } 1605769ce76dSAlexander GrafEOF 16064e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 16074e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1608b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1609769ce76dSAlexander Graf curl=yes 1610f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1611f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1612788c8196SJuan Quintela else 1613788c8196SJuan Quintela if test "$curl" = "yes" ; then 1614788c8196SJuan Quintela feature_not_found "curl" 1615788c8196SJuan Quintela fi 1616788c8196SJuan Quintela curl=no 1617769ce76dSAlexander Graf fi 1618769ce76dSAlexander Graffi # test "$curl" 1619769ce76dSAlexander Graf 1620769ce76dSAlexander Graf########################################## 16215495ed11SLuiz Capitulino# check framework probe 16225495ed11SLuiz Capitulino 16235495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 16245495ed11SLuiz Capitulino cat > $TMPC << EOF 16255495ed11SLuiz Capitulino#include <check.h> 16265495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 16275495ed11SLuiz CapitulinoEOF 1628f91672e5SPaolo Bonzini check_libs=`$pkgconfig --libs check` 16295495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 16305495ed11SLuiz Capitulino check_utests=yes 16315495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 16325495ed11SLuiz Capitulino else 16335495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 16345495ed11SLuiz Capitulino feature_not_found "check" 16355495ed11SLuiz Capitulino fi 16365495ed11SLuiz Capitulino check_utests=no 16375495ed11SLuiz Capitulino fi 16385495ed11SLuiz Capitulinofi # test "$check_utests" 16395495ed11SLuiz Capitulino 16405495ed11SLuiz Capitulino########################################## 1641fb599c9aSbalrog# bluez support probe 1642a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1643e820e3f4Sbalrog cat > $TMPC << EOF 1644e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1645e820e3f4Sbalrogint main(void) { return bt_error(0); } 1646e820e3f4SbalrogEOF 1647f91672e5SPaolo Bonzini bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null` 1648f91672e5SPaolo Bonzini bluez_libs=`$pkgconfig --libs bluez 2> /dev/null` 164952166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1650a20a6f46SJuan Quintela bluez=yes 1651e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1652e820e3f4Sbalrog else 1653a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1654a20a6f46SJuan Quintela feature_not_found "bluez" 1655a20a6f46SJuan Quintela fi 1656e820e3f4Sbalrog bluez="no" 1657e820e3f4Sbalrog fi 1658fb599c9aSbalrogfi 1659fb599c9aSbalrog 1660fb599c9aSbalrog########################################## 16617ba1e619Saliguori# kvm probe 1662b31a0277SJuan Quintelaif test "$kvm" != "no" ; then 16637ba1e619Saliguori cat > $TMPC <<EOF 16647ba1e619Saliguori#include <linux/kvm.h> 16659fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 16667ba1e619Saliguori#error Invalid KVM version 16677ba1e619Saliguori#endif 16689fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY) 16699fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY 16709fd8d8d7Saliguori#endif 16719fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR) 16729fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR 16739fd8d8d7Saliguori#endif 16749fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) 16759fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS 16769fd8d8d7Saliguori#endif 16777ba1e619Saliguoriint main(void) { return 0; } 16787ba1e619SaliguoriEOF 1679eac30262Saliguori if test "$kerneldir" != "" ; then 1680eac30262Saliguori kvm_cflags=-I"$kerneldir"/include 16818444eb6eSaliguori if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ 16828444eb6eSaliguori -a -d "$kerneldir/arch/x86/include" ; then 16838444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" 1684406b430dSaliguori elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then 1685406b430dSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" 16860e60a699SAlexander Graf elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then 16870e60a699SAlexander Graf kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include" 16888444eb6eSaliguori elif test -d "$kerneldir/arch/$cpu/include" ; then 16898444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" 16908444eb6eSaliguori fi 1691eac30262Saliguori else 1692f038e8f7SStefan Weil kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null` 1693eac30262Saliguori fi 169452166aa0SJuan Quintela if compile_prog "$kvm_cflags" "" ; then 1695b31a0277SJuan Quintela kvm=yes 1696dae5079aSJan Kiszka cat > $TMPC <<EOF 1697dae5079aSJan Kiszka#include <linux/kvm_para.h> 1698dae5079aSJan Kiszkaint main(void) { return 0; } 1699dae5079aSJan KiszkaEOF 1700dae5079aSJan Kiszka if compile_prog "$kvm_cflags" "" ; then 1701dae5079aSJan Kiszka kvm_para=yes 1702dae5079aSJan Kiszka fi 17037ba1e619Saliguori else 1704b31a0277SJuan Quintela if test "$kvm" = "yes" ; then 17050dba6195SLoïc Minier if has awk && has grep; then 1706a558ee17SJuan Quintela kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ 17079fd8d8d7Saliguori | grep "error: " \ 17089fd8d8d7Saliguori | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` 17099fd8d8d7Saliguori if test "$kvmerr" != "" ; then 1710b31a0277SJuan Quintela echo -e "${kvmerr}\n\ 1711168ccc11SJan Kiszka NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ 1712168ccc11SJan Kiszka recent kvm-kmod from http://sourceforge.net/projects/kvm." 17139fd8d8d7Saliguori fi 17149fd8d8d7Saliguori fi 1715b31a0277SJuan Quintela feature_not_found "kvm" 1716b31a0277SJuan Quintela fi 1717b31a0277SJuan Quintela kvm=no 17187ba1e619Saliguori fi 17197ba1e619Saliguorifi 17207ba1e619Saliguori 17217ba1e619Saliguori########################################## 1722d5970055SMichael S. Tsirkin# test for vhost net 1723d5970055SMichael S. Tsirkin 1724d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then 1725d5970055SMichael S. Tsirkin if test "$kvm" != "no"; then 1726d5970055SMichael S. Tsirkin cat > $TMPC <<EOF 1727d5970055SMichael S. Tsirkin #include <linux/vhost.h> 1728d5970055SMichael S. Tsirkin int main(void) { return 0; } 1729d5970055SMichael S. TsirkinEOF 1730d5970055SMichael S. Tsirkin if compile_prog "$kvm_cflags" "" ; then 1731d5970055SMichael S. Tsirkin vhost_net=yes 1732d5970055SMichael S. Tsirkin else 1733d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 1734d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1735d5970055SMichael S. Tsirkin fi 1736d5970055SMichael S. Tsirkin vhost_net=no 1737d5970055SMichael S. Tsirkin fi 1738d5970055SMichael S. Tsirkin else 1739d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 17404021d247SAurelien Jarno echo "NOTE: vhost-net feature requires KVM (--enable-kvm)." 1741d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1742d5970055SMichael S. Tsirkin fi 1743d5970055SMichael S. Tsirkin vhost_net=no 1744d5970055SMichael S. Tsirkin fi 1745d5970055SMichael S. Tsirkinfi 1746d5970055SMichael S. Tsirkin 1747d5970055SMichael S. Tsirkin########################################## 1748e5d355d1Saliguori# pthread probe 1749de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 17503c529d93Saliguori 1751e5d355d1Saliguoripthread=no 1752414f0dabSblueswir1cat > $TMPC << EOF 17533c529d93Saliguori#include <pthread.h> 1754de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1755414f0dabSblueswir1EOF 1756bd00d539SAndreas Färberif compile_prog "" "" ; then 1757bd00d539SAndreas Färber pthread=yes 1758bd00d539SAndreas Färberelse 1759de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 176052166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1761e5d355d1Saliguori pthread=yes 17625572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1763de65fe0fSSebastian Herbszt break 1764414f0dabSblueswir1 fi 1765de65fe0fSSebastian Herbszt done 1766bd00d539SAndreas Färberfi 1767414f0dabSblueswir1 17684617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 17694dd75c70SChristoph Hellwig echo 17704dd75c70SChristoph Hellwig echo "Error: pthread check failed" 17714dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 17724dd75c70SChristoph Hellwig echo 17734dd75c70SChristoph Hellwig exit 1 1774e5d355d1Saliguorifi 1775e5d355d1Saliguori 1776bf9298b9Saliguori########################################## 1777f27aaf4bSChristian Brunner# rbd probe 1778f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 1779f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1780f27aaf4bSChristian Brunner#include <stdio.h> 1781f27aaf4bSChristian Brunner#include <rados/librados.h> 1782f27aaf4bSChristian Brunnerint main(void) { rados_initialize(0, NULL); return 0; } 1783f27aaf4bSChristian BrunnerEOF 1784f27aaf4bSChristian Brunner rbd_libs="-lrados -lcrypto" 1785f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1786f27aaf4bSChristian Brunner librados_too_old=no 1787f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1788f27aaf4bSChristian Brunner#include <stdio.h> 1789f27aaf4bSChristian Brunner#include <rados/librados.h> 1790f27aaf4bSChristian Brunner#ifndef CEPH_OSD_TMAP_SET 1791f27aaf4bSChristian Brunner#error missing CEPH_OSD_TMAP_SET 1792f27aaf4bSChristian Brunner#endif 1793f27aaf4bSChristian Brunnerint main(void) { 1794f27aaf4bSChristian Brunner int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create; 1795f27aaf4bSChristian Brunner rados_initialize(0, NULL); 1796f27aaf4bSChristian Brunner return 0; 1797f27aaf4bSChristian Brunner} 1798f27aaf4bSChristian BrunnerEOF 1799f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1800f27aaf4bSChristian Brunner rbd=yes 1801f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 1802f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 1803f27aaf4bSChristian Brunner else 1804f27aaf4bSChristian Brunner rbd=no 1805f27aaf4bSChristian Brunner librados_too_old=yes 1806f27aaf4bSChristian Brunner fi 1807f27aaf4bSChristian Brunner else 1808f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 1809f27aaf4bSChristian Brunner feature_not_found "rados block device" 1810f27aaf4bSChristian Brunner fi 1811f27aaf4bSChristian Brunner rbd=no 1812f27aaf4bSChristian Brunner fi 1813f27aaf4bSChristian Brunner if test "$librados_too_old" = "yes" ; then 1814f27aaf4bSChristian Brunner echo "-> Your librados version is too old - upgrade needed to have rbd support" 1815f27aaf4bSChristian Brunner fi 1816f27aaf4bSChristian Brunnerfi 1817f27aaf4bSChristian Brunner 1818f27aaf4bSChristian Brunner########################################## 18195c6c3a6cSChristoph Hellwig# linux-aio probe 18205c6c3a6cSChristoph Hellwig 18215c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 18225c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 18235c6c3a6cSChristoph Hellwig#include <libaio.h> 18245c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 1825832ce9c2SScott Wood#include <stddef.h> 18265c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 18275c6c3a6cSChristoph HellwigEOF 18285c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 18295c6c3a6cSChristoph Hellwig linux_aio=yes 1830048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 1831048d179fSPaul Brook libs_tools="$libs_tools -laio" 18325c6c3a6cSChristoph Hellwig else 18335c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 18345c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 18355c6c3a6cSChristoph Hellwig fi 18363cfcae3cSLuiz Capitulino linux_aio=no 18375c6c3a6cSChristoph Hellwig fi 18385c6c3a6cSChristoph Hellwigfi 18395c6c3a6cSChristoph Hellwig 18405c6c3a6cSChristoph Hellwig########################################## 1841758e8e38SVenkateswararao Jujjuri (JV)# attr probe 1842758e8e38SVenkateswararao Jujjuri (JV) 1843758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 1844758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 1845758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 1846758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 1847758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h> 1848758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 1849758e8e38SVenkateswararao Jujjuri (JV)EOF 1850758e8e38SVenkateswararao Jujjuri (JV) if compile_prog "" "-lattr" ; then 1851758e8e38SVenkateswararao Jujjuri (JV) attr=yes 1852758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 1853758e8e38SVenkateswararao Jujjuri (JV) else 1854758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 1855758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 1856758e8e38SVenkateswararao Jujjuri (JV) fi 1857758e8e38SVenkateswararao Jujjuri (JV) attr=no 1858758e8e38SVenkateswararao Jujjuri (JV) fi 1859758e8e38SVenkateswararao Jujjuri (JV)fi 1860758e8e38SVenkateswararao Jujjuri (JV) 1861758e8e38SVenkateswararao Jujjuri (JV)########################################## 1862bf9298b9Saliguori# iovec probe 1863bf9298b9Saliguoricat > $TMPC <<EOF 1864db34f0b3Sblueswir1#include <sys/types.h> 1865bf9298b9Saliguori#include <sys/uio.h> 1866db34f0b3Sblueswir1#include <unistd.h> 1867bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1868bf9298b9SaliguoriEOF 1869bf9298b9Saliguoriiovec=no 187052166aa0SJuan Quintelaif compile_prog "" "" ; then 1871bf9298b9Saliguori iovec=yes 1872bf9298b9Saliguorifi 1873bf9298b9Saliguori 1874f652e6afSaurel32########################################## 1875ceb42de8Saliguori# preadv probe 1876ceb42de8Saliguoricat > $TMPC <<EOF 1877ceb42de8Saliguori#include <sys/types.h> 1878ceb42de8Saliguori#include <sys/uio.h> 1879ceb42de8Saliguori#include <unistd.h> 1880ceb42de8Saliguoriint main(void) { preadv; } 1881ceb42de8SaliguoriEOF 1882ceb42de8Saliguoripreadv=no 188352166aa0SJuan Quintelaif compile_prog "" "" ; then 1884ceb42de8Saliguori preadv=yes 1885ceb42de8Saliguorifi 1886ceb42de8Saliguori 1887ceb42de8Saliguori########################################## 1888f652e6afSaurel32# fdt probe 18892df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1890b41af4baSJuan Quintela fdt_libs="-lfdt" 1891f652e6afSaurel32 cat > $TMPC << EOF 1892f652e6afSaurel32int main(void) { return 0; } 1893f652e6afSaurel32EOF 189452166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1895f652e6afSaurel32 fdt=yes 1896e4782985SJuan Quintela libs_softmmu="$fdt_libs $libs_softmmu" 18972df87df7SJuan Quintela else 18982df87df7SJuan Quintela if test "$fdt" = "yes" ; then 18992df87df7SJuan Quintela feature_not_found "fdt" 19002df87df7SJuan Quintela fi 19012df87df7SJuan Quintela fdt=no 1902f652e6afSaurel32 fi 1903f652e6afSaurel32fi 1904f652e6afSaurel32 19053b3f24adSaurel32# 19063b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 19073b3f24adSaurel32# emulator. This is done because older glibc versions don't 19083b3f24adSaurel32# have syscall stubs for these implemented. 19093b3f24adSaurel32# 19103b3f24adSaurel32atfile=no 19113b3f24adSaurel32cat > $TMPC << EOF 19123b3f24adSaurel32#define _ATFILE_SOURCE 19133b3f24adSaurel32#include <sys/types.h> 19143b3f24adSaurel32#include <fcntl.h> 19153b3f24adSaurel32#include <unistd.h> 19163b3f24adSaurel32 19173b3f24adSaurel32int 19183b3f24adSaurel32main(void) 19193b3f24adSaurel32{ 19203b3f24adSaurel32 /* try to unlink nonexisting file */ 19213b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 19223b3f24adSaurel32} 19233b3f24adSaurel32EOF 192452166aa0SJuan Quintelaif compile_prog "" "" ; then 19253b3f24adSaurel32 atfile=yes 19263b3f24adSaurel32fi 19273b3f24adSaurel32 192839386ac7Saurel32# Check for inotify functions when we are building linux-user 19293b3f24adSaurel32# emulator. This is done because older glibc versions don't 19303b3f24adSaurel32# have syscall stubs for these implemented. In that case we 19313b3f24adSaurel32# don't provide them even if kernel supports them. 19323b3f24adSaurel32# 19333b3f24adSaurel32inotify=no 19343b3f24adSaurel32cat > $TMPC << EOF 19353b3f24adSaurel32#include <sys/inotify.h> 19363b3f24adSaurel32 19373b3f24adSaurel32int 19383b3f24adSaurel32main(void) 19393b3f24adSaurel32{ 19403b3f24adSaurel32 /* try to start inotify */ 19418690e420Saurel32 return inotify_init(); 19423b3f24adSaurel32} 19433b3f24adSaurel32EOF 194452166aa0SJuan Quintelaif compile_prog "" "" ; then 19453b3f24adSaurel32 inotify=yes 19463b3f24adSaurel32fi 19473b3f24adSaurel32 1948c05c7a73SRiku Voipioinotify1=no 1949c05c7a73SRiku Voipiocat > $TMPC << EOF 1950c05c7a73SRiku Voipio#include <sys/inotify.h> 1951c05c7a73SRiku Voipio 1952c05c7a73SRiku Voipioint 1953c05c7a73SRiku Voipiomain(void) 1954c05c7a73SRiku Voipio{ 1955c05c7a73SRiku Voipio /* try to start inotify */ 1956c05c7a73SRiku Voipio return inotify_init1(0); 1957c05c7a73SRiku Voipio} 1958c05c7a73SRiku VoipioEOF 1959c05c7a73SRiku Voipioif compile_prog "" "" ; then 1960c05c7a73SRiku Voipio inotify1=yes 1961c05c7a73SRiku Voipiofi 1962c05c7a73SRiku Voipio 1963ebc996f3SRiku Voipio# check if utimensat and futimens are supported 1964ebc996f3SRiku Voipioutimens=no 1965ebc996f3SRiku Voipiocat > $TMPC << EOF 1966ebc996f3SRiku Voipio#define _ATFILE_SOURCE 1967ebc996f3SRiku Voipio#include <stddef.h> 1968ebc996f3SRiku Voipio#include <fcntl.h> 1969ebc996f3SRiku Voipio 1970ebc996f3SRiku Voipioint main(void) 1971ebc996f3SRiku Voipio{ 1972ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 1973ebc996f3SRiku Voipio futimens(0, NULL); 1974ebc996f3SRiku Voipio return 0; 1975ebc996f3SRiku Voipio} 1976ebc996f3SRiku VoipioEOF 197752166aa0SJuan Quintelaif compile_prog "" "" ; then 1978ebc996f3SRiku Voipio utimens=yes 1979ebc996f3SRiku Voipiofi 1980ebc996f3SRiku Voipio 1981099d6b0fSRiku Voipio# check if pipe2 is there 1982099d6b0fSRiku Voipiopipe2=no 1983099d6b0fSRiku Voipiocat > $TMPC << EOF 1984099d6b0fSRiku Voipio#include <unistd.h> 1985099d6b0fSRiku Voipio#include <fcntl.h> 1986099d6b0fSRiku Voipio 1987099d6b0fSRiku Voipioint main(void) 1988099d6b0fSRiku Voipio{ 1989099d6b0fSRiku Voipio int pipefd[2]; 1990099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 1991099d6b0fSRiku Voipio return 0; 1992099d6b0fSRiku Voipio} 1993099d6b0fSRiku VoipioEOF 199452166aa0SJuan Quintelaif compile_prog "" "" ; then 1995099d6b0fSRiku Voipio pipe2=yes 1996099d6b0fSRiku Voipiofi 1997099d6b0fSRiku Voipio 199840ff6d7eSKevin Wolf# check if accept4 is there 199940ff6d7eSKevin Wolfaccept4=no 200040ff6d7eSKevin Wolfcat > $TMPC << EOF 200140ff6d7eSKevin Wolf#include <sys/socket.h> 200240ff6d7eSKevin Wolf#include <stddef.h> 200340ff6d7eSKevin Wolf 200440ff6d7eSKevin Wolfint main(void) 200540ff6d7eSKevin Wolf{ 200640ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 200740ff6d7eSKevin Wolf return 0; 200840ff6d7eSKevin Wolf} 200940ff6d7eSKevin WolfEOF 201040ff6d7eSKevin Wolfif compile_prog "" "" ; then 201140ff6d7eSKevin Wolf accept4=yes 201240ff6d7eSKevin Wolffi 201340ff6d7eSKevin Wolf 20143ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 20153ce34dfbSvibisreenivasansplice=no 20163ce34dfbSvibisreenivasancat > $TMPC << EOF 20173ce34dfbSvibisreenivasan#include <unistd.h> 20183ce34dfbSvibisreenivasan#include <fcntl.h> 20193ce34dfbSvibisreenivasan#include <limits.h> 20203ce34dfbSvibisreenivasan 20213ce34dfbSvibisreenivasanint main(void) 20223ce34dfbSvibisreenivasan{ 20233ce34dfbSvibisreenivasan int len, fd; 20243ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 20253ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 20263ce34dfbSvibisreenivasan return 0; 20273ce34dfbSvibisreenivasan} 20283ce34dfbSvibisreenivasanEOF 202952166aa0SJuan Quintelaif compile_prog "" "" ; then 20303ce34dfbSvibisreenivasan splice=yes 20313ce34dfbSvibisreenivasanfi 20323ce34dfbSvibisreenivasan 2033dcc38d1cSMarcelo Tosatti########################################## 2034dcc38d1cSMarcelo Tosatti# signalfd probe 2035dcc38d1cSMarcelo Tosattisignalfd="no" 2036dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2037dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE 2038dcc38d1cSMarcelo Tosatti#include <unistd.h> 2039dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2040dcc38d1cSMarcelo Tosatti#include <signal.h> 2041dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2042dcc38d1cSMarcelo TosattiEOF 2043dcc38d1cSMarcelo Tosatti 2044dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2045dcc38d1cSMarcelo Tosatti signalfd=yes 2046dcc38d1cSMarcelo Tosattifi 2047dcc38d1cSMarcelo Tosatti 2048c2882b96SRiku Voipio# check if eventfd is supported 2049c2882b96SRiku Voipioeventfd=no 2050c2882b96SRiku Voipiocat > $TMPC << EOF 2051c2882b96SRiku Voipio#include <sys/eventfd.h> 2052c2882b96SRiku Voipio 2053c2882b96SRiku Voipioint main(void) 2054c2882b96SRiku Voipio{ 2055c2882b96SRiku Voipio int efd = eventfd(0, 0); 2056c2882b96SRiku Voipio return 0; 2057c2882b96SRiku Voipio} 2058c2882b96SRiku VoipioEOF 2059c2882b96SRiku Voipioif compile_prog "" "" ; then 2060c2882b96SRiku Voipio eventfd=yes 2061c2882b96SRiku Voipiofi 2062c2882b96SRiku Voipio 2063d0927938SUlrich Hecht# check for fallocate 2064d0927938SUlrich Hechtfallocate=no 2065d0927938SUlrich Hechtcat > $TMPC << EOF 2066d0927938SUlrich Hecht#include <fcntl.h> 2067d0927938SUlrich Hecht 2068d0927938SUlrich Hechtint main(void) 2069d0927938SUlrich Hecht{ 2070d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2071d0927938SUlrich Hecht return 0; 2072d0927938SUlrich Hecht} 2073d0927938SUlrich HechtEOF 2074be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2075d0927938SUlrich Hecht fallocate=yes 2076d0927938SUlrich Hechtfi 2077d0927938SUlrich Hecht 2078*c727f47dSPeter Maydell# check for sync_file_range 2079*c727f47dSPeter Maydellsync_file_range=no 2080*c727f47dSPeter Maydellcat > $TMPC << EOF 2081*c727f47dSPeter Maydell#include <fcntl.h> 2082*c727f47dSPeter Maydell 2083*c727f47dSPeter Maydellint main(void) 2084*c727f47dSPeter Maydell{ 2085*c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2086*c727f47dSPeter Maydell return 0; 2087*c727f47dSPeter Maydell} 2088*c727f47dSPeter MaydellEOF 2089*c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2090*c727f47dSPeter Maydell sync_file_range=yes 2091*c727f47dSPeter Maydellfi 2092*c727f47dSPeter Maydell 2093d0927938SUlrich Hecht# check for dup3 2094d0927938SUlrich Hechtdup3=no 2095d0927938SUlrich Hechtcat > $TMPC << EOF 2096d0927938SUlrich Hecht#include <unistd.h> 2097d0927938SUlrich Hecht 2098d0927938SUlrich Hechtint main(void) 2099d0927938SUlrich Hecht{ 2100d0927938SUlrich Hecht dup3(0, 0, 0); 2101d0927938SUlrich Hecht return 0; 2102d0927938SUlrich Hecht} 2103d0927938SUlrich HechtEOF 210478f5d726SJan Kiszkaif compile_prog "" "" ; then 2105d0927938SUlrich Hecht dup3=yes 2106d0927938SUlrich Hechtfi 2107d0927938SUlrich Hecht 2108cc8ae6deSpbrook# Check if tools are available to build documentation. 2109a25dba17SJuan Quintelaif test "$docs" != "no" ; then 211001668d98SStefan Weil if has makeinfo && has pod2man; then 2111a25dba17SJuan Quintela docs=yes 211283a3ab8bSJuan Quintela else 2113a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2114a25dba17SJuan Quintela feature_not_found "docs" 211583a3ab8bSJuan Quintela fi 2116a25dba17SJuan Quintela docs=no 211783a3ab8bSJuan Quintela fi 2118cc8ae6deSpbrookfi 2119cc8ae6deSpbrook 2120f514f41cSStefan Weil# Search for bswap_32 function 21216ae9a1f4SJuan Quintelabyteswap_h=no 21226ae9a1f4SJuan Quintelacat > $TMPC << EOF 21236ae9a1f4SJuan Quintela#include <byteswap.h> 21246ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 21256ae9a1f4SJuan QuintelaEOF 212652166aa0SJuan Quintelaif compile_prog "" "" ; then 21276ae9a1f4SJuan Quintela byteswap_h=yes 21286ae9a1f4SJuan Quintelafi 21296ae9a1f4SJuan Quintela 2130f514f41cSStefan Weil# Search for bswap_32 function 21316ae9a1f4SJuan Quintelabswap_h=no 21326ae9a1f4SJuan Quintelacat > $TMPC << EOF 21336ae9a1f4SJuan Quintela#include <sys/endian.h> 21346ae9a1f4SJuan Quintela#include <sys/types.h> 21356ae9a1f4SJuan Quintela#include <machine/bswap.h> 21366ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 21376ae9a1f4SJuan QuintelaEOF 213852166aa0SJuan Quintelaif compile_prog "" "" ; then 21396ae9a1f4SJuan Quintela bswap_h=yes 21406ae9a1f4SJuan Quintelafi 21416ae9a1f4SJuan Quintela 2142da93a1fdSaliguori########################################## 2143da93a1fdSaliguori# Do we need librt 2144da93a1fdSaliguoricat > $TMPC <<EOF 2145da93a1fdSaliguori#include <signal.h> 2146da93a1fdSaliguori#include <time.h> 2147da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 2148da93a1fdSaliguoriEOF 2149da93a1fdSaliguori 215052166aa0SJuan Quintelaif compile_prog "" "" ; then 215107ffa4bdSJuan Quintela : 215252166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 215307ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2154da93a1fdSaliguorifi 2155da93a1fdSaliguori 215631ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2157179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 21586362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 21596362a53fSJuan Quintelafi 21606362a53fSJuan Quintela 2161de5071c5SBlue Swirl########################################## 2162de5071c5SBlue Swirl# check if the compiler defines offsetof 2163de5071c5SBlue Swirl 2164de5071c5SBlue Swirlneed_offsetof=yes 2165de5071c5SBlue Swirlcat > $TMPC << EOF 2166de5071c5SBlue Swirl#include <stddef.h> 2167de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2168de5071c5SBlue SwirlEOF 2169de5071c5SBlue Swirlif compile_prog "" "" ; then 2170de5071c5SBlue Swirl need_offsetof=no 2171de5071c5SBlue Swirlfi 2172de5071c5SBlue Swirl 21735f6b9e8fSBlue Swirl########################################## 2174747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 2175747bbdf7SBlue Swirl# 2176747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 2177747bbdf7SBlue Swirl# about attribute warn_unused_result 2178747bbdf7SBlue Swirl 2179747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 2180747bbdf7SBlue Swirlcat > $TMPC << EOF 2181747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 2182747bbdf7SBlue Swirl#error gcc 3.3 or older 2183747bbdf7SBlue Swirl#endif 2184747bbdf7SBlue Swirlint main(void) { return 0;} 2185747bbdf7SBlue SwirlEOF 2186747bbdf7SBlue Swirlif compile_prog "" ""; then 2187747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 2188747bbdf7SBlue Swirlfi 2189747bbdf7SBlue Swirl 2190cd4ec0b4SGerd Hoffmann# spice probe 2191cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2192cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2193cd4ec0b4SGerd Hoffmann#include <spice.h> 2194cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2195cd4ec0b4SGerd HoffmannEOF 2196cd4ec0b4SGerd Hoffmann spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null) 2197cd4ec0b4SGerd Hoffmann spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null) 2198ba807829SStefan Weil if $pkgconfig --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \ 2199cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2200cd4ec0b4SGerd Hoffmann spice="yes" 2201cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2202cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2203cd4ec0b4SGerd Hoffmann else 2204cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2205cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2206cd4ec0b4SGerd Hoffmann fi 2207cd4ec0b4SGerd Hoffmann spice="no" 2208cd4ec0b4SGerd Hoffmann fi 2209cd4ec0b4SGerd Hoffmannfi 2210cd4ec0b4SGerd Hoffmann 2211cd4ec0b4SGerd Hoffmann########################################## 2212cd4ec0b4SGerd Hoffmann 2213747bbdf7SBlue Swirl########################################## 22145f6b9e8fSBlue Swirl# check if we have fdatasync 22155f6b9e8fSBlue Swirl 22165f6b9e8fSBlue Swirlfdatasync=no 22175f6b9e8fSBlue Swirlcat > $TMPC << EOF 22185f6b9e8fSBlue Swirl#include <unistd.h> 22195f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); } 22205f6b9e8fSBlue SwirlEOF 22215f6b9e8fSBlue Swirlif compile_prog "" "" ; then 22225f6b9e8fSBlue Swirl fdatasync=yes 22235f6b9e8fSBlue Swirlfi 22245f6b9e8fSBlue Swirl 222594a420b1SStefan Hajnoczi########################################## 2226e78815a5SAndreas Färber# check if we have madvise 2227e78815a5SAndreas Färber 2228e78815a5SAndreas Färbermadvise=no 2229e78815a5SAndreas Färbercat > $TMPC << EOF 2230e78815a5SAndreas Färber#include <sys/types.h> 2231e78815a5SAndreas Färber#include <sys/mman.h> 2232832ce9c2SScott Wood#include <stddef.h> 2233e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2234e78815a5SAndreas FärberEOF 2235e78815a5SAndreas Färberif compile_prog "" "" ; then 2236e78815a5SAndreas Färber madvise=yes 2237e78815a5SAndreas Färberfi 2238e78815a5SAndreas Färber 2239e78815a5SAndreas Färber########################################## 2240e78815a5SAndreas Färber# check if we have posix_madvise 2241e78815a5SAndreas Färber 2242e78815a5SAndreas Färberposix_madvise=no 2243e78815a5SAndreas Färbercat > $TMPC << EOF 2244e78815a5SAndreas Färber#include <sys/mman.h> 2245832ce9c2SScott Wood#include <stddef.h> 2246e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2247e78815a5SAndreas FärberEOF 2248e78815a5SAndreas Färberif compile_prog "" "" ; then 2249e78815a5SAndreas Färber posix_madvise=yes 2250e78815a5SAndreas Färberfi 2251e78815a5SAndreas Färber 2252e78815a5SAndreas Färber########################################## 225394a420b1SStefan Hajnoczi# check if trace backend exists 225494a420b1SStefan Hajnoczi 225594a420b1SStefan Hajnoczish "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 225694a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 225794a420b1SStefan Hajnoczi echo 225894a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 225994a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 226094a420b1SStefan Hajnoczi echo 226194a420b1SStefan Hajnoczi exit 1 226294a420b1SStefan Hajnoczifi 226394a420b1SStefan Hajnoczi 22647e24e92aSStefan Hajnoczi########################################## 22657e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 22667e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 22677e24e92aSStefan Hajnoczi cat > $TMPC << EOF 22687e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 22697e24e92aSStefan Hajnoczi#include <ust/marker.h> 22707e24e92aSStefan Hajnocziint main(void) { return 0; } 22717e24e92aSStefan HajnocziEOF 22727e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 22737e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 22747e24e92aSStefan Hajnoczi else 22757e24e92aSStefan Hajnoczi echo 22767e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 22777e24e92aSStefan Hajnoczi echo 22787e24e92aSStefan Hajnoczi exit 1 22797e24e92aSStefan Hajnoczi fi 22807e24e92aSStefan Hajnoczifi 2281b3d08c02SDaniel P. Berrange 2282b3d08c02SDaniel P. Berrange########################################## 2283b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2284b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2285b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2286b3d08c02SDaniel P. Berrange echo 2287b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2288b3d08c02SDaniel P. Berrange echo 2289b3d08c02SDaniel P. Berrange exit 1 2290b3d08c02SDaniel P. Berrange fi 2291c276b17dSDaniel P. Berrange trace_backend_stap="no" 2292c276b17dSDaniel P. Berrange if has 'stap' ; then 2293c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2294c276b17dSDaniel P. Berrange fi 2295b3d08c02SDaniel P. Berrangefi 2296b3d08c02SDaniel P. Berrange 22977e24e92aSStefan Hajnoczi########################################## 2298e86ecd4bSJuan Quintela# End of CC checks 2299e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2300e86ecd4bSJuan Quintela 2301e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 23021156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2303e86ecd4bSJuan Quintelafi 2304a316e378SJuan Quintela 2305e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2306e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2307e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 230820ff6c80SAnthony Liguori 230920ff6c80SAnthony Liguoriif test -z "$werror" ; then 2310e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2311e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2312e86ecd4bSJuan Quintela werror="yes" 2313e86ecd4bSJuan Quintela else 2314e86ecd4bSJuan Quintela werror="no" 2315e86ecd4bSJuan Quintela fi 2316e86ecd4bSJuan Quintelafi 2317e86ecd4bSJuan Quintela 231820ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 231920ff6c80SAnthony Liguori# enable/disable 232020ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 232120ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 232220ff6c80SAnthony Liguori zero_malloc="no" 232320ff6c80SAnthony Liguori else 232420ff6c80SAnthony Liguori zero_malloc="yes" 232520ff6c80SAnthony Liguori fi 232620ff6c80SAnthony Liguorifi 232720ff6c80SAnthony Liguori 2328e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2329a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2330e86ecd4bSJuan Quintelafi 2331e86ecd4bSJuan Quintela 2332e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2333e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 23341156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2335e86ecd4bSJuan Quintela fi 2336e86ecd4bSJuan Quintelafi 2337e86ecd4bSJuan Quintela 2338952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2339952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2340952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2341952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2342952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2343952afb71SBlue Swirl fi 2344952afb71SBlue Swirl done 2345952afb71SBlue Swirlfi 2346952afb71SBlue Swirl 2347190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 23485a67135aSbellard 2349ca35f780SPaolo Bonzinitools= 2350ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2351ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2352ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2353ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2354ca35f780SPaolo Bonzini if [ "$check_utests" = "yes" ]; then 2355ca35f780SPaolo Bonzini tools="check-qint check-qstring check-qdict check-qlist $tools" 2356ca35f780SPaolo Bonzini tools="check-qfloat check-qjson $tools" 2357ca35f780SPaolo Bonzini fi 2358ca35f780SPaolo Bonzini fi 2359ca35f780SPaolo Bonzinifi 2360ca35f780SPaolo Bonzini 2361ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2362ca35f780SPaolo Bonziniroms= 2363ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2364ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2365ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2366ca35f780SPaolo Bonzini roms="optionrom" 2367ca35f780SPaolo Bonzinifi 2368ca35f780SPaolo Bonzini 2369ca35f780SPaolo Bonzini 23707d13299dSbellardecho "Install prefix $prefix" 2371f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2372f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 23731c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 237411d9f695Sbellardif test "$mingw32" = "no" ; then 2375f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 237643ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 237711d9f695Sbellardfi 23785a67135aSbellardecho "Source path $source_path" 23797d13299dSbellardecho "C compiler $cc" 238083469015Sbellardecho "Host C compiler $host_cc" 23810c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2382a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 23830c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 23847d13299dSbellardecho "make $make" 23856a882643Spbrookecho "install $install" 2386a98fd896Sbellardecho "host CPU $cpu" 2387de83cd02Sbellardecho "host big endian $bigendian" 238897a847bcSbellardecho "target list $target_list" 2389ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2390b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 23917d13299dSbellardecho "gprof enabled $gprof" 239203b4fe7dSaliguoriecho "sparse enabled $sparse" 23931625af87Saliguoriecho "strip binaries $strip_opt" 239405c2a3e7Sbellardecho "profiler $profiler" 239543ce4dfeSbellardecho "static build $static" 239685aa5189Sbellardecho "-Werror enabled $werror" 23975b0753e0Sbellardif test "$darwin" = "yes" ; then 23985b0753e0Sbellard echo "Cocoa support $cocoa" 23995b0753e0Sbellardfi 240097a847bcSbellardecho "SDL support $sdl" 24014d3b6f6eSbalrogecho "curses support $curses" 2402769ce76dSAlexander Grafecho "curl support $curl" 24035495ed11SLuiz Capitulinoecho "check support $check_utests" 240467b915a5Sbellardecho "mingw32 support $mingw32" 24050c58ac1cSmalcecho "Audio drivers $audio_drv_list" 24060c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2407eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 24088ff9cbf7Smalcecho "Mixer emulation $mixemu" 24098d5d2d4cSthsecho "VNC TLS support $vnc_tls" 24102f9606b3Saliguoriecho "VNC SASL support $vnc_sasl" 24112f6f5c7aSCorentin Charyecho "VNC JPEG support $vnc_jpeg" 2412efe556adSCorentin Charyecho "VNC PNG support $vnc_png" 2413bd023f95SCorentin Charyecho "VNC thread $vnc_thread" 24143142255cSblueswir1if test -n "$sparc_cpu"; then 24153142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 24163142255cSblueswir1fi 2417e37630caSaliguoriecho "xen support $xen" 24182e4d9fb1Saurel32echo "brlapi support $brlapi" 2419a20a6f46SJuan Quintelaecho "bluez support $bluez" 2420a25dba17SJuan Quintelaecho "Documentation $docs" 2421c5937220Spbrook[ ! -z "$uname_release" ] && \ 2422c5937220Spbrookecho "uname -r $uname_release" 2423bd0c5661Spbrookecho "NPTL support $nptl" 2424379f6698SPaul Brookecho "GUEST_BASE $guest_base" 242534005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 24268a16d273Sthsecho "vde support $vde" 2427e5d355d1Saliguoriecho "IO thread $io_thread" 24285c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2429758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 243077755340Sthsecho "Install blobs $blobs" 2431b31a0277SJuan Quintelaecho "KVM support $kvm" 2432f652e6afSaurel32echo "fdt support $fdt" 2433ceb42de8Saliguoriecho "preadv support $preadv" 24345f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2435e78815a5SAndreas Färberecho "madvise $madvise" 2436e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2437ee682d27SStefan Weilecho "uuid support $uuid" 2438d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 243994a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 24409410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2441cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2442f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2443dce512deSChristoph Hellwigecho "xfsctl support $xfs" 244467b915a5Sbellard 244597a847bcSbellardif test $sdl_too_old = "yes"; then 244624b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2447e8cd23deSbellardfi 244897a847bcSbellard 244998ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 24504bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 245197a847bcSbellard 245298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 245398ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 245498ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 245598ec69acSJuan Quintelaecho >> $config_host_mak 245698ec69acSJuan Quintela 2457e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 245899d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 245999d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 246099d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 246199d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 246299d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 246399d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 24641dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2465804edf29SJuan Quintela 24662408a527Saurel32case "$cpu" in 246724e804ecSAlexander Graf i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 2468e0da9dd3SJuan Quintela ARCH=$cpu 24692408a527Saurel32 ;; 2470a302c32dSLaurent Desnogues armv4b|armv4l) 247116dbd14fSJuan Quintela ARCH=arm 24722408a527Saurel32 ;; 24732408a527Saurel32esac 247498ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2475f8393946Saurel32if test "$debug_tcg" = "yes" ; then 24762358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2477f8393946Saurel32fi 2478b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2479b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2480b4475aa2SLuiz Capitulinofi 2481f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 24822358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2483f3d08ee6SPaul Brookfi 24841625af87Saliguoriif test "$strip_opt" = "yes" ; then 248552ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 24861625af87Saliguorifi 24877d13299dSbellardif test "$bigendian" = "yes" ; then 2488e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 248997a847bcSbellardfi 24902358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 249167b915a5Sbellardif test "$mingw32" = "yes" ; then 249298ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 24939fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 24949fe6de94SBlue Swirl version_major=${rc_version%%.*} 24959fe6de94SBlue Swirl rc_version=${rc_version#*.} 24969fe6de94SBlue Swirl version_minor=${rc_version%%.*} 24979fe6de94SBlue Swirl rc_version=${rc_version#*.} 24989fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 24999fe6de94SBlue Swirl version_micro=0 25009fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 25019fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2502210fa556Spbrookelse 250335f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2504210fa556Spbrookfi 2505128ab2ffSblueswir1 2506dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2507dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2508dffcb71cSMark McLoughlinfi 2509dffcb71cSMark McLoughlin 251083fb7adfSbellardif test "$darwin" = "yes" ; then 251198ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 251283fb7adfSbellardfi 2513b29fe3edSmalc 2514b29fe3edSmalcif test "$aix" = "yes" ; then 251598ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2516b29fe3edSmalcfi 2517b29fe3edSmalc 2518ec530c81Sbellardif test "$solaris" = "yes" ; then 251998ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 25202358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 25210475a5caSths if test "$needs_libsunmath" = "yes" ; then 252275b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 25230475a5caSths fi 2524ec530c81Sbellardfi 2525179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2526179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2527179cf400SAndreas Färberfi 252897a847bcSbellardif test "$static" = "yes" ; then 252998ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 253097a847bcSbellardfi 253105c2a3e7Sbellardif test $profiler = "yes" ; then 25322358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 253305c2a3e7Sbellardfi 2534c20709aaSbellardif test "$slirp" = "yes" ; then 253598ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2536b6e31c12SJuan Quintela QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS" 2537c20709aaSbellardfi 25388a16d273Sthsif test "$vde" = "yes" ; then 253998ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 25408a16d273Sthsfi 25410c58ac1cSmalcfor card in $audio_card_list; do 2542f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 254398ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 25440c58ac1cSmalcdone 25452358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 25460c58ac1cSmalcfor drv in $audio_drv_list; do 2547f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 254898ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2549923e4521Smalc if test "$drv" = "fmod"; then 25507aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2551fb065187Sbellard fi 25520c58ac1cSmalcdone 255367f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 255467f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 255567f86e8eSJuan Quintelafi 2556d5631638Smalcif test "$audio_win_int" = "yes" ; then 2557d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2558d5631638Smalcfi 2559eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 25608ff9cbf7Smalcif test "$mixemu" = "yes" ; then 256198ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 25628ff9cbf7Smalcfi 25638d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 256498ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2565525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 25668d5d2d4cSthsfi 25672f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 256898ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 256960ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 25702f9606b3Saliguorifi 257196763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then 25722f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 25732f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 25742f6f5c7aSCorentin Charyfi 257596763cf9SCorentin Charyif test "$vnc_png" != "no" ; then 2576efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 2577efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 2578efe556adSCorentin Charyfi 257996763cf9SCorentin Charyif test "$vnc_thread" != "no" ; then 2580bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 2581bd023f95SCorentin Chary echo "CONFIG_THREAD=y" >> $config_host_mak 2582bd023f95SCorentin Charyfi 258376655d6dSaliguoriif test "$fnmatch" = "yes" ; then 25842358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 258576655d6dSaliguorifi 2586ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2587ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2588ee682d27SStefan Weilfi 2589dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 2590dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 2591dce512deSChristoph Hellwigfi 2592b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 259398ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 25942358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 259598ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 259698ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2597a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 259898ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2599cc8ae6deSpbrookfi 26001ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 260198ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 26028ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 260349ecc3faSbellardfi 260449ecc3faSbellardif test "$cocoa" = "yes" ; then 260598ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 260649ecc3faSbellardfi 26074d3b6f6eSbalrogif test "$curses" = "yes" ; then 260898ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2609ab4e5602SJan Kiszkafi 26103b3f24adSaurel32if test "$atfile" = "yes" ; then 26112358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 26123b3f24adSaurel32fi 2613ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 26142358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2615ebc996f3SRiku Voipiofi 2616099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 26172358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2618099d6b0fSRiku Voipiofi 261940ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 262040ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 262140ff6d7eSKevin Wolffi 26223ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 26232358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 26243ce34dfbSvibisreenivasanfi 2625c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2626c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2627c2882b96SRiku Voipiofi 2628d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2629d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2630d0927938SUlrich Hechtfi 2631*c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 2632*c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 2633*c727f47dSPeter Maydellfi 2634d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2635d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2636d0927938SUlrich Hechtfi 26373b3f24adSaurel32if test "$inotify" = "yes" ; then 26382358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 26393b3f24adSaurel32fi 2640c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2641c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2642c05c7a73SRiku Voipiofi 26436ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 26446ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 26456ae9a1f4SJuan Quintelafi 26466ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 26476ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 26486ae9a1f4SJuan Quintelafi 2649769ce76dSAlexander Grafif test "$curl" = "yes" ; then 265098ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2651b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2652769ce76dSAlexander Graffi 26532e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 265498ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 26552e4d9fb1Saurel32fi 2656fb599c9aSbalrogif test "$bluez" = "yes" ; then 265798ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2658ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2659fb599c9aSbalrogfi 2660e37630caSaliguoriif test "$xen" = "yes" ; then 26615647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2662e37630caSaliguorifi 2663e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 266498ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2665bd023f95SCorentin Chary echo "CONFIG_THREAD=y" >> $config_host_mak 2666e5d355d1Saliguorifi 26675c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 26685c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 26695c6c3a6cSChristoph Hellwigfi 2670758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 2671758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 2672758e8e38SVenkateswararao Jujjuri (JV)fi 2673758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 2674758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2675758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 2676758e8e38SVenkateswararao Jujjuri (JV) fi 2677758e8e38SVenkateswararao Jujjuri (JV)fi 267877755340Sthsif test "$blobs" = "yes" ; then 267998ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 268077755340Sthsfi 2681bf9298b9Saliguoriif test "$iovec" = "yes" ; then 26822358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2683bf9298b9Saliguorifi 2684ceb42de8Saliguoriif test "$preadv" = "yes" ; then 26852358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2686ceb42de8Saliguorifi 2687f652e6afSaurel32if test "$fdt" = "yes" ; then 26883f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2689f652e6afSaurel32fi 2690dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 2691dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 2692dcc38d1cSMarcelo Tosattifi 2693de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2694de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2695de5071c5SBlue Swirlfi 2696747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2697747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2698747bbdf7SBlue Swirlfi 26995f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 27005f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 27015f6b9e8fSBlue Swirlfi 2702e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 2703e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 2704e78815a5SAndreas Färberfi 2705e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 2706e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 2707e78815a5SAndreas Färberfi 270897a847bcSbellard 2709cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 2710cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 2711cd4ec0b4SGerd Hoffmannfi 2712cd4ec0b4SGerd Hoffmann 271383fb7adfSbellard# XXX: suppress that 27147d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 27152358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 27167d3505c5Sbellardfi 27177d3505c5Sbellard 27182358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2719c5937220Spbrook 272020ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 272120ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 272220ff6c80SAnthony Liguorifi 2723f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 2724f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 2725f27aaf4bSChristian Brunnerfi 272620ff6c80SAnthony Liguori 272768063649Sblueswir1# USB host support 272868063649Sblueswir1case "$usb" in 272968063649Sblueswir1linux) 273098ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 273168063649Sblueswir1;; 273268063649Sblueswir1bsd) 273398ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 273468063649Sblueswir1;; 273568063649Sblueswir1*) 273698ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 273768063649Sblueswir1;; 273868063649Sblueswir1esac 273968063649Sblueswir1 274094a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 274122890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then 274222890ab5SPrerna Saxena echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak 274322890ab5SPrerna Saxenafi 27449410b56cSPrerna Saxena# Set the appropriate trace file. 27459410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 27469410b56cSPrerna Saxena trace_file="\"$trace_file-%u\"" 27479410b56cSPrerna Saxenafi 2748c276b17dSDaniel P. Berrangeif test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then 2749c276b17dSDaniel P. Berrange echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak 2750c276b17dSDaniel P. Berrangefi 27519410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 27529410b56cSPrerna Saxena 275398ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 275498ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2755804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2756804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2757804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2758804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2759804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2760804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 27612b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 2762804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2763804edf29SJuan Quintelaif test "$sparse" = "yes" ; then 2764804edf29SJuan Quintela echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2765804edf29SJuan Quintela echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2766a558ee17SJuan Quintela echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2767804edf29SJuan Quintelafi 2768804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2769804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2770804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 27719fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 2772e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2773a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2774c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2775e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2776a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2777a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 277873da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 27793e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2780804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2781804edf29SJuan Quintela 27824bf6b55bSJuan Quintela# generate list of library paths for linker script 27834bf6b55bSJuan Quintela 27844bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 27854bf6b55bSJuan Quintela 27864bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 27874bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 27884bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 27894bf6b55bSJuan Quintela else 27904bf6b55bSJuan Quintela rm ${config_host_ld}~ 27914bf6b55bSJuan Quintela fi 27924bf6b55bSJuan Quintelafi 27934bf6b55bSJuan Quintela 27944d904533SBlue Swirlfor d in libdis libdis-user; do 27954d904533SBlue Swirl mkdir -p $d 27964d904533SBlue Swirl rm -f $d/Makefile 27974d904533SBlue Swirl ln -s $source_path/Makefile.dis $d/Makefile 27984d904533SBlue Swirl echo > $d/config.mak 27994d904533SBlue Swirldone 2800d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then 2801d44cff22SRichard Henderson echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak 2802d44cff22SRichard Hendersonfi 28034d904533SBlue Swirl 280497a847bcSbellardfor target in $target_list; do 280597a847bcSbellardtarget_dir="$target" 280625be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 2807600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 280897a847bcSbellardtarget_bigendian="no" 28091f3d3c8fSJuan Quintela 2810ea2d6a39SJuan Quintelacase "$target_arch2" in 281124e804ecSAlexander Graf armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 2812ea2d6a39SJuan Quintela target_bigendian=yes 2813ea2d6a39SJuan Quintela ;; 2814ea2d6a39SJuan Quintelaesac 281597a847bcSbellardtarget_softmmu="no" 2816997344f3Sbellardtarget_user_only="no" 2817831b7825Sthstarget_linux_user="no" 2818831b7825Sthstarget_darwin_user="no" 281984778508Sblueswir1target_bsd_user="no" 28209e407a85Spbrookcase "$target" in 2821600309b6SBlue Swirl ${target_arch2}-softmmu) 28229e407a85Spbrook target_softmmu="yes" 28239e407a85Spbrook ;; 2824600309b6SBlue Swirl ${target_arch2}-linux-user) 28259c7a4202SBlue Swirl if test "$linux" != "yes" ; then 28269c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 28279c7a4202SBlue Swirl exit 1 28289c7a4202SBlue Swirl fi 28299e407a85Spbrook target_user_only="yes" 28309e407a85Spbrook target_linux_user="yes" 28319e407a85Spbrook ;; 2832600309b6SBlue Swirl ${target_arch2}-darwin-user) 28339c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 28349c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 28359c7a4202SBlue Swirl exit 1 28369c7a4202SBlue Swirl fi 28379e407a85Spbrook target_user_only="yes" 2838831b7825Sths target_darwin_user="yes" 28399e407a85Spbrook ;; 2840600309b6SBlue Swirl ${target_arch2}-bsd-user) 28419cf55765SBlue Swirl if test "$bsd" != "yes" ; then 28429c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 28439c7a4202SBlue Swirl exit 1 28449c7a4202SBlue Swirl fi 284584778508Sblueswir1 target_user_only="yes" 284684778508Sblueswir1 target_bsd_user="yes" 284784778508Sblueswir1 ;; 28489e407a85Spbrook *) 28499e407a85Spbrook echo "ERROR: Target '$target' not recognised" 28509e407a85Spbrook exit 1 28519e407a85Spbrook ;; 28529e407a85Spbrookesac 2853831b7825Sths 285497a847bcSbellardmkdir -p $target_dir 2855158142c2Sbellardmkdir -p $target_dir/fpu 285657fec1feSbellardmkdir -p $target_dir/tcg 285759f2a787SGerd Hoffmannmkdir -p $target_dir/ide 285884778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 285969de927cSbellard mkdir -p $target_dir/nwfpe 286069de927cSbellardfi 286169de927cSbellard 2862ec530c81Sbellard# 2863ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link 2864ec530c81Sbellard# 2865ec530c81Sbellardrm -f $target_dir/Makefile 2866ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile 2867ec530c81Sbellard 286897a847bcSbellard 286925be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 287097a847bcSbellard 2871e5fe0c52Spbrookbflt="no" 2872bd0c5661Spbrooktarget_nptl="no" 2873600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 28747ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 287556aebc89Spbrookgdb_xml_files="" 28767ba1e619Saliguori 2877938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 28786acff7daSJuan QuintelaTARGET_BASE_ARCH="" 2879e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 2880e73aae67SJuan Quintela 2881600309b6SBlue Swirlcase "$target_arch2" in 28822408a527Saurel32 i386) 28831ad2134fSPaul Brook target_phys_bits=32 28842408a527Saurel32 ;; 28852408a527Saurel32 x86_64) 28866acff7daSJuan Quintela TARGET_BASE_ARCH=i386 28871ad2134fSPaul Brook target_phys_bits=64 28882408a527Saurel32 ;; 28892408a527Saurel32 alpha) 28901ad2134fSPaul Brook target_phys_bits=64 2891a4b388ffSRichard Henderson target_nptl="yes" 28922408a527Saurel32 ;; 28932408a527Saurel32 arm|armeb) 2894b498c8a0SJuan Quintela TARGET_ARCH=arm 2895e5fe0c52Spbrook bflt="yes" 2896bd0c5661Spbrook target_nptl="yes" 289756aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 28981ad2134fSPaul Brook target_phys_bits=32 28992408a527Saurel32 ;; 29002408a527Saurel32 cris) 2901253bd7f8Sedgar_igl target_nptl="yes" 29021ad2134fSPaul Brook target_phys_bits=32 29032408a527Saurel32 ;; 29042408a527Saurel32 m68k) 29050938cda5Saurel32 bflt="yes" 290656aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 29071ad2134fSPaul Brook target_phys_bits=32 29082408a527Saurel32 ;; 290972b675caSEdgar E. Iglesias microblaze) 291072b675caSEdgar E. Iglesias bflt="yes" 291172b675caSEdgar E. Iglesias target_nptl="yes" 291272b675caSEdgar E. Iglesias target_phys_bits=32 291372b675caSEdgar E. Iglesias ;; 29142408a527Saurel32 mips|mipsel) 2915b498c8a0SJuan Quintela TARGET_ARCH=mips 291625be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 2917f04dc72fSPaul Brook target_nptl="yes" 29181ad2134fSPaul Brook target_phys_bits=64 29192408a527Saurel32 ;; 29202408a527Saurel32 mipsn32|mipsn32el) 2921b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 29226acff7daSJuan Quintela TARGET_BASE_ARCH=mips 292325be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 29241ad2134fSPaul Brook target_phys_bits=64 29252408a527Saurel32 ;; 29262408a527Saurel32 mips64|mips64el) 2927b498c8a0SJuan Quintela TARGET_ARCH=mips64 29286acff7daSJuan Quintela TARGET_BASE_ARCH=mips 292925be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 29301ad2134fSPaul Brook target_phys_bits=64 29312408a527Saurel32 ;; 29322408a527Saurel32 ppc) 2933c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 29341ad2134fSPaul Brook target_phys_bits=32 2935d6630708SNathan Froyd target_nptl="yes" 29362408a527Saurel32 ;; 29372408a527Saurel32 ppcemb) 29386acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2939e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2940c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 29411ad2134fSPaul Brook target_phys_bits=64 2942d6630708SNathan Froyd target_nptl="yes" 29432408a527Saurel32 ;; 29442408a527Saurel32 ppc64) 29456acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2946e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2947c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 29481ad2134fSPaul Brook target_phys_bits=64 29492408a527Saurel32 ;; 29502408a527Saurel32 ppc64abi32) 2951b498c8a0SJuan Quintela TARGET_ARCH=ppc64 29526acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2953e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 295425be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 2955c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 29561ad2134fSPaul Brook target_phys_bits=64 29572408a527Saurel32 ;; 29582408a527Saurel32 sh4|sh4eb) 2959b498c8a0SJuan Quintela TARGET_ARCH=sh4 29604dbed897Spbrook bflt="yes" 29610b6d3ae0Saurel32 target_nptl="yes" 29621ad2134fSPaul Brook target_phys_bits=32 29632408a527Saurel32 ;; 29642408a527Saurel32 sparc) 29651ad2134fSPaul Brook target_phys_bits=64 29662408a527Saurel32 ;; 29672408a527Saurel32 sparc64) 29686acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 29691ad2134fSPaul Brook target_phys_bits=64 29702408a527Saurel32 ;; 29712408a527Saurel32 sparc32plus) 2972b498c8a0SJuan Quintela TARGET_ARCH=sparc64 29736acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 2974e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 297525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 29761ad2134fSPaul Brook target_phys_bits=64 29772408a527Saurel32 ;; 297824e804ecSAlexander Graf s390x) 297924e804ecSAlexander Graf target_phys_bits=64 298024e804ecSAlexander Graf ;; 29812408a527Saurel32 *) 2982de83cd02Sbellard echo "Unsupported target CPU" 2983de83cd02Sbellard exit 1 29842408a527Saurel32 ;; 29852408a527Saurel32esac 298625be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 2987053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 298825be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 298925be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 299042bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 29916acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 29926acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 29936acff7daSJuan Quintelafi 299425be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 2995e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 2996e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 2997e6e91b9cSJuan Quintelafi 299825be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 29991b0c87fcSJuan Quintelacase "$target_arch2" in 30001b0c87fcSJuan Quintela i386|x86_64) 30011b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 300225be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 30031b0c87fcSJuan Quintela fi 30041b0c87fcSJuan Quintelaesac 3005c59249f9SJuan Quintelacase "$target_arch2" in 30060e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3007c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3008c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3009c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3010c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 30115f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3012c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3013c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 301425be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 301525be210fSJuan Quintela echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak 3016dae5079aSJan Kiszka if test "$kvm_para" = "yes"; then 3017dae5079aSJan Kiszka echo "CONFIG_KVM_PARA=y" >> $config_target_mak 3018dae5079aSJan Kiszka fi 3019d5970055SMichael S. Tsirkin if test $vhost_net = "yes" ; then 3020d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3021d5970055SMichael S. Tsirkin fi 3022c59249f9SJuan Quintela fi 3023c59249f9SJuan Quintelaesac 3024de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 302525be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 302697a847bcSbellardfi 302797a847bcSbellardif test "$target_softmmu" = "yes" ; then 3028b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 302925be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 303025be210fSJuan Quintela echo "LIBS+=$libs_softmmu" >> $config_target_mak 30310e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 30325791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3033de83cd02Sbellardfi 3034997344f3Sbellardif test "$target_user_only" = "yes" ; then 303525be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3036997344f3Sbellardfi 3037831b7825Sthsif test "$target_linux_user" = "yes" ; then 303825be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3039831b7825Sthsfi 3040831b7825Sthsif test "$target_darwin_user" = "yes" ; then 304125be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3042831b7825Sthsfi 304356aebc89Spbrooklist="" 304456aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 304556aebc89Spbrook for x in $gdb_xml_files; do 304656aebc89Spbrook list="$list $source_path/gdb-xml/$x" 304756aebc89Spbrook done 304825be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 30493d0f1517SJuan Quintelafi 3050de83cd02Sbellard 3051f57975fbSJuan Quintelacase "$target_arch2" in 3052990b3e19SRichard Henderson alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus) 305325be210fSJuan Quintela echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak 3054f57975fbSJuan Quintela ;; 3055d6b38939SJuan Quintela *) 305625be210fSJuan Quintela echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak 3057d6b38939SJuan Quintela ;; 3058f57975fbSJuan Quintelaesac 3059f57975fbSJuan Quintela 3060e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 306125be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3062e5fe0c52Spbrookfi 3063bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3064bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 306525be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3066bd0c5661Spbrookfi 3067379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 306825be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3069379f6698SPaul Brookfi 307084778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 307125be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 307284778508Sblueswir1fi 30735b0753e0Sbellard 30744afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3075fa282484SJuan Quintela 30764afddb55SJuan Quintelacflags="" 3077fa282484SJuan Quintelaldflags="" 30789b8e111fSJuan Quintela 307957ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 308057ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/sparc $cflags" 308124e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 308224e804ecSAlexander Graf cflags="-I\$(SRC_PATH)/tcg/s390 $cflags" 30835d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 30845d8a4f8fSRichard Henderson cflags="-I\$(SRC_PATH)/tcg/i386 $cflags" 308557ddfbf7SJuan Quintelaelse 308657ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags" 308757ddfbf7SJuan Quintelafi 308857ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags" 308957ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags" 309057ddfbf7SJuan Quintela 30914d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 30924d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 30934d904533SBlue Swirlelse 30944d904533SBlue Swirl libdis_config_mak=libdis/config.mak 30954d904533SBlue Swirlfi 30964d904533SBlue Swirl 309764656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 309864656024SJuan Quintela case "$i" in 309964656024SJuan Quintela alpha) 310025be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 31014d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 310264656024SJuan Quintela ;; 310364656024SJuan Quintela arm) 310425be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 31054d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 310664656024SJuan Quintela ;; 310764656024SJuan Quintela cris) 310825be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 31094d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 311064656024SJuan Quintela ;; 311164656024SJuan Quintela hppa) 311225be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 31134d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 311464656024SJuan Quintela ;; 311564656024SJuan Quintela i386|x86_64) 311625be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 31174d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 311864656024SJuan Quintela ;; 3119903ec55cSAurelien Jarno ia64*) 3120903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3121903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3122903ec55cSAurelien Jarno ;; 312364656024SJuan Quintela m68k) 312425be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 31254d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 312664656024SJuan Quintela ;; 312764656024SJuan Quintela microblaze) 312825be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 31294d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 313064656024SJuan Quintela ;; 313164656024SJuan Quintela mips*) 313225be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 31334d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 313464656024SJuan Quintela ;; 313564656024SJuan Quintela ppc*) 313625be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 31374d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 313864656024SJuan Quintela ;; 313924e804ecSAlexander Graf s390*) 314025be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 31414d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 314264656024SJuan Quintela ;; 314364656024SJuan Quintela sh4) 314425be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 31454d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 314664656024SJuan Quintela ;; 314764656024SJuan Quintela sparc*) 314825be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 31494d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 315064656024SJuan Quintela ;; 315164656024SJuan Quintela esac 315264656024SJuan Quinteladone 315364656024SJuan Quintela 31546ee7126fSJuan Quintelacase "$ARCH" in 31556ee7126fSJuan Quintelaalpha) 31566ee7126fSJuan Quintela # Ensure there's only a single GP 31576ee7126fSJuan Quintela cflags="-msmall-data $cflags" 31586ee7126fSJuan Quintela;; 31596ee7126fSJuan Quintelaesac 31606ee7126fSJuan Quintela 316155d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 316255d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 316355d9c04bSJuan Quintela arm) 316455d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 316555d9c04bSJuan Quintela ;; 316655d9c04bSJuan Quintela i386|mips|ppc) 316755d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 316855d9c04bSJuan Quintela ;; 316955d9c04bSJuan Quintela esac 317055d9c04bSJuan Quintelafi 317155d9c04bSJuan Quintela 317234005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 317334005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 317434005a00SKirill A. Shutemov cflags="-fpie $cflags" 317534005a00SKirill A. Shutemov ldflags="-pie $ldflags" 317634005a00SKirill A. Shutemovfi 317734005a00SKirill A. Shutemov 3178471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3179471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3180471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 318125be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3182471857ddSJuan Quintelafi 3183471857ddSJuan Quintela 3184d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 318525be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3186d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3187d02c1db3SJuan Quintela cflags="-p $cflags" 3188d02c1db3SJuan Quintela ldflags="-p $ldflags" 3189d02c1db3SJuan Quintela fi 3190d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3191d02c1db3SJuan Quintela ldflags="-p $ldflags" 319225be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3193d02c1db3SJuan Quintela fi 3194d02c1db3SJuan Quintelafi 3195d02c1db3SJuan Quintela 31966ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 31979b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3198fa282484SJuan Quintela case "$ARCH" in 3199fa282484SJuan Quintela sparc) 3200fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3201322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3202fa282484SJuan Quintela ;; 32034d58be06SRichard Henderson alpha | s390x) 32044d58be06SRichard Henderson # The default placement of the application is fine. 32054d58be06SRichard Henderson ;; 3206fd76e73aSRichard Henderson *) 3207322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3208fa282484SJuan Quintela ;; 3209fa282484SJuan Quintela esac 3210fa282484SJuan Quintelafi 3211fa282484SJuan Quintela 321225be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 321325be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3214fa282484SJuan Quintela 321597a847bcSbellarddone # for target in $targets 32167d13299dSbellard 32177d13299dSbellard# build tree in object directory if source path is different from current one 32187d13299dSbellardif test "$source_path_used" = "yes" ; then 3219e1144d00SMark McLoughlin DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 32202d9f27d2SAnthony Liguori DIRS="$DIRS roms/seabios roms/vgabios" 32213e230dd2SCorentin Chary DIRS="$DIRS fsdev ui" 32227d13299dSbellard FILES="Makefile tests/Makefile" 3223e7daa605Sths FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 3224e1ffb0f1Sedgar_igl FILES="$FILES tests/test-mmap.c" 3225ae0bfb79SBlue Swirl FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 32262d9f27d2SAnthony Liguori FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 32277ea78b74SJan Kiszka for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 32287ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 32297ea78b74SJan Kiszka done 32307d13299dSbellard for dir in $DIRS ; do 32317d13299dSbellard mkdir -p $dir 32327d13299dSbellard done 3233ec530c81Sbellard # remove the link and recreate it, as not all "ln -sf" overwrite the link 32347d13299dSbellard for f in $FILES ; do 3235ec530c81Sbellard rm -f $f 3236ec530c81Sbellard ln -s $source_path/$f $f 32377d13299dSbellard done 32387d13299dSbellardfi 32391ad2134fSPaul Brook 3240c34ebfdcSAnthony Liguori# temporary config to build submodules 32412d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3242c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 324337116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3244c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3245c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3246c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3247c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3248c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3249c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3250c34ebfdcSAnthony Liguori echo "HOST_CC=$host_cc" >> $config_mak 3251c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3252c34ebfdcSAnthony Liguoridone 3253c34ebfdcSAnthony Liguori 32541ad2134fSPaul Brookfor hwlib in 32 64; do 32551ad2134fSPaul Brook d=libhw$hwlib 32561ad2134fSPaul Brook mkdir -p $d 32579953b2fcSBlue Swirl mkdir -p $d/ide 32581ad2134fSPaul Brook rm -f $d/Makefile 32591ad2134fSPaul Brook ln -s $source_path/Makefile.hw $d/Makefile 326037116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 32611ad2134fSPaul Brookdone 3262add16157SBlue Swirl 3263add16157SBlue Swirld=libuser 3264add16157SBlue Swirlmkdir -p $d 3265add16157SBlue Swirlrm -f $d/Makefile 3266add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile 3267299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 3268299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 3269299060a0SKirill A. Shutemovfi 3270b40292e7SJan Kiszka 3271b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3272b40292e7SJan Kiszka mkdir -p QMP 3273b40292e7SJan Kiszkafi 3274